From 3474c6b88f69185cd1bcb0ca4a0d286e6e4fa17f Mon Sep 17 00:00:00 2001 From: Milan Date: Sun, 19 Apr 2020 15:39:30 +0200 Subject: [PATCH] roles.cgi: sort keys --- website/agenda/planung/roles.cgi | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/website/agenda/planung/roles.cgi b/website/agenda/planung/roles.cgi index 745ba01..6cb2200 100755 --- a/website/agenda/planung/roles.cgi +++ b/website/agenda/planung/roles.cgi @@ -110,7 +110,7 @@ sub save_roles { #initialize all value ids (given by params matching to database columns) my $values = {}; - for my $param ( keys %$params ) { + for my $param ( sort keys %$params ) { if ( $param =~ /(.+?)\_(\d+)?$/ ) { my $column = $1; my $id = $2 || ''; @@ -120,7 +120,7 @@ sub save_roles { } #init checkbox values with 0 - for my $id ( keys %$values ) { + for my $id ( sort keys %$values ) { if ( update_allowed( $permissions, $role_by_id, $id ) ) { for my $column ( keys %$columns ) { next @@ -135,11 +135,11 @@ sub save_roles { } #set all checkbox values to 1 - for my $param ( keys %$params ) { + for my $param ( sort keys %$params ) { if ( $param =~ /(.+?)\_(\d+)?$/ ) { my $column = $1; my $id = $2 || ''; - next unless ( defined $columns->{$column} ); + next unless defined $columns->{$column}; if ( update_allowed( $permissions, $role_by_id, $id ) ) { my $value = $params->{$param} || ''; if ( $column eq 'level' ) { @@ -190,7 +190,7 @@ sub save_roles { if ( $id eq '' ) { #insert role - next if ( $role->{role} eq '' ); + next if $role->{role} eq ''; if ( defined $role_from_db ) { uac::print_error("a role with name '$role->{role}' already exists!"); next; @@ -387,8 +387,6 @@ sub sort_columns { my $index = $groups->{$group} || 0; $index += $actions->{$action} if defined $actions->{$action}; $column_level->{$column} = $index; - - # print $index."
"; } my @columns = sort { $column_level->{$a} <=> $column_level->{$b} } ( keys %$column_level );