@EXPORT = qw(
&GetShelves &GetShelfContents
&ShelfPossibleAction
- &GetBibliosShelves
);
@EXPORT_OK = qw(
&ShelvesMax
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);
use C4::CourseReserves qw(GetItemCourseReservesInfo);
use C4::Acquisition qw(GetOrdersByBiblionumber);
+use Koha::Virtualshelves;
+
my $query = CGI->new();
my $analyze = $query->param('analyze');
# 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 ( XSLTDetailsDisplay ) %]
[% XSLTBloc %]
- [% IF ( GetShelves ) %]
+ [% IF shelves %]
<span class="results_summary"><span class="label">Lists that include this title: </span>
- [% FOREACH GetShelve IN GetShelves %]
- <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=view&shelfnumber=[% GetShelve.shelfnumber %]">[% GetShelve.shelfname %]</a>
+ [% FOREACH s IN shelves %]
+ <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=view&shelfnumber=[% s.shelfnumber %]">[% s.shelfname %]</a>
[% IF ( loop.last ) %][% ELSE %]|[% END %]
[% END %]
</span>
</li>
[% END %]
<!--This grabs all of the lists a bib record appears in -->
- [% IF ( GetShelves ) %]
- <li><strong>Lists that include this title: </strong>
- <ul>
- [% FOREACH GetShelve IN GetShelves %]
- <li><a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=view&shelfnumber=[% GetShelve.shelfnumber %]">[% GetShelve.shelfname %]</a></li>
- [% END %]
- </ul>
- </li>
+ [% IF shelves %]
+ <li><strong>Lists that include this title: </strong>
+ <ul>
+ [% FOREACH s IN shelves %]
+ <li><a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=view&shelfnumber=[% s.shelfnumber %]">[% s.shelfname %]</a></li>
+ [% END %]
+ </ul>
+ </li>
[% END %]
[% IF ( TagsEnabled && TagsShowOnDetail && TagLoop ) %]
<li><strong>Tags:</strong>
[% END # / LibraryThingForLibrariesID %]
<!--This grabs all of the lists a bib record appears in -->
- [% IF ( GetShelves ) %]
+ [% IF shelves %]
<span class="results_summary lists"><span class="label">List(s) this item appears in: </span>
- [% FOREACH GetShelve IN GetShelves %]
- <a href="/cgi-bin/koha/opac-shelves.pl?viewshelf=[% GetShelve.shelfnumber %]">[% GetShelve.shelfname %]</a>
+ [% FOREACH shelf IN shelves %]
+ <a href="/cgi-bin/koha/opac-shelves.pl?viewshelf=[% shelf.shelfnumber %]">[% shelf.shelfname %]</a>
[% IF ( loop.last ) %][% ELSE %]|[% END %]
[% END %]
</span>
- [% END # / GetShelves %]
+ [% END %]
[% IF ( TagsShowEnabled ) %]
<div class="results_summary tags">
use C4::HTML5Media;
use C4::CourseReserves qw(GetItemCourseReservesInfo);
+use Koha::Virtualshelves;
+
BEGIN {
if (C4::Context->preference('BakerTaylorEnabled')) {
require C4::External::BakerTaylor;
);
# 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 {