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

(-)a/C4/Accounts.pm (+21 lines)
Lines 47-52 BEGIN { Link Here
47
                &makepartialpayment
47
                &makepartialpayment
48
                &recordpayment_selectaccts
48
                &recordpayment_selectaccts
49
                &WriteOffFee
49
                &WriteOffFee
50
                &GetTotalFines
50
	);
51
	);
51
}
52
}
52
53
Lines 814-819 sub WriteOffFee { Link Here
814
815
815
}
816
}
816
817
818
=head2 GetTotalFines
819
820
    my $total_fines_owed = GetTotalFines( $borrowernumber );
821
822
    Returns the total amount owed by the given borrower.
823
824
=cut
825
826
sub GetTotalFines {
827
    my ( $borrowernumber ) = @_;
828
    my $dbh = C4::Context->dbh();
829
    my $query = "SELECT SUM( amountoutstanding ) AS total FROM accountlines WHERE borrowernumber = ?";
830
    my $sth = $dbh->prepare( $query );
831
    $sth->execute( $borrowernumber );
832
    my $row = $sth->fetchrow_hashref();
833
    my $total = $row->{'total'};
834
    $total = $total || 0;
835
    return $total;
836
}
837
817
END { }    # module clean-up code here (global destructor)
838
END { }    # module clean-up code here (global destructor)
818
839
819
1;
840
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
=head2 GetIssuingRules
696
=head2 GetIssuingRules
717
697
(-)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