Code cleaner when we are using multicompany

This commit is contained in:
Laurent Destailleur 2015-04-10 11:40:24 +02:00
parent c25872b182
commit d944c3bf17
2 changed files with 31 additions and 6 deletions

View File

@ -78,7 +78,27 @@ foreach($fulltree as $key => $val)
$userstatic->firstname=$val['firstname'];
$userstatic->lastname=$val['lastname'];
$userstatic->statut=$val['statut'];
$li=$userstatic->getNomUrl(1,'').' ('.$val['login'].(empty($conf->multicompany->enabled)?'':' - '.$langs->trans("Instance").' '.$val['entity']).')';
$entity=$val['entity'];
$entitystring='';
// TODO Set of entitystring should be done with a hook
if (is_object($mc))
{
if (! empty($conf->multicompany->enabled))
{
if (empty($entity))
{
$entitystring=$langs->trans("AllEntities");
}
else
{
$mc->getInfo($entity);
$entitystring=$mc->label;
}
}
}
$li=$userstatic->getNomUrl(1,'').' ('.$val['login'].($entitystring?' - '.$entitystring:'').')';
$data[] = array(
'rowid'=>$val['rowid'],

View File

@ -176,22 +176,27 @@ if ($resql)
{
print ' ('.$langs->trans("DomainUser").')';
}
// TODO This should be done with a hook
$entity=$obj->entity;
$entitystring='';
// TODO Set of entitystring should be done with a hook
if (is_object($mc))
{
if (! empty($conf->multicompany->enabled))
{
if (empty($obj->entity))
if (empty($entity))
{
print ' ('.$langs->trans("AllEntities").')';
$entitystring=$langs->trans("AllEntities");
}
else
{
$mc->getInfo($obj->entity);
print ' ('.$mc->label.')';
$mc->getInfo($entity);
$entitystring=$mc->label;
}
}
}
print ($entitystring?' ('.$entitystring.')':'');
print '</td>';
print '<td align="right">'.dol_print_date($db->jdate($obj->datec),'dayhour').'</td>';
print '<td align="right">';