Lines 167-173
sub CreateQueue {
Link Here
|
167 |
my $transport_cost_matrix; |
167 |
my $transport_cost_matrix; |
168 |
my $use_transport_cost_matrix = C4::Context->preference("UseTransportCostMatrix"); |
168 |
my $use_transport_cost_matrix = C4::Context->preference("UseTransportCostMatrix"); |
169 |
if ($use_transport_cost_matrix) { |
169 |
if ($use_transport_cost_matrix) { |
170 |
debug( "Using cost matrix" ); |
|
|
171 |
$transport_cost_matrix = TransportCostMatrix(); |
170 |
$transport_cost_matrix = TransportCostMatrix(); |
172 |
unless (keys %$transport_cost_matrix) { |
171 |
unless (keys %$transport_cost_matrix) { |
173 |
warn "UseTransportCostMatrix set to yes, but matrix not populated"; |
172 |
warn "UseTransportCostMatrix set to yes, but matrix not populated"; |
Lines 175-186
sub CreateQueue {
Link Here
|
175 |
} |
174 |
} |
176 |
} |
175 |
} |
177 |
unless ($transport_cost_matrix) { |
176 |
unless ($transport_cost_matrix) { |
178 |
debug( "Not using cost matrix" ); |
|
|
179 |
$branches_to_use = load_branches_to_pull_from(); |
177 |
$branches_to_use = load_branches_to_pull_from(); |
180 |
} |
178 |
} |
181 |
|
179 |
|
182 |
my $bibs_with_pending_requests = GetBibsWithPendingHoldRequests(); |
180 |
my $bibs_with_pending_requests = GetBibsWithPendingHoldRequests(); |
183 |
debug( "bibs_with_pending_requests: ".Dumper($bibs_with_pending_requests) ); |
|
|
184 |
|
181 |
|
185 |
foreach my $biblionumber (@$bibs_with_pending_requests) { |
182 |
foreach my $biblionumber (@$bibs_with_pending_requests) { |
186 |
$total_bibs++; |
183 |
$total_bibs++; |
Lines 192-198
sub CreateQueue {
Link Here
|
192 |
my $item_map = MapItemsToHoldRequests($hold_requests, $available_items, $branches_to_use, $transport_cost_matrix); |
189 |
my $item_map = MapItemsToHoldRequests($hold_requests, $available_items, $branches_to_use, $transport_cost_matrix); |
193 |
$item_map or next; |
190 |
$item_map or next; |
194 |
my $item_map_size = scalar(keys %$item_map) |
191 |
my $item_map_size = scalar(keys %$item_map) |
195 |
or next;; |
192 |
or next; |
196 |
|
193 |
|
197 |
$num_items_mapped += $item_map_size; |
194 |
$num_items_mapped += $item_map_size; |
198 |
CreatePicklistFromItemMap($item_map); |
195 |
CreatePicklistFromItemMap($item_map); |
Lines 351-357
sub MapItemsToHoldRequests {
Link Here
|
351 |
return unless scalar(@$hold_requests) > 0; |
348 |
return unless scalar(@$hold_requests) > 0; |
352 |
return unless scalar(@$available_items) > 0; |
349 |
return unless scalar(@$available_items) > 0; |
353 |
|
350 |
|
354 |
debug( "MapItemsToHoldRequests() for ", Dumper($hold_requests, $available_items, $branches_to_use, $transport_cost_matrix) ); |
|
|
355 |
my $automatic_return = C4::Context->preference("AutomaticItemReturn"); |
351 |
my $automatic_return = C4::Context->preference("AutomaticItemReturn"); |
356 |
|
352 |
|
357 |
# identify item-level requests |
353 |
# identify item-level requests |
Lines 500-506
sub MapItemsToHoldRequests {
Link Here
|
500 |
|
496 |
|
501 |
sub CreatePicklistFromItemMap { |
497 |
sub CreatePicklistFromItemMap { |
502 |
my $item_map = shift; |
498 |
my $item_map = shift; |
503 |
debug ("CreatePicklistFromItemMap for ", Dumper($item_map) ); |
|
|
504 |
|
499 |
|
505 |
my $dbh = C4::Context->dbh; |
500 |
my $dbh = C4::Context->dbh; |
506 |
|
501 |
|
Lines 564-573
sub AddToHoldTargetMap {
Link Here
|
564 |
|
559 |
|
565 |
# Helper functions, not part of any interface |
560 |
# Helper functions, not part of any interface |
566 |
|
561 |
|
567 |
sub debug { |
|
|
568 |
# warn @_; |
569 |
} |
570 |
|
571 |
sub _trim { |
562 |
sub _trim { |
572 |
return $_[0] unless $_[0]; |
563 |
return $_[0] unless $_[0]; |
573 |
$_[0] =~ s/^\s+//; |
564 |
$_[0] =~ s/^\s+//; |
574 |
- |
|
|