[Libreoffice-commits] core.git: forms/source

Julien Nabet serval2412 at yahoo.fr
Fri Jan 26 13:41:29 UTC 2018


 forms/source/component/Time.cxx |    3 +++
 1 file changed, 3 insertions(+)

New commits:
commit a30652295be09afdbba707ce13d0a03e22c4e7a3
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Fri Jan 26 11:19:36 2018 +0100

    tdf#108473: don't let empty date in datetime in forms
    
    If only an hour is given (so no date part), copy behavior for table and query
    and put 30/12/99 by default
    
    Change-Id: Ifb371758538d2d11bd02b101a347d34816b6fddf
    Reviewed-on: https://gerrit.libreoffice.org/48665
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/forms/source/component/Time.cxx b/forms/source/component/Time.cxx
index 3e580c8451c2..ed87e9aa6224 100644
--- a/forms/source/component/Time.cxx
+++ b/forms/source/component/Time.cxx
@@ -22,6 +22,7 @@
 #include <connectivity/dbconversion.hxx>
 #include <com/sun/star/sdbc/DataType.hpp>
 #include <comphelper/processfactory.hxx>
+#include <com/sun/star/util/DateTime.hpp>
 
 using namespace dbtools;
 
@@ -235,6 +236,8 @@ bool OTimeModel::commitControlValueToDbColumn( bool /*_bPostReset*/ )
                 else
                 {
                     util::DateTime aDateTime = m_xColumn->getTimestamp();
+                    if (aDateTime.Year == 0 && aDateTime.Month == 0 && aDateTime.Day == 0)
+                        aDateTime = ::com::sun::star::util::DateTime(0,0,0,0,30,12,1899, false);
                     aDateTime.NanoSeconds = aTime.NanoSeconds;
                     aDateTime.Seconds = aTime.Seconds;
                     aDateTime.Minutes = aTime.Minutes;


More information about the Libreoffice-commits mailing list