Bugzilla – Attachment 36748 Details for
Bug 13601
Get rid of DateTime::Format::DateParse
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[Signed-off] Bug 13601: Add a fallback check for compability with existing code
Signed-off-Bug-13601-Add-a-fallback-check-for-comp.patch (text/plain), 2.16 KB, created by
Marc Véron
on 2015-03-09 18:23:27 UTC
(
hide
)
Description:
[Signed-off] Bug 13601: Add a fallback check for compability with existing code
Filename:
MIME Type:
Creator:
Marc Véron
Created:
2015-03-09 18:23:27 UTC
Size:
2.16 KB
patch
obsolete
>From 3372af44f4b19ee9588b3585b7d5797441b4c48d Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Tue, 20 Jan 2015 15:49:39 +0100 >Subject: [PATCH] [Signed-off] Bug 13601: Add a fallback check for compability > with existing code >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >There are a lot of places where the date comes from the DB but the >dateformat parameter is not set to 'sql'. >dt_from_string needs to fallback with this format if the pref format >does not match. > >Signed-off-by: Marc Véron <veron@veron.ch> >--- > Koha/DateUtils.pm | 29 +++++++++++++++++++++-------- > 1 file changed, 21 insertions(+), 8 deletions(-) > >diff --git a/Koha/DateUtils.pm b/Koha/DateUtils.pm >index 0a5e15a..3f44f83 100644 >--- a/Koha/DateUtils.pm >+++ b/Koha/DateUtils.pm >@@ -66,6 +66,16 @@ sub dt_from_string { > } > > my $regex; >+ >+ # The fallback format is sql/iso >+ my $fallback_re = qr| >+ (?<year>\d{4}) >+ - >+ (?<month>\d{2}) >+ - >+ (?<day>\d{2}) >+ |xms; >+ > if ( $date_format eq 'metric' ) { > # metric format is "dd/mm/yyyy[ hh:mm:ss]" > $regex = qr| >@@ -87,14 +97,8 @@ sub dt_from_string { > |xms; > } > elsif ( $date_format eq 'iso' or $date_format eq 'sql' ) { >- # iso format is yyyy-dd-mm[ hh:mm:ss]" >- $regex = qr| >- (?<year>\d{4}) >- - >- (?<month>\d{2}) >- - >- (?<day>\d{2}) >- |xms; >+ # iso or sql format are yyyy-dd-mm[ hh:mm:ss]" >+ $regex = $fallback_re; > } > else { > die "Invalid dateformat parameter ($date_format)"; >@@ -124,6 +128,15 @@ sub dt_from_string { > minute => $+{minute}, > second => $+{second}, > ); >+ } elsif ( $date_string =~ $fallback_re ) { >+ %dt_params = ( >+ year => $+{year}, >+ month => $+{month}, >+ day => $+{day}, >+ hour => $+{hour}, >+ minute => $+{minute}, >+ second => $+{second}, >+ ); > } > else { > die "The given date ($date_string) does not match the date format ($date_format)"; >-- >1.7.10.4
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 13601
:
35405
|
35406
|
35407
|
35408
|
35433
|
36733
|
36734
|
36735
|
36736
|
36737
|
36745
|
36746
|
36747
|
36748
|
36754
|
36755
|
36756
|
36928
|
36933
|
36939
|
37023
|
37087
|
37088
|
37089
|
37090
|
37091
|
37092
|
37093