2'@phan-var-force DolibarrModules $this';
8if (empty($keyforselect) || empty($keyforelement) || empty($keyforaliasextra)) {
10 dol_print_error(
null,
'include of file extrafieldsinimport.inc.php was done but var $keyforselect or $keyforelement or $keyforaliasextra was not set');
15$sql =
"SELECT name, label, type, param, fieldcomputed, fielddefault, fieldrequired FROM ".MAIN_DB_PREFIX.
"extrafields";
16$sql .=
" WHERE elementtype = '".$this->db->escape($keyforselect).
"' AND type <> 'separate' AND entity IN (0, ".((int) $conf->entity).
') ORDER BY pos ASC';
18$resql = $this->db->query($sql);
20 while ($obj = $this->db->fetch_object($resql)) {
21 $fieldname = $keyforaliasextra.
'.'.$obj->name;
22 $fieldlabel = ucfirst($obj->label);
24 $typefield = preg_replace(
'/\(.*$/',
'', $obj->type);
30 $typeFilter =
"Numeric";
38 $typeFilter =
"Boolean";
44 if ($tmpparam[
'options'] && is_array($tmpparam[
'options'])) {
45 $typeFilter =
"Select:".$obj->param;
52 if (is_array($tmpparam) && array_key_exists(
'options', $tmpparam) && $tmpparam[
'options'] && is_array($tmpparam[
'options'])) {
53 $tmpkeys = array_keys($tmpparam[
'options']);
54 $tmp = array_shift($tmpkeys);
56 if (preg_match(
'/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) {
57 $typeFilter =
"List:".$tmp;
61 if ($obj->type !=
'separate') {
63 if (empty($obj->fieldcomputed)) {
64 $this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ?
'*' :
'');
65 $this->import_TypeFields_array[$r][$fieldname] = $typeFilter;
66 $this->import_entities_array[$r][$fieldname] = $keyforelement;
69 $this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ?
'*' :
'');
70 $this->import_TypeFields_array[$r][$fieldname] = $typeFilter.
'Compute';
71 $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 dolibarr global constant string value.