diff --git a/www/class/centreon-clapi/centreonHost.class.php b/www/class/centreon-clapi/centreonHost.class.php index 372b8fe41f66c5282c7fe2085b905ec9778c1156..01e7b0314c8a3e0634ad5d1d6da29c8a637afeee 100644 --- a/www/class/centreon-clapi/centreonHost.class.php +++ b/www/class/centreon-clapi/centreonHost.class.php @@ -906,16 +906,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 47ccfad329f3834e75b8e5c7259fdb704dd9e972..2cf2d845e08c04290b929c1747ff8b63688ecc02 100644 --- a/www/class/centreon-clapi/centreonObject.class.php +++ b/www/class/centreon-clapi/centreonObject.class.php @@ -443,10 +443,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',