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

(-)a/C4/HoldsQueue.pm (-19 / +18 lines)
Lines 585-608 sub MapItemsToHoldRequests { Link Here
585
            } else {
585
            } else {
586
                $pull_branches = [keys %items_by_branch];
586
                $pull_branches = [keys %items_by_branch];
587
            }
587
            }
588
            $holdingbranch ||= $pull_branches->[0];    # We set this as the first from the list of pull branches
589
                 # unless we set it above to the pickupbranch or the least cost branch
590
                 # FIXME: The itention is to follow StaticHoldsQueueWeight, but we don't check that pref
588
591
589
            # Try picking items where the home and pickup branch match first
592
            # Try picking items where the home and pickup branch match first
590
            PULL_BRANCHES:
591
            foreach my $branch (@$pull_branches) {
593
            foreach my $branch (@$pull_branches) {
592
                my $holding_branch_items = $items_by_branch{$branch}
594
                my $holding_branch_items = $items_by_branch{$branch}
593
                  or next;
595
                    or next;
594
596
595
                $holdingbranch ||= $branch; # We set this as the first from the list of pull branches
596
                # unless we set it above to the pickupbranch or the least cost branch
597
                # FIXME: The itention is to follow StaticHoldsQueueWeight, but we don't check that pref
598
                foreach my $item (@$holding_branch_items) {
597
                foreach my $item (@$holding_branch_items) {
599
                    next if $pickup_branch ne $item->{homebranch};
598
                    if ( $pickup_branch eq $item->{homebranch}
600
                    next unless _can_item_fill_request( $item, $request, $libraries );
599
                        && _can_item_fill_request( $item, $request, $libraries ) )
601
600
                    {
602
                    $itemnumber = $item->{itemnumber};
601
                        $itemnumber    = $item->{itemnumber};
603
                    $holdingbranch = $branch;
602
                        $holdingbranch = $branch;
604
                    last PULL_BRANCHES;
603
                        last;
604
                    }
605
                }
605
                }
606
                last if $itemnumber;
606
            }
607
            }
607
608
608
            # Now try items from the least cost branch based on the transport cost matrix or StaticHoldsQueueWeight
609
            # Now try items from the least cost branch based on the transport cost matrix or StaticHoldsQueueWeight
Lines 617-635 sub MapItemsToHoldRequests { Link Here
617
618
618
            # Now try for items for any item that can fill this hold
619
            # Now try for items for any item that can fill this hold
619
            unless ( $itemnumber ) {
620
            unless ( $itemnumber ) {
620
                PULL_BRANCHES2:
621
                foreach my $branch (@$pull_branches) {
621
                foreach my $branch (@$pull_branches) {
622
                    my $holding_branch_items = $items_by_branch{$branch}
622
                    my $holding_branch_items = $items_by_branch{$branch}
623
                      or next;
623
                      or next;
624
624
625
                    foreach my $item (@$holding_branch_items) {
625
                    foreach my $item (@$holding_branch_items) {
626
626
                        if( _can_item_fill_request( $item, $request, $libraries ) ){
627
                        next unless _can_item_fill_request( $item, $request, $libraries );
627
                            $itemnumber = $item->{itemnumber};
628
628
                            $holdingbranch = $branch;
629
                        $itemnumber = $item->{itemnumber};
629
                            last;
630
                        $holdingbranch = $branch;
630
                        }
631
                        last PULL_BRANCHES2;
632
                    }
631
                    }
632
                    last if $itemnumber;
633
                }
633
                }
634
            }
634
            }
635
        }
635
        }
636
- 

Return to bug 35432