diff --git a/layouts/v7/modules/Settings/Workflows/WorkFlowTrigger.tpl b/layouts/v7/modules/Settings/Workflows/WorkFlowTrigger.tpl index 9e0ae7eda894914fa50192bc7827c7bfed961d35..0c41811baf05fb1bc6938346fbfdcca71d26a341 100644 --- a/layouts/v7/modules/Settings/Workflows/WorkFlowTrigger.tpl +++ b/layouts/v7/modules/Settings/Workflows/WorkFlowTrigger.tpl @@ -145,7 +145,17 @@ <label class='col-sm-2 control-label'>{vtranslate('LBL_NEXT_TRIGGER_TIME', $QUALIFIED_MODULE)}</label> <div class='col-sm-4 controls'> {if $WORKFLOW_MODEL_OBJ->schtypeid neq 4} - {DateTimeField::convertToUserFormat($WORKFLOW_MODEL_OBJ->nexttrigger_time)} + {assign var="userModel" value=Users_Privileges_Model::getCurrentUserModel()} + {if $userModel->get('hour_format') == '12'} + {assign var="fieldvalue" value=DateTimeField::convertToUserFormat($WORKFLOW_MODEL_OBJ->nexttrigger_time)} + {assign var="time_parts" value=explode(" ", $fieldvalue)} + {assign var="time" value=$time_parts[1]} + {assign var="value" value=Vtiger_Time_UIType::getTimeValueInAMorPM($time)} + {assign var="fieldvalue" value=$time_parts[0]|cat:' '|cat:$value} + {$fieldvalue} + {else} + {DateTimeField::convertToUserFormat($WORKFLOW_MODEL_OBJ->nexttrigger_time)} + {/if} <span> ({$ACTIVE_ADMIN->time_zone})</span> {/if} </div> diff --git a/modules/Settings/Workflows/actions/SaveWorkflow.php b/modules/Settings/Workflows/actions/SaveWorkflow.php index f0ead16777d9ed72fb25ca375615f57dcade9760..11ba1545183b93efa15524e070a7998d07da38b7 100644 --- a/modules/Settings/Workflows/actions/SaveWorkflow.php +++ b/modules/Settings/Workflows/actions/SaveWorkflow.php @@ -73,11 +73,12 @@ class Settings_Workflows_SaveWorkflow_Action extends Vtiger_Action_Controller { $workflowModel->set('name', $name); if ($executionCondition == '6') { $schtime = $request->get("schtime"); - if (preg_match('/^(0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$/', $schtime)) { - $schtime .= ':00'; - } else { - $schtime = date('H:i:s', strtotime($schtime)); + // checking the scheduled time input is in time format. If not set it to 00:00 + if (!strtotime($schtime)) { + $schtime = '00:00'; } + // converting the schtime to H:i:s (00:00:00) format to store in DB. + $schtime = date('H:i:s', strtotime($schtime)); $workflowModel->set('schtime', $schtime);