From 7f81660dd3ac31533fc1da7b33c778d958c4522e Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 2 Jul 2021 16:22:05 +0100 Subject: [PATCH] Bug 27946: (follow-up) Use bug 28656 --- Koha/ArticleRequest.pm | 39 ++++++++++----------------------------- 1 file changed, 10 insertions(+), 29 deletions(-) diff --git a/Koha/ArticleRequest.pm b/Koha/ArticleRequest.pm index 310065387c..c014f9acac 100644 --- a/Koha/ArticleRequest.pm +++ b/Koha/ArticleRequest.pm @@ -105,35 +105,16 @@ sub cancel { $self->notes($notes) if $notes; if ( $self->debit_line_id ) { my $line = Koha::Account::Lines->find( $self->debit_line_id ); - if ( $line->amount != $line->amountoutstanding ) { - $self->borrower->account->add_credit( - { - amount => $line->amount, - user_id => C4::Context->userenv - ? C4::Context->userenv->{'number'} - : undef, - interface => C4::Context->interface, - library_id => C4::Context->userenv - ? C4::Context->userenv->{'branch'} - : undef, - type => 'CREDIT', - description => 'Article request cancelled', - item_id => $self->itemnumber - } - ); - } - else { - $line->cancel( - { - branch => C4::Context->userenv - ? C4::Context->userenv->{'branch'} - : undef, - staff_id => C4::Context->userenv - ? C4::Context->userenv->{'number'} - : undef, - } - ) unless $line->status && $line->status eq 'CANCELLED'; - } + $line->cancel( + { + branch => C4::Context->userenv + ? C4::Context->userenv->{'branch'} + : undef, + staff_id => C4::Context->userenv + ? C4::Context->userenv->{'number'} + : undef, + } + ); } $self->store(); -- 2.20.1