Clean code for kanban view

This commit is contained in:
Laurent Destailleur 2022-03-31 18:06:39 +02:00
parent e10f9b4435
commit 867883e9b1
4 changed files with 485 additions and 396 deletions

View File

@ -257,7 +257,7 @@ $form = new Form($db);
$now = dol_now(); $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 = ''; $help_url = '';
$title = $langs->trans('ListOf', $langs->transnoentitiesnoconv("MyObjects")); $title = $langs->trans('ListOf', $langs->transnoentitiesnoconv("MyObjects"));
$morejs = array(); $morejs = array();
@ -675,7 +675,7 @@ while ($i < $imaxinloop) {
} else { } else {
// Show here line of result // Show here line of result
$j = 0; $j = 0;
print '<tr class="oddeven">'; print '<tr data-rowid="'.$object->id.'" class="oddeven">';
foreach ($object->fields as $key => $val) { foreach ($object->fields as $key => $val) {
$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {

View File

@ -41,6 +41,7 @@ $show_files = GETPOST('show_files', 'int');
$confirm = GETPOST('confirm', 'alpha'); $confirm = GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array'); $toselect = GETPOST('toselect', 'array');
$optioncss = GETPOST('optioncss', 'aZ09'); $optioncss = GETPOST('optioncss', 'aZ09');
$mode = GETPOST('mode', 'aZ');
$id = GETPOST('id', 'int'); $id = GETPOST('id', 'int');
@ -118,9 +119,10 @@ $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $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; $page = 0;
} // If $page is not defined, or '' or -1 }
$offset = $limit * $page; $offset = $limit * $page;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $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'); $object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position');
$permissiontoread = $user->rights->projet->lire;
$permissiontodelete = $user->rights->projet->supprimer;
/* /*
* Actions * Actions
*/ */
if (GETPOST('cancel', 'alpha')) { if (GETPOST('cancel', 'alpha')) {
$action = 'list'; $massaction = ''; $action = 'list';
$massaction = '';
} }
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') { if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') {
$massaction = ''; $massaction = '';
@ -224,15 +230,13 @@ if (empty($reshook)) {
$search_datelimit_endyear = ''; $search_datelimit_endyear = '';
$search_datelimit_start = ''; $search_datelimit_start = '';
$search_datelimit_end = ''; $search_datelimit_end = '';
$toselect = ''; $toselect = array();
$search_array_options = array(); $search_array_options = array();
} }
// Mass actions // Mass actions
$objectclass = 'Task'; $objectclass = 'Task';
$objectlabel = 'Tasks'; $objectlabel = 'Tasks';
$permissiontoread = $user->rights->projet->lire;
$permissiontodelete = $user->rights->projet->supprimer;
$uploaddir = $conf->projet->dir_output.'/tasks'; $uploaddir = $conf->projet->dir_output.'/tasks';
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
} }
@ -248,8 +252,14 @@ if (empty($search_projectstatus) && $search_projectstatus == '') {
* View * View
*/ */
$now = dol_now();
$form = new Form($db); $form = new Form($db);
$now = dol_now();
$help_url = "EN:Module_Projects|FR:Module_Projets|ES:M&oacute;dulo_Proyectos";
$morejs = array();
$morecss = array();
$formother = new FormOther($db); $formother = new FormOther($db);
$socstatic = new Societe($db); $socstatic = new Societe($db);
$projectstatic = new Project($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'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
// Add where from hooks // Add where from hooks
$parameters = array(); $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; $sql .= $hookmanager->resPrint;
if (!empty($arrayfields['t.tobill']['checked']) || !empty($arrayfields['t.billed']['checked'])) { 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,"; $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); $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) { if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all) {
$obj = $db->fetch_object($resql); $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'); header("Location: ".DOL_URL_ROOT.'/projet/tasks/task.php?id='.$id.'&withproject=1');
exit; exit;
} }
$help_url = "EN:Module_Projects|FR:Module_Projets|ES:M&oacute;dulo_Proyectos";
llxHeader("", $title, $help_url); // Output page
// --------------------------------------------------------------------
llxHeader('', $title, $help_url);
$arrayofselected = is_array($toselect) ? $toselect : array();
$param = ''; $param = '';
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
@ -581,6 +596,10 @@ if ($optioncss != '') {
} }
// Add $param from extra fields // Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; 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 // List of mass actions available
$arrayofmassactions = array( $arrayofmassactions = array(
@ -588,17 +607,17 @@ $arrayofmassactions = array(
// 'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), // 'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
); );
//if($user->rights->societe->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer"); //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"); $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(); $arrayofmassactions = array();
} }
$massactionbutton = $form->selectMassAction('', $arrayofmassactions); $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); $newcardbutton = dolGetButtonTitle($langs->trans('NewTask'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/projet/tasks.php?action=create', '', $user->rights->projet->creer);
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
if ($optioncss != '') { if ($optioncss != '') {
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
} }
@ -686,6 +705,8 @@ if ($massactionbutton) {
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'" id="tablelines3">'."\n"; print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'" id="tablelines3">'."\n";
// Fields title search
// --------------------------------------------------------------------
print '<tr class="liste_titre_filter">'; print '<tr class="liste_titre_filter">';
if (!empty($arrayfields['t.fk_task_parent']['checked'])) { if (!empty($arrayfields['t.fk_task_parent']['checked'])) {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
@ -792,7 +813,7 @@ if (!empty($arrayfields['t.billed']['checked'])) {
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
// Fields from hook // Fields from hook
$parameters = array('arrayfields'=>$arrayfields); $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; print $hookmanager->resPrint;
if (!empty($arrayfields['t.datec']['checked'])) { if (!empty($arrayfields['t.datec']['checked'])) {
// Date creation // Date creation
@ -809,63 +830,8 @@ print '<td class="liste_titre maxwidthsearch">';
$searchpicto = $form->showFilterButtons(); $searchpicto = $form->showFilterButtons();
print $searchpicto; print $searchpicto;
print '</td>'; print '</td>';
print "</tr>\n"; print '</tr>'."\n";
print '<tr class="liste_titre">';
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( $totalarray = array(
'nbfield' => 0, 'nbfield' => 0,
'val' => array( 'val' => array(
@ -884,6 +850,82 @@ $totalarray = array(
'totaltobill' => 0, 'totaltobill' => 0,
'totalbilled' => 0, 'totalbilled' => 0,
); );
// Fields title label
// --------------------------------------------------------------------
print '<tr class="liste_titre">';
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 // Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields // Hook fields
@ -898,13 +940,15 @@ $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // No
print $hookmanager->resPrint; print $hookmanager->resPrint;
if (!empty($arrayfields['t.datec']['checked'])) { if (!empty($arrayfields['t.datec']['checked'])) {
print_liste_field_titre($arrayfields['t.datec']['label'], $_SERVER["PHP_SELF"], "t.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap '); 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'])) { if (!empty($arrayfields['t.tms']['checked'])) {
print_liste_field_titre($arrayfields['t.tms']['label'], $_SERVER["PHP_SELF"], "t.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap '); 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_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
print "</tr>\n"; $totalarray['nbfield']++;
print '</tr>'."\n";
$plannedworkloadoutputformat = 'allhourmin'; $plannedworkloadoutputformat = 'allhourmin';
$timespentoutputformat = 'allhourmin'; $timespentoutputformat = 'allhourmin';
@ -915,10 +959,19 @@ if (!empty($conf->global->PROJECT_TIMES_SPENT_FORMAT)) {
$timespentoutputformat = $conf->global->PROJECT_TIME_SPENT_FORMAT; $timespentoutputformat = $conf->global->PROJECT_TIME_SPENT_FORMAT;
} }
// Loop on record
// --------------------------------------------------------------------
$i = 0; $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); $obj = $db->fetch_object($resql);
if (empty($obj)) {
break; // Should not happen
}
// Store properties in $object
$object->id = $obj->id; $object->id = $obj->id;
$object->ref = $obj->ref; $object->ref = $obj->ref;
$object->label = $obj->label; $object->label = $obj->label;
@ -932,7 +985,6 @@ while ($i < min($num, $limit)) {
$object->duration_effective = $obj->duration_effective; $object->duration_effective = $obj->duration_effective;
$object->fk_task_parent = $obj->fk_task_parent; $object->fk_task_parent = $obj->fk_task_parent;
$projectstatic->id = $obj->projectid; $projectstatic->id = $obj->projectid;
$projectstatic->ref = $obj->projectref; $projectstatic->ref = $obj->projectref;
$projectstatic->title = $obj->projecttitle; $projectstatic->title = $obj->projecttitle;
@ -940,6 +992,18 @@ while ($i < min($num, $limit)) {
$projectstatic->statut = $obj->projectstatus; $projectstatic->statut = $obj->projectstatus;
$projectstatic->datee = $db->jdate($obj->projectdatee); $projectstatic->datee = $db->jdate($obj->projectdatee);
if ($mode == 'kanban') {
if ($i == 0) {
print '<tr><td colspan="'.$savnbfield.'">';
print '<div class="box-flex-container">';
}
// Output Kanban
print $object->getKanbanView('');
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';
}
} else {
$userAccess = $projectstatic->restrictedProjectArea($user); // why this ? $userAccess = $projectstatic->restrictedProjectArea($user); // why this ?
if ($userAccess >= 0) { if ($userAccess >= 0) {
print '<tr data-rowid="'.$object->id.'" class="oddeven">'; print '<tr data-rowid="'.$object->id.'" class="oddeven">';
@ -1168,6 +1232,7 @@ while ($i < min($num, $limit)) {
if (!empty($arrayfields['t.budget_amount']['checked'])) { if (!empty($arrayfields['t.budget_amount']['checked'])) {
print '<td class="center">'; print '<td class="center">';
print price($object->budget_amount, 0, $langs, 1, 0, 0, $conf->currency); print price($object->budget_amount, 0, $langs, 1, 0, 0, $conf->currency);
print '</td>';
if (!$i) { if (!$i) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
} }
@ -1179,7 +1244,6 @@ while ($i < min($num, $limit)) {
$totalarray['totalbudget_amountfield'] = $totalarray['nbfield']; $totalarray['totalbudget_amountfield'] = $totalarray['nbfield'];
} }
$totalarray['totalbudgetamount'] += $obj->budget_amount; $totalarray['totalbudgetamount'] += $obj->budget_amount;
print '</td>';
} }
// Time not billed // Time not billed
if (!empty($arrayfields['t.tobill']['checked'])) { if (!empty($arrayfields['t.tobill']['checked'])) {
@ -1257,24 +1321,26 @@ while ($i < min($num, $limit)) {
print '<td class="nowrap center">'; print '<td class="nowrap center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined 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; $selected = 0;
if (in_array($obj->id, $arrayofselected)) { if (in_array($object->id, $arrayofselected)) {
$selected = 1; $selected = 1;
} }
print '<input id="cb'.$obj->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.'"'.($selected ? ' checked="checked"' : '').'>'; print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
} }
print '</td>'; print '</td>';
if (!$i) { if (!$i) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
} }
print "</tr>\n"; print '</tr>'."\n";
}
} }
$i++; $i++;
} }
// Show total line // Show total line
if (isset($totalarray['totaldurationeffectivefield']) || isset($totalarray['totalplannedworkloadfield']) || isset($totalarray['totalprogress_calculatedfield']) 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 '<tr class="liste_total">'; print '<tr class="liste_total">';
$i = 0; $i = 0;
while ($i < $totalarray['nbfield']) { while ($i < $totalarray['nbfield']) {
@ -1308,14 +1374,14 @@ if (isset($totalarray['totaldurationeffectivefield']) || isset($totalarray['tota
$db->free($resql); $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 $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
print "</table>"; print '</table>'."\n";
print '</div>'; print '</div>'."\n";
print '</form>'; print '</form>'."\n";
// End of page // End of page
llxFooter(); llxFooter();

View File

@ -6475,6 +6475,17 @@ dd.dropdowndd ul li {
white-space: nowrap; white-space: nowrap;
} }
/* ============================================================================== */
/* Kanban */
/* ============================================================================== */
.info-box-label {
max-width: 180px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* ============================================================================== */ /* ============================================================================== */
/* Markdown rendering */ /* Markdown rendering */

View File

@ -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 */ /* Markdown rendering */
/* ============================================================================== */ /* ============================================================================== */