diff --git a/tests/clapi_export/clapi-configuration.txt b/tests/clapi_export/clapi-configuration.txt index 6cc2aba1e5f..605f5427baa 100644 --- a/tests/clapi_export/clapi-configuration.txt +++ b/tests/clapi_export/clapi-configuration.txt @@ -5023,6 +5023,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 625c54f1dd3..5dce8d0c894 100644 --- a/www/class/centreon-clapi/centreonHost.class.php +++ b/www/class/centreon-clapi/centreonHost.class.php @@ -1293,7 +1293,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"; } }