From d5130f25418e367b53cd015891b7d743211f3370 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 1 Nov 2021 02:16:29 +0100 Subject: [PATCH] Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop FIX #19013 --- htdocs/adherents/card.php | 14 ++--- htdocs/ticket/card.php | 85 +++++++++++++++------------- htdocs/ticket/class/ticket.class.php | 19 +++++-- 3 files changed, 68 insertions(+), 50 deletions(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index cf0d82b2c7b..5b53437a212 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1788,13 +1788,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; - // Birth Date - print ''; - - // Public - print ''; - - // Categories + // Tags / Categories if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) { print ''; print ''; } + // Birth Date + print ''; + + // Public + print ''; + // Other attributes include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 581ca8601e8..3dbd1ad8aa7 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -618,7 +618,7 @@ if (empty($reshook)) { if ($ret > 0) { $log_action = $langs->trans('TicketInitialMessageModified')." \n"; // include the Diff class - dol_include_once('/ticket/class/utils_diff.class.php'); + include_once DOL_DOCUMENT_ROOT.'/core/class/utils_diff.class.php'; // output the result of comparing two files as plain text $log_action .= Diff::toString(Diff::compare(strip_tags($oldvalue_message), strip_tags($object->message))); @@ -1048,11 +1048,11 @@ if ($action == 'create' || $action == 'presend') { print '
'.$langs->trans("DateOfBirth").''.dol_print_date($object->birth, 'day').'
'.$langs->trans("Public").''.yn($object->public).'
'.$langs->trans("Categories").''; @@ -1802,6 +1796,12 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print '
'.$langs->trans("DateOfBirth").''.dol_print_date($object->birth, 'day').'
'.$langs->trans("Public").''.yn($object->public).'
'; + print '
'; print $langs->trans("AssignedTo"); if ($object->fk_statut < $object::STATUS_CLOSED && GETPOST('set', 'alpha') != "assign_ticket" && $user->rights->ticket->manage) { - print ''.img_edit($langs->trans('Modify'), '').''.img_edit($langs->trans('Modify'), '').''; } - print '
'; + print ''; print ''; - if ($object->fk_user_assign > 0) { + if (GETPOST('set', 'alpha') != "assign_ticket" && $object->fk_user_assign > 0) { $userstat->fetch($object->fk_user_assign); print $userstat->getNomUrl(-1); } @@ -1063,30 +1063,30 @@ if ($action == 'create' || $action == 'presend') { print ''; print ''; print ''; - print ' '; + //print ' '; print $form->select_dolusers($user->id, 'fk_user_assign', 1); - print ' '; + print ' '; print ''; } print ''; // Progression print ''; - print ''; // Timing (Duration sum of linked fichinter) - if ($conf->ficheinter->enabled) { + if (!empty($conf->ficheinter->enabled)) { $object->fetchObjectLinked(); $num = count($object->linkedObjects); $timing = 0; + $foundinter = 0; if ($num) { foreach ($object->linkedObjects as $objecttype => $objects) { if ($objecttype = "fichinter") { foreach ($objects as $fichinter) { + $foundinter++; $timing += $fichinter->duration; } } } } - print ''; } + // Other attributes + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; + + print '
'; + print ''; if ($action != 'progression' && $object->fk_statut < $object::STATUS_CLOSED && !$user->socid) { print ''; } print '
'; print $langs->trans('Progression').''; print ''.img_edit($langs->trans('Modify')).'
'; - print '
'; + print ''; if ($user->rights->ticket->write && $action == 'progression') { print '
'; print ''; print ''; print ''; - print ''; - print ' '; + print ''; + print ' '; print '
'; } else { print($object->progress > 0 ? $object->progress : '0').'%'; @@ -1095,32 +1095,53 @@ if ($action == 'create' || $action == 'presend') { print '
'; - + print '
'; print $form->textwithpicto($langs->trans("TicketDurationAuto"), $langs->trans("TicketDurationAutoInfos"), 1); print ''; - print convertSecondToTime($timing, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY); + print $foundinter ? convertSecondToTime($timing, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY) : ''; print '
'; + + + // Fin colonne gauche et début colonne droite + print '
'; + + print '
'; + print ''; + print ''; + print ''; + + print '
'; + // Categories if ($conf->categorie->enabled) { + print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table + + print ''; + print ''; - print '
'; - print '
'; + print ''; + print ''; @@ -1130,7 +1151,7 @@ if ($action == 'create' || $action == 'presend') { if ($user->rights->ticket->write && $action == 'categories') { $cate_arbo = $form->select_all_categories(Categorie::TYPE_TICKET, '', 'parent', 64, 0, 1); - if (count($cate_arbo)) { + if (is_array($cate_arbo)) { // Categories print '"; } @@ -1155,27 +1176,15 @@ if ($action == 'create' || $action == 'presend') { print $form->showCategories($object->id, Categorie::TYPE_TICKET, 1); print ""; } + + print '
'; print $langs->trans("Categories"); if ($action != 'categories' && !$user->socid) { print ''.img_edit($langs->trans('Modify')).''; print ''; @@ -1146,7 +1167,7 @@ if ($action == 'create' || $action == 'presend') { } print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0); - print ''; + print ''; print ''; print "
'; } - // Other attributes - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; - - print '
'; - - - // Fin colonne gauche et début colonne droite - print '
'; - // View Original message $actionobject->viewTicketOriginalMessage($user, $action, $object); // Classification of ticket - print '
'; - print ''; - print ''; - print ''; - print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table print ''; print ''; @@ -1184,11 +1193,11 @@ if ($action == 'create' || $action == 'presend') { print ''; print ''; @@ -1198,7 +1207,7 @@ if ($action == 'create' || $action == 'presend') { print ''; // Type print ''; @@ -1206,15 +1215,15 @@ if ($action == 'create' || $action == 'presend') { // Group print ''; print ''; print ''; // Severity print ''; print ''; diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index ed134296e76..2265bb2fb66 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1258,12 +1258,12 @@ class Ticket extends CommonObject /** * Return status label of object * - * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto - * @return string Label + * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto + * @return string Label */ public function getLibStatut($mode = 0) { - return $this->libStatut($this->fk_statut, $mode); + return $this->libStatut($this->fk_statut, $mode, 0, $this->progress); } @@ -1274,9 +1274,10 @@ class Ticket extends CommonObject * @param string $status Id status * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @param int $notooltip 1=No tooltip + * @param int $progress Progression (0 to 100) * @return string Label */ - public function LibStatut($status, $mode = 0, $notooltip = 0) + public function LibStatut($status, $mode = 0, $notooltip = 0, $progress = 0) { // phpcs:enable global $langs; @@ -1312,7 +1313,15 @@ class Ticket extends CommonObject $params = array('tooltip' => 'no'); } - return dolGetStatus($langs->transnoentitiesnoconv($labelStatus), $langs->transnoentitiesnoconv($labelStatusShort), '', $statusType, $mode, '', $params); + $labelStatus = $langs->transnoentitiesnoconv($labelStatus); + $labelStatusShort = $langs->transnoentitiesnoconv($labelStatusShort); + + if ($status == self::STATUS_IN_PROGRESS && $progress > 0) { + $labelStatus .= ' ('.round($progress).'%)'; + $labelStatusShort .= ' ('.round($progress).'%)'; + } + + return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode, '', $params); }
'; if (GETPOST('set', 'alpha') == 'properties' && $user->rights->ticket->write) { - print ''; + print ''; } else { // Button to edit Properties if ($object->fk_statut < $object::STATUS_NEED_MORE_INFO && $user->rights->ticket->write) { - print ''.img_edit($langs->trans('Modify')).''; + print ' '.img_edit($langs->trans('Modify')).''; } } print '
'; - print $langs->trans('TicketChangeType'); + print $langs->trans('Type'); print ''; $formticket->selectTypesTickets($object->type_code, 'update_value_type', '', 2); print '
'; - print $langs->trans('TicketChangeCategory'); + print $langs->trans('TicketCategory'); print ''; - $formticket->selectGroupTickets($object->category_code, 'update_value_category', '', 2); + $formticket->selectGroupTickets($object->category_code, 'update_value_category', '', 2, 0, 0, 0, 'maxwidth500'); print '
'; - print $langs->trans('TicketChangeSeverity'); + print $langs->trans('TicketSeverity'); print ''; $formticket->selectSeveritiesTickets($object->severity_code, 'update_value_severity', '', 2); print '