View | Details | Raw Unified | Return to bug 13841
Collapse All | Expand All

(-)a/C4/Overdues.pm (-24 / +18 lines)
Lines 580-608 sub UpdateFine { Link Here
580
            #      print "no update needed $data->{'amount'}"
580
            #      print "no update needed $data->{'amount'}"
581
        }
581
        }
582
    } else {
582
    } else {
583
        my $sth4 = $dbh->prepare(
583
        if ( $amount ) { # Don't add new fines with an amount of 0
584
            "SELECT title FROM biblio LEFT JOIN items ON biblio.biblionumber=items.biblionumber WHERE items.itemnumber=?"
584
            my $sth4 = $dbh->prepare(
585
        );
585
                "SELECT title FROM biblio LEFT JOIN items ON biblio.biblionumber=items.biblionumber WHERE items.itemnumber=?"
586
        $sth4->execute($itemnum);
586
            );
587
        my $title = $sth4->fetchrow;
587
            $sth4->execute($itemnum);
588
588
            my $title = $sth4->fetchrow;
589
#         #   print "not in account";
589
590
#         my $sth3 = $dbh->prepare("Select max(accountno) from accountlines");
590
            my $nextaccntno = C4::Accounts::getnextacctno($borrowernumber);
591
#         $sth3->execute;
591
592
# 
592
            my $desc = ( $type ? "$type " : '' ) . "$title $due";    # FIXEDME, avoid whitespace prefix on empty $type
593
#         # FIXME - Make $accountno a scalar.
593
594
#         my @accountno = $sth3->fetchrow_array;
594
            my $query = "INSERT INTO accountlines
595
#         $sth3->finish;
595
                         (borrowernumber,itemnumber,date,amount,description,accounttype,amountoutstanding,lastincrement,accountno)
596
#         $accountno[0]++;
596
                         VALUES (?,?,now(),?,?,'FU',?,?,?)";
597
# begin transaction
597
            my $sth2 = $dbh->prepare($query);
598
		my $nextaccntno = C4::Accounts::getnextacctno($borrowernumber);
598
            $debug and print STDERR "UpdateFine query: $query\nw/ args: $borrowernumber, $itemnum, $amount, $desc, $amount, $amount, $nextaccntno\n";
599
		my $desc = ($type ? "$type " : '') . "$title $due";	# FIXEDME, avoid whitespace prefix on empty $type
599
            $sth2->execute( $borrowernumber, $itemnum, $amount, $desc, $amount, $amount, $nextaccntno );
600
		my $query = "INSERT INTO accountlines
600
        }
601
		    (borrowernumber,itemnumber,date,amount,description,accounttype,amountoutstanding,lastincrement,accountno)
602
			    VALUES (?,?,now(),?,?,'FU',?,?,?)";
603
		my $sth2 = $dbh->prepare($query);
604
		$debug and print STDERR "UpdateFine query: $query\nw/ args: $borrowernumber, $itemnum, $amount, $desc, $amount, $amount, $nextaccntno\n";
605
        $sth2->execute($borrowernumber, $itemnum, $amount, $desc, $amount, $amount, $nextaccntno);
606
    }
601
    }
607
    # logging action
602
    # logging action
608
    &logaction(
603
    &logaction(
609
- 

Return to bug 13841