fix warnings in task list

This commit is contained in:
Frédéric FRANCE 2021-10-24 13:57:04 +02:00
parent 50df842417
commit 3765a89283
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1

View File

@ -67,8 +67,9 @@ $search_task_user = GETPOST('search_task_user', 'int');
$search_task_progress = GETPOST('search_task_progress');
$search_task_budget_amount = GETPOST('search_task_budget_amount');
$search_societe = GETPOST('search_societe');
$search_opp_status = GETPOST("search_opp_status", 'alpha');
$mine = $_REQUEST['mode'] == 'mine' ? 1 : 0;
$mine = (GETPOSTISSET('mode') && GETPOST('mode', 'alpha') == 'mine') ? 1 : 0;
if ($mine) {
$search_task_user = $user->id; $mine = 0;
}
@ -346,7 +347,7 @@ $sql .= ", ".MAIN_DB_PREFIX."projet_task as t";
if (!empty($arrayfields['t.tobill']['checked']) || !empty($arrayfields['t.billed']['checked'])) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task_time as tt ON tt.fk_task = t.rowid";
}
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
}
if ($search_project_user > 0) {
@ -864,7 +865,29 @@ if (!empty($arrayfields['t.billed']['checked'])) {
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
$totalarray = array();
$totalarray['nbfield'] = 0;
$totalarray['val'] = array();
$totalarray['val']['t.planned_workload'] = 0;
$totalarray['val']['t.duration_effective'] = 0;
$totalarray['val']['t.progress'] = 0;
$totalarray['val']['t.budget_amount'] = 0;
$totalarray['totalplannedworkload'] = 0;
$totalarray['totaldurationeffective'] = 0;
$totalarray['totaldurationdeclared'] = 0;
$totalarray['totaltobillfield'] = array();
$totalarray['totalbilledfield'] = 0;
$totalarray['totalbudget_amountfield'] = 0;
$totalarray['totalbudgetamount'] = 0;
$totalarray['totaltobill'] = 0;
$totalarray['totalbilled'] = 0;
$parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder,
'totalarray' => $totalarray,
);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (!empty($arrayfields['t.datec']['checked'])) {
@ -887,7 +910,6 @@ if (!empty($conf->global->PROJECT_TIMES_SPENT_FORMAT)) {
}
$i = 0;
$totalarray = array();
while ($i < min($num, $limit)) {
$obj = $db->fetch_object($resql);
@ -1148,7 +1170,7 @@ while ($i < min($num, $limit)) {
}
$totalarray['val']['t.budget_amount'] += $obj->budget_amount;
if (!$i) {
$totalarray['totalbudget_amount'] = $totalarray['nbfield'];
$totalarray['totalbudget_amountfield'] = $totalarray['nbfield'];
}
$totalarray['totalbudgetamount'] += $obj->budget_amount;
print '</td>';
@ -1269,7 +1291,7 @@ if (isset($totalarray['totaldurationeffectivefield']) || isset($totalarray['tota
print '<td class="center">'.convertSecondToTime($totalarray['totaltobill'], $plannedworkloadoutputformat).'</td>';
} elseif ($totalarray['totalbilledfield'] == $i) {
print '<td class="center">'.convertSecondToTime($totalarray['totalbilled'], $plannedworkloadoutputformat).'</td>';
} elseif ($totalarray['totalbudget_amount'] == $i) {
} elseif ($totalarray['totalbudget_amountfield'] == $i) {
print '<td class="center">'.price($totalarray['totalbudgetamount'], 0, $langs, 1, 0, 0, $conf->currency).'</td>';
} else {
print '<td></td>';