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 196-201 if ( $query->param('place_reserve') ) { Link Here
196
        my @itemnumbers = $query->param("checkitem_$biblioNum");
197
        my @itemnumbers = $query->param("checkitem_$biblioNum");
197
        my $branch = $query->param("branch_$biblioNum");
198
        my $branch = $query->param("branch_$biblioNum");
198
        my $reqtype = $query->param("reqtype_$biblioNum");
199
        my $reqtype = $query->param("reqtype_$biblioNum");
200
        warn $biblioNum;
201
        if (!$reqtype) {
202
            #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.
203
            # Determine what the forced_hold_level is.
204
            my $holds = Koha::Holds->search(
205
                {
206
                     borrowernumber => $borrowernumber,
207
                     biblionumber   => $biblioNum,
208
                     found          => undef,
209
                }
210
            );
211
            my $forced_hold_level = $holds->forced_hold_level();
212
            if ($forced_hold_level eq "item") {
213
                $reqtype = "Specific";
214
            } elsif ($forced_hold_level eq "record") {
215
                $reqtype = "Any";
216
            }
217
        }
199
        my $holds_to_place_count = $query->param("holds_to_place_count_$biblioNum") || 1;
218
        my $holds_to_place_count = $query->param("holds_to_place_count_$biblioNum") || 1;
200
        my $notes = $query->param('notes_'.$biblioNum) || '';
219
        my $notes = $query->param('notes_'.$biblioNum) || '';
201
        my $nbRequested = $reqtype eq 'Specific' ? @itemnumbers : $holds_to_place_count;
220
        my $nbRequested = $reqtype eq 'Specific' ? @itemnumbers : $holds_to_place_count;
Lines 246-261 if ( $query->param('place_reserve') ) { Link Here
246
                if ( $hostbiblioNum ne $biblioNum ) {
265
                if ( $hostbiblioNum ne $biblioNum ) {
247
                    $biblionumber = $hostbiblioNum;
266
                    $biblionumber = $hostbiblioNum;
248
                }
267
                }
249
268
                my $reservestatus = CanItemBeReserved( $borrowernumber, $itemnumber);
250
                $canreserve = 0 unless CanItemBeReserved( $borrowernumber, $itemnumber ) eq 'OK';
269
                $canreserve = 0 if !($reservestatus->{status} eq 'OK');
251
                $rank = '0' unless C4::Context->preference('ReservesNeedReturns');
270
                $rank = '0' unless C4::Context->preference('ReservesNeedReturns');
252
                my $item = GetItem($itemnumber);
271
                my $item = GetItem($itemnumber);
253
                if ( $item->{'holdingbranch'} eq $branch ) {
272
                if ( $item->{'holdingbranch'} eq $branch ) {
254
                    $found = 'W'
273
                    $found = 'W'
255
                      unless C4::Context->preference('ReservesNeedReturns');
274
                      unless C4::Context->preference('ReservesNeedReturns');
256
                }
275
                }
257
276
                warn $itemnumber;
277
                warn $canreserve;
258
                if ($canreserve) {
278
                if ($canreserve) {
279
                    warn $canreserve;
259
                    my $reserve_id = AddReserve(
280
                    my $reserve_id = AddReserve(
260
                        $branch,         $borrowernumber,
281
                        $branch,         $borrowernumber,
261
                        $biblionumber,
282
                        $biblionumber,
Lines 594-599 foreach my $biblioNum (@biblionumbers) { Link Here
594
        }
615
        }
595
    );
616
    );
596
    my $forced_hold_level = $holds->forced_hold_level();
617
    my $forced_hold_level = $holds->forced_hold_level();
618
    warn $forced_hold_level;
597
    if ($forced_hold_level) {
619
    if ($forced_hold_level) {
598
        #$biblioLoopIter{force_hold}   = 1 if $forced_hold_level eq 'item';
620
        #$biblioLoopIter{force_hold}   = 1 if $forced_hold_level eq 'item';
599
        #$biblioLoopIter{itemholdable} = 0 if $forced_hold_level eq 'record';
621
        #$biblioLoopIter{itemholdable} = 0 if $forced_hold_level eq 'record';
600
- 

Return to bug 15565