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

(-)a/C4/HoldsQueue.pm (-13 / +22 lines)
Lines 434-455 sub MapItemsToHoldRequests { Link Here
434
        my $LocalHoldsPriorityItemControl =
434
        my $LocalHoldsPriorityItemControl =
435
          C4::Context->preference('LocalHoldsPriorityItemControl');
435
          C4::Context->preference('LocalHoldsPriorityItemControl');
436
436
437
    REQUEST:
437
        foreach my $request (@$hold_requests) {
438
        foreach my $request (@$hold_requests) {
439
            my $patron;
438
            last if $num_items_remaining == 0;
440
            last if $num_items_remaining == 0;
439
            my $patron = Koha::Patrons->find($request->{borrowernumber});
440
            next if $patron->category->exclude_from_local_holds_priority;
441
442
            my $local_hold_match;
441
            my $local_hold_match;
443
            foreach my $item (@$available_items) {
442
            foreach my $item (@$available_items) {
444
                next if $item->{_object}->exclude_from_local_holds_priority;
445
446
                next unless _checkHoldPolicy($item, $request);
447
448
                next if $request->{itemnumber} && $request->{itemnumber} != $item->{itemnumber};
449
450
                next if $request->{item_group_id} && $item->{_object}->item_group && $item->{_object}->item_group->id ne $request->{item_group_id};
451
452
                next unless $item->{_object}->can_be_transferred( { to => $libraries->{ $request->{branchcode} } } );
453
443
454
                my $local_holds_priority_item_branchcode =
444
                my $local_holds_priority_item_branchcode =
455
                  $item->{$LocalHoldsPriorityItemControl};
445
                  $item->{$LocalHoldsPriorityItemControl};
Lines 466-471 sub MapItemsToHoldRequests { Link Here
466
                  $local_holds_priority_patron_branchcode;
456
                  $local_holds_priority_patron_branchcode;
467
457
468
                if ($local_hold_match) {
458
                if ($local_hold_match) {
459
                    next if $item->{_object}->exclude_from_local_holds_priority;
460
461
                    if ( !defined $patron ) {
462
                        $patron = Koha::Patrons->find( $request->{borrowernumber} );
463
464
                        next REQUEST if $patron->category->exclude_from_local_holds_priority;
465
                    }
466
467
                    next unless _checkHoldPolicy( $item, $request );
468
469
                    next if $request->{itemnumber} && $request->{itemnumber} != $item->{itemnumber};
470
471
                    next
472
                        if $request->{item_group_id}
473
                        && $item->{_object}->item_group
474
                        && $item->{_object}->item_group->id ne $request->{item_group_id};
475
476
                    next
477
                        unless $item->{_object}->can_be_transferred( { to => $libraries->{ $request->{branchcode} } } );
478
469
                    if ( exists $items_by_itemnumber{ $item->{itemnumber} }
479
                    if ( exists $items_by_itemnumber{ $item->{itemnumber} }
470
                        and not exists $allocated_items{ $item->{itemnumber} }
480
                        and not exists $allocated_items{ $item->{itemnumber} }
471
                        and not $request->{allocated})
481
                        and not $request->{allocated})
472
- 

Return to bug 35899