Bug 30042 - Remove Date::Calc use
Summary: Remove Date::Calc use
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Tomás Cohen Arazi
QA Contact: Kyle M Hall
URL:
Keywords:
Depends on: 29843
Blocks:
  Show dependency treegraph
 
Reported: 2022-02-08 10:17 UTC by Tomás Cohen Arazi
Modified: 2023-09-14 08:45 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.11.00


Attachments
Bug 30042: Remove Date::Calc dependency in batch_anonymize.pl (1.78 KB, patch)
2022-02-08 17:48 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 30042: Remove Date::Calc dependency in batch_anonymize.pl (1.79 KB, patch)
2022-08-31 17:46 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 30042: Remove Date::Calc dependency in batch_anonymize.pl (1.93 KB, patch)
2022-08-31 17:58 UTC, Joonas Kylmälä
Details | Diff | Splinter Review
Bug 30042: Remove Date::Calc dependency in batch_anonymize.pl (1.99 KB, patch)
2022-09-02 17:48 UTC, Kyle M Hall
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Tomás Cohen Arazi 2022-02-08 10:17:59 UTC

    
Comment 1 Jonathan Druart 2022-02-08 16:58:00 UTC
There is no occurrence of Date::Calc in tools/cleanborrowers.pl
Comment 2 Tomás Cohen Arazi 2022-02-08 17:48:38 UTC
Created attachment 130334 [details] [review]
Bug 30042: Remove Date::Calc dependency in batch_anonymize.pl

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>
Comment 3 Tomás Cohen Arazi 2022-02-08 17:49:31 UTC
(In reply to Jonathan Druart from comment #1)
> There is no occurrence of Date::Calc in tools/cleanborrowers.pl

Right, sorry for that. I read 'the cronjob' on bug 29843 and jumped to  file this one so we don't forget, but didn't check if the file was the right one.
Comment 4 Jonathan Druart 2022-02-08 18:08:21 UTC
Why this script and not all other occurrences then?
Comment 5 Tomás Cohen Arazi 2022-08-31 12:18:45 UTC
I still think this should be moved forward.
Comment 6 Joonas Kylmälä 2022-08-31 17:27:13 UTC
After the patch we add days instead of subtracting them.
Comment 7 Tomás Cohen Arazi 2022-08-31 17:46:23 UTC
Created attachment 140015 [details] [review]
Bug 30042: Remove Date::Calc dependency in batch_anonymize.pl

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>
Comment 8 Tomás Cohen Arazi 2022-08-31 17:46:43 UTC
(In reply to Joonas Kylmälä from comment #6)
> After the patch we add days instead of subtracting them.

How did that happen LOL. Fixed!
Comment 9 Joonas Kylmälä 2022-08-31 17:58:01 UTC
Created attachment 140016 [details] [review]
Bug 30042: Remove Date::Calc dependency in batch_anonymize.pl

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>
Comment 10 Kyle M Hall 2022-09-02 17:48:15 UTC
Created attachment 140175 [details] [review]
Bug 30042: Remove Date::Calc dependency in batch_anonymize.pl

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>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 11 Tomás Cohen Arazi 2022-09-07 20:30:45 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!
Comment 12 Lucas Gass 2022-10-31 19:33:56 UTC
Backported to 22.05.x for upcoming 22.05.07 release
Comment 13 Arthur Suzuki 2022-11-14 13:29:23 UTC
depends on bz29843, can't backport to 21.11.x
Comment 14 Marcel de Rooy 2023-09-14 08:45:47 UTC
(In reply to Jonathan Druart from comment #4)
> Why this script and not all other occurrences then?

Yes, the title of this report is misleading..

git grep -l Date::Calc | wc -l
41