Merge pull request #3189 from hregis/3.8_bug
Fix: avoid error if $mc object not exists
This commit is contained in:
commit
24d8485b3d
@ -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)
|
||||
{
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011 Herve Prot <herve.prot@symeos.com>
|
||||
* Copyright (C) 2012 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
@ -239,7 +239,7 @@ if ($action == 'create')
|
||||
print '<td class="valeur"><input size="30" type="text" id="nom" name="nom" value=""></td></tr>';
|
||||
|
||||
// Multicompany
|
||||
if (! empty($conf->multicompany->enabled))
|
||||
if (! empty($conf->multicompany->enabled) && is_object($mc))
|
||||
{
|
||||
if (empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity)
|
||||
{
|
||||
@ -326,7 +326,7 @@ else
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Multicompany
|
||||
if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity)
|
||||
if (! empty($conf->multicompany->enabled) && is_object($mc) && empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity)
|
||||
{
|
||||
$mc->getInfo($object->entity);
|
||||
print "<tr>".'<td valign="top">'.$langs->trans("Entity").'</td>';
|
||||
@ -401,7 +401,7 @@ else
|
||||
print $form->select_dolusers('','user',1,$exclude,0,'','',$object->entity);
|
||||
print ' ';
|
||||
// Multicompany
|
||||
if (! empty($conf->multicompany->enabled))
|
||||
if (! empty($conf->multicompany->enabled) && is_object($mc))
|
||||
{
|
||||
if ($conf->entity == 1 && $conf->multicompany->transverse_mode)
|
||||
{
|
||||
@ -455,7 +455,7 @@ else
|
||||
print '</td>';
|
||||
print '<td>'.$useringroup->lastname.'</td>';
|
||||
print '<td>'.$useringroup->firstname.'</td>';
|
||||
if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity)
|
||||
if (! empty($conf->multicompany->enabled) && is_object($mc) && ! empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity)
|
||||
{
|
||||
print '<td class="valeur">';
|
||||
if (! empty($useringroup->usergroup_entity))
|
||||
@ -513,7 +513,7 @@ else
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Multicompany
|
||||
if (! empty($conf->multicompany->enabled))
|
||||
if (! empty($conf->multicompany->enabled) && is_object($mc))
|
||||
{
|
||||
if (empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity)
|
||||
{
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011 Herve Prot <herve.prot@symeos.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -108,7 +108,7 @@ if ($resql)
|
||||
}
|
||||
print "</td>";
|
||||
//multicompany
|
||||
if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode) && $conf->entity == 1)
|
||||
if (! empty($conf->multicompany->enabled) && is_object($mc) && empty($conf->multicompany->transverse_mode) && $conf->entity == 1)
|
||||
{
|
||||
$mc->getInfo($obj->entity);
|
||||
print '<td align="center">'.$mc->label.'</td>';
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -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