From b9f4fa6260ccca1d603f425379a547a9b423cd23 Mon Sep 17 00:00:00 2001 From: Nicole Engard Date: Thu, 27 Aug 2009 11:22:15 -0400 Subject: [PATCH] Bug 1003 Added lists to bib details pages This patch adds links to all public lists that a bib record belongs to to the detail page in the OPAC and the Inranet. If the item is not in any lists nothing shows on the detail page. The same goes if virtualshelves is turned OFF. Signed-off-by: Galen Charlton --- C4/VirtualShelves.pm | 19 +++++++++++++++++++ catalogue/detail.pl | 7 +++++++ .../prog/en/modules/catalogue/detail.tmpl | 11 +++++++++++ .../prog/en/modules/opac-detail.tmpl | 9 +++++++++ opac/opac-detail.pl | 8 ++++++++ 5 files changed, 54 insertions(+) diff --git a/C4/VirtualShelves.pm b/C4/VirtualShelves.pm index 76786e9bfd..50475508a1 100644 --- a/C4/VirtualShelves.pm +++ b/C4/VirtualShelves.pm @@ -44,6 +44,7 @@ BEGIN { &ModShelf &ShelfPossibleAction &DelFromShelf &DelShelf + &GetBibliosShelves ); @EXPORT_OK = qw( &GetShelvesSummary &GetRecentShelves @@ -532,6 +533,24 @@ sub DelShelf { return $sth->execute(shift); } +=item GetBibShelves + +This finds all the 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; +} + =item RefreshShelvesSummary ($total, $pubshelves, $barshelves) = RefreshShelvesSummary($sessionID, $loggedinuser, $row_count); diff --git a/catalogue/detail.pl b/catalogue/detail.pl index 9c9ebe9647..6c2afdc0d7 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -35,6 +35,7 @@ use C4::Serials; use C4::XISBN qw(get_xisbns get_biblionumber_from_isbn); use C4::External::Amazon; use C4::Search; # enabled_staff_search_views +use C4::VirtualShelves; # use Smart::Comments; @@ -225,6 +226,12 @@ $template->param( # $debug and $template->param(debug_display => 1); +# Lists + +if (C4::Context->preference("virtualshelves") ) { + $template->param( 'GetShelves' => GetBibliosShelves( $biblionumber ) ); +} + # XISBN Stuff if (C4::Context->preference("FRBRizeEditions")==1) { eval { diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tmpl index e330f7f50f..251c6dfa81 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tmpl @@ -100,6 +100,7 @@ function verify_images() { +
  • OPAC View: /cgi-bin/koha/opac-detail.pl?biblionumber=" target="_blank">Open in new window @@ -150,6 +151,16 @@ function verify_images() {
  • + + +
  • Lists that include this title: +
      + +
    • ">
    • + +
    +
  • + diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl index 12a5003550..ae40837aeb 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl @@ -216,6 +216,15 @@ YAHOO.util.Event.onContentReady("furtherm", function () { + + + List(s) this item appears in: + + &sortfield=title"> + | + + +
    diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index dd73cfcc39..cae305ae32 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -38,6 +38,7 @@ use C4::External::Syndetics qw(get_syndetics_index get_syndetics_summary get_syn use C4::Review; use C4::Serials; use C4::Members; +use C4::VirtualShelves; use C4::XSLT; BEGIN { @@ -266,6 +267,13 @@ $template->param( loggedincommenter => $loggedincommenter ); +# Lists + +if (C4::Context->preference("virtualshelves") ) { + $template->param( 'GetShelves' => GetBibliosShelves( $biblionumber ) ); +} + + # XISBN Stuff if (C4::Context->preference("OPACFRBRizeEditions")==1) { eval { -- 2.39.5