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

(-)a/C4/HoldsQueue.pm (-1 / +21 lines)
Lines 458-463 sub MapItemsToHoldRequests { Link Here
458
            } else {
458
            } else {
459
                $pull_branches = [keys %items_by_branch];
459
                $pull_branches = [keys %items_by_branch];
460
            }
460
            }
461
462
            # Try picking items where the home and pickup branch match first
461
            PULL_BRANCHES:
463
            PULL_BRANCHES:
462
            foreach my $branch (@$pull_branches) {
464
            foreach my $branch (@$pull_branches) {
463
                my $holding_branch_items = $items_by_branch{$branch}
465
                my $holding_branch_items = $items_by_branch{$branch}
Lines 474-479 sub MapItemsToHoldRequests { Link Here
474
                }
476
                }
475
            }
477
            }
476
478
479
            # Now try items from the least cost branch based on the transport cost matrix or StaticHoldsQueueWeight
477
            unless ( $itemnumber ) {
480
            unless ( $itemnumber ) {
478
                foreach my $current_item ( @{ $items_by_branch{$holdingbranch} } ) {
481
                foreach my $current_item ( @{ $items_by_branch{$holdingbranch} } ) {
479
                    if ( $holdingbranch && ( $current_item->{holdallowed} == 2 || $request->{borrowerbranch} eq $current_item->{homebranch} ) ) {
482
                    if ( $holdingbranch && ( $current_item->{holdallowed} == 2 || $request->{borrowerbranch} eq $current_item->{homebranch} ) ) {
Lines 482-487 sub MapItemsToHoldRequests { Link Here
482
                    }
485
                    }
483
                }
486
                }
484
            }
487
            }
488
489
            # Now try for items for any item that can fill this hold
490
            unless ( $itemnumber ) {
491
                PULL_BRANCHES2:
492
                foreach my $branch (@$pull_branches) {
493
                    my $holding_branch_items = $items_by_branch{$branch}
494
                      or next;
495
496
                    $holdingbranch ||= $branch;
497
                    foreach my $item (@$holding_branch_items) {
498
                        next if ( $item->{holdallowed} == 1 && $item->{homebranch} ne $request->{borrowerbranch} );
499
500
                        $itemnumber = $item->{itemnumber};
501
                        $holdingbranch = $branch;
502
                        last PULL_BRANCHES2;
503
                    }
504
                }
505
            }
485
        }
506
        }
486
507
487
        if ($itemnumber) {
508
        if ($itemnumber) {
488
- 

Return to bug 14297