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

(-)a/C4/Accounts.pm (+21 lines)
Lines 50-55 BEGIN { Link Here
50
                &makepartialpayment
50
                &makepartialpayment
51
                &recordpayment_selectaccts
51
                &recordpayment_selectaccts
52
                &WriteOffFee
52
                &WriteOffFee
53
                &GetTotalFines
53
	);
54
	);
54
}
55
}
55
56
Lines 1001-1006 sub WriteOffFee { Link Here
1001
1002
1002
}
1003
}
1003
1004
1005
=head2 GetTotalFines
1006
1007
    my $total_fines_owed = GetTotalFines( $borrowernumber );
1008
1009
    Returns the total amount owed by the given borrower.
1010
1011
=cut
1012
1013
sub GetTotalFines {
1014
    my ( $borrowernumber ) = @_;
1015
    my $dbh = C4::Context->dbh();
1016
    my $query = "SELECT SUM( amountoutstanding ) AS total FROM accountlines WHERE borrowernumber = ?";
1017
    my $sth = $dbh->prepare( $query );
1018
    $sth->execute( $borrowernumber );
1019
    my $row = $sth->fetchrow_hashref();
1020
    my $total = $row->{'total'};
1021
    $total = $total || 0;
1022
    return $total;
1023
}
1024
1004
END { }    # module clean-up code here (global destructor)
1025
END { }    # module clean-up code here (global destructor)
1005
1026
1006
1;
1027
1;
(-)a/C4/Overdues.pm (-19 lines)
Lines 658-682 sub GetFine { Link Here
658
    return 0;
658
    return 0;
659
}
659
}
660
660
661
=head2 GetTotalFines
662
663
    my $total_fines_owed = GetTotalFines( $borrowernumber );
664
665
    Returns the total amount owed by the given borrower.
666
667
=cut
668
669
sub GetTotalFines {
670
    my ( $borrowernumber ) = @_;
671
    my $dbh = C4::Context->dbh();
672
    my $query = "SELECT SUM( amountoutstanding ) AS total FROM accountlines WHERE borrowernumber = ?";
673
    my $sth = $dbh->prepare( $query );
674
    $sth->execute( $borrowernumber );
675
    my $row = $sth->fetchrow_hashref();
676
    my $total = $row->{'total'};
677
    $total = $total || 0;
678
    return $total;
679
}
680
661
681
=head2 NumberNotifyId
662
=head2 NumberNotifyId
682
663
(-)a/C4/SIP/ILS/Transaction/Renew.pm (-2 / +1 lines)
Lines 35-41 sub do_renew_for { Link Here
35
    my $borrower = shift;
35
    my $borrower = shift;
36
    my ($renewokay,$renewerror) = CanBookBeRenewed($borrower->{borrowernumber},$self->{item}->{itemnumber});
36
    my ($renewokay,$renewerror) = CanBookBeRenewed($borrower->{borrowernumber},$self->{item}->{itemnumber});
37
37
38
    unless ( C4::Overdues::GetTotalFines($borrower->{borrowernumber}) < C4::Context->preference('OPACFineNoRenewals') ) {
38
    unless ( C4::Accounts::GetTotalFines($borrower->{borrowernumber}) < C4::Context->preference('OPACFineNoRenewals') ) {
39
        $renewokay = 0;
39
        $renewokay = 0;
40
        $renewerror = 'too_many_fines'
40
        $renewerror = 'too_many_fines'
41
    }
41
    }
42
- 

Return to bug 7560