- 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.
89 lines
2.7 KiB
PHP
89 lines
2.7 KiB
PHP
<?php
|
|
/**
|
|
This File was developed by Stefan Warnat <vtiger@stefanwarnat.de>
|
|
|
|
It belongs to the Workflow Designer and must not be distributed without complete extension
|
|
**/
|
|
|
|
require_once(realpath(dirname(__FILE__).'/../autoload_wf.php'));
|
|
|
|
class WfTaskMessage extends \Workflow\Task
|
|
{
|
|
/**
|
|
* @param $context \Workflow\VTEntity
|
|
*/
|
|
public function handleTask(&$context) {
|
|
$adb = PearDatabase::getInstance();
|
|
|
|
$targetId = $this->get('targetId', $context);
|
|
if(empty($targetId)) {
|
|
$targetId = $context->getId();
|
|
}
|
|
|
|
$target = $this->get('target');
|
|
if($target == -1) {
|
|
$target = 'record';
|
|
}
|
|
|
|
$targetIds = array();
|
|
|
|
if($target == 'record') {
|
|
if(strpos($targetId, 'x') !== false) {
|
|
$parts = explode('x', $targetId);
|
|
$targetId = $parts[1];
|
|
}
|
|
$targetIds[] = $targetId;
|
|
} else {
|
|
$targetUser = $this->get('targetUser', $context);
|
|
if(!empty($targetUser)) {
|
|
if($targetUser == 'assigned') $targetUser = 'assigned_user_id';
|
|
if($targetUser == 'modified') $targetUser = 'modifiedby';
|
|
|
|
$targetuserId = \Workflow\VTTemplate::parse('$'.$targetUser, $context);
|
|
|
|
if(strpos($targetuserId, 'x') !== false) {
|
|
$parts = explode('x', $targetuserId);
|
|
$targetuserId = $parts[1];
|
|
}
|
|
|
|
$targetIds[] = $targetuserId;
|
|
}
|
|
}
|
|
|
|
/* if($this->get('target') == 'user') {
|
|
if(strpos($idString, "x") !== false) {
|
|
$idParts = explode("x", $idString);
|
|
return $idParts[1];
|
|
}
|
|
|
|
$current_user = $cu_model = Users_Record_Model::getCurrentUserModel();
|
|
$target = 'user';
|
|
|
|
$targetId = $current_user->id;
|
|
}*/
|
|
|
|
|
|
$type = $this->get('type', $context);
|
|
$subject = $this->get('subject', $context);
|
|
$message = $this->get('message', $context);
|
|
|
|
foreach($targetIds as $targetId) {
|
|
$this->addStat('Add Message to '.$type.' '.$targetId);
|
|
|
|
$sql = 'INSERT INTO vtiger_wf_messages SET crmid = ?, type = ?, subject = ?, message = ?, show_once = ?, show_until = ?, position = ?, created = NOW(), target = ?';
|
|
$adb->pquery($sql, array($targetId, $type, $subject, $message, $this->get('show_once', $context), $this->get('show_until', $context), $this->get('position', $context), $target));
|
|
}
|
|
|
|
return "yes";
|
|
}
|
|
|
|
public function beforeGetTaskform($viewer) {
|
|
$viewer->assign('isFrontendWorkflow', $this->getWorkflow()->isFrontendWorkflow());
|
|
}
|
|
|
|
public function beforeSave(&$values) {
|
|
|
|
|
|
}
|
|
}
|