From b4cc701868ea42bd51e40a08d6910d707e157e6c Mon Sep 17 00:00:00 2001 From: Matthias Meusburger Date: Tue, 22 Sep 2020 15:16:23 +0200 Subject: [PATCH] Bug 26506: Fix Koha::Account::pay if called when no user is logged-in Currently, Koha::Account::pay will fail if no user is logged-in when it is called. In this case, this patch will use undef instead of 0 for $manager_id in order to comply with the foreign key constraint on manager_id. --- Koha/Account.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Koha/Account.pm b/Koha/Account.pm index 2a63856..5178d98 100644 --- a/Koha/Account.pm +++ b/Koha/Account.pm @@ -95,7 +95,7 @@ sub pay { my $patron = Koha::Patrons->find( $self->{patron_id} ); - my $manager_id = $userenv ? $userenv->{number} : 0; + my $manager_id = $userenv ? $userenv->{number} : undef; my $interface = $params ? ( $params->{interface} || C4::Context->interface ) : C4::Context->interface; Koha::Exceptions::Account::RegisterRequired->throw() if ( C4::Context->preference("UseCashRegisters") -- 2.7.4