2

I'm trying to setup workflow in vtiger that export invoice to pdf once the invoice has certain status.

To do it, I was thinking of using the "Invoke Custom Function". There is a documentation on it, but it is not clear, like: where/which file to register the event manager??

I also found that the same questions was actually asked and solved by another person, but when i opened the link in the post, it direct me to "Page not found" error.

John Conde
  • 217,595
  • 99
  • 455
  • 496
shinega
  • 113
  • 1
  • 4
  • 13

2 Answers2

3
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");

Add these lines of code in a php file replace with your module name, label,path,method name and add the file to vtiger instance, run the file. It will be added in database table "com_vtiger_workflowtasks_entitymethod". You can use now your invoke custom function in workflow section for the particular module.

Harsha Mullangi
  • 474
  • 1
  • 6
  • 27
  • A small addition: you then need to call this php file with the addEntityMethod call in order to register the custom cunction. – Peter T. Jul 25 '15 at 17:12
0

done all according to Answer before

<?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- This file was executed by http://IP/registerworkflow.php and i can see Update Account in custom Script 3- create simple function

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

4-file /tmp/people.txt was created by me and 777 chmod 5- email send was added to test workflow is executed (so first step execute Update Account function second email ) But strange is that i can reseive imail but script not put data to a test file