Bugzilla – Attachment 42480 Details for
Bug 14402
Add --fees option to cleanup_database.pl to purge all 0 balance fees and payments older than the given number of days
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED-OFF] bug 14402: Make purge_zero_balance_fees() delete fees with NULL balance.
SIGNED-OFF-bug-14402-Make-purgezerobalancefees-del.patch (text/plain), 6.74 KB, created by
Barton Chittenden
on 2015-09-10 22:55:25 UTC
(
hide
)
Description:
[SIGNED-OFF] bug 14402: Make purge_zero_balance_fees() delete fees with NULL balance.
Filename:
MIME Type:
Creator:
Barton Chittenden
Created:
2015-09-10 22:55:25 UTC
Size:
6.74 KB
patch
obsolete
>From c2242317da01a0fe63a1e3bbc89e728147ee192d Mon Sep 17 00:00:00 2001 >From: Barton <barton@bywatersolutions.com> >Date: Thu, 10 Sep 2015 22:03:43 +0000 >Subject: [PATCH] [SIGNED-OFF] bug 14402: Make purge_zero_balance_fees() > delete fees with NULL balance. > >Also, add notes to perldocs and usage that payments and >credits are not linked to fines and may be deleted >independently of the associated fine. > >Signed-off-by: Nancy Keener <nkeener@washoecounty.us> >--- > C4/Accounts.pm | 9 +++++++-- > misc/cronjobs/cleanup_database.pl | 5 ++++- > t/db_dependent/Accounts.t | 23 ++++++++++++----------- > 3 files changed, 23 insertions(+), 14 deletions(-) > >diff --git a/C4/Accounts.pm b/C4/Accounts.pm >index 4b67dce..4f5f8d4 100644 >--- a/C4/Accounts.pm >+++ b/C4/Accounts.pm >@@ -829,10 +829,15 @@ sub WriteOffFee { > > purge_zero_balance_fees( $days ); > >-Delete accountlines entries where amountoutstanding is 0 which are more than a given number of days old. >+Delete accountlines entries where amountoutstanding is 0 or NULL which are more than a given number of days old. > > B<$days> -- Zero balance fees older than B<$days> days old will be deleted. > >+B<Warning:> Because fines and payments are not linked in accountlines, it is >+possible for a fine to be deleted without the accompanying payment, >+or vise versa. This won't affect the account balance, but might be >+confusing to staff. >+ > =cut > > sub purge_zero_balance_fees { >@@ -844,7 +849,7 @@ sub purge_zero_balance_fees { > q{ > DELETE FROM accountlines > WHERE date < date_sub(curdate(), INTERVAL ? DAY) >- AND amountoutstanding = 0; >+ AND ( amountoutstanding = 0 or amountoutstanding IS NULL ); > } > ); > $sth->execute($days) or die $dbh->errstr; >diff --git a/misc/cronjobs/cleanup_database.pl b/misc/cronjobs/cleanup_database.pl >index c79e4f0..3ef4231 100755 >--- a/misc/cronjobs/cleanup_database.pl >+++ b/misc/cronjobs/cleanup_database.pl >@@ -62,7 +62,10 @@ Usage: $0 [-h|--help] [--sessions] [--sessdays DAYS] [-v|--verbose] [--zebraqueu > --z3950 purge records from import tables that are the result > of Z39.50 searches > --fees DAYS purge entries accountlines older than DAYS days, where >- amountoutstanding is 0. >+ amountoutstanding is 0 or NULL. >+ WARNING: Fees and payments may not be deleted together. >+ This will not affect the account balance but may be >+ confusing to staff. > --logs DAYS purge entries from action_logs older than DAYS days. > Defaults to 180 days if no days specified. > --searchhistory DAYS purge entries from search_history older than DAYS days. >diff --git a/t/db_dependent/Accounts.t b/t/db_dependent/Accounts.t >index 61ec951..531500b 100644 >--- a/t/db_dependent/Accounts.t >+++ b/t/db_dependent/Accounts.t >@@ -18,7 +18,7 @@ > > use Modern::Perl; > >-use Test::More tests => 18; >+use Test::More tests => 19; > use Test::MockModule; > use Test::Warn; > >@@ -90,16 +90,17 @@ $sth = $dbh->prepare( > my $days = 5; > > my @test_data = ( >- { amount => 0 , days_ago => 0 , description =>'purge_zero_balance_fees should not delete 0 balance fees with date today' , delete => 0 } , >- { amount => 0 , days_ago => $days - 1 , description =>'purge_zero_balance_fees should not delete 0 balance fees with date before threshold day' , delete => 0 } , >- { amount => 0 , days_ago => $days , description =>'purge_zero_balance_fees should not delete 0 balance fees with date on threshold day' , delete => 0 } , >- { amount => 0 , days_ago => $days + 1 , description =>'purge_zero_balance_fees should delete 0 balance fees with date after threshold day' , delete => 1 } , >- { amount => 5 , days_ago => $days - 1 , description =>'purge_zero_balance_fees should not delete fees with postive amout owed before threshold day' , delete => 0 } , >- { amount => 5 , days_ago => $days , description =>'purge_zero_balance_fees should not delete fees with postive amout owed on threshold day' , delete => 0 } , >- { amount => 5 , days_ago => $days + 1 , description =>'purge_zero_balance_fees should not delete fees with postive amout owed after threshold day' , delete => 0 } , >- { amount => -5 , days_ago => $days - 1 , description =>'purge_zero_balance_fees should not delete fees with negative amout owed before threshold day' , delete => 0 } , >- { amount => -5 , days_ago => $days , description =>'purge_zero_balance_fees should not delete fees with negative amout owed on threshold day' , delete => 0 } , >- { amount => -5 , days_ago => $days + 1 , description =>'purge_zero_balance_fees should not delete fees with negative amout owed after threshold day' , delete => 0 } >+ { amount => 0 , days_ago => 0 , description =>'purge_zero_balance_fees should not delete 0 balance fees with date today' , delete => 0 } , >+ { amount => 0 , days_ago => $days - 1 , description =>'purge_zero_balance_fees should not delete 0 balance fees with date before threshold day' , delete => 0 } , >+ { amount => 0 , days_ago => $days , description =>'purge_zero_balance_fees should not delete 0 balance fees with date on threshold day' , delete => 0 } , >+ { amount => 0 , days_ago => $days + 1 , description =>'purge_zero_balance_fees should delete 0 balance fees with date after threshold day' , delete => 1 } , >+ { amount => undef , days_ago => $days + 1 , description =>'purge_zero_balance_fees should delete NULL balance fees with date after threshold day' , delete => 1 } , >+ { amount => 5 , days_ago => $days - 1 , description =>'purge_zero_balance_fees should not delete fees with postive amout owed before threshold day' , delete => 0 } , >+ { amount => 5 , days_ago => $days , description =>'purge_zero_balance_fees should not delete fees with postive amout owed on threshold day' , delete => 0 } , >+ { amount => 5 , days_ago => $days + 1 , description =>'purge_zero_balance_fees should not delete fees with postive amout owed after threshold day' , delete => 0 } , >+ { amount => -5 , days_ago => $days - 1 , description =>'purge_zero_balance_fees should not delete fees with negative amout owed before threshold day' , delete => 0 } , >+ { amount => -5 , days_ago => $days , description =>'purge_zero_balance_fees should not delete fees with negative amout owed on threshold day' , delete => 0 } , >+ { amount => -5 , days_ago => $days + 1 , description =>'purge_zero_balance_fees should not delete fees with negative amout owed after threshold day' , delete => 0 } > ); > > for my $data ( @test_data ) { >-- >1.7.10.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 14402
:
41043
|
41086
|
41087
|
41088
|
42242
|
42243
|
42244
|
42245
|
42246
|
42477
|
42478
|
42479
|
42480
|
42556
|
42557
|
42815
|
42816
|
42817
|
42818
|
42819
|
42820
|
42993
|
42994
|
42995
|
42996
|
42997
|
44664