summaryrefslogtreecommitdiff
path: root/lib/RHRD/rddb.pm
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2016-07-25 21:22:08 (GMT)
committerChristian Pointner <equinox@helsinki.at>2016-07-25 21:22:45 (GMT)
commit343ac9e3baec46fef765d7193a92555fea7e288c (patch)
treeed2c7e6af96d45a06934e2e1c7ad55b9ae2201d5 /lib/RHRD/rddb.pm
parentca5e48c874c015ce60e43fb5ccf73845fe46b6a2 (diff)
list groups by type
Diffstat (limited to 'lib/RHRD/rddb.pm')
-rwxr-xr-xlib/RHRD/rddb.pm19
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();