diff options
Diffstat (limited to 'lib/RHRD')
-rwxr-xr-x | lib/RHRD/rddb.pm | 23 |
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 }; } |