From a2d728223fc6c983cdb2dd3892395ed365153a77 Mon Sep 17 00:00:00 2001 From: David Cook Date: Fri, 18 Jun 2021 06:08:00 +0000 Subject: [PATCH] Bug 15565: Allow multiple hold for multiple bib in OPAC This patch allows an OPAC user to select multiple item holds from multiple bibs when placing holds/reserves from the OPAC search result page. --- .../bootstrap/en/modules/opac-reserve.tt | 27 ++++++++++++++----- 1 file changed, 20 insertions(+), 7 deletions(-) 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 4512db0337..94bc33e581 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt @@ -649,7 +649,10 @@ $(".confirmjs:checked").each(function() { var biblioNum = $(this).val(); biblionumbers += biblioNum + "/"; - selections += biblioNum + "/"; + + var select_bib = biblioNum; + var select_pickup; + var select_items = [] // If required hold note is empty, make it visible if( $("#holdnotes_"+biblioNum).attr( 'required' ) && $("#holdnotes_"+biblioNum).val() == '' ) { @@ -661,23 +664,33 @@ // If the 'specific copy' radio button is checked if ($("#reqspecific_" + biblioNum + ":checked").size() > 0) { // Find the selected copy - var item = $(".checkitem_" + biblioNum + ":checked"); - if ($(item).size() == 0) { + var items = $(".checkitem_" + biblioNum + ":checked"); + if ($(items).size() == 0) { alert(MSG_NO_ITEM_SELECTED); badBib = biblioNum; return false; } else { - selections += $(item).val(); + items.each( function(index,el){ + select_items.push( $(el).val() ); + }); } } - selections += "/"; // Add the pickup location var branchSel = $("#branch_" + biblioNum); if (branchSel.size() > 0) { - selections += $(branchSel).val(); + select_pickup = $(branchSel).val(); + } + + if ( select_items.length > 0 ){ + select_items.forEach( function(item_value,index){ + selections += select_bib + "/" + item_value + "/" + select_pickup + "/"; + }); } - selections += "/"; + else { + selections += select_bib + "/" + "/" + select_pickup + "/"; + } + return true; }); -- 2.20.1