From 35d1fc95791af0ca19e1a1381434af7c155dcf53 Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Mon, 2 Nov 2009 09:11:19 -0600 Subject: [PATCH 01/11] fixed: RSS feeds generated with incorrect link for channel --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/AssetAspect/RssFeed.pm | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 9e9ae35ca..12b8c981d 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -1,4 +1,5 @@ 7.8.3 + - fixed: RSS feeds generated with incorrect link for channel - Fixed an error being thrown by the CalendarUpdateFeeds workflow activity. - The auto add to group and auto delete from group operations that are used with the GroupAdd and GroupDelete macros were fixed to make the user log in if they aren't already. - fixed #11074: Links to CS posts not working diff --git a/lib/WebGUI/AssetAspect/RssFeed.pm b/lib/WebGUI/AssetAspect/RssFeed.pm index b1caab66f..85e8db41f 100644 --- a/lib/WebGUI/AssetAspect/RssFeed.pm +++ b/lib/WebGUI/AssetAspect/RssFeed.pm @@ -483,7 +483,7 @@ sub getFeed { $feed->description( $self->get('feedDescription') || $self->get('synopsis') ); $feed->pubDate( $self->getContentLastModified ); $feed->copyright( $self->get('feedCopyright') ); - $feed->link( $self->getUrl ); + $feed->link( $self->session->url->getSiteURL . $self->getUrl ); # $feed->language( $lang ); if ($self->get('feedImage')) { my $storage = WebGUI::Storage->get($self->session, $self->get('feedImage')); From c017926194c3857469ce9b90b75bd403b746fb10 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Sun, 1 Nov 2009 19:13:33 -0800 Subject: [PATCH 02/11] Add the eventMetaData template variable back to the test. --- t/Asset/Wobject/EventManagementSystem.t | 2 ++ 1 file changed, 2 insertions(+) diff --git a/t/Asset/Wobject/EventManagementSystem.t b/t/Asset/Wobject/EventManagementSystem.t index 69c6cf202..1bc2393db 100644 --- a/t/Asset/Wobject/EventManagementSystem.t +++ b/t/Asset/Wobject/EventManagementSystem.t @@ -222,6 +222,7 @@ $templateMock->mock('process', sub { $templateVars = $_[1]; } ); 'isPackage' => ignore(), 'usePackedHeadTags' => ignore(), 'encryptPage' => ignore(), + 'eventMetaData' => ignore(), 'tagId' => ignore(), 'seatsAvailable' => '5', 'revisedBy' => ignore(), @@ -263,6 +264,7 @@ $templateMock->mock('process', sub { $templateVars = $_[1]; } ); 'usePackedHeadTags' => ignore(), 'encryptPage' => ignore(), 'tagId' => ignore(), + 'eventMetaData' => ignore(), 'seatsAvailable' => '3', 'revisedBy' => ignore(), 'isExportable' => ignore(), From fcab30158d223ff1c422d7e27f4cb2cb0a5ae178 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Mon, 2 Nov 2009 08:03:32 -0800 Subject: [PATCH 03/11] Update RssFeed test. --- t/AssetAspect/RssFeed.t | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/t/AssetAspect/RssFeed.t b/t/AssetAspect/RssFeed.t index a97182a90..466372e96 100644 --- a/t/AssetAspect/RssFeed.t +++ b/t/AssetAspect/RssFeed.t @@ -103,7 +103,7 @@ cmp_deeply( methods( title => 'Dummy Title', description => 'Dummy Synopsis', ##Not description - link => '/home/shawshank', + link => $session->url->getSiteURL . '/home/shawshank', copyright => undef, ), '... title, description, link inherit from asset by default, copyright unset' @@ -139,7 +139,7 @@ cmp_deeply( methods( title => 'Rita Hayworth and the Shawshank Redemption', description => 'A good movie, providing loads of testing collateral', - link => '/home/shawshank', + link => $session->url->getSiteURL . '/home/shawshank', copyright => 'copyright 2009 Plain Black Corporation', ), '... feed settings override asset defaults, copyright' From 74f7038ec12008aadb5fc6aa41f0699b993ee6fd Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Mon, 2 Nov 2009 09:05:36 -0800 Subject: [PATCH 04/11] Fix a bad comment. --- lib/WebGUI/Asset.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/WebGUI/Asset.pm b/lib/WebGUI/Asset.pm index 4ab569fda..ea33cacb3 100644 --- a/lib/WebGUI/Asset.pm +++ b/lib/WebGUI/Asset.pm @@ -1096,7 +1096,7 @@ sub getEditForm { } } - # send back the rendered form + # send back the object return $tabform; } From e9b11c517842ac2cb7ab8cff82ed4de17cf38553 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Mon, 2 Nov 2009 09:05:58 -0800 Subject: [PATCH 05/11] Navigation can use the default Asset getEditForm controls. Fixes bug #11188 --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/Asset/Wobject/Navigation.pm | 14 -------------- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 12b8c981d..f8f5a8a04 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -32,6 +32,7 @@ - fixed #10984: Edit Survey Screen isn't right in demo - added: getTopKeywords method to Keywords API - added: print remaining tickets feature to EMS + - fixed #11188: Incoherence in Navigation edit form 7.8.2 - Added scheduled vendor payout workflow activity. (Special thanks to Martin @ Oqapi) diff --git a/lib/WebGUI/Asset/Wobject/Navigation.pm b/lib/WebGUI/Asset/Wobject/Navigation.pm index 35223f1c1..327a2bddf 100644 --- a/lib/WebGUI/Asset/Wobject/Navigation.pm +++ b/lib/WebGUI/Asset/Wobject/Navigation.pm @@ -281,20 +281,6 @@ sub getEditForm { ".($ancestorsChecked ? "" : "toggleAncestorEndPoint();")." //]]> "); - my $previewButton;# = qq{ - # }; - my $saveButton = ' '; - $tabform->{_submit} = $previewButton." ".$saveButton; return $tabform; } From 37689843a308207f54882b2fb700e3713d7e67d6 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Mon, 2 Nov 2009 09:43:12 -0800 Subject: [PATCH 06/11] Update the POD for the AssetProxy macro, re the displaying of edit controls. Fixes bug #11189 --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/Macro/AssetProxy.pm | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index f8f5a8a04..da11ebf1e 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -33,6 +33,7 @@ - added: getTopKeywords method to Keywords API - added: print remaining tickets feature to EMS - fixed #11188: Incoherence in Navigation edit form + - fixed #11189: Controls variable missing in image asset in AssetProxy 7.8.2 - Added scheduled vendor payout workflow activity. (Special thanks to Martin @ Oqapi) diff --git a/lib/WebGUI/Macro/AssetProxy.pm b/lib/WebGUI/Macro/AssetProxy.pm index 268cd3cc8..0e7ef77ce 100644 --- a/lib/WebGUI/Macro/AssetProxy.pm +++ b/lib/WebGUI/Macro/AssetProxy.pm @@ -27,9 +27,9 @@ Macro for displaying the output of an Asset in another location. =head3 url | assetId -My specify either the asset url or the asset id. If no Asset with that URL or id can be found, an internationalized error message will be returned instead. +Specify either the asset url or the asset id. If no Asset with that URL or id can be found, an internationalized error message will be returned instead. -No editing controls (toolbar) will be displayed in the Asset output, even if Admin is turned on. +Editing controls (toolbar) may or may not be displayed in the Asset output, even if Admin is turned on. The Not Found Page may not be Asset Proxied. From baf9f3c700d0fbaa5fb40c3f6eda209996afab48 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Mon, 2 Nov 2009 10:52:01 -0800 Subject: [PATCH 07/11] Make a synopsis field available to the Event edit form. Fixes bug #11190 --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/Asset/Event.pm | 7 +++++++ lib/WebGUI/Help/Asset_Event.pm | 1 + lib/WebGUI/i18n/English/Asset_Event.pm | 5 +++++ 4 files changed, 14 insertions(+) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index da11ebf1e..40fcedff0 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -34,6 +34,7 @@ - added: print remaining tickets feature to EMS - fixed #11188: Incoherence in Navigation edit form - fixed #11189: Controls variable missing in image asset in AssetProxy + - fixed #11190: event tmpl_var in help but not available 7.8.2 - Added scheduled vendor payout workflow activity. (Special thanks to Martin @ Oqapi) diff --git a/lib/WebGUI/Asset/Event.pm b/lib/WebGUI/Asset/Event.pm index a83f44a9e..309de8f0e 100644 --- a/lib/WebGUI/Asset/Event.pm +++ b/lib/WebGUI/Asset/Event.pm @@ -2063,6 +2063,13 @@ sub www_edit { size => 22, }); + # synopsis + $var->{"formSynopsis"} + = WebGUI::Form::textarea($session, { + name => "synopsis", + value => $form->process("synopsis") || $self->get("synopsis"), + }); + # Group to View $var->{"formGroupIdView"} = WebGUI::Form::Group($session, { diff --git a/lib/WebGUI/Help/Asset_Event.pm b/lib/WebGUI/Help/Asset_Event.pm index 425b3dbc9..848ab1174 100644 --- a/lib/WebGUI/Help/Asset_Event.pm +++ b/lib/WebGUI/Help/Asset_Event.pm @@ -21,6 +21,7 @@ our $HELP = { 'required' => 1, }, { 'name' => 'formMenuTitle', }, + { 'name' => 'formSynopsis', }, { 'name' => 'formLocation', }, { 'name' => 'formDescription', }, { 'name' => 'formGroupToView', }, diff --git a/lib/WebGUI/i18n/English/Asset_Event.pm b/lib/WebGUI/i18n/English/Asset_Event.pm index 3331fc7c7..c047e42de 100644 --- a/lib/WebGUI/i18n/English/Asset_Event.pm +++ b/lib/WebGUI/i18n/English/Asset_Event.pm @@ -35,6 +35,11 @@ our $I18N = { lastUpdated => 1171067211, }, + 'formSynopsis' => { + message => q|HTML form for entering or editing the Event Synopsis.|, + lastUpdated => 1171067211, + }, + 'formLocation' => { message => q|HTML form for entering or editing the Event Location.|, lastUpdated => 1171067211, From 9b94516377e340954451b97b3cad99f5a1e232fc Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Mon, 2 Nov 2009 10:31:40 -0800 Subject: [PATCH 08/11] Remove debug code from Calendar. --- lib/WebGUI/Asset/Wobject/Calendar.pm | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/lib/WebGUI/Asset/Wobject/Calendar.pm b/lib/WebGUI/Asset/Wobject/Calendar.pm index e288cfa8d..b8f905701 100644 --- a/lib/WebGUI/Asset/Wobject/Calendar.pm +++ b/lib/WebGUI/Asset/Wobject/Calendar.pm @@ -1296,11 +1296,8 @@ sub viewList { ### Get the events my $dtStart = WebGUI::DateTime->new( $session, $params->{start} ); $dtStart->set_time_zone($tz); - $dtStart->truncate( to => 'day' ); my $dtEnd = $dtStart->clone->add( seconds => $self->get('listViewPageInterval') ); - warn 'truncated: '.$dtStart->toDatabase; - warn 'end date: '.$dtEnd->toDatabase; my @events = $self->getEventsIn( $dtStart->toDatabase, @@ -1910,8 +1907,6 @@ sub www_ical { $dt_start->set_time_zone( $session->datetime->getTimeZone ); } - $session->log->warn("start1: ". $dt_start->toMysql); - my $dt_end; my $end = $form->param("end"); if ($end) { @@ -1925,10 +1920,6 @@ sub www_ical { $dt_end = $dt_start->clone->add( seconds => $self->get('icalInterval') ); } - $session->log->warn("start2: ". $dt_start->toMysql); - $session->log->warn("end2: ". $dt_end->toMysql); - - # Get all the events we're going to display my @events = $self->getEventsIn($dt_start->toMysql,$dt_end->toMysql); @@ -1938,11 +1929,8 @@ sub www_ical { . qq{VERSION:2.0\r\n}; # VEVENT: - $session->log->warn("before event processing"); EVENT: for my $event (@events) { - $session->log->warn("have event: "); next EVENT unless $event->canView(); - $session->log->warn($event->getTitle); $ical .= qq{BEGIN:VEVENT\r\n}; ### UID From 3950611b47d7926ceacbe366576b1de8cecd12b6 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Mon, 2 Nov 2009 18:07:24 -0800 Subject: [PATCH 09/11] i18n the event recurrence form. Fixes bug #11194 --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/Asset/Event.pm | 169 ++++++++++++------------- lib/WebGUI/i18n/English/Asset_Event.pm | 121 ++++++++++++++++++ 3 files changed, 206 insertions(+), 85 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 40fcedff0..c1d75eb8f 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -35,6 +35,7 @@ - fixed #11188: Incoherence in Navigation edit form - fixed #11189: Controls variable missing in image asset in AssetProxy - fixed #11190: event tmpl_var in help but not available + - fixed #11194: Event Asset Recurrence form is not i18n'ed 7.8.2 - Added scheduled vendor payout workflow activity. (Special thanks to Martin @ Oqapi) diff --git a/lib/WebGUI/Asset/Event.pm b/lib/WebGUI/Asset/Event.pm index 309de8f0e..b309e7ecd 100644 --- a/lib/WebGUI/Asset/Event.pm +++ b/lib/WebGUI/Asset/Event.pm @@ -2209,22 +2209,23 @@ sub www_edit { : $self->isAllDay ; + my $i18n = WebGUI::International->new($session, 'Asset_Event'); $var->{"formTime"} = q| - +
- +
| - . q|Start: |.$var->{"formStartTime"} - . q|
End: |.$var->{"formEndTime"} - . q|
Time Zone: |.$var->{formTimeZone} - . q|
|; + . $i18n->get('start') . q|: | . $var->{"formStartTime"} . q|
| + . $i18n->get('end') . q|: | . $var->{"formEndTime"} . q|
| + . $i18n->get('timezone', 'DateTime'). q|: | . $var->{formTimeZone} . q|| + ; ###### related links my $relatedLinks = $self->getRelatedLinks(); @@ -2241,8 +2242,8 @@ sub www_edit { value => $form->process("rel_group_id_".$_->{eventlinkId}) || $_->{groupIdView} || $self->getParent->get("groupIdView"), defaultValue => $self->getParent->get("groupIdView"), }); - $_->{seq_num_name} = "rel_seq_".$_->{eventlinkId}; - $_->{seq_num_id} = "rel_seq_id_".$_->{eventlinkId}; + $_->{seq_num_name} = "rel_seq_".$_->{eventlinkId}; + $_->{seq_num_id} = "rel_seq_id_".$_->{eventlinkId}; $_->{seq_num_value} = $seqNum++; } $var->{"relatedLinks"} = $relatedLinks; @@ -2265,90 +2266,88 @@ sub www_edit { = q|

-

+

-

+

- Every
+ |. $i18n->get('Every'). q|
-
+
- +
-

-

+

- Every week(s) on
+ |. sprintf($i18n->get('Every N weeks on'), q||). q|
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-

-

+

-

Every month(s) on

+

|. sprintf($i18n->get('Every N months on'), q||). q|

- +

week on + + + + + + |. $i18n->get('week on'). q|

-

+

-

Every years(s) on

+

|. sprintf($i18n->get('Every N years on'),q||). q|

@@ -2356,34 +2355,34 @@ sub www_edit {

of + + + + + + + + |. $i18n->get('of'). q|

@@ -2403,18 +2402,18 @@ sub www_edit { $var->{"formRecurEnd"} = q|
-
+
- | + | . WebGUI::Form::date($session,{ name => "recurEndDate", value => $recur{endDate}, defaultValue => $recur{endDate} }) . q|
- + - occurences. + |. $i18n->get('occurences'). q|.
|; @@ -2430,14 +2429,14 @@ sub www_edit { $var->{"formSave"} = WebGUI::Form::submit($session, { name => "save", - value => "save", + value => $i18n->get('62', 'WebGUI'), }); # Cancel button $var->{"formCancel"} = WebGUI::Form::button($session, { name => "cancel", - value => "cancel", + value => $i18n->get('cancel', 'WebGUI'), extras => 'onClick="window.history.go(-1)"', }); diff --git a/lib/WebGUI/i18n/English/Asset_Event.pm b/lib/WebGUI/i18n/English/Asset_Event.pm index c047e42de..0c4e7da64 100644 --- a/lib/WebGUI/i18n/English/Asset_Event.pm +++ b/lib/WebGUI/i18n/English/Asset_Event.pm @@ -700,6 +700,127 @@ be useful, others may not.|, lastUpdated => 1204668000, }, + 'No specific time' => { + message => q{No specific time (all day event)}, + lastUpdated => 1257188155, + }, + + 'Specific start/end time' => { + message => q{Specific start/end time}, + lastUpdated => 1257188155, + }, + + 'day' => { + message => q{day}, + lastUpdated => 1257188155, + }, + + 'Daily' => { + message => q{Daily}, + lastUpdated => 1257188155, + context => q{An event that occurs every day}, + }, + + 'Weekday(s)' => { + message => q{Weekday(s)}, + lastUpdated => 1257188155, + context => q{May occur on one or more weekdays (Monday through Friday)}, + }, + + 'Weekly' => { + message => q{Weekly}, + lastUpdated => 1257188155, + }, + + 'Monthly' => { + message => q{Monthly}, + lastUpdated => 1257188155, + }, + + 'Yearly' => { + message => q{Yearly}, + lastUpdated => 1257188155, + }, + + 'first' => { + message => q{first}, + lastUpdated => 1257188155, + }, + + 'second' => { + message => q{second}, + lastUpdated => 1257188155, + }, + + 'third' => { + message => q{third}, + lastUpdated => 1257188155, + }, + + 'fourth' => { + message => q{fourth}, + lastUpdated => 1257188155, + }, + + 'last' => { + message => q{last}, + lastUpdated => 1257188155, + }, + + 'of' => { + message => 'of', + lastUpdated => 0, + }, + + 'No end' => { + message => 'No end', + lastUpdated => 0, + }, + + 'By date' => { + message => 'By date', + lastUpdated => 0, + }, + + 'After' => { + message => 'After', + lastUpdated => 0, + }, + + 'occurences' => { + message => 'occurences', + lastUpdated => 0, + }, + + 'Every' => { + message => 'Every', + lastUpdated => 0, + }, + + 'Every N weeks on' => { + message => 'Every %s week(s) on', + lastUpdated => 0, + context => '%s is filled with an HTML Form control', + }, + + 'Every N months on' => { + message => 'Every %s month(s) on', + lastUpdated => 0, + context => '%s is filled with an HTML Form control', + }, + + 'Every N years on' => { + message => 'Every %s year(s) on', + lastUpdated => 0, + context => '%s is filled with an HTML Form control', + }, + + 'week on' => { + message => 'week on', + lastUpdated => 0, + context => 'follows a select list with ordinals, first, second, etc. To form the phrase, First week on, Second week on', + }, + }; 1; From 1eeb76e96fb08cc068e0f2c17ca601e3f8fb3737 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Mon, 2 Nov 2009 18:29:46 -0800 Subject: [PATCH 10/11] newByLineage should log its own error. Fixes bug #11192 --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/AssetLineage.pm | 5 +++++ t/Asset/AssetLineage.t | 11 +++++++---- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index c1d75eb8f..322225c41 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -36,6 +36,7 @@ - fixed #11189: Controls variable missing in image asset in AssetProxy - fixed #11190: event tmpl_var in help but not available - fixed #11194: Event Asset Recurrence form is not i18n'ed + - fixed #11192: newByLineage tries to instantiate asset even if no assetId found 7.8.2 - Added scheduled vendor payout workflow activity. (Special thanks to Martin @ Oqapi) diff --git a/lib/WebGUI/AssetLineage.pm b/lib/WebGUI/AssetLineage.pm index 0ecb6d70d..9db0ae1b3 100644 --- a/lib/WebGUI/AssetLineage.pm +++ b/lib/WebGUI/AssetLineage.pm @@ -821,6 +821,11 @@ sub newByLineage { $class = $assetLineage->{$lineage}{class}; unless ($id && $class) { ($id,$class) = $session->db->quickArray("select assetId, className from asset where lineage=?",[$lineage]); + if (!$id || !$class) { + $session->errorHandler->error("Couldn't instantiate asset from lineage: ".$lineage. ": class name or assetId missing"); + return undef; + } + return undef if !$id || !$class; $assetLineage->{$lineage}{id} = $id; $assetLineage->{$lineage}{class} = $class; $session->stow->set("assetLineage",$assetLineage); diff --git a/t/Asset/AssetLineage.t b/t/Asset/AssetLineage.t index 4ea371595..f03192212 100644 --- a/t/Asset/AssetLineage.t +++ b/t/Asset/AssetLineage.t @@ -17,7 +17,7 @@ use WebGUI::Session; use WebGUI::User; use WebGUI::Asset; -use Test::More tests => 90; # increment this value for each test you create +use Test::More tests => 92; # increment this value for each test you create use Test::Deep; # Test the methods in WebGUI::AssetLineage @@ -388,16 +388,19 @@ my $snippet4 = WebGUI::Asset->newByLineage($session, $snippets[4]->get('lineage' is ($snippet4->getId, $snippets[4]->getId, 'newByLineage returns correct Asset'); $snippet4 = WebGUI::Asset->newByLineage($session, $snippets[4]->get('lineage')); -is ($snippet4->getId, $snippets[4]->getId, 'newByLineage: cached lookup'); +is ($snippet4->getId, $snippets[4]->getId, '... cached lookup'); my $cachedLineage = $session->stow->get('assetLineage'); delete $cachedLineage->{$snippet4->get('lineage')}->{id}; my $snippet4 = WebGUI::Asset->newByLineage($session, $snippets[4]->get('lineage')); -is ($snippet4->getId, $snippets[4]->getId, 'newByLineage: failing id cache forces lookup'); +is ($snippet4->getId, $snippets[4]->getId, '... failing id cache forces lookup'); delete $cachedLineage->{$snippet4->get('lineage')}->{class}; my $snippet4 = WebGUI::Asset->newByLineage($session, $snippets[4]->get('lineage')); -is ($snippet4->getId, $snippets[4]->getId, 'newByLineage: failing class cache forces lookup'); +is ($snippet4->getId, $snippets[4]->getId, '... failing class cache forces lookup'); + +is(WebGUI::Asset->newByLineage($session, 'notALineage'), undef, '... returns undef'); +ok(!exists $session->stow->get('assetLineage')->{assetLineage}, '... no entry for the bad lineage in stow'); #################################################### # From d8526028abf9ab9827cee966d37e949017aaa32e Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Tue, 3 Nov 2009 09:24:48 -0800 Subject: [PATCH 11/11] Fix small number handling in the Shop. Fixes bug #11195 Format the number to be checked against 0.00 in Shop/Pay.pm, since sometimes perl will leave small remainders when subtracting numbers. --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/Shop/Pay.pm | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 322225c41..3cb89d568 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -37,6 +37,7 @@ - fixed #11190: event tmpl_var in help but not available - fixed #11194: Event Asset Recurrence form is not i18n'ed - fixed #11192: newByLineage tries to instantiate asset even if no assetId found + - fixed #11195: Shop, sometimes free checkout does not work 7.8.2 - Added scheduled vendor payout workflow activity. (Special thanks to Martin @ Oqapi) diff --git a/lib/WebGUI/Shop/Pay.pm b/lib/WebGUI/Shop/Pay.pm index 515a614ff..d404538f0 100644 --- a/lib/WebGUI/Shop/Pay.pm +++ b/lib/WebGUI/Shop/Pay.pm @@ -409,7 +409,7 @@ sub www_selectPaymentGateway { # Complete Transaction if it's a $0 transaction. my $total = $cart->calculateTotal; - if (($total + $cart->calculateShopCreditDeduction($total)) == 0) { + if (sprintf('%.2f', $total + $cart->calculateShopCreditDeduction($total)) eq '0.00') { my $transaction = WebGUI::Shop::Transaction->create($session, {cart => $cart}); $transaction->completePurchase('zero', 'success', 'success'); $cart->onCompletePurchase;