Thêm option cho Workflow Display Manager trong InnoAutoProcess

  • Thêm option :

Chèn thêm option mới ở file layouts\v7\modules\Settings\InnoAutoProcess\VT7\FrontendManager.tpl :

<option value=”custompopupcall” {if $link.position eq ‘custompopupcall’}selected=”selected”{/if}>{vtranslate(‘Button in Custom Popup Call’, ‘Settings:InnoAutoProcess’)}</option>

  • Lấy option ra view backend sử dụng :

$query = “select workflow_id, label from abmsco_wf_frontendmanager where module = ? and position = ‘custompopupcall’ limit 1”;
$result = $adb->pquery($query, [$moduleName]);
$row = $adb->fetch_row($result);

$viewer->assign(‘HAVE_CUSTOM_WF_BTN’, true);
$viewer->assign(‘CUSTOM_WF_BTN_LABEL’, $row[“label”]);
$viewer->assign(‘CUSTOM_WF_BTN_WF_ID’, $row[“workflow_id”]);
$viewer->assign(‘CUSTOM_WF_BTN_CRM_ID’, $recordId);

  • Render ở tpl :

{if $HAVE_CUSTOM_WF_BTN eq true}
<button style=”margin-right: 5px;” id=”btnCustomWF” data-crm-id=”{$CUSTOM_WF_BTN_CRM_ID}” data-wf-id=”{$CUSTOM_WF_BTN_WF_ID}” class=”btn btn-info” name=””><strong>{$CUSTOM_WF_BTN_LABEL}</strong></button>
{/if}

{literal}

<script type=”text/javascript”>

$(“#btnCustomWF”).on(“click”, function(e){
e.preventDefault();
var Execution = new WorkflowExecution();
Execution.init($(this).data(“crm-id”));//crmid
Execution.setWorkflowById($(this).data(“wf-id”));//wf_id
Execution.enableRedirection(false);
Execution.execute();
});
</script>

{/literal}

Leave a Reply

You must be logged in to post a comment.