View | Details | Raw Unified | Return to bug 14402
Collapse All | Expand All

(-)a/misc/cronjobs/cleanup_database.pl (-22 / +19 lines)
Lines 64-69 Usage: $0 [-h|--help] [--sessions] [--sessdays DAYS] [-v|--verbose] [--zebraqueu Link Here
64
                      of Z39.50 searches
64
                      of Z39.50 searches
65
   --fees DAYS        purge entries accountlines older than DAYS days, where
65
   --fees DAYS        purge entries accountlines older than DAYS days, where
66
                      amountoutstanding is 0 or NULL.
66
                      amountoutstanding is 0 or NULL.
67
                      In the case of --feees, DAYS must be greater than
68
                      or equal to 1.
67
                      WARNING: Fees and payments may not be deleted together.
69
                      WARNING: Fees and payments may not be deleted together.
68
                      This will not affect the account balance but may be
70
                      This will not affect the account balance but may be
69
                      confusing to staff.
71
                      confusing to staff.
Lines 82-109 USAGE Link Here
82
    exit $_[0];
84
    exit $_[0];
83
}
85
}
84
86
85
my (
87
my $help;
86
    $help,
88
my $sessions;
87
    $sessions,
89
my $sess_days;
88
    $sess_days,
90
my $verbose;
89
    $verbose,
91
my $zebraqueue_days;
90
    $zebraqueue_days,
92
my $mail;
91
    $mail,
93
my $purge_merged;
92
    $purge_merged,
94
my $pImport;
93
    $pImport,
95
my $pLogs;
94
    $pLogs,
96
my $pSearchhistory;
95
    $pSearchhistory,
97
my $pZ3950;
96
    $pZ3950,
98
my $pListShareInvites;
97
    $pListShareInvites,
99
my $pDebarments;
98
    $pDebarments,
100
my $allDebarments;
99
    $allDebarments,
101
my $pExpSelfReg;
100
    $pExpSelfReg,
102
my $pUnvSelfReg;
101
    $pUnvSelfReg,
103
my $fees_days;
102
    $fees_days
103
    $help,   $sessions,          $sess_days, $verbose, $zebraqueue_days,
104
    $mail,   $purge_merged,      $pImport,   $pLogs,   $pSearchhistory,
105
    $pZ3950, $pListShareInvites, $pDebarments, $allDebarments,
106
);
107
104
108
GetOptions(
105
GetOptions(
109
    'h|help'          => \$help,
106
    'h|help'          => \$help,
(-)a/t/db_dependent/Accounts.t (-6 / +9 lines)
Lines 81-87 $context->mock( 'userenv', sub { Link Here
81
# 1 => yesterday
81
# 1 => yesterday
82
# etc.
82
# etc.
83
83
84
$sth = $dbh->prepare(
84
my $sth = $dbh->prepare(
85
    "INSERT INTO accountlines (
85
    "INSERT INTO accountlines (
86
         borrowernumber,
86
         borrowernumber,
87
         amountoutstanding,
87
         amountoutstanding,
Lines 99-113 my @test_data = ( Link Here
99
    { amount => 0     , days_ago => $days     , description =>'purge_zero_balance_fees should not delete 0 balance fees with date on threshold day'          , delete => 0 } ,
99
    { amount => 0     , days_ago => $days     , description =>'purge_zero_balance_fees should not delete 0 balance fees with date on threshold day'          , delete => 0 } ,
100
    { amount => 0     , days_ago => $days + 1 , description =>'purge_zero_balance_fees should delete 0 balance fees with date after threshold day'           , delete => 1 } ,
100
    { amount => 0     , days_ago => $days + 1 , description =>'purge_zero_balance_fees should delete 0 balance fees with date after threshold day'           , delete => 1 } ,
101
    { amount => undef , days_ago => $days + 1 , description =>'purge_zero_balance_fees should delete NULL balance fees with date after threshold day'        , delete => 1 } ,
101
    { amount => undef , days_ago => $days + 1 , description =>'purge_zero_balance_fees should delete NULL balance fees with date after threshold day'        , delete => 1 } ,
102
    { amount => 5     , days_ago => $days - 1 , description =>'purge_zero_balance_fees should not delete fees with postive amout owed before threshold day'  , delete => 0 } ,
102
    { amount => 5     , days_ago => $days - 1 , description =>'purge_zero_balance_fees should not delete fees with positive amout owed before threshold day'  , delete => 0 } ,
103
    { amount => 5     , days_ago => $days     , description =>'purge_zero_balance_fees should not delete fees with postive amout owed on threshold day'      , delete => 0 } ,
103
    { amount => 5     , days_ago => $days     , description =>'purge_zero_balance_fees should not delete fees with positive amout owed on threshold day'      , delete => 0 } ,
104
    { amount => 5     , days_ago => $days + 1 , description =>'purge_zero_balance_fees should not delete fees with postive amout owed after threshold day'   , delete => 0 } ,
104
    { amount => 5     , days_ago => $days + 1 , description =>'purge_zero_balance_fees should not delete fees with positive amout owed after threshold day'   , delete => 0 } ,
105
    { amount => -5    , days_ago => $days - 1 , description =>'purge_zero_balance_fees should not delete fees with negative amout owed before threshold day' , delete => 0 } ,
105
    { amount => -5    , days_ago => $days - 1 , description =>'purge_zero_balance_fees should not delete fees with negative amout owed before threshold day' , delete => 0 } ,
106
    { amount => -5    , days_ago => $days     , description =>'purge_zero_balance_fees should not delete fees with negative amout owed on threshold day'     , delete => 0 } ,
106
    { amount => -5    , days_ago => $days     , description =>'purge_zero_balance_fees should not delete fees with negative amout owed on threshold day'     , delete => 0 } ,
107
    { amount => -5    , days_ago => $days + 1 , description =>'purge_zero_balance_fees should not delete fees with negative amout owed after threshold day'  , delete => 0 }
107
    { amount => -5    , days_ago => $days + 1 , description =>'purge_zero_balance_fees should not delete fees with negative amout owed after threshold day'  , delete => 0 }
108
);
108
);
109
109
110
for my $data  ( @test_data ) {
110
my $borrower = Koha::Borrower->new( { firstname => 'Test', surname => 'Patron', categorycode => 'PT', branchcode => 'MPL' } )->store();
111
112
for my $data ( @test_data ) {
111
    $sth->execute($borrower->borrowernumber, $data->{amount}, $data->{days_ago}, $data->{description});
113
    $sth->execute($borrower->borrowernumber, $data->{amount}, $data->{days_ago}, $data->{description});
112
}
114
}
113
115
Lines 132-137 for my $data (@test_data) { Link Here
132
    is_delete_correct( $data->{delete}, $data->{description});
134
    is_delete_correct( $data->{delete}, $data->{description});
133
}
135
}
134
136
137
$dbh->do(q|DELETE FROM accountlines|);
138
135
subtest "recordpayment() tests" => sub {
139
subtest "recordpayment() tests" => sub {
136
140
137
    plan tests => 10;
141
    plan tests => 10;
138
- 

Return to bug 14402