Browse Source

Bug 17453: Inter-site holds improvement

At the moment users can reserve items and choose any library as a pick up
location, but there is no mechanism to prevent users from reserving items that
are available on the shelf at any given location from reserving the item at the
same location, essentially creating a Fetch and Collect scenario.
This has an impact on staff workloads as they are having to process reservations
and check shelves for items that students can already come and collect from the
open library shelves.
The aim of this enhancement is to decrease the impact on staff workload there
should be a restriction in place that prevents users from requesting items for
collection at a library where the item is currently available.

Implementation:
We first tried to add a new circulation rule adding a 4th
“NotIfAvailableAtPickupLibrary” option to "On shelf holds allowed".
That would make the development more flexible.
But in that case we quickly faced non-trivial problematics:
Let's say you have 3 items I1, I2 and I3. The first one has onshelfholds
set to Yes and 2 others has it set to “NotIfAvailableAtPickupLibrary”.
What would be the expected behavior if a hold is placed at biblio level?
And if a hold is placed at item level for I1?
This second point could be answered by reworking the interface to move
the libraries dropdown list elsewhere (1 list per item) or by adding a
lot of JS code to handle the different situation. But it would be
much more complicated to implement.
So finally I moved back to the simple approach and added a new pref to
handle the behavior globally.

Test plan:
0/ Switch off OPACHoldsIfAvailableAtPickup
1/ Let's say you have 3 libraries L1, L2, L3, create 2 items owned by L1
and L2
2/ Place a biblio level hold. You should only be able to pick it up at
L3
2/ Place a item level hold. You should only be able to pick it up at
L3
3/ Create a third items owned by L3
4/ Now you should not be able to place a hold on this record anymore

Sponsored-by: University of the Arts London

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

https://bugs.koha-community.org/show_bug.cgi?id=14753

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
17.05.x
Jonathan Druart 8 years ago
committed by Kyle M Hall
parent
commit
00c5929c1a
  1. 11
      koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt
  2. 23
      opac/opac-reserve.pl

11
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt

@ -219,7 +219,16 @@
</select>
[% ELSE %]
<select name="branch" id="branch_[% bibitemloo.biblionumber %]">
[% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %]
[% FOREACH library IN Branches.all( selected => branch) %]
[% SET pickup_available_at = bibitemloo.not_available_at.grep(library.branchcode).size ? 0 : 1 %]
[% IF library.selected AND pickup_available_at %]
<option value="[% library.branchcode %]" selected="selected" >[% library.branchname %]</option>
[% ELSIF pickup_available_at %]
<option value="[% library.branchcode %]">[% library.branchname %]</option>
[% ELSE %]
<option value="[% library.branchcode %]" disabled="disabled" title="At least one item is available at this library">[% library.branchname %]</option>
[% END %]
[% END %]
</select>
[% END # / UNLESS bibitemloo.holdable %]
</li>

23
opac/opac-reserve.pl

@ -278,6 +278,10 @@ if ( $query->param('place_reserve') ) {
$canreserve = 0;
}
unless ( C4::Context->preference('OPACHoldsIfAvailableAtPickup') ) {
$canreserve = 0 if Koha::Items->search({ biblionumber => $biblioNum, holdingbranch => $branch })->count;
}
my $itemtype = $query->param('itemtype') || undef;
$itemtype = undef if $itemNum;
@ -378,6 +382,7 @@ $template->param('item_level_itypes' => $itemLevelTypes);
foreach my $biblioNum (@biblionumbers) {
my @not_available_at = ();
my $record = GetMarcBiblio($biblioNum);
# Init the bib item with the choices for branch pickup
my %biblioLoopIter;
@ -520,6 +525,10 @@ foreach my $biblioNum (@biblionumbers) {
$biblioLoopIter{force_hold} = 1 if $hold_allowed eq 'F';
}
$numCopiesAvailable++;
if ( not C4::Context->preference('OPACHoldsIfAvailableAtPickup') ) {
push @not_available_at, $itemInfo->{holdingbranch};
}
}
$itemLoopIter->{imageurl} = getitemtypeimagelocation( 'opac', $itemTypes->{ $itemInfo->{itype} }{imageurl} );
@ -548,6 +557,20 @@ foreach my $biblioNum (@biblionumbers) {
$biblioLoopIter{already_patron_possession} = 1;
}
if ( $biblioLoopIter{holdable} ) {
@not_available_at = uniq @not_available_at;
$biblioLoopIter{not_available_at} = \@not_available_at ;
}
unless ( C4::Context->preference('OPACHoldsIfAvailableAtPickup') ) {
@not_available_at = uniq @not_available_at;
$biblioLoopIter{not_available_at} = \@not_available_at ;
# The record is not holdable is not available at any of the libraries
if ( Koha::Libraries->search->count == @not_available_at ) {
$biblioLoopIter{holdable} = 0;
}
}
$biblioLoopIter{holdable} &&= CanBookBeReserved($borrowernumber,$biblioNum) eq 'OK';
# For multiple holds per record, if a patron has previously placed a hold,

Loading…
Cancel
Save