Lines 46-54
BEGIN {
Link Here
|
46 |
&getrefunds |
46 |
&getrefunds |
47 |
&chargelostitem |
47 |
&chargelostitem |
48 |
&ReversePayment |
48 |
&ReversePayment |
49 |
&makepartialpayment |
49 |
&makepartialpayment |
50 |
&recordpayment_selectaccts |
50 |
&recordpayment_selectaccts |
51 |
&WriteOffFee |
51 |
&WriteOffFee |
|
|
52 |
&purge_zero_balance_fees |
52 |
); |
53 |
); |
53 |
} |
54 |
} |
54 |
|
55 |
|
Lines 824-829
sub WriteOffFee {
Link Here
|
824 |
|
825 |
|
825 |
} |
826 |
} |
826 |
|
827 |
|
|
|
828 |
=head2 purge_zero_balance_fees |
829 |
|
830 |
purge_zero_balance_fees( $days ); |
831 |
|
832 |
Delete accountlines entries where amountoutstanding is 0 which are more than a given number of days old. |
833 |
|
834 |
B<$days> -- Zero balance fees older than B<$days> days old will be deleted. |
835 |
|
836 |
=cut |
837 |
|
838 |
sub purge_zero_balance_fees { |
839 |
my $days = shift; |
840 |
my $count = 0; |
841 |
|
842 |
my $dbh = C4::Context->dbh; |
843 |
my $sth = $dbh->prepare( |
844 |
q{ |
845 |
DELETE FROM accountlines |
846 |
WHERE date < date_sub(curdate(), INTERVAL ? DAY) |
847 |
AND amountoutstanding = 0; |
848 |
} |
849 |
); |
850 |
$sth->execute($days) or die $dbh->errstr; |
851 |
} |
852 |
|
827 |
END { } # module clean-up code here (global destructor) |
853 |
END { } # module clean-up code here (global destructor) |
828 |
|
854 |
|
829 |
1; |
855 |
1; |
830 |
- |
|
|