Bugzilla – Attachment 33510 Details for
Bug 13242
Slow checkin for patrons restricted indefinitely
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13242: DateUtils should manage separately 9999-* dates
Bug-13242-DateUtils-should-manage-separately-9999-.patch (text/plain), 1.57 KB, created by
Jonathan Druart
on 2014-11-13 08:47:34 UTC
(
hide
)
Description:
Bug 13242: DateUtils should manage separately 9999-* dates
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2014-11-13 08:47:34 UTC
Size:
1.57 KB
patch
obsolete
>From c4c6c326c25973b66e8439c83ba609121957e14e Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Thu, 13 Nov 2014 09:34:43 +0100 >Subject: [PATCH] Bug 13242: DateUtils should manage separately 9999-* dates > >On bug 13226, we have seen that >my $date = DateTime->new(year => 9999, month => 12, day => 31); > => OK > >DateTime::Format::DateParse->parse_datetime( '9999-12-31' ); > => OK > >DateTime::Format::DateParse->parse_datetime( '9999-12-31', > 'America/Los_Angeles' ); > => KO (~20sec on my laptop) > >For instance if you try to check in items for a patron which is >restricted indefinitely (and there is no overdue on the item), the code >in C4::Circulation::AddReturn l~1948 > my $borrower_debar_dt = dt_from_string( $borrower->{debarred} ); >will be called. > >dt_from_string should not called >DateTime::Format::DateParse->parse_datetime with the time zone parameter >in this case. > >Test plan: >Create an indefinitely restriction for a patron and check an item in. >Without this patch, it should take ~20 sec. >With, ~2 or 3 sec. >--- > Koha/DateUtils.pm | 5 +++++ > 1 file changed, 5 insertions(+) > >diff --git a/Koha/DateUtils.pm b/Koha/DateUtils.pm >index b372a3a..2a3543e 100644 >--- a/Koha/DateUtils.pm >+++ b/Koha/DateUtils.pm >@@ -53,6 +53,11 @@ to the system preferences. If the date string is empty DateTime->now is returned > > sub dt_from_string { > my ( $date_string, $date_format, $tz ) = @_; >+ >+ if ( $date_string =~ /^9999-/ ) { >+ return DateTime::Format::DateParse->parse_datetime($date_string); >+ } >+ > if ( !$tz ) { > $tz = C4::Context->tz; > } >-- >2.1.0
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 13242
:
33510
|
33511
|
33560
|
33561
|
33564
|
33565
|
33589
|
33590
|
33591
|
33592
|
33596
|
33597
|
33945