Merge branch 'ent-9169-13822-error-al-actualizar-informacion-de-un-agente-cuando-se-llega-al-maximo-de-agentes-de-un' into 'develop'

Fix edit agent when group limit is reached

See merge request artica/pandorafms!5085
This commit is contained in:
Diego Muñoz-Reja 2022-09-21 11:03:29 +00:00
commit 158af125e2
1 changed files with 2 additions and 1 deletions

View File

@ -1052,9 +1052,10 @@ if ($update_agent) {
$exists_ip = db_get_row_sql($sql);
}
$old_group = agents_get_agent_group($id_agente);
if ($grupo <= 0) {
ui_print_error_message(__('The group id %d is incorrect.', $grupo));
} else if (group_allow_more_agents($grupo, true, 'update') === false) {
} else if ($old_group !== $grupo && group_allow_more_agents($grupo, true, 'update') === false) {
ui_print_error_message(__('Agent cannot be updated due to the maximum agent limit for this group'));
} else if ($exists_ip) {
ui_print_error_message(__('Duplicate main IP address'));