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

94 lines
4.4 KiB
PHP

<?php
/* * *******************************************************************************
* The content of this file is subject to the VD Notifier Pro license.
* ("License"); You may not use this file except in compliance with the License
* The Initial Developer of the Original Code is http://www.vordoom.net
* Portions created by Vordoom.net are Copyright(C) Vordoom.net
* All Rights Reserved.
* ****************************************************************************** */
include_once('vtlib/Vtiger/Module.php');
require 'include/events/include.inc';
class VDNotifierPro {
/**
* Invoked when special actions are performed on the module.
* @param String Module name
* @param String Event Type
*/
function vtlib_handler($moduleName, $eventType) {
global $adb;
$moduleName = 'VDNotifierPro';
$moduleInstance = Vtiger_Module::getInstance($moduleName);
if($eventType == 'module.postinstall') {
$fieldid = $adb->getUniqueID('vtiger_settings_field');
$blockid = getSettingsBlockId('LBL_OTHER_SETTINGS');
$seq_res = $adb->query("SELECT max(sequence) AS max_seq FROM vtiger_settings_field WHERE blockid=$blockid");
$seq = 1;
if ($adb->num_rows($seq_res) > 0)
{
$cur_seq = $adb->query_result($seq_res, 0, 'max_seq');
if ($cur_seq != null)
{
$seq = $cur_seq + 1;
}
}
$adb->pquery('INSERT INTO vtiger_settings_field(fieldid, blockid, name, description, linkto, sequence,active) VALUES (?,?,?,?,?,?,?)',
array
($fieldid,
$blockid,
$moduleName,
'LBL_'.strtoupper($moduleName).'_DESCRIPTION',
'index.php?module='.$moduleName.'&view=Index&parent=Settings',
$seq,
0
)
);
$adb->pquery("INSERT INTO vtiger_vdnotifierpro_seq (id) value ('1')", array());
$EventManager = new VTEventsManager($adb);
$createEvent = 'vtiger.entity.aftersave';
$deleteEVent = 'vtiger.entity.beforedelete';
$restoreEvent = 'vtiger.entity.afterrestore';
$handler_path = 'modules/VDNotifierPro/VDNotifierProHandler.php';
$className = 'VDNotifierProHandler';
$EventManager->registerHandler($createEvent, $handler_path, $className);
$EventManager->registerHandler($deleteEVent, $handler_path, $className);
$EventManager->registerHandler($restoreEvent, $handler_path, $className);
$moduleInstance->addLink('HEADERSCRIPT', 'VDNotifierScript', 'layouts/v7/modules/Settings/VDNotifierPro/resources/pnotify/jquery.pnotify.js');
$moduleInstance->addLink('HEADERCSS', 'VDNotifierPnotifyCSS', 'layouts/v7/modules/Settings/VDNotifierPro/resources/pnotify/jquery.pnotify.default.css');
} else if($eventType == 'module.disabled') {
$moduleInstance->deleteLink('HEADERSCRIPT', 'VDNotifierScript', 'layouts/v7/modules/Settings/VDNotifierPro/resources/pnotify/jquery.pnotify.js');
$moduleInstance->deleteLink('HEADERCSS', 'VDNotifierPnotifyCSS', 'layouts/v7/modules/Settings/VDNotifierPro/resources/pnotify/jquery.pnotify.default.css');
} else if($eventType == 'module.enabled') {
$moduleInstance->addLink('HEADERSCRIPT', 'VDNotifierScript', 'layouts/v7/modules/Settings/VDNotifierPro/resources/pnotify/jquery.pnotify.js');
$moduleInstance->addLink('HEADERCSS', 'VDNotifierPnotifyCSS', 'layouts/v7/modules/Settings/VDNotifierPro/resources/pnotify/jquery.pnotify.default.css');
}
else if($eventType == 'module.preuninstall') {
require_once('vtlib/Vtiger/Link.php');
$tabid = getTabId($moduleName);
Vtiger_Link::deleteAll($tabid);
$EventManager = new VTEventsManager($adb);
$className = 'VDNotifierProHandler';
$EventManager->unregisterHandler($className);
$adb->pquery('DELETE FROM vtiger_settings_field WHERE name = ?', array($moduleName));
$adb->pquery('DROP TABLE vtiger_vdnotifierpro', array());
$adb->pquery('DROP TABLE vtiger_vdnotifierpro_seq', array());
} else if($eventType == 'module.preupdate') {
// TODO Handle actions before this module is updated.
} else if($eventType == 'module.postupdate') {
// TODO Handle actions after this module is updated.
}
}
}