Bugzilla – Attachment 140016 Details for
Bug 30042
Remove Date::Calc use
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30042: Remove Date::Calc dependency in batch_anonymize.pl
Bug-30042-Remove-DateCalc-dependency-in-batchanony.patch (text/plain), 1.93 KB, created by
Joonas Kylmälä
on 2022-08-31 17:58:01 UTC
(
hide
)
Description:
Bug 30042: Remove Date::Calc dependency in batch_anonymize.pl
Filename:
MIME Type:
Creator:
Joonas Kylmälä
Created:
2022-08-31 17:58:01 UTC
Size:
1.93 KB
patch
obsolete
>From 7342c77fa17837cdaf5b5e188c74069c1f3c5cfe Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 8 Feb 2022 14:45:11 -0300 >Subject: [PATCH] Bug 30042: Remove Date::Calc dependency in batch_anonymize.pl >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >This patch makes the script use the Koha::DateUtils tools instead. > >To test: >1. Run: > $ kshell > k$ perl misc/cronjobs/batch_anonymise.pl --verbose --days 7 >=> SUCCESS: You see (the date may vary): >Checkouts and holds before 2022-02-15 will be anonymised. >2. Apply this patch >3. Repeat 1 >=> SUCCESS: Same output >4. Sign off :-D > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> > >Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi> >--- > misc/cronjobs/batch_anonymise.pl | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > >diff --git a/misc/cronjobs/batch_anonymise.pl b/misc/cronjobs/batch_anonymise.pl >index 786e847c34..24edb727f4 100755 >--- a/misc/cronjobs/batch_anonymise.pl >+++ b/misc/cronjobs/batch_anonymise.pl >@@ -25,10 +25,10 @@ use C4::Context; > use C4::Log qw( cronlogaction ); > > use Koha::Database; >+use Koha::DateUtils qw(dt_from_string output_pref); > use Koha::Old::Checkouts; > use Koha::Old::Holds; > >-use Date::Calc qw( Add_Delta_Days Today ); > use Getopt::Long qw( GetOptions ); > > sub usage { >@@ -62,10 +62,10 @@ if ( !$days ) { > > 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; >-$verbose and print "Checkouts and holds before $formatdate will be anonymised.\n"; >+my $date = dt_from_string->subtract( days => $days ); >+ >+print "Checkouts and holds before " . output_pref( { dt => $date, dateformat => 'iso', dateonly => 1 } ) . " will be anonymised.\n" >+ if $verbose; > > my $rows = Koha::Old::Checkouts > ->filter_by_anonymizable >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 30042
:
130334
|
140015
|
140016
|
140175