VTiger:工作流 - 调用自定义函数



我正在尝试在vtiger中设置工作流程,一旦发票具有特定状态,即可将发票导出为pdf。

为此,我正在考虑使用"调用自定义函数"。上面有一个文档,但不清楚,例如:在哪里/哪个文件注册事件管理器?

我还发现相同的问题实际上是由另一个人提出和解决的,但是当我打开帖子中的链接时,它会将我定向到"找不到页面"错误。

require_once 'include/utils/utils.php';
require 'modules/com_vtiger_workflow/VTEntityMethodManager.inc';
$emm = new VTEntityMethodManager($adb); 
//$emm->addEntityMethod("Module Name","Label", "Path to file" , "Method Name" );
$emm->addEntityMethod("Invoice", "Update Inventory", "include/InventoryHandler.php", "handleInventoryProductRel");
将这些

代码行添加到php文件中,替换为您的模块名称,标签,路径,方法名称,并将文件添加到vtiger实例,运行该文件。它将添加到数据库表"com_vtiger_workflowtasks_entitymethod"中。现在,您可以在特定模块的工作流部分中使用调用自定义函数。

全部按照之前的答案完成

<?php
require_once 'include/utils/utils.php';
require 'modules/com_vtiger_workflow/VTEntityMethodManager.inc';
$emm = new VTEntityMethodManager($adb);
#addEntityMethod("Module", "LABEL", "FILENAME", "FUNCTION_NAME");
$emm->addEntityMethod("Accounts", "Update Account","modules/Accounts/updateAccountData.php", "updateAccountData");
?>

2-此文件由 http://IP/registerworkflow.php 执行我可以看到自定义脚本中的更新帐户3-创建简单的功能

<?php
function updateAccountData($entity){
$file = '/tmp/people.txt';
$current = file_get_contents($file);
$current .= "John Smithn";
file_put_contents($file, __LINE__.':'.print_r($current, true)."rn");
}
?>

4-file/tmp/people.txt 由我和 777 chmod 创建5-电子邮件发送已添加到执行测试工作流 (所以第一步执行更新帐户功能第二封电子邮件)但奇怪的是,我可以接收imail,但脚本不会将数据放入测试文件

最新更新