if ($U->ou_ancestor_setting_value($self->circ_lib, 'circ.block_renews_for_holds')) {
my ($hold, undef, $retarget) = $holdcode->find_nearest_permitted_hold(
- $self->editor, $self->copy, $self->editor->requestor, 1
+ $self->editor, $self->copy, $self->editor->requestor, 1, $self->circ_lib
);
$self->push_events(new OpenILS::Event("COPY_NEEDED_FOR_HOLD")) if $hold;
}
my $copy = shift; # copy to target
my $user = shift; # staff
my $check_only = shift; # do no updates, just see if the copy could fulfill a hold
+ my $force_ou = shift; # if set, use this OU instead of the work OU
my $evt = OpenILS::Event->new('ACTION_HOLD_REQUEST_NOT_FOUND');
my $bc = $copy->barcode;
+ $force_ou = $user->ws_ou unless $force_ou;
+
# find any existing holds that already target this copy
my $old_holds = $editor->search_action_hold_request(
{ current_copy => $copy->id,
}
);
- my $hold_stall_interval = $U->ou_ancestor_setting_value($user->ws_ou, OILS_SETTING_HOLD_SOFT_STALL);
+ my $hold_stall_interval = $U->ou_ancestor_setting_value($force_ou, OILS_SETTING_HOLD_SOFT_STALL);
- $logger->info("circulator: searching for best hold at org ".$user->ws_ou.
+ $logger->info("circulator: searching for best hold at org ".$force_ou.
" and copy $bc with a hold stalling interval of ". ($hold_stall_interval || "(none)"));
- my $fifo = $U->ou_ancestor_setting_value($user->ws_ou, 'circ.holds_fifo');
+ my $fifo = $U->ou_ancestor_setting_value($force_ou, 'circ.holds_fifo');
# search for what should be the best holds for this copy to fulfill
my $best_holds = $U->storagereq(
"open-ils.storage.action.hold_request.nearest_hold.atomic",
- $user->ws_ou, $copy->id, 10, $hold_stall_interval, $fifo );
+ $force_ou, $copy->id, 10, $hold_stall_interval, $fifo );
unless(@$best_holds) {