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

(-)a/misc/cronjobs/advance_notices.pl (-1 / +1 lines)
Lines 186-191 my $help = 0; Link Here
186
my $man     = 0;
186
my $man     = 0;
187
187
188
my $command_line_options = join(" ",@ARGV);
188
my $command_line_options = join(" ",@ARGV);
189
cronlogaction({ info => $command_line_options });
189
190
190
GetOptions(
191
GetOptions(
191
            'help|?'         => \$help,
192
            'help|?'         => \$help,
Lines 217-223 END_WARN Link Here
217
unless ($confirm) {
218
unless ($confirm) {
218
     pod2usage(1);
219
     pod2usage(1);
219
}
220
}
220
cronlogaction({ info => $command_line_options });
221
221
222
my %branches = ();
222
my %branches = ();
223
if (@branchcodes) {
223
if (@branchcodes) {
(-)a/misc/cronjobs/automatic_item_modification_by_age.pl (-1 / +1 lines)
Lines 12-17 use C4::Items; Link Here
12
use C4::Log qw( cronlogaction );
12
use C4::Log qw( cronlogaction );
13
13
14
my $command_line_options = join(" ",@ARGV);
14
my $command_line_options = join(" ",@ARGV);
15
cronlogaction({ info => $command_line_options });
15
16
16
# Getting options
17
# Getting options
17
my ( $verbose, $help, $confirm );
18
my ( $verbose, $help, $confirm );
Lines 30-36 my $rules = eval { JSON::from_json( $syspref_content ) }; Link Here
30
pod2usage({ -message => "Unable to load the configuration : $@", -exitval => 1 })
31
pod2usage({ -message => "Unable to load the configuration : $@", -exitval => 1 })
31
    if $@;
32
    if $@;
32
33
33
cronlogaction({ info => $command_line_options });
34
34
35
my $report = C4::Items::ToggleNewStatus( { rules => $rules, report_only => not $confirm } );
35
my $report = C4::Items::ToggleNewStatus( { rules => $rules, report_only => not $confirm } );
36
36
(-)a/misc/cronjobs/automatic_renewals.pl (-2 / +1 lines)
Lines 88-93 use Koha::Libraries; Link Here
88
use Koha::Patrons;
88
use Koha::Patrons;
89
89
90
my $command_line_options = join( " ", @ARGV );
90
my $command_line_options = join( " ", @ARGV );
91
cronlogaction( { info => $command_line_options } );
91
92
92
my ( $help, $send_notices, $verbose, $confirm, $digest_per_branch );
93
my ( $help, $send_notices, $verbose, $confirm, $digest_per_branch );
93
GetOptions(
94
GetOptions(
Lines 130-137 To change this, edit the "EnhancedMessagingPreferences" syspref. Link Here
130
END_WARN
131
END_WARN
131
}
132
}
132
133
133
cronlogaction( { info => $command_line_options } );
134
135
$verbose = 1            unless $verbose or $confirm;
134
$verbose = 1            unless $verbose or $confirm;
136
print "Test run only\n" unless $confirm;
135
print "Test run only\n" unless $confirm;
137
136
(-)a/misc/cronjobs/batch_anonymise.pl (-2 / +1 lines)
Lines 44-49 USAGE Link Here
44
}
44
}
45
45
46
my $command_line_options = join(" ",@ARGV);
46
my $command_line_options = join(" ",@ARGV);
47
cronlogaction({ info => $command_line_options });
47
48
48
my ( $help, $days, $verbose );
49
my ( $help, $days, $verbose );
49
50
Lines 62-69 if ( !$days ) { Link Here
62
    usage(1);
63
    usage(1);
63
}
64
}
64
65
65
cronlogaction({ info => $command_line_options });
66
67
my $date = dt_from_string->subtract( days => $days );
66
my $date = dt_from_string->subtract( days => $days );
68
67
69
print "Checkouts and holds before " . output_pref( { dt => $date, dateformat => 'iso', dateonly => 1 } ) . " will be anonymised.\n"
68
print "Checkouts and holds before " . output_pref( { dt => $date, dateformat => 'iso', dateonly => 1 } ) . " will be anonymised.\n"
(-)a/misc/cronjobs/build_browser_and_cloud.pl (-2 / +1 lines)
Lines 16-21 use C4::Log; Link Here
16
use Koha::Biblios;
16
use Koha::Biblios;
17
17
18
my $command_line_options = join(" ",@ARGV);
18
my $command_line_options = join(" ",@ARGV);
19
cronlogaction({ info => $command_line_options });
19
20
20
my ( $input_marc_file, $number) = ('',0);
21
my ( $input_marc_file, $number) = ('',0);
21
my ($version, $confirm,$field,$batch,$max_digits,$cloud_tag);
22
my ($version, $confirm,$field,$batch,$max_digits,$cloud_tag);
Lines 59-66 my $browser_subfield = $2; Link Here
59
warn "browser : $browser_tag / $browser_subfield" unless $batch;
60
warn "browser : $browser_tag / $browser_subfield" unless $batch;
60
die "no cloud or browser field/subfield defined : nothing to do !" unless $browser_tag or $cloud_tag;
61
die "no cloud or browser field/subfield defined : nothing to do !" unless $browser_tag or $cloud_tag;
61
62
62
cronlogaction({ info => $command_line_options });
63
64
my $dbh = C4::Context->dbh;
63
my $dbh = C4::Context->dbh;
65
64
66
my $i=0;
65
my $i=0;
(-)a/misc/cronjobs/cart_to_shelf.pl (-2 / +1 lines)
Lines 38-43 use Getopt::Long qw( GetOptions ); Link Here
38
my $hours = 0;
38
my $hours = 0;
39
39
40
my $command_line_options = join(" ",@ARGV);
40
my $command_line_options = join(" ",@ARGV);
41
cronlogaction({ info => $command_line_options });
41
42
42
GetOptions( 'h|hours=s' => \$hours, );
43
GetOptions( 'h|hours=s' => \$hours, );
43
44
Lines 60-67 unless ($hours) { Link Here
60
    die "ERROR: No --hours (-h) option defined";
61
    die "ERROR: No --hours (-h) option defined";
61
}
62
}
62
63
63
cronlogaction({ info => $command_line_options });
64
65
my $query = "SELECT itemnumber FROM items WHERE location = 'CART' AND TIMESTAMPDIFF(HOUR, items.timestamp, NOW() ) > ?";
64
my $query = "SELECT itemnumber FROM items WHERE location = 'CART' AND TIMESTAMPDIFF(HOUR, items.timestamp, NOW() ) > ?";
66
my $sth = C4::Context->dbh->prepare($query);
65
my $sth = C4::Context->dbh->prepare($query);
67
$sth->execute($hours);
66
$sth->execute($hours);
(-)a/misc/cronjobs/cleanup_database.pl (-1 / +1 lines)
Lines 174-179 my $reports; Link Here
174
my $edifact_msg_days;
174
my $edifact_msg_days;
175
175
176
my $command_line_options = join( " ", @ARGV );
176
my $command_line_options = join( " ", @ARGV );
177
cronlogaction( { info => $command_line_options } );
177
178
178
GetOptions(
179
GetOptions(
179
    'h|help'                     => \$help,
180
    'h|help'                     => \$help,
Lines 297-303 if ( $pDebarments && $allDebarments ) { Link Here
297
298
298
say "Confirm flag not passed, running in dry-run mode..." unless $confirm;
299
say "Confirm flag not passed, running in dry-run mode..." unless $confirm;
299
300
300
cronlogaction( { info => $command_line_options } );
301
301
302
my $dbh = C4::Context->dbh();
302
my $dbh = C4::Context->dbh();
303
my $sth;
303
my $sth;
(-)a/misc/cronjobs/cloud-kw.pl (-2 / +1 lines)
Lines 35-40 my $help = 0; Link Here
35
my $conf        = '';
35
my $conf        = '';
36
36
37
my $command_line_options = join(" ",@ARGV);
37
my $command_line_options = join(" ",@ARGV);
38
cronlogaction({ info => $command_line_options });
38
39
39
GetOptions( 
40
GetOptions( 
40
    'verbose'   => \$verbose,
41
    'verbose'   => \$verbose,
Lines 49-56 sub usage { Link Here
49
50
50
usage() if $help || !$conf;
51
usage() if $help || !$conf;
51
52
52
cronlogaction({ info => $command_line_options });
53
54
my @clouds;
53
my @clouds;
55
print "Reading configuration file: $conf\n" if $verbose;
54
print "Reading configuration file: $conf\n" if $verbose;
56
eval {
55
eval {
(-)a/misc/cronjobs/debar_patrons_with_fines.pl (-1 / +5 lines)
Lines 76-81 use Koha::Patron::Debarments; Link Here
76
76
77
use C4::Log qw( cronlogaction );
77
use C4::Log qw( cronlogaction );
78
78
79
my $command_line_options = join(" ",@ARGV);
80
cronlogaction({ info => $command_line_options });
81
79
my ( $amount, $help, $confirm, $message, $expiration, $file, $verbose );
82
my ( $amount, $help, $confirm, $message, $expiration, $file, $verbose );
80
GetOptions(
83
GetOptions(
81
    'a|amount:i'     => \$amount,
84
    'a|amount:i'     => \$amount,
Lines 89-95 GetOptions( Link Here
89
pod2usage(1) if $help;
92
pod2usage(1) if $help;
90
pod2usage(1) unless $message || $file;
93
pod2usage(1) unless $message || $file;
91
94
92
cronlogaction();
93
my $patrons = Koha::Patrons->filter_by_amount_owed( { more_than => $amount // 0 } );
95
my $patrons = Koha::Patrons->filter_by_amount_owed( { more_than => $amount // 0 } );
94
$message = getMessageContent();
96
$message = getMessageContent();
95
97
Lines 126-131 my $verb = $confirm ? 'Debarred' : 'Found'; Link Here
126
print "debar_patrons_with_fines: $verb $count_patrons patrons";
128
print "debar_patrons_with_fines: $verb $count_patrons patrons";
127
print( $errors ? ", had $errors failures\n" : "\n" );
129
print( $errors ? ", had $errors failures\n" : "\n" );
128
130
131
cronlogaction({ action => 'End', info => "COMPLETED" });
132
129
sub getMessageContent {
133
sub getMessageContent {
130
    return $message if ($message);
134
    return $message if ($message);
131
    open( my $FH, "<:encoding(UTF-8)", $file ) or die "Could not open $file: $!\n";
135
    open( my $FH, "<:encoding(UTF-8)", $file ) or die "Could not open $file: $!\n";
(-)a/misc/cronjobs/delete_patrons.pl (-2 / +1 lines)
Lines 15-20 my ( $help, $verbose, $not_borrowed_since, $expired_before, $last_seen, Link Here
15
    @category_code, $branchcode, $file, $confirm );
15
    @category_code, $branchcode, $file, $confirm );
16
16
17
my $command_line_options = join(" ",@ARGV);
17
my $command_line_options = join(" ",@ARGV);
18
cronlogaction({ info => $command_line_options });
18
19
19
GetOptions(
20
GetOptions(
20
    'h|help'                 => \$help,
21
    'h|help'                 => \$help,
Lines 46-53 unless ( $not_borrowed_since or $expired_before or $last_seen or @category_code Link Here
46
    pod2usage(q{At least one filter is mandatory});
47
    pod2usage(q{At least one filter is mandatory});
47
}
48
}
48
49
49
cronlogaction({ info => $command_line_options });
50
51
my @file_members;
50
my @file_members;
52
if ($file) {
51
if ($file) {
53
    open(my $fh, '<:encoding(UTF-8)', $file) or die "Could not open file $file' $!";
52
    open(my $fh, '<:encoding(UTF-8)', $file) or die "Could not open file $file' $!";
(-)a/misc/cronjobs/erm_run_harvester.pl (-2 / +1 lines)
Lines 100-105 C<erm_run_harvester.pl --begin-date 2000-01-01 --end-date 2024-01-01 --debug --d Link Here
100
=cut
100
=cut
101
101
102
my $command_line_options = join( " ", @ARGV );
102
my $command_line_options = join( " ", @ARGV );
103
cronlogaction( { info => $command_line_options } );
103
104
104
# Command line option values
105
# Command line option values
105
my $help       = 0;
106
my $help       = 0;
Lines 131-138 unless ($begin_date) { Link Here
131
    pod2usage(1);
132
    pod2usage(1);
132
}
133
}
133
134
134
cronlogaction( { info => $command_line_options } );
135
136
debug_msg("Dry run: Harvests will not be enqueued") if $dry_run;
135
debug_msg("Dry run: Harvests will not be enqueued") if $dry_run;
137
while ( my $udprovider = $udproviders->next ) {
136
while ( my $udprovider = $udproviders->next ) {
138
    debug_msg(
137
    debug_msg(
(-)a/misc/cronjobs/fines.pl (-2 / +1 lines)
Lines 51-56 my $maxdays; Link Here
51
my $verify_issue;
51
my $verify_issue;
52
52
53
my $command_line_options = join(" ",@ARGV);
53
my $command_line_options = join(" ",@ARGV);
54
cronlogaction({ info => $command_line_options });
54
55
55
GetOptions(
56
GetOptions(
56
    'h|help'    => \$help,
57
    'h|help'    => \$help,
Lines 96-103 catch { Link Here
96
    exit;
97
    exit;
97
};
98
};
98
99
99
cronlogaction({ info => $command_line_options });
100
101
my @borrower_fields =
100
my @borrower_fields =
102
  qw(cardnumber categorycode surname firstname email phone address citystate);
101
  qw(cardnumber categorycode surname firstname email phone address citystate);
103
my @item_fields  = qw(itemnumber barcode date_due);
102
my @item_fields  = qw(itemnumber barcode date_due);
(-)a/misc/cronjobs/gather_print_notices.pl (-2 / +1 lines)
Lines 30-35 my ( Link Here
30
);
30
);
31
31
32
my $command_line_options = join(" ",@ARGV);
32
my $command_line_options = join(" ",@ARGV);
33
cronlogaction({ info => $command_line_options });
33
34
34
$send = 1;
35
$send = 1;
35
GetOptions(
36
GetOptions(
Lines 74-81 if ( $ods and @letter_codes != 1 ) { Link Here
74
75
75
$delimiter ||= q|,|;
76
$delimiter ||= q|,|;
76
77
77
cronlogaction({ info => $command_line_options });
78
79
my $today_iso     = output_pref( { dt => dt_from_string, dateonly => 1, dateformat => 'iso' } ) ;
78
my $today_iso     = output_pref( { dt => dt_from_string, dateonly => 1, dateformat => 'iso' } ) ;
80
my $today_syspref = output_pref( { dt => dt_from_string, dateonly => 1 } );
79
my $today_syspref = output_pref( { dt => dt_from_string, dateonly => 1 } );
81
80
(-)a/misc/cronjobs/harvest_oai.pl (-2 / +1 lines)
Lines 29-34 use C4::Log qw( cronlogaction ); Link Here
29
use Try::Tiny qw( catch try );
29
use Try::Tiny qw( catch try );
30
30
31
my $command_line_options = join( " ", @ARGV );
31
my $command_line_options = join( " ", @ARGV );
32
cronlogaction( { info => $command_line_options } );
32
33
33
my ( $help, $verbose, $id, $days, $list, $force );
34
my ( $help, $verbose, $id, $days, $list, $force );
34
35
Lines 99-106 try { Link Here
99
    exit;
100
    exit;
100
};
101
};
101
102
102
cronlogaction( { info => $command_line_options } );
103
104
my $harvester =
103
my $harvester =
105
    Koha::OAI::Client::Harvester->new( { server => $server, days => $days, force => $force, logger => \&logFunction } );
104
    Koha::OAI::Client::Harvester->new( { server => $server, days => $days, force => $force, logger => \&logFunction } );
106
$harvester->init();
105
$harvester->init();
(-)a/misc/cronjobs/holds/build_holds_queue.pl (-2 / +1 lines)
Lines 65-70 my $force = 0; Link Here
65
my $unallocated = 0;
65
my $unallocated = 0;
66
66
67
my $command_line_options = join( " ", @ARGV );
67
my $command_line_options = join( " ", @ARGV );
68
cronlogaction( { info => $command_line_options } );
68
69
69
GetOptions(
70
GetOptions(
70
    'h|help'        => \$help,
71
    'h|help'        => \$help,
Lines 83-90 if ( $rthq && !$force ) { Link Here
83
    exit(1);
84
    exit(1);
84
}
85
}
85
86
86
cronlogaction( { info => $command_line_options } );
87
88
my $loops = C4::Context->preference('HoldsQueueParallelLoopsCount');
87
my $loops = C4::Context->preference('HoldsQueueParallelLoopsCount');
89
CreateQueue( { loops => $loops, unallocated => $unallocated } );
88
CreateQueue( { loops => $loops, unallocated => $unallocated } );
90
89
(-)a/misc/cronjobs/holds/cancel_expired_holds.pl (-2 / +1 lines)
Lines 66-71 my $help = 0; Link Here
66
my $reason;
66
my $reason;
67
67
68
my $command_line_options = join(" ",@ARGV);
68
my $command_line_options = join(" ",@ARGV);
69
cronlogaction({ info => $command_line_options });
69
70
70
GetOptions(
71
GetOptions(
71
    'help|?'   => \$help,
72
    'help|?'   => \$help,
Lines 73-80 GetOptions( Link Here
73
) or pod2usage(1);
74
) or pod2usage(1);
74
pod2usage(1) if $help;
75
pod2usage(1) if $help;
75
76
76
cronlogaction({ info => $command_line_options });
77
78
C4::Reserves::CancelExpiredReserves($reason);
77
C4::Reserves::CancelExpiredReserves($reason);
79
78
80
cronlogaction({ action => 'End', info => "COMPLETED" });
79
cronlogaction({ action => 'End', info => "COMPLETED" });
(-)a/misc/cronjobs/holds/cancel_unfilled_holds.pl (-2 / +1 lines)
Lines 86-91 my $confirm = 0; Link Here
86
my $reason;
86
my $reason;
87
87
88
my $command_line_options = join(" ",@ARGV);
88
my $command_line_options = join(" ",@ARGV);
89
cronlogaction({ info => $command_line_options });
89
90
90
GetOptions(
91
GetOptions(
91
    'h|help|?'   => \$help,
92
    'h|help|?'   => \$help,
Lines 108-115 qq{\nError: You must specify a value for days waiting to cancel holds.\n}, Link Here
108
    );
109
    );
109
}
110
}
110
111
111
cronlogaction({ info => $command_line_options });
112
113
warn "Running in test mode, no actions will be taken" unless ($confirm);
112
warn "Running in test mode, no actions will be taken" unless ($confirm);
114
113
115
$verbose and warn "Looking for unfilled holds placed $days or more days ago\n";
114
$verbose and warn "Looking for unfilled holds placed $days or more days ago\n";
(-)a/misc/cronjobs/holds/holds_reminder.pl (-2 / +1 lines)
Lines 177-182 my $opt_out = 0; Link Here
177
my @mtts;
177
my @mtts;
178
178
179
my $command_line_options = join(" ",@ARGV);
179
my $command_line_options = join(" ",@ARGV);
180
cronlogaction({ info => $command_line_options });
180
181
181
GetOptions(
182
GetOptions(
182
    'help|?'       => \$help,
183
    'help|?'       => \$help,
Lines 196-203 pod2usage( -verbose => 2 ) if $man; Link Here
196
197
197
$lettercode ||= 'HOLD_REMINDER';
198
$lettercode ||= 'HOLD_REMINDER';
198
199
199
cronlogaction({ info => $command_line_options });
200
201
# Unless a delay is specified by the user we target all waiting holds
200
# Unless a delay is specified by the user we target all waiting holds
202
unless (defined $days) {
201
unless (defined $days) {
203
    $days=0;
202
    $days=0;
(-)a/misc/cronjobs/longoverdue.pl (-2 / +1 lines)
Lines 56-61 my $list_itemtypes = 0; Link Here
56
my @skip_lost_values;
56
my @skip_lost_values;
57
57
58
my $command_line_options = join(" ",@ARGV);
58
my $command_line_options = join(" ",@ARGV);
59
cronlogaction({ info => $command_line_options });
59
60
60
GetOptions(
61
GetOptions(
61
    'l|lost=s%'         => \$lost,
62
    'l|lost=s%'         => \$lost,
Lines 320-327 unless ($confirm) { Link Here
320
    print "### TEST MODE -- NO ACTIONS TAKEN ###\n";
321
    print "### TEST MODE -- NO ACTIONS TAKEN ###\n";
321
}
322
}
322
323
323
cronlogaction({ info => $command_line_options });
324
325
# In my opinion, this line is safe SQL to have outside the API. --atz
324
# In my opinion, this line is safe SQL to have outside the API. --atz
326
our $bounds_sth = C4::Context->dbh->prepare("SELECT DATE_SUB(CURDATE(), INTERVAL ? DAY)");
325
our $bounds_sth = C4::Context->dbh->prepare("SELECT DATE_SUB(CURDATE(), INTERVAL ? DAY)");
327
326
(-)a/misc/cronjobs/marc_ordering_process.pl (-2 / +1 lines)
Lines 67-72 use Koha::MarcOrderAccounts; Link Here
67
use C4::Log qw( cronlogaction );
67
use C4::Log qw( cronlogaction );
68
68
69
my $command_line_options = join( " ", @ARGV );
69
my $command_line_options = join( " ", @ARGV );
70
cronlogaction( { info => $command_line_options } );
70
71
71
my ( $help, $verbose, $confirm, $delete );
72
my ( $help, $verbose, $confirm, $delete );
72
GetOptions(
73
GetOptions(
Lines 78-85 GetOptions( Link Here
78
79
79
pod2usage(0) if $help;
80
pod2usage(0) if $help;
80
81
81
cronlogaction( { info => $command_line_options } );
82
83
$verbose = 1            unless $verbose or $confirm;
82
$verbose = 1            unless $verbose or $confirm;
84
print "Test run only\n" unless $confirm;
83
print "Test run only\n" unless $confirm;
85
84
(-)a/misc/cronjobs/membership_expiry.pl (-2 / +1 lines)
Lines 179-184 my $letter_expiry; Link Here
179
my $letter_renew;
179
my $letter_renew;
180
180
181
my $command_line_options = join(" ",@ARGV);
181
my $command_line_options = join(" ",@ARGV);
182
cronlogaction({ info => $command_line_options });
182
183
183
GetOptions(
184
GetOptions(
184
    'help|?'         => \$help,
185
    'help|?'         => \$help,
Lines 226-233 if ( !C4::Context->preference('TrackLastPatronActivityTriggers') Link Here
226
    );
227
    );
227
}
228
}
228
229
229
cronlogaction({ info => $command_line_options });
230
231
my $expdays = C4::Context->preference('MembershipExpiryDaysNotice');
230
my $expdays = C4::Context->preference('MembershipExpiryDaysNotice');
232
if( !$expdays ) {
231
if( !$expdays ) {
233
    #If the pref is not set, we will exit
232
    #If the pref is not set, we will exit
(-)a/misc/cronjobs/overdue_notices.pl (-1 / +1 lines)
Lines 312-317 my @myborcatout; Link Here
312
my ( $date_input, $today );
312
my ( $date_input, $today );
313
313
314
my $command_line_options = join(" ",@ARGV);
314
my $command_line_options = join(" ",@ARGV);
315
cronlogaction({ info => $command_line_options });
315
316
316
GetOptions(
317
GetOptions(
317
    'help|?'         => \$help,
318
    'help|?'         => \$help,
Lines 335-341 GetOptions( Link Here
335
) or pod2usage(2);
336
) or pod2usage(2);
336
pod2usage(1) if $help;
337
pod2usage(1) if $help;
337
pod2usage( -verbose => 2 ) if $man;
338
pod2usage( -verbose => 2 ) if $man;
338
cronlogaction({ info => $command_line_options });
339
339
340
if ( defined $csvfilename && $csvfilename =~ /^-/ ) {
340
if ( defined $csvfilename && $csvfilename =~ /^-/ ) {
341
    warn qq(using "$csvfilename" as filename, that seems odd);
341
    warn qq(using "$csvfilename" as filename, that seems odd);
(-)a/misc/cronjobs/patron_emailer.pl (-2 / +1 lines)
Lines 118-123 my $error_msgs = { Link Here
118
};
118
};
119
119
120
my $command_line_options = join(" ",@ARGV);
120
my $command_line_options = join(" ",@ARGV);
121
cronlogaction({ info => $command_line_options });
121
122
122
GetOptions(
123
GetOptions(
123
    'help|?'      => \$help,
124
    'help|?'      => \$help,
Lines 133-140 GetOptions( Link Here
133
pod2usage(1) if $help;
134
pod2usage(1) if $help;
134
pod2usage(1) unless $report_id && $notice && $module;
135
pod2usage(1) unless $report_id && $notice && $module;
135
136
136
cronlogaction({ info => $command_line_options });
137
138
my ( $emails, $errors ) = C4::Reports::Guided::EmailReport({
137
my ( $emails, $errors ) = C4::Reports::Guided::EmailReport({
139
    email      => $email,
138
    email      => $email,
140
    from       => $from,
139
    from       => $from,
(-)a/misc/cronjobs/process_message_queue.pl (-2 / +1 lines)
Lines 38-43 my @letter_code; Link Here
38
my $exit_on_plugin_failure = 0;
38
my $exit_on_plugin_failure = 0;
39
39
40
my $command_line_options = join( " ", @ARGV );
40
my $command_line_options = join( " ", @ARGV );
41
cronlogaction( { info => $command_line_options } );
41
42
42
GetOptions(
43
GetOptions(
43
    'u|username:s'             => \$username,
44
    'u|username:s'             => \$username,
Lines 86-93 try { Link Here
86
    exit;
87
    exit;
87
};
88
};
88
89
89
cronlogaction( { info => $command_line_options } );
90
91
# Remove empty elements, see bug 37075
90
# Remove empty elements, see bug 37075
92
@letter_code = grep { $_ ne q{} } @letter_code;
91
@letter_code = grep { $_ ne q{} } @letter_code;
93
92
(-)a/misc/cronjobs/purge_suggestions.pl (-6 / +8 lines)
Lines 26-39 use C4::Suggestions; Link Here
26
use C4::Log qw( cronlogaction );
26
use C4::Log qw( cronlogaction );
27
use C4::Context;
27
use C4::Context;
28
28
29
my ( $help, $days, $confirm );
29
my ( $help, $days, $confirm, $verbose );
30
30
31
my $command_line_options = join(" ",@ARGV);
31
my $command_line_options = join(" ",@ARGV);
32
cronlogaction({ info => $command_line_options });
32
33
33
GetOptions(
34
GetOptions(
34
    'help|?' => \$help,
35
    'help|?'    => \$help,
35
    'days:i' => \$days,
36
    'days:i'    => \$days,
36
    'confirm'=> \$confirm,
37
    'confirm'   => \$confirm,
38
    'v|verbose' => \$verbose,
37
);
39
);
38
40
39
my $usage = << 'ENDUSAGE';
41
my $usage = << 'ENDUSAGE';
Lines 42-47 Parameters: Link Here
42
-help|? This message
44
-help|? This message
43
-days TTT to define the age of suggestions to delete
45
-days TTT to define the age of suggestions to delete
44
-confirm flag needed to confirm purge operation
46
-confirm flag needed to confirm purge operation
47
-verbose flag to increase feedback
45
48
46
The days parameter falls back to the value of system preference
49
The days parameter falls back to the value of system preference
47
PurgeSuggestionsOlderThan. Suggestions are deleted only for a positive
50
PurgeSuggestionsOlderThan. Suggestions are deleted only for a positive
Lines 59-66 if( !$confirm || $help || !defined($days) ) { Link Here
59
    print "No confirm parameter passed!\n\n" if !$confirm && !$help;
62
    print "No confirm parameter passed!\n\n" if !$confirm && !$help;
60
    print $usage;
63
    print $usage;
61
} elsif( $days and $days > 0 ) {
64
} elsif( $days and $days > 0 ) {
62
    $command_line_options .= " ( effective days = $days )";
65
    print "Purging suggestions older than $days days\n" if $verbose;
63
    cronlogaction({ info => $command_line_options });
64
    DelSuggestionsOlderThan($days);
66
    DelSuggestionsOlderThan($days);
65
} else {
67
} else {
66
    warn "This script requires a positive number of days. Aborted.\n";
68
    warn "This script requires a positive number of days. Aborted.\n";
(-)a/misc/cronjobs/reconcile_balances.pl (-1 / +1 lines)
Lines 65-70 my $help = 0; Link Here
65
my $verbose = 0;
65
my $verbose = 0;
66
66
67
my $command_line_options = join(" ",@ARGV);
67
my $command_line_options = join(" ",@ARGV);
68
cronlogaction({ info => $command_line_options });
68
69
69
GetOptions(
70
GetOptions(
70
    'help'    => \$help,
71
    'help'    => \$help,
Lines 72-78 GetOptions( Link Here
72
) or pod2usage(2);
73
) or pod2usage(2);
73
74
74
pod2usage(1) if $help;
75
pod2usage(1) if $help;
75
cronlogaction({ info => $command_line_options });
76
76
77
my @patron_ids = Koha::Account::Lines->search(
77
my @patron_ids = Koha::Account::Lines->search(
78
        {
78
        {
(-)a/misc/cronjobs/restrict_patrons_with_failed_notices.pl (-1 / +3 lines)
Lines 28-33 use Koha::Patrons; Link Here
28
use C4::Letters;
28
use C4::Letters;
29
use Koha::Notice::Message;
29
use Koha::Notice::Message;
30
30
31
my $command_line_options = join(" ",@ARGV);
32
cronlogaction({ info => $command_line_options });
33
31
# Getting options
34
# Getting options
32
my ( $help, $verbose, $confirm );
35
my ( $help, $verbose, $confirm );
33
GetOptions(
36
GetOptions(
Lines 47-53 Exiting cronjob Link Here
47
50
48
END_WARN
51
END_WARN
49
}
52
}
50
cronlogaction();
51
53
52
my @failed_notices = Koha::Notice::Messages->get_failed_notices( { days => 7 } )->as_list;
54
my @failed_notices = Koha::Notice::Messages->get_failed_notices( { days => 7 } )->as_list;
53
55
(-)a/misc/cronjobs/runreport.pl (-2 / +1 lines)
Lines 205-210 my $password = undef; Link Here
205
my $method = 'LOGIN';
205
my $method = 'LOGIN';
206
206
207
my $command_line_options = join(" ",@ARGV);
207
my $command_line_options = join(" ",@ARGV);
208
cronlogaction({ info => $command_line_options });
208
209
209
GetOptions(
210
GetOptions(
210
    'help|?'            => \$help,
211
    'help|?'            => \$help,
Lines 231-238 pod2usage( -verbose => 2 ) if ($man); Link Here
231
pod2usage( -verbose => 2 ) if ($help and $verbose);
232
pod2usage( -verbose => 2 ) if ($help and $verbose);
232
pod2usage(1) if $help;
233
pod2usage(1) if $help;
233
234
234
cronlogaction({ info => $command_line_options });
235
236
unless ($format) {
235
unless ($format) {
237
    $verbose and print STDERR "No format specified, assuming 'text'\n";
236
    $verbose and print STDERR "No format specified, assuming 'text'\n";
238
    $format = 'text';
237
    $format = 'text';
(-)a/misc/cronjobs/serialsUpdate.pl (-2 / +1 lines)
Lines 60-65 my $note = ''; Link Here
60
my $nonote  = 0;
60
my $nonote  = 0;
61
61
62
my $command_line_options = join(" ",@ARGV);
62
my $command_line_options = join(" ",@ARGV);
63
cronlogaction({ info => $command_line_options });
63
64
64
GetOptions(
65
GetOptions(
65
    'help|h|?'  => \$help,
66
    'help|h|?'  => \$help,
Lines 73-80 GetOptions( Link Here
73
pod2usage(1) if $help;
74
pod2usage(1) if $help;
74
pod2usage( -verbose => 2 ) if $man;
75
pod2usage( -verbose => 2 ) if $man;
75
76
76
cronlogaction({ info => $command_line_options });
77
78
$verbose and !$confirm and print "### Database will not be modified ###\n";
77
$verbose and !$confirm and print "### Database will not be modified ###\n";
79
78
80
if ( $note && $nonote ) {
79
if ( $note && $nonote ) {
(-)a/misc/cronjobs/sftp_file.pl (-2 / +1 lines)
Lines 127-132 my $status_email_message = undef; Link Here
127
my $sftp_status          = undef;
127
my $sftp_status          = undef;
128
128
129
my $command_line_options = join( " ", @ARGV );
129
my $command_line_options = join( " ", @ARGV );
130
cronlogaction( { info => $command_line_options } );
130
131
131
GetOptions(
132
GetOptions(
132
    'help|?'         => \$help,
133
    'help|?'         => \$help,
Lines 144-151 pod2usage( -verbose => 2 ) if ($man); Link Here
144
pod2usage( -verbose => 2 ) if ( $help and $verbose );
145
pod2usage( -verbose => 2 ) if ( $help and $verbose );
145
pod2usage(1) if $help;
146
pod2usage(1) if $help;
146
147
147
cronlogaction( { info => $command_line_options } );
148
149
# Check we have all the SFTP details we need
148
# Check we have all the SFTP details we need
150
if ( !$user || !$pass || !$host || !$upload_dir ) {
149
if ( !$user || !$pass || !$host || !$upload_dir ) {
151
    pod2usage(q|Please provide details for sftp username, password, upload directory, and host|);
150
    pod2usage(q|Please provide details for sftp username, password, upload directory, and host|);
(-)a/misc/cronjobs/share_usage_with_koha_community.pl (-2 / +1 lines)
Lines 12-17 use C4::Log qw( cronlogaction ); Link Here
12
use POSIX qw( strftime );
12
use POSIX qw( strftime );
13
13
14
my $command_line_options = join(" ",@ARGV);
14
my $command_line_options = join(" ",@ARGV);
15
cronlogaction({ info => $command_line_options });
15
16
16
my ( $help, $verbose, $force, $quiet );
17
my ( $help, $verbose, $force, $quiet );
17
GetOptions(
18
GetOptions(
Lines 38-45 Setting the quiet flag will silence this message. Link Here
38
    exit 1;
39
    exit 1;
39
}
40
}
40
41
41
cronlogaction({ info => $command_line_options });
42
43
my $need_update = ($force ? 1 : C4::UsageStats::NeedUpdate() );
42
my $need_update = ($force ? 1 : C4::UsageStats::NeedUpdate() );
44
43
45
if ($need_update) {
44
if ($need_update) {
(-)a/misc/cronjobs/staticfines.pl (-2 / +1 lines)
Lines 53-58 my $debug = 0; Link Here
53
my $bigdebug = 0;
53
my $bigdebug = 0;
54
54
55
my $command_line_options = join(" ",@ARGV);
55
my $command_line_options = join(" ",@ARGV);
56
cronlogaction({ info => $command_line_options });
56
57
57
GetOptions(
58
GetOptions(
58
    'h|help'      => \$help,
59
    'h|help'      => \$help,
Lines 83-90 This script has the following parameters : Link Here
83
ENDUSAGE
84
ENDUSAGE
84
die $usage if $help;
85
die $usage if $help;
85
86
86
cronlogaction({ info => $command_line_options });
87
88
my $dbh = C4::Context->dbh;
87
my $dbh = C4::Context->dbh;
89
88
90
# Processing categories
89
# Processing categories
(-)a/misc/cronjobs/update_patrons_category.pl (-2 / +3 lines)
Lines 170-175 my $branch_lim; Link Here
170
my %fields;
170
my %fields;
171
my @where;
171
my @where;
172
172
173
my $command_line_options = join(" ",@ARGV);
174
cronlogaction({ info => $command_line_options });
175
173
GetOptions(
176
GetOptions(
174
    'help|?'          => \$help,
177
    'help|?'          => \$help,
175
    'man'             => \$man,
178
    'man'             => \$man,
Lines 202-209 if ( not $fromcat && $tocat ) { #make sure we've specified the info we need. Link Here
202
205
203
$verbose and print "Will update patrons from $fromcat to $tocat with conditions below (if any)\n";
206
$verbose and print "Will update patrons from $fromcat to $tocat with conditions below (if any)\n";
204
207
205
cronlogaction();
206
207
my %params;
208
my %params;
208
209
209
if ( $reg_bef || $reg_aft ) {
210
if ( $reg_bef || $reg_aft ) {
(-)a/misc/cronjobs/update_totalissues.pl (-2 / +1 lines)
Lines 53-58 my $progress = 100; Link Here
53
my $unit;
53
my $unit;
54
54
55
my $command_line_options = join( " ", @ARGV );
55
my $command_line_options = join( " ", @ARGV );
56
cronlogaction( { info => $command_line_options } );
56
57
57
my $result = GetOptions(
58
my $result = GetOptions(
58
    'v|verbose'    => \$verbose,
59
    'v|verbose'    => \$verbose,
Lines 89-96 unless ( $usestats || $useitems ) { Link Here
89
90
90
usage() if $want_help;
91
usage() if $want_help;
91
92
92
cronlogaction( { info => $command_line_options } );
93
94
my $dbh = C4::Context->dbh;
93
my $dbh = C4::Context->dbh;
95
94
96
my $num_bibs_processed = 0;
95
my $num_bibs_processed = 0;
(-)a/misc/maintenance/fix_invalid_dates.pl (-1 / +8 lines)
Lines 40-50 This script fixes any date fields in the database that have '0000-00-00' values Link Here
40
my $verbose = 0;
40
my $verbose = 0;
41
my $doit    = 0;
41
my $doit    = 0;
42
42
43
my $command_line_options = join( " ", @ARGV );
44
43
GetOptions(
45
GetOptions(
44
    'v|verbose' => \$verbose,
46
    'v|verbose' => \$verbose,
45
    'c|confirm' => \$doit,
47
    'c|confirm' => \$doit,
46
);
48
);
47
49
50
if ($doit) {
51
    cronlogaction( { action => 'Run', info => $command_line_options } );
52
} else {
53
    warn "Running in dry-run mode, provide --confirm to apply the changes\n";
54
}
55
48
my $schema = Koha::Database->new->schema;
56
my $schema = Koha::Database->new->schema;
49
57
50
# Loop over all the DBIx::Class classes
58
# Loop over all the DBIx::Class classes
51
- 

Return to bug 38857