diff options
author | Christian Pointner <equinox@spreadspace.org> | 2015-10-09 17:03:10 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2015-10-09 17:03:10 (GMT) |
commit | c6c891b3921dce1cb3575e67a6f45f0fb24f722d (patch) | |
tree | a2f747eea6c2f51ceea679a93c2f3740aefa2ff7 /lib | |
parent | 91a5a9072f82cef110535917a4601f14ddd9fa31 (diff) |
improved show deletion
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/RHRD/rddb.pm | 42 |
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); |