Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

fix(clapi) fix duplicate on stpl #5775

Merged
merged 1 commit into from
Oct 12, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions www/class/centreon-clapi/centreonServiceTemplate.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -752,11 +752,19 @@ public function __call($name, $arg)
$relobj->delete(null, $serviceId);
}

$existingRelationIds = $relobj->getTargetIdFromSourceId(
$relobj->getSecondKey(),
$relobj->getFirstKey(),
$serviceId
);
if ((strtolower($matches[2]) === 'hosttemplate') && (strtolower($matches[1]) === 'add')) {
$existingRelationIds = $relobj->getTargetIdFromSourceId(
$relobj->getSecondKey(),
$relobj->getFirstKey(),
$serviceId
);
} else {
$existingRelationIds = $relobj->getTargetIdFromSourceId(
$relobj->getFirstKey(),
$relobj->getSecondKey(),
$serviceId
);
}

foreach ($relationTable as $relationId) {
if ($matches[1] == "del") {
Expand Down