From 7f73d92dc8e7a918b5cc5372ded39bddd2be2a1d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 6 Jan 2026 10:25:39 +0100 Subject: [PATCH] Fix select of product and last date in list of time spent --- htdocs/langs/en_US/main.lang | 2 + htdocs/projet/tasks/time.php | 73 +++++++++++++++++++++--------------- 2 files changed, 44 insertions(+), 31 deletions(-) diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 86dacafb387..c7daa5bb7ec 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -891,6 +891,8 @@ MyDashboard=My Dashboard Deductible=Deductible from=from toward=toward +fromhour=from +tohour=to Access=Access SelectAction=Select action SelectTargetUser=Select target user/employee diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 41dc7e38ed8..d23391436ef 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -1309,10 +1309,12 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser } $arrayfields['author'] = array('label' => $langs->trans("By"), 'checked' => '1'); $arrayfields['t.note'] = array('label' => $langs->trans("Note"), 'checked' => '1'); + $arrayfields['t.tms'] = array('label' => $langs->trans("DateModification"), 'checked' => '0'); if (isModEnabled('service') && !empty($projectstatic->thirdparty) && $projectstatic->thirdparty->id > 0 && $projectstatic->usage_bill_time) { $arrayfields['t.fk_product'] = array('label' => $langs->trans("Product"), 'checked' => '1'); } $arrayfields['t.element_duration'] = array('label' => $langs->trans("Duration"), 'checked' => '1'); + $arrayfields['t.fk_product'] = array('label' => $langs->trans("Product"), 'checked' => '0', 'enabled' => (string) (int) (((getDolGlobalInt('PROJECT_HIDE_TASKS') || !getDolGlobalInt('PROJECT_BILL_TIME_SPENT')) ? 0 : 1) && $projectstatic->usage_bill_time)); $arrayfields['value'] = array('label' => $langs->trans("Value"), 'checked' => '1', 'enabled' => (string) (int) isModEnabled("salaries")); $arrayfields['valuebilled'] = array('label' => $langs->trans("Billed"), 'checked' => '1', 'enabled' => (string) (int) (((getDolGlobalInt('PROJECT_HIDE_TASKS') || !getDolGlobalInt('PROJECT_BILL_TIME_SPENT')) ? 0 : 1) && $projectstatic->usage_bill_time)); // Extra fields @@ -1600,7 +1602,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser } $sql = "SELECT t.rowid, t.fk_element, t.element_date, t.element_datehour, t.element_date_withhour, t.element_duration, t.fk_user, t.note, t.thm,"; - $sql .= " t.fk_product, t.import_key, t.datec, t.tms"; + $sql .= " t.fk_product, t.import_key, t.datec, t.tms,"; $sql .= " pt.rowid as taskid, pt.ref, pt.label, pt.fk_projet,"; $sql .= " u.lastname, u.firstname, u.login, u.photo, u.gender, u.statut as user_status,"; $sql .= " il.fk_facture as invoice_id, inv.fk_statut,"; @@ -1998,6 +2000,10 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser if (!empty($arrayfields['t.note']['checked'])) { print ''; } + // Last modification + if (!empty($arrayfields['t.tms']['checked'])) { + print ''; + } // Duration if (!empty($arrayfields['t.element_duration']['checked'])) { // Duration - Time spent @@ -2007,7 +2013,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser if ($search_timespent_starthour || $search_timespent_startmin) { $durationtouse_start = ($search_timespent_starthour * 3600 + $search_timespent_startmin * 60); } - print '
' . $langs->trans('from') . ' '; + print '
' . $langs->trans('fromhour') . ' '; print $form->select_duration('search_timespent_duration_start', $durationtouse_start, 0, 'text', 0, 1); print '
'; @@ -2015,7 +2021,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser if ($search_timespent_endhour || $search_timespent_endmin) { $durationtouse_end = ($search_timespent_endhour * 3600 + $search_timespent_endmin * 60); } - print '
' . $langs->trans('to') . ' '; + print '
' . $langs->trans('tohour') . ' '; print $form->select_duration('search_timespent_duration_end', $durationtouse_end, 0, 'text', 0, 1); print '
'; @@ -2023,11 +2029,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser } // Product if (!empty($arrayfields['t.fk_product']['checked'])) { - print ''; - } - // Last modification - if (!empty($arrayfields['t.tms']['checked'])) { - print ''; + print ''; } // Value in main currency if (!empty($arrayfields['value']['checked'])) { @@ -2107,6 +2109,10 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser print_liste_field_titre($arrayfields['t.note']['label'], $_SERVER['PHP_SELF'], 't.note', '', $param, '', $sortfield, $sortorder); $totalarray['nbfield']++; } + if (!empty($arrayfields['t.tms']['checked'])) { + print_liste_field_titre($arrayfields['t.tms']['label'], $_SERVER['PHP_SELF'], 't.tms', '', $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; + } if (!empty($arrayfields['t.element_duration']['checked'])) { print_liste_field_titre($arrayfields['t.element_duration']['label'], $_SERVER['PHP_SELF'], 't.element_duration', '', $param, '', $sortfield, $sortorder, 'right '); $totalarray['nbfield']++; @@ -2115,10 +2121,6 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser print_liste_field_titre($arrayfields['t.fk_product']['label'], $_SERVER['PHP_SELF'], 't.fk_product', '', $param, '', $sortfield, $sortorder); $totalarray['nbfield']++; } - if (!empty($arrayfields['t.tms']['checked'])) { - print_liste_field_titre($arrayfields['t.tms']['label'], $_SERVER['PHP_SELF'], 't.tms', '', $param, '', $sortfield, $sortorder); - $totalarray['nbfield']++; - } if (!empty($arrayfields['value']['checked'])) { print_liste_field_titre($arrayfields['value']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'right '); @@ -2414,7 +2416,17 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser print ''; } - // Time spent + // Last modification + if (!empty($arrayfields['t.tms']['checked'])) { + print ''; + print dol_print_date($task_time->tms, 'dayhour'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Time spent - Duration if (!empty($arrayfields['t.element_duration']['checked'])) { print ''; if ($action == 'editline' && GETPOSTINT('lineid') == $task_time->rowid) { @@ -2466,13 +2478,6 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser } } - // Last modification - if (!empty($arrayfields['t.tms']['checked'])) { - print ''; - print dol_print_date($task_time->tms, 'dayhour'); - print ''; - } - // Value spent if (!empty($arrayfields['value']['checked'])) { $langs->load("salaries"); @@ -2504,7 +2509,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser } } - // Billed + // Value billed if (!empty($arrayfields['valuebilled']['checked'])) { print ''; // invoice_id and invoice_line_id if (!getDolGlobalString('PROJECT_HIDE_TASKS') && getDolGlobalString('PROJECT_BILL_TIME_SPENT')) { @@ -2718,7 +2723,13 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser print ''; } - // Time spent + // Last modification + if (!empty($arrayfields['t.tms']['checked'])) { + print ''; + print ''; + } + + // Time spent - duration if (!empty($arrayfields['t.element_duration']['checked'])) { print ''; if ($action == 'splitline' && GETPOSTINT('lineid') == $task_time->rowid) { @@ -2883,7 +2894,14 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser print ''; } - // Time spent + // Last modification + if (!empty($arrayfields['t.tms']['checked'])) { + print ''; + print dol_print_date($task_time->tms, 'dayhour'); + print ''; + } + + // Time spent - duration if (!empty($arrayfields['t.element_duration']['checked'])) { print ''; if ($action == 'splitline' && GETPOSTINT('lineid') == $task_time->rowid) { @@ -2901,14 +2919,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser print ''; } - // Last modification - if (!empty($arrayfields['t.tms']['checked'])) { - print ''; - print dol_print_date($task_time->tms, 'dayhour'); - print ''; - } - - // Value spent + // Value spent - duration if (!empty($arrayfields['value']['checked'])) { print ''; print '';