From 5d811a8c73c17e870f866d0660883ded1d3b134a Mon Sep 17 00:00:00 2001 From: MaximilienR-easya <122890855+MaximilienR-easya@users.noreply.github.com> Date: Thu, 18 Jul 2024 18:56:07 +0200 Subject: [PATCH] Finished event end time (#30123) * Add when you set to finished an event, it set to now the end time if it is undefined * Fix comment --- htdocs/comm/action/card.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 8b70bb73c80..96e6f47f360 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -776,6 +776,8 @@ if (empty($reshook) && $action == 'update') { $datep = dol_mktime(GETPOST("aphour", 'int'), GETPOST("apmin", 'int'), GETPOST("apsec", 'int'), GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), 'tzuserrel'); $datef = dol_mktime(GETPOST("p2hour", 'int'), GETPOST("p2min", 'int'), GETPOST("apsec", 'int'), GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), 'tzuserrel'); } + //set end date to now if percentage is set to 100 and end date not set + $datef = (!$datef && $percentage == 100)?dol_now():$datef; if ($object->elementtype == 'ticket') { // code should be TICKET_MSG, TICKET_MSG_PRIVATE, TICKET_MSG_SENTBYMAIL, TICKET_MSG_PRIVATE_SENTBYMAIL if ($private) { @@ -834,12 +836,6 @@ if (empty($reshook) && $action == 'update') { } } - if (!$datef && $percentage == 100) { - $error++; - $donotclearsession = 1; - setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("DateEnd")), $object->errors, 'errors'); - $action = 'edit'; - } $transparency = (GETPOST("transparency") == 'on' ? 1 : 0);