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);
}

View file

@ -239,11 +239,13 @@ our $HELP = {
{ 'name' => 'ticketDuration'},
{ 'name' => 'ticketLocation'},
{ 'name' => 'ticketEventNumber'},
{ 'name' => 'ticketMeta_[LABEL]'},
{ 'name' => 'seatsRemaining'},
{ 'name' => 'seatsAvailable'},
{ 'name' => 'price'},
{ 'name' => 'relatedRibbons'},
{ 'name' => 'relatedBadgeGroups'},
{ 'name' => 'eventMetaData'},
{ 'name' => 'title'},
{ 'name' => 'menuTitle'},
{ 'name' => 'url'},

View file

@ -2084,6 +2084,17 @@ normal templates.|,
context => q|Field Label|,
},
'eventMetaData' => {
message => q|Meta data for the event returned as a JSON data structure|,
lastUpdated => 1147050475,
context => q|Field Label|,
},
'ticketMeta_[LABEL]' => {
message => q|Value for the meta data field [LABEL]. Non word and whitespace characters in [LABEL] should be replaced with an underscore. <br/><br/>Ex: Meta Data Label: "First Name" should be referenced: &lt;tmpl_var ticketMeta_First_Name&gt; and so on|,
lastUpdated => 1147050475,
context => q|Field Label|,
},
};

View file

@ -78,7 +78,7 @@ isa_ok($ems, 'WebGUI::Asset::Wobject::EventManagementSystem');
# Test to see if we can set new values
my $newEMSSettings = {
timezone => 'America/New York',
timezone => 'America/New_York',
};
# update the new values for this instance
@ -227,7 +227,8 @@ $templateMock->mock('process', sub { $templateVars = $_[1]; } );
'revisedBy' => ignore(),
'isExportable' => ignore(),
'creationDate' => ignore(),
'ticketStart' => '2009-01-01 14:00:00'
'ticketStart' => '2009-01-01 09:00',
'ticketStart_epoch' => '1230818400',
};
my $ticket2 = {
@ -266,7 +267,8 @@ $templateMock->mock('process', sub { $templateVars = $_[1]; } );
'revisedBy' => ignore(),
'isExportable' => ignore(),
'creationDate' => ignore(),
'ticketStart' => '2009-01-01 14:00:00'
'ticketStart' => '2009-01-01 09:00',
'ticketStart_epoch' => '1230818400',
};
my @ticketArray = ();