From 2f8309127b08490eba625e97464d034e2c704035 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 Signed-off-by: Séverine QUEUNE Signed-off-by: Kyle M Hall --- .../prog/en/modules/reserve/request.tt | 16 +- .../opac-tmpl/bootstrap/en/modules/opac-reserve.tt | 192 ++++++++++----------- koha-tmpl/opac-tmpl/bootstrap/less/opac.less | 3 + opac/opac-reserve.pl | 174 +++++++++---------- reserve/placerequest.pl | 34 ++-- 5 files changed, 202 insertions(+), 217 deletions(-) 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 02c50b9..ad60b2f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt @@ -25,6 +25,8 @@ var override_items = {[% FOREACH bibitemloo IN bibitemloop %][% FOREACH itemloo [% 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() { @@ -149,17 +151,21 @@ function checkMultiHold() { } }); $("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 > 0){ $("#requestany").prop("checked", false); } else { $("#requestany").prop("checked",true); } + + if (remainingHolds - numchecked < 0) { + alert(MSG_EXCEEDED_HOLDS_PER_RECORD); + } }); $(".clear-date").on("click",function(e){ @@ -493,9 +499,9 @@ function checkMultiHold() { Hold must be record level [% ELSIF ( itemloo.available ) %] - + [% ELSIF ( itemloo.override ) %] - + [% ELSE %] 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 0f2f4eb..e529885 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt @@ -138,20 +138,18 @@
- -
[% FOREACH bibitemloo IN bibitemloop %]
+

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

  • [% UNLESS ( bibitemloo.holdable ) %] - [% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %] [% ELSE %] @@ -292,29 +290,39 @@
  • [% 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 %] + @@ -338,9 +346,9 @@ [% END # / FOREACH itemLoo IN bibitemloo.itemLoop%]
    Select a specific item:
    [% IF ( itemLoo.available ) %] - + [% ELSE %] - Cannot be put on hold [% END %] @@ -414,7 +422,6 @@
    - [% END # / IF ( bibitemloo.itemholdable )%]
    [% END # / IF ( bibitemloo.holdable ) %] @@ -437,6 +444,7 @@