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 <nkeener@washoecounty.us> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
85431368be
commit
9f6ac9be11
1 changed files with 16 additions and 1 deletions
|
@ -40,10 +40,11 @@ use C4::Search;
|
|||
use C4::Search::History;
|
||||
use Getopt::Long;
|
||||
use C4::Log;
|
||||
use C4::Accounts;
|
||||
|
||||
sub usage {
|
||||
print STDERR <<USAGE;
|
||||
Usage: $0 [-h|--help] [--sessions] [--sessdays DAYS] [-v|--verbose] [--zebraqueue DAYS] [-m|--mail] [--merged] [--import DAYS] [--logs DAYS] [--searchhistory DAYS] [--restrictions DAYS] [--all-restrictions]
|
||||
Usage: $0 [-h|--help] [--sessions] [--sessdays DAYS] [-v|--verbose] [--zebraqueue DAYS] [-m|--mail] [--merged] [--import DAYS] [--logs DAYS] [--searchhistory DAYS] [--restrictions DAYS] [--all-restrictions] [--fees DAYS]
|
||||
|
||||
-h --help prints this help message, and exits, ignoring all
|
||||
other options
|
||||
|
@ -61,6 +62,8 @@ Usage: $0 [-h|--help] [--sessions] [--sessdays DAYS] [-v|--verbose] [--zebraqueu
|
|||
Defaults to 60 days if no days specified.
|
||||
--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.
|
||||
--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.
|
||||
|
@ -93,6 +96,10 @@ my (
|
|||
$allDebarments,
|
||||
$pExpSelfReg,
|
||||
$pUnvSelfReg,
|
||||
$fees_days
|
||||
$help, $sessions, $sess_days, $verbose, $zebraqueue_days,
|
||||
$mail, $purge_merged, $pImport, $pLogs, $pSearchhistory,
|
||||
$pZ3950, $pListShareInvites, $pDebarments, $allDebarments,
|
||||
);
|
||||
|
||||
GetOptions(
|
||||
|
@ -106,6 +113,7 @@ GetOptions(
|
|||
'import:i' => \$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 });
|
||||
|
|
Loading…
Reference in a new issue