summaryrefslogtreecommitdiff
path: root/lib/RHRD
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2016-07-31 12:12:14 (GMT)
committerChristian Pointner <equinox@helsinki.at>2016-07-31 12:12:14 (GMT)
commit1283d78ec24c3b4e084409610e4711015044ce58 (patch)
tree00efc5edf30655d407961f06d22e1bb4606b7333 /lib/RHRD
parent96b197680f423d4afda7c113a1049a656cc81abf (diff)
print used carts for musicpools
Diffstat (limited to 'lib/RHRD')
-rwxr-xr-xlib/RHRD/rddb.pm26
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/RHRD/rddb.pm b/lib/RHRD/rddb.pm
index b576ad4..de34bbd 100755
--- a/lib/RHRD/rddb.pm
+++ b/lib/RHRD/rddb.pm
@@ -2284,6 +2284,32 @@ sub remove_musicpool
return @actions;
}
+sub get_musicpool_carts_used
+{
+ my ($ctx, $shortname) = @_;
+
+ my ($groupname, $status, $errorstring) = get_musicpool_group($ctx, $shortname);
+ unless (defined $groupname) {
+ return (undef, $status, $errorstring);
+ }
+
+ my $sql = qq{select NUMBER from CART where GROUP_NAME = ? order by NUMBER};
+
+ my $sth = $ctx->{'dbh'}->prepare($sql)
+ or return (undef, 'ERROR', "Database Error: " . $ctx->{'dbh'}->errstr);
+
+ $sth->execute($groupname)
+ or return (undef, 'ERROR', "Database Error: " . $sth->errstr);
+
+ my @carts;
+ while(my ($cart) = $sth->fetchrow_array()) {
+ push @carts, $cart;
+ }
+ $sth->finish();
+
+ return @carts;
+}
+
sub is_musicgrid_user
{
my ($ctx, $username) = @_;