use vars qw($VERSION @ISA @EXPORT);
BEGIN {
- # set the version for version checking
+ # set the version for version checking
$VERSION = 3.07.00.049;
- require Exporter;
- @ISA = qw(Exporter);
- @EXPORT = qw(&logaction &GetLogStatus &displaylog &GetLogs);
+ require Exporter;
+ @ISA = qw(Exporter);
+ @EXPORT = qw(&logaction &cronlogaction &GetLogStatus &displaylog &GetLogs);
}
=head1 NAME
$sth->finish;
}
+=item cronlogaction
+
+ &cronlogaction();
+
+Convenience routine to add a record into action_logs table from a cron job.
+
+=cut
+
+#'
+sub cronlogaction {
+ logaction( 'CRONJOBS', 'Run', 0, (caller(0))[1] ) if C4::Context->preference('CronjobLog');
+}
+
+
=item GetLogStatus
$status = GetLogStatus;
--- /dev/null
+INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES ('CronjobLog','0',NULL,'If ON, log information from cron jobs.','YesNo');
('CoceProviders', NULL, 'aws,gb,ol', 'Coce providers', 'multiple'),
('COinSinOPACResults','1','','If ON, use COinS in OPAC search results page. NOTE: this can slow down search response time significantly','YesNo'),
('ConfirmFutureHolds','0','','Number of days for confirming future holds','Integer'),
+('CronjobLog','0',NULL,'If ON, log information from cron jobs.','YesNo'),
('CurrencyFormat','US','US|FR','Determines the display format of currencies. eg: \'36000\' is displayed as \'360 000,00\' in \'FR\' or \'360,000.00\' in \'US\'.','Choice'),
('dateformat','us','metric|us|iso','Define global date format (us mm/dd/yyyy, metric dd/mm/yyy, ISO yyyy-mm-dd)','Choice'),
('DebugLevel','2','0|1|2','Define the level of debugging information sent to the browser when errors are encountered (set to 0 in production). 0=none, 1=some, 2=most','Choice'),
on: Log
off: "Don't log"
- when serials are added, deleted or changed.
+ -
+ - pref: CronjobLog
+ choices:
+ on: Log
+ off: "Don't log"
+ - information from cron jobs.
[% CASE 'LETTER' %]Letter
[% CASE 'FINES' %]Fines
[% CASE 'SYSTEMPREFERENCE' %]System prefs
+[% CASE 'CRONJOBS' %]Cron jobs
[% CASE %][% module %]
[% END %]
[% END %]
[% ELSE %]
<option value="">All</option>
[% END %]
- [% FOREACH modx IN [ 'CATALOGUING' 'AUTHORITIES' 'MEMBERS' 'ACQUISITIONS' 'SERIAL' 'CIRCULATION' 'LETTER' 'FINES' 'SYSTEMPREFERENCE' ] %]
+ [% FOREACH modx IN [ 'CATALOGUING' 'AUTHORITIES' 'MEMBERS' 'ACQUISITIONS' 'SERIAL' 'CIRCULATION' 'LETTER' 'FINES' 'SYSTEMPREFERENCE' 'CRONJOBS' ] %]
[% IF modules.grep(modx).size %]
<option value="[% modx %]" selected="selected">[% PROCESS translate_log_module module=modx %]</option>
[% ELSE %]
use C4::Members::Messaging;
use C4::Overdues;
use Koha::DateUtils;
+use C4::Log;
=head1 NAME
unless ($confirm) {
pod2usage(1);
}
+
+cronlogaction();
+
# The fields that will be substituted into <<items.content>>
my @item_content_fields = split(/,/,$itemscontent);
use C4::Circulation;
use C4::Context;
+use C4::Log;
+
+cronlogaction();
my $dbh = C4::Context->dbh;
my ( $borrowernumber, $itemnumber, $branch, $ok, $error );
Add_Delta_Days
);
use Getopt::Long;
+use C4::Log;
sub usage {
print STDERR <<USAGE;
usage(1);
}
+cronlogaction();
+
my ($year,$month,$day) = Today();
my ($newyear,$newmonth,$newday) = Add_Delta_Days ($year,$month,$day,(-1)*$days);
my $formatdate = sprintf "%4d-%02d-%02d",$newyear,$newmonth,$newday;
use ZOOM;
use MARC::File::USMARC;
use Getopt::Long;
+use C4::Log;
+
my ( $input_marc_file, $number) = ('',0);
my ($version, $confirm,$test_parameter,$field,$batch,$max_digits,$cloud_tag);
GetOptions(
warn "browser : $browser_tag / $browser_subfield" unless $batch;
die "no cloud or browser field/subfield defined : nothing to do !" unless $browser_tag or $cloud_tag;
+cronlogaction();
+
my $dbh = C4::Context->dbh;
my $i=0;
use warnings;
use C4::Items qw/ CartToShelf /;
+use C4::Log;
BEGIN {
die "ERROR: No --hours (-h) option defined";
}
+cronlogaction();
+
my $query = "SELECT itemnumber FROM items WHERE location = 'CART' AND TIMESTAMPDIFF(HOUR, items.timestamp, NOW() ) > ?";
my $sth = C4::Context->dbh->prepare($query);
$sth->execute($hours);
use C4::Context;
use C4::Dates;
-
use C4::Search;
-
use Getopt::Long;
+use C4::Log;
sub usage {
print STDERR <<USAGE;
usage(1);
}
+cronlogaction();
+
my $dbh = C4::Context->dbh();
my $sth;
my $sth2;
use Pod::Usage;
use Getopt::Long;
use C4::Context;
-
+use C4::Log;
my $verbose = 0;
my $help = 0;
usage() if $help || !$conf;
+cronlogaction();
my @clouds;
print "Reading configuration file: $conf\n" if $verbose;
use C4::Context;
use C4::Members qw/ DelMember /;
+use C4::Log;
my $help;
my $confirm;
exit;
}
+cronlogaction();
+
# Delete accounts that haven't been upgraded from the 'temporary' category code
my $delay =
C4::Context->preference('PatronSelfRegistrationExpireTemporaryAccountsDelay');
use C4::Members;
use C4::VirtualShelves;
use Koha::DateUtils;
+use C4::Log;
my ( $help, $verbose, $not_borrowed_since, $expired_before, $category_code,
$branchcode, $confirm );
exit;
}
+cronlogaction();
+
my $members = GetBorrowersToExpunge(
{
not_borrowered_since => $not_borrowed_since,
use C4::Context;
use C4::Members qw/ DelMember /;
+use C4::Log;
my $help;
my $confirm;
exit;
}
+cronlogaction();
+
my $dbh = C4::Context->dbh;
$dbh->do( "
use Koha::Calendar;
use Koha::DateUtils;
+use C4::Log;
my $help;
my $verbose;
exit;
}
+cronlogaction();
+
my @borrower_fields =
qw(cardnumber categorycode surname firstname email phone address citystate);
my @item_fields = qw(itemnumber barcode date_due);
use C4::Templates;
use File::Spec;
use Getopt::Long;
+use C4::Log;
sub usage {
print STDERR <<USAGE;
usage(1);
}
+cronlogaction();
+
my $today = C4::Dates->new();
my @all_messages = @{ GetPrintMessages() };
exit unless (@all_messages);
# cancel all expired hold requests
use C4::Reserves;
+use C4::Log;
+
+cronlogaction();
AutoUnsuspendReserves();
}
use C4::HoldsQueue qw(CreateQueue);
+use C4::Log;
+
+cronlogaction();
CreateQueue();
# cancel all expired hold requests
use C4::Reserves;
+use C4::Log;
+
+cronlogaction();
CancelExpiredReserves();
use C4::Members;
use Getopt::Long;
use Pod::Usage;
+use C4::Log;
=head1 NAME
exit;
}
+cronlogaction();
+
my $dbh=C4::Context->dbh;
my @branches = C4::Branch::GetBranches();
#get today's date, format it and subtract upperagelimit
use C4::Items;
use C4::Circulation qw/LostItem/;
use Getopt::Long;
+use C4::Log;
my $lost; # key=lost value, value=num days.
my ($charge, $verbose, $confirm, $quiet);
print "### TEST MODE -- NO ACTIONS TAKEN ###\n";
}
+cronlogaction();
+
# In my opinion, this line is safe SQL to have outside the API. --atz
our $bounds_sth = C4::Context->dbh->prepare("SELECT DATE_SUB(CURDATE(), INTERVAL ? DAY)");
use C4::Letters;
use C4::Overdues qw(GetFine GetOverdueMessageTransportTypes);
use C4::Budgets qw(GetCurrency);
-use Koha::DateUtils;
-
use Koha::Borrower::Debarments qw(AddUniqueDebarment);
use Koha::DateUtils;
use Koha::Calendar;
+use C4::Log;
=head1 NAME
pod2usage(1) if $help;
pod2usage( -verbose => 2 ) if $man;
+cronlogaction();
+
if ( defined $csvfilename && $csvfilename =~ /^-/ ) {
warn qq(using "$csvfilename" as filename, that seems odd);
}
eval { require "$FindBin::Bin/../kohalib.pl" };
}
use C4::Letters;
+use C4::Log;
use Getopt::Long;
my $username = undef;
die $usage if $help;
+cronlogaction();
+
C4::Letters::SendQueuedMessages( { verbose => $verbose, username => $username, password => $password, method => $method } );
use Getopt::Long;
use Pod::Usage;
use C4::Suggestions;
+use C4::Log;
my ($help, $days);
}
if($days){
+ cronlogaction();
DelSuggestionsOlderThan($days);
}
use C4::Reports::Guided; # 0.12
use C4::Context;
use Koha::Email;
+use C4::Log;
use Getopt::Long qw(:config auto_help auto_version);
use Pod::Usage;
pod2usage( -verbose => 2 ) if ($help and $verbose);
pod2usage(1) if $help;
+cronlogaction();
+
unless ($format) {
$verbose and print STDERR "No format specified, assuming 'text'\n";
$format = 'text';
use C4::Dates qw/format_date format_date_in_iso/;
use C4::Debug;
use C4::Serials;
+use C4::Log;
use Date::Calc qw/Date_to_Days check_date/;
use Getopt::Long;
pod2usage(1) if $help;
pod2usage( -verbose => 2 ) if $man;
+cronlogaction();
+
$verbose and !$confirm and print "### Database will not be modified ###\n";
if ( $note && $nonote ) {
use C4::Context;
use C4::UsageStats;
+use C4::Log;
use POSIX qw(strftime);
my ( $help, $verbose, $force );
exit 1;
}
+cronlogaction();
+
my $need_update = ($force ? 1 : C4::UsageStats::NeedUpdate() );
if ($need_update) {
use C4::Calendar qw(); # don't need any exports from Calendar
use C4::Biblio;
use C4::Debug; # supplying $debug and $cgi_debug
+use C4::Log;
use Getopt::Long;
use List::MoreUtils qw/none/;
use Koha::DateUtils;
ENDUSAGE
die $usage if $help;
+cronlogaction();
+
my $dbh = C4::Context->dbh;
# Processing categories
use Pod::Usage;
use C4::Context;
use C4::Biblio;
+use C4::Log;
use DateTime;
use DateTime::Format::MySQL;
use Time::HiRes qw/time/;
usage();
}
+cronlogaction();
+
my $dbh = C4::Context->dbh;
$dbh->{AutoCommit} = 0;