bug fixes: start date is returned in UTC instead of the proper time zone, meta data fields are not properly returned to the template

This commit is contained in:
khenn 2009-11-01 08:44:22 -06:00
parent 71548339de
commit 3958a36271
4 changed files with 32 additions and 3 deletions

View file

@ -1991,6 +1991,7 @@ sub www_printRemainingTickets {
EMSTicket.location as ticketLocation,
EMSTicket.relatedBadgeGroups,
EMSTicket.relatedRibbons,
EMSTicket.eventMetaData,
(seatsAvailable - (select count(*) from EMSRegistrantTicket where ticketAssetId = asset.assetId)) as seatsRemaining
FROM
asset
@ -2011,6 +2012,19 @@ sub www_printRemainingTickets {
$var->{'tickets_loop'} = [];
while (my $hash = $sth->hashRef) {
my $seatsRemaining = $hash->{seatsRemaining};
#Put start time in the correct timezone
my $startTime = WebGUI::DateTime->new($hash->{ticketStart})->set_time_zone($self->get('timezone'));
$hash->{ticketStart} = $startTime->strftime('%F %R');
$hash->{ticketStart_epoch} = $startTime->epoch;
#Add meta data fields
my $data = $hash->{eventMetaData} || '{}';
my $meta = JSON->new->decode($data);
foreach my $key (keys %{$meta}) {
my $tmplKey = $key;
$tmplKey =~ s/[\s\W]/_/g;
$hash->{'ticketMeta_'.$tmplKey} = $meta->{$key};
}
#Add to the loop
for (my $i = 0; $i < $seatsRemaining; $i++ ) {
push(@{$var->{'tickets_loop'}},$hash);
}