Bug 19540: Tell the patron why a hold cannot be placed on items
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 7 Jan 2021 12:44:33 +0000 (13:44 +0100)
committerTomas Cohen Arazi <tomascohen@theke.io>
Wed, 17 Aug 2022 13:00:01 +0000 (10:00 -0300)
This patch adds an explanation when a hold cannot be placed, in some situation:
tooManyReserves
tooManyHoldsForThisRecord
tooManyReservesToday
itemAlreadyOnHold

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt
opac/opac-reserve.pl

index 1d1d55f..176ee43 100644 (file)
                                     [% ELSIF ( bibitemloo.recall ) %]
                                         <div class="alert alert-warning">You have already placed a recall on this title.</div>
                                     [% ELSE %]
-                                        [% IF ( bibitemloo.already_patron_possession ) %]
+                                        [% IF bibitemloo.alreadypossession %]
                                             <div class="alert alert-warning">This title cannot be requested because it's already in your possession.</div>
+                                        [% ELSIF bibitemloo.tooManyReserves %]
+                                            <div class="alert alert-warning">This title cannot be requested because you reached the maximum number of holds.</div>
+                                        [% ELSIF bibitemloo.tooManyHoldsForThisRecord %]
+                                            <div class="alert alert-warning">This title cannot be requested because you exceeded max holds per record.</div>
+                                        [% ELSIF bibitemloo.tooManyReservesToday %]
+                                            <div class="alert alert-warning">This title cannot be requested because you reached the daily hold limit.</div>
+                                        [% ELSIF bibitemloo.itemAlreadyOnHold %]
+                                            <div class="alert alert-warning">This title cannot be requested because you already have hold for this item.</div>
                                         [% ELSE %]
                                             [% UNLESS ( bibitemloo.bib_available ) %]
                                                 <div class="alert">There are no items that can be placed on hold.</div>
index 20f67e8..e32a41e 100755 (executable)
@@ -565,7 +565,7 @@ foreach my $biblioNum (@biblionumbers) {
 
     my $status = CanBookBeReserved( $borrowernumber, $biblioNum )->{status};
     $biblioLoopIter{holdable} &&= $status eq 'OK';
-    $biblioLoopIter{already_patron_possession} = $status eq 'alreadypossession';
+    $biblioLoopIter{$status} = 1;
 
     if ( $biblioLoopIter{holdable} and C4::Context->preference('AllowHoldItemTypeSelection') ) {
         # build the allowed item types loop