From c060a075ece487ceb69e41fa8e8b60449c092df6 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. --- .../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 94bc33e581..de0d9d0b47 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt @@ -158,6 +158,16 @@ [% END %]
+
+
+
    +
  • + + +
  • +
+
+
diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl index 0e0c13d8e7..0c1edf2e5b 100755 --- a/opac/opac-reserve.pl +++ b/opac/opac-reserve.pl @@ -195,6 +195,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_grouped; @@ -239,6 +240,7 @@ if ( $query->param('place_reserve') ) { } my $failed_holds = 0; + my $hold_group; while (@selectedItems) { my $biblioNum = shift(@selectedItems); my $itemNum = shift(@selectedItems); @@ -322,6 +324,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, @@ -335,6 +343,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.20.1