summaryrefslogtreecommitdiff
path: root/lib/RHRD/rddb.pm
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2015-10-09 17:40:46 (GMT)
committerChristian Pointner <equinox@spreadspace.org>2015-10-09 17:40:46 (GMT)
commitc253bf234deafa69ed2e462c8ec2d8f41b484e9e (patch)
tree27e4abb33d56ebf23ac0877baebfc0fde1cfa850 /lib/RHRD/rddb.pm
parentc6c891b3921dce1cb3575e67a6f45f0fb24f722d (diff)
added some checks before drastic changes of a group
Diffstat (limited to 'lib/RHRD/rddb.pm')
-rwxr-xr-xlib/RHRD/rddb.pm16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/RHRD/rddb.pm b/lib/RHRD/rddb.pm
index 5aedef4..67b431f 100755
--- a/lib/RHRD/rddb.pm
+++ b/lib/RHRD/rddb.pm
@@ -907,15 +907,23 @@ sub get_shows_next_free_slot
sub list_shows
{
- my ($ctx) = @_;
+ my ($ctx, $groupname) = @_;
- my $sql = qq{select TO_CART,SET_USER_DEFINED from DROPBOXES where STATION_NAME=? order by TO_CART;};
+ my $sql = qq{select TO_CART,SET_USER_DEFINED from DROPBOXES where STATION_NAME = ? order by TO_CART;};
+ if(defined($groupname)) {
+ $sql = qq{select TO_CART,SET_USER_DEFINED from DROPBOXES where STATION_NAME = ? and GROUP_NAME = ? order by TO_CART;};
+ }
my $sth = $ctx->{'dbh'}->prepare($sql)
or return (undef, 'ERROR', "Database Error: " . $ctx->{'dbh'}->errstr);
- $sth->execute($ctx->{'config'}{'dropboxes'}{'dropbox-pseudo-station'})
- or return (undef, 'ERROR', "Database Error: " . $sth->errstr);
+ unless(defined($groupname)) {
+ $sth->execute($ctx->{'config'}{'dropboxes'}{'dropbox-pseudo-station'})
+ or return (undef, 'ERROR', "Database Error: " . $sth->errstr);
+ } else {
+ $sth->execute($ctx->{'config'}{'dropboxes'}{'dropbox-pseudo-station'}, $groupname)
+ or return (undef, 'ERROR', "Database Error: " . $sth->errstr);
+ }
my @show_dbs;
while(my ($to_cart, $params, $lowcart, $highcart) = $sth->fetchrow_array()) {