Bug 16223: (QA follow-up) Move trigger to apply

This patch moves the del_restrictions_after_payment from before the
actual credit application call inside Koha::Account::pay to after the
application of credits to debits in Koha::Account::Line::apply.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Martin Renvoize 2022-11-11 09:54:05 +00:00 committed by Tomas Cohen Arazi
parent cba9824e6d
commit c04e297f39
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F
2 changed files with 3 additions and 3 deletions

View file

@ -39,7 +39,6 @@ use Koha::Account::DebitTypes;
use Koha::Exceptions;
use Koha::Exceptions::Account;
use Koha::Plugins;
use Koha::Patron::Debarments;
=head1 NAME
@ -118,8 +117,6 @@ sub pay {
}
);
Koha::Patron::Debarments::del_restrictions_after_payment({ borrowernumber => $self->{patron_id} });
# NOTE: Pay historically always applied as much credit as it could to all
# existing outstanding debits, whether passed specific debits or otherwise.
if ( $payment->amountoutstanding ) {

View file

@ -28,6 +28,7 @@ use Koha::Database;
use Koha::DateUtils qw( dt_from_string );
use Koha::Exceptions::Account;
use Koha::Items;
use Koha::Patron::Debarments;
use base qw(Koha::Object Koha::Object::Mixin::AdditionalFields);
@ -699,6 +700,8 @@ sub apply {
}
});
Koha::Patron::Debarments::del_restrictions_after_payment({ borrowernumber => $self->borrowernumber });
return $self;
}