View | Details | Raw Unified | Return to bug 15565
Collapse All | Expand All

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt (-3 / +5 lines)
Lines 146-151 Link Here
146
                        <form action="/cgi-bin/koha/opac-reserve.pl" method="post" id="hold-request-form">
146
                        <form action="/cgi-bin/koha/opac-reserve.pl" method="post" id="hold-request-form">
147
                            <input type="hidden" name="place_reserve" value="1"/>
147
                            <input type="hidden" name="place_reserve" value="1"/>
148
                            <!-- These values are set dynamically by js -->
148
                            <!-- These values are set dynamically by js -->
149
                            <input type="hidden" name="biblionumbers" id="biblionumbers"/>
149
                            <div id="bigloop">
150
                            <div id="bigloop">
150
151
151
                                [% FOREACH bibitemloo IN bibitemloop %]
152
                                [% FOREACH bibitemloo IN bibitemloop %]
Lines 614-620 Link Here
614
                    total += parseInt($("input[name='checkitem_'"+biblioNum+"]:checked").length);
615
                    total += parseInt($("input[name='checkitem_'"+biblioNum+"]:checked").length);
615
                    total -= 2;
616
                    total -= 2;
616
                } else {
617
                } else {
617
                    total += parseInt($("select[name='holds_to_place_count_"+biblioNum+"']").val());
618
                    total += parseInt($("input[name='holds_to_place_count_"+biblioNum+"']").val());
618
                }
619
                }
619
            });
620
            });
620
            return total;
621
            return total;
Lines 655-660 Link Here
655
656
656
        // When 'Place Hold' button is clicked
657
        // When 'Place Hold' button is clicked
657
        $(".placehold").click(function(){
658
        $(".placehold").click(function(){
659
            var biblionumbers = "";
658
            if (total_requested() + [% reserves_count | html %] > [% maxreserves | html %]) {
660
            if (total_requested() + [% reserves_count | html %] > [% maxreserves | html %]) {
659
                alert(MSG_MAX_HOLDS_EXCEEDED);
661
                alert(MSG_MAX_HOLDS_EXCEEDED);
660
                return false;
662
                return false;
Lines 669-675 Link Here
669
            var badBib = null;
671
            var badBib = null;
670
            $("input[name='biblionumbers']:checked").each(function() {
672
            $("input[name='biblionumbers']:checked").each(function() {
671
                var biblioNum = $(this).val();
673
                var biblioNum = $(this).val();
672
674
                biblionumbers += biblioNum + "/";
673
                // If required hold note is empty, make it visible
675
                // If required hold note is empty, make it visible
674
                if( $("#holdnotes_"+biblioNum).attr( 'required' ) && $("#holdnotes_"+biblioNum).val() == '' ) {
676
                if( $("#holdnotes_"+biblioNum).attr( 'required' ) && $("#holdnotes_"+biblioNum).val() == '' ) {
675
                    if( !$("#hold-options-"+biblioNum).is(':visible')) {
677
                    if( !$("#hold-options-"+biblioNum).is(':visible')) {
Lines 693-699 Link Here
693
            if (badBib) { // alert has been raised already
695
            if (badBib) { // alert has been raised already
694
                return false;
696
                return false;
695
            }
697
            }
696
698
            $("#biblionumbers").val(biblionumbers);
697
            return true;
699
            return true;
698
        });
700
        });
699
701
(-)a/opac/opac-reserve.pl (-5 / +17 lines)
Lines 112-118 my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_l Link Here
112
112
113
# Coming from opac-search biblionumbers param is a string, coming from
113
# Coming from opac-search biblionumbers param is a string, coming from
114
# opac-reserve, it's an array.
114
# opac-reserve, it's an array.
115
my @biblionumbers = ref($query->param('biblionumbers')) eq 'Array'
115
116
my @biblionumbers = ref($query->multi_param('biblionumbers')) eq 'Array'
116
    ? $query->param('biblionumbers')
117
    ? $query->param('biblionumbers')
117
    : split(/\//, $query->param('biblionumbers'));
118
    : split(/\//, $query->param('biblionumbers'));
118
119
Lines 120-125 unless (@biblionumbers) { Link Here
120
    push(@biblionumbers, $query->multi_param('biblionumber'));
121
    push(@biblionumbers, $query->multi_param('biblionumber'));
121
}
122
}
122
123
124
my $multiBibHolds;
125
if (scalar(@biblionumbers) > 1) {
126
    $multiBibHolds = 1;
127
}
128
123
# Pass the numbers to the page so they can be fed back
129
# Pass the numbers to the page so they can be fed back
124
# when the hold is confirmed. TODO: Not necessary?
130
# when the hold is confirmed. TODO: Not necessary?
125
$template->param( biblionumbers => @biblionumbers );
131
$template->param( biblionumbers => @biblionumbers );
Lines 137-142 $template->param( branch => $branch ); Link Here
137
143
138
my %biblioDataHash; # Hash of biblionumber to biblio/biblioitems record.
144
my %biblioDataHash; # Hash of biblionumber to biblio/biblioitems record.
139
my %itemInfoHash; # Hash of itemnumber to item info.
145
my %itemInfoHash; # Hash of itemnumber to item info.
146
140
foreach my $biblioNumber (@biblionumbers) {
147
foreach my $biblioNumber (@biblionumbers) {
141
148
142
    my $biblioData = GetBiblioData($biblioNumber);
149
    my $biblioData = GetBiblioData($biblioNumber);
Lines 159-165 foreach my $biblioNumber (@biblionumbers) { Link Here
159
    foreach my $itemInfo (@itemInfos) {
166
    foreach my $itemInfo (@itemInfos) {
160
        $itemInfoHash{$itemInfo->{itemnumber}} = $itemInfo;
167
        $itemInfoHash{$itemInfo->{itemnumber}} = $itemInfo;
161
    }
168
    }
162
163
    # Compute the priority rank.
169
    # Compute the priority rank.
164
    my $biblio = Koha::Biblios->find( $biblioNumber );
170
    my $biblio = Koha::Biblios->find( $biblioNumber );
165
    my $holds = $biblio->holds;
171
    my $holds = $biblio->holds;
Lines 190-200 if ( $query->param('place_reserve') ) { Link Here
190
    }
196
    }
191
197
192
    my $failed_holds = 0;
198
    my $failed_holds = 0;
199
193
    foreach my $biblioNum (@biblionumbers) {
200
    foreach my $biblioNum (@biblionumbers) {
194
        my $itemNum = $query->param("checkitem_$biblioNum");
201
        my $itemNum = $query->param("checkitem_$biblioNum");
195
        my @itemnumbers = $query->param("checkitem_$biblioNum");
202
        my @itemnumbers = $query->param("checkitem_$biblioNum");
196
        my $branch = $query->param("branch");
203
        my $branch = $query->param("branch");
197
        my $reqtype = $query->param("reqtype_$biblioNum");
204
        my $reqtype = $query->param("reqtype_$biblioNum");
205
198
        if (!$reqtype) {
206
        if (!$reqtype) {
199
            #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.
207
            #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.
200
            # Determine what the forced_hold_level is.
208
            # Determine what the forced_hold_level is.
Lines 283-290 if ( $query->param('place_reserve') ) { Link Here
283
                    ++$reserve_cnt;
291
                    ++$reserve_cnt;
284
                }
292
                }
285
            }
293
            }
286
            print $query->redirect("/cgi-bin/koha/opac-user.pl?" . ( $failed_holds ? "failed_holds=$failed_holds" : q|| ) . "#opac-user-holds");
294
287
            exit;
295
            # $multiBibHolds indicates if holds on multiple biblio records has been placed
296
            # If not set then can exit and re-direct out of loop otherwise loop through other biblionumbers in @biblionumbers
297
            if (!$multiBibHolds) {
298
                print $query->redirect("/cgi-bin/koha/opac-user.pl?" . ( $failed_holds ? "failed_holds=$failed_holds" : q|| ) . "#opac-user-holds");
299
                exit;
300
            }
288
        }
301
        }
289
        $canreserve = 0 unless CanBookBeReserved( $borrowernumber, $biblioNum )->{status} eq 'OK';
302
        $canreserve = 0 unless CanBookBeReserved( $borrowernumber, $biblioNum )->{status} eq 'OK';
290
        unless ( $can_place_hold_if_available_at_pickup ) {
303
        unless ( $can_place_hold_if_available_at_pickup ) {
291
- 

Return to bug 15565