use Modern::Perl;
-use Carp;
-use Try::Tiny;
-use C4::Items;
+use C4::Items qw( CartToShelf ModDateLastSeen );
use Koha::Database;
-use Koha::DateUtils;
+use Koha::DateUtils qw( dt_from_string );
use Koha::Exceptions::Item::Transfer;
use base qw(Koha::Object);
error => "The 'reason' parameter is mandatory" )
unless defined($params->{reason});
- my $in_transit = $self->in_transit;
-
# Throw exception if item is in transit already
- Koha::Exceptions::Item::Transfer::InTransit->throw() if ( !$params->{force} && $in_transit );
+ Koha::Exceptions::Item::Transfer::InTransit->throw() if ( !$params->{force} && $self->in_transit );
# Update the cancelled date
$self->set(
{ datecancelled => dt_from_string, cancellation_reason => $params->{reason} } )
->store;
- # Set up return transfer if transfer was force cancelled whilst in transit
- # and we were not notified that the transfer is being replaced.
- # NOTE: We don't catch here, as we're happy to fail if there are already
- # other transfers in the queue.
- if ($in_transit && !$params->{replace}) {
- try {
- $self->item->request_transfer(
- { to => $self->from_library, reason => 'TransferCancellation' } );
- };
- }
-
return $self;
}