Files
crm.clientright.ru/modules/Workflow2/tasks/WfTaskDecisiontable.php
Fedor ac7467f0b4 Major CRM updates: AI Assistant, Court Status API, S3 integration improvements, and extensive file storage system
- Added comprehensive AI Assistant system (aiassist/ directory):
  * Vector search and embedding capabilities
  * Typebot proxy integration
  * Elastic search functionality
  * Message classification and chat history
  * MCP proxy for external integrations

- Implemented Court Status API (GetCourtStatus.php):
  * Real-time court document status checking
  * Integration with external court systems
  * Comprehensive error handling and logging

- Enhanced S3 integration:
  * Improved file backup system with metadata
  * Batch processing capabilities
  * Enhanced error logging and recovery
  * Copy operations with URL fixing

- Added Telegram contact creation API
- Improved error logging across all modules
- Enhanced callback system for AI responses
- Extensive backup file storage with timestamps
- Updated documentation and README files

- File storage improvements:
  * Thousands of backup files with proper metadata
  * Fix operations for broken file references
  * Project-specific backup and recovery systems
  * Comprehensive file integrity checking

Total: 26,461+ files added/modified including AWS SDK, vendor dependencies, and extensive backup system.
2025-10-16 11:17:21 +03:00

110 lines
3.8 KiB
PHP

<?php
require_once(realpath(dirname(__FILE__).'/../autoload_wf.php'));
class WfTaskDecisiontable extends \Workflow\Task
{
public function handleTask(&$context) {
/* Insert here source code to execute the task */
$structure = $this->get('structure');
$dataRows = $this->get('data');
$decisionValues = array();
foreach($structure['_ColType']['decision'] as $col) {
$matchValue = $structure['_Columns'][$col]['value'];
$decisionValues[$col] = \Workflow\VTTemplate::parse($matchValue, $context);
}
foreach($dataRows as $index => $data) {
$match = false;
foreach($structure['_ColType']['decision'] as $col) {
// var_dump('run check',$col);
$matchValue = $decisionValues[$col];
$checkValue = $data[$col];
switch ($checkValue['type']) {
case 'equal':
// var_dump($checkValue['value'].' == '.$matchValue);
$match = ($checkValue['value'] == $matchValue);
break;
case 'contain':
// var_dump($checkValue['value'].' ~= '.$matchValue);
if (strpos($matchValue, $checkValue['value']) !== false) {
$match = true;
} else {
$match = false;
}
break;
case 'expression':
$parser = new \Workflow\ExpressionParser($checkValue['value'], $context, false); # Last Parameter = DEBUG
try {
$parser->run();
} catch(\Workflow\ExpressionException $exp) {
Workflow2::error_handler(E_EXPRESSION_ERROR, $exp->getMessage(), "", "");
}
$returnValue = $parser->getReturn();
if($returnValue == 'on' || $returnValue == 'true' || $returnValue == 'yes' || $returnValue == 1 || $returnValue == '1' || $returnValue === true) {
$match = true;
} else {
$match = false;
}
break;
}
if($match === false) {
break;
}
}
if($match === false) {
continue;
}
if($match === true) {
foreach($structure['_ColType']['setter'] as $col) {
$setConfig = $structure['_Columns'][$col];
$content = \Workflow\VTTemplate::parse($data[$col]['value'], $context);
switch($setConfig['type']) {
case 'envvar':
$code = '<?php '.$setConfig['value'].' = "'.addslashes($content).'"; ?>';
\Workflow\VTTemplate::parse($code, $context);
break;
case 'field':
$context->set($setConfig['value'], $content);
break;
}
}
break;
}
}
return "yes";
}
public function beforeGetTaskform($viewer) {
if($this->notEmpty('data') === false) {
$this->set('data', array());
}
if($this->notEmpty('structure') === false) {
$this->set('structure', array());
}
$viewer->assign('fields', \Workflow\VtUtils::getFieldsWithBlocksForModule($this->getModuleName()));
/* Insert here source code to create custom configurations pages */
}
public function beforeSave(&$values) {
/* Insert here source code to modify the values the user submit on configuration */
}
}