summaryrefslogtreecommitdiff
path: root/lib/RHRD/rddb.pm
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2015-10-09 21:52:32 (GMT)
committerChristian Pointner <equinox@spreadspace.org>2015-10-09 21:52:32 (GMT)
commit8101926eadf4723bb027cf53e3f2831d3d5d26b2 (patch)
tree298cf260635b4cb10a5d8a99ddc61673d5ab4cf3 /lib/RHRD/rddb.pm
parent79151dc4de2bb8758cd220ee0111c25edadc99e7 (diff)
add show groups to default service, also deleting cuts when removing groups
Diffstat (limited to 'lib/RHRD/rddb.pm')
-rwxr-xr-xlib/RHRD/rddb.pm23
1 files changed, 20 insertions, 3 deletions
diff --git a/lib/RHRD/rddb.pm b/lib/RHRD/rddb.pm
index 48aed35..e29cde1 100755
--- a/lib/RHRD/rddb.pm
+++ b/lib/RHRD/rddb.pm
@@ -542,6 +542,11 @@ sub remove_group
my ($ctx, $groupname) = @_;
my @actions = ({
+ # Delete Member Cuts
+ sql => qq{delete from CUTS where CART_NUMBER IN (select NUMBER from CART where GROUP_NAME = ?);},
+ name => 'member cuts',
+ cnt => 0
+ }, {
# Delete Member Carts
sql => qq{delete from CART where GROUP_NAME = ?;},
name => 'member carts',
@@ -1012,6 +1017,14 @@ sub create_show_group
return (undef, $status, $errorstring);
}
+ my $sql = qq{insert into AUDIO_PERMS (GROUP_NAME, SERVICE_NAME) values (?, ?);};
+ my $sth = $ctx->{'dbh'}->prepare($sql)
+ or return (undef, 'ERROR', "Database Error: " . $ctx->{'dbh'}->errstr);
+
+ $sth->execute($groupname, $ctx->{'config'}{'shows'}{'service'})
+ or return (undef, 'ERROR', "Database Error: " . $sth->errstr);
+ $sth->finish();
+
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);
@@ -1350,13 +1363,17 @@ sub remove_show
if(!defined $show_carts[0]) {
push @actions, { name => 'audio carts', cnt => 0 };
} else {
- my $sth = $ctx->{'dbh'}->prepare(qq{delete from CART where NUMBER = ?;})
+ my $sth_cut = $ctx->{'dbh'}->prepare(qq{delete from CUTS where CART_NUMBER = ?;})
+ or return (undef, 'ERROR', "Database Error: " . $ctx->{'dbh'}->errstr);
+ my $sth_cart = $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();
+ $sth_cut->execute($cart) or return (undef, 'ERROR', "Database Error: " . $sth_cut->errstr);
+ $sth_cut->finish();
+ $cnt += ($sth_cart->execute($cart) or return (undef, 'ERROR', "Database Error: " . $sth_cart->errstr));
+ $sth_cart->finish();
}
push @actions, { name => 'audio carts', cnt => $cnt };
}