From befc7750ec0f38674ba581d968022b38861944c6 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 --- Koha/Account.pm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Koha/Account.pm b/Koha/Account.pm index 719ea1da96..63c212bc5b 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.20.1