From dbaf146266a5d25d2c3843cde977cfa027854134 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 Signed-off-by: Jonathan Druart --- 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 7beeb1a969..09e0f0e8dc 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.39.5