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 997-1002 sub WriteOffFee { Link Here
997
998
998
}
999
}
999
1000
1001
=head2 GetTotalFines
1002
1003
    my $total_fines_owed = GetTotalFines( $borrowernumber );
1004
1005
    Returns the total amount owed by the given borrower.
1006
1007
=cut
1008
1009
sub GetTotalFines {
1010
    my ( $borrowernumber ) = @_;
1011
    my $dbh = C4::Context->dbh();
1012
    my $query = "SELECT SUM( amountoutstanding ) AS total FROM accountlines WHERE borrowernumber = ?";
1013
    my $sth = $dbh->prepare( $query );
1014
    $sth->execute( $borrowernumber );
1015
    my $row = $sth->fetchrow_hashref();
1016
    my $total = $row->{'total'};
1017
    $total = $total || 0;
1018
    return $total;
1019
}
1020
1000
END { }    # module clean-up code here (global destructor)
1021
END { }    # module clean-up code here (global destructor)
1001
1022
1002
1;
1023
1;
(-)a/C4/Overdues.pm (-20 lines)
Lines 53-59 BEGIN { Link Here
53
        &GetOverdueDelays
53
        &GetOverdueDelays
54
        &GetOverduerules
54
        &GetOverduerules
55
        &GetFine
55
        &GetFine
56
        &GetTotalFines
57
        &CreateItemAccountLine
56
        &CreateItemAccountLine
58
        &ReplacementCost2
57
        &ReplacementCost2
59
        
58
        
Lines 693-717 sub GetFine { Link Here
693
    return 0;
692
    return 0;
694
}
693
}
695
694
696
=head2 GetTotalFines
697
698
    my $total_fines_owed = GetTotalFines( $borrowernumber );
699
700
    Returns the total amount owed by the given borrower.
701
702
=cut
703
704
sub GetTotalFines {
705
    my ( $borrowernumber ) = @_;
706
    my $dbh = C4::Context->dbh();
707
    my $query = "SELECT SUM( amountoutstanding ) AS total FROM accountlines WHERE borrowernumber = ?";
708
    my $sth = $dbh->prepare( $query );
709
    $sth->execute( $borrowernumber );
710
    my $row = $sth->fetchrow_hashref();
711
    my $total = $row->{'total'};
712
    $total = $total || 0;
713
    return $total;
714
}
715
695
716
sub ReplacementCost2 {
696
sub ReplacementCost2 {
717
    my ( $itemnum, $borrowernumber ) = @_;
697
    my ( $itemnum, $borrowernumber ) = @_;
(-)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