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');
42$cachekey = $keyforselect.
'_'.
$conf->entity;
43if (!isset(
$conf->cache[
'extrafieldsinimport'][$cachekey])) {
44 $sql =
"SELECT name, label, type, param, fieldcomputed, fielddefault, fieldrequired FROM ".MAIN_DB_PREFIX.
"extrafields";
45 $sql .=
" WHERE elementtype = '".$this->db->escape($keyforselect).
"' AND type <> 'separate' AND entity IN (0, ".((int)
$conf->entity).
') ORDER BY pos ASC';
47 $tmparrayextrafieldsinimport = array();
48 $resql = $this->db->query($sql);
50 while ($obj = $this->db->fetch_object($resql)) {
51 $tmparrayextrafieldsinimport[] = $obj;
54 $conf->cache[
'extrafieldsinimport'][$cachekey] = $tmparrayextrafieldsinimport;
56if (!empty(
$conf->cache[
'extrafieldsinimport'][$cachekey])) {
57 foreach (
$conf->cache[
'extrafieldsinimport'][$cachekey] as $obj) {
58 '@phan-var-force stdClass $obj';
59 $fieldname = $keyforaliasextra.
'.'.$obj->name;
60 $fieldlabel = ucfirst($obj->label);
62 $typefield = preg_replace(
'/\(.*$/',
'', $obj->type);
68 $typeFilter =
"Numeric";
76 $typeFilter =
"Boolean";
82 if ($tmpparam[
'options'] && is_array($tmpparam[
'options'])) {
83 $typeFilter =
"Select:".$obj->param;
90 if (is_array($tmpparam) && array_key_exists(
'options', $tmpparam) && $tmpparam[
'options'] && is_array($tmpparam[
'options'])) {
91 $tmpkeys = array_keys($tmpparam[
'options']);
92 $tmp = (
string) array_shift($tmpkeys);
94 if (preg_match(
'/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) {
95 $typeFilter =
"List:".$tmp;
99 if ($obj->type !=
'separate') {
101 if (empty($obj->fieldcomputed)) {
102 $this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ?
'*' :
'');
103 $this->import_TypeFields_array[$r][$fieldname] = $typeFilter;
104 $this->import_entities_array[$r][$fieldname] = $keyforelement;
107 $this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ?
'*' :
'');
108 $this->import_TypeFields_array[$r][$fieldname] = $typeFilter.
'Compute';
109 $this->import_entities_array[$r][$fieldname] = $keyforelement;
jsonOrUnserialize($stringtodecode, $assoc=true)
Decode an encoded string.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string