Bug 22600: Set 'commandline' interface appropriately
This patch change Koha::Cron to be a more generic Koha::Script class and update all commanline driven scripts to use it. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
parent
125de75517
commit
d2e189ca1c
99 changed files with 190 additions and 64 deletions
|
@ -1,4 +1,4 @@
|
|||
package Koha::Cron;
|
||||
package Koha::Script;
|
||||
|
||||
# Copyright PTFS Europe 2019
|
||||
# Copyright 2019 Koha Development Team
|
||||
|
@ -22,29 +22,50 @@ use Modern::Perl;
|
|||
|
||||
=head1 NAME
|
||||
|
||||
Koha::Cron - Koha Cron scripts base class
|
||||
Koha::Script - Koha scripts base class
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
use Koha::Cron;
|
||||
use Koha::Script
|
||||
use Koha::Script -cron;
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This class should be used in all cronscripts. It sets the interface and userenv appropriately.
|
||||
This class should be used in all scripts. It sets the interface and userenv appropriately.
|
||||
|
||||
=cut
|
||||
|
||||
use C4::Context;
|
||||
|
||||
# Set userenv
|
||||
C4::Context->_new_userenv(1);
|
||||
C4::Context->set_userenv(
|
||||
undef, undef, undef, 'CRON', 'CRON', undef,
|
||||
undef, undef, undef, undef, undef
|
||||
);
|
||||
sub import {
|
||||
my $class = shift;
|
||||
my @flags = @_;
|
||||
|
||||
# Set interface
|
||||
C4::Context->interface('cron');
|
||||
C4::Context->_new_userenv(1);
|
||||
if ( ( $flags[0] || '' ) eq '-cron' ) {
|
||||
|
||||
# Set userenv
|
||||
C4::Context->_new_userenv(1);
|
||||
C4::Context->set_userenv(
|
||||
undef, undef, undef, 'CRON', 'CRON', undef,
|
||||
undef, undef, undef, undef, undef
|
||||
);
|
||||
|
||||
# Set interface
|
||||
C4::Context->interface('cron');
|
||||
|
||||
}
|
||||
else {
|
||||
# Set userenv
|
||||
C4::Context->set_userenv(
|
||||
undef, undef, undef, 'CLI', 'CLI', undef,
|
||||
undef, undef, undef, undef, undef
|
||||
);
|
||||
|
||||
# Set interface
|
||||
C4::Context->interface('commandline');
|
||||
}
|
||||
}
|
||||
|
||||
=head1 AUTHOR
|
||||
|
|
@ -18,6 +18,7 @@
|
|||
# along with Koha; if not, see <http://www.gnu.org/licenses>.
|
||||
#
|
||||
|
||||
use Koha::Script;
|
||||
use C4::Boolean;
|
||||
use C4::Context;
|
||||
use C4::Debug;
|
||||
|
|
|
@ -12,6 +12,7 @@ BEGIN {
|
|||
}
|
||||
|
||||
# Koha modules used
|
||||
use Koha::Script;
|
||||
use C4::Context;
|
||||
use MARC::File::USMARC;
|
||||
use MARC::Record;
|
||||
|
|
|
@ -11,6 +11,7 @@ BEGIN {
|
|||
}
|
||||
|
||||
# Koha modules used
|
||||
use Koha::Script;
|
||||
use MARC::Record;
|
||||
use C4::Context;
|
||||
use C4::Biblio;
|
||||
|
|
|
@ -12,6 +12,7 @@ BEGIN {
|
|||
|
||||
# Koha modules used
|
||||
|
||||
use Koha::Script;
|
||||
use C4::Context;
|
||||
use C4::Biblio;
|
||||
use MARC::Record;
|
||||
|
|
|
@ -13,6 +13,7 @@ BEGIN {
|
|||
}
|
||||
|
||||
# Koha modules used
|
||||
use Koha::Script;
|
||||
use MARC::Record;
|
||||
use C4::Context;
|
||||
use C4::Biblio;
|
||||
|
|
|
@ -8,6 +8,7 @@ use MARC::Record;
|
|||
use Pod::Usage;
|
||||
use Time::HiRes qw(gettimeofday);
|
||||
|
||||
use Koha::Script;
|
||||
use C4::Context;
|
||||
use C4::Biblio;
|
||||
use C4::Items;
|
||||
|
|
|
@ -12,7 +12,7 @@ BEGIN {
|
|||
}
|
||||
|
||||
# Koha modules used
|
||||
|
||||
use Koha::Script;
|
||||
use C4::Context;
|
||||
use C4::Biblio;
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ use Getopt::Long;
|
|||
use Pod::Usage;
|
||||
use IO::File;
|
||||
|
||||
use Koha::Script;
|
||||
use C4::Biblio;
|
||||
|
||||
my ($help, $files);
|
||||
|
|
|
@ -10,6 +10,7 @@ use warnings;
|
|||
|
||||
use File::Find;
|
||||
|
||||
use Koha::Script;
|
||||
use C4::Context;
|
||||
|
||||
@ARGV = qw(.) unless @ARGV;
|
||||
|
|
|
@ -9,6 +9,7 @@ BEGIN {
|
|||
eval { require "$FindBin::Bin/kohalib.pl" };
|
||||
}
|
||||
|
||||
use Koha::Script;
|
||||
use C4::Context;
|
||||
use C4::ImportBatch;
|
||||
use Getopt::Long;
|
||||
|
|
|
@ -49,7 +49,7 @@ BEGIN {
|
|||
use FindBin;
|
||||
eval { require "$FindBin::Bin/../kohalib.pl" };
|
||||
}
|
||||
use Koha::Cron;
|
||||
use Koha::Script -cron;
|
||||
use C4::Biblio;
|
||||
use C4::Context;
|
||||
use C4::Letters;
|
||||
|
|
|
@ -6,7 +6,7 @@ use Getopt::Long;
|
|||
use Pod::Usage;
|
||||
use JSON;
|
||||
|
||||
use Koha::Cron;
|
||||
use Koha::Script -cron;
|
||||
use C4::Context;
|
||||
use C4::Items;
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ use Modern::Perl;
|
|||
use Pod::Usage;
|
||||
use Getopt::Long;
|
||||
|
||||
use Koha::Cron;
|
||||
use Koha::Script -cron;
|
||||
use C4::Circulation;
|
||||
use C4::Context;
|
||||
use C4::Log;
|
||||
|
|
|
@ -29,7 +29,7 @@ BEGIN {
|
|||
eval { require "$FindBin::Bin/../kohalib.pl" };
|
||||
}
|
||||
|
||||
use Koha::Cron;
|
||||
use Koha::Script -cron;
|
||||
use C4::Context;
|
||||
use Koha::Patrons;
|
||||
use Date::Calc qw(
|
||||
|
|
|
@ -10,7 +10,7 @@ BEGIN {
|
|||
eval { require "$FindBin::Bin/../kohalib.pl" };
|
||||
}
|
||||
|
||||
use Koha::Cron;
|
||||
use Koha::Script -cron;
|
||||
use C4::Koha;
|
||||
use C4::Context;
|
||||
use C4::Biblio;
|
||||
|
|
|
@ -28,7 +28,7 @@ cart_to_shelf.pl cron script to set items with location of CART to original she
|
|||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Koha::Cron;
|
||||
use Koha::Script -cron;
|
||||
use C4::Items qw/ CartToShelf /;
|
||||
use C4::Log;
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ use Modern::Perl;
|
|||
use Pod::Usage;
|
||||
use Getopt::Long;
|
||||
|
||||
use Koha::Cron;
|
||||
use Koha::Script -cron;
|
||||
use C4::Context;
|
||||
use C4::Biblio;
|
||||
use AnyEvent;
|
||||
|
|
|
@ -78,7 +78,7 @@ use strict;
|
|||
use warnings;
|
||||
use LWP::UserAgent;
|
||||
use HTTP::Request;
|
||||
use Koha::Cron;
|
||||
use Koha::Script -cron;
|
||||
use C4::Biblio;
|
||||
|
||||
|
||||
|
@ -148,7 +148,7 @@ use Carp;
|
|||
|
||||
use Pod::Usage;
|
||||
use Getopt::Long;
|
||||
use Koha::Cron;
|
||||
use Koha::Script -cron;
|
||||
use C4::Context;
|
||||
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ BEGIN {
|
|||
eval { require "$FindBin::Bin/../kohalib.pl" };
|
||||
}
|
||||
|
||||
use Koha::Cron;
|
||||
use Koha::Script -cron;
|
||||
use C4::Context;
|
||||
use C4::Search;
|
||||
use C4::Search::History;
|
||||
|
|
|
@ -26,7 +26,7 @@ use YAML::Syck;
|
|||
use Pod::Usage;
|
||||
use Getopt::Long;
|
||||
|
||||
use Koha::Cron;
|
||||
use Koha::Script -cron;
|
||||
use C4::Context;
|
||||
use C4::Log;
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ use DBI;
|
|||
use Getopt::Long;
|
||||
use Pod::Usage;
|
||||
|
||||
use Koha::Cron;
|
||||
use Koha::Script -cron;
|
||||
use C4::Context;
|
||||
use English qw(-no_match_vars);
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ BEGIN {
|
|||
eval { my $lib = "$FindBin::Bin/../kohalib.pl"; require $lib };
|
||||
}
|
||||
|
||||
use Koha::Cron;
|
||||
use Koha::Script -cron;
|
||||
use C4::Context;
|
||||
|
||||
my $help;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
use Getopt::Long;
|
||||
|
||||
use Koha::Cron;
|
||||
use Koha::Script -cron;
|
||||
use C4::Context;
|
||||
use C4::Items;
|
||||
use C4::Circulation;
|
||||
|
|
|
@ -5,7 +5,7 @@ use Modern::Perl;
|
|||
use Pod::Usage;
|
||||
use Getopt::Long;
|
||||
|
||||
use Koha::Cron;
|
||||
use Koha::Script -cron;
|
||||
use C4::Members;
|
||||
use Koha::DateUtils;
|
||||
use Koha::Patrons;
|
||||
|
|
|
@ -33,7 +33,7 @@ BEGIN {
|
|||
|
||||
use Getopt::Long;
|
||||
use Pod::Usage;
|
||||
use Koha::Cron;
|
||||
use Koha::Script -cron;
|
||||
use C4::Biblio;
|
||||
use C4::Items;
|
||||
use Koha::Database;
|
||||
|
|
|
@ -29,7 +29,7 @@ use utf8;
|
|||
# can be run as frequently as required
|
||||
# log messages are appended to logdir/editrace.log
|
||||
|
||||
use Koha::Cron;
|
||||
use Koha::Script -cron;
|
||||
use C4::Context;
|
||||
use Log::Log4perl qw(:easy);
|
||||
use Koha::Database;
|
||||
|
|
|
@ -30,7 +30,7 @@ use strict;
|
|||
use warnings;
|
||||
use 5.010;
|
||||
|
||||
use Koha::Cron;
|
||||
use Koha::Script -cron;
|
||||
use C4::Context;
|
||||
use C4::Overdues;
|
||||
use Getopt::Long;
|
||||
|
|
|
@ -10,7 +10,7 @@ BEGIN {
|
|||
}
|
||||
|
||||
use CGI qw( utf8 ); # NOT a CGI script, this is just to keep C4::Templates::gettemplate happy
|
||||
use Koha::Cron;
|
||||
use Koha::Script -cron;
|
||||
use C4::Context;
|
||||
use C4::Debug;
|
||||
use C4::Letters;
|
||||
|
|
|
@ -29,7 +29,7 @@ BEGIN {
|
|||
|
||||
# cancel all expired hold requests
|
||||
|
||||
use Koha::Cron;
|
||||
use Koha::Script -cron;
|
||||
use C4::Reserves;
|
||||
use C4::Log;
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ BEGIN {
|
|||
eval { require "$FindBin::Bin/../kohalib.pl" };
|
||||
}
|
||||
|
||||
use Koha::Cron;
|
||||
use Koha::Script -cron;
|
||||
use C4::HoldsQueue qw(CreateQueue);
|
||||
use C4::Log;
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ BEGIN {
|
|||
|
||||
# cancel all expired hold requests
|
||||
|
||||
use Koha::Cron;
|
||||
use Koha::Script -cron;
|
||||
use C4::Reserves;
|
||||
use C4::Log;
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ BEGIN {
|
|||
use Getopt::Long;
|
||||
use Pod::Usage;
|
||||
|
||||
use Koha::Cron;
|
||||
use Koha::Script -cron;
|
||||
use C4::Reserves;
|
||||
use C4::Log;
|
||||
use Koha::Holds;
|
||||
|
|
|
@ -31,7 +31,7 @@ BEGIN {
|
|||
|
||||
use Getopt::Long;
|
||||
use Pod::Usage;
|
||||
use Koha::Cron;
|
||||
use Koha::Script -cron;
|
||||
use C4::ImportBatch;
|
||||
|
||||
my ($help, $framework);
|
||||
|
|
|
@ -26,7 +26,7 @@ BEGIN {
|
|||
eval { require "$FindBin::Bin/../kohalib.pl" };
|
||||
}
|
||||
|
||||
use Koha::Cron;
|
||||
use Koha::Script -cron;
|
||||
use C4::Context;
|
||||
use C4::Members;
|
||||
use Getopt::Long;
|
||||
|
|
|
@ -34,7 +34,7 @@ BEGIN {
|
|||
eval { require "$FindBin::Bin/../kohalib.pl" };
|
||||
}
|
||||
|
||||
use Koha::Cron;
|
||||
use Koha::Script -cron;
|
||||
use C4::Context;
|
||||
use C4::Items;
|
||||
use C4::Circulation qw/LostItem MarkIssueReturned/;
|
||||
|
|
|
@ -126,7 +126,7 @@ BEGIN {
|
|||
eval { require "$FindBin::Bin/../kohalib.pl" };
|
||||
}
|
||||
|
||||
use Koha::Cron;
|
||||
use Koha::Script -cron;
|
||||
use C4::Context;
|
||||
use C4::Letters;
|
||||
use C4::Log;
|
||||
|
|
|
@ -5,7 +5,7 @@ use Getopt::Long;
|
|||
use Pod::Usage;
|
||||
use Time::HiRes qw(gettimeofday);
|
||||
|
||||
use Koha::Cron;
|
||||
use Koha::Script -cron;
|
||||
use C4::AuthoritiesMarc;
|
||||
use Koha::Authority::MergeRequests;
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ use Modern::Perl;
|
|||
use Pod::Usage;
|
||||
use Getopt::Long;
|
||||
|
||||
use Koha::Cron;
|
||||
use Koha::Script -cron;
|
||||
use C4::Budgets qw( GetBudget );
|
||||
use C4::Suggestions qw( GetUnprocessedSuggestions );
|
||||
use Koha::Libraries;
|
||||
|
|
|
@ -34,7 +34,7 @@ use Text::CSV_XS;
|
|||
use DateTime;
|
||||
use DateTime::Duration;
|
||||
|
||||
use Koha::Cron;
|
||||
use Koha::Script -cron;
|
||||
use C4::Context;
|
||||
use C4::Letters;
|
||||
use C4::Overdues qw(GetFine GetOverdueMessageTransportTypes parse_overdues_letter);
|
||||
|
|
|
@ -26,7 +26,7 @@ BEGIN {
|
|||
eval { require "$FindBin::Bin/../kohalib.pl" };
|
||||
}
|
||||
|
||||
use Koha::Cron;
|
||||
use Koha::Script -cron;
|
||||
use C4::Letters;
|
||||
use C4::Log;
|
||||
use Getopt::Long;
|
||||
|
|
|
@ -29,7 +29,7 @@ BEGIN {
|
|||
use Getopt::Long;
|
||||
use Pod::Usage;
|
||||
|
||||
use Koha::Cron;
|
||||
use Koha::Script -cron;
|
||||
use C4::Suggestions;
|
||||
use C4::Log;
|
||||
use C4::Context;
|
||||
|
|
|
@ -62,7 +62,7 @@ BEGIN {
|
|||
eval { require "$FindBin::Bin/../kohalib.pl" };
|
||||
}
|
||||
|
||||
use Koha::Cron;
|
||||
use Koha::Script -cron;
|
||||
use C4::Log;
|
||||
|
||||
use Koha::Account::Lines;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Koha::Cron;
|
||||
use Koha::Script -cron;
|
||||
use C4::Context;
|
||||
|
||||
# this script will remove those older than 5 days
|
||||
|
|
|
@ -29,7 +29,7 @@ use Modern::Perl;
|
|||
|
||||
use Template;
|
||||
|
||||
use Koha::Cron;
|
||||
use Koha::Script -cron;
|
||||
use C4::Context;
|
||||
use Time::Local;
|
||||
use POSIX;
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
use Modern::Perl;
|
||||
|
||||
use Koha::Cron;
|
||||
use Koha::Script -cron;
|
||||
use C4::Reports::Guided; # 0.12
|
||||
use Koha::Reports;
|
||||
use C4::Context;
|
||||
|
|
|
@ -28,7 +28,7 @@ BEGIN {
|
|||
eval { require "$FindBin::Bin/../kohalib.pl" };
|
||||
}
|
||||
|
||||
use Koha::Cron;
|
||||
use Koha::Script -cron;
|
||||
use C4::Context;
|
||||
use C4::Debug;
|
||||
use C4::Serials;
|
||||
|
|
|
@ -5,7 +5,7 @@ use Modern::Perl;
|
|||
use Pod::Usage;
|
||||
use Getopt::Long;
|
||||
|
||||
use Koha::Cron;
|
||||
use Koha::Script -cron;
|
||||
use C4::Context;
|
||||
use C4::UsageStats;
|
||||
use C4::Log;
|
||||
|
|
|
@ -24,7 +24,7 @@ use utf8;
|
|||
use Pod::Usage;
|
||||
use Getopt::Long;
|
||||
|
||||
use Koha::Cron;
|
||||
use Koha::Script -cron;
|
||||
use C4::Biblio;
|
||||
use Koha::Sitemapper;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
use Modern::Perl;
|
||||
|
||||
use Koha::Cron;
|
||||
use Koha::Script -cron;
|
||||
use C4::SocialData;
|
||||
|
||||
my $results = C4::SocialData::get_report;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
use Modern::Perl;
|
||||
|
||||
use Koha::Cron;
|
||||
use Koha::Script -cron;
|
||||
use C4::Context;
|
||||
use C4::SocialData;
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ BEGIN {
|
|||
|
||||
use Date::Calc qw/Date_to_Days/;
|
||||
|
||||
use Koha::Cron;
|
||||
use Koha::Script -cron;
|
||||
use C4::Context;
|
||||
use C4::Circulation;
|
||||
use C4::Overdues;
|
||||
|
|
|
@ -110,7 +110,7 @@ database updates have been performed.").
|
|||
use Modern::Perl;
|
||||
use Getopt::Long qw/HelpMessage :config gnu_getopt/;
|
||||
|
||||
use Koha::Cron;
|
||||
use Koha::Script -cron;
|
||||
use C4::Context;
|
||||
use C4::Letters;
|
||||
use Koha::StockRotationRotas;
|
||||
|
|
|
@ -31,7 +31,7 @@ BEGIN {
|
|||
use Getopt::Long;
|
||||
use Pod::Usage;
|
||||
|
||||
use Koha::Cron;
|
||||
use Koha::Script -cron;
|
||||
use C4::Context;
|
||||
|
||||
sub usage {
|
||||
|
|
|
@ -31,7 +31,7 @@ BEGIN {
|
|||
use Getopt::Long;
|
||||
use Pod::Usage;
|
||||
|
||||
use Koha::Cron;
|
||||
use Koha::Script -cron;
|
||||
use C4::Context;
|
||||
use C4::Items;
|
||||
use C4::Letters;
|
||||
|
|
|
@ -31,7 +31,7 @@ BEGIN {
|
|||
use Getopt::Long;
|
||||
use Pod::Usage;
|
||||
|
||||
use Koha::Cron;
|
||||
use Koha::Script -cron;
|
||||
use C4::Context;
|
||||
use C4::Biblio;
|
||||
use C4::Log;
|
||||
|
|
|
@ -21,6 +21,7 @@ use Modern::Perl;
|
|||
use Getopt::Long;
|
||||
use Pod::Usage;
|
||||
|
||||
use Koha::Script;
|
||||
use Koha::Patrons;
|
||||
|
||||
my ( $help, $surname, $userid, $password, $branchcode, $categorycode, $cardnumber );
|
||||
|
|
|
@ -22,6 +22,7 @@ use Modern::Perl;
|
|||
use Getopt::Long;
|
||||
use Pod::Usage;
|
||||
|
||||
use Koha::Script;
|
||||
use C4::Installer;
|
||||
use C4::Context;
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ use Modern::Perl;
|
|||
use Text::CSV;
|
||||
use Getopt::Long qw(:config no_ignore_case);
|
||||
|
||||
use Koha::Script;
|
||||
use C4::Context;
|
||||
use Koha::Patrons;
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ use List::MoreUtils qw(uniq);
|
|||
use Getopt::Long;
|
||||
use Pod::Usage;
|
||||
|
||||
use Koha::Script;
|
||||
use C4::Auth;
|
||||
use C4::Context;
|
||||
use C4::Record;
|
||||
|
|
|
@ -12,6 +12,7 @@ BEGIN {
|
|||
eval { require "$FindBin::Bin/kohalib.pl" };
|
||||
}
|
||||
|
||||
use Koha::Script;
|
||||
use C4::Context;
|
||||
use C4::Biblio;
|
||||
use C4::Auth;
|
||||
|
|
|
@ -22,6 +22,7 @@ use Modern::Perl;
|
|||
use Getopt::Long;
|
||||
use Pod::Usage;
|
||||
|
||||
use Koha::Script;
|
||||
use Koha::Patrons::Import;
|
||||
my $Import = Koha::Patrons::Import->new();
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ BEGIN {
|
|||
eval { require "$FindBin::Bin/kohalib.pl" };
|
||||
}
|
||||
|
||||
use Koha::Script;
|
||||
use C4::Context;
|
||||
use C4::Biblio;
|
||||
use Getopt::Long;
|
||||
|
|
|
@ -12,6 +12,7 @@ BEGIN {
|
|||
eval { require "$FindBin::Bin/../kohalib.pl" };
|
||||
}
|
||||
|
||||
use Koha::Script;
|
||||
use C4::Biblio;
|
||||
|
||||
sub process {
|
||||
|
|
|
@ -12,6 +12,7 @@ BEGIN {
|
|||
eval { require "$FindBin::Bin/../kohalib.pl" };
|
||||
}
|
||||
|
||||
use Koha::Script;
|
||||
use C4::Biblio;
|
||||
use Getopt::Long;
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ use Modern::Perl;
|
|||
use Getopt::Long;
|
||||
use Pod::Usage;
|
||||
|
||||
use Koha::Script;
|
||||
use Koha::Authorities;
|
||||
use Koha::Authority::Subfields;
|
||||
use Koha::MetadataRecord::Authority;
|
||||
|
|
|
@ -26,6 +26,7 @@ BEGIN {
|
|||
eval { require "$FindBin::Bin/../kohalib.pl" };
|
||||
}
|
||||
|
||||
use Koha::Script;
|
||||
use C4::Context;
|
||||
use C4::Members::Messaging;
|
||||
use Getopt::Long;
|
||||
|
|
|
@ -30,6 +30,7 @@ use open OUT => ':encoding(UTF-8)', ':std';
|
|||
use Getopt::Long;
|
||||
use Pod::Usage;
|
||||
|
||||
use Koha::Script;
|
||||
use C4::Context;
|
||||
my $dbh = C4::Context->dbh;
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ BEGIN {
|
|||
eval { require "$FindBin::Bin/../kohalib.pl" };
|
||||
}
|
||||
|
||||
use Koha::Script;
|
||||
use C4::Context;
|
||||
use Getopt::Long;
|
||||
use Pod::Usage;
|
||||
|
|
|
@ -27,6 +27,7 @@ BEGIN {
|
|||
eval { require "$FindBin::Bin/../kohalib.pl" };
|
||||
}
|
||||
|
||||
use Koha::Script;
|
||||
use C4::Context;
|
||||
use C4::Installer;
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ use Getopt::Long;
|
|||
use Pod::Usage;
|
||||
use YAML;
|
||||
use Try::Tiny;
|
||||
use Koha::Script;
|
||||
use C4::Context;
|
||||
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ use Modern::Perl;
|
|||
use C4::Context;
|
||||
use C4::Tags;
|
||||
|
||||
use Koha::Script;
|
||||
use Koha::Database;
|
||||
use Koha::Tags;
|
||||
use Koha::Tags::Approvals;
|
||||
|
|
|
@ -20,6 +20,7 @@ use strict;
|
|||
use warnings;
|
||||
use 5.010;
|
||||
|
||||
use Koha::Script;
|
||||
use Koha::Indexer::Utils;
|
||||
|
||||
use Getopt::Long;
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Koha::Script;
|
||||
use Koha::RecordProcessor;
|
||||
use Data::Dumper;
|
||||
use C4::Biblio;
|
||||
|
|
|
@ -22,6 +22,7 @@ use strict;
|
|||
use warnings;
|
||||
$|=1;
|
||||
|
||||
use Koha::Script;
|
||||
use C4::Context;
|
||||
use C4::Biblio;
|
||||
use Getopt::Long;
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
# along with Koha; if not, see <http://www.gnu.org/licenses>.
|
||||
|
||||
use Modern::Perl;
|
||||
|
||||
use Koha::Script;
|
||||
use C4::Charset qw( SanitizeRecord );
|
||||
use C4::Context;
|
||||
use DBI;
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
use Modern::Perl;
|
||||
|
||||
use Koha::Script;
|
||||
use Koha::Items;
|
||||
use Koha::Biblioitems;
|
||||
use Koha::ItemTypes;
|
||||
|
|
|
@ -28,6 +28,8 @@ BEGIN {
|
|||
|
||||
# possible modules to use
|
||||
use Getopt::Long;
|
||||
|
||||
use Koha::Script;
|
||||
use C4::Context;
|
||||
use C4::Biblio;
|
||||
use Pod::Usage;
|
||||
|
|
|
@ -28,6 +28,8 @@ BEGIN {
|
|||
|
||||
# possible modules to use
|
||||
use Getopt::Long;
|
||||
|
||||
use Koha::Script;
|
||||
use C4::Context;
|
||||
use C4::Items;
|
||||
use Pod::Usage;
|
||||
|
|
|
@ -23,6 +23,7 @@ use Getopt::Long;
|
|||
use List::MoreUtils qw/uniq/;
|
||||
use Pod::Usage;
|
||||
|
||||
use Koha::Script;
|
||||
use C4::AuthoritiesMarc qw/AddAuthority DelAuthority GetAuthority merge/;
|
||||
|
||||
my ( @authid, $confirm, $delete, $help, $merge, $reference, $renumber, $verbose );
|
||||
|
|
|
@ -6,6 +6,7 @@ use strict;
|
|||
#use warnings; FIXME - Bug 2505
|
||||
|
||||
# Koha modules used
|
||||
use Koha::Script;
|
||||
use C4::Context;
|
||||
use C4::Biblio;
|
||||
use C4::AuthoritiesMarc;
|
||||
|
|
|
@ -8,6 +8,7 @@ use strict;
|
|||
use MARC::File::USMARC;
|
||||
use MARC::Record;
|
||||
use MARC::Batch;
|
||||
use Koha::Script;
|
||||
use C4::Context;
|
||||
use C4::Biblio;
|
||||
use C4::AuthoritiesMarc;
|
||||
|
|
|
@ -6,6 +6,7 @@ use strict;
|
|||
#use warnings; FIXME - Bug 2505
|
||||
|
||||
# Koha modules used
|
||||
use Koha::Script;
|
||||
use C4::Context;
|
||||
use C4::Biblio;
|
||||
use C4::AuthoritiesMarc;
|
||||
|
|
|
@ -42,6 +42,7 @@ use MARC::File::XML;
|
|||
use List::MoreUtils qw/uniq/;
|
||||
use Getopt::Std;
|
||||
|
||||
use Koha::Script;
|
||||
use C4::Context;
|
||||
use C4::Charset qw/StripNonXmlChars/;
|
||||
use C4::Biblio;
|
||||
|
|
|
@ -17,6 +17,7 @@ use MARC::Record;
|
|||
use MARC::Batch;
|
||||
use MARC::Charset;
|
||||
|
||||
use Koha::Script;
|
||||
use C4::Context;
|
||||
use C4::Biblio;
|
||||
use C4::Koha;
|
||||
|
|
|
@ -33,6 +33,7 @@ BEGIN {
|
|||
|
||||
# Koha modules used
|
||||
use MARC::Record;
|
||||
use Koha::Script;
|
||||
use C4::Context;
|
||||
use Getopt::Long;
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ BEGIN {
|
|||
eval { require "$FindBin::Bin/../kohalib.pl" };
|
||||
}
|
||||
|
||||
use Koha::Script;
|
||||
use C4::Context;
|
||||
use C4::Biblio;
|
||||
use C4::Items;
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
|
||||
use strict;
|
||||
#use warnings; FIXME - Bug 2505
|
||||
use C4::Context;
|
||||
|
||||
use Koha::Script;
|
||||
use C4::Context;
|
||||
use C4::Items;
|
||||
use C4::Biblio;
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ use Modern::Perl;
|
|||
use Getopt::Long;
|
||||
use Text::CSV;
|
||||
|
||||
use Koha::Script;
|
||||
use C4::Context;
|
||||
use C4::Biblio;
|
||||
use C4::Koha qw( GetVariationsOfISBN );
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
use Modern::Perl;
|
||||
|
||||
use Koha::Script;
|
||||
use C4::Context;
|
||||
use Getopt::Long;
|
||||
use Fcntl qw(:flock);
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Koha::Script;
|
||||
use C4::Context;
|
||||
use C4::AuthoritiesMarc;
|
||||
use Getopt::Long;
|
||||
|
|
|
@ -29,6 +29,7 @@ BEGIN {
|
|||
eval { require "$FindBin::Bin/../kohalib.pl" };
|
||||
}
|
||||
|
||||
use Koha::Script;
|
||||
use C4::Biblio;
|
||||
use C4::Context;
|
||||
use Getopt::Long;
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
|
||||
use strict;
|
||||
#use warnings; FIXME - Bug 2505
|
||||
use C4::Context;
|
||||
|
||||
use Koha::Script;
|
||||
use C4::Context;
|
||||
use C4::Items;
|
||||
use C4::Biblio;
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ use Modern::Perl;
|
|||
use Getopt::Long;
|
||||
use Pod::Usage;
|
||||
|
||||
use Koha::Script;
|
||||
use C4::Biblio;
|
||||
|
||||
my @biblios;
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Koha::Script;
|
||||
use C4::Context;
|
||||
use C4::Items;
|
||||
use Data::Dumper;
|
||||
|
|
|
@ -83,6 +83,7 @@ Full documentation.
|
|||
|
||||
use autodie;
|
||||
use Getopt::Long;
|
||||
use Koha::Script;
|
||||
use C4::Context;
|
||||
use Koha::MetadataRecord::Authority;
|
||||
use Koha::BiblioUtils;
|
||||
|
|
|
@ -27,6 +27,7 @@ BEGIN {
|
|||
eval { require "$FindBin::Bin/kohalib.pl" };
|
||||
}
|
||||
|
||||
use Koha::Script;
|
||||
use C4::Context;
|
||||
use C4::ImportBatch;
|
||||
use C4::Matcher;
|
||||
|
|
48
t/Koha/Script.t
Normal file
48
t/Koha/Script.t
Normal file
|
@ -0,0 +1,48 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
# This file is part of Koha.
|
||||
#
|
||||
# Koha is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Koha is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Koha; if not, see <http://www.gnu.org/licenses>.
|
||||
|
||||
use Modern::Perl;
|
||||
|
||||
use Test::More tests => 3;
|
||||
|
||||
BEGIN { use_ok('Koha::Script') }
|
||||
|
||||
use C4::Context;
|
||||
|
||||
my $userenv = C4::Context->userenv;
|
||||
is_deeply(
|
||||
$userenv,
|
||||
{
|
||||
'surname' => 'CLI',
|
||||
'id' => undef,
|
||||
'flags' => undef,
|
||||
'cardnumber' => undef,
|
||||
'firstname' => 'CLI',
|
||||
'branchname' => undef,
|
||||
'branchprinter' => undef,
|
||||
'emailaddress' => undef,
|
||||
'number' => undef,
|
||||
'shibboleth' => undef,
|
||||
'branch' => undef
|
||||
},
|
||||
"Context userenv set correctly with no flags"
|
||||
);
|
||||
|
||||
my $interface = C4::Context->interface;
|
||||
is( $interface, 'commandline', "Context interface set correctly with no flags" );
|
||||
|
||||
1;
|
|
@ -19,7 +19,7 @@ use Modern::Perl;
|
|||
|
||||
use Test::More tests => 3;
|
||||
|
||||
BEGIN { use_ok('Koha::Cron') }
|
||||
BEGIN { use_ok( "Koha::Script", '-cron' ) }
|
||||
|
||||
use C4::Context;
|
||||
|
||||
|
@ -39,10 +39,10 @@ is_deeply(
|
|||
'shibboleth' => undef,
|
||||
'branch' => undef
|
||||
},
|
||||
"Context userenv set correctly"
|
||||
"Context userenv set correctly with -cron"
|
||||
);
|
||||
|
||||
my $interface = C4::Context->interface;
|
||||
is($interface, 'cron', "Context interface set correctly");
|
||||
is( $interface, 'cron', "Context interface set correctly with -cron" );
|
||||
|
||||
1;
|
Loading…
Reference in a new issue