From 8d7387c471cd6da3157e47087932f05da85b1b47 Mon Sep 17 00:00:00 2001 From: Nicolas Domenech Date: Mon, 8 Jul 2024 13:26:58 +0200 Subject: [PATCH] #261 [RegistrationCertificate] add: linked control on list --- .../registrationcertificatefr_list.php | 31 +++++++++++++++++-- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/view/registrationcertificatefr/registrationcertificatefr_list.php b/view/registrationcertificatefr/registrationcertificatefr_list.php index d13f67d..3e86397 100644 --- a/view/registrationcertificatefr/registrationcertificatefr_list.php +++ b/view/registrationcertificatefr/registrationcertificatefr_list.php @@ -161,7 +161,15 @@ } // Definition of array of fields for columns -$arrayfields = array(); +$arrayfields = []; +if (isModEnabled('digiquali')) { + $arrayfields['t.controls'] = [ + 'label' => 'Controls', + 'checked' => 1, + 'enabled' => 1, + 'position' => 200 + ]; +} foreach ($object->fields as $key => $val) { // If $val['visible']==0, then we never show the field if (!empty($val['visible'])) { @@ -482,6 +490,10 @@ $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']; +} + print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table print ''."\n"; @@ -517,6 +529,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; $formadmin = new FormAdmin($db); print $formadmin->select_language($search[$key], 'search_lang', 0, null, 1, 0, 0, 'minwidth150 maxwidth200', 2); + } elseif ($key == 'controls' && isModEnabled('digiquali')) { + continue; } else { print ''; } @@ -553,7 +567,11 @@ $cssforfield .= ($cssforfield ? ' ' : '').'right'; } if (!empty($arrayfields['t.'.$key]['checked'])) { - print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n"; + $disableSortField = 0; + if ($key == 'controls' && isModEnabled('digiquali')) { + $disableSortField = 1; + } + print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''), $disableSortField)."\n"; } } // Extra fields @@ -617,7 +635,14 @@ print ''; if ($key == 'status') { print $object->getLibStatut(5); - } elseif ($key == 'rowid') { + } elseif ($key == 'controls' && isModEnabled('digiquali')) { + $object->fetchObjectLinked($object->fk_lot,'productbatch', '', 'digiquali_control'); + if (is_array($object->linkedObjects['digiquali_control']) && !empty($object->linkedObjects['digiquali_control'])) { + foreach ($object->linkedObjects['digiquali_control'] as $control) { + print $control->getNomUrl(1) . '
'; + } + } + } elseif ($key == 'rowid') { print $object->showOutputField($val, $key, $object->id, ''); } else { print $object->showOutputField($val, $key, $object->$key, '');