Skip to content

Commit 9da8884

Browse files
committedOct 15, 2011
Make sure that calendar time span flags are always set. Fixes bug #12271.
1 parent 82603b2 commit 9da8884

File tree

4 files changed

+16
-9
lines changed

4 files changed

+16
-9
lines changed
 

‎docs/changelog/7.x.x.txt

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
- fixed #12268: Point of sale form missing from cart screen.
44
- fixed #12201: AssetReport - no selects.
55
- fixed #12269: Login / Loginbox with encryptlogin
6+
- fixed #12271: Calendar List View does not always show labels
67

78
7.10.23
89
- fixed #12225: Stock asset, multiple instances on a page

‎lib/WebGUI/Asset/Wobject/Calendar.pm

+7-4
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,7 @@ sub viewList {
11331133
);
11341134

11351135
### Build the event vars
1136-
my $dtLast = $dtStart; # The DateTime of the last event
1136+
my $dtLast = WebGUI::DateTime->new(0); # The DateTime of the last event
11371137
EVENT: for my $event (@events) {
11381138
next EVENT unless $event && $event->canView();
11391139
my ( %eventVar, %eventDate )
@@ -1142,12 +1142,15 @@ sub viewList {
11421142
# Add the change flags
11431143
my $dt = $event->getDateTimeStart;
11441144
if ( $dt->year > $dtLast->year ) {
1145-
$eventVar{ new_year } = 1;
1145+
$eventVar{ new_year } = 1;
1146+
$eventVar{ new_month } = 1;
1147+
$eventVar{ new_day } = 1;
11461148
}
1147-
if ( $dt->month > $dtLast->month ) {
1149+
elsif ( $dt->month > $dtLast->month ) {
11481150
$eventVar{ new_month } = 1;
1151+
$eventVar{ new_day } = 1;
11491152
}
1150-
if ( $dt->day > $dtLast->day ) {
1153+
elsif ( $dt->day > $dtLast->day ) {
11511154
$eventVar{ new_day } = 1;
11521155
}
11531156

‎lib/WebGUI/Help/Asset_Calendar.pm

+3-3
Original file line numberDiff line numberDiff line change
@@ -241,15 +241,15 @@ our $HELP = {
241241
],
242242
variables => [
243243
{
244-
name => 'newYear',
244+
name => 'new_year',
245245
description => 'helpvar newYear',
246246
},
247247
{
248-
name => 'newMonth',
248+
name => 'new_month',
249249
description => 'helpvar newMonth',
250250
},
251251
{
252-
name => 'newDay',
252+
name => 'new_day',
253253
description => 'helpvar newDay',
254254
},
255255
{

‎t/Asset/Wobject/Calendar.t

+5-2
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ use Data::Dumper;
5757
use WebGUI::Asset::Wobject::Calendar;
5858
use WebGUI::Asset::Event;
5959

60-
plan tests => 15 + scalar @icalWrapTests;
61-
6260
my $session = WebGUI::Test->session;
6361

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

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

575576
######################################################################
576577
#
@@ -606,3 +607,5 @@ cmp_deeply(
606607
[],
607608
'but getFeeds still returns a data structure.'
608609
);
610+
611+
done_testing;

0 commit comments

Comments
 (0)
Please sign in to comment.