Bug 28520: Revert "Bug 12362: Cancel transfer with hold cancelation"

This reverts commit 6c10582914.

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>
Rebased-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>

JD amended patch: restore Koha::Item::Transfer->from_library (we are
adding tests in a future patch).

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:05 +00:00 committed by Kyle M Hall
parent e98ce2c1fb
commit 0ff47f87ef
3 changed files with 4 additions and 18 deletions

View File

@ -511,17 +511,8 @@ Cancel a hold:
sub cancel {
my ( $self, $params ) = @_;
$self->_result->result_source->schema->txn_do(
sub {
if ( $self->is_in_transit ) {
my $transfer = $self->item->get_transfer;
# NOTE: Transfers are well bound with Holds.. as such we have to check that there is actually a
# transfer enqueued and in transit here prior to trying to cancel it.
if ( $transfer && $transfer->in_transit ) {
$transfer->cancel({ reason => 'CancelReserve', force => 1 });
}
}
$self->cancellationdate( dt_from_string->strftime( '%Y-%m-%d %H:%M:%S' ) );
$self->priority(0);
$self->cancellation_reason( $params->{cancellation_reason} );

View File

@ -173,15 +173,12 @@ sub cancel {
->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' } );
};
}
try {
$self->item->request_transfer(
{ to => $self->from_library, reason => 'TransferCancellation' } );
};
return $self;
}

View File

@ -134,8 +134,6 @@
[%- CASE 'Reserve' -%]Reserve
[%- CASE 'LostReserve' -%]Lost reserve
[%- CASE 'CancelReserve' -%]Cancelled reserve
[%- CASE 'TransferCancellation' -%]Transfer was cancelled whilst in transit
[%- CASE -%][% trigger | html %]
[%- END -%]
</p>
</div>