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

(-)a/opac/opac-reserve.pl (-4 / +25 lines)
Lines 44-49 use Koha::Libraries; Link Here
44
use Koha::Patrons;
44
use Koha::Patrons;
45
use Date::Calc qw/Today Date_to_Days/;
45
use Date::Calc qw/Today Date_to_Days/;
46
use List::MoreUtils qw/uniq/;
46
use List::MoreUtils qw/uniq/;
47
use Data::Dumper;
47
48
48
my $maxreserves = C4::Context->preference("maxreserves");
49
my $maxreserves = C4::Context->preference("maxreserves");
49
50
Lines 192-197 if ( $query->param('place_reserve') ) { Link Here
192
        my @itemnumbers = $query->param("checkitem_$biblioNum");
193
        my @itemnumbers = $query->param("checkitem_$biblioNum");
193
        my $branch = $query->param("branch_$biblioNum");
194
        my $branch = $query->param("branch_$biblioNum");
194
        my $reqtype = $query->param("reqtype_$biblioNum");
195
        my $reqtype = $query->param("reqtype_$biblioNum");
196
        warn $biblioNum;
197
        if (!$reqtype) {
198
            #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.
199
            # Determine what the forced_hold_level is.
200
            my $holds = Koha::Holds->search(
201
                {
202
                     borrowernumber => $borrowernumber,
203
                     biblionumber   => $biblioNum,
204
                     found          => undef,
205
                }
206
            );
207
            my $forced_hold_level = $holds->forced_hold_level();
208
            if ($forced_hold_level eq "item") {
209
                $reqtype = "Specific";
210
            } elsif ($forced_hold_level eq "record") {
211
                $reqtype = "Any";
212
            }
213
        }
195
        my $holds_to_place_count = $query->param("holds_to_place_count_$biblioNum") || 1;
214
        my $holds_to_place_count = $query->param("holds_to_place_count_$biblioNum") || 1;
196
        my $notes = $query->param('notes_'.$biblioNum) || '';
215
        my $notes = $query->param('notes_'.$biblioNum) || '';
197
        my $nbRequested = $reqtype eq 'Specific' ? @itemnumbers : $holds_to_place_count;
216
        my $nbRequested = $reqtype eq 'Specific' ? @itemnumbers : $holds_to_place_count;
Lines 257-272 if ( $query->param('place_reserve') ) { Link Here
257
                if ( $hostbiblioNum ne $biblioNum ) {
276
                if ( $hostbiblioNum ne $biblioNum ) {
258
                    $biblionumber = $hostbiblioNum;
277
                    $biblionumber = $hostbiblioNum;
259
                }
278
                }
260
279
                my $reservestatus = CanItemBeReserved( $borrowernumber, $itemnumber);
261
                $canreserve = 0 unless CanItemBeReserved( $borrowernumber, $itemnumber ) eq 'OK';
280
                $canreserve = 0 if !($reservestatus->{status} eq 'OK');
262
                $rank = '0' unless C4::Context->preference('ReservesNeedReturns');
281
                $rank = '0' unless C4::Context->preference('ReservesNeedReturns');
263
                my $item = GetItem($itemnumber);
282
                my $item = GetItem($itemnumber);
264
                if ( $item->{'holdingbranch'} eq $branch ) {
283
                if ( $item->{'holdingbranch'} eq $branch ) {
265
                    $found = 'W'
284
                    $found = 'W'
266
                      unless C4::Context->preference('ReservesNeedReturns');
285
                      unless C4::Context->preference('ReservesNeedReturns');
267
                }
286
                }
268
287
                warn $itemnumber;
288
                warn $canreserve;
269
                if ($canreserve) {
289
                if ($canreserve) {
290
                    warn $canreserve;
270
                    my $reserve_id = AddReserve(
291
                    my $reserve_id = AddReserve(
271
                        $branch,         $borrowernumber,
292
                        $branch,         $borrowernumber,
272
                        $biblionumber,
293
                        $biblionumber,
Lines 620-625 foreach my $biblioNum (@biblionumbers) { Link Here
620
        }
641
        }
621
    );
642
    );
622
    my $forced_hold_level = $holds->forced_hold_level();
643
    my $forced_hold_level = $holds->forced_hold_level();
644
    warn $forced_hold_level;
623
    if ($forced_hold_level) {
645
    if ($forced_hold_level) {
624
        #$biblioLoopIter{force_hold}   = 1 if $forced_hold_level eq 'item';
646
        #$biblioLoopIter{force_hold}   = 1 if $forced_hold_level eq 'item';
625
        #$biblioLoopIter{itemholdable} = 0 if $forced_hold_level eq 'record';
647
        #$biblioLoopIter{itemholdable} = 0 if $forced_hold_level eq 'record';
626
- 

Return to bug 15565