From 821656ae63a812d3c75970430cd666a371d89dfd 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 Content-Type: text/plain; charset="utf-8" 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. --- C4/VirtualShelves.pm | 19 +++++++++++++++++++ catalogue/detail.pl | 7 +++++++ .../prog/en/modules/catalogue/detail.tmpl | 11 +++++++++++ .../opac-tmpl/prog/en/modules/opac-detail.tmpl | 9 +++++++++ opac/opac-detail.pl | 8 ++++++++ 5 files changed, 54 insertions(+), 0 deletions(-) diff --git a/C4/VirtualShelves.pm b/C4/VirtualShelves.pm index 76786e9..5047550 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 9c9ebe9..6c2afdc 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 e330f7f..251c6df 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 12a5003..ae40837 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 52562c7..c3b104b 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 { -- 1.5.6.5