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

131 lines
4.6 KiB
PHP

<?php
/* * *******************************************************************************
* The content of this file is subject to the Favorite 4 You license.
* ("License"); You may not use this file except in compliance with the License
* The Initial Developer of the Original Code is IT-Solutions4You s.r.o.
* Portions created by IT-Solutions4You s.r.o. are Copyright(C) IT-Solutions4You s.r.o.
* All Rights Reserved.
* ****************************************************************************** */
require_once 'modules/Webforms/model/WebformsModel.php';
require_once 'include/Webservices/DescribeObject.php';
class ITS4YouFavorite
{
protected static $moduleDescribeCache = array();
public $LBL_MODULE_NAME = 'Favorite 4 You';
public $db;
// Cache to speed up describe information store
public $log;
/**
* [module, type, label, url, icon, sequence, handlerInfo]
* @return array
*/
public $registerCustomLinks = array(
['ITS4YouFavorite', 'HEADERSCRIPT', 'ITS4YouFavorite', 'layouts/$LAYOUT$/modules/ITS4YouFavorite/resources/ITS4YouFavorite.js']
);
function __construct()
{
global $log, $currentModule;
$this->db = PearDatabase::getInstance();
$this->log = $log;
}
function vtlib_handler($moduleName, $eventType)
{
require_once('include/utils/utils.php');
require_once('vtlib/Vtiger/Module.php');
$layout = Vtiger_Viewer::getDefaultLayoutName();
switch ($eventType) {
case 'module.postupdate':
case 'module.enabled':
case 'module.postinstall':
$this->addCustomLinks($layout);
break;
case 'module.preupdate':
case 'module.preuninstall':
case 'module.disabled':
$this->deleteCustomLinks($layout);
break;
}
}
public function addCustomLinks($layout)
{
$this->updateSettingsLinks();
$this->retrieveCustomLinks();
$this->updateCustomLinks();
}
public function updateSettingsLinks($register = true)
{
$image = '';
$description = 'Add your work to favorite...';
$linkTo = 'index.php?module=ITS4YouFavorite&parent=Settings&view=List';
$blockId = getSettingsBlockId('LBL_OTHER_SETTINGS');
$active = 1;
if ($register) {
$result1 = $this->db->pquery('SELECT 1 FROM vtiger_settings_field WHERE name=?', array($this->LBL_MODULE_NAME));
$active = 0;
if (!$this->db->num_rows($result1)) {
$fieldId = $this->db->getUniqueID('vtiger_settings_field');
$seq_res = $this->db->pquery('SELECT max(sequence) AS max_seq FROM vtiger_settings_field WHERE blockid = ?', array($blockId));
$sequence = intval($this->db->query_result($seq_res, 0, 'max_seq')) + 1;
$this->db->pquery('INSERT INTO vtiger_settings_field(fieldid, blockid, name, iconpath, description, linkto, sequence) VALUES (?,?,?,?,?,?,?)', array($fieldId, $blockId, $this->LBL_MODULE_NAME, $image, $description, $linkTo, $sequence));
}
}
$this->db->pquery('UPDATE vtiger_settings_field set active=? where name=?', array($active, $this->LBL_MODULE_NAME));
}
public function retrieveCustomLinks()
{
$entityModules = Vtiger_Module_Model::getEntityModules();
foreach ($entityModules as $entityModule) {
$this->registerCustomLinks[] = [
$entityModule->getName(),
'DETAILVIEW',
'Add to Favorite',
'javascript:ITS4YouFavorite_Js.addToFavorite()'
];
}
}
/**
* @param bool $register
*/
public function updateCustomLinks($register = true)
{
foreach ($this->registerCustomLinks as $customLink) {
list($moduleName, $type, $label, $url, $icon, $sequence, $handler) = array_pad($customLink, 7, null);
$module = Vtiger_Module::getInstance($moduleName);
$url = str_replace('$LAYOUT$', Vtiger_Viewer::getDefaultLayoutName(), $url);
if ($module) {
$module->deleteLink($type, $label);
if ($register) {
$module->addLink($type, $label, $url, $icon, $sequence, $handler);
}
}
}
}
public function deleteCustomLinks($layout)
{
$this->updateSettingsLinks(false);
$this->updateCustomLinks(false);
}
}