mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-07 18:18:18 +01:00
Better detail for time elapsed
This commit is contained in:
@@ -7637,3 +7637,15 @@ function isVisibleToUserType($type_user, &$menuentry, &$listofmodulesforexternal
|
|||||||
if (! $menuentry['perms']) return 2; // No permissions and user is external
|
if (! $menuentry['perms']) return 2; // No permissions and user is external
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Round to next multiple.
|
||||||
|
*
|
||||||
|
* @param double $n Number to round up
|
||||||
|
* @param integer $x Multiple. For example 60 to round up to nearest exact minute for a date with seconds.
|
||||||
|
* @return integer Value rounded.
|
||||||
|
*/
|
||||||
|
function roundUpToNextMultiple($n, $x=5)
|
||||||
|
{
|
||||||
|
return (ceil($n)%$x === 0) ? ceil($n) : round(($n+$x/2)/$x)*$x;
|
||||||
|
}
|
||||||
|
|||||||
@@ -198,7 +198,8 @@ TicketMessageMailSignatureLabelAdmin=Signature of response email
|
|||||||
TicketMessageMailSignatureHelpAdmin=This text will be inserted after the response message.
|
TicketMessageMailSignatureHelpAdmin=This text will be inserted after the response message.
|
||||||
TicketMessageHelp=Only this text will be saved in the message list on ticket card.
|
TicketMessageHelp=Only this text will be saved in the message list on ticket card.
|
||||||
TicketMessageSubstitutionReplacedByGenericValues=Substitutions variables are replaced by generic values.
|
TicketMessageSubstitutionReplacedByGenericValues=Substitutions variables are replaced by generic values.
|
||||||
TicketTimeToRead=Time elapsed before ticket read
|
TimeElapsedSince=Time elapsed since
|
||||||
|
TicketTimeToRead=Time elapsed before read
|
||||||
TicketContacts=Contacts ticket
|
TicketContacts=Contacts ticket
|
||||||
TicketDocumentsLinked=Documents linked to ticket
|
TicketDocumentsLinked=Documents linked to ticket
|
||||||
ConfirmReOpenTicket=Confirm reopen this ticket ?
|
ConfirmReOpenTicket=Confirm reopen this ticket ?
|
||||||
|
|||||||
@@ -82,6 +82,8 @@ $permissiontoadd = $user->rights->ticket->write;
|
|||||||
|
|
||||||
$actionobject = new ActionsTicket($db);
|
$actionobject = new ActionsTicket($db);
|
||||||
|
|
||||||
|
$now = dol_now();
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
@@ -364,26 +366,23 @@ if ($action == 'view' || $action == 'add_message' || $action == 'close' || $acti
|
|||||||
// Creation date
|
// Creation date
|
||||||
print '<tr><td>' . $langs->trans("DateCreation") . '</td><td>';
|
print '<tr><td>' . $langs->trans("DateCreation") . '</td><td>';
|
||||||
print dol_print_date($object->datec, 'dayhour');
|
print dol_print_date($object->datec, 'dayhour');
|
||||||
|
print ' - '.$langs->trans("TimeElapsedSince").': '.'<i>'.convertSecondToTime(roundUpToNextMultiple($now - $object->datec, 60)).'</i>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Read date
|
// Read date
|
||||||
|
print '<tr><td>' . $langs->trans("TicketReadOn") . '</td><td>';
|
||||||
if (!empty($object->date_read)) {
|
if (!empty($object->date_read)) {
|
||||||
print '<tr><td>' . $langs->trans("TicketReadOn") . '</td><td>';
|
print dol_print_date($object->date_read, 'dayhour');
|
||||||
print dol_print_date($object->date_read, 'dayhour');
|
print ' - '.$langs->trans("TicketTimeToRead").': <i>'.convertSecondToTime(roundUpToNextMultiple($object->date_read - $object->datec, 60)).'</i>';
|
||||||
print '</td></tr>';
|
print ' - '.$langs->trans("TimeElapsedSince").': '.'<i>'.convertSecondToTime(roundUpToNextMultiple($now - $object->date_read, 60)).'</i>';
|
||||||
|
|
||||||
print '<tr><td>' . $langs->trans("TicketTimeToRead") . '</td><td>';
|
|
||||||
print '<strong>' . convertSecondToTime($object->date_read - $object->datec) . '</strong>';
|
|
||||||
print '</td></tr>';
|
|
||||||
}
|
}
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
// Close date
|
// Close date
|
||||||
|
print '<tr><td>' . $langs->trans("TicketCloseOn") . '</td><td>';
|
||||||
if (!empty($object->date_close)) {
|
if (!empty($object->date_close)) {
|
||||||
print '<tr><td>' . $langs->trans("TicketCloseOn") . '</td><td>';
|
print dol_print_date($object->date_close, 'dayhour');
|
||||||
print dol_print_date($object->date_close, 'dayhour');
|
|
||||||
print '</td></tr>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Thirdparty
|
// Thirdparty
|
||||||
@@ -453,25 +452,28 @@ if ($action == 'view' || $action == 'add_message' || $action == 'close' || $acti
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Timing (Duration sum of linked fichinter
|
// Timing (Duration sum of linked fichinter)
|
||||||
$object->fetchObjectLinked();
|
if ($conf->fichinter->enabled)
|
||||||
$num = count($object->linkedObjects);
|
{
|
||||||
$timing = 0;
|
$object->fetchObjectLinked();
|
||||||
if ($num) {
|
$num = count($object->linkedObjects);
|
||||||
foreach ($object->linkedObjects as $objecttype => $objects) {
|
$timing = 0;
|
||||||
if ($objecttype = "fichinter") {
|
if ($num) {
|
||||||
foreach ($objects as $fichinter) {
|
foreach ($object->linkedObjects as $objecttype => $objects) {
|
||||||
$timing += $fichinter->duration;
|
if ($objecttype = "fichinter") {
|
||||||
}
|
foreach ($objects as $fichinter) {
|
||||||
}
|
$timing += $fichinter->duration;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print '<tr><td valign="top">';
|
}
|
||||||
|
}
|
||||||
|
print '<tr><td valign="top">';
|
||||||
|
|
||||||
print $form->textwithpicto($langs->trans("TicketDurationAuto"), $langs->trans("TicketDurationAutoInfos"), 1);
|
print $form->textwithpicto($langs->trans("TicketDurationAuto"), $langs->trans("TicketDurationAutoInfos"), 1);
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
print convertSecondToTime($timing, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY);
|
print convertSecondToTime($timing, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
// Other attributes
|
// Other attributes
|
||||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
||||||
|
|||||||
Reference in New Issue
Block a user