- 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.
99 lines
3.4 KiB
PHP
99 lines
3.4 KiB
PHP
<?php
|
|
/*+**********************************************************************************
|
|
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
|
|
* ("License"); You may not use this file except in compliance with the License
|
|
* The Original Code is: vtiger CRM Open Source
|
|
* The Initial Developer of the Original Code is vtiger.
|
|
* Portions created by vtiger are Copyright (C) vtiger.
|
|
* All Rights Reserved.
|
|
************************************************************************************/
|
|
|
|
require_once('modules/com_vtiger_workflow/VTEntityCache.inc');
|
|
require_once('modules/com_vtiger_workflow/VTWorkflowUtils.php');
|
|
require_once('modules/com_vtiger_workflow/VTSimpleTemplate.inc');
|
|
|
|
require_once('modules/SMSNotifier/SMSNotifier.php');
|
|
|
|
class VTSMSTask extends VTTask {
|
|
public $executeImmediately = true;
|
|
|
|
public function getFieldNames(){
|
|
return array('content', 'sms_recepient');
|
|
}
|
|
|
|
public function doTask($entity){
|
|
|
|
if(SMSNotifier::checkServer()) {
|
|
|
|
global $adb, $current_user,$log;
|
|
|
|
$util = new VTWorkflowUtils();
|
|
$admin = $util->adminUser();
|
|
$ws_id = $entity->getId();
|
|
$entityCache = new VTEntityCache($admin);
|
|
|
|
$et = new VTSimpleTemplate($this->sms_recepient);
|
|
$recepient = $et->render($entityCache, $ws_id);
|
|
$recepients = explode(',',$recepient);
|
|
$relatedIds = $this->getRelatedIdsFromTemplate($this->sms_recepient, $entityCache, $ws_id);
|
|
$relatedIds = explode(',', $relatedIds);
|
|
$relatedIdsArray = array();
|
|
foreach ($relatedIds as $entityId) {
|
|
if (!empty($entityId)) {
|
|
list($moduleId, $recordId) = vtws_getIdComponents($entityId);
|
|
if (!empty($recordId)) {
|
|
$relatedIdsArray[] = $recordId;
|
|
}
|
|
}
|
|
}
|
|
|
|
$ct = new VTSimpleTemplate($this->content);
|
|
$content = $ct->render($entityCache, $ws_id);
|
|
$relatedCRMid = substr($ws_id, stripos($ws_id, 'x')+1);
|
|
$relatedIdsArray[] = $relatedCRMid;
|
|
|
|
$relatedModule = $entity->getModuleName();
|
|
|
|
/** Pickup only non-empty numbers */
|
|
$tonumbers = array();
|
|
foreach($recepients as $tonumber) {
|
|
if(!empty($tonumber)) $tonumbers[] = $tonumber;
|
|
}
|
|
|
|
//As content could be sent with HTML tags.
|
|
$content = strip_tags(br2nl($content));
|
|
|
|
//SalesPlatform.ru begin
|
|
$this->smsNotifierId = SMSNotifier::sendsms($content, $tonumbers, $current_user->id, $relatedIdsArray, $relatedModule, $this->sms_recepient);
|
|
//$this->smsNotifierId = SMSNotifier::sendsms($content, $tonumbers, $current_user->id, $relatedIdsArray);
|
|
//SalesPlatform.ru end
|
|
}
|
|
|
|
}
|
|
|
|
public function getRelatedIdsFromTemplate($template, $entityCache, $entityId) {
|
|
$this->template = $template;
|
|
$this->cache = $entityCache;
|
|
$this->parent = $this->cache->forId($entityId);
|
|
return preg_replace_callback('/\\$(\w+|\((\w+) : \(([_\w]+)\) (\w+)\))/', array($this,"matchHandler"), $this->template);
|
|
}
|
|
|
|
public function matchHandler($match) {
|
|
preg_match('/\((\w+) : \(([_\w]+)\) (\w+)\)/', $match[1], $matches);
|
|
// If parent is empty then we can't do any thing here
|
|
if(!empty($this->parent)){
|
|
if(count($matches) != 0){
|
|
list($full, $referenceField, $referenceModule, $fieldname) = $matches;
|
|
$referenceId = $this->parent->get($referenceField);
|
|
if($referenceModule==="Users" || $referenceId==null){
|
|
$result ="";
|
|
} else {
|
|
$result = $referenceId;
|
|
}
|
|
}
|
|
}
|
|
return $result;
|
|
}
|
|
}
|
|
?>
|