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

136 lines
5.1 KiB
PHP

<?php
/*********************************************************************************
* The content of this file is subject to the ITS4YouKanbanView 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 ITS4YouKanbanView
{
protected static $moduleDescribeCache = array();
public $LBL_MODULE_NAME = 'Kanban View 4 You';
// Cache to speed up describe information store
public $LBL_MODULE_NAME_OLD = 'ITS4YouKanbanView';
public $moduleName = 'ITS4YouKanbanView';
public $moduleInstance;
/**
* [module, type, label, url, icon, sequence, handlerInfo]
* @return array
*/
public $registerCustomLinks = array(
['ITS4YouKanbanView', 'HEADERSCRIPT', 'ITS4YouKanbanView_HS_Js', 'layouts/$LAYOUT$/modules/ITS4YouKanbanView/resources/ITS4YouKanbanView_HS.js']
);
public function __construct()
{
global $log, $currentModule;
$this->db = PearDatabase::getInstance();
$this->log = $log;
}
public function vtlib_handler($moduleName, $eventType)
{
$this->moduleInstance = Vtiger_Module::getInstance($moduleName);
switch ($eventType) {
case 'module.postinstall':
case 'module.enabled':
case 'module.postupdate':
$this->addCustomLinks();
break;
case 'module.preuninstall':
case 'module.disabled':
case 'module.preupdate':
$this->deleteCustomLinks();
break;
}
}
public function addCustomLinks()
{
$this->updateSettings();
$this->updateCustomLinks();
$this->updateFields();
}
public function updateSettings($register = true)
{
$image = '';
$description = 'Kanban view for modules.';
$linkto = 'index.php?module=ITS4YouKanbanView&parent=Settings&view=List';
if ($register) {
$result1 = $this->db->pquery('SELECT 1 FROM vtiger_settings_field WHERE name=?', array($this->LBL_MODULE_NAME_OLD));
if ($this->db->num_rows($result1)) {
$this->db->pquery('UPDATE vtiger_settings_field SET name=?, iconpath=?, description=?, linkto=? WHERE name=?', array($this->LBL_MODULE_NAME, $image, $description, $linkto, $this->LBL_MODULE_NAME_OLD));
}
$result2 = $this->db->pquery('SELECT 1 FROM vtiger_settings_field WHERE name=?', array($this->LBL_MODULE_NAME));
if (!$this->db->num_rows($result2)) {
$fieldid = $this->db->getUniqueID('vtiger_settings_field');
$blockid = getSettingsBlockId('LBL_OTHER_SETTINGS');
$seq_res = $this->db->pquery("SELECT max(sequence) AS max_seq FROM vtiger_settings_field WHERE blockid = ?", array($blockid));
if ($this->db->num_rows($seq_res) > 0) {
$cur_seq = $this->db->query_result($seq_res, 0, 'max_seq');
if ($cur_seq != null) {
$seq = $cur_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, $seq));
}
$this->db->pquery('UPDATE vtiger_settings_field SET active= 0 WHERE name= ?', array($this->LBL_MODULE_NAME));
} else {
$this->db->pquery('UPDATE vtiger_settings_field SET active= 1 WHERE name= ?', array($this->LBL_MODULE_NAME));
}
}
/**
* @param bool $register
*/
public function updateCustomLinks($register = true)
{
foreach ($this->registerCustomLinks as $customLink) {
$module = Vtiger_Module::getInstance($customLink[0]);
$type = $customLink[1];
$label = $customLink[2];
$url = str_replace('$LAYOUT$', Vtiger_Viewer::getDefaultLayoutName(), $customLink[3]);
if ($module) {
$module->deleteLink($type, $label);
if ($register) {
$module->addLink($type, $label, $url, $customLink[4], $customLink[5], $customLink[6]);
}
}
}
}
public function updateFields()
{
$this->db->pquery('ALTER TABLE `its4you_kanban_view_settings` CHANGE `id` `id` INT(19) NOT NULL AUTO_INCREMENT');
}
public function deleteCustomLinks()
{
$this->updateCustomLinks(false);
$this->updateSettings(false);
}
public function getNonAdminAccessControlQuery($tabName, $user)
{
return '';
}
}