summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2014-09-19 23:20:01 (GMT)
committerChristian Pointner <equinox@helsinki.at>2014-09-19 23:20:01 (GMT)
commit59984c7553efdd0bb27eb932cecc07609c112245 (patch)
tree5a82e6e67959e637ab0b5fce46b0e87cfed4f27d /lib
parenta3463648d1c70337a5bc2919a88eeace36c6499f (diff)
also get show title at list drobboxes
Diffstat (limited to 'lib')
-rwxr-xr-xlib/rddb.pm28
1 files changed, 27 insertions, 1 deletions
diff --git a/lib/rddb.pm b/lib/rddb.pm
index 823629d..c834dda 100755
--- a/lib/rddb.pm
+++ b/lib/rddb.pm
@@ -77,6 +77,26 @@ sub check_token
return (0, 'ERROR', "wrong password");
}
+sub get_showtitle
+{
+ my ($dbh, $showid) = @_;
+
+ my $sql = qq{select TITLE from CART where NUMBER = ?;};
+ my $sth = $dbh->prepare($sql)
+ or return (undef, 'ERROR', "Database Error: " . $dbh->errstr);
+
+ $sth->execute($showid)
+ or return (undef, 'ERROR', "Database Error: " . $sth->errstr);
+
+ my ($title) = $sth->fetchrow_array;
+ $sth->finish();
+
+ unless(defined $title) {
+ return (undef, 'ERROR', "Show wid ID=" . $showid . " not found!")
+ }
+ return ($title, 'OK', 'success');
+}
+
sub get_dropboxes
{
my ($dbh, $username) = @_;
@@ -102,7 +122,13 @@ sub get_dropboxes
$entry->{'PARAM'} = $params;
if($type eq "show") {
$entry->{'SHOWID'} = $showid;
- # $params has the format: 1111-01-1600-060
+
+ my ($title, $status, $errorstring) = get_showtitle($dbh, $showid);
+ unless (defined $title) {
+ return (undef, $status, $errorstring);
+ }
+ $entry->{'SHOWTITLE'} = $title;
+
if($params =~ /^([01]{4})-([0-9]{2})-([0-9]{2})([0-9]{2})-([0-9]{3})$/) {
$entry->{'RHYTHM'} = $1;
$entry->{'DOW'} = int $2;