diff options
author | Christian Pointner <equinox@helsinki.at> | 2014-09-19 23:20:01 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2014-09-19 23:20:01 (GMT) |
commit | 59984c7553efdd0bb27eb932cecc07609c112245 (patch) | |
tree | 5a82e6e67959e637ab0b5fce46b0e87cfed4f27d | |
parent | a3463648d1c70337a5bc2919a88eeace36c6499f (diff) |
also get show title at list drobboxes
-rwxr-xr-x | lib/rddb.pm | 28 | ||||
-rwxr-xr-x | listdrobpoxes.cgi | 1 |
2 files changed, 28 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; diff --git a/listdrobpoxes.cgi b/listdrobpoxes.cgi index c1efb06..7ef0bcf 100755 --- a/listdrobpoxes.cgi +++ b/listdrobpoxes.cgi @@ -54,6 +54,7 @@ if($responsecode != 200) { print " <autotrim-level>" . $href->{'TRIMLEVEL'} . "</autotrim-level>\n"; print " <parameters>" . $href->{'PARAM'} . "</parameters>\n"; if($href->{'TYPE'} eq "show") { + print " <show-title>" . $href->{'SHOWTITLE'} . "</show-title>\n"; print " <show-rhythm>" . $href->{'RHYTHM'} . "</show-rhythm>\n"; print " <show-dayofweek>" . $href->{'DOW'} . "</show-dayofweek>\n"; print " <show-starttime>" . $href->{'STARTTIME'} . "</show-starttime>\n"; |