Skip to content

Commit

Permalink
Evarisk#261 [RegistrationCertificate] add: linked control on list
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-eoxia committed Nov 6, 2024
1 parent 0173672 commit 8d7387c
Showing 1 changed file with 28 additions and 3 deletions.
31 changes: 28 additions & 3 deletions view/registrationcertificatefr/registrationcertificatefr_list.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'])) {
Expand Down Expand Up @@ -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 '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";

Expand Down Expand Up @@ -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 '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -617,7 +635,14 @@
print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>';
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) . '<br>';
}
}
} elseif ($key == 'rowid') {
print $object->showOutputField($val, $key, $object->id, '');
} else {
print $object->showOutputField($val, $key, $object->$key, '');
Expand Down

0 comments on commit 8d7387c

Please sign in to comment.