Bugzilla – Attachment 40691 Details for
Bug 14382
datepicker's dateFormat setting for reports is missing
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14382: Non-ISO Date parameters generate empty reports.
0001-Bug-14382-Non-ISO-Date-parameters-generate-empty-rep.patch (text/plain), 2.55 KB, created by
Amit Gupta
on 2015-06-26 17:53:39 UTC
(
hide
)
Description:
Bug 14382: Non-ISO Date parameters generate empty reports.
Filename:
MIME Type:
Creator:
Amit Gupta
Created:
2015-06-26 17:53:39 UTC
Size:
2.55 KB
patch
obsolete
>From b233182e3f77ecbbd0795e8d0ed9c3f003357431 Mon Sep 17 00:00:00 2001 >From: Mark Tompsett <mtompset@hotmail.com> >Date: Wed, 24 Jun 2015 12:13:46 -0400 >Subject: [PATCH] Bug 14382: Non-ISO Date parameters generate empty reports. > >The issue is that SQL expects ISO dates, but the user may wish to view dates according to the dateformat system preference. > >By detecting a date preference, the non-ISO dates can be converted to ISO dates before being stuffed back into the SQL query to be executed. > >TEST PLAN >--------- >1) Add a report with date parameters. > -- I used 'Holds placed in date range' from > http://wiki.koha-community.org/wiki/SQL_Reports_Library >2) Set your dateformat to YYYY-MM-DD >3) Run the report > -- Note the SQL reads > "... BETWEEN '{date formatted in YYYY-MM-DD}'..." > -- If there is supposed to be data, there is some. >4) Set your dateformat to MM/DD/YYYY >5) Run the report > -- Note the SQL reads > "... BETWEEN '{date formatted in MM/DD/YYYY}'..." > -- If there is supposed to be data, there is none. >6) Apply patch >7) Repeat steps 2-5 > -- The SQL will always read YYYY-MM-DD (ISO) format. > -- The report will have data, if there is some. >8) koha qa test tools. > >Signed-off-by: Amit Gupta <amit.gupta@informaticsglobal.com> >--- > reports/guided_reports.pl | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > >diff --git a/reports/guided_reports.pl b/reports/guided_reports.pl >index 9cfa8ce..25d9929 100755 >--- a/reports/guided_reports.pl >+++ b/reports/guided_reports.pl >@@ -33,6 +33,7 @@ use C4::Branch; # XXX subfield_is_koha_internal_p > use C4::Koha qw/IsAuthorisedValueCategory GetFrameworksLoop/; > use C4::Context; > use C4::Log; >+use Koha::DateUtils qw/dt_from_string output_pref/; > > =head1 NAME > >@@ -750,9 +751,13 @@ elsif ($phase eq 'Run this report'){ > my @split = split /<<|>>/,$sql; > my @tmpl_parameters; > for(my $i=0;$i<$#split/2;$i++) { >- my $quoted = C4::Context->dbh->quote($sql_params[$i]); >+ my $quoted = $sql_params[$i]; > # if there are special regexp chars, we must \ them > $split[$i*2+1] =~ s/(\||\?|\.|\*|\(|\)|\%)/\\$1/g; >+ if ($split[$i*2+1] =~ /|date>>/) { >+ $quoted = output_pref({ dt => dt_from_string($quoted), dateformat => 'iso', dateonly => 1 }) if $quoted; >+ } >+ $quoted = C4::Context->dbh->quote($quoted); > $sql =~ s/<<$split[$i*2+1]>>/$quoted/; > } > my ($sth, $errors) = execute_query($sql, $offset, $limit); >-- >1.7.9.5 >
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 14382
:
40127
|
40130
|
40157
|
40357
|
40358
|
40360
|
40593
|
40594
|
40611
|
40684
|
40691
|
40776
|
40777
|
40781