From 1d42b5fbff3f43fb9bf326d06bf772ae3a44b02f Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 13 Sep 2019 17:03:02 +0100 Subject: [PATCH] Bug 23321: (follow-up) Correction to exception logic This patch reduces the noisy warning of uninitialised variables Sponsored-by: PTFS Europe Sponsored-by: Cheshire Libraries Shared Services Signed-off-by: Tomas Cohen Arazi Signed-off-by: Martin Renvoize --- Koha/Account.pm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Koha/Account.pm b/Koha/Account.pm index 86858f9a93..afff235822 100644 --- a/Koha/Account.pm +++ b/Koha/Account.pm @@ -89,8 +89,9 @@ sub pay { my $interface = $params ? ( $params->{interface} || C4::Context->interface ) : C4::Context->interface; Koha::Exceptions::Account::RegisterRequired->throw() if ( C4::Context->preference("UseCashRegisters") - && !defined($cash_register) - && ( $interface ne 'opac' ) ); + && defined($payment_type) + && ( $payment_type eq 'CASH' ) + && !defined($cash_register) ); my @fines_paid; # List of account lines paid on with this payment @@ -352,8 +353,9 @@ sub add_credit { Koha::Exceptions::Account::RegisterRequired->throw() if ( C4::Context->preference("UseCashRegisters") - && !defined($cash_register) - && ( $payment_type eq 'CASH' ) ); + && defined($payment_type) + && ( $payment_type eq 'CASH' ) + && !defined($cash_register) ); my $schema = Koha::Database->new->schema; -- 2.39.5