Handle the edge case where no fields are to be returned in a Thingy search. Fixes bug #11587

This commit is contained in:
Colin Kuskie 2010-05-25 12:02:32 -07:00
parent 7a1487be55
commit 9cfcf84c2f
2 changed files with 10 additions and 7 deletions

View file

@ -8,6 +8,7 @@
- fixed #11584: Errors on checkout when payment problems occur
- fixed #11582: Registering with a .mobi email address
- fixed #11580: Date not populated for Story Archive RSS feed
- fixed #11587: Thingy, no fields and undefined statement handles
7.9.5
- Asset->www_copy now has a progress bar

View file

@ -3357,18 +3357,20 @@ sequenceNumber');
WebGUI::Cache->new($self->session,"query_".$thingId)->set($query,30*60);
$paginatePage = $self->session->form->param('pn') || 1;
$currentUrl = $self->session->url->append($currentUrl, "orderBy=".$orderBy) if $orderBy;
$currentUrl = $self->session->url->append($currentUrl, "orderBy=".$orderBy) if $orderBy;
$p = WebGUI::Paginator->new($self->session,$currentUrl,$thingProperties->{thingsPerPage}, undef, $paginatePage);
my $sth = $self->session->db->read($query) if ! $noFields;
my @visibleResults;
while (my $result = $sth->hashRef){
if ($self->canViewThingData($thingId,$result->{thingDataId})){
push(@visibleResults,$result);
if (! $noFields) {
my $sth = $self->session->db->read($query) if ! $noFields;
while (my $result = $sth->hashRef){
if ($self->canViewThingData($thingId,$result->{thingDataId})){
push(@visibleResults,$result);
}
}
}
$p->setDataByArrayRef(\@visibleResults) if ! $noFields;
$p->setDataByArrayRef(\@visibleResults);
$searchResults = $p->getPageData($paginatePage);
foreach my $searchResult (@$searchResults){