Bugzilla – Attachment 102551 Details for
Bug 24840
Datetime issues in automatic_renewals / CanBookBeReserved
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24840: Catch some further cases of DateTime->now
Bug-24840-Catch-some-further-cases-of-DateTime-now.patch (text/plain), 4.29 KB, created by
Jonathan Druart
on 2020-04-08 10:23:25 UTC
(
hide
)
Description:
Bug 24840: Catch some further cases of DateTime->now
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-04-08 10:23:25 UTC
Size:
4.29 KB
patch
obsolete
>From a440802ae33a5de3d84336dda63eb55b8c3001d5 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Wed, 8 Apr 2020 10:43:54 +0100 >Subject: [PATCH] Bug 24840: Catch some further cases of DateTime->now > >This patch corrects a few additional cases where DateTime->now is called >directly instead of via Koha::DateUtils. > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > Koha/Illrequest.pm | 3 ++- > Koha/StockRotationItem.pm | 12 ++++++------ > misc/cronjobs/update_totalissues.pl | 3 ++- > 3 files changed, 10 insertions(+), 8 deletions(-) > >diff --git a/Koha/Illrequest.pm b/Koha/Illrequest.pm >index bc39152d58..5ab0adc210 100644 >--- a/Koha/Illrequest.pm >+++ b/Koha/Illrequest.pm >@@ -27,6 +27,7 @@ use Try::Tiny; > use DateTime; > > use Koha::Database; >+use Koha::DateUtils qw/ dt_from_string /; > use Koha::Email; > use Koha::Exceptions::Ill; > use Koha::Illcomments; >@@ -688,7 +689,7 @@ Mark a request as completed (status = COMP). > sub mark_completed { > my ( $self ) = @_; > $self->status('COMP')->store; >- $self->completed(DateTime->now)->store; >+ $self->completed(dt_from_string())->store; > return { > error => 0, > status => '', >diff --git a/Koha/StockRotationItem.pm b/Koha/StockRotationItem.pm >index 430dfcb00f..b46dc3cc88 100644 >--- a/Koha/StockRotationItem.pm >+++ b/Koha/StockRotationItem.pm >@@ -129,7 +129,7 @@ sub needs_advancing { > ); > my $duration = DateTime::Duration > ->new( days => $self->stage->duration ); >- if ( $arrival + $duration le DateTime->now ) { >+ if ( $arrival + $duration le dt_from_string() ) { > return 1; > } else { > return 0; >@@ -155,7 +155,7 @@ sub repatriate { > 'itemnumber' => $self->itemnumber_id, > 'frombranch' => $self->itemnumber->holdingbranch, > 'tobranch' => $self->stage->branchcode_id, >- 'datesent' => DateTime->now, >+ 'datesent' => dt_from_string(), > 'comments' => $msg, > 'reason' => "StockrotationRepatriation" > })->store; >@@ -185,14 +185,14 @@ sub advance { > my $transfer = Koha::Item::Transfer->new({ > 'itemnumber' => $self->itemnumber_id, > 'frombranch' => $item->holdingbranch, >- 'datesent' => DateTime->now, >+ 'datesent' => dt_from_string(), > 'reason' => "StockrotationAdvance" > }); > > if ( $self->indemand && !$self->fresh ) { > $self->indemand(0)->store; # De-activate indemand > $transfer->tobranch($self->stage->branchcode_id); >- $transfer->datearrived(DateTime->now); >+ $transfer->datearrived(dt_from_string()); > } else { > # Find and update our stage. > my $stage = $self->stage; >@@ -200,7 +200,7 @@ sub advance { > if ( $self->fresh ) { # Just added to rota > $new_stage = $self->stage->first_sibling || $self->stage; > $transfer->tobranch($new_stage->branchcode_id); >- $transfer->datearrived(DateTime->now) # Already at first branch >+ $transfer->datearrived(dt_from_string()) # Already at first branch > if $item->holdingbranch eq $new_stage->branchcode_id; > $self->fresh(0)->store; # Reset fresh > } elsif ( !$stage->last_sibling ) { # Last stage >@@ -208,7 +208,7 @@ sub advance { > # Revert to first stage. > $new_stage = $stage->first_sibling || $stage; > $transfer->tobranch($new_stage->branchcode_id); >- $transfer->datearrived(DateTime->now); >+ $transfer->datearrived(dt_from_string()); > } else { > $self->delete; # StockRotationItem is done. > return 1; >diff --git a/misc/cronjobs/update_totalissues.pl b/misc/cronjobs/update_totalissues.pl >index 7e24d0788d..6421779d16 100755 >--- a/misc/cronjobs/update_totalissues.pl >+++ b/misc/cronjobs/update_totalissues.pl >@@ -32,6 +32,7 @@ use Getopt::Long; > use Pod::Usage; > > use Koha::Script -cron; >+use Koha::DateUtils qw/ dt_from_string /; > use C4::Context; > use C4::Biblio; > use C4::Log; >@@ -122,7 +123,7 @@ sub process_items { > > sub process_stats { > if ($interval) { >- my $dt = DateTime->now; >+ my $dt = dt_from_string(); > > my %units = ( > h => 'hours', >-- >2.20.1
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 24840
:
101802
|
102542
|
102543
|
102550
| 102551 |
104438