From 36571ccdb0c657eba09ce64dac6e8df06e2653ab Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 6 Aug 2015 15:28:12 +0100 Subject: [PATCH] Bug 14544: Get rid of GetBibliosShelves --- C4/VirtualShelves.pm | 21 --------------------- catalogue/detail.pl | 13 ++++++++++++- opac/opac-detail.pl | 15 ++++++++++++--- 3 files changed, 24 insertions(+), 25 deletions(-) diff --git a/C4/VirtualShelves.pm b/C4/VirtualShelves.pm index dd9efde..8f23f85 100644 --- a/C4/VirtualShelves.pm +++ b/C4/VirtualShelves.pm @@ -42,7 +42,6 @@ BEGIN { @EXPORT = qw( &GetShelves &GetShelfContents &ShelfPossibleAction - &GetBibliosShelves ); @EXPORT_OK = qw( &ShelvesMax @@ -333,26 +332,6 @@ sub ShelfPossibleAction { return 0; } -=head2 GetBibliosShelves - -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 - JOIN virtualshelfcontents vc ON (vs.shelfnumber= vc.shelfnumber) - WHERE vs.category=2 - AND vc.biblionumber= ? - '); - $sth->execute( $biblionumber ); - return $sth->fetchall_arrayref({}); -} - =head2 ShelvesMax $howmany= ShelvesMax($context); diff --git a/catalogue/detail.pl b/catalogue/detail.pl index b7ba9a4..d74db2a 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -45,6 +45,8 @@ use C4::HTML5Media; use C4::CourseReserves qw(GetItemCourseReservesInfo); use C4::Acquisition qw(GetOrdersByBiblionumber); +use Koha::Virtualshelves; + my $query = CGI->new(); my $analyze = $query->param('analyze'); @@ -374,7 +376,16 @@ $template->param( # Lists if (C4::Context->preference("virtualshelves") ) { - $template->param( 'GetShelves' => GetBibliosShelves( $biblionumber ) ); + my $shelves = Koha::Virtualshelves->search( + { + biblionumber => $biblionumber, + category => 2, + }, + { + join => 'virtualshelfcontents', + } + ); + $template->param( 'GetShelves' => $shelves ); } # XISBN Stuff diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 0fa588f..b67e745 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -53,6 +53,8 @@ use Koha::DateUtils; use C4::HTML5Media; use C4::CourseReserves qw(GetItemCourseReservesInfo); +use Koha::Virtualshelves; + BEGIN { if (C4::Context->preference('BakerTaylorEnabled')) { require C4::External::BakerTaylor; @@ -844,12 +846,19 @@ $template->param( ); # Lists - if (C4::Context->preference("virtualshelves") ) { - $template->param( 'GetShelves' => GetBibliosShelves( $biblionumber ) ); + my $shelves = Koha::Virtualshelves->search( + { + biblionumber => $biblionumber, + category => 2, + }, + { + join => 'virtualshelfcontents', + } + ); + $template->param( 'GetShelves' => $shelves ); } - # XISBN Stuff if (C4::Context->preference("OPACFRBRizeEditions")==1) { eval { -- 2.1.0