Merge branch 'ent-6692-error-CLI-update-group' into 'develop'

Fixed CLI update_group

See merge request artica/pandorafms!3596
This commit is contained in:
Daniel Rodriguez 2020-12-01 11:57:07 +01:00
commit e2bffd30c1
1 changed files with 9 additions and 3 deletions

View File

@ -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);