Bug 12478 : Fixing the tests in t/Koha_ElasticSearch_Indexer.t
[srvgit] / misc / cronjobs / cleanup_database.pl
index ef013a1..bb54256 100755 (executable)
@@ -35,7 +35,6 @@ BEGIN {
 }
 
 use C4::Context;
-use C4::Dates;
 use C4::Search;
 use C4::Search::History;
 use Getopt::Long;
@@ -63,7 +62,12 @@ 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.
+                      In the case of --feees, DAYS must be greater than
+                      or equal to 1.
+                      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.
@@ -79,28 +83,23 @@ USAGE
     exit $_[0];
 }
 
-my (
-    $help,
-    $sessions,
-    $sess_days,
-    $verbose,
-    $zebraqueue_days,
-    $mail,
-    $purge_merged,
-    $pImport,
-    $pLogs,
-    $pSearchhistory,
-    $pZ3950,
-    $pListShareInvites,
-    $pDebarments,
-    $allDebarments,
-    $pExpSelfReg,
-    $pUnvSelfReg,
-    $fees_days
-    $help,   $sessions,          $sess_days, $verbose, $zebraqueue_days,
-    $mail,   $purge_merged,      $pImport,   $pLogs,   $pSearchhistory,
-    $pZ3950, $pListShareInvites, $pDebarments, $allDebarments,
-);
+my $help;
+my $sessions;
+my $sess_days;
+my $verbose;
+my $zebraqueue_days;
+my $mail;
+my $purge_merged;
+my $pImport;
+my $pLogs;
+my $pSearchhistory;
+my $pZ3950;
+my $pListShareInvites;
+my $pDebarments;
+my $allDebarments;
+my $pExpSelfReg;
+my $pUnvSelfReg;
+my $fees_days;
 
 GetOptions(
     'h|help'          => \$help,
@@ -365,7 +364,7 @@ sub PurgeZ3950 {
 }
 
 sub PurgeDebarments {
-    require Koha::Borrower::Debarments;
+    require Koha::Patron::Debarments;
     my $days = shift;
     $count = 0;
     $sth   = $dbh->prepare(
@@ -377,7 +376,7 @@ sub PurgeDebarments {
     );
     $sth->execute($days) or die $dbh->errstr;
     while ( my ($borrower_debarment_id) = $sth->fetchrow_array ) {
-        Koha::Borrower::Debarments::DelDebarment($borrower_debarment_id);
+        Koha::Patron::Debarments::DelDebarment($borrower_debarment_id);
         $count++;
     }
     return $count;