Bug 33176: Enforce RequirePaymentType with API

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Sam Lau <samalau@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Lucas Gass 2023-04-13 17:52:58 +00:00 committed by Tomas Cohen Arazi
parent b15a15df9e
commit df4285adb2
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F

View file

@ -145,6 +145,10 @@ sub add_credit {
my $note = $body->{note};
my $library_id = $body->{library_id};
if ( C4::Context->preference("RequirePaymentType") && !defined($payment_type) ) {
Koha::Exceptions::Account::PaymentTypeRequired->throw();
}
my $credit = $account->add_credit(
{
amount => $amount,