diff --git a/layouts/v7/modules/Settings/Workflows/WorkFlowTrigger.tpl b/layouts/v7/modules/Settings/Workflows/WorkFlowTrigger.tpl index 8fc5e9d4fa561542f419b31a2a2b00b70dfecb38..0c41811baf05fb1bc6938346fbfdcca71d26a341 100644 --- a/layouts/v7/modules/Settings/Workflows/WorkFlowTrigger.tpl +++ b/layouts/v7/modules/Settings/Workflows/WorkFlowTrigger.tpl @@ -133,7 +133,7 @@ </label> <div class="col-sm-2 controls" id='schtime'> <div class="input-group time" > - <input type='text' data-format='24' name='schtime' value="{$WORKFLOW_MODEL_OBJ->schtime}" data-rule-required="true" class="timepicker-default inputElement"/> + <input type='text' data-format='{$CURRENT_USER->get('hour_format')}' name='schtime' value="{$WORKFLOW_MODEL_OBJ->schtime}" data-rule-required="true" class="timepicker-default inputElement"/> <span class="input-group-addon"> <i class="fa fa-clock-o"></i> </span> @@ -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 1455030d0bc77c94c70d5f028783433826ce8966..11ba1545183b93efa15524e070a7998d07da38b7 100644 --- a/modules/Settings/Workflows/actions/SaveWorkflow.php +++ b/modules/Settings/Workflows/actions/SaveWorkflow.php @@ -73,10 +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-2]\d(:[0-5]\d){1,2}$/', $schtime) or substr($schtime, 0, 2) > 23) { // invalid time format + // checking the scheduled time input is in time format. If not set it to 00:00 + if (!strtotime($schtime)) { $schtime = '00:00'; } - $schtime .=':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);