Validate date/time fields using their regular expression during an import (or synchro) to avoid passing wrong formats as-is (e.g. 01/02/16 can become 01/02/0016 instead of 01/02/2016 if you use the 4 digits format for years and pass only 2 digits !)

SVN:trunk[4096]
This commit is contained in:
Denis Flaven
2016-05-17 14:51:42 +00:00
parent 6b465688a2
commit 316d1f9b14
2 changed files with 16 additions and 5 deletions

View File

@@ -827,6 +827,8 @@ class BulkChange
{
$sFormat = $sDateFormat;
}
$oFormat = new DateTimeFormat($sFormat);
$sRegExp = $oFormat->ToRegExpr();
if (!preg_match('/'.$sRegExp.'/', $this->m_aData[$iRow][$iCol]))
{
$aResult[$iRow]["__STATUS__"]= new RowStatus_Issue(Dict::S('UI:CSVReport-Row-Issue-DateFormat'));