From 363e675c9d9231ee95a51f2f90a3d89b97e25f78 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. --- 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 edc33ccf73..9929b76bd1 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 5e18b05988..ea5d639aa8 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); @@ -307,6 +309,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, @@ -320,6 +328,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