From e6cee0b7c679b7655ecedf13cc9b2f433e82f554 Mon Sep 17 00:00:00 2001 From: Alex Arnaud Date: Wed, 12 Oct 2016 07:02:19 +0000 Subject: [PATCH] Bug 15565: Place multiple holds at once for the same record on staff and OPAC. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Test plan: 1. Create an circulation rule to use for testing the patches on this bug report. Ensure it has a value greater than 1 for 'Holds allowed', 'Holds per record (count)', and 'Item level holds' is enabled. 2. Also ensure the 'RequestOnOpac' syspref is set to 'Allow'. 3. Go to the reservation page (request.pl) of a biblio in the staff client with more than one item. 4. Notice beside each item a radio button is displayed preventing you from being able to select multiple items to place a hold on. 5. Go to the reservation page (opac-reserve.pl) of the same biblio in the OPAC also notice a radio button is displayed beside every item. 6. Apply patches 7. Repeat step 3 and 5 and notice in both the staff client and OPAC checkboxes rather than radio buttons are displayed beside each item so you can select multiple items for reservation at a time. 8. From staff interface, place several item-level holds for the same user on the same record at once: - check that you are warned if you exceed "Holds per record (count)" (circulation rules) for this record. - check also maxReserves system preference. 9. From opac, place several item-level and record level holds for the same user on the same record at once: - check that can't exceed "Holds per record (count)" for this record. This is enforced by all unticked item checkboxes being disabled after the number of ticked checkboxes equals the 'Holds per record (count)' (circulation rules) value. - check also maxReserves system preference. Do the same in OPAC and staff by selecting several record (multi-hold). Signed-off-by: Séverine QUEUNE Signed-off-by: Kyle M Hall Signed-off-by: Benjamin Rokseth --- .../prog/en/modules/reserve/request.tt | 16 +- .../opac-tmpl/bootstrap/en/modules/opac-reserve.tt | 200 +- koha-tmpl/opac-tmpl/bootstrap/less/opac.less | 2644 ++++++++++++++++++++ opac/opac-reserve.pl | 166 +- reserve/placerequest.pl | 32 +- 5 files changed, 2852 insertions(+), 206 deletions(-) create mode 100644 koha-tmpl/opac-tmpl/bootstrap/less/opac.less diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt index 7d8276e60e..a181df9fa2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt @@ -14,6 +14,7 @@ [% END %] [% INCLUDE 'doc-head-close.inc' %] [% Asset.css("css/datatables.css") | $raw %] + @@ -312,9 +313,9 @@ Hold must be record level [% ELSIF ( itemloo.available ) %] - + [% ELSIF ( itemloo.override ) %] - + [% ELSE %] @@ -729,6 +730,8 @@ [% END %][% END %][% END %] }; var MSG_NO_ITEMS_AVAILABLE = _("A hold cannot be requested on any of these items."); + var MSG_EXCEEDED_HOLDS_PER_RECORD = _("Patron has exceeded the number of holds for this record."); + var remainingHolds = "[% remaining_holds_for_record %]"; $(document).ready(function() { function ToggleHoldsToPlace() { @@ -853,17 +856,20 @@ } }); $("input[name=checkitem]").click(function() { - onechecked = 0; + numchecked = 0; $("input[name=checkitem]").each(function() { if(this.checked){ - onechecked = 1; + numchecked = 1; } }); - if(onechecked == 1){ + if(numchecked == 1){ $("#requestany").prop("checked", false); } else { $("#requestany").prop("checked",true); } + if (remainingHolds - numchecked < 0) { + alert(MSG_EXCEEDED_HOLDS_PER_RECORD); + } }); var prev_rank_request; $("select[name=rank-request]").on("focus", function() { 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 d1bf7ee78a..409f49353d 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt @@ -145,20 +145,18 @@
- -
[% FOREACH bibitemloo IN bibitemloop %]
+

[% IF ( bibitemloo.holdable ) %] - - - - - - + + [% END # / bibitemloo.holdable %] @@ -225,7 +223,7 @@

  • [% UNLESS ( bibitemloo.holdable ) %] - [% PROCESS options_for_libraries libraries => Branches.all({ search_params => { pickup_location => 1 }, selected => branch }) %] [% ELSE %] @@ -299,30 +297,40 @@
  • [% END # / IF OpacHoldNotes %] - [% IF bibitemloo.itemholdable %] - - - [% END # / IF bibitemloo.itemholdable %] + + + - [% IF bibitemloo.itemholdable %] - + [% IF bibitemloo.remaining_holds_for_record > 1 %] + [% SET count = 1 %] +
    + + +
    + [% ELSE %] + + [% END %] + +
    @@ -345,9 +353,9 @@ [% END # / FOREACH itemLoo IN bibitemloo.itemLoop%] -
    Select a specific item:
    Copy number
    [% IF ( itemLoo.available ) %] - + [% ELSE %] - Cannot be put on hold [% END %] @@ -420,9 +428,8 @@
    - [% END # / IF ( bibitemloo.itemholdable )%] -
    + +
    [% END # / IF ( bibitemloo.holdable ) %] @@ -444,6 +451,7 @@