Starting with version 600.0801 I implement a temporarily filestore, which could used by the actions to store files for later usage, without make use of the VtigerCRM integrated Documents/Attachments and waste a CRMID for a file, you need for only one task.
The filestore is stored in an Environmental Variable or current execution. This means, all files of one execution will be removed, after the complete workflow is finished.
The filestore works like a key-value storage. Every file will have a FileStore ID, which must used to reference the file. For example one action will create a file and store this in the filestore with the ID “file_xyz”.
Every task in the same execution, which support filestore Input, could open the file with the ID “file_xyz”.
If you want to use the filestore in your own actions, use the following interface of the \Workflow\VTEntity class, given to the action in $context.
To store a file inside the filestore:
$context->addTempFile($filepath, $filestoreid, $filename);
Параметр
$filepath | String | The temporarily path to the file you create This file will be moved to the central tmp directory inside Workflow Designer |
$filestoreid | String | The ID you want to use, to store the File |
$filename | String | The filename of this file. Could be used by tasks to use the correct filename |
Для того, чтобы загрузить файл из хранилища файлов:
$file = $context->getTempFiles($filestoreid);
Параметр
$filestoreid | string | The ID of the file you want to get |
Returns
array( "path" => <absolute path to the file>, "name" => <filename you set during addTempFile> )