Debug v17

This commit is contained in:
Laurent Destailleur 2022-12-16 12:59:47 +01:00
parent f34253796f
commit 3b87aadc48
11 changed files with 49 additions and 21 deletions

View File

@ -555,7 +555,7 @@ foreach ($object->fields as $key => $val) {
if (!empty($arrayfields['t.'.$key]['checked'])) { if (!empty($arrayfields['t.'.$key]['checked'])) {
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">'; print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) { 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)) { } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) {
print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', 'maxwidth125', 1); print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', 'maxwidth125', 1);
} elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) { } elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) {

View File

@ -572,7 +572,7 @@ foreach ($object->fields as $key => $val) {
if (!empty($arrayfields['t.'.$key]['checked'])) { if (!empty($arrayfields['t.'.$key]['checked'])) {
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">'; print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) { 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)) { } 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); print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth250', 1);
} elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) { } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {

View File

@ -123,7 +123,7 @@ foreach ($object->fields as $key => $val) {
$visible = (int) dol_eval($val['visible'], 1); $visible = (int) dol_eval($val['visible'], 1);
$arrayfields['t.'.$key] = array( $arrayfields['t.'.$key] = array(
'label'=>$val['label'], 'label'=>$val['label'],
'checked'=>(($visible < 0) ? 0 : 1), 'checked'=>(($visible <= 0) ? 0 : 1),
'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)), 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)),
'position'=>$val['position'], 'position'=>$val['position'],
'help'=> isset($val['help']) ? $val['help'] : '' 'help'=> isset($val['help']) ? $val['help'] : ''

View File

@ -1143,12 +1143,12 @@ if (!empty($arrayfields['p.tms']['checked'])) {
} }
if (!empty($arrayfields['p.tosell']['checked'])) { if (!empty($arrayfields['p.tosell']['checked'])) {
print '<td class="liste_titre center">'; print '<td class="liste_titre center">';
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 '</td >'; print '</td >';
} }
if (!empty($arrayfields['p.tobuy']['checked'])) { if (!empty($arrayfields['p.tobuy']['checked'])) {
print '<td class="liste_titre center">'; print '<td class="liste_titre center">';
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 '</td>'; print '</td>';
} }
if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {

View File

@ -485,7 +485,7 @@ $formproject->selectTasks($socid ? $socid : -1, $taskid, 'taskid', 32, 0, '-- '.
print '</div>'; print '</div>';
print ' '; print ' ';
print $formcompany->selectTypeContact($object, '', 'type', 'internal', 'rowid', 0, 'maxwidth150onsmartphone'); print $formcompany->selectTypeContact($object, '', 'type', 'internal', 'rowid', 0, 'maxwidth150onsmartphone');
print '<input type="submit" class="button valignmiddle smallonsmartphone" name="assigntask" value="'.dol_escape_htmltag($titleassigntask).'">'; print '<input type="submit" class="button valignmiddle smallonsmartphone small" name="assigntask" value="'.dol_escape_htmltag($titleassigntask).'">';
print '</div>'; print '</div>';
print '<div class="clearboth" style="padding-bottom: 20px;"></div>'; print '<div class="clearboth" style="padding-bottom: 20px;"></div>';

View File

@ -397,7 +397,7 @@ $formproject->selectTasks($socid ? $socid : -1, $taskid, 'taskid', 32, 0, '-- '.
print '</div>'; print '</div>';
print ' '; print ' ';
print $formcompany->selectTypeContact($object, '', 'type', 'internal', 'rowid', 0, 'maxwidth150onsmartphone'); print $formcompany->selectTypeContact($object, '', 'type', 'internal', 'rowid', 0, 'maxwidth150onsmartphone');
print '<input type="submit" class="button valignmiddle smallonsmartphone" name="assigntask" value="'.dol_escape_htmltag($titleassigntask).'">'; print '<input type="submit" class="button valignmiddle smallonsmartphone small" name="assigntask" value="'.dol_escape_htmltag($titleassigntask).'">';
print '</div>'; print '</div>';
print '<div class="clearboth" style="padding-bottom: 20px;"></div>'; print '<div class="clearboth" style="padding-bottom: 20px;"></div>';

View File

@ -498,7 +498,7 @@ $formproject->selectTasks($socid ? $socid : -1, $taskid, 'taskid', 32, 0, '-- '.
print '</div>'; print '</div>';
print ' '; print ' ';
print $formcompany->selectTypeContact($object, '', 'type', 'internal', 'rowid', 0, 'maxwidth150onsmartphone'); print $formcompany->selectTypeContact($object, '', 'type', 'internal', 'rowid', 0, 'maxwidth150onsmartphone');
print '<input type="submit" class="button valignmiddle smallonsmartphone" name="assigntask" value="'.dol_escape_htmltag($titleassigntask).'">'; print '<input type="submit" class="button valignmiddle smallonsmartphone small" name="assigntask" value="'.dol_escape_htmltag($titleassigntask).'">';
print '</div>'; print '</div>';
print '<div class="clearboth" style="padding-bottom: 20px;"></div>'; print '<div class="clearboth" style="padding-bottom: 20px;"></div>';

View File

@ -1542,8 +1542,12 @@ while ($i < $imaxinloop) {
//if ($obj->opp_status_code) //if ($obj->opp_status_code)
if (strcmp($obj->opp_amount, '')) { if (strcmp($obj->opp_amount, '')) {
print '<span class="amount">'.price($obj->opp_amount, 1, $langs, 1, -1, -1, '').'</span>'; print '<span class="amount">'.price($obj->opp_amount, 1, $langs, 1, -1, -1, '').'</span>';
if (empty($totalarray['val']['p.opp_amount'])) {
$totalarray['val']['p.opp_amount'] = $obj->opp_amount;
} else {
$totalarray['val']['p.opp_amount'] += $obj->opp_amount; $totalarray['val']['p.opp_amount'] += $obj->opp_amount;
} }
}
print '</td>'; print '</td>';
if (!$i) { if (!$i) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
@ -1571,8 +1575,12 @@ while ($i < $imaxinloop) {
print '<td align="right">'; print '<td align="right">';
if ($obj->opp_weighted_amount) { if ($obj->opp_weighted_amount) {
print '<span class="amount">'.price($obj->opp_weighted_amount, 1, $langs, 1, -1, -1, '').'</span>'; print '<span class="amount">'.price($obj->opp_weighted_amount, 1, $langs, 1, -1, -1, '').'</span>';
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; $totalarray['val']['opp_weighted_amount'] += $obj->opp_weighted_amount;
} }
}
print '</td>'; print '</td>';
if (!$i) { if (!$i) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
@ -1586,8 +1594,12 @@ while ($i < $imaxinloop) {
print '<td class="right">'; print '<td class="right">';
if ($obj->budget_amount != '') { if ($obj->budget_amount != '') {
print '<span class="amount">'.price($obj->budget_amount, 1, $langs, 1, -1, -1).'</span>'; print '<span class="amount">'.price($obj->budget_amount, 1, $langs, 1, -1, -1).'</span>';
if (empty($totalarray['val']['p.budget_amount'])) {
$totalarray['val']['p.budget_amount'] = $obj->budget_amount;
} else {
$totalarray['val']['p.budget_amount'] += $obj->budget_amount; $totalarray['val']['p.budget_amount'] += $obj->budget_amount;
} }
}
print '</td>'; print '</td>';
if (!$i) { if (!$i) {
$totalarray['nbfield']++; $totalarray['nbfield']++;

View File

@ -1239,7 +1239,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
} }
// Call Hook formConfirm // 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 $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) { if (empty($reshook)) {
$formconfirm .= $hookmanager->resPrint; $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['author'] = array('label'=>$langs->trans("By"), 'checked'=>1);
$arrayfields['t.note'] = array('label'=>$langs->trans("Note"), '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.fk_product'] = array('label' => $langs->trans("Product"), 'checked' => 1);
} }
$arrayfields['t.task_duration'] = array('label'=>$langs->trans("Duration"), '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; $total = 0;
$totalvalue = 0; $totalvalue = 0;
$totalarray = array(); $totalarray = array('nbfield'=>0);
foreach ($tasks as $task_time) { foreach ($tasks as $task_time) {
if ($i >= $limit) { if ($i >= $limit) {
break; break;
@ -2168,12 +2168,20 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
if (!$i) { if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 't.task_duration'; $totalarray['pos'][$totalarray['nbfield']] = 't.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; $totalarray['val']['t.task_duration'] += $task_time->task_duration;
}
if (!$i) { if (!$i) {
$totalarray['totaldurationfield'] = $totalarray['nbfield']; $totalarray['totaldurationfield'] = $totalarray['nbfield'];
} }
if (empty($totalarray['totalduration'])) {
$totalarray['totalduration'] = $task_time->task_duration;
} else {
$totalarray['totalduration'] += $task_time->task_duration; $totalarray['totalduration'] += $task_time->task_duration;
} }
}
//Product //Product
if (!empty($arrayfields['t.fk_product']['checked'])) { if (!empty($arrayfields['t.fk_product']['checked'])) {
@ -2208,12 +2216,20 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
if (!$i) { if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 'value'; $totalarray['pos'][$totalarray['nbfield']] = 'value';
} }
if (empty($totalarray['val']['value'])) {
$totalarray['val']['value'] = $value;
} else {
$totalarray['val']['value'] += $value; $totalarray['val']['value'] += $value;
}
if (!$i) { if (!$i) {
$totalarray['totalvaluefield'] = $totalarray['nbfield']; $totalarray['totalvaluefield'] = $totalarray['nbfield'];
} }
if (empty($totalarray['totalvalue'])) {
$totalarray['totalvalue'] = $value;
} else {
$totalarray['totalvalue'] += $value; $totalarray['totalvalue'] += $value;
} }
}
// Invoiced // Invoiced
if (!empty($arrayfields['valuebilled']['checked'])) { if (!empty($arrayfields['valuebilled']['checked'])) {

View File

@ -927,7 +927,7 @@ if (!empty($arrayfields['e.date_delivery']['checked'])) {
if (!empty($arrayfields['l.ref']['checked'])) { if (!empty($arrayfields['l.ref']['checked'])) {
// Delivery ref // Delivery ref
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input class="flat" size="10" type="text" name="search_ref_liv" value="'.$search_ref_liv.'"'; print '<input class="flat" type="text" name="search_ref_liv" value="'.dol_escape_htmltag($search_ref_liv).'"';
print '</td>'; print '</td>';
} }
if (!empty($arrayfields['l.date_delivery']['checked'])) { if (!empty($arrayfields['l.date_delivery']['checked'])) {
@ -960,7 +960,7 @@ if (!empty($arrayfields['e.tms']['checked'])) {
// Status // Status
if (!empty($arrayfields['e.fk_statut']['checked'])) { if (!empty($arrayfields['e.fk_statut']['checked'])) {
print '<td class="liste_titre maxwidthonsmartphone right">'; print '<td class="liste_titre maxwidthonsmartphone right">';
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 '</td>'; print '</td>';
} }
// Status billed // Status billed

View File

@ -1308,7 +1308,7 @@ if (!empty($arrayfields['s.tms']['checked'])) {
// Status // Status
if (!empty($arrayfields['s.status']['checked'])) { if (!empty($arrayfields['s.status']['checked'])) {
print '<td class="liste_titre center minwidth75imp">'; print '<td class="liste_titre center minwidth75imp">';
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 '</td>'; print '</td>';
} }
if (!empty($arrayfields['s.import_key']['checked'])) { if (!empty($arrayfields['s.import_key']['checked'])) {