diff --git a/modules/Settings/Workflows/actions/TaskAjax.php b/modules/Settings/Workflows/actions/TaskAjax.php index f0c6f6c3d28dab2b7bf1a1e11f78f297c94d1550..9af3153d19be41997dab3b22b35ed1bc7edf9667 100644 --- a/modules/Settings/Workflows/actions/TaskAjax.php +++ b/modules/Settings/Workflows/actions/TaskAjax.php @@ -116,10 +116,13 @@ class Settings_Workflows_TaskAjax_Action extends Settings_Vtiger_IndexAjax_View $result->emit(); return; } - } + }else if($mappingInfo['valuetype'] == 'rawtext' && Vtiger_Functions::isDateValue($mappingInfo['value'])) { + $mappingInfo['value'] = DateTimeField::convertToDBFormat($mappingInfo['value']); + $fieldMapping[$key] = $mappingInfo; + } } } - + $taskObject->field_value_mapping = Zend_Json::encode($fieldMapping); $taskType = get_class($taskObject); if ($taskType === 'VTCreateEventTask' || $taskType === 'VTCreateTodoTask') { if($taskType === 'VTCreateEventTask') { diff --git a/vtlib/Vtiger/Functions.php b/vtlib/Vtiger/Functions.php index 245cf42c221ad405f6b31c388510eb3ef69e386a..4762ebf700261e753521a6a15f3fe4fd937a6626 100644 --- a/vtlib/Vtiger/Functions.php +++ b/vtlib/Vtiger/Functions.php @@ -1243,17 +1243,27 @@ class Vtiger_Functions { * @return boolean Returns true if $value is date else returns false */ static function isDateValue($value) { - $valueParts = explode('-', $value); - if (count($valueParts) == 3 && (strlen($valueParts[0]) == 4 || strlen($valueParts[1]) == 4 || strlen($valueParts[2]) == 4)) { - $time = strtotime($value); - if ($time && $time > 0) { - return true; - } else { - return false; - } - } else { - return false; - } + $value = trim($value); + $delim = array('/','.'); + foreach ($delim as $delimiter){ + $x = strpos($value, $delimiter); + if($x === false) continue; + else{ + $value=str_replace($delimiter, '-', $value); + break; + } + } + $valueParts = explode('-', $value); + if (count($valueParts) == 3 && (strlen($valueParts[0]) == 4 || strlen($valueParts[1]) == 4 || strlen($valueParts[2]) == 4)) { + $time = strtotime($value); + if ($time && $time > 0) { + return true; + } else { + return false; + } + } else { + return false; + } } /**