From 34b361e21ad3ccb7a97b1d39e81ed97574646b3a Mon Sep 17 00:00:00 2001 From: Calvo Date: Wed, 7 Apr 2021 17:38:38 +0200 Subject: [PATCH] Fixed CLI update_agent adding duplicate agent address references --- pandora_server/util/pandora_manage.pl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index d84e8a8bd4..19a61be9f7 100755 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -3095,10 +3095,16 @@ sub cli_agent_update() { # Add the address to the agent if (defined $use_alias and $use_alias eq 'use_alias') { foreach my $id (@id_agents) { - add_new_address_agent ($dbh, $address_id, $id->{'id_agente'}); + my $ag_addr_id = get_agent_addr_id($dbh, $address_id, $id->{'id_agente'}); + if($ag_addr_id == -1) { + add_new_address_agent ($dbh, $address_id, $id->{'id_agente'}); + } } } else { - add_new_address_agent ($dbh, $address_id, $id_agent); + my $ag_addr_id = get_agent_addr_id($dbh, $address_id, $id_agent); + if($ag_addr_id == -1) { + add_new_address_agent ($dbh, $address_id, $id_agent); + } } $field = 'direccion';