summaryrefslogtreecommitdiff
path: root/lib/RHRD/rddb.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/RHRD/rddb.pm')
-rwxr-xr-xlib/RHRD/rddb.pm42
1 files changed, 42 insertions, 0 deletions
diff --git a/lib/RHRD/rddb.pm b/lib/RHRD/rddb.pm
index 07e0f86..5aedef4 100755
--- a/lib/RHRD/rddb.pm
+++ b/lib/RHRD/rddb.pm
@@ -968,9 +968,32 @@ sub create_show_group
return (undef, $status, $errorstring);
}
+ for my $user (@{$ctx->{'config'}{'specialusers'}{'allshows'}}) {
+ ($cnt, $status, $errorstring) = RHRD::rddb::add_group_member($ctx, $groupname, $user);
+ return (undef, $status, $errorstring) unless(defined $cnt);
+ }
+
return ($low_cart, 'OK', 'success');
}
+sub get_show_group
+{
+ my ($ctx, $showid) = @_;
+
+ my $sql = qq{select GROUP_NAME from DROPBOXES where TO_CART = ? and DROPBOXES.STATION_NAME = ?;};
+ my $sth = $ctx->{'dbh'}->prepare($sql)
+ or return (undef, 'ERROR', "Database Error: " . $ctx->{'dbh'}->errstr);
+
+ $sth->execute($showid, $ctx->{'config'}{'dropboxes'}{'dropbox-pseudo-station'})
+ or return (undef, 'ERROR', "Database Error: " . $sth->errstr);
+
+ my ($groupname) = $sth->fetchrow_array();
+ unless(defined($groupname)) {
+ return (undef, 'ERROR', "Show not found");
+ }
+ return ($groupname, 'OK', 'success');
+}
+
sub get_show_group_cart_range
{
my ($ctx, $showid) = @_;
@@ -1240,6 +1263,11 @@ sub remove_show
return (undef, $status, $errorstring);
}
+ my @show_carts = get_show_carts($ctx, $showid);
+ if(!defined $show_carts[0] && defined $show_carts[1]) {
+ return (undef, $show_carts[1], $show_carts[2]);
+ }
+
my @actions = ({
# Delete Dropbox
sql => qq{delete from DROPBOXES where TO_CART = ?;},
@@ -1271,6 +1299,20 @@ sub remove_show
$sth->finish();
}
+ if(!defined $show_carts[0]) {
+ push @actions, { name => 'audio carts', cnt => 0 };
+ } else {
+ my $sth = $ctx->{'dbh'}->prepare(qq{delete from CART where NUMBER = ?;})
+ or return (undef, 'ERROR', "Database Error: " . $ctx->{'dbh'}->errstr);
+
+ my $cnt = 0;
+ for my $cart (@show_carts) {
+ $cnt += ($sth->execute($cart) or return (undef, 'ERROR', "Database Error: " . $sth->errstr));
+ }
+ $sth->finish();
+ push @actions, { name => 'audio carts', cnt => $cnt };
+ }
+
(my $cnt, $status, $errorstring) = drop_log_table($ctx, $logname);
unless (defined $cnt) {
return (undef, $status, $errorstring);