diff options
author | Lionel Elie Mamane <lionel@mamane.lu> | 2015-07-14 17:49:44 +0200 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2015-07-16 09:22:10 +0000 |
commit | 9c20406420966ae8cdc866a8d4fef2b949529a07 (patch) | |
tree | 999fb4003350ab40fbb2558ba49df8adbda8b3f4 | |
parent | fe1e767e3397da41051a20ae6c80be5e123d07ba (diff) |
tdf#92654 a "Date" can contain a Time, so don't loose date by default
also fix DATEVALUE() function that was relying on this dataloss
Change-Id: I6030505a762df3ecbfe9a8331267846d3de817e8
Reviewed-on: https://gerrit.libreoffice.org/17049
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
4 files changed, 44 insertions, 0 deletions
diff --git a/external/jfreereport/UnpackedTarball_jfreereport_flow_engine.mk b/external/jfreereport/UnpackedTarball_jfreereport_flow_engine.mk index f6640e46f775..e0d309ab2f30 100644 --- a/external/jfreereport/UnpackedTarball_jfreereport_flow_engine.mk +++ b/external/jfreereport/UnpackedTarball_jfreereport_flow_engine.mk @@ -17,6 +17,7 @@ $(eval $(call gb_UnpackedTarball_fix_end_of_line,jfreereport_flow_engine,\ $(eval $(call gb_UnpackedTarball_add_patches,jfreereport_flow_engine,\ external/jfreereport/patches/flow-engine.patch \ + external/jfreereport/patches/flow-engine_date_is_datetime.patch.1 \ )) # vim: set noet sw=4 ts=4: diff --git a/external/jfreereport/UnpackedTarball_jfreereport_libformula.mk b/external/jfreereport/UnpackedTarball_jfreereport_libformula.mk index bb789666ae62..ec9d29d3b58c 100644 --- a/external/jfreereport/UnpackedTarball_jfreereport_libformula.mk +++ b/external/jfreereport/UnpackedTarball_jfreereport_libformula.mk @@ -19,6 +19,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,jfreereport_libformula,\ external/jfreereport/patches/common_build.patch \ external/jfreereport/patches/libformula-time-notz.patch \ external/jfreereport/patches/libformula-minutes_truncation.patch.1 \ + external/jfreereport/patches/libformula-datevalue_truncation.patch.1 \ )) # vim: set noet sw=4 ts=4: diff --git a/external/jfreereport/patches/flow-engine_date_is_datetime.patch.1 b/external/jfreereport/patches/flow-engine_date_is_datetime.patch.1 new file mode 100644 index 000000000000..3ed23ee589ac --- /dev/null +++ b/external/jfreereport/patches/flow-engine_date_is_datetime.patch.1 @@ -0,0 +1,13 @@ +diff -ur jfreereport_flow_engine.org/source/org/jfree/report/expressions/ReportFormulaContext.java jfreereport_flow_engine/source/org/jfree/report/expressions/ReportFormulaContext.java +--- jfreereport_flow_engine.org/source/org/jfree/report/expressions/ReportFormulaContext.java 2015-07-14 17:24:51.924156060 +0200 ++++ jfreereport_flow_engine/source/org/jfree/report/expressions/ReportFormulaContext.java 2015-07-14 17:27:56.669270298 +0200 +@@ -120,7 +120,7 @@ + { + if (flags.isDate()) + { +- return DateTimeType.DATE_TYPE; ++ return DateTimeType.DATETIME_TYPE; + } + if (flags.isNumeric()) + { +Only in jfreereport_flow_engine/source/org/jfree/report/expressions: ReportFormulaContext.java~ diff --git a/external/jfreereport/patches/libformula-datevalue_truncation.patch.1 b/external/jfreereport/patches/libformula-datevalue_truncation.patch.1 new file mode 100644 index 000000000000..069c667c19ac --- /dev/null +++ b/external/jfreereport/patches/libformula-datevalue_truncation.patch.1 @@ -0,0 +1,29 @@ +diff -ur jfreereport_libformula.org/source/org/pentaho/reporting/libraries/formula/function/datetime/DateValueFunction.java jfreereport_libformula/source/org/pentaho/reporting/libraries/formula/function/datetime/DateValueFunction.java +--- jfreereport_libformula.org/source/org/pentaho/reporting/libraries/formula/function/datetime/DateValueFunction.java 2010-06-01 17:15:50.000000000 +0200 ++++ jfreereport_libformula/source/org/pentaho/reporting/libraries/formula/function/datetime/DateValueFunction.java 2015-07-14 17:24:42.503895240 +0200 +@@ -18,6 +18,7 @@ + package org.pentaho.reporting.libraries.formula.function.datetime; + + import java.util.Date; ++import java.util.Calendar; + + import org.pentaho.reporting.libraries.formula.EvaluationException; + import org.pentaho.reporting.libraries.formula.FormulaContext; +@@ -28,6 +29,7 @@ + import org.pentaho.reporting.libraries.formula.typing.Type; + import org.pentaho.reporting.libraries.formula.typing.TypeRegistry; + import org.pentaho.reporting.libraries.formula.typing.coretypes.DateTimeType; ++import org.pentaho.reporting.libraries.formula.util.DateUtil; + + /** + * This function returns +@@ -61,7 +63,8 @@ + final Object value = parameters.getValue(0); + + final Date date1 = typeRegistry.convertToDate(type, value); +- return new TypeValuePair(DateTimeType.DATE_TYPE, date1); ++ final Date date = DateUtil.normalizeDate(date1, DateTimeType.DATE_TYPE); + ++ return new TypeValuePair(DateTimeType.DATE_TYPE, date); + } + } |