From 2abb1efa8579cd86f58c1c0932f2c0fca680cb44 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Thu, 18 Jun 2020 11:34:27 +0000 Subject: [PATCH] Bug 25801: Add itemnumber parameter to opac-detail Note: The GetItemsInfo call is now suboptimal. Leaving it as-is for now in the hope that item refactoring picks it up ;) Test plan: Test opac-detail via biblionumber (regular use). Test opac-detail by passing an itemnumber in the URL: /cgi-bin/koha/opac-detail?itemnumber=999 Signed-off-by: Marcel de Rooy Signed-off-by: Owen Leonard Signed-off-by: Katrin Fischer --- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt | 4 ++-- opac/opac-detail.pl | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) 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 554af2f760..f71d686067 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt @@ -479,8 +479,8 @@ [% ELSE %]
  • [% END %] - [% BLOCK holding_tab_title %][% IF SeparateHoldings %][% LoginBranchname | html %] holdings[% ELSE %]Holdings[% END %][% END %] - [% PROCESS holding_tab_title %] [% UNLESS too_many_items %][% ' ( ' _ (itemloop.size || 0) _ ' )' | html %][% END %] + [% BLOCK holding_tab_title %][% IF SeparateHoldings %][% LoginBranchname | html %] holdings[% ELSE %][% IF specific_item %]Item details[% ELSE %]Holdings[% END %][% END %][% END %] + [% PROCESS holding_tab_title %] [% UNLESS too_many_items OR specific_item %][% ' ( ' _ (itemloop.size || 0) _ ' )' | html %][% END %]
  • [% IF (SeparateHoldings) %]
  • Other holdings [% ' ( ' _ (otheritemloop.size || 0) _ ' )' | html %]
  • diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 5c1880fbed..ce091b78fb 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -67,6 +67,9 @@ my $query = CGI->new(); my $biblionumber = $query->param('biblionumber') || $query->param('bib') || 0; $biblionumber = int($biblionumber); +my $specific_item = $query->param('itemnumber') ? Koha::Items->find( scalar $query->param('itemnumber') ) : undef; +$biblionumber = $specific_item->biblionumber if $specific_item; + my ( $template, $borrowernumber, $cookie ) = get_template_and_user( { template_name => "opac-detail.tt", @@ -77,6 +80,10 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( ); my @all_items = GetItemsInfo($biblionumber); +if( $specific_item ) { + @all_items = grep { $_->{itemnumber} == $query->param('itemnumber') } @all_items; + $template->param( specific_item => 1 ); +} my @hiddenitems; my $patron = Koha::Patrons->find( $borrowernumber ); our $borcat= q{}; -- 2.11.0