diff --git a/misc/cronjobs/cleanup_database.pl b/misc/cronjobs/cleanup_database.pl index e882b4bb59..ef013a1467 100755 --- a/misc/cronjobs/cleanup_database.pl +++ b/misc/cronjobs/cleanup_database.pl @@ -40,10 +40,11 @@ use C4::Search; use C4::Search::History; 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, @@ -134,6 +142,7 @@ unless ( $sessions || $purge_merged || $pImport || $pLogs + || $fees_days || $pSearchhistory || $pZ3950 || $pListShareInvites @@ -242,6 +251,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; C4::Search::History::delete({ interval => $pSearchhistory });