@@ -, +, @@ opac-search.pl --- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt | 6 +++++- opac/opac-reserve.pl | 16 +++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt +++ a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt @@ -151,6 +151,7 @@
+
[% FOREACH bibitemloo IN bibitemloop %] @@ -616,7 +617,7 @@ total += parseInt($("input[name='checkitem_'"+biblioNum+"]:checked").length); total -= 2; } else { - total += parseInt($("select[name='holds_to_place_count_"+biblioNum+"']").val()); + total += parseInt($("input[name='holds_to_place_count_"+biblioNum+"']").val()); } }); return total; @@ -657,6 +658,7 @@ // When 'Place Hold' button is clicked $(".placehold").click(function(){ + var biblionumbers = ""; if (total_requested() + [% reserves_count | html %] > [% maxreserves | html %]) { alert(MSG_MAX_HOLDS_EXCEEDED); return false; @@ -671,6 +673,7 @@ var badBib = null; $("input[name='biblionumbers']:checked").each(function() { var biblioNum = $(this).val(); + biblionumbers += biblioNum + "/"; // If required hold note is empty, make it visible if( $("#holdnotes_"+biblioNum).attr( 'required' ) && $("#holdnotes_"+biblioNum).val() == '' ) { @@ -695,6 +698,7 @@ if (badBib) { // alert has been raised already return false; } + $("#biblionumbers").val(biblionumbers); return true; }); --- a/opac/opac-reserve.pl +++ a/opac/opac-reserve.pl @@ -111,7 +111,7 @@ my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_l # Coming from opac-search biblionumbers param is a string, coming from # opac-reserve, it's an array. -my @biblionumbers = ref($query->param('biblionumbers')) eq 'Array' +my @biblionumbers = ref($query->multi_param('biblionumbers')) eq 'Array' ? $query->param('biblionumbers') : split(/\//, $query->param('biblionumbers')); @@ -119,6 +119,11 @@ unless (@biblionumbers) { push(@biblionumbers, $query->multi_param('biblionumber')); } +my $multiBibHolds; +if ( scalar( @biblionumbers ) > 1 ){ + $multiBibHolds = 1; +} + # Pass the numbers to the page so they can be fed back # when the hold is confirmed. TODO: Not necessary? $template->param( biblionumbers => @biblionumbers ); @@ -283,8 +288,13 @@ if ( $query->param('place_reserve') ) { ++$reserve_cnt; } } - print $query->redirect("/cgi-bin/koha/opac-user.pl?" . ( $failed_holds ? "failed_holds=$failed_holds" : q|| ) . "#opac-user-holds"); - exit; + + # $multiBibHolds indicates if holds on multiple biblio records has been placed + # If not set then can exit and re-direct out of loop otherwise loop through other biblionumbers in @biblionumbers + if (!$multiBibHolds) { + print $query->redirect("/cgi-bin/koha/opac-user.pl?" . ( $failed_holds ? "failed_holds=$failed_holds" : q|| ) . "#opac-user-holds"); + exit; + } } $canreserve = 0 unless CanBookBeReserved( $borrowernumber, $biblioNum )->{status} eq 'OK'; --