07-20-2021, 01:31 PM
(This post was last modified: 07-20-2021, 03:48 PM by inspectorflint.
Edit Reason: error ortográfico
)
hello:
I`m trying to create a function based workflow to calculate two fields in a custom module. I configure the workflow like this:
And I create a entry in the workflow functions whit this code:
$Vtiger_Utils_Log = true;
require_once 'include/utils/utils.php';
include_once('vtlib/Vtiger/Module.php');
require 'modules/com_vtiger_workflow/VTEntityMethodManager.inc';
global $adb;
$emm = new VTEntityMethodManager($adb);
$emm->addEntityMethod("FacturaComisiones", "calcularCamposFrasComisiones", "flujos_trabajo/HandlerCalcularCamposFrasComisiones.php", "calcularCamposFrasComisiones");
echo 'add Workflow Custom Function calcularCamposFrasComisiones to facturaComisiones module is complete!';
The funtion appears in the list of the workflow configuration in the custom module, but when I try to launch it saving one element , nothig appears. The function contains this code:
function escribirLog($texto, $archivo = "calcularCampos.txt"){
// una funcion para escribir un log de sucesos...
$ddf = fopen($archivo,'a');
fwrite($ddf,"[".date("r")."] $texto\r\n");
fclose($ddf);
//fclose($archivo);
}
function calcularCamposFrasComisiones($entity) {
include '../config.inc.php';
require_once 'include/database/PearDatabase.php';
// se obtiene la id del objeto que vamos a utilizar (en este caso, la ID de la Remesa)
global $adb, $thesoid;
$id = $entity->getId();
$id = explode("x", [i]$id );
[/i]
$thesoid = $id[1];
escribirLog($thesoid,"calcularCampos.txt" );
}
But the log appears empty. If I call the function directly it works...
I don´t know if the function isn´t register, or the problem will be another
Thanbk you
I`m trying to create a function based workflow to calculate two fields in a custom module. I configure the workflow like this:
And I create a entry in the workflow functions whit this code:
$Vtiger_Utils_Log = true;
require_once 'include/utils/utils.php';
include_once('vtlib/Vtiger/Module.php');
require 'modules/com_vtiger_workflow/VTEntityMethodManager.inc';
global $adb;
$emm = new VTEntityMethodManager($adb);
$emm->addEntityMethod("FacturaComisiones", "calcularCamposFrasComisiones", "flujos_trabajo/HandlerCalcularCamposFrasComisiones.php", "calcularCamposFrasComisiones");
echo 'add Workflow Custom Function calcularCamposFrasComisiones to facturaComisiones module is complete!';
The funtion appears in the list of the workflow configuration in the custom module, but when I try to launch it saving one element , nothig appears. The function contains this code:
function escribirLog($texto, $archivo = "calcularCampos.txt"){
// una funcion para escribir un log de sucesos...
$ddf = fopen($archivo,'a');
fwrite($ddf,"[".date("r")."] $texto\r\n");
fclose($ddf);
//fclose($archivo);
}
function calcularCamposFrasComisiones($entity) {
include '../config.inc.php';
require_once 'include/database/PearDatabase.php';
// se obtiene la id del objeto que vamos a utilizar (en este caso, la ID de la Remesa)
global $adb, $thesoid;
$id = $entity->getId();
$id = explode("x", [i]$id );
[/i]
$thesoid = $id[1];
escribirLog($thesoid,"calcularCampos.txt" );
}
But the log appears empty. If I call the function directly it works...
I don´t know if the function isn´t register, or the problem will be another
Thanbk you