Clean code for v15
This commit is contained in:
parent
bb38ea79f4
commit
186185267e
@ -127,7 +127,6 @@ if ($result) {
|
||||
$title = $langs->trans('AccountingPeriods');
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $addbutton, '', $limit, 1);
|
||||
|
||||
// Load attribute_label
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
@ -119,7 +119,7 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg) {
|
||||
}
|
||||
//if (!empty($objp->$key))
|
||||
// $objp->array_options[$tmpkey] = $objp->$key;
|
||||
//$objp->array_options[$tmpkey] = $extrafields->showOutputField($key, $objp->$tmpkey, '', 1); //$objp->$tmpkey;
|
||||
//$objp->array_options[$tmpkey] = $extrafields->showOutputField($key, $objp->$tmpkey, '', $object->table_element); //$objp->$tmpkey;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -7862,7 +7862,7 @@ abstract class CommonObject
|
||||
|
||||
switch ($mode) {
|
||||
case "view":
|
||||
$out .= $extrafields->showOutputField($key, $value);
|
||||
$out .= $extrafields->showOutputField($key, $value, '', $this->table_element);
|
||||
break;
|
||||
case "create":
|
||||
$out .= $extrafields->showInputField($key, $value, '', $keysuffix, '', 0, $this->id, $this->table_element);
|
||||
|
||||
@ -42,12 +42,6 @@ class ExtraFields
|
||||
*/
|
||||
public $db;
|
||||
|
||||
/**
|
||||
* @var array Array with type of element (for what object is the extrafield)
|
||||
* @deprecated
|
||||
*/
|
||||
public $attribute_elementtype;
|
||||
|
||||
/**
|
||||
* @var array Array with type of the extra field
|
||||
* @deprecated
|
||||
@ -60,90 +54,12 @@ class ExtraFields
|
||||
*/
|
||||
public $attribute_label;
|
||||
|
||||
/**
|
||||
* @var array Array with size of extra field
|
||||
* @deprecated
|
||||
*/
|
||||
public $attribute_size;
|
||||
|
||||
/**
|
||||
* @var array Array with list of possible values for some types of extra fields
|
||||
* @deprecated
|
||||
*/
|
||||
public $attribute_choice;
|
||||
|
||||
/**
|
||||
* @var array Array to store compute formula for computed fields
|
||||
* @deprecated
|
||||
*/
|
||||
public $attribute_computed;
|
||||
|
||||
/**
|
||||
* @var array Array to store default value
|
||||
* @deprecated
|
||||
*/
|
||||
public $attribute_default;
|
||||
|
||||
/**
|
||||
* @var array Array to store if attribute is unique or not
|
||||
* @deprecated
|
||||
*/
|
||||
public $attribute_unique;
|
||||
|
||||
/**
|
||||
* @var array Array to store if attribute is required or not
|
||||
* @deprecated
|
||||
*/
|
||||
public $attribute_required;
|
||||
|
||||
/**
|
||||
* @var array Array to store parameters of attribute (used in select type)
|
||||
* @deprecated
|
||||
*/
|
||||
public $attribute_param;
|
||||
|
||||
/**
|
||||
* @var array Array to store position of attribute
|
||||
* @deprecated
|
||||
*/
|
||||
public $attribute_pos;
|
||||
|
||||
/**
|
||||
* @var array Array to store if attribute is editable regardless of the document status
|
||||
* @deprecated
|
||||
*/
|
||||
public $attribute_alwayseditable;
|
||||
|
||||
/**
|
||||
* @var array Array to store permission to check
|
||||
* @deprecated
|
||||
*/
|
||||
public $attribute_perms;
|
||||
|
||||
/**
|
||||
* @var array Array to store language file to translate label of values
|
||||
* @deprecated
|
||||
*/
|
||||
public $attribute_langfile;
|
||||
|
||||
/**
|
||||
* @var array Array to store if field is visible by default on list
|
||||
* @deprecated
|
||||
*/
|
||||
public $attribute_list;
|
||||
|
||||
/**
|
||||
* @var array Array to store if field is summable
|
||||
* @deprecated
|
||||
*/
|
||||
public $attribute_totalizable;
|
||||
|
||||
/**
|
||||
* @var array Array to store entity id of extrafield
|
||||
* @deprecated
|
||||
*/
|
||||
public $attribute_entityid;
|
||||
|
||||
|
||||
/**
|
||||
* @var array New array to store extrafields definition
|
||||
@ -203,17 +119,8 @@ class ExtraFields
|
||||
$this->attributes = array();
|
||||
|
||||
// For old usage
|
||||
$this->attribute_elementtype = array();
|
||||
$this->attribute_type = array();
|
||||
$this->attribute_label = array();
|
||||
$this->attribute_size = array();
|
||||
$this->attribute_computed = array();
|
||||
$this->attribute_default = array();
|
||||
$this->attribute_unique = array();
|
||||
$this->attribute_required = array();
|
||||
$this->attribute_perms = array();
|
||||
$this->attribute_langfile = array();
|
||||
$this->attribute_list = array();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -238,7 +145,7 @@ class ExtraFields
|
||||
* @param string $langfile Language file
|
||||
* @param string $enabled Condition to have the field enabled or not
|
||||
* @param int $totalizable Is a measure. Must show a total on lists
|
||||
* @param int $printable Is extrafield displayed on PDF
|
||||
* @param int $printable Is extrafield displayed on PDF
|
||||
* @return int <=0 if KO, >0 if OK
|
||||
*/
|
||||
public function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique = 0, $required = 0, $default_value = '', $param = '', $alwayseditable = 0, $perms = '', $list = '-1', $help = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0, $printable = 0)
|
||||
@ -873,7 +780,7 @@ class ExtraFields
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Load array this->attributes, or old this->attribute_xxx like attribute_label, attribute_type, ...
|
||||
* Load array this->attributes (and some old this->attribute_xxx like attribute_label, attribute_type, ...
|
||||
*
|
||||
* @param string $elementtype Type of element ('' = all or $object->table_element like 'adherent', 'commande', 'thirdparty', 'facture', 'propal', 'product', ...).
|
||||
* @param boolean $forceload Force load of extra fields whatever is status of cache.
|
||||
@ -932,20 +839,6 @@ class ExtraFields
|
||||
// Old usage
|
||||
$this->attribute_type[$tab->name] = $tab->type;
|
||||
$this->attribute_label[$tab->name] = $tab->label;
|
||||
$this->attribute_size[$tab->name] = $tab->size;
|
||||
$this->attribute_elementtype[$tab->name] = $tab->elementtype;
|
||||
$this->attribute_default[$tab->name] = $tab->fielddefault;
|
||||
$this->attribute_computed[$tab->name] = $tab->fieldcomputed;
|
||||
$this->attribute_unique[$tab->name] = $tab->fieldunique;
|
||||
$this->attribute_required[$tab->name] = $tab->fieldrequired;
|
||||
$this->attribute_param[$tab->name] = ($tab->param ? jsonOrUnserialize($tab->param) : '');
|
||||
$this->attribute_pos[$tab->name] = $tab->pos;
|
||||
$this->attribute_alwayseditable[$tab->name] = $tab->alwayseditable;
|
||||
$this->attribute_perms[$tab->name] = (strlen($tab->perms) == 0 ? 1 : $tab->perms);
|
||||
$this->attribute_langfile[$tab->name] = $tab->langs;
|
||||
$this->attribute_list[$tab->name] = $tab->list;
|
||||
$this->attribute_totalizable[$tab->name] = $tab->totalizable;
|
||||
$this->attribute_entityid[$tab->name] = $tab->entity;
|
||||
|
||||
// New usage
|
||||
$this->attributes[$tab->elementtype]['type'][$tab->name] = $tab->type;
|
||||
@ -1028,20 +921,10 @@ class ExtraFields
|
||||
$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
|
||||
{
|
||||
} else {
|
||||
// Old usage
|
||||
$label = $this->attribute_label[$key];
|
||||
$type = $this->attribute_type[$key];
|
||||
$size = $this->attribute_size[$key];
|
||||
$elementtype = $this->attribute_elementtype[$key]; // Seems not used
|
||||
$default = $this->attribute_default[$key];
|
||||
$computed = $this->attribute_computed[$key];
|
||||
$unique = $this->attribute_unique[$key];
|
||||
$required = $this->attribute_required[$key];
|
||||
$param = $this->attribute_param[$key];
|
||||
$langfile = $this->attribute_langfile[$key];
|
||||
$list = $this->attribute_list[$key];
|
||||
$totalizable = $this->attribute_totalizable[$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)
|
||||
}
|
||||
|
||||
@ -1626,20 +1509,10 @@ class ExtraFields
|
||||
$list = dol_eval($this->attributes[$extrafieldsobjectkey]['list'][$key], 1);
|
||||
$help = $this->attributes[$extrafieldsobjectkey]['help'][$key];
|
||||
$hidden = (empty($list) ? 1 : 0); // If $list 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
|
||||
{
|
||||
//dol_syslog("Warning: parameter 'extrafieldsobjectkey' is missing", LOG_WARNING);
|
||||
} else {
|
||||
// Old usage
|
||||
$label = $this->attribute_label[$key];
|
||||
$type = $this->attribute_type[$key];
|
||||
$size = $this->attribute_size[$key];
|
||||
$default = $this->attribute_default[$key];
|
||||
$computed = $this->attribute_computed[$key];
|
||||
$unique = $this->attribute_unique[$key];
|
||||
$required = $this->attribute_required[$key];
|
||||
$param = $this->attribute_param[$key];
|
||||
$perms = dol_eval($this->attribute_perms[$key], 1);
|
||||
$langfile = $this->attribute_langfile[$key];
|
||||
$list = dol_eval($this->attribute_list[$key], 1);
|
||||
$help = ''; // Not supported with old syntax
|
||||
$hidden = (empty($list) ? 1 : 0); // If $list 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)
|
||||
}
|
||||
|
||||
@ -41,7 +41,7 @@ $langs->load("modulebuilder");
|
||||
print '<span class="opacitymedium">'.$langs->trans("DefineHereComplementaryAttributes", $textobject).'</span><br>'."\n";
|
||||
print '<br>';
|
||||
|
||||
// Load attribute_label
|
||||
// Load $extrafields->attributes
|
||||
$extrafields->fetch_name_optionals_label($elementtype);
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
|
||||
@ -157,7 +157,7 @@ class InterfaceTicketEmail extends DolibarrTriggers
|
||||
if (is_array($object->array_options) && count($object->array_options) > 0) {
|
||||
foreach ($object->array_options as $key => $value) {
|
||||
$key = substr($key, 8); // remove "options_"
|
||||
$message_admin .= '<li>'.$langs->trans($extraFields->attributes[$object->element]['label'][$key]).' : '.$extraFields->showOutputField($key, $value).'</li>';
|
||||
$message_admin .= '<li>'.$langs->trans($extraFields->attributes[$object->element]['label'][$key]).' : '.$extraFields->showOutputField($key, $value, '', $object->table_element).'</li>';
|
||||
}
|
||||
}
|
||||
$message_admin .= '</ul>';
|
||||
|
||||
@ -635,7 +635,7 @@ class ProductFournisseur extends Product
|
||||
* @param int $limit Limit
|
||||
* @param int $offset Offset
|
||||
* @param int $socid Filter on a third party id
|
||||
* @return array Array of Products with new properties to define supplier price
|
||||
* @return array Array of ProductFournisseur with new properties to define supplier price
|
||||
*/
|
||||
public function list_product_fournisseur_price($prodid, $sortfield = '', $sortorder = '', $limit = 0, $offset = 0, $socid = 0)
|
||||
{
|
||||
|
||||
@ -99,7 +99,6 @@ if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
// Load attribute_label
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "e.ref", "", "", "", $sortfield, $sortorder);
|
||||
|
||||
@ -1211,7 +1211,7 @@ END;
|
||||
$obj = $db->fetch_object($resql);
|
||||
foreach ($extralabels as $key => $value) {
|
||||
if (!empty($arrayfields['ef.'.$key]['checked']) && !empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && $extrafields->attributes["product_fournisseur_price"]['list'][$key] != 3) {
|
||||
print '<td align="right">'.$extrafields->showOutputField($key, $obj->{$key})."</td>";
|
||||
print '<td align="right">'.$extrafields->showOutputField($key, $obj->{$key}, '', 'product_fournisseur_price')."</td>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -297,7 +297,7 @@ if (empty($reshook) && $action == 'create_ticket' && GETPOST('save', 'alpha')) {
|
||||
if (is_array($object->array_options) && count($object->array_options) > 0) {
|
||||
foreach ($object->array_options as $key => $value) {
|
||||
$key = substr($key, 8); // remove "options_"
|
||||
$message_admin .= '<li>'.$langs->trans($extrafields->attributes[$object->element]['label'][$key]).' : '.$extrafields->showOutputField($key, $value).'</li>';
|
||||
$message_admin .= '<li>'.$langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' : '.$extrafields->showOutputField($key, $value, '', $object->table_element).'</li>';
|
||||
}
|
||||
}
|
||||
$message_admin .= '</ul>';
|
||||
|
||||
@ -651,7 +651,7 @@ if ($action == "view_ticketlist") {
|
||||
}
|
||||
print '>';
|
||||
$tmpkey = 'options_'.$key;
|
||||
print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1);
|
||||
print $extrafields->showOutputField($key, $obj->$tmpkey, '', $object->table_element);
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user