From d7113a3602f3abdd4947ac6ad8eec83dcfe7e283 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 19 Oct 2017 17:32:23 +0200 Subject: [PATCH] Fix init of environment for a dedicated entity in API --- htdocs/api/class/api_access.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/api/class/api_access.class.php b/htdocs/api/class/api_access.class.php index 5c6acfb9a84..41ff488136d 100644 --- a/htdocs/api/class/api_access.class.php +++ b/htdocs/api/class/api_access.class.php @@ -118,7 +118,7 @@ class DolibarrApiAccess implements iAuthenticate $stored_key = $obj->api_key; $userentity = $obj->entity; - if (! defined("DOLENTITY") && $conf->entity != $obj->entity) // If API was not forced with HTTP_DOLENTITY, and user is on another entity, so we reset entity to entity of user + if (! defined("DOLENTITY") && $conf->entity != ($obj->entity?$obj->entity:1)) // If API was not forced with HTTP_DOLENTITY, and user is on another entity, so we reset entity to entity of user { $conf->entity = ($obj->entity?$obj->entity:1); // We must also reload global conf to get params from the entity