[open-ils-commits] [GIT] Evergreen ILS branch master updated. 2a36365dde5e927284d90301949bac572f1b49f2
Evergreen Git
git at git.evergreen-ils.org
Tue Jun 6 11:02:08 EDT 2017
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".
The branch, master has been updated
via 2a36365dde5e927284d90301949bac572f1b49f2 (commit)
from fc9b7ea11520aaf9f188e682daa9066d91870a1c (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 2a36365dde5e927284d90301949bac572f1b49f2
Author: Jason Boyer <jboyer at library.in.gov>
Date: Fri May 12 15:14:54 2017 -0400
LP1690434: Date Comparisons in the Reporter
Because of the way the where clause is constructed
in queries using the Year + Month Transform reports
using some types of operators could produce invalid
SQL.
To test:
put together a simple report template with a date
in the Basic Filters section, using the Year + Month
transform and the On or After operator. (a count of
circs with an xact_start filter is a simple way to
set this up.) Schedule it with a relative date
such as 1 month ago and run it.
Pre Patch: the report will fail and the error text
will reference a missing text >= double precision
comparison function.
Post Patch: you'll get a count of how many circs
were opened last month (or whatever report you
wrote).
Signed-off-by: Jason Boyer <jboyer at library.in.gov>
Signed-off-by: Mike Rylander <mrylander at gmail.com>
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Reporter/SQLBuilder.pm b/Open-ILS/src/perlmods/lib/OpenILS/Reporter/SQLBuilder.pm
index f3cef56..d98a04f 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Reporter/SQLBuilder.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Reporter/SQLBuilder.pm
@@ -386,8 +386,8 @@ sub toSQL {
my $val = $self->{params};
$val = $$val[0] if (ref($val));
- return "EXTRACT(YEAR FROM \$_$$\$$rtime\$_$$\$::TIMESTAMPTZ + \$_$$\$$val months\$_$$\$)" .
- " || \$_$$\$-\$_$$\$ || LPAD(EXTRACT(MONTH FROM \$_$$\$$rtime\$_$$\$::TIMESTAMPTZ + \$_$$\$$val months\$_$$\$)::text,2,\$_$$\$0\$_$$\$)";
+ return "(EXTRACT(YEAR FROM \$_$$\$$rtime\$_$$\$::TIMESTAMPTZ + \$_$$\$$val months\$_$$\$)" .
+ " || \$_$$\$-\$_$$\$ || LPAD(EXTRACT(MONTH FROM \$_$$\$$rtime\$_$$\$::TIMESTAMPTZ + \$_$$\$$val months\$_$$\$)::text,2,\$_$$\$0\$_$$\$))";
}
@@ -694,8 +694,8 @@ package OpenILS::Reporter::SQLBuilder::Column::Transform::month_trunc;
sub toSQL {
my $self = shift;
- return 'EXTRACT(YEAR FROM "' . $self->{_relation} . '"."' . $self->name . '")' .
- ' || \'-\' || LPAD(EXTRACT(MONTH FROM "' . $self->{_relation} . '"."' . $self->name . '")::text,2,\'0\')';
+ return '(EXTRACT(YEAR FROM "' . $self->{_relation} . '"."' . $self->name . '")' .
+ ' || \'-\' || LPAD(EXTRACT(MONTH FROM "' . $self->{_relation} . '"."' . $self->name . '")::text,2,\'0\'))';
}
sub is_aggregate { return 0 }
@@ -728,8 +728,8 @@ package OpenILS::Reporter::SQLBuilder::Column::Transform::quarter;
sub toSQL {
my $self = shift;
- return 'EXTRACT(YEAR FROM "' . $self->{_relation} . '"."' . $self->name . '")' .
- ' || \'-Q\' || EXTRACT(QUARTER FROM "' . $self->{_relation} . '"."' . $self->name . '")';
+ return '(EXTRACT(YEAR FROM "' . $self->{_relation} . '"."' . $self->name . '")' .
+ ' || \'-Q\' || EXTRACT(QUARTER FROM "' . $self->{_relation} . '"."' . $self->name . '"))';
}
sub is_aggregate { return 0 }
-----------------------------------------------------------------------
Summary of changes:
.../perlmods/lib/OpenILS/Reporter/SQLBuilder.pm | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
hooks/post-receive
--
Evergreen ILS
More information about the open-ils-commits
mailing list