From e33b09c49f6be3f2716f39e59e86349d9ffd4681 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 Content-Type: text/plain; charset=utf-8 Signed-off-by: Alex Arnaud Signed-off-by: Marcel de Rooy --- C4/VirtualShelves.pm | 21 ------------------- catalogue/detail.pl | 13 +++++++++++- .../prog/en/modules/catalogue/detail.tt | 22 ++++++++++---------- .../opac-tmpl/bootstrap/en/modules/opac-detail.tt | 8 +++---- opac/opac-detail.pl | 15 ++++++++++--- 5 files changed, 39 insertions(+), 40 deletions(-) diff --git a/C4/VirtualShelves.pm b/C4/VirtualShelves.pm index 5c072f9..252ca2e 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 30ce2c2..1989a7c 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -44,6 +44,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'); @@ -377,7 +379,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( 'shelves' => $shelves ); } # XISBN Stuff diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt index 20ac837..b501e42 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -357,10 +357,10 @@ function verify_images() { [% IF ( XSLTDetailsDisplay ) %] [% XSLTBloc %] - [% IF ( GetShelves ) %] + [% IF shelves %] Lists that include this title: - [% FOREACH GetShelve IN GetShelves %] - [% GetShelve.shelfname %] + [% FOREACH s IN shelves %] + [% s.shelfname %] [% IF ( loop.last ) %][% ELSE %]|[% END %] [% END %] @@ -521,14 +521,14 @@ function verify_images() { [% END %] - [% IF ( GetShelves ) %] -
  • Lists that include this title: - -
  • + [% IF shelves %] +
  • Lists that include this title: + +
  • [% END %] [% IF ( TagsEnabled && TagsShowOnDetail && TagLoop ) %]
  • Tags: diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt index 1c36c06..cb0daa5 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt @@ -390,14 +390,14 @@ [% END # / LibraryThingForLibrariesID %] - [% IF ( GetShelves ) %] + [% IF shelves %] List(s) this item appears in: - [% FOREACH GetShelve IN GetShelves %] - [% GetShelve.shelfname %] + [% FOREACH shelf IN shelves %] + [% shelf.shelfname %] [% IF ( loop.last ) %][% ELSE %]|[% END %] [% END %] - [% END # / GetShelves %] + [% END %] [% IF ( TagsShowEnabled ) %]
    diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 0fa588f..4e3d73e 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( shelves => $shelves ); } - # XISBN Stuff if (C4::Context->preference("OPACFRBRizeEditions")==1) { eval { -- 1.7.10.4