Fixed CLI update_agent adding duplicate agent address references

This commit is contained in:
Calvo 2021-04-07 17:38:38 +02:00
parent 10a7420928
commit 34b361e21a
1 changed files with 8 additions and 2 deletions

View File

@ -3095,11 +3095,17 @@ 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) {
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 {
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';
}