dolibarr 19.0.3
extrafields_list_array_fields.tpl.php
1<?php
2
3// This tpl file is included into the init part of pages, so before action.
4// So no output must be done.
5
6// Protection to avoid direct call of template
7if (empty($conf) || !is_object($conf)) {
8 print "Error, template page can't be called as URL";
9 exit;
10}
11
12if (empty($extrafieldsobjectkey) && is_object($object)) {
13 $extrafieldsobjectkey = $object->table_element;
14}
15
16// Loop to show all columns of extrafields from $obj, $extrafields and $db
17if (!empty($extrafieldsobjectkey)) { // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ...
18 if (isset($extrafields->attributes[$extrafieldsobjectkey]['label']) && is_array($extrafields->attributes[$extrafieldsobjectkey]['label']) && count($extrafields->attributes[$extrafieldsobjectkey]['label']) > 0) {
19 if (empty($extrafieldsobjectprefix)) {
20 $extrafieldsobjectprefix = 'ef.';
21 }
22 foreach ($extrafields->attributes[$extrafieldsobjectkey]['label'] as $key => $val) {
23 if (!empty($extrafields->attributes[$extrafieldsobjectkey]['list'][$key])) {
24 $arrayfields[$extrafieldsobjectprefix.$key] = array(
25 'label' => $extrafields->attributes[$extrafieldsobjectkey]['label'][$key],
26 'type' => $extrafields->attributes[$extrafieldsobjectkey]['type'][$key],
27 'checked' => ((dol_eval($extrafields->attributes[$extrafieldsobjectkey]['list'][$key], 1, 1, '1') <= 0) ? 0 : 1),
28 'position' => $extrafields->attributes[$extrafieldsobjectkey]['pos'][$key],
29 'enabled' => (abs((int) dol_eval($extrafields->attributes[$extrafieldsobjectkey]['list'][$key], 1)) != 3 && dol_eval($extrafields->attributes[$extrafieldsobjectkey]['perms'][$key], 1, 1, '1')),
30 'langfile' => $extrafields->attributes[$extrafieldsobjectkey]['langfile'][$key],
31 'help' => $extrafields->attributes[$extrafieldsobjectkey]['help'][$key],
32 );
33 }
34 }
35 }
36}
dol_eval($s, $returnvalue=0, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.