Files
crm.clientright.ru/modules/Workflow2/extends/emailtemplates/emailmaker.inc.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

60 lines
2.0 KiB
PHP

<?php
namespace Workflow\Plugins\EmailTemplate;
use Workflow\Emailtemplates;
use Workflow\VTEntity;
class Emailmaker {
public static function getAllTemplates($moduleName) {
$mailtemplates = array();
$emailmaker = new \EMAILMaker_Module_Model();
if(method_exists($emailmaker, 'GetAvailableTemplates')) {
$templates = $emailmaker->GetAvailableTemplates($moduleName);
foreach($templates as $categoryTitle => $category) {
if(!is_array($category)) {
$mailtemplates[$categoryTitle] = $category;
} else {
foreach($category as $templateid => $template) {
$mailtemplates[$templateid] = $template;
}
}
}
}
return $mailtemplates;
}
public static function getTemplate($id, VTEntity $context) {
$current_language = vglobal('current_language');
$adb = \PearDatabase::getInstance();
$templateid = $id;
$sql = 'SELECT body, subject FROM vtiger_emakertemplates WHERE templateid = ?';
$result = $adb->pquery($sql, array($templateid));
$EMAILContentModel = \EMAILMaker_EMAILContent_Model::getInstance($context->getModuleName(), $context->getId(), $current_language, $context->getId(), $context->getModuleName());
$data = $adb->raw_query_result_rowdata($result, 0);
$EMAILContentModel->setSubject($data['subject']);
$EMAILContentModel->setBody($data['body']);
$EMAILContentModel->getContent(true);
$embeddedImages = $EMAILContentModel->getEmailImages();
$subject = $EMAILContentModel->getSubject();
$content = $EMAILContentModel->getBody();
return array(
'content' => $content,
'subject' => $subject,
'images' => $embeddedImages,
);
}
}
if(vtlib_isModuleActive('EMAILMaker') && class_exists('EMAILMaker_Module_Model')) {
Emailtemplates::register('\\Workflow\\Plugins\\EmailTemplate\\Emailmaker', 'EMAILMaker');
}