diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 102d275b968..6332aab4794 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -2195,7 +2195,8 @@ else } // Multicompany - if (! empty($conf->multicompany->enabled)) + // TODO check if user not linked with the current entity before change entity (thirdparty, invoice, etc.) !! + if (! empty($conf->multicompany->enabled) && is_object($mc)) { if (empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity) { diff --git a/htdocs/user/home.php b/htdocs/user/home.php index cb700b9701e..d14c9b8fb21 100644 --- a/htdocs/user/home.php +++ b/htdocs/user/home.php @@ -180,21 +180,18 @@ if ($resql) $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($entity)) - { - $entitystring=$langs->trans("AllEntities"); - } - else - { - $mc->getInfo($entity); - $entitystring=$mc->label; - } - } - } + if (! empty($conf->multicompany->enabled) && is_object($mc)) + { + if (empty($entity)) + { + $entitystring=$langs->trans("AllEntities"); + } + else + { + $mc->getInfo($entity); + $entitystring=$mc->label; + } + } print ($entitystring?' ('.$entitystring.')':''); print ''; @@ -259,7 +256,7 @@ if ($canreadperms) print img_picto($langs->trans("GlobalGroup"),'redstar'); } print ""; - if (! empty($conf->multicompany->enabled)) + if (! empty($conf->multicompany->enabled) && is_object($mc)) { $mc->getInfo($obj->entity); print '