@@ -, +, @@ request_transfer run updatedatabase when applying --- C4/Circulation.pm | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) --- a/C4/Circulation.pm +++ a/C4/Circulation.pm @@ -3591,19 +3591,17 @@ This function validate the line of brachtransfer but with the wrong destination sub updateWrongTransfer { my ( $itemNumber,$waitingAtLibrary,$FromLibrary ) = @_; - # first step: cancel the original transfer - my $item = Koha::Items->find($itemNumber); - my $transfer = $item->get_transfer; - $transfer->set({ datecancelled => dt_from_string, cancellation_reason => 'WrongTransfer' })->store(); + my $to_library = Koha::Libraries->find($waitingAtLibrary); - # second step: create a new transfer to the right location + # Request a new transfer, replacing the existing one. + my $item = Koha::Items->find($itemNumber); my $new_transfer = $item->request_transfer( { - to => $transfer->to_library, - reason => $transfer->reason, - comment => $transfer->comments, + to => $to_library, + reason => 'WrongTransfer', ignore_limits => 1, - enqueue => 1 + replace => 1, + force => 1 } ); --