# Add renewal if possible
my @renewal = CanBookBeRenewed( $borrowernumber, $itemnumber );
if ( $renewal[0] ) { AddRenewal( $borrowernumber, $itemnumber ); }
if ( $renewal[0] ) { AddRenewal( $borrowernumber, $itemnumber, $item->checkout->branchcode ); }
my $issue = $item->checkout;
return unless $issue; # FIXME should be handled
# Set the userenv
C4::Context->_new_userenv(1);
C4::Context->set_userenv(
undef, undef, undef, 'CRON', 'CRON', undef,
undef, undef, undef, 'ILSDI', 'ILSDI', undef,
undef, undef, undef, undef, undef
);
C4::Context->interface('api');
-