From cb9eb45f1e9f20330c215f0fe003c3ab86eb1807 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Mon, 20 Aug 2018 10:48:07 -0400 Subject: [PATCH] Bug 7614: Don't allow un-usable pickup locations in the opac pickup locations pulldown Also fully qualifies some subroutine calls that fail for reasons unkown. --- C4/Items.pm | 6 +++--- C4/Reserves.pm | 2 +- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt | 1 - opac/opac-reserve.pl | 8 +++++++- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/C4/Items.pm b/C4/Items.pm index bf464c3e30..36474d14e8 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -240,7 +240,7 @@ sub AddItemFromMarc { my $localitemmarc=MARC::Record->new; $localitemmarc->append_fields($source_item_marc->field($itemtag)); - my $item = &TransformMarcToKoha( $localitemmarc, $frameworkcode ,'items'); + my $item = C4::Biblio::TransformMarcToKoha( $localitemmarc, $frameworkcode ,'items'); my $unlinked_item_subfields = _get_unlinked_item_subfields($localitemmarc, $frameworkcode); return AddItem($item, $biblionumber, $dbh, $frameworkcode, $unlinked_item_subfields); } @@ -299,7 +299,7 @@ sub AddItem { $item->{'itemnumber'} = $itemnumber; - ModZebra( $item->{biblionumber}, "specialUpdate", "biblioserver" ); + C4::Biblio::ModZebra( $item->{biblionumber}, "specialUpdate", "biblioserver" ); logaction( "CATALOGUING", "ADD", $itemnumber, "item" ) if C4::Context->preference("CataloguingLog"); @@ -2190,7 +2190,7 @@ sub _get_unlinked_item_subfields { my $original_item_marc = shift; my $frameworkcode = shift; - my $marcstructure = GetMarcStructure(1, $frameworkcode, { unsafe => 1 }); + my $marcstructure = C4::Biblio::GetMarcStructure(1, $frameworkcode, { unsafe => 1 }); # assume that this record has only one field, and that that # field contains only the item information diff --git a/C4/Reserves.pm b/C4/Reserves.pm index e3c9a74c5d..dcfc1fb652 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -449,7 +449,7 @@ sub CanItemBeReserved { unless ($destination->pickup_location) { return 'libraryNotPickupLocation'; } - unless ($item->can_be_transferred({ to => $destination->branchcode })) { + unless ($item->can_be_transferred({ to => $destination })) { return 'cannotBeTransferred'; } } 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 3b61eb8bc7..c388061f65 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt @@ -224,7 +224,6 @@ [% END %] - [% UNLESS ( singleBranchMode ) %] [% IF ( bibitemloo.holdable && choose_branch ) %]
  • diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl index 3b9b341684..6fa933bc6d 100755 --- a/opac/opac-reserve.pl +++ b/opac/opac-reserve.pl @@ -178,6 +178,7 @@ foreach my $biblioNumber (@biblionumbers) { # Compute the priority rank. my $biblio = Koha::Biblios->find( $biblioNumber ); + $biblioData->{object} = $biblio; my $holds = $biblio->holds; my $rank = $holds->count; $biblioData->{reservecount} = 1; # new reserve @@ -394,7 +395,6 @@ $template->param('item_level_itypes' => $itemLevelTypes); foreach my $biblioNum (@biblionumbers) { - my @not_available_at = (); my $record = GetMarcBiblio({ biblionumber => $biblioNum }); # Init the bib item with the choices for branch pickup my %biblioLoopIter; @@ -406,6 +406,12 @@ foreach my $biblioNum (@biblionumbers) { &get_out($query, $cookie, $template->output); } + my @not_available_at = (); + my $biblio = $biblioData->{object}; + foreach my $library ( $pickup_locations->as_list ) { + push( @not_available_at, $library->branchcode ) unless $biblio->can_be_transferred({ to => $library }); + } + my $frameworkcode = GetFrameworkCode( $biblioData->{biblionumber} ); $biblioLoopIter{biblionumber} = $biblioData->{biblionumber}; $biblioLoopIter{title} = $biblioData->{title}; -- 2.11.0