Lines 354-361
sub MapItemsToHoldRequests {
Link Here
|
354 |
return unless scalar(@$hold_requests) > 0; |
354 |
return unless scalar(@$hold_requests) > 0; |
355 |
return unless scalar(@$available_items) > 0; |
355 |
return unless scalar(@$available_items) > 0; |
356 |
|
356 |
|
357 |
my $automatic_return = C4::Context->preference("AutomaticItemReturn"); |
|
|
358 |
|
359 |
# identify item-level requests |
357 |
# identify item-level requests |
360 |
my %specific_items_requested = map { $_->{itemnumber} => 1 } |
358 |
my %specific_items_requested = map { $_->{itemnumber} => 1 } |
361 |
grep { defined($_->{itemnumber}) } |
359 |
grep { defined($_->{itemnumber}) } |
Lines 419-425
sub MapItemsToHoldRequests {
Link Here
|
419 |
my $pickup_branch = $request->{branchcode} || $request->{borrowerbranch}; |
417 |
my $pickup_branch = $request->{branchcode} || $request->{borrowerbranch}; |
420 |
my ($itemnumber, $holdingbranch); |
418 |
my ($itemnumber, $holdingbranch); |
421 |
|
419 |
|
422 |
my $holding_branch_items = $automatic_return ? undef : $items_by_branch{$pickup_branch}; |
420 |
my $holding_branch_items = $items_by_branch{$pickup_branch}; |
423 |
if ( $holding_branch_items ) { |
421 |
if ( $holding_branch_items ) { |
424 |
foreach my $item (@$holding_branch_items) { |
422 |
foreach my $item (@$holding_branch_items) { |
425 |
if ( $request->{borrowerbranch} eq $item->{homebranch} ) { |
423 |
if ( $request->{borrowerbranch} eq $item->{homebranch} ) { |
Lines 587-596
sub least_cost_branch {
Link Here
|
587 |
#$from - arrayref |
585 |
#$from - arrayref |
588 |
my ($to, $from, $transport_cost_matrix) = @_; |
586 |
my ($to, $from, $transport_cost_matrix) = @_; |
589 |
|
587 |
|
590 |
# Nothing really spectacular: supply to branch, a list of potential from branches |
588 |
# Nothing really spectacular: supply to branch, a list of potential from branches |
591 |
# and find the minimum from - to value from the transport_cost_matrix |
589 |
# and find the minimum from - to value from the transport_cost_matrix |
592 |
return $from->[0] if @$from == 1; |
590 |
return $from->[0] if @$from == 1; |
593 |
|
591 |
|
|
|
592 |
# If the pickup library is in the list of libraries to pull from, |
593 |
# return that library right away, it is obviously the least costly |
594 |
my ($self) = grep( /$to/, @$from ); |
595 |
return ($self) if $self; |
596 |
|
594 |
my ($least_cost, @branch); |
597 |
my ($least_cost, @branch); |
595 |
foreach (@$from) { |
598 |
foreach (@$from) { |
596 |
my $cell = $transport_cost_matrix->{$to}{$_}; |
599 |
my $cell = $transport_cost_matrix->{$to}{$_}; |
597 |
- |
|
|