[Koha-patches] [PATCH] bug 1003: tweak GetBibliosShelves
Galen Charlton
gmcharlt at gmail.com
Sun Sep 6 19:06:06 CEST 2009
* 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 <gmcharlt at gmail.com>
---
C4/VirtualShelves.pm | 22 ++++++++++++----------
1 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/C4/VirtualShelves.pm b/C4/VirtualShelves.pm
index 5047550..06bd3a3 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
--
1.6.3.3
More information about the Koha-patches
mailing list