Fix: avoid error if $mc object not exists
TODO check if user not linked with the current entity before change entity (thirdparty, invoice, etc.) !!
This commit is contained in:
parent
08c38feb98
commit
cf92f704d8
@ -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)
|
||||
{
|
||||
|
||||
@ -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 '</td>';
|
||||
@ -259,7 +256,7 @@ if ($canreadperms)
|
||||
print img_picto($langs->trans("GlobalGroup"),'redstar');
|
||||
}
|
||||
print "</td>";
|
||||
if (! empty($conf->multicompany->enabled))
|
||||
if (! empty($conf->multicompany->enabled) && is_object($mc))
|
||||
{
|
||||
$mc->getInfo($obj->entity);
|
||||
print '<td>';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user