diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Calendar.php b/workflow/engine/src/ProcessMaker/BusinessModel/Calendar.php index 83ff11b05..9a9814125 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Calendar.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Calendar.php @@ -19,8 +19,8 @@ class Calendar private $arrayWorkHourFieldDefinition = array( "DAY" => array("type" => "int", "required" => true, "empty" => false, "defaultValues" => array(0, 1, 2, 3, 4, 5, 6, 7), "fieldNameAux" => "day"), - "HOUR_START" => array("type" => "hour", "required" => true, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "hourStart"), - "HOUR_END" => array("type" => "hour", "required" => true, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "hourEnd") + 'HOUR_START' => array('type' => 'hour', 'required' => true, 'empty' => false, 'defaultValues' => array(), 'fieldNameAux' => 'hourStart', 'regexp' => '/^(?:[0-1]\d|2[0-3])\:[0-5]\d$/'), + 'HOUR_END' => array('type' => 'hour', 'required' => true, 'empty' => false, 'defaultValues' => array(), 'fieldNameAux' => 'hourEnd', 'regexp' => '/^(?:[0-1]\d|2[0-3])\:[0-5]\d$/') ); private $arrayHolidayFieldDefinition = array( @@ -751,4 +751,3 @@ class Calendar } } } - diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Process.php b/workflow/engine/src/ProcessMaker/BusinessModel/Process.php index c8f2ea000..975013407 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Process.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Process.php @@ -228,7 +228,13 @@ class Process } break; case "hour": - if (!preg_match('/^' . $regexpTime . '$/', $fieldValue)) { + $regexpTime = '/^' . $regexpTime . '$/'; + + if (array_key_exists('regexp', $arrayFieldDefinition[$fieldName])) { + $regexpTime = $arrayFieldDefinition[$fieldName]['regexp']; + } + + if (!preg_match($regexpTime, $fieldValue)) { throw new \Exception(\G::LoadTranslation('ID_INVALID_VALUE', [$fieldNameAux])); } break; @@ -532,16 +538,16 @@ class Process $trigger = new \ProcessMaker\BusinessModel\Trigger(); /** - * Try catch block is added to escape the exception and continue editing - * the properties of the process, otherwise there is no way to edit - * the properties that the exception is thrown: trigger nonexistent. + * Try catch block is added to escape the exception and continue editing + * the properties of the process, otherwise there is no way to edit + * the properties that the exception is thrown: trigger nonexistent. * The same goes for the similar blocks. */ if (isset($arrayData["PRO_TRI_DELETED"]) && $arrayData["PRO_TRI_DELETED"] . "" != "") { try { $trigger->throwExceptionIfNotExistsTrigger($arrayData["PRO_TRI_DELETED"], $processUid, $this->arrayFieldNameForException["processTriDeleted"]); } catch (\Exception $e) { - + } } @@ -549,7 +555,7 @@ class Process try { $trigger->throwExceptionIfNotExistsTrigger($arrayData["PRO_TRI_CANCELED"], $processUid, $this->arrayFieldNameForException["processTriCanceled"]); } catch (\Exception $e) { - + } } @@ -557,7 +563,7 @@ class Process try { $trigger->throwExceptionIfNotExistsTrigger($arrayData["PRO_TRI_PAUSED"], $processUid, $this->arrayFieldNameForException["processTriPaused"]); } catch (\Exception $e) { - + } } @@ -565,7 +571,7 @@ class Process try { $trigger->throwExceptionIfNotExistsTrigger($arrayData["PRO_TRI_REASSIGNED"], $processUid, $this->arrayFieldNameForException["processTriReassigned"]); } catch (\Exception $e) { - + } } @@ -1834,4 +1840,3 @@ class Process } } -