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

(-)a/C4/Context.pm (+1 lines)
Lines 1032-1037 sub interface { Link Here
1032
            || $interface eq 'opac'
1032
            || $interface eq 'opac'
1033
            || $interface eq 'intranet'
1033
            || $interface eq 'intranet'
1034
            || $interface eq 'sip'
1034
            || $interface eq 'sip'
1035
            || $interface eq 'cron'
1035
            || $interface eq 'commandline' )
1036
            || $interface eq 'commandline' )
1036
        {
1037
        {
1037
            $context->{interface} = $interface;
1038
            $context->{interface} = $interface;
(-)a/Koha/Cron.pm (+55 lines)
Line 0 Link Here
1
package Koha::Cron;
2
3
# Copyright PTFS Europe 2019
4
# Copyright 2019 Koha Development Team
5
#
6
# This file is part of Koha.
7
#
8
# Koha is free software; you can redistribute it and/or modify it under the
9
# terms of the GNU General Public License as published by the Free Software
10
# Foundation; either version 3 of the License, or (at your option) any later
11
# version.
12
#
13
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
14
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License along
18
# with Koha; if not, write to the Free Software Foundation, Inc.,
19
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
21
use Modern::Perl;
22
23
=head1 NAME
24
25
Koha::Cron - Koha Cron scripts base class
26
27
=head1 SYNOPSIS
28
29
    use Koha::Cron;
30
31
=head1 DESCRIPTION
32
33
This class should be used in all cronscripts. It sets the interface and userenv appropriately.
34
35
=cut
36
37
use C4::Context;
38
39
# Set userenv
40
C4::Context->_new_userenv(1);
41
C4::Context->set_userenv(
42
    undef, undef, undef, 'CRON', 'CRON', undef,
43
    undef, undef, undef, undef,  undef
44
);
45
46
# Set interface
47
C4::Context->interface('cron');
48
49
=head1 AUTHOR
50
51
Martin Renvoize <martin.renvoize@ptfs-europe.com>
52
53
=cut
54
55
1;
(-)a/misc/cronjobs/advance_notices.pl (-1 / +1 lines)
Lines 49-54 BEGIN { Link Here
49
    use FindBin;
49
    use FindBin;
50
    eval { require "$FindBin::Bin/../kohalib.pl" };
50
    eval { require "$FindBin::Bin/../kohalib.pl" };
51
}
51
}
52
use Koha::Cron;
52
use C4::Biblio;
53
use C4::Biblio;
53
use C4::Context;
54
use C4::Context;
54
use C4::Letters;
55
use C4::Letters;
Lines 223-229 END_WARN Link Here
223
unless ($confirm) {
224
unless ($confirm) {
224
     pod2usage(1);
225
     pod2usage(1);
225
}
226
}
226
227
cronlogaction();
227
cronlogaction();
228
228
229
# The fields that will be substituted into <<items.content>>
229
# The fields that will be substituted into <<items.content>>
(-)a/misc/cronjobs/automatic_item_modification_by_age.pl (+1 lines)
Lines 6-11 use Getopt::Long; Link Here
6
use Pod::Usage;
6
use Pod::Usage;
7
use JSON;
7
use JSON;
8
8
9
use Koha::Cron;
9
use C4::Context;
10
use C4::Context;
10
use C4::Items;
11
use C4::Items;
11
12
(-)a/misc/cronjobs/automatic_renewals.pl (-1 / +1 lines)
Lines 52-57 use Modern::Perl; Link Here
52
use Pod::Usage;
52
use Pod::Usage;
53
use Getopt::Long;
53
use Getopt::Long;
54
54
55
use Koha::Cron;
55
use C4::Circulation;
56
use C4::Circulation;
56
use C4::Context;
57
use C4::Context;
57
use C4::Log;
58
use C4::Log;
Lines 67-73 GetOptions( Link Here
67
) || pod2usage(1);
68
) || pod2usage(1);
68
69
69
pod2usage(0) if $help;
70
pod2usage(0) if $help;
70
71
cronlogaction();
71
cronlogaction();
72
72
73
my $auto_renews = Koha::Checkouts->search({ auto_renew => 1 });
73
my $auto_renews = Koha::Checkouts->search({ auto_renew => 1 });
(-)a/misc/cronjobs/batch_anonymise.pl (+1 lines)
Lines 29-34 BEGIN { Link Here
29
    eval { require "$FindBin::Bin/../kohalib.pl" };
29
    eval { require "$FindBin::Bin/../kohalib.pl" };
30
}
30
}
31
31
32
use Koha::Cron;
32
use C4::Context;
33
use C4::Context;
33
use Koha::Patrons;
34
use Koha::Patrons;
34
use Date::Calc qw(
35
use Date::Calc qw(
(-)a/misc/cronjobs/build_browser_and_cloud.pl (+1 lines)
Lines 10-15 BEGIN { Link Here
10
    eval { require "$FindBin::Bin/../kohalib.pl" };
10
    eval { require "$FindBin::Bin/../kohalib.pl" };
11
}
11
}
12
12
13
use Koha::Cron;
13
use C4::Koha;
14
use C4::Koha;
14
use C4::Context;
15
use C4::Context;
15
use C4::Biblio;
16
use C4::Biblio;
(-)a/misc/cronjobs/cart_to_shelf.pl (+1 lines)
Lines 28-33 cart_to_shelf.pl cron script to set items with location of CART to original she Link Here
28
use strict;
28
use strict;
29
use warnings;
29
use warnings;
30
30
31
use Koha::Cron;
31
use C4::Items qw/ CartToShelf /;
32
use C4::Items qw/ CartToShelf /;
32
use C4::Log;
33
use C4::Log;
33
34
(-)a/misc/cronjobs/check-url-quick.pl (+2 lines)
Lines 20-25 Link Here
20
use Modern::Perl;
20
use Modern::Perl;
21
use Pod::Usage;
21
use Pod::Usage;
22
use Getopt::Long;
22
use Getopt::Long;
23
24
use Koha::Cron;
23
use C4::Context;
25
use C4::Context;
24
use C4::Biblio;
26
use C4::Biblio;
25
use AnyEvent;
27
use AnyEvent;
(-)a/misc/cronjobs/check-url.pl (+2 lines)
Lines 78-83 use strict; Link Here
78
use warnings;
78
use warnings;
79
use LWP::UserAgent;
79
use LWP::UserAgent;
80
use HTTP::Request;
80
use HTTP::Request;
81
use Koha::Cron;
81
use C4::Biblio;
82
use C4::Biblio;
82
83
83
84
Lines 147-152 use Carp; Link Here
147
148
148
use Pod::Usage;
149
use Pod::Usage;
149
use Getopt::Long;
150
use Getopt::Long;
151
use Koha::Cron;
150
use C4::Context;
152
use C4::Context;
151
153
152
154
(-)a/misc/cronjobs/cleanup_database.pl (+1 lines)
Lines 34-39 BEGIN { Link Here
34
    eval { require "$FindBin::Bin/../kohalib.pl" };
34
    eval { require "$FindBin::Bin/../kohalib.pl" };
35
}
35
}
36
36
37
use Koha::Cron;
37
use C4::Context;
38
use C4::Context;
38
use C4::Search;
39
use C4::Search;
39
use C4::Search::History;
40
use C4::Search::History;
(-)a/misc/cronjobs/cloud-kw.pl (-1 / +3 lines)
Lines 25-30 use Carp; Link Here
25
use YAML::Syck;
25
use YAML::Syck;
26
use Pod::Usage;
26
use Pod::Usage;
27
use Getopt::Long;
27
use Getopt::Long;
28
29
use Koha::Cron;
28
use C4::Context;
30
use C4::Context;
29
use C4::Log;
31
use C4::Log;
30
32
Lines 42-48 sub usage { Link Here
42
    exit;
44
    exit;
43
} 
45
} 
44
46
45
usage() if $help || !$conf;          
47
usage() if $help || !$conf;
46
48
47
cronlogaction();
49
cronlogaction();
48
50
(-)a/misc/cronjobs/create_koc_db.pl (-1 / +2 lines)
Lines 94-99 $|++; Link Here
94
use DBI;
94
use DBI;
95
use Getopt::Long;
95
use Getopt::Long;
96
use Pod::Usage;
96
use Pod::Usage;
97
98
use Koha::Cron;
97
use C4::Context;
99
use C4::Context;
98
use English qw(-no_match_vars);
100
use English qw(-no_match_vars);
99
101
Lines 118-124 GetOptions( Link Here
118
pod2usage(1) if $help;
120
pod2usage(1) if $help;
119
pod2usage( -verbose => 2 ) if $man;
121
pod2usage( -verbose => 2 ) if $man;
120
122
121
122
my %wanted_borrowers_columns = map { $_ => 1 } qw/borrowernumber cardnumber surname  firstname address city phone dateofbirth/; 
123
my %wanted_borrowers_columns = map { $_ => 1 } qw/borrowernumber cardnumber surname  firstname address city phone dateofbirth/; 
123
my %wanted_issues_columns    = map { $_ => 1 } qw/borrowernumber date_due itemcallnumber title itemtype/;
124
my %wanted_issues_columns    = map { $_ => 1 } qw/borrowernumber date_due itemcallnumber title itemtype/;
124
125
(-)a/misc/cronjobs/delete_expired_opac_registrations.pl (+1 lines)
Lines 28-33 BEGIN { Link Here
28
    eval { my $lib = "$FindBin::Bin/../kohalib.pl"; require $lib };
28
    eval { my $lib = "$FindBin::Bin/../kohalib.pl"; require $lib };
29
}
29
}
30
30
31
use Koha::Cron;
31
use C4::Context;
32
use C4::Context;
32
33
33
my $help;
34
my $help;
(-)a/misc/cronjobs/delete_items.pl (+2 lines)
Lines 1-6 Link Here
1
#! /usr/bin/perl
1
#! /usr/bin/perl
2
2
3
use Getopt::Long;
3
use Getopt::Long;
4
5
use Koha::Cron;
4
use C4::Context;
6
use C4::Context;
5
use C4::Items;
7
use C4::Items;
6
use C4::Circulation;
8
use C4::Circulation;
(-)a/misc/cronjobs/delete_patrons.pl (+1 lines)
Lines 5-10 use Modern::Perl; Link Here
5
use Pod::Usage;
5
use Pod::Usage;
6
use Getopt::Long;
6
use Getopt::Long;
7
7
8
use Koha::Cron;
8
use C4::Members;
9
use C4::Members;
9
use Koha::DateUtils;
10
use Koha::DateUtils;
10
use Koha::Patrons;
11
use Koha::Patrons;
(-)a/misc/cronjobs/delete_records_via_leader.pl (+1 lines)
Lines 33-38 BEGIN { Link Here
33
33
34
use Getopt::Long;
34
use Getopt::Long;
35
use Pod::Usage;
35
use Pod::Usage;
36
use Koha::Cron;
36
use C4::Biblio;
37
use C4::Biblio;
37
use C4::Items;
38
use C4::Items;
38
use Koha::Database;
39
use Koha::Database;
(-)a/misc/cronjobs/edi_cron.pl (+1 lines)
Lines 29-34 use utf8; Link Here
29
# can be run as frequently as required
29
# can be run as frequently as required
30
# log messages are appended to logdir/editrace.log
30
# log messages are appended to logdir/editrace.log
31
31
32
use Koha::Cron;
32
use C4::Context;
33
use C4::Context;
33
use Log::Log4perl qw(:easy);
34
use Log::Log4perl qw(:easy);
34
use Koha::Database;
35
use Koha::Database;
(-)a/misc/cronjobs/fines.pl (+1 lines)
Lines 30-35 use strict; Link Here
30
use warnings;
30
use warnings;
31
use 5.010;
31
use 5.010;
32
32
33
use Koha::Cron;
33
use C4::Context;
34
use C4::Context;
34
use C4::Overdues;
35
use C4::Overdues;
35
use Getopt::Long;
36
use Getopt::Long;
(-)a/misc/cronjobs/gather_print_notices.pl (+1 lines)
Lines 10-15 BEGIN { Link Here
10
}
10
}
11
11
12
use CGI qw( utf8 ); # NOT a CGI script, this is just to keep C4::Templates::gettemplate happy
12
use CGI qw( utf8 ); # NOT a CGI script, this is just to keep C4::Templates::gettemplate happy
13
use Koha::Cron;
13
use C4::Context;
14
use C4::Context;
14
use C4::Debug;
15
use C4::Debug;
15
use C4::Letters;
16
use C4::Letters;
(-)a/misc/cronjobs/holds/auto_unsuspend_holds.pl (+1 lines)
Lines 29-34 BEGIN { Link Here
29
29
30
# cancel all expired hold requests
30
# cancel all expired hold requests
31
31
32
use Koha::Cron;
32
use C4::Reserves;
33
use C4::Reserves;
33
use C4::Log;
34
use C4::Log;
34
35
(-)a/misc/cronjobs/holds/build_holds_queue.pl (+1 lines)
Lines 15-20 BEGIN { Link Here
15
    eval { require "$FindBin::Bin/../kohalib.pl" };
15
    eval { require "$FindBin::Bin/../kohalib.pl" };
16
}
16
}
17
17
18
use Koha::Cron;
18
use C4::HoldsQueue qw(CreateQueue);
19
use C4::HoldsQueue qw(CreateQueue);
19
use C4::Log;
20
use C4::Log;
20
21
(-)a/misc/cronjobs/holds/cancel_expired_holds.pl (+1 lines)
Lines 29-34 BEGIN { Link Here
29
29
30
# cancel all expired hold requests
30
# cancel all expired hold requests
31
31
32
use Koha::Cron;
32
use C4::Reserves;
33
use C4::Reserves;
33
use C4::Log;
34
use C4::Log;
34
35
(-)a/misc/cronjobs/holds/cancel_unfilled_holds.pl (+1 lines)
Lines 28-33 BEGIN { Link Here
28
use Getopt::Long;
28
use Getopt::Long;
29
use Pod::Usage;
29
use Pod::Usage;
30
30
31
use Koha::Cron;
31
use C4::Reserves;
32
use C4::Reserves;
32
use C4::Log;
33
use C4::Log;
33
use Koha::Holds;
34
use Koha::Holds;
(-)a/misc/cronjobs/import_webservice_batch.pl (+1 lines)
Lines 31-36 BEGIN { Link Here
31
31
32
use Getopt::Long;
32
use Getopt::Long;
33
use Pod::Usage;
33
use Pod::Usage;
34
use Koha::Cron;
34
use C4::ImportBatch;
35
use C4::ImportBatch;
35
36
36
my ($help, $framework);
37
my ($help, $framework);
(-)a/misc/cronjobs/j2a.pl (+1 lines)
Lines 26-31 BEGIN { Link Here
26
    eval { require "$FindBin::Bin/../kohalib.pl" };
26
    eval { require "$FindBin::Bin/../kohalib.pl" };
27
}
27
}
28
28
29
use Koha::Cron;
29
use C4::Context;
30
use C4::Context;
30
use C4::Members;
31
use C4::Members;
31
use Getopt::Long;
32
use Getopt::Long;
(-)a/misc/cronjobs/longoverdue.pl (+2 lines)
Lines 33-38 BEGIN { Link Here
33
    use FindBin;
33
    use FindBin;
34
    eval { require "$FindBin::Bin/../kohalib.pl" };
34
    eval { require "$FindBin::Bin/../kohalib.pl" };
35
}
35
}
36
37
use Koha::Cron;
36
use C4::Context;
38
use C4::Context;
37
use C4::Items;
39
use C4::Items;
38
use C4::Circulation qw/LostItem MarkIssueReturned/;
40
use C4::Circulation qw/LostItem MarkIssueReturned/;
(-)a/misc/cronjobs/membership_expiry.pl (+1 lines)
Lines 126-131 BEGIN { Link Here
126
    eval { require "$FindBin::Bin/../kohalib.pl" };
126
    eval { require "$FindBin::Bin/../kohalib.pl" };
127
}
127
}
128
128
129
use Koha::Cron;
129
use C4::Context;
130
use C4::Context;
130
use C4::Letters;
131
use C4::Letters;
131
use C4::Log;
132
use C4::Log;
(-)a/misc/cronjobs/merge_authorities.pl (-2 / +3 lines)
Lines 5-10 use Getopt::Long; Link Here
5
use Pod::Usage;
5
use Pod::Usage;
6
use Time::HiRes qw(gettimeofday);
6
use Time::HiRes qw(gettimeofday);
7
7
8
use Koha::Cron;
8
use C4::AuthoritiesMarc;
9
use C4::AuthoritiesMarc;
9
use Koha::Authority::MergeRequests;
10
use Koha::Authority::MergeRequests;
10
11
Lines 19-26 GetOptions( Link Here
19
);
20
);
20
21
21
$|=1; # flushes output
22
$|=1; # flushes output
22
if( $params->{batch} ) {
23
if ( $params->{batch} ) {
23
    handle_batch( $params );
24
    handle_batch($params);
24
} else {
25
} else {
25
    pod2usage(1);
26
    pod2usage(1);
26
}
27
}
(-)a/misc/cronjobs/notice_unprocessed_suggestions.pl (+1 lines)
Lines 5-10 use Modern::Perl; Link Here
5
use Pod::Usage;
5
use Pod::Usage;
6
use Getopt::Long;
6
use Getopt::Long;
7
7
8
use Koha::Cron;
8
use C4::Budgets qw( GetBudget );
9
use C4::Budgets qw( GetBudget );
9
use C4::Suggestions qw( GetUnprocessedSuggestions );
10
use C4::Suggestions qw( GetUnprocessedSuggestions );
10
use Koha::Libraries;
11
use Koha::Libraries;
(-)a/misc/cronjobs/overdue_notices.pl (-1 / +1 lines)
Lines 34-39 use Text::CSV_XS; Link Here
34
use DateTime;
34
use DateTime;
35
use DateTime::Duration;
35
use DateTime::Duration;
36
36
37
use Koha::Cron;
37
use C4::Context;
38
use C4::Context;
38
use C4::Letters;
39
use C4::Letters;
39
use C4::Overdues qw(GetFine GetOverdueMessageTransportTypes parse_overdues_letter);
40
use C4::Overdues qw(GetFine GetOverdueMessageTransportTypes parse_overdues_letter);
Lines 325-331 GetOptions( Link Here
325
) or pod2usage(2);
326
) or pod2usage(2);
326
pod2usage(1) if $help;
327
pod2usage(1) if $help;
327
pod2usage( -verbose => 2 ) if $man;
328
pod2usage( -verbose => 2 ) if $man;
328
329
cronlogaction() unless $test_mode;
329
cronlogaction() unless $test_mode;
330
330
331
if ( defined $csvfilename && $csvfilename =~ /^-/ ) {
331
if ( defined $csvfilename && $csvfilename =~ /^-/ ) {
(-)a/misc/cronjobs/process_message_queue.pl (+2 lines)
Lines 25-30 BEGIN { Link Here
25
    use FindBin;
25
    use FindBin;
26
    eval { require "$FindBin::Bin/../kohalib.pl" };
26
    eval { require "$FindBin::Bin/../kohalib.pl" };
27
}
27
}
28
29
use Koha::Cron;
28
use C4::Letters;
30
use C4::Letters;
29
use C4::Log;
31
use C4::Log;
30
use Getopt::Long;
32
use Getopt::Long;
(-)a/misc/cronjobs/purge_suggestions.pl (+2 lines)
Lines 28-33 BEGIN { Link Here
28
28
29
use Getopt::Long;
29
use Getopt::Long;
30
use Pod::Usage;
30
use Pod::Usage;
31
32
use Koha::Cron;
31
use C4::Suggestions;
33
use C4::Suggestions;
32
use C4::Log;
34
use C4::Log;
33
use C4::Context;
35
use C4::Context;
(-)a/misc/cronjobs/reconcile_balances.pl (-1 / +1 lines)
Lines 62-67 BEGIN { Link Here
62
    eval { require "$FindBin::Bin/../kohalib.pl" };
62
    eval { require "$FindBin::Bin/../kohalib.pl" };
63
}
63
}
64
64
65
use Koha::Cron;
65
use C4::Log;
66
use C4::Log;
66
67
67
use Koha::Account::Lines;
68
use Koha::Account::Lines;
Lines 76-82 GetOptions( Link Here
76
) or pod2usage(2);
77
) or pod2usage(2);
77
78
78
pod2usage(1) if $help;
79
pod2usage(1) if $help;
79
80
cronlogaction();
80
cronlogaction();
81
81
82
my @patron_ids = map { $_->borrowernumber } Koha::Account::Lines->search(
82
my @patron_ids = map { $_->borrowernumber } Koha::Account::Lines->search(
(-)a/misc/cronjobs/remove_temporary_edifiles.pl (+1 lines)
Lines 2-7 Link Here
2
use strict;
2
use strict;
3
use warnings;
3
use warnings;
4
4
5
use Koha::Cron;
5
use C4::Context;
6
use C4::Context;
6
7
7
# this script will remove those older than 5 days
8
# this script will remove those older than 5 days
(-)a/misc/cronjobs/rss/rss.pl (+2 lines)
Lines 28-33 Link Here
28
use Modern::Perl;
28
use Modern::Perl;
29
29
30
use Template;
30
use Template;
31
32
use Koha::Cron;
31
use C4::Context;
33
use C4::Context;
32
use Time::Local;
34
use Time::Local;
33
use POSIX;
35
use POSIX;
(-)a/misc/cronjobs/runreport.pl (+1 lines)
Lines 20-25 Link Here
20
20
21
use Modern::Perl;
21
use Modern::Perl;
22
22
23
use Koha::Cron;
23
use C4::Reports::Guided; # 0.12
24
use C4::Reports::Guided; # 0.12
24
use Koha::Reports;
25
use Koha::Reports;
25
use C4::Context;
26
use C4::Context;
(-)a/misc/cronjobs/serialsUpdate.pl (+1 lines)
Lines 28-33 BEGIN { Link Here
28
    eval { require "$FindBin::Bin/../kohalib.pl" };
28
    eval { require "$FindBin::Bin/../kohalib.pl" };
29
}
29
}
30
30
31
use Koha::Cron;
31
use C4::Context;
32
use C4::Context;
32
use C4::Debug;
33
use C4::Debug;
33
use C4::Serials;
34
use C4::Serials;
(-)a/misc/cronjobs/share_usage_with_koha_community.pl (+1 lines)
Lines 5-10 use Modern::Perl; Link Here
5
use Pod::Usage;
5
use Pod::Usage;
6
use Getopt::Long;
6
use Getopt::Long;
7
7
8
use Koha::Cron;
8
use C4::Context;
9
use C4::Context;
9
use C4::UsageStats;
10
use C4::UsageStats;
10
use C4::Log;
11
use C4::Log;
(-)a/misc/cronjobs/sitemap.pl (+2 lines)
Lines 23-28 use Modern::Perl; Link Here
23
use utf8;
23
use utf8;
24
use Pod::Usage;
24
use Pod::Usage;
25
use Getopt::Long;
25
use Getopt::Long;
26
27
use Koha::Cron;
26
use C4::Biblio;
28
use C4::Biblio;
27
use Koha::Sitemapper;
29
use Koha::Sitemapper;
28
30
(-)a/misc/cronjobs/social_data/get_report_social_data.pl (+2 lines)
Lines 1-6 Link Here
1
#!/usr/bin/perl
1
#!/usr/bin/perl
2
2
3
use Modern::Perl;
3
use Modern::Perl;
4
5
use Koha::Cron;
4
use C4::SocialData;
6
use C4::SocialData;
5
7
6
my $results = C4::SocialData::get_report;
8
my $results = C4::SocialData::get_report;
(-)a/misc/cronjobs/social_data/update_social_data.pl (+2 lines)
Lines 1-6 Link Here
1
#!/usr/bin/perl
1
#!/usr/bin/perl
2
2
3
use Modern::Perl;
3
use Modern::Perl;
4
5
use Koha::Cron;
4
use C4::Context;
6
use C4::Context;
5
use C4::SocialData;
7
use C4::SocialData;
6
8
(-)a/misc/cronjobs/staticfines.pl (+1 lines)
Lines 37-42 BEGIN { Link Here
37
37
38
use Date::Calc qw/Date_to_Days/;
38
use Date::Calc qw/Date_to_Days/;
39
39
40
use Koha::Cron;
40
use C4::Context;
41
use C4::Context;
41
use C4::Circulation;
42
use C4::Circulation;
42
use C4::Overdues;
43
use C4::Overdues;
(-)a/misc/cronjobs/stockrotation.pl (+2 lines)
Lines 109-114 database updates have been performed."). Link Here
109
109
110
use Modern::Perl;
110
use Modern::Perl;
111
use Getopt::Long qw/HelpMessage :config gnu_getopt/;
111
use Getopt::Long qw/HelpMessage :config gnu_getopt/;
112
113
use Koha::Cron;
112
use C4::Context;
114
use C4::Context;
113
use C4::Letters;
115
use C4::Letters;
114
use Koha::StockRotationRotas;
116
use Koha::StockRotationRotas;
(-)a/misc/cronjobs/thirdparty/TalkingTech_itiva_inbound.pl (+1 lines)
Lines 31-36 BEGIN { Link Here
31
use Getopt::Long;
31
use Getopt::Long;
32
use Pod::Usage;
32
use Pod::Usage;
33
33
34
use Koha::Cron;
34
use C4::Context;
35
use C4::Context;
35
36
36
sub usage {
37
sub usage {
(-)a/misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl (+1 lines)
Lines 31-36 BEGIN { Link Here
31
use Getopt::Long;
31
use Getopt::Long;
32
use Pod::Usage;
32
use Pod::Usage;
33
33
34
use Koha::Cron;
34
use C4::Context;
35
use C4::Context;
35
use C4::Items;
36
use C4::Items;
36
use C4::Letters;
37
use C4::Letters;
(-)a/misc/cronjobs/update_totalissues.pl (+2 lines)
Lines 30-35 BEGIN { Link Here
30
30
31
use Getopt::Long;
31
use Getopt::Long;
32
use Pod::Usage;
32
use Pod::Usage;
33
34
use Koha::Cron;
33
use C4::Context;
35
use C4::Context;
34
use C4::Biblio;
36
use C4::Biblio;
35
use C4::Log;
37
use C4::Log;
(-)a/t/Context.t (-1 / +2 lines)
Lines 2-8 Link Here
2
2
3
use Modern::Perl;
3
use Modern::Perl;
4
use DBI;
4
use DBI;
5
use Test::More tests => 26;
5
use Test::More tests => 27;
6
use Test::MockModule;
6
use Test::MockModule;
7
7
8
BEGIN {
8
BEGIN {
Lines 62-64 is(C4::Context->interface, 'opac', 'interface still opac'); Link Here
62
#Bug 14751
62
#Bug 14751
63
is( C4::Context->interface( 'SiP' ), 'sip', 'interface SiP' );
63
is( C4::Context->interface( 'SiP' ), 'sip', 'interface SiP' );
64
is( C4::Context->interface( 'COMMANDLINE' ), 'commandline', 'interface commandline uc' );
64
is( C4::Context->interface( 'COMMANDLINE' ), 'commandline', 'interface commandline uc' );
65
is( C4::Context->interface( 'CRON' ), 'cron', 'interface cron uc' );
(-)a/t/Koha/Cron.t (-1 / +48 lines)
Line 0 Link Here
0
- 
1
#!/usr/bin/perl
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 3 of the License, or
8
# (at your option) any later version.
9
#
10
# Koha is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
17
18
use Modern::Perl;
19
20
use Test::More tests => 3;
21
22
BEGIN { use_ok('Koha::Cron') }
23
24
use C4::Context;
25
26
my $userenv = C4::Context->userenv;
27
is_deeply(
28
    $userenv,
29
    {
30
        'surname'       => 'CRON',
31
        'id'            => undef,
32
        'flags'         => undef,
33
        'cardnumber'    => undef,
34
        'firstname'     => 'CRON',
35
        'branchname'    => undef,
36
        'branchprinter' => undef,
37
        'emailaddress'  => undef,
38
        'number'        => undef,
39
        'shibboleth'    => undef,
40
        'branch'        => undef
41
    },
42
    "Context userenv set correctly"
43
);
44
45
my $interface = C4::Context->interface;
46
is($interface, 'cron', "Context interface set correctly");
47
48
1;

Return to bug 22600