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

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

Return to bug 14402