diff options
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/RHRD/rddb.pm | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/lib/RHRD/rddb.pm b/lib/RHRD/rddb.pm index bfa31fd..10148f8 100755 --- a/lib/RHRD/rddb.pm +++ b/lib/RHRD/rddb.pm @@ -551,7 +551,7 @@ sub get_user_groups { my ($ctx, $username) = @_; - my $sql = qq{select GROUP_NAME from USER_PERMS where USER_NAME = ?;}; + my $sql = qq{select GROUP_NAME from USER_PERMS where USER_NAME = ? oder by GROUP_NAME;}; my $sth = $ctx->{'dbh'}->prepare($sql) or return (undef, 'ERROR', "Database Error: " . $ctx->{'dbh'}->errstr); @@ -852,17 +852,28 @@ sub remove_group_member sub list_groups { - my ($ctx) = @_; + my ($ctx, $type) = @_; + + my $min_cart = RD_MIN_CART; + my $max_cart = RD_MAX_CART; + if(defined $type) { + ($min_cart, $max_cart) = get_shows_cart_range($ctx) if($type eq "shows"); + ($min_cart, $max_cart) = get_jingles_cart_range($ctx) if($type eq "jingles"); + ($min_cart, $max_cart) = get_musicpools_cart_range($ctx) if($type eq "pools"); + } - my $sql = qq{select NAME from GROUPS order by DEFAULT_LOW_CART;}; + my $sql = qq{select NAME from GROUPS where DEFAULT_LOW_CART >= ? and DEFAULT_HIGH_CART <= ? order by DEFAULT_LOW_CART;}; my $sth = $ctx->{'dbh'}->prepare($sql) or return (undef, 'ERROR', "Database Error: " . $ctx->{'dbh'}->errstr); - $sth->execute() + $sth->execute($min_cart, $max_cart) or return (undef, 'ERROR', "Database Error: " . $sth->errstr); my @groups; while(my ($group) = $sth->fetchrow_array()) { + next if($group eq $ctx->{'config'}{'specialgroups'}{'allshows'}); + next if($group eq $ctx->{'config'}{'specialgroups'}{'alljingles'}); + next if($group eq $ctx->{'config'}{'specialgroups'}{'allpools'}); push @groups, $group; } $sth->finish(); |