From ead7d86842d76e4619ebf7a4d9fa28998bad3442 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 21 Mar 2017 12:24:28 -0300 Subject: [PATCH] Bug 18266: Fix internal error when paying fine for lost item without.. item MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit If a fine is created for a lost item but the itemnumber is not supplied, the system will return it. The item should not be mark as returned if there is no item linked to the fine. Test plan: 1. Turn StoreLastBorrower on 2. Create a manual invoice for a lost item, do not supply a barcode 3. Pay the fines 'Pay fines > Pay' => Without this patch applied you get Can't call method "last_returned_by" on an undefined value at /home/marc/koha/C4/Circulation.pm line 2188. => With this patch applied, you must not get the error. Signed-off-by: Marc Véron Signed-off-by: Nick Clemens Signed-off-by: Kyle M Hall --- Koha/Account.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Koha/Account.pm b/Koha/Account.pm index 28b789facb..9ec1c1b2f9 100644 --- a/Koha/Account.pm +++ b/Koha/Account.pm @@ -101,7 +101,7 @@ sub pay { $fine->amountoutstanding($new_amountoutstanding)->store(); $balance_remaining = $balance_remaining - $amount_to_pay; - if ( $fine->accounttype && ( $fine->accounttype eq 'Rep' || $fine->accounttype eq 'L' ) ) + if ( $fine->itemnumber && $fine->accounttype && ( $fine->accounttype eq 'Rep' || $fine->accounttype eq 'L' ) ) { C4::Circulation::ReturnLostItem( $self->{patron_id}, $fine->itemnumber ); } -- 2.39.5