return if $self->capture eq 'nocapture'; # Not capturing holds anyway? Move on.
return if $self->is_precat; # No holds for precats
return unless $self->circ_lib == $self->copy->circ_lib; # Item isn't "home"? Don't check.
- return unless $self->copy->holdable; # Not holdable, shouldn't capture holds.
+ return unless $U->is_true($self->copy->holdable); # Not holdable, shouldn't capture holds.
+ my $status = $U->copy_status($self->copy->status);
+ return unless $U->is_true($status->holdable); # Current status not holdable means no hold will ever target the item
# Specifically target items that are likely new (by status ID)
- unless ($self->retarget_mode =~ m/\.all/) {
- my $status = $U->copy_status($self->copy->status)->id;
- return unless $status == OILS_COPY_STATUS_IN_PROCESS;
+ return unless $status->id == OILS_COPY_STATUS_IN_PROCESS || $self->retarget_mode =~ m/\.all/;
+ my $location = $self->copy->location;
+ if(!ref($location)) {
+ $location = $self->editor->retrieve_asset_copy_location($self->copy->location);
+ $self->copy->location($location);
}
+ return unless $U->is_true($location->holdable); # Don't bother on non-holdable locations
# Fetch holds for the bib
my ($result) = $holdcode->method_lookup('open-ils.circ.holds.retrieve_all_from_title')->run(
if($self->capture ne 'capture') {
# see if this item is in a hold-capture-delay location
- my $location = $self->editor->retrieve_asset_copy_location($self->copy->location);
+ my $location = $self->copy->location;
+ if(!ref($location)) {
+ $location = $self->editor->retrieve_asset_copy_location($self->copy->location);
+ $self->copy->location($location);
+ }
if($U->is_true($location->hold_verify)) {
$self->bail_on_events(
OpenILS::Event->new('HOLD_CAPTURE_DELAYED', copy_location => $location));