Lines 268-275
sub CalcFine {
Link Here
|
268 |
} else { |
268 |
} else { |
269 |
# a zero (or null) chargeperiod or negative units_minus_grace value means no charge. |
269 |
# a zero (or null) chargeperiod or negative units_minus_grace value means no charge. |
270 |
} |
270 |
} |
|
|
271 |
|
271 |
$amount = $data->{overduefinescap} if $data->{overduefinescap} && $amount > $data->{overduefinescap}; |
272 |
$amount = $data->{overduefinescap} if $data->{overduefinescap} && $amount > $data->{overduefinescap}; |
|
|
273 |
$amount = $item->{'replacementprice'} if ( C4::Context->preference('MaxFineIsReplacementPrice') && $item->{'replacementprice'} && $amount > $item->{'replacementprice'} ); |
274 |
|
272 |
$debug and warn sprintf("CalcFine returning (%s, %s, %s, %s)", $amount, $data->{'chargename'}, $units_minus_grace, $chargeable_units); |
275 |
$debug and warn sprintf("CalcFine returning (%s, %s, %s, %s)", $amount, $data->{'chargename'}, $units_minus_grace, $chargeable_units); |
|
|
276 |
|
273 |
return ($amount, $data->{'chargename'}, $units_minus_grace, $chargeable_units); |
277 |
return ($amount, $data->{'chargename'}, $units_minus_grace, $chargeable_units); |
274 |
# FIXME: chargename is NEVER populated anywhere. |
278 |
# FIXME: chargename is NEVER populated anywhere. |
275 |
} |
279 |
} |
Lines 543-548
sub UpdateFine {
Link Here
|
543 |
$total_amount_other += $rec->{'amountoutstanding'}; |
547 |
$total_amount_other += $rec->{'amountoutstanding'}; |
544 |
} |
548 |
} |
545 |
|
549 |
|
|
|
550 |
if ( C4::Context->preference('MaxFineIsReplacementPrice') ) { |
551 |
my $item = C4::Items::GetItem( $itemnum ); |
552 |
if ( $item->{'replacementprice'} && $amount > $item->{'replacementprice'} ) { |
553 |
$debug && warn "Reducing fine for item $itemnum borrower $borrowernumber from $amount to $item->{'replacementprice'} - Fine exceeds replacement price"; |
554 |
$amount = $item->{'replacementprice'}; |
555 |
} |
556 |
} |
557 |
|
546 |
if (my $maxfine = C4::Context->preference('MaxFine')) { |
558 |
if (my $maxfine = C4::Context->preference('MaxFine')) { |
547 |
if ($total_amount_other + $amount > $maxfine) { |
559 |
if ($total_amount_other + $amount > $maxfine) { |
548 |
my $new_amount = $maxfine - $total_amount_other; |
560 |
my $new_amount = $maxfine - $total_amount_other; |
Lines 552-557
sub UpdateFine {
Link Here
|
552 |
} |
564 |
} |
553 |
} |
565 |
} |
554 |
|
566 |
|
|
|
567 |
|
555 |
if ( $data ) { |
568 |
if ( $data ) { |
556 |
|
569 |
|
557 |
# we're updating an existing fine. Only modify if amount changed |
570 |
# we're updating an existing fine. Only modify if amount changed |