Bug 28520: Revert "Bug 12362: Reverse transfer upon cancellation"

This reverts commit d0407686eb.

This commit was part of a series adding adding reverse transfers, i.e.
transfers that were created for transfers that were cancelled and
we wanted the item to return back to its sending library. This however
hid the information about transfer happening and we need another approach
to the problem.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Joonas Kylmälä 2021-06-08 07:50:29 +00:00 committed by Kyle M Hall
parent 0ff47f87ef
commit 6747606131

View file

@ -18,7 +18,6 @@ package Koha::Item::Transfer;
use Modern::Perl; use Modern::Perl;
use Carp; use Carp;
use Try::Tiny;
use C4::Items; use C4::Items;
@ -162,24 +161,14 @@ sub cancel {
error => "The 'reason' parameter is mandatory" ) error => "The 'reason' parameter is mandatory" )
unless defined($params->{reason}); unless defined($params->{reason});
my $in_transit = $self->in_transit;
# Throw exception if item is in transit already # 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 # Update the cancelled date
$self->set( $self->set(
{ datecancelled => dt_from_string, cancellation_reason => $params->{reason} } ) { datecancelled => dt_from_string, cancellation_reason => $params->{reason} } )
->store; ->store;
# Set up return transfer if transfer was force cancelled whilst in transit
# NOTE: We don't catch here, as we're happy to fail if there are already
# other transfers in the queue.
try {
$self->item->request_transfer(
{ to => $self->from_library, reason => 'TransferCancellation' } );
};
return $self; return $self;
} }