From 18170597840e9a485fc826c1f4c88990c20587ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20V=C3=A9ron?= Date: Mon, 5 Oct 2015 18:20:57 +0200 Subject: [PATCH] Bug 14960 - Remove C4::Dates from files in misc/cronjobs (part 1) This patch removes C4::Dates from following files: - misc/cronjobs/batch_anonymise.pl - misc/cronjobs/cleanup_database.pl - misc/cronjobs/gather_print_notices.pl - misc/cronjobs/serialsUpdate.pl - misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl To test: - Carefully review code changes. - Verify that the cronjobs behave as before. --- misc/cronjobs/batch_anonymise.pl | 1 - misc/cronjobs/cleanup_database.pl | 1 - misc/cronjobs/gather_print_notices.pl | 1 - misc/cronjobs/serialsUpdate.pl | 4 ++-- misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl | 6 +++--- 5 files changed, 5 insertions(+), 8 deletions(-) diff --git a/misc/cronjobs/batch_anonymise.pl b/misc/cronjobs/batch_anonymise.pl index 45868dc..c90842f 100755 --- a/misc/cronjobs/batch_anonymise.pl +++ b/misc/cronjobs/batch_anonymise.pl @@ -31,7 +31,6 @@ BEGIN { use C4::Context; use C4::Circulation; -use C4::Dates; use Date::Calc qw( Today Add_Delta_Days diff --git a/misc/cronjobs/cleanup_database.pl b/misc/cronjobs/cleanup_database.pl index 0766141..0265e84 100755 --- a/misc/cronjobs/cleanup_database.pl +++ b/misc/cronjobs/cleanup_database.pl @@ -35,7 +35,6 @@ BEGIN { } use C4::Context; -use C4::Dates; use C4::Search; use Getopt::Long; use C4::Log; diff --git a/misc/cronjobs/gather_print_notices.pl b/misc/cronjobs/gather_print_notices.pl index d573f04..2e898b7 100755 --- a/misc/cronjobs/gather_print_notices.pl +++ b/misc/cronjobs/gather_print_notices.pl @@ -11,7 +11,6 @@ BEGIN { use CGI qw( utf8 ); # NOT a CGI script, this is just to keep C4::Templates::gettemplate happy use C4::Context; -use C4::Dates; use C4::Debug; use C4::Letters; use C4::Templates; diff --git a/misc/cronjobs/serialsUpdate.pl b/misc/cronjobs/serialsUpdate.pl index fedf064..b648554 100755 --- a/misc/cronjobs/serialsUpdate.pl +++ b/misc/cronjobs/serialsUpdate.pl @@ -29,10 +29,10 @@ BEGIN { } use C4::Context; -use C4::Dates qw/format_date format_date_in_iso/; use C4::Debug; use C4::Serials; use C4::Log; +use Koha::DateUtils; use Date::Calc qw/Date_to_Days check_date/; use Getopt::Long; @@ -119,7 +119,7 @@ while ( my $issue = $sth->fetchrow_hashref ) { if ( $subscription && $publisheddate && $publisheddate ne "0000-00-00" ) { my $nextpublisheddate = GetNextDate( $subscription, $publisheddate ); - my $today = format_date_in_iso( C4::Dates->new()->output() ); + my $today = output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }); if ( $nextpublisheddate && $today ) { my ( $year, $month, $day ) = split( /-/, $nextpublisheddate ); diff --git a/misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl b/misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl index d4063d4..18e9f86 100755 --- a/misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl +++ b/misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl @@ -36,8 +36,8 @@ use C4::Context; use C4::Items; use C4::Letters; use C4::Overdues; -use C4::Dates; use C4::Calendar; +use Koha::DateUtils; sub usage { pod2usage( -verbose => 2 ); @@ -124,8 +124,8 @@ foreach my $type (@types) { } foreach my $issues (@loop) { - my $date = C4::Dates->new( $issues->{'date_due'}, 'iso' ); - my $due_date = $date->output('metric'); + my $date_dt = dt_from_string ( $issues->{'date_due'} ); + my $due_date = output_pref( { dt => $date_dt, dateonly => 1, dateformat =>'metric' } ); my $letter = C4::Letters::GetPreparedLetter( module => $module, -- 1.7.10.4