diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 9d9ced35d..cfe3152d3 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -11,6 +11,7 @@ - fixed AddressBook feedback for missing fields. - fixed #11606: Syndicated Content feed returns a relative link - fixed #11614: Forums: Sort Fields + - fixed #11616: No access to /root 7.9.6 - new checkbox in the asset manager for clearing the package flag on import diff --git a/lib/WebGUI/AssetLineage.pm b/lib/WebGUI/AssetLineage.pm index 49acf0283..8e2d699fb 100644 --- a/lib/WebGUI/AssetLineage.pm +++ b/lib/WebGUI/AssetLineage.pm @@ -461,10 +461,6 @@ sub getLineage { my $sql = $self->getLineageSql($relatives,$rules); - unless ($sql) { - return []; - } - my @lineage; my %relativeCache; my $sth = $self->session->db->read($sql); @@ -732,7 +728,8 @@ sub getLineageSql { } ## finish up our where clause if (!scalar(@whereModifiers)) { - return ""; + #Return valid SQL that will never select an asset. + return q|select * from asset where assetId="###---###"|; } $where .= ' and ('.join(" or ",@whereModifiers).')'; if (exists $rules->{whereClause} && $rules->{whereClause}) { diff --git a/t/Asset/AssetLineage.t b/t/Asset/AssetLineage.t index 07f2bb999..531d82d7a 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 => 93; # increment this value for each test you create +use Test::More tests => 96; # increment this value for each test you create use Test::Deep; # Test the methods in WebGUI::AssetLineage @@ -445,6 +445,22 @@ cmp_bag( 'getLineage: descendants of topFolder', ); +$ids = $root->getLineage(['ancestors']); +cmp_deeply( + $ids, + [], + '... getting ancestors of root returns empty array' +); + +#################################################### +# +# getLineageSql +# +#################################################### + +note "getLineageSql"; +ok $root->getLineageSql(['ancestors']), 'valid SQL returned in an error condition'; + #################################################### # # getLineageIterator @@ -497,6 +513,13 @@ cmp_bag( 'getLineageIterator: descendants of topFolder', ); +my $empty = getListFromIterator($root->getLineageIterator(['ancestors'])); +cmp_bag( + $empty, + [], + '... getting ancestors of root returns empty array' +); + #################################################### # # addChild