From 6dc31e64ae989bb6fb87b51b64f7ec164e8d9f2c Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Mon, 9 Mar 2009 18:40:21 +0000 Subject: [PATCH] Add a new option for getMatchingAssets to set the number of rows per page. Add another sort clause to make testing easier. --- lib/WebGUI/Keyword.pm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/WebGUI/Keyword.pm b/lib/WebGUI/Keyword.pm index 374132c21..fd12cb997 100644 --- a/lib/WebGUI/Keyword.pm +++ b/lib/WebGUI/Keyword.pm @@ -194,6 +194,10 @@ A classname pattern to match. For example, if you provide 'WebGUI::Asset::Sku' t Instead of returning an array reference of assetId's, return a paginator object. +=head3 rowsPerPage + +If usePaginator is passed, then this variable will set the number of rows per page that the paginator uses. + =cut sub getMatchingAssets { @@ -242,11 +246,11 @@ sub getMatchingAssets { # write the query my $query = 'select distinct assetKeyword.assetId from assetKeyword left join asset using (assetId) - where '.join(' and ', @clauses).' order by creationDate desc'; + where '.join(' and ', @clauses).' order by creationDate desc, lineage'; # perform the search if ($options->{usePaginator}) { - my $p = WebGUI::Paginator->new($self->session); + my $p = WebGUI::Paginator->new($self->session, undef, $options->{rowsPerPage}); $p->setDataByQuery($query, undef, undef, \@params); return $p; }