From f8affce8fa861ef38bea0c010eaaa7eb8324b6d3 Mon Sep 17 00:00:00 2001 From: Alex Arnaud Date: Wed, 12 Oct 2016 07:02:19 +0000 Subject: [PATCH] Bz 15565 - Place multiple holds at once for the same record on staff and OPAC. --- .../prog/en/modules/reserve/request.tt | 16 +- .../opac-tmpl/bootstrap/en/modules/opac-reserve.tt | 188 ++++++++++----------- koha-tmpl/opac-tmpl/bootstrap/less/opac.less | 3 + opac/opac-reserve.pl | 183 +++++++++----------- reserve/placerequest.pl | 34 ++-- 5 files changed, 201 insertions(+), 223 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 12b4e1b..bae2d7b 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){ @@ -495,9 +501,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 c0dd300..750aa7d 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt @@ -134,20 +134,18 @@
- -
[% FOREACH bibitemloo IN bibitemloop %]
+

[% IF ( bibitemloo.holdable ) %] - - - - - - + + [% END # / bibitemloo.holdable %] @@ -214,11 +212,11 @@

  • [% UNLESS ( bibitemloo.holdable ) %] - [% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %] [% ELSE %] - [% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %] [% END # / UNLESS bibitemloo.holdable %] @@ -273,29 +271,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 %] + @@ -319,9 +327,9 @@ [% END # / FOREACH itemLoo IN bibitemloo.itemLoop%]
    Select a specific item:
    [% IF ( itemLoo.available ) %] - + [% ELSE %] - Cannot be put on hold [% END %] @@ -395,7 +403,6 @@
    - [% END # / IF ( bibitemloo.itemholdable )%]
    [% END # / IF ( bibitemloo.holdable ) %] @@ -418,6 +425,7 @@