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