Bug 14390: [Follow-up] Only update FU record in UpdateFine

Exclude O, F and M when outstanding == 0.
Check if the issue_id points to a FU record.

Note: We only warn now when we see a second FU record with this issue id.
That should be a rare exception. As before, we are just counting it in
our total. Added a FIXME.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Tested fine on overdue. Renewed and backdated for a second fine. The F
and FU can be seen on the Fines tab and are totaled on Check out.

Signed-off-by: Jacek Ablewicz <abl@biblos.pk.edu.pl>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Marcel de Rooy 2016-08-23 16:33:10 +02:00 committed by Kyle M Hall
parent 4fa4b8a306
commit fa48df281d
1 changed files with 5 additions and 3 deletions

View File

@ -537,8 +537,9 @@ sub UpdateFine {
# "REF" is Cash Refund
my $sth = $dbh->prepare(
"SELECT * FROM accountlines
WHERE borrowernumber=?
AND accounttype IN ('FU','O','F','M')"
WHERE borrowernumber=? AND
(( accounttype IN ('O','F','M') AND amountoutstanding<>0 ) OR
accounttype = 'FU' )"
);
$sth->execute( $borrowernumber );
my $data;
@ -549,9 +550,10 @@ sub UpdateFine {
# - accumulate fines for other items
# so we can update $itemnum fine taking in account fine caps
while (my $rec = $sth->fetchrow_hashref) {
if ( $rec->{issue_id} == $issue_id ) {
if ( $rec->{issue_id} == $issue_id && $rec->{accounttype} eq 'FU' ) {
if ($data) {
warn "Not a unique accountlines record for issue_id $issue_id";
#FIXME Should we still count this one in total_amount ??
}
else {
$data = $rec;