From 6337fd3667e9599c56c78330d17a5b735437e382 Mon Sep 17 00:00:00 2001 From: Luis Calvo Date: Thu, 5 Nov 2020 14:31:26 +0100 Subject: [PATCH] Fixed CLI update_group --- pandora_server/util/pandora_manage.pl | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index ba141b545f..a6fe3bf63c 100755 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -5754,16 +5754,22 @@ sub cli_delete_group() { sub cli_update_group() { my ($group_id,$group_name,$parent_group_name,$icon,$description) = @ARGV[2..6]; my $result; - $result = db_do ($dbh, 'SELECT * FROM tgrupo WHERE id_grupo=?', $group_id); + + $result = get_db_value ($dbh, 'SELECT * FROM tgrupo WHERE id_grupo=?', $group_id); if($result == "0E0"){ print_log "[ERROR] Group '$group_id' doesn`t exist \n\n"; }else{ if(defined($group_name)){ if(defined($parent_group_name)){ - my $parent_group_id = get_group_id($dbh,$parent_group_name); - exist_check($parent_group_id, 'group name', $parent_group_name); + my $parent_group_id = 0; + + if($parent_group_name ne 'All') { + $parent_group_id = get_group_id($dbh,$parent_group_name); + exist_check($parent_group_id, 'group name', $parent_group_name); + } + if(defined($icon)){ if(defined($description)){ db_do ($dbh,'UPDATE tgrupo SET nombre=? , parent=? , icon=? , description=? WHERE id_grupo=?',$group_name,$parent_group_id,$icon,$description,$group_id);