26'@phan-var-force DolibarrModules $this';
32if (empty($keyforselect) || empty($keyforelement) || empty($keyforaliasextra)) {
34 dol_print_error(
null,
'include of file extrafieldsinimport.inc.php was done but var $keyforselect or $keyforelement or $keyforaliasextra was not set');
39$sql =
"SELECT name, label, type, param, fieldcomputed, fielddefault, fieldrequired FROM ".MAIN_DB_PREFIX.
"extrafields";
40$sql .=
" WHERE elementtype = '".$this->db->escape($keyforselect).
"' AND type <> 'separate' AND entity IN (0, ".((int)
$conf->entity).
') ORDER BY pos ASC';
42$resql = $this->db->query($sql);
44 while ($obj = $this->db->fetch_object($resql)) {
45 $fieldname = $keyforaliasextra.
'.'.$obj->name;
46 $fieldlabel = ucfirst($obj->label);
48 $typefield = preg_replace(
'/\(.*$/',
'', $obj->type);
54 $typeFilter =
"Numeric";
62 $typeFilter =
"Boolean";
68 if ($tmpparam[
'options'] && is_array($tmpparam[
'options'])) {
69 $typeFilter =
"Select:".$obj->param;
76 if (is_array($tmpparam) && array_key_exists(
'options', $tmpparam) && $tmpparam[
'options'] && is_array($tmpparam[
'options'])) {
77 $tmpkeys = array_keys($tmpparam[
'options']);
78 $tmp = (string) array_shift($tmpkeys);
80 if (preg_match(
'/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) {
81 $typeFilter =
"List:".$tmp;
85 if ($obj->type !=
'separate') {
87 if (empty($obj->fieldcomputed)) {
88 $this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ?
'*' :
'');
89 $this->import_TypeFields_array[$r][$fieldname] = $typeFilter;
90 $this->import_entities_array[$r][$fieldname] = $keyforelement;
93 $this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ?
'*' :
'');
94 $this->import_TypeFields_array[$r][$fieldname] = $typeFilter.
'Compute';
95 $this->import_entities_array[$r][$fieldname] = $keyforelement;
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
jsonOrUnserialize($stringtodecode)
Decode an encode string.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...