Lines 311-332
sub DelDebarmentsAfterPayment {
Link Here
|
311 |
my ( $total_due, $accts, $numaccts ) = C4::Members::GetMemberAccountRecords($borrowernumber); |
311 |
my ( $total_due, $accts, $numaccts ) = C4::Members::GetMemberAccountRecords($borrowernumber); |
312 |
|
312 |
|
313 |
foreach my $debarment (@{ $debarments }){ |
313 |
foreach my $debarment (@{ $debarments }){ |
314 |
if (exists $liftDebarmentRules->{$debarment->{'comment'}}) { |
314 |
my $rule; |
315 |
# Delete debarment IF: |
315 |
|
316 |
# 1. there is no maximum outstanding fines defined for the liftDebarmentRule |
316 |
foreach my $liftRule (keys $liftDebarmentRules){ |
317 |
# and there is no outstanding fines. |
317 |
my $comment = $debarment->{'comment'}; |
318 |
# 2. there is a maximum outstanding fines amount defined |
318 |
$rule = $liftRule if $comment =~ $liftRule; |
319 |
# and total_due is smaller or equal than the defined maximum outstanding amount |
319 |
} |
320 |
# Otherwise, do not lift the debarment. |
320 |
next unless $rule; |
321 |
if (not defined $liftDebarmentRules->{$debarment->{'comment'}}->{'outstanding'}){ |
321 |
|
322 |
if ($total_due <= 0) { |
322 |
# Delete debarment IF: |
323 |
DelDebarment($debarment->{'borrower_debarment_id'}); |
323 |
# 1. there is no maximum outstanding fines defined for the liftDebarmentRule |
324 |
} |
324 |
# and there is no outstanding fines. |
|
|
325 |
# 2. there is a maximum outstanding fines amount defined |
326 |
# and total_due is smaller or equal than the defined maximum outstanding amount |
327 |
# Otherwise, do not lift the debarment. |
328 |
if (not defined $liftDebarmentRules->{$rule}->{'outstanding'}){ |
329 |
if ($total_due <= 0) { |
330 |
DelDebarment($debarment->{'borrower_debarment_id'}); |
325 |
} |
331 |
} |
326 |
else { |
332 |
} |
327 |
if ($total_due <= $liftDebarmentRules->{$debarment->{'comment'}}->{'outstanding'}) { |
333 |
else { |
328 |
DelDebarment($debarment->{'borrower_debarment_id'}); |
334 |
if ($total_due <= $liftDebarmentRules->{$rule}->{'outstanding'}) { |
329 |
} |
335 |
DelDebarment($debarment->{'borrower_debarment_id'}); |
330 |
} |
336 |
} |
331 |
} |
337 |
} |
332 |
} |
338 |
} |