diff --git a/application/applicationcontext.class.inc.php b/application/applicationcontext.class.inc.php index ca74cef53..374b6ceb0 100644 --- a/application/applicationcontext.class.inc.php +++ b/application/applicationcontext.class.inc.php @@ -77,12 +77,16 @@ class ApplicationContext protected $aValues; protected static $aDefaultValues; // Cache shared among all instances - public function __construct() + public function __construct($bReadContext = true) { $this->aNames = array( 'org_id', 'menu' ); - $this->ReadContext(); + if ($bReadContext) + { + $this->ReadContext(); + } + } /** diff --git a/pages/ajax.render.php b/pages/ajax.render.php index 8bcdd456a..ac8957e3b 100644 --- a/pages/ajax.render.php +++ b/pages/ajax.render.php @@ -442,6 +442,18 @@ try { $aExtraParams = json_decode(str_replace("'", '"', $sExtraParams), true /* associative array */); } + // Restore the app context from the ExtraParams + $oAppContext = new ApplicationContext(false); // false => don't read the context yet ! + $aContext = array(); + foreach($oAppContext->GetNames() as $sName) + { + $sParamName = 'c['.$sName.']'; + if (isset($aExtraParams[$sParamName])) + { + $aContext[$sName] = $aExtraParams[$sParamName]; + } + } + $_REQUEST['c'] = $aContext; if ($sEncoding == 'oql') { $oFilter = CMDBSearchFilter::FromOQL($sFilter);