From: Lebbeous Fogle-Weekley Date: Thu, 17 Oct 2013 16:49:52 +0000 (-0400) Subject: In search, do create_date/edit_date comparisons by date, not timestamp X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=refs%2Fheads%2Fcollab%2Fsenator%2Fbre_dates_not_timestamps;p=working%2FEvergreen.git In search, do create_date/edit_date comparisons by date, not timestamp This makes searches on a date range include whole days at the start and end of the range, whereas before they excluded the day at the end of the range. Signed-off-by: Lebbeous Fogle-Weekley --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm index e4e237c035..64128c1c44 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm @@ -1136,8 +1136,9 @@ sub flatten { } else { # "before $cend" $cend = cleanse_ISO8601($cend); + $cend =~ s/^(.+)T.+$/$1/; $where .= $joiner if $where ne ''; - $where .= "bre.$datefilter <= \$_$$\$$cend\$_$$\$"; + $where .= "bre.$datefilter\::DATE <= \$_$$\$$cend\$_$$\$"; } } elsif (!$cend or $cend eq 'infinity') { # no end supplied @@ -1145,15 +1146,18 @@ sub flatten { # useless use of filter } else { # "after $cstart" $cstart = cleanse_ISO8601($cstart); + $cstart =~ s/^(.+)T.+$/$1/; $where .= $joiner if $where ne ''; - $where .= "bre.$datefilter >= \$_$$\$$cstart\$_$$\$"; + $where .= "bre.$datefilter\::DATE >= \$_$$\$$cstart\$_$$\$"; } } else { # both supplied # "between $cstart and $cend" $cstart = cleanse_ISO8601($cstart); $cend = cleanse_ISO8601($cend); + $cstart =~ s/^(.+)T.+$/$1/; + $cend =~ s/^(.+)T.+$/$1/; $where .= $joiner if $where ne ''; - $where .= "bre.$datefilter BETWEEN \$_$$\$$cstart\$_$$\$ AND \$_$$\$$cend\$_$$\$"; + $where .= "bre.$datefilter\::DATE BETWEEN \$_$$\$$cstart\$_$$\$ AND \$_$$\$$cend\$_$$\$"; } } } elsif ($filter->name eq 'bib_source') {