diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index db32cc787e5..6e52660206f 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5,7 +5,7 @@ * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2004 Christophe Combelles - * Copyright (C) 2005-2017 Regis Houssin + * Copyright (C) 2005-2019 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2010-2018 Juanjo Menent * Copyright (C) 2013 Cédric Salvador @@ -111,7 +111,7 @@ function setEntity($currentobject) } else { - return $conf->entity; + return ((is_object($currentobject) && $currentobject->id > 0 && $currentobject->entity > 0) ? $currentobject->entity : $conf->entity); } }