Files
crm.clientright.ru/modules/Workflow2/lib/Workflow/CommunicationPlugin.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

158 lines
4.1 KiB
PHP

<?php
/**
* Created by JetBrains PhpStorm.
* User: Stefan Warnat <support@stefanwarnat.de>
* Date: 04.06.14 15:48
* You must not use this file without permission.
*/
namespace Workflow;
abstract class CommunicationPlugin extends Extendable {
protected $name = 'Unnamed Provider';
/**
* @var ConfigHandler
*/
private $configHandler;
protected $usernameLabel = 'Account SID';
protected $passwordLabel = 'Auth Token';
protected $supported = array(
'sms' => false,
'fax' => false
);
public function setConfiguration($config) {
$this->configHandler = new ConfigHandler();
$this->configHandler->loadData($config);
}
public function get($key) {
return $this->configHandler->getValue($key);
}
protected $configFields = array(
'username' => array(
'label' => 'Provider',
'type' => 'text',
),
'password' => array(
'label' => 'Password',
'type' => 'password',
),
);
protected $additionalFields = array(
'sms' => array(
'to' => array(
'label' => 'Receiver',
'type' => 'templatefield',
),
'from' => array(
'label' => 'Sender',
'type' => 'templatefield',
),
'content' => array(
'label' => 'Content',
'type' => 'templatearea',
),
),
'fax' => array(
'receiver' => array(
'label' => 'Receiver',
'type' => 'templatefield',
),
)
);
protected $extraDataFields = array();
public static function init() {
self::_init(dirname(__FILE__).'/../../extends/communicate/');
}
public static function getAvailableProvider() {
/**
* @var $items CommunicationPlugin[]
*/
$items = self::getItems();
$return = array();
foreach($items as $item) {
$name = $item->getName();
$return[$item->getExtendableKey()] = $name;
}
return $return;
}
public function isSupported($method) {
return $this->supported[strtolower($method)] == true;
}
/** Functions you could overwrite in your provider **/
public function getConfigFields() {
$this->configFields['username']['label'] = $this->usernameLabel;
$this->configFields['password']['label'] = $this->passwordLabel;
return $this->configFields;
}
public function getName() {
return $this->name;
}
abstract public function test();
public function isAvailable($moduleName) {
return true;
}
public function SMS($data) {}
public function SMS_check($data) {}
public function FAX($filepath, $data) {}
public function FAX_check($data) {}
final public function filterDataField($method, $config) {
$dataField = $this->getDataFields($method);
$result = array();
foreach($dataField as $key => $value) {
$result[$key] = $config[$key];
}
return $result;
}
public function getDataFields($method) {
$method = strtolower($method);
if(!isset($this->additionalFields[$method])) {
$this->additionalFields[$method] = array();
}
if(!empty($this->extraDataFields[$method])) {
$this->additionalFields[$method] = array_merge($this->additionalFields[$method], $this->extraDataFields[$method]);
}
if($this->isSupported($method)) {
return $this->additionalFields[$method];
} else {
throw new \Exception('Not supported Communication Method');
}
}
public function includeXmlRPC() {
}
public function getSoapClient()
{
if (!class_exists('wf_nusoap_base', false)) {
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'SWExtension' . DIRECTORY_SEPARATOR . 'nusoap' . DIRECTORY_SEPARATOR . 'nusoap.php');
}
return new \wf_nusoap_base();
}
}
?>