fixed api methods for creating and deleting scheduled downtimes agents

This commit is contained in:
alejandro.campos@artica.es 2022-09-19 10:44:25 +02:00
parent 3524cdac6c
commit 181a480b9d
1 changed files with 2 additions and 4 deletions

View File

@ -7685,8 +7685,7 @@ function api_set_planned_downtimes_delete_agents($id, $thrash1, $other, $thrash3
} }
if (!empty($other['data'][0])) { if (!empty($other['data'][0])) {
$agents = io_safe_input($other['data']); $agents = $other['data'];
$agents = explode(';', $agents);
$results = false; $results = false;
foreach ($agents as $agent) { foreach ($agents as $agent) {
if (db_get_value_sql(sprintf('SELECT id from tplanned_downtime_agents WHERE id_agent = %d AND id_downtime = %d', $agent, $id)) !== false) { if (db_get_value_sql(sprintf('SELECT id from tplanned_downtime_agents WHERE id_agent = %d AND id_downtime = %d', $agent, $id)) !== false) {
@ -7762,8 +7761,7 @@ function api_set_planned_downtimes_add_agents($id, $thrash1, $other, $thrash3)
} }
if (!empty($other['data'][0])) { if (!empty($other['data'][0])) {
$agents = io_safe_input($other['data']); $agents = $other['data'];
$agents = explode(';', $agents);
$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 (db_get_value_sql(sprintf('SELECT id from tplanned_downtime_agents tpd WHERE tpd.id_agent = %d AND id_downtime = %d', $agent, $id)) === false) {