From f60d3837ee036e53df9ae1486d39f4a45a09e460 Mon Sep 17 00:00:00 2001 From: Alex Arnaud Date: Mon, 1 Feb 2016 18:20:50 +0100 Subject: [PATCH] Bz 15565 - Place multiple holds at once for the same record on staff and OPAC. 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. 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, - check also maxReserves system preference. Do the same in OPAC and staff by selecting several record (multi-hold). --- .../prog/en/modules/reserve/request.tt | 34 ++-- .../opac-tmpl/bootstrap/en/modules/opac-reserve.tt | 160 +++++++++--------- koha-tmpl/opac-tmpl/bootstrap/less/opac.less | 3 + opac/opac-reserve.pl | 187 ++++++++++----------- reserve/placerequest.pl | 32 ++-- 5 files changed, 196 insertions(+), 220 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 2dbd482..913e83f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt @@ -22,6 +22,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() { [% IF AutoResumeSuspendedHolds %] @@ -148,19 +150,23 @@ function checkMultiHold() { }); } }); - $("input[name=checkitem]").click(function() { - onechecked = 0; - $("input[name=checkitem]").each(function() { - if(this.checked){ - onechecked = 1; - } - }); - if(onechecked == 1){ + $("input[name=checkitem]").click(function() { + numchecked = 0; + $("input[name=checkitem]").each(function() { + if(this.checked){ + numchecked++; + } + }); + if(numchecked > 0){ $("#requestany").removeAttr("checked"); - } else { - $("#requestany").attr("checked","checked"); - } - }); + } else { + $("#requestany").attr("checked","checked"); + } + + if (remainingHolds - numchecked < 0) { + alert(MSG_EXCEEDED_HOLDS_PER_RECORD); + } + }); $(".clear-date").on("click",function(e){ e.preventDefault(); @@ -512,9 +518,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 516ada5..5246321 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt @@ -124,20 +124,18 @@
- -
[% FOREACH bibitemloo IN bibitemloop %]
+

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

  • [% UNLESS ( bibitemloo.holdable ) %] - [% FOREACH branchloo IN bibitemloo.branchloop %] [% IF ( branchloo.selected ) %] @@ -214,7 +212,7 @@ [% END %] [% ELSE %] - [% FOREACH branchloo IN bibitemloo.branchloop %] [% IF ( branchloo.selected ) %] @@ -261,10 +259,8 @@
  • - [% IF bibitemloo.itemholdable %] - [% END # / IF bibitemloo.itemholdable %] - [% IF bibitemloo.itemholdable %] + [% IF bibitemloo.remaining_holds_for_record > 1 %] + [% SET count = 1 %] +
    + + +
    + [% ELSE %] + + [% END %] + @@ -307,9 +315,9 @@ [% END # / FOREACH itemLoo IN bibitemloo.itemLoop%]
    Select a specific item:
    [% IF ( itemLoo.available ) %] - + [% ELSE %] - Cannot be put on hold [% END %] @@ -383,7 +391,6 @@
    - [% END # / IF ( bibitemloo.itemholdable )%]
    [% END # / IF ( bibitemloo.holdable ) %] @@ -406,6 +413,7 @@