Files
crm.clientright.ru/modules/FinReports/FinReportsHandler.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

63 lines
3.0 KiB
PHP

<?php
require_once 'include/events/VTEventHandler.inc';
//vimport('~~/vtlib/Vtiger/Module.php');
class FinReportsHandler extends VTEventHandler {
function handleEvent($eventName, $data) {
global $adb;
if ($eventName == 'vtiger.entity.aftersave' && $data->getModuleName() == "FinReports") {
$moduleId = $data->getId();
$moduleName = $data->getModuleName();
$entityData = $data->getData();
foreach($entityData as $key => $value)
{
if(preg_match('/^cf_.+_id$/', $key, $name))
{
$relModule = $adb->pquery("SELECT
vtiger_field.*, vtiger_fieldmodulerel.relmodule, vtiger_tab.name
FROM
vtiger_field
JOIN vtiger_tab ON (
vtiger_field.tabid = vtiger_tab.tabid
)
JOIN vtiger_fieldmodulerel ON (
vtiger_fieldmodulerel.fieldid = vtiger_field.fieldid
)
WHERE
vtiger_field.fieldname = ?
",array($key));
if($adb->num_rows($relModule) > 0){
$moduleNameRelated = '';
while ($row = $adb->fetchByAssoc($relModule)) {
$moduleNameRelated = $row['relmodule'];
}
if(!empty($value)){
$result = $adb->pquery("SELECT vtiger_crmentityrel.*
FROM
vtiger_crmentityrel
WHERE crmid = ? AND relcrmid = ?",array($value,$moduleId,));
if($adb->num_rows($result) == 0){
$adb->pquery("INSERT INTO vtiger_crmentityrel (crmid,module,relcrmid,relmodule) VALUE (?,?,?,?)",array($value,$moduleNameRelated,$moduleId,$moduleName));
}
}else{
$result = $adb->pquery("SELECT vtiger_crmentityrel.*
FROM
vtiger_crmentityrel
WHERE module = ? AND relcrmid = ? AND relmodule = ?",array($moduleNameRelated,$moduleId,$moduleName));
if($count = $adb->num_rows($result) > 0){
$adb->pquery("DELETE FROM vtiger_crmentityrel WHERE module = ? AND relcrmid = ? AND relmodule = ?",array($moduleNameRelated,$moduleId,$moduleName));
}
}
}
}
}
}
}
}