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

(-)a/C4/HoldsQueue.pm (-5 / +18 lines)
Lines 406-411 sub _checkHoldPolicy { Link Here
406
  Returns a hash of hashes with itemnumbers as keys, each itemnumber containing a hash with the information
406
  Returns a hash of hashes with itemnumbers as keys, each itemnumber containing a hash with the information
407
  about the hold it has been mapped to.
407
  about the hold it has been mapped to.
408
408
409
  This routine attempts to match the holds in the following priority
410
  1 - If local holds priority is enabled we check all requests to see if local matches can be found
411
  2 - We check for item level matches and fill those
412
  3 - We now loop the remaining requests in priority order attempting to fill with
413
      a - Items where HoldsQueuePrioritizeBranch matches either from items held at the pickup branch, or at the least cost branch (if Transport Cost Matrix is being used)
414
      b - Items where the homebranch of the item and the pickup library match
415
      c - Items from the least cost branch (or items at the pickup location if available)
416
      d - Any item that can fill the hold
417
409
=cut
418
=cut
410
419
411
sub MapItemsToHoldRequests {
420
sub MapItemsToHoldRequests {
Lines 495-500 sub MapItemsToHoldRequests { Link Here
495
        }
504
        }
496
    }
505
    }
497
506
507
    # Handle item level requests
508
    # Note that we loop the requests in priority order reserving an item for each title level hold
509
    # So we will only fill item level requests if there are enough items to fill higher priority
510
    # title level holds.
498
    foreach my $request (@$hold_requests) {
511
    foreach my $request (@$hold_requests) {
499
        last if $num_items_remaining == 0;
512
        last if $num_items_remaining == 0;
500
        next if $request->{allocated};
513
        next if $request->{allocated};
Lines 557-567 sub MapItemsToHoldRequests { Link Here
557
        if ($holding_branch_items) {
570
        if ($holding_branch_items) {
558
            $holdingbranch = $pickup_branch;
571
            $holdingbranch = $pickup_branch;
559
        } elsif ($transport_cost_matrix) {
572
        } elsif ($transport_cost_matrix) {
573
            # If there are items available at the pickup branch they will always be the least cost (no transfer needed) so we only check here in the case where there are none
560
            $pull_branches = [ keys %items_by_branch ];
574
            $pull_branches = [ keys %items_by_branch ];
561
            $holdingbranch = least_cost_branch( $pickup_branch, $pull_branches, $transport_cost_matrix );
575
            $holdingbranch = least_cost_branch( $pickup_branch, $pull_branches, $transport_cost_matrix );
562
            next
576
            next
563
                unless $holdingbranch
577
                unless $holdingbranch
564
                ; # If using the matrix, and nothing is least cost, it means we cannot transfer to the pikcup branch for this request
578
                ; # If using the matrix, and nothing is least cost, it means we cannot transfer to the pickup branch for this request
565
            $holding_branch_items = $items_by_branch{$holdingbranch};
579
            $holding_branch_items = $items_by_branch{$holdingbranch};
566
        }
580
        }
567
581
Lines 578-585 sub MapItemsToHoldRequests { Link Here
578
        # ********************************
592
        # ********************************
579
593
580
594
595
        # Not found yet, fall back to basics
581
        unless ($itemnumber) {
596
        unless ($itemnumber) {
582
            # not found yet, fall back to basics
583
            if ($branches_to_use) {
597
            if ($branches_to_use) {
584
                $pull_branches = $branches_to_use;
598
                $pull_branches = $branches_to_use;
585
            } else {
599
            } else {
Lines 587-593 sub MapItemsToHoldRequests { Link Here
587
            }
601
            }
588
            $holdingbranch ||= $pull_branches->[0];    # We set this as the first from the list of pull branches
602
            $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
603
                 # 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
604
                 # FIXME: The intention is to follow StaticHoldsQueueWeight, but we don't check that pref
591
605
592
            # Try picking items where the home and pickup branch match first
606
            # Try picking items where the home and pickup branch match first
593
            foreach my $branch (@$pull_branches) {
607
            foreach my $branch (@$pull_branches) {
Lines 662-668 sub MapItemsToHoldRequests { Link Here
662
  my $bool = _can_item_fill_request( $item, $request, $libraries );
676
  my $bool = _can_item_fill_request( $item, $request, $libraries );
663
677
664
  This is an internal function of MapItemsToHoldRequests for checking an item against a hold. It uses the custom hashes for item and hold information
678
  This is an internal function of MapItemsToHoldRequests for checking an item against a hold. It uses the custom hashes for item and hold information
665
  used by thta routine
679
  used by that routine
666
680
667
=cut
681
=cut
668
682
669
- 

Return to bug 35432