From d56f679195beaa1a917c8a9ac8a2162392e01b86 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 Signed-off-by: Katrin Fischer --- .../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 67f60c8861..17a79c8136 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt @@ -15,6 +15,7 @@ [% END %] [% INCLUDE 'doc-head-close.inc' %] [% Asset.css("css/datatables.css") | $raw %] + @@ -316,9 +317,9 @@ Hold must be record level [% ELSIF ( itemloo.available ) %] - + [% ELSIF ( itemloo.override ) %] - + [% ELSE %] @@ -670,6 +671,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() { @@ -794,17 +797,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; var priorities; 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 d4c4d689c9..2d49d92181 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt @@ -146,20 +146,18 @@
- -
[% FOREACH bibitemloo IN bibitemloop %]
+

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

  • [% UNLESS ( bibitemloo.holdable ) %] - [% PROCESS options_for_libraries libraries => Branches.all({ search_params => { pickup_location => 1 }, selected => branch }) %] [% ELSE %] @@ -300,30 +298,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 %] + +
    @@ -349,9 +357,9 @@ [% END # / FOREACH itemLoo IN bibitemloo.itemLoop%] -
    Select a specific item:
    Copy number
    [% IF ( itemLoo.available ) %] - + [% ELSE %] - Cannot be put on hold [% END %] @@ -427,9 +435,8 @@
    - [% END # / IF ( bibitemloo.itemholdable )%] -
    + +
    [% END # / IF ( bibitemloo.holdable ) %] @@ -451,6 +458,7 @@