From 1b19e072c0998b0ca6e4faf06baf00df5e2d5917 Mon Sep 17 00:00:00 2001 From: Barton Chittenden Date: Sat, 18 Jul 2015 13:29:29 -0700 Subject: [PATCH] Bug 14402: Add option --fees to /misc/cronjobs/cleanup_database.pl This will call C4::Accounts::purge_zero_balance_fees to remove all rows from accountlines which have 0 balance, and are more than DAYS old. Test plan: Run: t/db_dependent/Accounts.t If all unit tests pass, the --fees option to /misc/cronjobs/cleanup_database.pl should act as documented, because it is a straight pass-through to C4::Accounts::purge_zero_balance_fees(). http://bugs.koha-community.org/show_bug.cgi?id=14402 Signed-off-by: Nancy Keener --- misc/cronjobs/cleanup_database.pl | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/misc/cronjobs/cleanup_database.pl b/misc/cronjobs/cleanup_database.pl index 0766141..c79e4f0 100755 --- a/misc/cronjobs/cleanup_database.pl +++ b/misc/cronjobs/cleanup_database.pl @@ -39,10 +39,11 @@ use C4::Dates; use C4::Search; use Getopt::Long; use C4::Log; +use C4::Accounts; sub usage { print STDERR < \$pImport, 'z3950' => \$pZ3950, 'logs:i' => \$pLogs, + 'fees:i' => \$fees_days, 'searchhistory:i' => \$pSearchhistory, 'list-invites:i' => \$pListShareInvites, 'restrictions:i' => \$pDebarments, @@ -133,6 +141,7 @@ unless ( $sessions || $purge_merged || $pImport || $pLogs + || $fees_days || $pSearchhistory || $pZ3950 || $pListShareInvites @@ -241,6 +250,12 @@ if ($pLogs) { print "Done with purging action_logs.\n" if $verbose; } +if ($fees_days) { + print "Purging records from accountlines.\n" if $verbose; + purge_zero_balance_fees( $fees_days ); + print "Done purging records from accountlines.\n" if $verbose; +} + if ($pSearchhistory) { print "Purging records older than $pSearchhistory from search_history.\n" if $verbose; PurgeSearchHistory($pSearchhistory); -- 1.7.10.4