From 10e78e61d0937d4124f95f23e26467094a9bc0a1 Mon Sep 17 00:00:00 2001 From: Lari Taskula Date: Thu, 21 Dec 2017 16:55:58 +0200 Subject: [PATCH] Bug 7614: (follow-up) If patron's home library is not a pickup library, let them choose another one This patch fixes an issue where patron is not allowed to place a hold in OPAC while their home library is not a pickup library. Instead, they should be presented with a list of other available pickup locations. --- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt | 5 +++++ opac/opac-reserve.pl | 11 ++++++++++- 2 files changed, 15 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 36963c659e..3b61eb8bc7 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt @@ -111,6 +111,11 @@ [% END %] + [% IF ( no_pickup_locations ) %] +
  • + None of the libraries are available for pickup location. +
  • + [% END %] [% ELSE %] [% IF ( none_available && multi_hold ) %] diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl index e49971295e..3b9b341684 100755 --- a/opac/opac-reserve.pl +++ b/opac/opac-reserve.pl @@ -389,6 +389,7 @@ my $numBibsAvailable = 0; my $itemdata_enumchron = 0; my $anyholdable = 0; my $itemLevelTypes = C4::Context->preference('item-level_itypes'); +my $pickup_locations = Koha::Libraries->search({ pickup_location => 1 }); $template->param('item_level_itypes' => $itemLevelTypes); foreach my $biblioNum (@biblionumbers) { @@ -585,7 +586,7 @@ foreach my $biblioNum (@biblionumbers) { } } - $biblioLoopIter{holdable} &&= CanBookBeReserved($borrowernumber,$biblioNum,$branch) eq 'OK'; + $biblioLoopIter{holdable} &&= CanBookBeReserved($borrowernumber,$biblioNum) eq 'OK'; # For multiple holds per record, if a patron has previously placed a hold, # the patron can only place more holds of the same type. That is, if the @@ -610,6 +611,14 @@ foreach my $biblioNum (@biblionumbers) { $anyholdable = 1 if $biblioLoopIter{holdable}; } +unless ($pickup_locations->count) { + $numBibsAvailable = 0; + $anyholdable = 0; + $template->param( + message => 1, + no_pickup_locations => 1 + ); +} if ( $numBibsAvailable == 0 || $anyholdable == 0) { $template->param( none_available => 1 ); -- 2.11.0