@@ -, +, @@ --- 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(-) --- a/C4/VirtualShelves.pm +++ a/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); --- a/catalogue/detail.pl +++ a/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( 'shelves' => $shelves ); } # XISBN Stuff --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -356,10 +356,10 @@ function verify_images() { [% IF ( XSLTDetailsDisplay ) %] [% XSLTBloc %] - [% IF ( GetShelves ) %] + [% IF shelves %] Lists that include this title: - [% FOREACH GetShelve IN GetShelves %] - [% GetShelve.shelfname %] + [% FOREACH shelf IN shelves %] + [% shelf.shelfname %] [% IF ( loop.last ) %][% ELSE %]|[% END %] [% END %] @@ -520,14 +520,14 @@ function verify_images() { [% END %] - [% IF ( GetShelves ) %] -