Private GIT

Skip to content
Snippets Groups Projects
Commit 931340b4 authored by Laurent Pinsivy's avatar Laurent Pinsivy Committed by loiclau
Browse files

It is better to get MAX(traps_id) before use it (#5415)

parent b90307ec
No related branches found
No related tags found
No related merge requests found
......@@ -460,6 +460,9 @@ class CentreonTraps
$rq .= "'".$this->db->escape($ret["traps_customcode"])."') ";
$this->db->query($rq);
$res = $this->db->query("SELECT MAX(traps_id) FROM traps");
$traps_id = $res->fetchRow();
$this->setMatchingOptions($traps_id['MAX(traps_id)'], $_POST);
$this->setServiceRelations($traps_id['MAX(traps_id)']);
$this->setServiceTemplateRelations($traps_id['MAX(traps_id)']);
......@@ -468,9 +471,6 @@ class CentreonTraps
$this->setServiceTemplateRelations($traps_id['MAX(traps_id)'], $ret['service_templates']);
}
$res = $this->db->query("SELECT MAX(traps_id) FROM traps");
$traps_id = $res->fetchRow();
/* Prepare value for changelog */
$fields = CentreonLogAction::prepareChanges($ret);
$this->centreon->CentreonLogAction->insertLog(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment