|
@@ -43,6 +43,30 @@ class ExtraFields
|
|
|
*/
|
|
*/
|
|
|
public $db;
|
|
public $db;
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @var array Array with type of the extra field
|
|
|
|
|
+ * @deprecated
|
|
|
|
|
+ */
|
|
|
|
|
+ public $attribute_type;
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @var array Array with label of extra field
|
|
|
|
|
+ * @deprecated
|
|
|
|
|
+ */
|
|
|
|
|
+ public $attribute_label;
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @var array Array with list of possible values for some types of extra fields
|
|
|
|
|
+ * @deprecated
|
|
|
|
|
+ */
|
|
|
|
|
+ public $attribute_choice;
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @var array array to store extrafields definition
|
|
|
|
|
+ * @deprecated
|
|
|
|
|
+ */
|
|
|
|
|
+ public $attribute_list;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* @var array New array to store extrafields definition
|
|
* @var array New array to store extrafields definition
|
|
|
*/
|
|
*/
|
|
@@ -108,6 +132,9 @@ class ExtraFields
|
|
|
$this->error = '';
|
|
$this->error = '';
|
|
|
$this->errors = array();
|
|
$this->errors = array();
|
|
|
$this->attributes = array();
|
|
$this->attributes = array();
|
|
|
|
|
+
|
|
|
|
|
+ $this->attribute_type = array();
|
|
|
|
|
+ $this->attribute_label = array();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -875,6 +902,10 @@ class ExtraFields
|
|
|
$array_name_label[$tab->name] = $tab->label;
|
|
$array_name_label[$tab->name] = $tab->label;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // Old usage
|
|
|
|
|
+ $this->attribute_type[$tab->name] = $tab->type;
|
|
|
|
|
+ $this->attribute_label[$tab->name] = $tab->label;
|
|
|
|
|
+
|
|
|
$this->attributes[$tab->elementtype]['type'][$tab->name] = $tab->type;
|
|
$this->attributes[$tab->elementtype]['type'][$tab->name] = $tab->type;
|
|
|
$this->attributes[$tab->elementtype]['label'][$tab->name] = $tab->label;
|
|
$this->attributes[$tab->elementtype]['label'][$tab->name] = $tab->label;
|
|
|
$this->attributes[$tab->elementtype]['size'][$tab->name] = $tab->size;
|
|
$this->attributes[$tab->elementtype]['size'][$tab->name] = $tab->size;
|
|
@@ -949,22 +980,28 @@ class ExtraFields
|
|
|
dol_syslog(get_class($this).'::showInputField extrafieldsobjectkey required', LOG_ERR);
|
|
dol_syslog(get_class($this).'::showInputField extrafieldsobjectkey required', LOG_ERR);
|
|
|
return 'BadValueForParamExtraFieldsObjectKey';
|
|
return 'BadValueForParamExtraFieldsObjectKey';
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- $label = $this->attributes[$extrafieldsobjectkey]['label'][$key];
|
|
|
|
|
- $type = $this->attributes[$extrafieldsobjectkey]['type'][$key];
|
|
|
|
|
- $size = $this->attributes[$extrafieldsobjectkey]['size'][$key];
|
|
|
|
|
- $default = $this->attributes[$extrafieldsobjectkey]['default'][$key];
|
|
|
|
|
- $computed = $this->attributes[$extrafieldsobjectkey]['computed'][$key];
|
|
|
|
|
- $unique = $this->attributes[$extrafieldsobjectkey]['unique'][$key];
|
|
|
|
|
- $required = $this->attributes[$extrafieldsobjectkey]['required'][$key];
|
|
|
|
|
- $param = $this->attributes[$extrafieldsobjectkey]['param'][$key];
|
|
|
|
|
- $perms = dol_eval($this->attributes[$extrafieldsobjectkey]['perms'][$key], 1, 1, '1');
|
|
|
|
|
- $langfile = $this->attributes[$extrafieldsobjectkey]['langfile'][$key];
|
|
|
|
|
- $list = dol_eval($this->attributes[$extrafieldsobjectkey]['list'][$key], 1, 1, '1');
|
|
|
|
|
- $totalizable = $this->attributes[$extrafieldsobjectkey]['totalizable'][$key];
|
|
|
|
|
- $help = $this->attributes[$extrafieldsobjectkey]['help'][$key];
|
|
|
|
|
- $hidden = (empty($list) ? 1 : 0); // If empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller)
|
|
|
|
|
-
|
|
|
|
|
|
|
+ if (!empty($extrafieldsobjectkey)) {
|
|
|
|
|
+ $label = $this->attributes[$extrafieldsobjectkey]['label'][$key];
|
|
|
|
|
+ $type = $this->attributes[$extrafieldsobjectkey]['type'][$key];
|
|
|
|
|
+ $size = $this->attributes[$extrafieldsobjectkey]['size'][$key];
|
|
|
|
|
+ $default = $this->attributes[$extrafieldsobjectkey]['default'][$key];
|
|
|
|
|
+ $computed = $this->attributes[$extrafieldsobjectkey]['computed'][$key];
|
|
|
|
|
+ $unique = $this->attributes[$extrafieldsobjectkey]['unique'][$key];
|
|
|
|
|
+ $required = $this->attributes[$extrafieldsobjectkey]['required'][$key];
|
|
|
|
|
+ $param = $this->attributes[$extrafieldsobjectkey]['param'][$key];
|
|
|
|
|
+ $perms = dol_eval($this->attributes[$extrafieldsobjectkey]['perms'][$key], 1, 1, '1');
|
|
|
|
|
+ $langfile = $this->attributes[$extrafieldsobjectkey]['langfile'][$key];
|
|
|
|
|
+ $list = dol_eval($this->attributes[$extrafieldsobjectkey]['list'][$key], 1, 1, '1');
|
|
|
|
|
+ $totalizable = $this->attributes[$extrafieldsobjectkey]['totalizable'][$key];
|
|
|
|
|
+ $help = $this->attributes[$extrafieldsobjectkey]['help'][$key];
|
|
|
|
|
+ $hidden = (empty($list) ? 1 : 0); // If empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller)
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // Old usage
|
|
|
|
|
+ $label = $this->attribute_label[$key];
|
|
|
|
|
+ $type = $this->attribute_type[$key];
|
|
|
|
|
+ $list = $this->attribute_list[$key];
|
|
|
|
|
+ $hidden = (empty($list) ? 1 : 0); // If empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller)
|
|
|
|
|
+ }
|
|
|
if ($computed) {
|
|
if ($computed) {
|
|
|
if (!preg_match('/^search_/', $keyprefix)) {
|
|
if (!preg_match('/^search_/', $keyprefix)) {
|
|
|
return '<span class="opacitymedium">'.$langs->trans("AutomaticallyCalculated").'</span>';
|
|
return '<span class="opacitymedium">'.$langs->trans("AutomaticallyCalculated").'</span>';
|