if(!function_exists("wf_date")) {
function wf_date($value, $interval, $format = "Y-m-d") {
if(empty($interval)) {
$dateValue = strtotime($value);
} else {
$dateValue = strtotime($interval, strtotime($value));
}
return date($format, $dateValue);
}
}
==== You have a module, which create files you want to integrate into Workflows? ====
**PDFMaker and SQLReports are implemented in this way!**
isModuleActive()) {
return;
}
}
/**
* @var String $moduleName The module of the current Workflow
* @return array - array(
* 'filekeyA' => 'File title of the first file from this module',
* ...
* )
*
* The file title will be shown in the task configurations.
* The filekey will be given to your _getFile and should uniquely identify the file you should generate
*/
protected function _getAvailableFiles($moduleName) {
$return = array();
if(!$this->isModuleActive()) {
return $return;
}
/*
This function must simple return an array, like this:
array(
'filekeyA' => 'File title of this file'
)
*/
return $return;
}
/**
* @var String $key - The fileKey you set in the _getAvailableFiles function
* @var String $moduleName - The module from the given RecordID, which should be used to generate the file
* @var Int $crmid - The ID of the Record, which should be used to generate the file
* @return array - An Array with the following Structure
* array(
* 'path' => "",
* 'type' => "",
* 'name' => ""
* );
* The filename will probably overwritten by some tasks,
* but if not, it will be used to give this file to the user.
*/
protected function _getFile($key, $moduleName, $crmid) {
if(!$this->isModuleActive()) {
return false;
}
return array(
'path' => "",
'type' => "",
'name' => ""
);
}
public function isModuleActive() {
return getTabid('[moduleName]') && vtlib_isModuleActive('[moduleName]');
}
}
// This will register this class in the Interface Registry
\Workflow\InterfaceFiles::register('[SanitizedModuleName]', '\Workflow\Plugins\InterfaceFiles\[ModuleName]');
==== Add new Options what to do with Files generated by Workflows ====
With 600.0801 in added this interface. It will be integrated in every tasks in the next versions.
At this moment it is only integrated into the new PDFMaker Integration block.
Add a file in **/modules/Workflow2/extends/fileactions/** with the filename “**
'',
'options' => $options
)
$options is also an array with configuration options,
the User should input, if he choose this action
$options = array(
'' => array(
'type' => '',
'label' => '
==== Add a FieldType for Request Values from User ====
You would like to request a very special value from your users and you couldn't do this with the integrated field types?
**You could integrate you own fieldtypes!**
Add a file in **/modules/Workflow2/extends/fieldtypes/** with the filename “**
'',
'title' => '',
'config' => $config
* ), ...
* )
$config is an array of configuration fields, the admin needs to configure in backend
* it must have the following structure
* array(
* '' => array(
'type' => '[templatefield,templatearea,picklist,checkbox]',
* 'label' => '
==== use custom Inventory Fields ====
If you implement custom fields in your Inventory Records, like Invoice, Quotes, the values will be deleted during any workflows and you couldn't interact with this values from Workflow Designer before version 600.0825. \\
With this version, you could create a file named “InventoryFields.inc.php” directly into the “extends” directory. \\
This file will not be overwritten during updates of the module.
In this file you could configure the fields you create and want to keep during Workflows. \\
This file MUST have the following structure. \\
Because this file will be included during every Workflow execution in the Inventory Modules, you should proceed with caution. \\
Every Error in this file could make it impossible to execute any workflows.
array('inventoryField' => 'FieldNameWithoutProductIndex', 'label' => 'Label of this field'),
* );
*/
// Example:
return array(
'test' => array('inventoryField' => 'testCol', 'label' => 'Testvalue'),
);
tableCol | This is the name of the column in the vtiger_inventoryproductrel table. Won't be used to read from database , but will be a good and unique name |
FieldNameWithoutProductIndex | This is the Key of the value in the ProductsArray. You use this value in the “getAssociatedProducts” function |
Testvalue | The label of this field, which will be shown on task configurations |