diff --git a/tests/clapi_export/clapi-configuration.txt b/tests/clapi_export/clapi-configuration.txt index fc7fa560d80..6ebacfab511 100644 --- a/tests/clapi_export/clapi-configuration.txt +++ b/tests/clapi_export/clapi-configuration.txt @@ -5010,6 +5010,7 @@ HOST;setparam;Centreon-Server;timezone;0 HOST;setparam;Centreon-Server;host_locked;0 HOST;setparam;Centreon-Server;host_register;1 HOST;setparam;Centreon-Server;host_activate;1 +HOST;addparent;Centreon-Server;test_host HOST;addtemplate;Centreon-Server;generic-host HOST;addtemplate;test_host;my_htpl-test STPL;ADD;generic-service;generic-service; diff --git a/www/class/centreon-clapi/centreonHost.class.php b/www/class/centreon-clapi/centreonHost.class.php index f749f78ebcf..258491aafa0 100644 --- a/www/class/centreon-clapi/centreonHost.class.php +++ b/www/class/centreon-clapi/centreonHost.class.php @@ -1282,7 +1282,11 @@ public function export($filterName = null) echo $this->action . $this->delim . "addparent" . $this->delim . $element[$this->object->getUniqueLabelField()] . $this->delim - . isset($elements[$parentId]) && isset($elements[$parentId][$this->object->getUniqueLabelField()]) ? $elements[$parentId][$this->object->getUniqueLabelField()] : '' . "\n"; + . ((isset($elements[$parentId]) && isset($elements[$parentId][$this->object->getUniqueLabelField()])) + ? $elements[$parentId][$this->object->getUniqueLabelField()] + : '' + ) + . "\n"; } }