From 867883e9b163bb695848981ad02faa573e71d7a7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 31 Mar 2022 18:06:39 +0200 Subject: [PATCH] Clean code for kanban view --- .../modulebuilder/template/myobject_list.php | 4 +- htdocs/projet/tasks/list.php | 854 ++++++++++-------- htdocs/theme/eldy/global.inc.php | 11 + htdocs/theme/md/style.css.php | 12 + 4 files changed, 485 insertions(+), 396 deletions(-) diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 040dc074be1..0ecd42bda26 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -257,7 +257,7 @@ $form = new Form($db); $now = dol_now(); -//$help_url="EN:Module_MyObject|FR:Module_MyObject_FR|ES:Módulo_MyObject"; +//$help_url = "EN:Module_MyObject|FR:Module_MyObject_FR|ES:Módulo_MyObject"; $help_url = ''; $title = $langs->trans('ListOf', $langs->transnoentitiesnoconv("MyObjects")); $morejs = array(); @@ -675,7 +675,7 @@ while ($i < $imaxinloop) { } else { // Show here line of result $j = 0; - print ''; + print ''; foreach ($object->fields as $key => $val) { $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 697969c6060..d71cd9bca56 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -41,6 +41,7 @@ $show_files = GETPOST('show_files', 'int'); $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); $optioncss = GETPOST('optioncss', 'aZ09'); +$mode = GETPOST('mode', 'aZ'); $id = GETPOST('id', 'int'); @@ -118,9 +119,10 @@ $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); -if (empty($page) || $page == -1) { +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; -} // If $page is not defined, or '' or -1 +} $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; @@ -171,13 +173,17 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); +$permissiontoread = $user->rights->projet->lire; +$permissiontodelete = $user->rights->projet->supprimer; + /* * Actions */ if (GETPOST('cancel', 'alpha')) { - $action = 'list'; $massaction = ''; + $action = 'list'; + $massaction = ''; } if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') { $massaction = ''; @@ -224,15 +230,13 @@ if (empty($reshook)) { $search_datelimit_endyear = ''; $search_datelimit_start = ''; $search_datelimit_end = ''; - $toselect = ''; + $toselect = array(); $search_array_options = array(); } // Mass actions $objectclass = 'Task'; $objectlabel = 'Tasks'; - $permissiontoread = $user->rights->projet->lire; - $permissiontodelete = $user->rights->projet->supprimer; $uploaddir = $conf->projet->dir_output.'/tasks'; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } @@ -248,8 +252,14 @@ if (empty($search_projectstatus) && $search_projectstatus == '') { * View */ -$now = dol_now(); $form = new Form($db); + +$now = dol_now(); + +$help_url = "EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos"; +$morejs = array(); +$morecss = array(); + $formother = new FormOther($db); $socstatic = new Societe($db); $projectstatic = new Project($db); @@ -435,7 +445,7 @@ if ($search_task_user > 0) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; // Add where from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; if (!empty($arrayfields['t.tobill']['checked']) || !empty($arrayfields['t.billed']['checked'])) { $sql .= " GROUP BY p.rowid, p.ref, p.title, p.fk_statut, p.datee, p.fk_opp_status, p.public, p.fk_user_creat,"; @@ -476,17 +486,22 @@ if (!$resql) { $num = $db->num_rows($resql); -$arrayofselected = is_array($toselect) ? $toselect : array(); +// Direct jump if only one record found if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all) { $obj = $db->fetch_object($resql); - $id = $obj->id; + $id = $obj->id; // in select, task id has been aliases into 'id' header("Location: ".DOL_URL_ROOT.'/projet/tasks/task.php?id='.$id.'&withproject=1'); exit; } -$help_url = "EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos"; -llxHeader("", $title, $help_url); + +// Output page +// -------------------------------------------------------------------- + +llxHeader('', $title, $help_url); + +$arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { @@ -581,6 +596,10 @@ if ($optioncss != '') { } // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; +// Add $param from hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook +$param .= $hookmanager->resPrint; // List of mass actions available $arrayofmassactions = array( @@ -588,17 +607,17 @@ $arrayofmassactions = array( // 'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), ); //if($user->rights->societe->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer"); -if ($user->rights->societe->supprimer) { +if ($permissiontodelete) { $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); } -if (in_array($massaction, array('presend', 'predelete'))) { +if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) { $arrayofmassactions = array(); } $massactionbutton = $form->selectMassAction('', $arrayofmassactions); $newcardbutton = dolGetButtonTitle($langs->trans('NewTask'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/projet/tasks.php?action=create', '', $user->rights->projet->creer); -print '
'; +print ''."\n"; if ($optioncss != '') { print ''; } @@ -686,6 +705,8 @@ if ($massactionbutton) { print '
'; print ''."\n"; +// Fields title search +// -------------------------------------------------------------------- print ''; if (!empty($arrayfields['t.fk_task_parent']['checked'])) { print ''; -print "\n"; +print ''."\n"; -print ''; -if (!empty($arrayfields['t.fk_task_parent']['checked'])) { - print_liste_field_titre($arrayfields['t.fk_task_parent']['label'], $_SERVER["PHP_SELF"], "t.fk_task_parent", "", $param, "", $sortfield, $sortorder); -} -if (!empty($arrayfields['t.ref']['checked'])) { - print_liste_field_titre($arrayfields['t.ref']['label'], $_SERVER["PHP_SELF"], "t.ref", "", $param, "", $sortfield, $sortorder); -} -if (!empty($arrayfields['t.label']['checked'])) { - print_liste_field_titre($arrayfields['t.label']['label'], $_SERVER["PHP_SELF"], "t.label", "", $param, "", $sortfield, $sortorder); -} -if (!empty($arrayfields['t.description']['checked'])) { - print_liste_field_titre($arrayfields['t.description']['label'], $_SERVER["PHP_SELF"], "t.description", "", $param, "", $sortfield, $sortorder); -} -if (!empty($arrayfields['t.dateo']['checked'])) { - print_liste_field_titre($arrayfields['t.dateo']['label'], $_SERVER["PHP_SELF"], "t.dateo", "", $param, '', $sortfield, $sortorder, 'center '); -} -if (!empty($arrayfields['t.datee']['checked'])) { - print_liste_field_titre($arrayfields['t.datee']['label'], $_SERVER["PHP_SELF"], "t.datee", "", $param, '', $sortfield, $sortorder, 'center '); -} -if (!empty($arrayfields['p.ref']['checked'])) { - print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], "p.ref", "", $param, "", $sortfield, $sortorder); -} -if (!empty($arrayfields['p.title']['checked'])) { - print_liste_field_titre($arrayfields['p.title']['label'], $_SERVER["PHP_SELF"], "p.title", "", $param, "", $sortfield, $sortorder); -} -if (!empty($arrayfields['s.nom']['checked'])) { - print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, "", $sortfield, $sortorder); -} -if (!empty($arrayfields['p.fk_statut']['checked'])) { - print_liste_field_titre($arrayfields['p.fk_statut']['label'], $_SERVER["PHP_SELF"], "p.fk_statut", "", $param, '', $sortfield, $sortorder, 'center '); -} -if (!empty($arrayfields['t.planned_workload']['checked'])) { - print_liste_field_titre($arrayfields['t.planned_workload']['label'], $_SERVER["PHP_SELF"], "t.planned_workload", "", $param, '', $sortfield, $sortorder, 'center '); -} -if (!empty($arrayfields['t.duration_effective']['checked'])) { - print_liste_field_titre($arrayfields['t.duration_effective']['label'], $_SERVER["PHP_SELF"], "t.duration_effective", "", $param, '', $sortfield, $sortorder, 'center '); -} -if (!empty($arrayfields['t.progress_calculated']['checked'])) { - print_liste_field_titre($arrayfields['t.progress_calculated']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', '', '', 'center '); -} -if (!empty($arrayfields['t.progress']['checked'])) { - print_liste_field_titre($arrayfields['t.progress']['label'], $_SERVER["PHP_SELF"], "t.progress", "", $param, '', $sortfield, $sortorder, 'center '); -} -if (!empty($arrayfields['t.progress_summary']['checked'])) { - print_liste_field_titre($arrayfields['t.progress_summary']['label'], $_SERVER["PHP_SELF"], "t.progress", "", $param, '', $sortfield, $sortorder, 'center '); -} -if (!empty($arrayfields['t.budget_amount']['checked'])) { - print_liste_field_titre($arrayfields['t.budget_amount']['label'], $_SERVER["PHP_SELF"], "t.budget_amount", "", $param, '', $sortfield, $sortorder, 'center '); -} -if (!empty($arrayfields['t.tobill']['checked'])) { - print_liste_field_titre($arrayfields['t.tobill']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'center '); -} -if (!empty($arrayfields['t.billed']['checked'])) { - print_liste_field_titre($arrayfields['t.billed']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'center '); -} $totalarray = array( 'nbfield' => 0, 'val' => array( @@ -884,6 +850,82 @@ $totalarray = array( 'totaltobill' => 0, 'totalbilled' => 0, ); + +// Fields title label +// -------------------------------------------------------------------- +print ''; +if (!empty($arrayfields['t.fk_task_parent']['checked'])) { + print_liste_field_titre($arrayfields['t.fk_task_parent']['label'], $_SERVER["PHP_SELF"], "t.fk_task_parent", "", $param, "", $sortfield, $sortorder); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['t.ref']['checked'])) { + print_liste_field_titre($arrayfields['t.ref']['label'], $_SERVER["PHP_SELF"], "t.ref", "", $param, "", $sortfield, $sortorder); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['t.label']['checked'])) { + print_liste_field_titre($arrayfields['t.label']['label'], $_SERVER["PHP_SELF"], "t.label", "", $param, "", $sortfield, $sortorder); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['t.description']['checked'])) { + print_liste_field_titre($arrayfields['t.description']['label'], $_SERVER["PHP_SELF"], "t.description", "", $param, "", $sortfield, $sortorder); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['t.dateo']['checked'])) { + print_liste_field_titre($arrayfields['t.dateo']['label'], $_SERVER["PHP_SELF"], "t.dateo", "", $param, '', $sortfield, $sortorder, 'center '); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['t.datee']['checked'])) { + print_liste_field_titre($arrayfields['t.datee']['label'], $_SERVER["PHP_SELF"], "t.datee", "", $param, '', $sortfield, $sortorder, 'center '); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['p.ref']['checked'])) { + print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], "p.ref", "", $param, "", $sortfield, $sortorder); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['p.title']['checked'])) { + print_liste_field_titre($arrayfields['p.title']['label'], $_SERVER["PHP_SELF"], "p.title", "", $param, "", $sortfield, $sortorder); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['s.nom']['checked'])) { + print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, "", $sortfield, $sortorder); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['p.fk_statut']['checked'])) { + print_liste_field_titre($arrayfields['p.fk_statut']['label'], $_SERVER["PHP_SELF"], "p.fk_statut", "", $param, '', $sortfield, $sortorder, 'center '); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['t.planned_workload']['checked'])) { + print_liste_field_titre($arrayfields['t.planned_workload']['label'], $_SERVER["PHP_SELF"], "t.planned_workload", "", $param, '', $sortfield, $sortorder, 'center '); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['t.duration_effective']['checked'])) { + print_liste_field_titre($arrayfields['t.duration_effective']['label'], $_SERVER["PHP_SELF"], "t.duration_effective", "", $param, '', $sortfield, $sortorder, 'center '); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['t.progress_calculated']['checked'])) { + print_liste_field_titre($arrayfields['t.progress_calculated']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', '', '', 'center '); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['t.progress']['checked'])) { + print_liste_field_titre($arrayfields['t.progress']['label'], $_SERVER["PHP_SELF"], "t.progress", "", $param, '', $sortfield, $sortorder, 'center '); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['t.progress_summary']['checked'])) { + print_liste_field_titre($arrayfields['t.progress_summary']['label'], $_SERVER["PHP_SELF"], "t.progress", "", $param, '', $sortfield, $sortorder, 'center '); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['t.budget_amount']['checked'])) { + print_liste_field_titre($arrayfields['t.budget_amount']['label'], $_SERVER["PHP_SELF"], "t.budget_amount", "", $param, '', $sortfield, $sortorder, 'center '); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['t.tobill']['checked'])) { + print_liste_field_titre($arrayfields['t.tobill']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'center '); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['t.billed']['checked'])) { + print_liste_field_titre($arrayfields['t.billed']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'center '); + $totalarray['nbfield']++; +} // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields @@ -898,13 +940,15 @@ $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // No print $hookmanager->resPrint; if (!empty($arrayfields['t.datec']['checked'])) { print_liste_field_titre($arrayfields['t.datec']['label'], $_SERVER["PHP_SELF"], "t.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap '); + $totalarray['nbfield']++; } if (!empty($arrayfields['t.tms']['checked'])) { print_liste_field_titre($arrayfields['t.tms']['label'], $_SERVER["PHP_SELF"], "t.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap '); + $totalarray['nbfield']++; } print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); -print "\n"; - +$totalarray['nbfield']++; +print ''."\n"; $plannedworkloadoutputformat = 'allhourmin'; $timespentoutputformat = 'allhourmin'; @@ -915,10 +959,19 @@ if (!empty($conf->global->PROJECT_TIMES_SPENT_FORMAT)) { $timespentoutputformat = $conf->global->PROJECT_TIME_SPENT_FORMAT; } +// Loop on record +// -------------------------------------------------------------------- $i = 0; -while ($i < min($num, $limit)) { +$savnbfield = $totalarray['nbfield']; +$totalarray['nbfield'] = 0; +$imaxinloop = ($limit ? min($num, $limit) : $num); +while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); + if (empty($obj)) { + break; // Should not happen + } + // Store properties in $object $object->id = $obj->id; $object->ref = $obj->ref; $object->label = $obj->label; @@ -932,7 +985,6 @@ while ($i < min($num, $limit)) { $object->duration_effective = $obj->duration_effective; $object->fk_task_parent = $obj->fk_task_parent; - $projectstatic->id = $obj->projectid; $projectstatic->ref = $obj->projectref; $projectstatic->title = $obj->projecttitle; @@ -940,341 +992,355 @@ while ($i < min($num, $limit)) { $projectstatic->statut = $obj->projectstatus; $projectstatic->datee = $db->jdate($obj->projectdatee); - $userAccess = $projectstatic->restrictedProjectArea($user); // why this ? - if ($userAccess >= 0) { - print ''; + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + } + } else { + $userAccess = $projectstatic->restrictedProjectArea($user); // why this ? + if ($userAccess >= 0) { + print ''; - // Ref Parent - if (!empty($arrayfields['t.fk_task_parent']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Ref - if (!empty($arrayfields['t.ref']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Label - if (!empty($arrayfields['t.label']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Description - if (!empty($arrayfields['t.description']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date start - if (!empty($arrayfields['t.dateo']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date end - if (!empty($arrayfields['t.datee']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Project ref - if (!empty($arrayfields['p.ref']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Project title - if (!empty($arrayfields['p.title']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Third party - if (!empty($arrayfields['s.nom']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Project status - if (!empty($arrayfields['p.fk_statut']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Planned workload - if (!empty($arrayfields['t.planned_workload']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 't.planned_workload'; - } - $totalarray['val']['t.planned_workload'] += $obj->planned_workload; - if (!$i) { - $totalarray['totalplannedworkloadfield'] = $totalarray['nbfield']; - } - $totalarray['totalplannedworkload'] += $obj->planned_workload; - } - // Time spent - if (!empty($arrayfields['t.duration_effective']['checked'])) { - $showlineingray = 0; $showproject = 1; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 't.duration_effective'; - } - $totalarray['val']['t.duration_effective'] += $obj->duration_effective; - if (!$i) { - $totalarray['totaldurationeffectivefield'] = $totalarray['nbfield']; - } - $totalarray['totaldurationeffective'] += $obj->duration_effective; - } - // Calculated progress - if (!empty($arrayfields['t.progress_calculated']['checked'])) { - print ''; + if (!$i) { + $totalarray['nbfield']++; } } - print ''; - if (!$i) { - $totalarray['nbfield']++; + // Ref + if (!empty($arrayfields['t.ref']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } - if (!$i) { - $totalarray['totalprogress_calculatedfield'] = $totalarray['nbfield']; + // Label + if (!empty($arrayfields['t.label']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } - } - // Declared progress - if (!empty($arrayfields['t.progress']['checked'])) { - print ''; + if (!$i) { + $totalarray['nbfield']++; + } } - print ''; - if (!$i) { - $totalarray['nbfield']++; + // Date start + if (!empty($arrayfields['t.dateo']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 't.progress'; + // Date end + if (!empty($arrayfields['t.datee']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } - $totalarray['val']['t.progress'] += ($obj->planned_workload * $obj->progress / 100); - if (!$i) { - $totalarray['totalprogress_declaredfield'] = $totalarray['nbfield']; + // Project ref + if (!empty($arrayfields['p.ref']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } - $totalarray['totaldurationdeclared'] += $obj->planned_workload * $obj->progress / 100; - } - // Progress summary - if (!empty($arrayfields['t.progress_summary']['checked'])) { - print ''; + if (!$i) { + $totalarray['nbfield']++; + } } - print ''; - if (!$i) { - $totalarray['nbfield']++; + // Third party + if (!empty($arrayfields['s.nom']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } - if (!$i) { - $totalarray['totalprogress_summary'] = $totalarray['nbfield']; + // Project status + if (!empty($arrayfields['p.fk_statut']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } - } - if (!empty($arrayfields['t.budget_amount']['checked'])) { - print ''; - } - // Time not billed - if (!empty($arrayfields['t.tobill']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 't.tobill'; - } - if (!$i) { - $totalarray['totaltobillfield'] = $totalarray['nbfield']; - } - } - // Time billed - if (!empty($arrayfields['t.billed']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 't.billed'; - } - if (!$i) { - $totalarray['totalbilledfield'] = $totalarray['nbfield']; - } - } - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; - // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - // Date creation - if (!empty($arrayfields['t.datec']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date modification - if (!empty($arrayfields['t.tms']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Status - /*if (! empty($arrayfields['p.fk_statut']['checked'])) - { - $projectstatic->statut = $obj->fk_statut; - print ''; - }*/ - // Action column - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - print "\n"; + // Planned workload + if (!empty($arrayfields['t.planned_workload']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 't.planned_workload'; + } + $totalarray['val']['t.planned_workload'] += $obj->planned_workload; + if (!$i) { + $totalarray['totalplannedworkloadfield'] = $totalarray['nbfield']; + } + $totalarray['totalplannedworkload'] += $obj->planned_workload; + } + // Time spent + if (!empty($arrayfields['t.duration_effective']['checked'])) { + $showlineingray = 0; $showproject = 1; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 't.duration_effective'; + } + $totalarray['val']['t.duration_effective'] += $obj->duration_effective; + if (!$i) { + $totalarray['totaldurationeffectivefield'] = $totalarray['nbfield']; + } + $totalarray['totaldurationeffective'] += $obj->duration_effective; + } + // Calculated progress + if (!empty($arrayfields['t.progress_calculated']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['totalprogress_calculatedfield'] = $totalarray['nbfield']; + } + } + // Declared progress + if (!empty($arrayfields['t.progress']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 't.progress'; + } + $totalarray['val']['t.progress'] += ($obj->planned_workload * $obj->progress / 100); + if (!$i) { + $totalarray['totalprogress_declaredfield'] = $totalarray['nbfield']; + } + $totalarray['totaldurationdeclared'] += $obj->planned_workload * $obj->progress / 100; + } + // Progress summary + if (!empty($arrayfields['t.progress_summary']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['totalprogress_summary'] = $totalarray['nbfield']; + } + } + if (!empty($arrayfields['t.budget_amount']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 't.budget_amount'; + } + $totalarray['val']['t.budget_amount'] += $obj->budget_amount; + if (!$i) { + $totalarray['totalbudget_amountfield'] = $totalarray['nbfield']; + } + $totalarray['totalbudgetamount'] += $obj->budget_amount; + } + // Time not billed + if (!empty($arrayfields['t.tobill']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 't.tobill'; + } + if (!$i) { + $totalarray['totaltobillfield'] = $totalarray['nbfield']; + } + } + // Time billed + if (!empty($arrayfields['t.billed']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 't.billed'; + } + if (!$i) { + $totalarray['totalbilledfield'] = $totalarray['nbfield']; + } + } + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + // Fields from hook + $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Date creation + if (!empty($arrayfields['t.datec']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Date modification + if (!empty($arrayfields['t.tms']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Status + /*if (! empty($arrayfields['p.fk_statut']['checked'])) + { + $projectstatic->statut = $obj->fk_statut; + print ''; + }*/ + // Action column + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + + print ''."\n"; + } } $i++; } + // Show total line if (isset($totalarray['totaldurationeffectivefield']) || isset($totalarray['totalplannedworkloadfield']) || isset($totalarray['totalprogress_calculatedfield']) - || isset($totalarray['totaltobill']) || isset($totalarray['totalbilled'])) { + || isset($totalarray['totaltobill']) || isset($totalarray['totalbilled']) || isset($totalarray['totalbudget'])) { print ''; $i = 0; while ($i < $totalarray['nbfield']) { @@ -1308,14 +1374,14 @@ if (isset($totalarray['totaldurationeffectivefield']) || isset($totalarray['tota $db->free($resql); -$parameters = array('sql' => $sql); +$parameters = array('arrayfields'=>$arrayfields, 'sql' => $sql); $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; -print "
'; @@ -792,7 +813,7 @@ if (!empty($arrayfields['t.billed']['checked'])) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Fields from hook $parameters = array('arrayfields'=>$arrayfields); -$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (!empty($arrayfields['t.datec']['checked'])) { // Date creation @@ -809,63 +830,8 @@ print ''; $searchpicto = $form->showFilterButtons(); print $searchpicto; print '
'; + print '
'; + } + // Output Kanban + print $object->getKanbanView(''); + if ($i == ($imaxinloop - 1)) { + print '
'; + print '
'; - if (!empty($object->fk_task_parent)) { - $object_parent = new Task($db); - $result = $object_parent->fetch($object->fk_task_parent); - if ($result < 0) { - setEventMessage($object_parent->error, 'errors'); - } else { - print $object_parent->getNomUrl(1, 'withproject'); - if ($object_parent->hasDelay()) { - print img_warning("Late"); + // Ref Parent + if (!empty($arrayfields['t.fk_task_parent']['checked'])) { + print ''; + if (!empty($object->fk_task_parent)) { + $object_parent = new Task($db); + $result = $object_parent->fetch($object->fk_task_parent); + if ($result < 0) { + setEventMessage($object_parent->error, 'errors'); + } else { + print $object_parent->getNomUrl(1, 'withproject'); + if ($object_parent->hasDelay()) { + print img_warning("Late"); + } } } - } - print ''; - print $object->getNomUrl(1, 'withproject'); - if ($object->hasDelay()) { - print img_warning("Late"); - } - print ''; - print dol_escape_htmltag($object->label); - print ''; - print dol_escape_htmltag($object->description); - print ''; - print dol_print_date($db->jdate($obj->date_start), 'day'); - print ''; - print dol_print_date($db->jdate($obj->date_end), 'day'); - print ''; - print $projectstatic->getNomUrl(1, 'task'); - if ($projectstatic->hasDelay()) { - print img_warning("Late"); - } - print ''; - print dol_trunc($obj->projecttitle, 80); - print ''; - if ($obj->socid) { - $socstatic->id = $obj->socid; - $socstatic->name = $obj->name; - print $socstatic->getNomUrl(1); - } else { - print ' '; - } - print ''; - print $projectstatic->getLibStatut(1); - print ''; - $fullhour = convertSecondToTime($obj->planned_workload, $plannedworkloadoutputformat); - $workingdelay = convertSecondToTime($obj->planned_workload, 'all', 86400, 7); // TODO Replace 86400 and 7 to take account working hours per day and working day per weeks - if ($obj->planned_workload != '') { - print $fullhour; - // TODO Add delay taking account of working hours per day and working day per week - //if ($workingdelay != $fullhour) print '
('.$workingdelay.')'; - } - //else print '--:--'; - print '
'; - if ($showlineingray) { - print ''; - } else { - print ''; - } - if ($obj->duration_effective) { - print convertSecondToTime($obj->duration_effective, $timespentoutputformat); - } else { - print '--:--'; - } - if ($showlineingray) { - print ''; - } else { - print ''; - } - print ''; - if ($obj->planned_workload || $obj->duration_effective) { - if ($obj->planned_workload) { - print round(100 * $obj->duration_effective / $obj->planned_workload, 2).' %'; - } else { - print $form->textwithpicto('', $langs->trans('WorkloadNotDefined'), 1, 'help'); + print ''; + print $object->getNomUrl(1, 'withproject'); + if ($object->hasDelay()) { + print img_warning("Late"); + } + print ''; + print dol_escape_htmltag($object->label); + print ''; - if ($obj->progress != '') { - print getTaskProgressBadge($object); + // Description + if (!empty($arrayfields['t.description']['checked'])) { + print ''; + print dol_escape_htmltag($object->description); + print ''; + print dol_print_date($db->jdate($obj->date_start), 'day'); + print ''; + print dol_print_date($db->jdate($obj->date_end), 'day'); + print ''; + print $projectstatic->getNomUrl(1, 'task'); + if ($projectstatic->hasDelay()) { + print img_warning("Late"); + } + print ''; - if ($obj->progress != '' && $obj->duration_effective) { - print getTaskProgressView($object, false, false); + // Project title + if (!empty($arrayfields['p.title']['checked'])) { + print ''; + print dol_trunc($obj->projecttitle, 80); + print ''; + if ($obj->socid) { + $socstatic->id = $obj->socid; + $socstatic->name = $obj->name; + print $socstatic->getNomUrl(1); + } else { + print ' '; + } + print ''; + print $projectstatic->getLibStatut(1); + print ''; - print price($object->budget_amount, 0, $langs, 1, 0, 0, $conf->currency); - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 't.budget_amount'; - } - $totalarray['val']['t.budget_amount'] += $obj->budget_amount; - if (!$i) { - $totalarray['totalbudget_amountfield'] = $totalarray['nbfield']; - } - $totalarray['totalbudgetamount'] += $obj->budget_amount; - print ''; - if ($obj->usage_bill_time) { - print convertSecondToTime($obj->tobill, 'allhourmin'); - $totalarray['val']['t.tobill'] += $obj->tobill; - $totalarray['totaltobill'] += $obj->tobill; - } else { - print ''.$langs->trans("NA").''; - } - print ''; - if ($obj->usage_bill_time) { - print convertSecondToTime($obj->billed, 'allhourmin'); - $totalarray['val']['t.billed'] += $obj->billed; - $totalarray['totalbilled'] += $obj->billed; - } else { - print ''.$langs->trans("NA").''; - } - print ''; - print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); - print ''; - print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); - print ''.$projectstatic->getLibStatut(5).''; - 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($obj->id, $arrayofselected)) { - $selected = 1; - } - print ''; - } - print '
'; + $fullhour = convertSecondToTime($obj->planned_workload, $plannedworkloadoutputformat); + $workingdelay = convertSecondToTime($obj->planned_workload, 'all', 86400, 7); // TODO Replace 86400 and 7 to take account working hours per day and working day per weeks + if ($obj->planned_workload != '') { + print $fullhour; + // TODO Add delay taking account of working hours per day and working day per week + //if ($workingdelay != $fullhour) print '
('.$workingdelay.')'; + } + //else print '--:--'; + print '
'; + if ($showlineingray) { + print ''; + } else { + print ''; + } + if ($obj->duration_effective) { + print convertSecondToTime($obj->duration_effective, $timespentoutputformat); + } else { + print '--:--'; + } + if ($showlineingray) { + print ''; + } else { + print ''; + } + print ''; + if ($obj->planned_workload || $obj->duration_effective) { + if ($obj->planned_workload) { + print round(100 * $obj->duration_effective / $obj->planned_workload, 2).' %'; + } else { + print $form->textwithpicto('', $langs->trans('WorkloadNotDefined'), 1, 'help'); + } + } + print ''; + if ($obj->progress != '') { + print getTaskProgressBadge($object); + } + print ''; + if ($obj->progress != '' && $obj->duration_effective) { + print getTaskProgressView($object, false, false); + } + print ''; + print price($object->budget_amount, 0, $langs, 1, 0, 0, $conf->currency); + print ''; + if ($obj->usage_bill_time) { + print convertSecondToTime($obj->tobill, 'allhourmin'); + $totalarray['val']['t.tobill'] += $obj->tobill; + $totalarray['totaltobill'] += $obj->tobill; + } else { + print ''.$langs->trans("NA").''; + } + print ''; + if ($obj->usage_bill_time) { + print convertSecondToTime($obj->billed, 'allhourmin'); + $totalarray['val']['t.billed'] += $obj->billed; + $totalarray['totalbilled'] += $obj->billed; + } else { + print ''.$langs->trans("NA").''; + } + print ''; + print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); + print ''; + print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); + print ''.$projectstatic->getLibStatut(5).''; + 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($object->id, $arrayofselected)) { + $selected = 1; + } + print ''; + } + print '
"; -print '
'; +print ''."\n"; +print ''."\n"; -print '
'; +print ''."\n"; // End of page llxFooter(); diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index bd37c650f2f..ba260737678 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -6475,6 +6475,17 @@ dd.dropdowndd ul li { white-space: nowrap; } +/* ============================================================================== */ +/* Kanban */ +/* ============================================================================== */ + +.info-box-label { + max-width: 180px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + /* ============================================================================== */ /* Markdown rendering */ diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 117bebe12ca..764b21bba77 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -6345,6 +6345,18 @@ dd.dropdowndd ul li { } +/* ============================================================================== */ +/* Kanban */ +/* ============================================================================== */ + +.info-box-label { + max-width: 180px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + + /* ============================================================================== */ /* Markdown rendering */ /* ============================================================================== */