27@phan-var-force DolibarrModules $this
35if (empty($keyforselect) || empty($keyforelement) || empty($keyforaliasextra)) {
37 dol_print_error(
null,
'include of file extrafieldsinexport.inc.php was done but var $keyforselect or $keyforelement or $keyforaliasextra was not set');
42$sql =
"SELECT name, label, type, param, fieldcomputed, fielddefault FROM ".MAIN_DB_PREFIX.
"extrafields";
43$sql .=
" WHERE elementtype = '".$this->db->escape($keyforselect).
"' AND type <> 'separate' AND entity IN (0, ".((int)
$conf->entity).
') ORDER BY pos ASC';
45$resql = $this->db->query($sql);
47 while ($obj = $this->db->fetch_object($resql)) {
48 $fieldname = $keyforaliasextra.
'.'.$obj->name;
49 $fieldlabel = ucfirst($obj->label);
51 $typefield = preg_replace(
'/\(.*$/',
'', $obj->type);
57 $typeFilter =
"Numeric";
65 $typeFilter =
"Boolean";
71 if ($tmpparam[
'options'] && is_array($tmpparam[
'options'])) {
72 $typeFilter =
"Select:".$obj->param;
79 if (is_array($tmpparam) && array_key_exists(
'options', $tmpparam) && $tmpparam[
'options'] && is_array($tmpparam[
'options'])) {
80 $tmpkeys = array_keys($tmpparam[
'options']);
81 $tmp = array_shift($tmpkeys);
83 if (preg_match(
'/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', (
string) $tmp)) {
84 $typeFilter =
"List:".$tmp;
88 if ($obj->type !=
'separate') {
90 if (empty($obj->fieldcomputed)) {
91 $this->export_fields_array[$r][$fieldname] = $fieldlabel;
92 $this->export_TypeFields_array[$r][$fieldname] = $typeFilter;
93 $this->export_entities_array[$r][$fieldname] = $keyforelement;
96 $this->export_fields_array[$r][$fieldname] = $fieldlabel;
97 $this->export_TypeFields_array[$r][$fieldname] = $typeFilter.
'Compute';
98 $this->export_special_array[$r][$fieldname] = $obj->fieldcomputed;
99 $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.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...