#8786 Fixed delete address
This commit is contained in:
parent
ad957c5a72
commit
dcdcbfad88
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue