5@phan-var-force DolibarrModules $this
13if (empty($keyforselect) || empty($keyforelement) || empty($keyforaliasextra)) {
15 dol_print_error(
null,
'include of file extrafieldsinexport.inc.php was done but var $keyforselect or $keyforelement or $keyforaliasextra was not set');
20$sql =
"SELECT name, label, type, param, fieldcomputed, fielddefault FROM ".MAIN_DB_PREFIX.
"extrafields";
21$sql .=
" WHERE elementtype = '".$this->db->escape($keyforselect).
"' AND type <> 'separate' AND entity IN (0, ".((int) $conf->entity).
') ORDER BY pos ASC';
23$resql = $this->db->query($sql);
25 while ($obj = $this->db->fetch_object($resql)) {
26 $fieldname = $keyforaliasextra.
'.'.$obj->name;
27 $fieldlabel = ucfirst($obj->label);
29 $typefield = preg_replace(
'/\(.*$/',
'', $obj->type);
35 $typeFilter =
"Numeric";
43 $typeFilter =
"Boolean";
49 if ($tmpparam[
'options'] && is_array($tmpparam[
'options'])) {
50 $typeFilter =
"Select:".$obj->param;
57 if (is_array($tmpparam) && array_key_exists(
'options', $tmpparam) && $tmpparam[
'options'] && is_array($tmpparam[
'options'])) {
58 $tmpkeys = array_keys($tmpparam[
'options']);
59 $tmp = array_shift($tmpkeys);
61 if (preg_match(
'/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', (
string) $tmp)) {
62 $typeFilter =
"List:".$tmp;
66 if ($obj->type !=
'separate') {
68 if (empty($obj->fieldcomputed)) {
69 $this->export_fields_array[$r][$fieldname] = $fieldlabel;
70 $this->export_TypeFields_array[$r][$fieldname] = $typeFilter;
71 $this->export_entities_array[$r][$fieldname] = $keyforelement;
74 $this->export_fields_array[$r][$fieldname] = $fieldlabel;
75 $this->export_TypeFields_array[$r][$fieldname] = $typeFilter.
'Compute';
76 $this->export_special_array[$r][$fieldname] = $obj->fieldcomputed;
77 $this->export_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.