diff --git a/www/class/centreon-clapi/centreonHost.class.php b/www/class/centreon-clapi/centreonHost.class.php index b5d7e299d3921b0fe2137cf2d7f88d84951c7f39..df33a299beb1c564ee85979723882a2831fac286 100644 --- a/www/class/centreon-clapi/centreonHost.class.php +++ b/www/class/centreon-clapi/centreonHost.class.php @@ -901,16 +901,16 @@ class CentreonHost extends CentreonObject $serviceDesc = array('service_description' => $params['service_alias'], 'service_activate' => '1', 'service_register' => '1', - 'service_template_model_stm_id' => $serviceTemplateId, - 'service_hPars' => $hostId); + 'service_template_model_stm_id' => $serviceTemplateId); $svcId = $svcObj->insert($serviceDesc); $hostSvcRel->insert($hostId, $svcId); - $this->params = array_merge($this->params, $serviceDesc); + $serviceDesc['service_hPars'] = $hostId; $this->addAuditLog( 'a', $svcId, $params['service_alias'], - $this->params + $serviceDesc, + 'SERVICE' ); $svcExtended->insert(array($svcExtended->getUniqueLabelField() => $svcId)); } diff --git a/www/class/centreon-clapi/centreonObject.class.php b/www/class/centreon-clapi/centreonObject.class.php index d6d5673a856fa6c697b153e6f6917108420a342d..34f6e05a892488e9e29c1ba2102bf8dca9166ba6 100644 --- a/www/class/centreon-clapi/centreonObject.class.php +++ b/www/class/centreon-clapi/centreonObject.class.php @@ -424,10 +424,11 @@ abstract class CentreonObject * @param int $objId * @param string $objName * @param array $objValues + * @param string|null $objectType - The object type to log if is null use the object type of the class */ - public function addAuditLog($actionType, $objId, $objName, $objValues = array()) + public function addAuditLog($actionType, $objId, $objName, $objValues = array(), $objectType = null) { - $objType = strtoupper($this->action); + $objType = is_null($objectType) ? strtoupper($this->action) : $objectType; $objectTypes = array( 'HTPL' => 'host', 'STPL' => 'service',