Bug 24168: (bug 23116 follow-up) AllowHoldPolicyOverride allows a librarian to almost...
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 4 Dec 2019 15:04:45 +0000 (16:04 +0100)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Mon, 9 Dec 2019 14:23:37 +0000 (14:23 +0000)
This patch actually fixes the issue described on bug 23116.

Test plan:
See bug 23116 and comment 5. Important to note that the later comparison with
itemAlreadyOnHold assumes that the variable is a string.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

reserve/request.pl

index c501482..4f80b8d 100755 (executable)
@@ -548,8 +548,8 @@ foreach my $biblionumber (@biblionumbers) {
 
                 $item->{'holdallowed'} = $branchitemrule->{'holdallowed'};
 
-                my $can_item_be_reserved = CanItemBeReserved( $patron->borrowernumber, $itemnumber, $pickup );
-                $item->{not_holdable} = $can_item_be_reserved->{status} unless ( $can_item_be_reserved->{status} eq 'OK' );
+                my $can_item_be_reserved = CanItemBeReserved( $patron->borrowernumber, $itemnumber, $pickup )->{status};
+                $item->{not_holdable} = $can_item_be_reserved unless $can_item_be_reserved eq 'OK';
 
                 $item->{item_level_holds} = Koha::IssuingRules->get_opacitemholds_policy( { item => $item_object, patron => $patron } );
 
@@ -557,7 +557,7 @@ foreach my $biblionumber (@biblionumbers) {
                        !$item->{cantreserve}
                     && !$exceeded_maxreserves
                     && IsAvailableForItemLevelRequest($item_object, $patron)
-                    && $can_item_be_reserved->{status} eq 'OK'
+                    && $can_item_be_reserved eq 'OK'
                   )
                 {
                     $item->{available} = 1;