From 6b90ec566cd5df8ef3d65a26a8b9ce37c078b08e Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Sun, 6 Sep 2009 13:05:06 -0400 Subject: [PATCH] bug 1003: tweak GetBibliosShelves * correct POD - returns *public* lists that bib belongs to * use fetchall_arrayref to return results in one fell swoop * corrected indentation Signed-off-by: Galen Charlton --- C4/VirtualShelves.pm | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/C4/VirtualShelves.pm b/C4/VirtualShelves.pm index 50475508a1..06bd3a347e 100644 --- a/C4/VirtualShelves.pm +++ b/C4/VirtualShelves.pm @@ -535,20 +535,22 @@ sub DelShelf { =item GetBibShelves -This finds all the lists that this bib record is in. +This finds all the public lists that this bib record is in. =cut sub GetBibliosShelves { - my ( $biblionumber ) = @_; - my $dbh = C4::Context->dbh; - my $sth = $dbh->prepare('SELECT vs.shelfname, vs.shelfnumber FROM virtualshelves vs LEFT JOIN virtualshelfcontents vc ON (vs.shelfnumber= vc.shelfnumber) WHERE vs.category != 1 AND vc.biblionumber= ?'); - $sth->execute( $biblionumber ); - my @lists; - while (my $data = $sth->fetchrow_hashref){ - push @lists,$data; - } - return \@lists; + my ( $biblionumber ) = @_; + my $dbh = C4::Context->dbh; + my $sth = $dbh->prepare(' + SELECT vs.shelfname, vs.shelfnumber + FROM virtualshelves vs + JOIN virtualshelfcontents vc ON (vs.shelfnumber= vc.shelfnumber) + WHERE vs.category != 1 + AND vc.biblionumber= ? + '); + $sth->execute( $biblionumber ); + return $sth->fetchall_arrayref({}); } =item RefreshShelvesSummary -- 2.39.5