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

(-)a/C4/Overdues.pm (-2 / +9 lines)
Lines 655-663 sub GetFine { Link Here
655
    my $dbh   = C4::Context->dbh();
655
    my $dbh   = C4::Context->dbh();
656
    my $query = q|SELECT sum(amountoutstanding) as fineamount FROM accountlines
656
    my $query = q|SELECT sum(amountoutstanding) as fineamount FROM accountlines
657
    where accounttype like 'F%'
657
    where accounttype like 'F%'
658
  AND amountoutstanding > 0 AND itemnumber = ? AND borrowernumber=?|;
658
  AND amountoutstanding > 0 AND borrowernumber=?|;
659
    my @query_param;
660
    push @query_param, $borrowernumber;
661
    if (defined $itemnum )
662
    {
663
        $query .= " AND itemnumber=?";
664
        push @query_param, $itemnum;
665
    }
659
    my $sth = $dbh->prepare($query);
666
    my $sth = $dbh->prepare($query);
660
    $sth->execute( $itemnum, $borrowernumber );
667
    $sth->execute( @query_param );
661
    my $fine = $sth->fetchrow_hashref();
668
    my $fine = $sth->fetchrow_hashref();
662
    if ($fine->{fineamount}) {
669
    if ($fine->{fineamount}) {
663
        return $fine->{fineamount};
670
        return $fine->{fineamount};
(-)a/misc/cronjobs/staticfines.pl (-2 / +1 lines)
Lines 196-202 for ( my $i = 0 ; $i < scalar(@$data) ; $i++ ) { Link Here
196
    $amount = $catamounts{$borrower->{'categorycode'}} if (defined $catamounts{$borrower->{'categorycode'}});
196
    $amount = $catamounts{$borrower->{'categorycode'}} if (defined $catamounts{$borrower->{'categorycode'}});
197
197
198
    # We check if there is already a fine for the given borrower
198
    # We check if there is already a fine for the given borrower
199
    my $fine = GetFine($data->[$i]->{'borrowernumber'});
199
    my $fine = GetFine(undef, $data->[$i]->{'borrowernumber'});
200
    if ($fine > 0) {
200
    if ($fine > 0) {
201
        $debug and warn "There is already a fine for borrower " . $data->[$i]->{'borrowernumber'} . ". Nothing to do here. Skipping this borrower";
201
        $debug and warn "There is already a fine for borrower " . $data->[$i]->{'borrowernumber'} . ". Nothing to do here. Skipping this borrower";
202
        next;
202
        next;
203
- 

Return to bug 13018