From 4a96fd0d77bfd61a1b1b74db6879cfead96771ba Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Fri, 30 May 2014 13:08:01 +0200 Subject: [PATCH] Fix: No error once multicompany module has been removed. --- htdocs/user/fiche.php | 30 +++++++++++++++++------------- htdocs/user/home.php | 36 ++++++++++++++++++++---------------- 2 files changed, 37 insertions(+), 29 deletions(-) diff --git a/htdocs/user/fiche.php b/htdocs/user/fiche.php index 85c6e815642..32a4e9d25ec 100644 --- a/htdocs/user/fiche.php +++ b/htdocs/user/fiche.php @@ -1300,19 +1300,23 @@ else } // Multicompany - if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity) - { - print '<tr><td valign="top">'.$langs->trans("Entity").'</td><td width="75%" class="valeur">'; - if ($object->admin && ! $object->entity) - { - print $langs->trans("AllEntities"); - } - else - { - $mc->getInfo($object->entity); - print $mc->label; - } - print "</td></tr>\n"; + // TODO This should be done with hook formObjectOption + if (is_object($mc)) + { + if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity) + { + print '<tr><td valign="top">'.$langs->trans("Entity").'</td><td width="75%" class="valeur">'; + if ($object->admin && ! $object->entity) + { + print $langs->trans("AllEntities"); + } + else + { + $mc->getInfo($object->entity); + print $mc->label; + } + print "</td></tr>\n"; + } } // Other attributes diff --git a/htdocs/user/home.php b/htdocs/user/home.php index 3f43e40e43a..28eade2859f 100644 --- a/htdocs/user/home.php +++ b/htdocs/user/home.php @@ -148,26 +148,30 @@ if ($resql) $companystatic->canvas=$obj->canvas; print $companystatic->getNomUrl(1); } - else if (! empty($conf->multicompany->enabled)) - { - if ($obj->admin && ! $obj->entity) - { - print $langs->trans("AllEntities"); - } - else - { - $mc->getInfo($obj->entity); - print $mc->label; - } - } - else if ($obj->ldap_sid) - { - print $langs->trans("DomainUser"); - } else { print $langs->trans("InternalUser"); } + if ($obj->ldap_sid) + { + print ' ('.$langs->trans("DomainUser").')'; + } + // TODO This should be done with a hook + if (is_object($mc)) + { + if (! empty($conf->multicompany->enabled)) + { + if ($obj->admin && ! $obj->entity) + { + print ' ('.$langs->trans("AllEntities").')'; + } + else + { + $mc->getInfo($obj->entity); + print ' ('.$mc->label.')'; + } + } + } print '</td>'; print '<td align="right">'.dol_print_date($db->jdate($obj->datec),'dayhour').'</td>'; print '<td align="right">'; -- GitLab