From 3b87aadc4863a9e4b04e668160cbf333ed87db91 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 16 Dec 2022 12:59:47 +0100 Subject: [PATCH] Debug v17 --- htdocs/bom/bom_list.php | 2 +- .../modulebuilder/template/myobject_list.php | 2 +- htdocs/mrp/mo_list.php | 2 +- htdocs/product/list.php | 4 +-- htdocs/projet/activity/perday.php | 2 +- htdocs/projet/activity/permonth.php | 2 +- htdocs/projet/activity/perweek.php | 2 +- htdocs/projet/list.php | 18 +++++++++-- htdocs/projet/tasks/time.php | 30 ++++++++++++++----- htdocs/reception/list.php | 4 +-- htdocs/societe/list.php | 2 +- 11 files changed, 49 insertions(+), 21 deletions(-) diff --git a/htdocs/bom/bom_list.php b/htdocs/bom/bom_list.php index 337ff51c3ef..b9b20c64d1f 100644 --- a/htdocs/bom/bom_list.php +++ b/htdocs/bom/bom_list.php @@ -555,7 +555,7 @@ foreach ($object->fields as $key => $val) { if (!empty($arrayfields['t.'.$key]['checked'])) { print ''; if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) { - print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1); + print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100'.($key == 'status' ? ' search_status onrightofpage' : ''), 1); } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) { print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', 'maxwidth125', 1); } elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) { diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 06ad9a298ec..29c9205b1f0 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -572,7 +572,7 @@ foreach ($object->fields as $key => $val) { if (!empty($arrayfields['t.'.$key]['checked'])) { print ''; if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) { - print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1); + print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100'.($key == 'status' ? ' search_status onrightofpage' : ''), 1); } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) { print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth250', 1); } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) { diff --git a/htdocs/mrp/mo_list.php b/htdocs/mrp/mo_list.php index 723e4a76853..1a00a2dc052 100644 --- a/htdocs/mrp/mo_list.php +++ b/htdocs/mrp/mo_list.php @@ -123,7 +123,7 @@ foreach ($object->fields as $key => $val) { $visible = (int) dol_eval($val['visible'], 1); $arrayfields['t.'.$key] = array( 'label'=>$val['label'], - 'checked'=>(($visible < 0) ? 0 : 1), + 'checked'=>(($visible <= 0) ? 0 : 1), 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)), 'position'=>$val['position'], 'help'=> isset($val['help']) ? $val['help'] : '' diff --git a/htdocs/product/list.php b/htdocs/product/list.php index da17d702820..14d43e038f1 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -1143,12 +1143,12 @@ if (!empty($arrayfields['p.tms']['checked'])) { } if (!empty($arrayfields['p.tosell']['checked'])) { print ''; - print $form->selectarray('search_tosell', array('0'=>$langs->trans('ProductStatusNotOnSellShort'), '1'=>$langs->trans('ProductStatusOnSellShort')), $search_tosell, 1); + print $form->selectarray('search_tosell', array('0'=>$langs->trans('ProductStatusNotOnSellShort'), '1'=>$langs->trans('ProductStatusOnSellShort')), $search_tosell, 1, 0, 0, '', 0, 0, 0, '', 'search_status width100 onrightofpage'); print ''; } if (!empty($arrayfields['p.tobuy']['checked'])) { print ''; - print $form->selectarray('search_tobuy', array('0'=>$langs->trans('ProductStatusNotOnBuyShort'), '1'=>$langs->trans('ProductStatusOnBuyShort')), $search_tobuy, 1); + print $form->selectarray('search_tobuy', array('0'=>$langs->trans('ProductStatusNotOnBuyShort'), '1'=>$langs->trans('ProductStatusOnBuyShort')), $search_tobuy, 1, 0, 0, '', 0, 0, 0, '', 'search_status width100 onrightofpage'); print ''; } if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php index 14b98b82581..2e322ac2c3f 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -485,7 +485,7 @@ $formproject->selectTasks($socid ? $socid : -1, $taskid, 'taskid', 32, 0, '-- '. print ''; print ' '; print $formcompany->selectTypeContact($object, '', 'type', 'internal', 'rowid', 0, 'maxwidth150onsmartphone'); -print ''; +print ''; print ''; print '
'; diff --git a/htdocs/projet/activity/permonth.php b/htdocs/projet/activity/permonth.php index 49849b362ba..c013c07c23a 100644 --- a/htdocs/projet/activity/permonth.php +++ b/htdocs/projet/activity/permonth.php @@ -397,7 +397,7 @@ $formproject->selectTasks($socid ? $socid : -1, $taskid, 'taskid', 32, 0, '-- '. print ''; print ' '; print $formcompany->selectTypeContact($object, '', 'type', 'internal', 'rowid', 0, 'maxwidth150onsmartphone'); -print ''; +print ''; print ''; print '
'; diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index 7177f35e71c..d41dcc39494 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -498,7 +498,7 @@ $formproject->selectTasks($socid ? $socid : -1, $taskid, 'taskid', 32, 0, '-- '. print ''; print ' '; print $formcompany->selectTypeContact($object, '', 'type', 'internal', 'rowid', 0, 'maxwidth150onsmartphone'); -print ''; +print ''; print ''; print '
'; diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 994f4024b52..12b58799b5d 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -1542,7 +1542,11 @@ while ($i < $imaxinloop) { //if ($obj->opp_status_code) if (strcmp($obj->opp_amount, '')) { print ''.price($obj->opp_amount, 1, $langs, 1, -1, -1, '').''; - $totalarray['val']['p.opp_amount'] += $obj->opp_amount; + if (empty($totalarray['val']['p.opp_amount'])) { + $totalarray['val']['p.opp_amount'] = $obj->opp_amount; + } else { + $totalarray['val']['p.opp_amount'] += $obj->opp_amount; + } } print ''; if (!$i) { @@ -1571,7 +1575,11 @@ while ($i < $imaxinloop) { print ''; if ($obj->opp_weighted_amount) { print ''.price($obj->opp_weighted_amount, 1, $langs, 1, -1, -1, '').''; - $totalarray['val']['opp_weighted_amount'] += $obj->opp_weighted_amount; + if (empty($totalarray['val']['opp_weighted_amount'])) { + $totalarray['val']['opp_weighted_amount'] = $obj->opp_weighted_amount; + } else { + $totalarray['val']['opp_weighted_amount'] += $obj->opp_weighted_amount; + } } print ''; if (!$i) { @@ -1586,7 +1594,11 @@ while ($i < $imaxinloop) { print ''; if ($obj->budget_amount != '') { print ''.price($obj->budget_amount, 1, $langs, 1, -1, -1).''; - $totalarray['val']['p.budget_amount'] += $obj->budget_amount; + if (empty($totalarray['val']['p.budget_amount'])) { + $totalarray['val']['p.budget_amount'] = $obj->budget_amount; + } else { + $totalarray['val']['p.budget_amount'] += $obj->budget_amount; + } } print ''; if (!$i) { diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 27ccb40b4ed..ceddeedfd33 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -1239,7 +1239,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser } // Call Hook formConfirm - $parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid, "projectstatic" => $projectstatic, "withproject" => $withproject); + $parameters = array('formConfirm' => $formconfirm, "projectstatic" => $projectstatic, "withproject" => $withproject); $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if (empty($reshook)) { $formconfirm .= $hookmanager->resPrint; @@ -1265,7 +1265,7 @@ 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); - if ($conf->service->enabled && $projectstatic->thirdparty->id > 0 && $projectstatic->usage_bill_time) { + 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.task_duration'] = array('label'=>$langs->trans("Duration"), 'checked'=>1); @@ -1971,7 +1971,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser $total = 0; $totalvalue = 0; - $totalarray = array(); + $totalarray = array('nbfield'=>0); foreach ($tasks as $task_time) { if ($i >= $limit) { break; @@ -2168,11 +2168,19 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser if (!$i) { $totalarray['pos'][$totalarray['nbfield']] = 't.task_duration'; } - $totalarray['val']['t.task_duration'] += $task_time->task_duration; + if (empty($totalarray['val']['t.task_duration'])) { + $totalarray['val']['t.task_duration'] = $task_time->task_duration; + } else { + $totalarray['val']['t.task_duration'] += $task_time->task_duration; + } if (!$i) { $totalarray['totaldurationfield'] = $totalarray['nbfield']; } - $totalarray['totalduration'] += $task_time->task_duration; + if (empty($totalarray['totalduration'])) { + $totalarray['totalduration'] = $task_time->task_duration; + } else { + $totalarray['totalduration'] += $task_time->task_duration; + } } //Product @@ -2208,11 +2216,19 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser if (!$i) { $totalarray['pos'][$totalarray['nbfield']] = 'value'; } - $totalarray['val']['value'] += $value; + if (empty($totalarray['val']['value'])) { + $totalarray['val']['value'] = $value; + } else { + $totalarray['val']['value'] += $value; + } if (!$i) { $totalarray['totalvaluefield'] = $totalarray['nbfield']; } - $totalarray['totalvalue'] += $value; + if (empty($totalarray['totalvalue'])) { + $totalarray['totalvalue'] = $value; + } else { + $totalarray['totalvalue'] += $value; + } } // Invoiced diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index cac761023ef..d6e39e64eeb 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -927,7 +927,7 @@ if (!empty($arrayfields['e.date_delivery']['checked'])) { if (!empty($arrayfields['l.ref']['checked'])) { // Delivery ref print ''; - print ''; } if (!empty($arrayfields['l.date_delivery']['checked'])) { @@ -960,7 +960,7 @@ if (!empty($arrayfields['e.tms']['checked'])) { // Status if (!empty($arrayfields['e.fk_statut']['checked'])) { print ''; - print $form->selectarray('search_status', array('0'=>$langs->trans('StatusReceptionDraftShort'), '1'=>$langs->trans('StatusReceptionValidatedShort'), '2'=>$langs->trans('StatusReceptionProcessedShort')), $search_status, 1); + print $form->selectarray('search_status', array('0'=>$langs->trans('StatusReceptionDraftShort'), '1'=>$langs->trans('StatusReceptionValidatedShort'), '2'=>$langs->trans('StatusReceptionProcessedShort')), $search_status, 1, 0, 0, '', 0, 0, 0, '', 'search_status onrightofpage'); print ''; } // Status billed diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 5cc3c053d29..aafbbf90741 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -1308,7 +1308,7 @@ if (!empty($arrayfields['s.tms']['checked'])) { // Status if (!empty($arrayfields['s.status']['checked'])) { print ''; - print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), $search_status, 1, 0, 0, '', 0, 0, 0, '', '', 1); + print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), $search_status, 1, 0, 0, '', 0, 0, 0, '', 'search_status minwidth75 maxwidth125 onrightofpage', 1); print ''; } if (!empty($arrayfields['s.import_key']['checked'])) {