From cf969a96a63510cbf3d133b36c8500636a1ce7ba Mon Sep 17 00:00:00 2001 From: David Cook Date: Fri, 18 Jun 2021 07:32:25 +0000 Subject: [PATCH] Bug 15516: Add ability to create hold groups from OPAC This patch adds a "Treat as hold group" to opac-reserve.pl, which lets OPAC users create a hold group which can include 1+ bibs and either bib-level holds, or item-level holds, or both. Signed-off-by: Michal Denar --- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt | 10 ++++++++++ opac/opac-reserve.pl | 9 +++++++++ 2 files changed, 19 insertions(+) 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 e16095740e..9a12be1170 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt @@ -159,6 +159,16 @@
Hold requests +
+
+
    +
  • + + +
  • +
+
+
diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl index 68f8026873..6e6bfdff6b 100755 --- a/opac/opac-reserve.pl +++ b/opac/opac-reserve.pl @@ -191,6 +191,7 @@ foreach my $biblioNumber (@biblionumbers) { # # if ( $query->param('place_reserve') ) { + my $add_to_hold_group = $query->param('add_to_hold_group'); my $reserve_cnt = 0; if ($maxreserves) { $reserve_cnt = $patron->holds->count_holds; @@ -224,6 +225,7 @@ if ( $query->param('place_reserve') ) { } my $failed_holds = 0; + my $hold_group; while (@selectedItems) { my $biblioNum = shift(@selectedItems); my $itemNum = shift(@selectedItems); @@ -308,6 +310,12 @@ if ( $query->param('place_reserve') ) { # Here we actually do the reserveration. Stage 3. if ($canreserve) { + if ($add_to_hold_group){ + #NOTE: We wait to create a hold group until we know that we can actually place a hold/reserve + if ( ! $hold_group ){ + $hold_group = Koha::HoldGroup->new->store; + } + } my $reserve_id = AddReserve( { branchcode => $branch, @@ -321,6 +329,7 @@ if ( $query->param('place_reserve') ) { itemnumber => $itemNum, found => $found, itemtype => $itemtype, + hold_group_id => $hold_group ? $hold_group->id : undef, } ); $failed_holds++ unless $reserve_id; -- 2.11.0