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

Commit

Permalink
5478 - Check if category is not a severity before duplicate contacts (#…
Browse files Browse the repository at this point in the history
…5509)

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

* * fix style
  • Loading branch information
lpinsivy authored and loiclau committed Aug 4, 2017
1 parent b6cd03e commit b4cd3aa
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ 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
Expand All @@ -156,14 +157,17 @@ function multipleHostCategoriesInDB($hostcategories = array(), $nbrDup = array()
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;
$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;
$query = "SELECT DISTINCT hgr.host_host_id FROM hostcategories_relation hgr " .
"WHERE hgr.hostcategories_hc_id = '" . $key . "'";
Expand Down

0 comments on commit b4cd3aa

Please sign in to comment.