diff --git a/view/registrationcertificatefr/registrationcertificatefr_list.php b/view/registrationcertificatefr/registrationcertificatefr_list.php index d13f67d..2dbef73 100644 --- a/view/registrationcertificatefr/registrationcertificatefr_list.php +++ b/view/registrationcertificatefr/registrationcertificatefr_list.php @@ -161,7 +161,36 @@ } // Definition of array of fields for columns -$arrayfields = array(); +$arrayfields = []; +if (isModEnabled('digiquali')) { + $arrayfields['t.controls'] = [ + 'label' => 'Controls', + 'checked' => 1, + 'enabled' => 1, + 'position' => 200 + ]; + + $arrayfields['t.control_date'] = [ + 'label' => 'ControlDate', + 'checked' => 1, + 'enabled' => 1, + 'position' => 210 + ]; + + $arrayfields['t.days_remaining_before_next_control'] = [ + 'label' => 'DaysBeforeNextControl', + 'checked' => 1, + 'enabled' => 1, + 'position' => 220 + ]; + + $arrayfields['t.control_verdict'] = [ + 'label' => 'Verdict', + 'checked' => 1, + 'enabled' => 1, + 'position' => 230 + ]; +} foreach ($object->fields as $key => $val) { // If $val['visible']==0, then we never show the field if (!empty($val['visible'])) { @@ -482,6 +511,13 @@ $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); +if (isModEnabled('digiquali')) { + $object->fields['controls'] = $arrayfields['t.controls']; + $object->fields['control_date'] = $arrayfields['t.control_date']; + $object->fields['days_remaining_before_next_control'] = $arrayfields['t.days_remaining_before_next_control']; + $object->fields['control_verdict'] = $arrayfields['t.control_verdict']; +} + print '
';
if ($key == 'status') {
print $object->getLibStatut(5);
- } elseif ($key == 'rowid') {
+ } elseif ($key == 'controls' && isModEnabled('digiquali')) {
+ $firstOccurrence = true;
+ foreach ($controls as $control) {
+ print $control->getNomUrl(1, '', 0, $firstOccurrence ? 'bold' : '') . ' '; + $firstOccurrence = false; + } + } elseif ($key == 'control_date' && isModEnabled('digiquali')) { + $control = reset($controls); + print dol_print_date($control->control_date, 'day'); + } elseif ($key == 'control_verdict' && isModEnabled('digiquali')) { + $control = reset($controls); + $verdictColor = $control->verdict == 1 ? 'green' : ($control->verdict == 2 ? 'red' : 'grey'); + print dol_strlen($control->verdict) > 0 ? ' ' : 'N/A'; + } elseif ($key == 'days_remaining_before_next_control' && isModEnabled('digiquali')) { + $control = reset($controls); + if (dol_strlen($control->next_control_date) > 0) { + $nextControl = floor(($control->next_control_date - dol_now('tzuser'))/(3600 * 24)); + $nextControlColor = $nextControl < 0 ? 'red' : ($nextControl <= 30 ? 'orange' : ($nextControl <= 60 ? 'yellow' : 'green')); + print ' '; + } + } elseif ($key == 'rowid') { print $object->showOutputField($val, $key, $object->id, ''); } else { print $object->showOutputField($val, $key, $object->$key, ''); |