Commit d619fb99 authored by Petter Goksøyr Åsen's avatar Petter Goksøyr Åsen Committed by Petter Goksøyr Åsen
Browse files

DEICH-5938 rewrite and fix check for debt in canItemBeIssued

parent 4edde8c1
......@@ -24,6 +24,7 @@ use Deichman::Patron::Loan;
use Deichman::Patron::Reserve;
use Deichman::Patron::MessageQueue;
use Deichman::Patron::MessageQueue::Digest;
use Deichman::Patron::Purresak;
use Deichman::Notice;
use Deichman::Spore::DB;
use Deichman::Stats::Transaction;
......@@ -651,14 +652,15 @@ sub canItemBeIssued {
#$self->Deichman::Patron::IsExpired() and $issuingimpossible->{EXPIRED} = 1;
# DEBTS
# Note: Koha::Account is different than other Koha Objects
my $debt = Koha::Account->new({patron_id => $self->{patron}->{borrowernumber}})->balance;
if ($debt > 0) {
# TODO: if $self->{prefs}->{IssuingInProcess}
if ($debt > $self->{prefs}->{noissuescharge} and not $self->{prefs}->{AllowFineOverride}) {
$self->Deichman::Patron::Purresak::FindPendingByPatron();
if ($self->{purresak}) {
my $debt = $self->{purresak}->{amount};
if ($self->{prefs}->{AllowFineOverride}) {
$needsconfirmation->{DEBT} = sprintf( "%.2f", $debt );
} else {
$issuingimpossible->{DEBT} = sprintf( "%.2f", $debt );
$self->{error} = Deichman::Exception::Loan::CannotCheckout->new("patronBlockedWithFees");
}
$self->{error} = Deichman::Exception::Loan::CannotCheckout->new("patronBlockedWithFees");
} elsif ($self->{prefs}->{NoIssuesChargeGuarantees}) {
my $guarantees_charges;
$self->Deichman::Patron::Guarantees();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment