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

#5478 - Check if category is not a severity before duplicate contacts #5509

Merged
merged 2 commits into from
Aug 4, 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
Original file line number Diff line number Diff line change
Expand Up @@ -147,20 +147,24 @@ function multipleHostCategoriesInDB($hostcategories = array(), $nbrDup = array()
for ($i = 1; $i <= $nbrDup[$key]; $i++) {
$val = null;
$rq = null;
$level = false;
foreach ($row as $key2 => $value2) {
(isset($key2) && $key2 == "hc_name") ? ($hc_name = $value2 = $value2."_".$i) : null;
$val ? $val .= ($value2!=null?(", '".$value2."'"):", NULL") : $val .= ($value2!=null?("'".$value2."'"):"NULL");
(isset($key2) && $key2 == "hc_name") ? ($hc_name = $value2 = $value2 . "_" . $i) : null;
$val ? $val .= ($value2 != null ? (", '" . $value2 . "'") : ", NULL") : $val .= ($value2 != null ? ("'" . $value2 . "'") : "NULL");
if ($key2 != "hc_id") {
$fields[$key2] = $value2;
}
if ($key2 == "level" && $value2 != "") {
$level = true;
}
}
$fields["hc_name"] = $hc_name;
if (testHostCategorieExistence($hc_name)) {
$val ? $rq = "INSERT INTO hostcategories VALUES (".$val.")" : $rq = null;
$DBRESULT = $pearDB->query($rq);
$DBRESULT = $pearDB->query("SELECT MAX(hc_id) FROM hostcategories");
$maxId = $DBRESULT->fetchRow();
if (isset($maxId["MAX(hc_id)"])) {
if (isset($maxId["MAX(hc_id)"]) && ! $level) {
$hcAcl[$maxId["MAX(hc_id)"]] = $key;
$DBRESULT = $pearDB->query("SELECT DISTINCT hgr.host_host_id FROM hostcategories_relation hgr WHERE hgr.hostcategories_hc_id = '".$key."'");
$fields["hc_hosts"] = "";
Expand Down