Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
en:extensions:workflowdesigner:developers [2014/12/15 16:54] swarnat |
en:extensions:workflowdesigner:developers [2016/07/22 12:38] (current) swarnat |
||
---|---|---|---|
Line 214: | Line 214: | ||
* Should return every fieldtype this class will provide | * Should return every fieldtype this class will provide | ||
* | * | ||
- | * @param $moduleName | + | * @param $moduleName - The moduleName of the Workflow, which include this field |
* @return array - An Array with the following Structure | * @return array - An Array with the following Structure | ||
* array( | * array( | ||
Line 285: | Line 285: | ||
\Workflow\Fieldtype::register('[IndividualNameA]', '\Workflow\Plugins\Fieldtypes\[IndividualNameA]'); | \Workflow\Fieldtype::register('[IndividualNameA]', '\Workflow\Plugins\Fieldtypes\[IndividualNameA]'); | ||
</code> | </code> | ||
+ | |||
+ | ==== add own shortfunctions ==== | ||
+ | |||
+ | If you want to add a custom "shortfunction" you could use with the syntax $[...], then you must do the following. | ||
+ | Create one file, with filename **<custom>.inc.php** in folder modules/Workflow2/extends/shortfunctions/ | ||
+ | |||
+ | Only required code is: | ||
+ | |||
+ | <code> | ||
+ | \Workflow\Shortfunctions::register('shortfunctionname', <CallAble Object>, $parametersShouldBeParsed); | ||
+ | </code> | ||
+ | |||
+ | The callable object could be any callable element, php could execute. For example an closure, or string with function name. Any possible option you see here: [[http://php.net/manual/de/language.types.callable.php]] | ||
+ | |||
+ | And you must implement this callable object with your PHP code. **That's all!** | ||
+ | |||
+ | ==== 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. | ||
+ | |||
+ | <code php> | ||
+ | <?php | ||
+ | /** | ||
+ | * You need to enter the following php structure | ||
+ | * | ||
+ | * return array( | ||
+ | * 'tableCol' => array('inventoryField' => 'FieldNameWithoutProductIndex', 'label' => 'Label of this field'), | ||
+ | * ); | ||
+ | */ | ||
+ | // Example: | ||
+ | |||
+ | return array( | ||
+ | 'test' => array('inventoryField' => 'testCol', 'label' => 'Testvalue'), | ||
+ | ); | ||
+ | </code> | ||
+ | | 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 | | ||
+ | |||
+ | This structure will make it possible to also set this fields if you create an Invoice in an Workflow. |