This commit implements changes to opac-reserve.tt and opac-reserve.pl.
1. The change to opac-reserve.tt JS fixes the total_requested() function which
returns an output which is always 2 digits higher than the actual number of
selected item checkboxes.
i.e. if the 'maxreserves' syspref (limit for the overall
number of reserves allowed by a user) is 4 and a user has no previous
holds and ticks 3 item checkboxes and submits the form.
The 'Maximum number of reserve exceded.' popup message is displayed,
however as they have selected 3 items for reservation this is less than
the maxreserves value of 4.
The popup is displayed because total_requested() JS function is
returning 5 (i.e. 2 on top of the actual number of requested holds).
This commit usbtracts 2 from the number of holds calculated by
total_requested() so that the accurate number of requested holds is
being used to determine whether or not to display the excess holds
2. When the 'Holds per record (count)' (circulation rule) and
'maxreserves' syspref are the same value (e.g. 4) you can tick 4 item
checkboxes in opac-reserve.pl and submit the form.
The form will submit successfully and to the user everything looks to
have worked however the holds will not be
This is because after the form is submitted to opac-reserve.pl a check is
If 'number of submitted hold requests' + 'number of previous existing holds'
greater than or equal to maxreserves syspref then set the variable
'$canreserve' to 0.
If the $canreserve variable is 0 the form will submit, no warning/error
message is displayed to the user but the holds are not created.
Users should be able to place 4 holds if the maxreserves syspref is 4
(just not more than 4 holds). This commit changes this check to:
If 'number of submitted hold requests' + 'number of previous existing
holds' greater than maxreserves syspref then set the variable '$canreserve' to
i.e. notice we only check for greater than (not equal to).
Which solves the bug of the form submitting and no holds being created
when the maxreserves syspref and 'Holds per record (count)' (circulation
rule) are the same.
Test plan (in two parts to test fix #1 and #2 (above)):
Test plan for fix #1:
1. Apply all patches on this bug report (15565) and follow and confirm
the feature works as described in the test plan in the first commit
2. Set the 'maxreserves' syspref to 3 (and 'Holds per record (count)'
(circulation rule) to 5)
3. Ensure your logged in patron account has no existing reserves
4. In the OPAC go to a biblio page with 3 or more items
5. In the reservation page (opac-reserve.pl) for that biblio select 2
item checkboes to place 2 item level holds and notice the 'Maximum
number of reserve exceded.' popup message is displayed.
As the maxreserves syspref value is 3 you should be able to place 2
holds without exceeding that value
6. Apply this patch
7. Repeat step 5 and notice the form submits without the exceeding popup
message and the holds are successfully placed.
Test plan for fix #2:
1. Apply all patches attached to this bug report (bug 15565) and perform
the test plan in the first commit and verify it works.
2. Set your 'Holds per record (count)' (circulation rule) and
'maxreserves' syspref to the same value 3
3. Go to a biblio in the OPAC with 3 or more items
4. In the opac-reserve.pl reservation interface for that biblio tick 3
item checkboxes to place 3 item level holds and submit the form.
5. Notice the form submits and no warning/error message is displayed
6. In the opac user summary page that is displayed after the reserve
form is submitted notice the holds are not displayed this is because
they have not been placed
7. Apply this patch
8. Repeat step 4 and 5 and notice the holds have been successfully
placed and are displayed in your opac user summary page.