diff options
author | Christian Pointner <equinox@helsinki.at> | 2016-11-25 23:10:47 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2016-11-25 23:10:47 (GMT) |
commit | 1c231c329cccf70fa809f57e75378f0963742388 (patch) | |
tree | 8d3ce21dc82c8137638d04f224e25c104f99ab6a /lib | |
parent | 2309e83af61203a814ade7a5df89cd68f73d41ef (diff) |
also add show types to multi-shows
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/RHRD/rddb.pm | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/lib/RHRD/rddb.pm b/lib/RHRD/rddb.pm index e9f79ef..83a5f5b 100755 --- a/lib/RHRD/rddb.pm +++ b/lib/RHRD/rddb.pm @@ -2036,7 +2036,7 @@ sub list_multi_shows { my ($ctx) = @_; - my $sql = qq{select NUMBER,TITLE,USER_DEFINED from CART where GROUP_NAME = ? order by NUMBER}; + my $sql = qq{select NUMBER,TITLE,USER_DEFINED,NOTES from CART where GROUP_NAME = ? order by NUMBER}; my $sth = $ctx->{'dbh'}->prepare($sql) or return (undef, 'ERROR', "Database Error: " . $ctx->{'dbh'}->errstr); @@ -2045,12 +2045,13 @@ sub list_multi_shows or return (undef, 'ERROR', "Database Error: " . $sth->errstr); my @mshows; - while(my ($id, $title, $shows) = $sth->fetchrow_array()) { + while(my ($id, $title, $shows, $type) = $sth->fetchrow_array()) { my $entry = {}; $entry->{'ID'} = $id; $entry->{'TITLE'} = $title; $entry->{'SHOWS'} = {}; + $entry->{'TYPE'} = $type; my @showlist = split(';', $shows); foreach my $show (@showlist) { @@ -2097,6 +2098,7 @@ sub create_multi_show { my $ctx = shift; my $title = shift; + my $type = shift; my %shows = %{shift()}; my $showstr = join(";", map { "$_:$shows{$_}" } sort keys %shows); @@ -2106,12 +2108,12 @@ sub create_multi_show return (undef, $status, $errorstring); } - my $sql = qq{insert into CART (NUMBER, TYPE, GROUP_NAME, TITLE, USER_DEFINED, VALIDITY, METADATA_DATETIME) values (?, 2, ?, ?, ?, 3, NOW())}; + my $sql = qq{insert into CART (NUMBER, TYPE, GROUP_NAME, TITLE, USER_DEFINED, NOTES, VALIDITY, METADATA_DATETIME) values (?, 2, ?, ?, ?, ?, 3, NOW())}; my $sth = $ctx->{'dbh'}->prepare($sql) or return (undef, 'ERROR', "Database Error: " . $ctx->{'dbh'}->errstr); - $sth->execute($number, $ctx->{'config'}{'specialgroups'}{'multishows'}, $title, $showstr) + $sth->execute($number, $ctx->{'config'}{'specialgroups'}{'multishows'}, $title, $showstr, $type) or return (undef, 'ERROR', "Database Error: " . $sth->errstr); $sth->finish(); @@ -2124,16 +2126,17 @@ sub update_multi_show my $ctx = shift; my $showid = shift; my $title = shift; + my $type = shift; my %shows = %{shift()}; my $showstr = join(";", map { "$_:$shows{$_}" } sort keys %shows); - my $sql = qq{update CART set TITLE = ?, USER_DEFINED = ? where NUMBER = ?}; + my $sql = qq{update CART set TITLE = ?, USER_DEFINED = ?, NOTES = ? where NUMBER = ?}; my $sth = $ctx->{'dbh'}->prepare($sql) or return (undef, 'ERROR', "Database Error: " . $ctx->{'dbh'}->errstr); - my $cnt = $sth->execute($title, $showstr, $showid) + my $cnt = $sth->execute($title, $showstr, $type, $showid) or return (undef, 'ERROR', "Database Error: " . $sth->errstr); $sth->finish(); @@ -2149,7 +2152,7 @@ sub get_multi_show_info { my ($ctx, $showid) = @_; - my $sql = qq{select TITLE,USER_DEFINED from CART where NUMBER = ?}; + my $sql = qq{select TITLE,USER_DEFINED,NOTES from CART where NUMBER = ?}; my $sth = $ctx->{'dbh'}->prepare($sql) or return (undef, 'ERROR', "Database Error: " . $ctx->{'dbh'}->errstr); @@ -2161,13 +2164,14 @@ sub get_multi_show_info return (undef, 'ERROR', 'multi-show does not exist'); } - my ($title, $shows) = $sth->fetchrow_array(); + my ($title, $shows, $type) = $sth->fetchrow_array(); $sth->finish(); my $entry = {}; $entry->{'ID'} = $showid; $entry->{'TITLE'} = $title; $entry->{'SHOWS'} = {}; + $entry->{'TYPE'} = $type; my @showlist = split(';', $shows); foreach my $show (@showlist) { |