Merge remote-tracking branch 'refs/remotes/Dolibarr/develop' into develop

This commit is contained in:
Darkjeff 2017-08-10 14:54:32 +02:00
commit f75deb939d
5 changed files with 34 additions and 7 deletions

View File

@ -337,7 +337,8 @@ if ($action == 'update')
(GETPOST('list', 'alpha')?1:0), (GETPOST('list', 'alpha')?1:0),
(GETPOST('ishidden', 'alpha')?1:0), (GETPOST('ishidden', 'alpha')?1:0),
GETPOST('default_value','alpha'), GETPOST('default_value','alpha'),
GETPOST('computed_value','alpha') GETPOST('computed_value','alpha'),
(GETPOST('entitycurrentorall', 'alpha')?0:'')
); );
if ($result > 0) if ($result > 0)
{ {

View File

@ -721,6 +721,8 @@ class ExtraFields
{ {
$array_name_label[$tab->name]=$tab->label; $array_name_label[$tab->name]=$tab->label;
} }
// Old usage // Old usage
$this->attribute_type[$tab->name]=$tab->type; $this->attribute_type[$tab->name]=$tab->type;
@ -737,7 +739,9 @@ class ExtraFields
$this->attribute_perms[$tab->name]=$tab->perms; $this->attribute_perms[$tab->name]=$tab->perms;
$this->attribute_list[$tab->name]=$tab->list; $this->attribute_list[$tab->name]=$tab->list;
$this->attribute_hidden[$tab->name]=$tab->ishidden; $this->attribute_hidden[$tab->name]=$tab->ishidden;
$this->attribute_entity[$tab->name]=$tab->entity; $this->attribute_entityid[$tab->name]=$tab->entity;
// New usage // New usage
$this->attributes[$tab->elementtype]['type'][$tab->name]=$tab->type; $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]['perms'][$tab->name]=$tab->perms;
$this->attributes[$tab->elementtype]['list'][$tab->name]=$tab->list; $this->attributes[$tab->elementtype]['list'][$tab->name]=$tab->list;
$this->attributes[$tab->elementtype]['ishidden'][$tab->name]=$tab->ishidden; $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; if ($elementtype) $this->attributes[$elementtype]['loaded']=1;

View File

@ -144,7 +144,7 @@ if (! empty($conf->global->MAIN_CAN_HIDE_EXTRAFIELDS)) {
$ishidden=$extrafields->attribute_hidden[$attrname]; $ishidden=$extrafields->attribute_hidden[$attrname];
} }
if ($conf->multicompany->enabled) { if ($conf->multicompany->enabled) {
$entitycurrentorall=$extrafields->attribute_entity[$attrname]; $entitycurrentorall=$extrafields->attribute_entityid[$attrname];
} }
if((($type == 'select') || ($type == 'checkbox') || ($type == 'radio')) && is_array($param)) if((($type == 'select') || ($type == 'checkbox') || ($type == 'radio')) && is_array($param))

View File

@ -50,7 +50,7 @@ print '<td align="center">'.$langs->trans("Required").'</td>';
print '<td align="center">'.$langs->trans("AlwaysEditable").'</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 (! empty($conf->global->MAIN_CAN_HIDE_EXTRAFIELDS)) print '<td align="center">'.$langs->trans("Hidden").'</td>';
if ($conf->multicompany->enabled) { if ($conf->multicompany->enabled) {
print '<td align="center">'.$langs->trans("AllEntities").'</td>'; print '<td align="center">'.$langs->trans("Entities").'</td>';
} }
print '<td width="80">&nbsp;</td>'; print '<td width="80">&nbsp;</td>';
print "</tr>\n"; print "</tr>\n";
@ -72,7 +72,7 @@ if (count($extrafields->attribute_type))
print '<td align="center">'.yn($extrafields->attribute_alwayseditable[$key])."</td>\n"; 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 (! 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) { 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 '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&attrname='.$key.'">'.img_edit().'</a>';
print "&nbsp; <a href=\"".$_SERVER["PHP_SELF"]."?action=delete&attrname=$key\">".img_delete()."</a></td>\n"; print "&nbsp; <a href=\"".$_SERVER["PHP_SELF"]."?action=delete&attrname=$key\">".img_delete()."</a></td>\n";

View File

@ -956,7 +956,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
} }
// Fields from hook // Fields from hook
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$task_time);
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;