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

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
Katrin Fischer 2018-08-09 22:13:32 +00:00 committed by Nick Clemens
parent 2953c6c6cd
commit ba116a578b
2 changed files with 17 additions and 1 deletions

View file

@ -3,6 +3,7 @@
[% USE KohaDates %] [% USE KohaDates %]
[% USE Price %] [% USE Price %]
[% USE ItemTypes %] [% USE ItemTypes %]
[% USE AuthorisedValues %]
[% INCLUDE 'doc-head-open.inc' %] [% INCLUDE 'doc-head-open.inc' %]
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog &rsaquo; Placing a hold</title> <title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog &rsaquo; Placing a hold</title>
[% INCLUDE 'doc-head-close.inc' %] [% INCLUDE 'doc-head-close.inc' %]
@ -334,6 +335,9 @@
<th>Home library</th> <th>Home library</th>
<th>Last location</th> <th>Last location</th>
[% END %] [% END %]
[% IF ( itemdata_ccode ) %]
<th>Collection</th>
[% END %]
<th>Call number</th> <th>Call number</th>
[% IF ( itemdata_enumchron ) %] [% IF ( itemdata_enumchron ) %]
<th>Vol info</th> <th>Vol info</th>
@ -373,6 +377,9 @@
<td class="homebranch">[% Branches.GetName( itemLoo.homeBranchName ) | html %]</td> <td class="homebranch">[% Branches.GetName( itemLoo.homeBranchName ) | html %]</td>
<td class="holdingbranch">[% Branches.GetName( itemLoo.holdingBranchName ) | html %]</td> <td class="holdingbranch">[% Branches.GetName( itemLoo.holdingBranchName ) | html %]</td>
[% END %] [% END %]
[% IF ( itemdata_ccode ) %]
<td class="ccode"> [% IF ( itemLoo.ccode ) %][% AuthorisedValues.GetByCode( 'CCODE', itemLoo.ccode ) %][% END %]</td>
[% END %]
<td class="call_no">[% itemLoo.callNumber | html %]</td> <td class="call_no">[% itemLoo.callNumber | html %]</td>
[% IF ( itemdata_enumchron ) %] [% IF ( itemdata_enumchron ) %]
<td class="vol_info">[% itemLoo.enumchron | html %]</td> <td class="vol_info">[% itemLoo.enumchron | html %]</td>

View file

@ -382,6 +382,7 @@ unless ($noreserves) {
my $biblioLoop = []; my $biblioLoop = [];
my $numBibsAvailable = 0; my $numBibsAvailable = 0;
my $itemdata_enumchron = 0; my $itemdata_enumchron = 0;
my $itemdata_ccode = 0;
my $anyholdable = 0; my $anyholdable = 0;
my $itemLevelTypes = C4::Context->preference('item-level_itypes'); my $itemLevelTypes = C4::Context->preference('item-level_itypes');
$template->param('item_level_itypes' => $itemLevelTypes); $template->param('item_level_itypes' => $itemLevelTypes);
@ -442,6 +443,7 @@ foreach my $biblioNum (@biblionumbers) {
$itemLoopIter->{homeBranchName} = $itemInfo->{homebranch}; $itemLoopIter->{homeBranchName} = $itemInfo->{homebranch};
$itemLoopIter->{callNumber} = $itemInfo->{itemcallnumber}; $itemLoopIter->{callNumber} = $itemInfo->{itemcallnumber};
$itemLoopIter->{enumchron} = $itemInfo->{enumchron}; $itemLoopIter->{enumchron} = $itemInfo->{enumchron};
$itemLoopIter->{ccode} = $itemInfo->{ccode};
$itemLoopIter->{copynumber} = $itemInfo->{copynumber}; $itemLoopIter->{copynumber} = $itemInfo->{copynumber};
if ($itemLevelTypes) { if ($itemLevelTypes) {
$itemLoopIter->{translated_description} = $itemInfo->{translated_description}; $itemLoopIter->{translated_description} = $itemInfo->{translated_description};
@ -546,10 +548,17 @@ foreach my $biblioNum (@biblionumbers) {
if ($itemLoopIter->{enumchron}) { if ($itemLoopIter->{enumchron}) {
$itemdata_enumchron = 1; $itemdata_enumchron = 1;
} }
# Show collection when needed
if ($itemLoopIter->{ccode}) {
$itemdata_ccode = 1;
}
push @{$biblioLoopIter{itemLoop}}, $itemLoopIter; push @{$biblioLoopIter{itemLoop}}, $itemLoopIter;
} }
$template->param( itemdata_enumchron => $itemdata_enumchron ); $template->param(
itemdata_enumchron => $itemdata_enumchron,
itemdata_ccode => $itemdata_ccode,
);
if ($numCopiesAvailable > 0) { if ($numCopiesAvailable > 0) {
$numBibsAvailable++; $numBibsAvailable++;