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
|
// 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)
|
if (empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -180,21 +180,18 @@ if ($resql)
|
|||||||
$entity=$obj->entity;
|
$entity=$obj->entity;
|
||||||
$entitystring='';
|
$entitystring='';
|
||||||
// TODO Set of entitystring should be done with a hook
|
// TODO Set of entitystring should be done with a hook
|
||||||
if (is_object($mc))
|
if (! empty($conf->multicompany->enabled) && is_object($mc))
|
||||||
{
|
{
|
||||||
if (! empty($conf->multicompany->enabled))
|
if (empty($entity))
|
||||||
{
|
{
|
||||||
if (empty($entity))
|
$entitystring=$langs->trans("AllEntities");
|
||||||
{
|
}
|
||||||
$entitystring=$langs->trans("AllEntities");
|
else
|
||||||
}
|
{
|
||||||
else
|
$mc->getInfo($entity);
|
||||||
{
|
$entitystring=$mc->label;
|
||||||
$mc->getInfo($entity);
|
}
|
||||||
$entitystring=$mc->label;
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
print ($entitystring?' ('.$entitystring.')':'');
|
print ($entitystring?' ('.$entitystring.')':'');
|
||||||
|
|
||||||
print '</td>';
|
print '</td>';
|
||||||
@ -259,7 +256,7 @@ if ($canreadperms)
|
|||||||
print img_picto($langs->trans("GlobalGroup"),'redstar');
|
print img_picto($langs->trans("GlobalGroup"),'redstar');
|
||||||
}
|
}
|
||||||
print "</td>";
|
print "</td>";
|
||||||
if (! empty($conf->multicompany->enabled))
|
if (! empty($conf->multicompany->enabled) && is_object($mc))
|
||||||
{
|
{
|
||||||
$mc->getInfo($obj->entity);
|
$mc->getInfo($obj->entity);
|
||||||
print '<td>';
|
print '<td>';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user