From 4168f0be01bfdb1533fc73390db91b97fbbdfa05 Mon Sep 17 00:00:00 2001 From: Faustin Date: Tue, 31 Jan 2023 12:11:37 +0100 Subject: [PATCH] checkbox colum on left for task/time.php list --- htdocs/projet/tasks/time.php | 122 +++++++++++++++++++++++++---------- 1 file changed, 87 insertions(+), 35 deletions(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 3c8597cd862..2ab70190722 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -1855,7 +1855,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser } $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; - $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields $selectedfields .= (is_array($arrayofmassactions) && count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); print '
'; @@ -1863,6 +1863,13 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser // Fields title search print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + $searchpicto = $form->showFilterButtons('left'); + print $searchpicto; + print ''; + } // Date if (!empty($arrayfields['t.task_date']['checked'])) { print ''; @@ -1954,13 +1961,18 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column - print ''; - $searchpicto = $form->showFilterButtons(); - print $searchpicto; - print ''; + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + $searchpicto = $form->showFilterButtons(); + print $searchpicto; + print ''; + } print ''."\n"; print ''; + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'width="80"', $sortfield, $sortorder, 'center maxwidthsearch '); + } if (!empty($arrayfields['t.task_date']['checked'])) { print_liste_field_titre($arrayfields['t.task_date']['label'], $_SERVER['PHP_SELF'], 't.task_date,t.task_datehour,t.rowid', '', $param, '', $sortfield, $sortorder); } @@ -2014,7 +2026,9 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'width="80"', $sortfield, $sortorder, 'center maxwidthsearch '); + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'width="80"', $sortfield, $sortorder, 'center maxwidthsearch '); + } print "\n"; $tasktmp = new Task($db); @@ -2035,6 +2049,42 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if (($action == 'editline' || $action == 'splitline') && GETPOST('lineid', 'int') == $task_time->rowid) { + print ''; + print ''; + print ' '; + print ''; + } elseif ($user->hasRight('projet', 'time') || $user->hasRight('projet', 'all', 'creer')) { // Read project and enter time consumed on assigned tasks + if (in_array($task_time->fk_user, $childids) || $user->hasRight('projet', 'all', 'creer')) { + if (getDolGlobalString('MAIN_FEATURES_LEVEL') >= 2) { + print ' '; + print 'rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">'; + print img_split('', 'class="pictofixedwidth"'); + print ''; + } + + print 'rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">'; + print img_edit('default', 0, 'class="pictofixedwidth paddingleft"'); + print ''; + + print 'rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">'; + print img_delete('default', 'class="pictodelete paddingleft"'); + print ''; + + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($task_time->rowid, $arrayofselected)) { + $selected = 1; + } + print ' '; + print ''; + } + } + } + } // Date if (!empty($arrayfields['t.task_date']['checked'])) { print ''; @@ -2318,36 +2368,38 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser print $hookmanager->resPrint; // Action column - print ''; - if (($action == 'editline' || $action == 'splitline') && GETPOST('lineid', 'int') == $task_time->rowid) { - print ''; - print ''; - print ' '; - print ''; - } elseif ($user->hasRight('projet', 'time') || $user->hasRight('projet', 'all', 'creer')) { // Read project and enter time consumed on assigned tasks - if (in_array($task_time->fk_user, $childids) || $user->hasRight('projet', 'all', 'creer')) { - if (getDolGlobalString('MAIN_FEATURES_LEVEL') >= 2) { - print ' '; - print 'rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">'; - print img_split('', 'class="pictofixedwidth"'); - print ''; - } - - print 'rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">'; - print img_edit('default', 0, 'class="pictofixedwidth paddingleft"'); - print ''; - - print 'rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">'; - print img_delete('default', 'class="pictodelete paddingleft"'); - print ''; - - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($task_time->rowid, $arrayofselected)) { - $selected = 1; + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if (($action == 'editline' || $action == 'splitline') && GETPOST('lineid', 'int') == $task_time->rowid) { + print ''; + print ''; + print ' '; + print ''; + } elseif ($user->hasRight('projet', 'time') || $user->hasRight('projet', 'all', 'creer')) { // Read project and enter time consumed on assigned tasks + if (in_array($task_time->fk_user, $childids) || $user->hasRight('projet', 'all', 'creer')) { + if (getDolGlobalString('MAIN_FEATURES_LEVEL') >= 2) { + print ' '; + print 'rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">'; + print img_split('', 'class="pictofixedwidth"'); + print ''; + } + + print 'rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">'; + print img_edit('default', 0, 'class="pictofixedwidth paddingleft"'); + print ''; + + print 'rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">'; + print img_delete('default', 'class="pictodelete paddingleft"'); + print ''; + + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($task_time->rowid, $arrayofselected)) { + $selected = 1; + } + print ' '; + print ''; } - print ' '; - print ''; } } }