Merge branch 'ent-8786-Borrado-de-IPs-en-agente-Delete-selected-items' into 'develop'

Ent 8786 borrado de i ps en agente delete selected items

See merge request artica/pandorafms!4797
This commit is contained in:
Daniel Rodriguez 2022-04-07 13:31:15 +00:00
commit bfcb4dad5e
2 changed files with 11 additions and 5 deletions

View File

@ -1065,9 +1065,9 @@ if ($update_agent) {
if ($action_delete_ip) {
$delete_ip = get_parameter_post('address_list');
if (empty($direccion_agente) === true) {
$direccideon_agente = agents_delete_address($id_agente, $delete_ip);
$direccion_agente = agents_delete_address($id_agente, $delete_ip, true);
} else {
agents_delete_address($id_agente, $delete_ip);
$direccion_agente = agents_delete_address($id_agente, $delete_ip, true);
}
}
@ -1089,7 +1089,6 @@ if ($update_agent) {
'icon_path' => $icon_path,
'update_gis_data' => $update_gis_data,
'url_address' => $url_description,
'url_address' => $url_description,
'quiet' => $quiet,
'cps' => $cps,
'safe_mode_module' => $safe_mode_module,

View File

@ -2118,7 +2118,7 @@ function agents_add_address($id_agent, $ip_address)
* @param int Agent id
* @param string IP address to unassign
*/
function agents_delete_address($id_agent, $ip_address)
function agents_delete_address($id_agent, $ip_address, $return=false)
{
global $config;
@ -2151,13 +2151,20 @@ function agents_delete_address($id_agent, $ip_address)
$new_ip = reset($new_ips);
}
// Change main address in agent to first one in the list
// Change main address in agent to first one in the list.
db_process_sql_update(
'tagente',
['direccion' => $new_ip],
['id_agente' => $id_agent]
);
} else {
$new_ip = agents_get_address($id_agent);
if (empty($new_ip)) {
$new_ip = '';
}
}
if ($return === true) {
return $new_ip;
}
}