From bc91603e712fff95a74a1422920de0dac93d7370 Mon Sep 17 00:00:00 2001 From: Katrin Fischer Date: Thu, 9 Aug 2018 22:13:32 +0000 Subject: [PATCH] Bug 20450: Add collection to item table when placing a hold on a specific copy (OPAC) This patch adds a new collection column to the item table when selecting a specific item for a hold. The column will only appear if at least one item has a collection set. To test, in OPAC: - Place a specific hold on - a record with one or more items with collections - a record with one or more items without collections - Verify the collections display correctly when they exist - Verify the table still works as expected --- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt | 7 +++++++ opac/opac-reserve.pl | 11 ++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt index 4b13a3a..8f83f9d 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt @@ -3,6 +3,7 @@ [% USE KohaDates %] [% USE Price %] [% USE ItemTypes %] +[% USE AuthorisedValues %] [% INCLUDE 'doc-head-open.inc' %] [% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog › Placing a hold [% INCLUDE 'doc-head-close.inc' %] @@ -334,6 +335,9 @@ Home library Last location [% END %] + [% IF ( itemdata_ccode ) %] + Collection + [% END %] Call number [% IF ( itemdata_enumchron ) %] Vol info @@ -373,6 +377,9 @@ [% Branches.GetName( itemLoo.homeBranchName ) %] [% Branches.GetName( itemLoo.holdingBranchName ) %] [% END %] + [% IF ( itemdata_ccode ) %] + [% IF ( itemLoo.ccode ) %][% AuthorisedValues.GetByCode( 'CCODE', itemLoo.ccode ) %][% END %] + [% END %] [% itemLoo.callNumber %] [% IF ( itemdata_enumchron ) %] [% itemLoo.enumchron %] diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl index a9af8d1..bff6564 100755 --- a/opac/opac-reserve.pl +++ b/opac/opac-reserve.pl @@ -387,6 +387,7 @@ unless ($noreserves) { my $biblioLoop = []; my $numBibsAvailable = 0; my $itemdata_enumchron = 0; +my $itemdata_ccode = 0; my $anyholdable = 0; my $itemLevelTypes = C4::Context->preference('item-level_itypes'); $template->param('item_level_itypes' => $itemLevelTypes); @@ -447,6 +448,7 @@ foreach my $biblioNum (@biblionumbers) { $itemLoopIter->{homeBranchName} = $itemInfo->{homebranch}; $itemLoopIter->{callNumber} = $itemInfo->{itemcallnumber}; $itemLoopIter->{enumchron} = $itemInfo->{enumchron}; + $itemLoopIter->{ccode} = $itemInfo->{ccode}; $itemLoopIter->{copynumber} = $itemInfo->{copynumber}; if ($itemLevelTypes) { $itemLoopIter->{translated_description} = $itemInfo->{translated_description}; @@ -551,10 +553,17 @@ foreach my $biblioNum (@biblionumbers) { if ($itemLoopIter->{enumchron}) { $itemdata_enumchron = 1; } + # Show collection when needed + if ($itemLoopIter->{ccode}) { + $itemdata_ccode = 1; + } push @{$biblioLoopIter{itemLoop}}, $itemLoopIter; } - $template->param( itemdata_enumchron => $itemdata_enumchron ); + $template->param( + itemdata_enumchron => $itemdata_enumchron, + itemdata_ccode => $itemdata_ccode, + ); if ($numCopiesAvailable > 0) { $numBibsAvailable++; -- 2.1.4