7if (empty($keyforselect) || empty($keyforelement) || empty($keyforaliasextra)) {
9 dol_print_error(
'',
'include of file extrafieldsinexport.inc.php was done but var $keyforselect or $keyforelement or $keyforaliasextra was not set');
14$sql =
"SELECT name, label, type, param, fieldcomputed, fielddefault FROM ".MAIN_DB_PREFIX.
"extrafields";
15$sql .=
" WHERE elementtype = '".$this->db->escape($keyforselect).
"' AND type <> 'separate' AND entity IN (0, ".((int) $conf->entity).
') ORDER BY pos ASC';
17$resql = $this->db->query($sql);
19 while ($obj = $this->db->fetch_object($resql)) {
20 $fieldname = $keyforaliasextra.
'.'.$obj->name;
21 $fieldlabel = ucfirst($obj->label);
23 $typefield = preg_replace(
'/\(.*$/',
'', $obj->type);
29 $typeFilter =
"Numeric";
37 $typeFilter =
"Boolean";
43 if ($tmpparam[
'options'] && is_array($tmpparam[
'options'])) {
44 $typeFilter =
"Select:".$obj->param;
51 if (is_array($tmpparam) && array_key_exists(
'options', $tmpparam) && $tmpparam[
'options'] && is_array($tmpparam[
'options'])) {
52 $tmpkeys = array_keys($tmpparam[
'options']);
53 $tmp = array_shift($tmpkeys);
55 if (preg_match(
'/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) {
56 $typeFilter =
"List:".$tmp;
60 if ($obj->type !=
'separate') {
62 if (empty($obj->fieldcomputed)) {
63 $this->export_fields_array[$r][$fieldname] = $fieldlabel;
64 $this->export_TypeFields_array[$r][$fieldname] = $typeFilter;
65 $this->export_entities_array[$r][$fieldname] = $keyforelement;
68 $this->export_fields_array[$r][$fieldname] = $fieldlabel;
69 $this->export_TypeFields_array[$r][$fieldname] = $typeFilter.
'Compute';
70 $this->export_special_array[$r][$fieldname] = $obj->fieldcomputed;
71 $this->export_entities_array[$r][$fieldname] = $keyforelement;
dol_print_error($db='', $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.