mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-04-08 18:55:09 +02:00
Merge branch 'ent-11353-15662-no-se-anade-mas-de-un-agente-a-la-parada-planificada-mediante-llamada-a-la-api' into 'develop'
Ent 11353 15662 no se anade mas de un agente a la parada planificada mediante llamada a la api See merge request artica/pandorafms!6110
This commit is contained in:
commit
683f9de3b2
@ -7833,24 +7833,26 @@ function api_set_planned_downtimes_add_agents($id, $thrash1, $other, $thrash3)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($other['data'][0])) {
|
if (!empty($other['data'][0])) {
|
||||||
$agents = $other['data'];
|
$agents = explode(';', $other['data'][0]);
|
||||||
$results = false;
|
$results = false;
|
||||||
foreach ($agents as $agent) {
|
foreach ($agents as $agent) {
|
||||||
if (db_get_value_sql(sprintf('SELECT id from tplanned_downtime_agents tpd WHERE tpd.id_agent = %d AND id_downtime = %d', $agent, $id)) === false) {
|
if (!empty($agent)) {
|
||||||
$res = db_process_sql_insert(
|
if (db_get_value_sql(sprintf('SELECT id from tplanned_downtime_agents tpd WHERE tpd.id_agent = %d AND id_downtime = %d', $agent, $id)) === false) {
|
||||||
'tplanned_downtime_agents',
|
$res = db_process_sql_insert(
|
||||||
[
|
'tplanned_downtime_agents',
|
||||||
'id_agent' => $agent,
|
[
|
||||||
'id_downtime' => $id,
|
'id_agent' => $agent,
|
||||||
'all_modules' => 0,
|
'id_downtime' => $id,
|
||||||
'manually_disabled' => 0,
|
'all_modules' => 0,
|
||||||
]
|
'manually_disabled' => 0,
|
||||||
);
|
]
|
||||||
if ($res) {
|
);
|
||||||
$results = true;
|
if ($res) {
|
||||||
|
$results = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
returnError(" Agent $agent is already at the planned downtime.");
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
returnError(" Agent $agent is already at the planned downtime.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user