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

(-)a/C4/Accounts.pm (+21 lines)
Lines 49-54 BEGIN { Link Here
49
                &makepartialpayment
49
                &makepartialpayment
50
                &recordpayment_selectaccts
50
                &recordpayment_selectaccts
51
                &WriteOffFee
51
                &WriteOffFee
52
                &GetTotalFines
52
	);
53
	);
53
}
54
}
54
55
Lines 824-829 sub WriteOffFee { Link Here
824
825
825
}
826
}
826
827
828
=head2 GetTotalFines
829
830
    my $total_fines_owed = GetTotalFines( $borrowernumber );
831
832
    Returns the total amount owed by the given borrower.
833
834
=cut
835
836
sub GetTotalFines {
837
    my ( $borrowernumber ) = @_;
838
    my $dbh = C4::Context->dbh();
839
    my $query = "SELECT SUM( amountoutstanding ) AS total FROM accountlines WHERE borrowernumber = ?";
840
    my $sth = $dbh->prepare( $query );
841
    $sth->execute( $borrowernumber );
842
    my $row = $sth->fetchrow_hashref();
843
    my $total = $row->{'total'};
844
    $total = $total || 0;
845
    return $total;
846
}
847
827
END { }    # module clean-up code here (global destructor)
848
END { }    # module clean-up code here (global destructor)
828
849
829
1;
850
1;
(-)a/C4/Overdues.pm (-19 lines)
Lines 668-692 sub GetFine { Link Here
668
    return 0;
668
    return 0;
669
}
669
}
670
670
671
=head2 GetTotalFines
672
673
    my $total_fines_owed = GetTotalFines( $borrowernumber );
674
675
    Returns the total amount owed by the given borrower.
676
677
=cut
678
679
sub GetTotalFines {
680
    my ( $borrowernumber ) = @_;
681
    my $dbh = C4::Context->dbh();
682
    my $query = "SELECT SUM( amountoutstanding ) AS total FROM accountlines WHERE borrowernumber = ?";
683
    my $sth = $dbh->prepare( $query );
684
    $sth->execute( $borrowernumber );
685
    my $row = $sth->fetchrow_hashref();
686
    my $total = $row->{'total'};
687
    $total = $total || 0;
688
    return $total;
689
}
690
671
691
=head2 NumberNotifyId
672
=head2 NumberNotifyId
692
673
(-)a/C4/SIP/ILS/Transaction/Renew.pm (-2 / +1 lines)
Lines 46-52 sub do_renew_for { Link Here
46
46
47
    }
47
    }
48
48
49
    unless ( C4::Overdues::GetTotalFines($borrower->{borrowernumber}) < C4::Context->preference('OPACFineNoRenewals') ) {
49
    unless ( C4::Accounts::GetTotalFines($borrower->{borrowernumber}) < C4::Context->preference('OPACFineNoRenewals') ) {
50
        $renewokay = 0;
50
        $renewokay = 0;
51
        $renewerror = 'too_many_fines'
51
        $renewerror = 'too_many_fines'
52
    }
52
    }
53
- 

Return to bug 7560