Merge pull request #7241 from atm-florian/dev_manageextrafieldswithmultientity
fix : Better management for exstrafeild management
This commit is contained in:
commit
54b8fff0d8
@ -337,7 +337,8 @@ if ($action == 'update')
|
||||
(GETPOST('list', 'alpha')?1:0),
|
||||
(GETPOST('ishidden', 'alpha')?1:0),
|
||||
GETPOST('default_value','alpha'),
|
||||
GETPOST('computed_value','alpha')
|
||||
GETPOST('computed_value','alpha'),
|
||||
(GETPOST('entitycurrentorall', 'alpha')?0:'')
|
||||
);
|
||||
if ($result > 0)
|
||||
{
|
||||
|
||||
@ -721,6 +721,8 @@ class ExtraFields
|
||||
{
|
||||
$array_name_label[$tab->name]=$tab->label;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Old usage
|
||||
$this->attribute_type[$tab->name]=$tab->type;
|
||||
@ -737,7 +739,9 @@ class ExtraFields
|
||||
$this->attribute_perms[$tab->name]=$tab->perms;
|
||||
$this->attribute_list[$tab->name]=$tab->list;
|
||||
$this->attribute_hidden[$tab->name]=$tab->ishidden;
|
||||
$this->attribute_entity[$tab->name]=$tab->entity;
|
||||
$this->attribute_entityid[$tab->name]=$tab->entity;
|
||||
|
||||
|
||||
|
||||
// New usage
|
||||
$this->attributes[$tab->elementtype]['type'][$tab->name]=$tab->type;
|
||||
@ -754,7 +758,29 @@ class ExtraFields
|
||||
$this->attributes[$tab->elementtype]['perms'][$tab->name]=$tab->perms;
|
||||
$this->attributes[$tab->elementtype]['list'][$tab->name]=$tab->list;
|
||||
$this->attributes[$tab->elementtype]['ishidden'][$tab->name]=$tab->ishidden;
|
||||
$this->attributes[$tab->elementtype]['entity'][$tab->name]=$tab->entity;
|
||||
$this->attributes[$tab->elementtype]['entityid'][$tab->name]=$tab->entity;
|
||||
|
||||
|
||||
if (!empty($conf->multicompany->enabled)) {
|
||||
$sql_entity_name='SELECT label FROM '.MAIN_DB_PREFIX.'entity WHERE rowid='.$tab->entity;
|
||||
$resql_entity_name=$this->db->query($sql_entity_name);
|
||||
if ($resql_entity_name)
|
||||
{
|
||||
if ($this->db->num_rows($resql_entity_name))
|
||||
{
|
||||
if ($obj = $this->db->fetch_object($resql_entity_name))
|
||||
{
|
||||
$this->attribute_entitylabel[$tab->name]=$obj->label;
|
||||
$this->attributes[$tab->elementtype]['entitylabel'][$tab->name]=$obj->label;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::fetch_name_optionals_label ".$this->error, LOG_ERR);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($elementtype) $this->attributes[$elementtype]['loaded']=1;
|
||||
|
||||
@ -144,7 +144,7 @@ if (! empty($conf->global->MAIN_CAN_HIDE_EXTRAFIELDS)) {
|
||||
$ishidden=$extrafields->attribute_hidden[$attrname];
|
||||
}
|
||||
if ($conf->multicompany->enabled) {
|
||||
$entitycurrentorall=$extrafields->attribute_entity[$attrname];
|
||||
$entitycurrentorall=$extrafields->attribute_entityid[$attrname];
|
||||
}
|
||||
|
||||
if((($type == 'select') || ($type == 'checkbox') || ($type == 'radio')) && is_array($param))
|
||||
|
||||
@ -50,7 +50,7 @@ print '<td align="center">'.$langs->trans("Required").'</td>';
|
||||
print '<td align="center">'.$langs->trans("AlwaysEditable").'</td>';
|
||||
if (! empty($conf->global->MAIN_CAN_HIDE_EXTRAFIELDS)) print '<td align="center">'.$langs->trans("Hidden").'</td>';
|
||||
if ($conf->multicompany->enabled) {
|
||||
print '<td align="center">'.$langs->trans("AllEntities").'</td>';
|
||||
print '<td align="center">'.$langs->trans("Entities").'</td>';
|
||||
}
|
||||
print '<td width="80"> </td>';
|
||||
print "</tr>\n";
|
||||
@ -72,7 +72,7 @@ if (count($extrafields->attribute_type))
|
||||
print '<td align="center">'.yn($extrafields->attribute_alwayseditable[$key])."</td>\n";
|
||||
if (! empty($conf->global->MAIN_CAN_HIDE_EXTRAFIELDS)) print '<td align="center">'.yn($extrafields->attribute_hidden[$key])."</td>\n"; // Add hidden option on not working feature. Why hide if user can't see it.
|
||||
if ($conf->multicompany->enabled) {
|
||||
print '<td align="center">'.($extrafields->attribute_entity[$key]==0?$langs->trans("All"):$langs->trans("Current")).'</td>';
|
||||
print '<td align="center">'.($extrafields->attribute_entityid[$key]==0?$langs->trans("All"):$extrafields->attribute_entitylabel[$key]).'</td>';
|
||||
}
|
||||
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&attrname='.$key.'">'.img_edit().'</a>';
|
||||
print " <a href=\"".$_SERVER["PHP_SELF"]."?action=delete&attrname=$key\">".img_delete()."</a></td>\n";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user