From 59984c7553efdd0bb27eb932cecc07609c112245 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Fri, 19 Sep 2014 23:20:01 +0000 Subject: also get show title at list drobboxes 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 " " . $href->{'TRIMLEVEL'} . "\n"; print " " . $href->{'PARAM'} . "\n"; if($href->{'TYPE'} eq "show") { + print " " . $href->{'SHOWTITLE'} . "\n"; print " " . $href->{'RHYTHM'} . "\n"; print " " . $href->{'DOW'} . "\n"; print " " . $href->{'STARTTIME'} . "\n"; -- cgit v0.10.2