- $logger->info('open-ils.circ.mark_item_missing_pieces: item needed for hold, shortening due date');
- my $due_date = DateTime->now(time_zone => 'local');
- $co_params->{'due_date'} = cleanse_ISO8601( $due_date->strftime('%FT%T%z') );
- } else {
- $logger->info('open-ils.circ.mark_item_missing_pieces: item not needed for hold');
- }
- }
+ if (! $circ->checkin_time) { # if circ active, attempt renew
+ my ($res) = $self->method_lookup('open-ils.circ.renew')->run($e->authtoken,{'copy_id'=>$circ->target_copy});
+ if (ref $res ne 'ARRAY') { $res = [ $res ]; }
+ if ( $res->[0]->{textcode} eq 'SUCCESS' ) {
+ $circ = $res->[0]->{payload}{'circ'};
+ $circ->target_copy( $copy->id );
+ $logger->info('open-ils.circ.mark_item_missing_pieces: successful renewal');
+ } else {
+ $logger->info('open-ils.circ.mark_item_missing_pieces: non-successful renewal');
+ }
+ } else {
+
+ my $co_params = {
+ 'copy_id'=>$circ->target_copy,
+ 'patron_id'=>$circ->usr,
+ 'skip_deposit_fee'=>1,
+ 'skip_rental_fee'=>1
+ };
+
+ if ($U->ou_ancestor_setting_value($e->requestor->ws_ou, 'circ.block_renews_for_holds')) {
+
+ my ($hold, undef, $retarget) = $holdcode->find_nearest_permitted_hold(
+ $e, $copy, $e->requestor, 1 );