diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 52a4a84ea..ccefcb4e2 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -8,12 +8,12 @@ - rfe: Added message to user search operation when user count exceeds 250. (Diona Kidd, Knowmad Technologies) - 7.4.16 + - fix: Event End Time Missing (perlDreamer Consulting, LLC.) + http://www.plainblack.com/bugs/tracker/event-end-time-missing - fix: EMS - Adding Prerequisite sets. - fix: Multiple Instances of EMS displaying on View Purchase - 7.4.15 - fix: Image asset test fails - fix: Article attachments don't obey max image dimentions diff --git a/lib/WebGUI/Asset/Event.pm b/lib/WebGUI/Asset/Event.pm index a80179463..8cd9335c0 100644 --- a/lib/WebGUI/Asset/Event.pm +++ b/lib/WebGUI/Asset/Event.pm @@ -1239,19 +1239,28 @@ sub getTemplateVars { ? 1 : 0 ; - # Make a Friendly date span + # Make a Friendly date span. $var{dateSpan} = $var{startDateDayName}.", " . $var{startDateMonthName}." " - . $var{startDateDayOfMonth}." " - . ( !$var{isAllDay} ? $var{startDateHour}.":".$var{startDateMinute}." ".$var{startDateM} : "" ) - . ( !$var{isOneDay} ? - ' • ' - . $var{endDateDayName}.", " - .$var{endDateMonthName}." " - .$var{endDateDayOfMonth}." " - . ( !$var{isAllDay} ? $var{endDateHour}.":".$var{endDateMinute}." ".$var{endDateM} : "") - : ""); + . $var{startDateDayOfMonth}; + if (! $var{isAllDay}) { + $var{dateSpan} .= ' '.$var{startDateHour}.":".$var{startDateMinute}." ".$var{startDateM}; + } + if (! $var{isOneDay}) { + $var{dateSpan} + .= ' • ' + . $var{endDateDayName}.", " + . $var{endDateMonthName}." " + . $var{endDateDayOfMonth}." " + } + elsif (! $var{isAllDay}) { + $var{dateSpan} + .= ' ‐ ' + } + if (! $var{isAllDay}) { + $var{dateSpan} .= ' '.$var{endDateHour}.":".$var{endDateMinute}." ".$var{endDateM}; + } # Make some friendly URLs my $urlStartParam = $dtStart->cloneToUserTimeZone->truncate(to => "day"); diff --git a/t/Asset/Event.t b/t/Asset/Event.t new file mode 100644 index 000000000..4d8eeb2af --- /dev/null +++ b/t/Asset/Event.t @@ -0,0 +1,59 @@ +#------------------------------------------------------------------- +# WebGUI is Copyright 2001-2007 Plain Black Corporation. +#------------------------------------------------------------------- +# Please read the legal notices (docs/legal.txt) and the license +# (docs/license.txt) that came with this distribution before using +# this software. +#------------------------------------------------------------------- +# http://www.plainblack.com info@plainblack.com +#------------------------------------------------------------------- + +use FindBin; +use strict; +use lib "$FindBin::Bin/../lib"; + +use WebGUI::Test; +use WebGUI::Session; +use WebGUI::Storage; +use WebGUI::Asset::Event; + +use Test::More; # increment this value for each test you create +use Test::Deep; +plan tests => 2; + +my $session = WebGUI::Test->session; + +my $versionTag = WebGUI::VersionTag->getWorking($session); +$versionTag->set({name=>"Adding Calendar for Event Asset Test"}); +my $defaultAsset = WebGUI::Asset->getDefault($session); +my $cal = $defaultAsset->addChild({className=>'WebGUI::Asset::Wobject::Calendar'}); +$versionTag->commit; + +my $properties = { + # '1234567890123456789012' + id => 'EventAssetTest00000012', + title => 'Birthday of WebGUI', + className => 'WebGUI::Asset::Event', + url => 'event-asset-test', + startDate => '2000-08-16', ##Times and dates have to be entered in UTC + startTime => '23:00:00', + endDate => '2000-08-17', + endTime => '03:00:00', + timeZone => 'America/Chicago', + location => 'Madison, Wisconsin', +}; + +my $event = $cal->addChild($properties, $properties->{id}); + +my $secondVersionTag = WebGUI::VersionTag->new($session, $event->get("tagId")); + +is($event->isAllDay, 0, 'isAllDay is zero since it has a start and end time'); + +my %templateVars = $event->getTemplateVars(); +is($templateVars{dateSpan}, 'Wednesday, August 16 6:00 PM ‐ 10:00 PM', 'getTemplateVars: dateSpan bridges times on a single day'); + +END { + # Clean up after thy self + $versionTag->rollback; + $secondVersionTag->rollback(); +}