@@ -, +, @@ opac-search.pl --- .../opac-tmpl/bootstrap/en/modules/opac-reserve.tt | 8 +++++--- opac/opac-reserve.pl | 21 +++++++++++++++++---- 2 files changed, 22 insertions(+), 7 deletions(-) --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt +++ a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt @@ -146,6 +146,7 @@
+
[% FOREACH bibitemloo IN bibitemloop %] @@ -614,7 +615,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; @@ -655,6 +656,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; @@ -669,7 +671,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() == '' ) { if( !$("#hold-options-"+biblioNum).is(':visible')) { @@ -693,7 +695,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 @@ -112,7 +112,8 @@ 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')); @@ -120,6 +121,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 ); @@ -137,6 +143,7 @@ $template->param( branch => $branch ); my %biblioDataHash; # Hash of biblionumber to biblio/biblioitems record. my %itemInfoHash; # Hash of itemnumber to item info. + foreach my $biblioNumber (@biblionumbers) { my $biblioData = GetBiblioData($biblioNumber); @@ -159,7 +166,6 @@ foreach my $biblioNumber (@biblionumbers) { foreach my $itemInfo (@itemInfos) { $itemInfoHash{$itemInfo->{itemnumber}} = $itemInfo; } - # Compute the priority rank. my $biblio = Koha::Biblios->find( $biblioNumber ); my $holds = $biblio->holds; @@ -190,11 +196,13 @@ if ( $query->param('place_reserve') ) { } my $failed_holds = 0; + foreach my $biblioNum (@biblionumbers) { my $itemNum = $query->param("checkitem_$biblioNum"); my @itemnumbers = $query->param("checkitem_$biblioNum"); my $branch = $query->param("branch"); my $reqtype = $query->param("reqtype_$biblioNum"); + if (!$reqtype) { #If no $reqtype value has been passed from the form this means both reqany and reqspecific radio buttons are disabled because a hold has been placed on this biblio previously and so a forced_hold_level exists. # Determine what the forced_hold_level is. @@ -283,8 +291,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'; unless ( $can_place_hold_if_available_at_pickup ) { --