From 99a053551c94e6fbb2c4c8ae875165e67e45807f Mon Sep 17 00:00:00 2001 From: Srdjan Jankovic Date: Tue, 21 Feb 2012 17:10:26 +1300 Subject: [PATCH] bug_7420: code reindent and comment --- C4/Overdues.pm | 34 +++++++++++++++++++--------------- 1 files changed, 19 insertions(+), 15 deletions(-) diff --git a/C4/Overdues.pm b/C4/Overdues.pm index 03192c0..0f7914c 100644 --- a/C4/Overdues.pm +++ b/C4/Overdues.pm @@ -515,25 +515,29 @@ sub UpdateFine { my $data; my $total_amount_other = 0.00; my $due_qr = qr/$due/; + # Cycle through the fines and + # - find line that relates to the requested $itemnum + # - accumulate fines for other items + # so we can update $itemnum fine taking in account fine caps while (my $rec = $sth->fetchrow_hashref) { - if ($rec->{itemnumber} == $itemnum && $rec->{description} =~ /$due_qr/) { - if ($data) { - warn "Not a unique accountlines record for item $itemnum borrower $borrowernumber"; - } else { - $data = $rec; - next; + if ($rec->{itemnumber} == $itemnum && $rec->{description} =~ /$due_qr/) { + if ($data) { + warn "Not a unique accountlines record for item $itemnum borrower $borrowernumber"; + } else { + $data = $rec; + next; + } } - } - $total_amount_other += $rec->{'amount'}; + $total_amount_other += $rec->{'amount'}; } if (my $maxfine = C4::Context->preference('MaxFine')) { - if ($total_amount_other + $amount > $maxfine) { - my $new_amount = $maxfine - $total_amount_other; - warn "Reducing fine for item $itemnum borrower $borrowernumber from $amount to $new_amount - MaxFine reached"; - return if $new_amount <= 0.00; - - $amount = $new_amount; - } + if ($total_amount_other + $amount > $maxfine) { + my $new_amount = $maxfine - $total_amount_other; + warn "Reducing fine for item $itemnum borrower $borrowernumber from $amount to $new_amount - MaxFine reached"; + return if $new_amount <= 0.00; + + $amount = $new_amount; + } } if ( $data ) { -- 1.6.5