Skip to content

Commit

Permalink
Make sure that calendar time span flags are always set. Fixes bug #12…
Browse files Browse the repository at this point in the history
…271.
  • Loading branch information
perlDreamer committed Oct 15, 2011
1 parent 82603b2 commit 9da8884
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
1 change: 1 addition & 0 deletions docs/changelog/7.x.x.txt
Expand Up @@ -3,6 +3,7 @@
- fixed #12268: Point of sale form missing from cart screen.
- fixed #12201: AssetReport - no selects.
- fixed #12269: Login / Loginbox with encryptlogin
- fixed #12271: Calendar List View does not always show labels

7.10.23
- fixed #12225: Stock asset, multiple instances on a page
Expand Down
11 changes: 7 additions & 4 deletions lib/WebGUI/Asset/Wobject/Calendar.pm
Expand Up @@ -1133,7 +1133,7 @@ sub viewList {
);

### Build the event vars
my $dtLast = $dtStart; # The DateTime of the last event
my $dtLast = WebGUI::DateTime->new(0); # The DateTime of the last event
EVENT: for my $event (@events) {
next EVENT unless $event && $event->canView();
my ( %eventVar, %eventDate )
Expand All @@ -1142,12 +1142,15 @@ sub viewList {
# Add the change flags
my $dt = $event->getDateTimeStart;
if ( $dt->year > $dtLast->year ) {
$eventVar{ new_year } = 1;
$eventVar{ new_year } = 1;
$eventVar{ new_month } = 1;
$eventVar{ new_day } = 1;
}
if ( $dt->month > $dtLast->month ) {
elsif ( $dt->month > $dtLast->month ) {
$eventVar{ new_month } = 1;
$eventVar{ new_day } = 1;
}
if ( $dt->day > $dtLast->day ) {
elsif ( $dt->day > $dtLast->day ) {
$eventVar{ new_day } = 1;
}

Expand Down
6 changes: 3 additions & 3 deletions lib/WebGUI/Help/Asset_Calendar.pm
Expand Up @@ -241,15 +241,15 @@ our $HELP = {
],
variables => [
{
name => 'newYear',
name => 'new_year',
description => 'helpvar newYear',
},
{
name => 'newMonth',
name => 'new_month',
description => 'helpvar newMonth',
},
{
name => 'newDay',
name => 'new_day',
description => 'helpvar newDay',
},
{
Expand Down
7 changes: 5 additions & 2 deletions t/Asset/Wobject/Calendar.t
Expand Up @@ -57,8 +57,6 @@ use Data::Dumper;
use WebGUI::Asset::Wobject::Calendar;
use WebGUI::Asset::Event;

plan tests => 15 + scalar @icalWrapTests;

my $session = WebGUI::Test->session;

# Do our work in the import node
Expand Down Expand Up @@ -571,6 +569,9 @@ cmp_deeply(
'... correct set of events in list view'
);

ok(exists $listVars->{events}->[0]->{new_year} && $listVars->{events}->[0]->{new_year}, 'first event has new_year set');
ok(exists $listVars->{events}->[0]->{new_month} && $listVars->{events}->[0]->{new_month}, 'first event has new_month set');
ok(exists $listVars->{events}->[0]->{new_day} && $listVars->{events}->[0]->{new_day}, 'first event has new_day set');

######################################################################
#
Expand Down Expand Up @@ -606,3 +607,5 @@ cmp_deeply(
[],
'but getFeeds still returns a data structure.'
);

done_testing;

0 comments on commit 9da8884

Please sign in to comment.