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

157 lines
5.7 KiB
PHP

<?php
/* +***********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
* *********************************************************************************** */
require_once 'vtlib/Vtiger/Module.php';
require_once('include/events/include.inc');
class Google {
const module = 'Google';
var $LBL_GOOGLE = 'LBL_GOOGLE';
/**
* Invoked when special actions are to be performed on the module.
* @param String Module name
* @param String Event Type
*/
function vtlib_handler($moduleName, $eventType) {
$adb = PearDatabase::getInstance();
$forModules = array('Contacts', 'Leads','Accounts');
$syncModules = array('Contacts' => 'Google Contacts', 'Calendar' => 'Google Calendar');
if ($eventType == 'module.postinstall') {
$adb->pquery('UPDATE vtiger_tab SET customized=0 WHERE name=?', array($moduleName));
// SalesPlatform.ru begin
$adb->pquery("INSERT INTO vtiger_google_sync_localization VALUES
(1, 'gd:namePrefix', '', ''),
(2, 'gd:givenName', '', ''),
(3, 'gd:familyName', '', ''),
(4, 'gd:orgTitle', '', ''),
(5, 'gd:orgName', '', ''),
(6, 'gContact:birthday', '', ''),
(7, 'gd:email', 'home', 'Домашние контакты'),
(8, 'gd:email', 'work', 'Рабочие контакты'),
(9, 'gd:phoneNumber', 'mobile', 'Мобильные устройства'),
(10, 'gd:phoneNumber', 'work', 'Рабочие контакты'),
(11, 'gd:phoneNumber', 'home', 'Домашние контакты'),
(12, 'gd:structuredPostalAddress', 'home', 'Домашние контакты'),
(13, 'gd:structuredPostalAddress', 'work', 'Рабочие контакты'),
(14, 'content', '', '')", array());
// SalesPlatform.ru end
$this->addMapWidget($forModules);
$this->addWidgetforSync($syncModules);
} else if ($eventType == 'module.disabled') {
$this->removeMapWidget($forModules);
$this->removeWidgetforSync($syncModules);
$adb->pquery('UPDATE vtiger_settings_field SET active=1 WHERE name=?',array($this->LBL_GOOGLE));
} else if ($eventType == 'module.enabled') {
$this->addMapWidget($forModules);
$this->addWidgetforSync($syncModules);
$adb->pquery('UPDATE vtiger_settings_field SET active=0 WHERE name=?',array($this->LBL_GOOGLE));
} else if ($eventType == 'module.preuninstall') {
$this->removeMapWidget($forModules);
$this->removeWidgetforSync($syncModules);
} else if ($eventType == 'module.preupdate') {
// TODO Handle actions before this module is updated.
} else if ($eventType == 'module.postupdate') {
}
}
/**
* Add widget to other module.
* @param Array $moduleNames
* @param String $widgetType
* @param String $widgetName
* @return
*/
function addMapWidget($moduleNames, $widgetType = 'DETAILVIEWSIDEBARWIDGET', $widgetName = 'Google Map') {
if (empty($moduleNames))
return;
if (is_string($moduleNames))
$moduleNames = array($moduleNames);
foreach ($moduleNames as $moduleName) {
$module = Vtiger_Module::getInstance($moduleName);
if ($module) {
$module->addLink($widgetType, $widgetName, 'module=Google&view=Map&mode=showMap&viewtype=detail', '', '', '');
}
}
}
/**
* Remove widget from other modules.
* @param Array $moduleNames
* @param String $widgetType
* @param String $widgetName
* @return
*/
function removeMapWidget($moduleNames, $widgetType = 'DETAILVIEWSIDEBARWIDGET', $widgetName = 'Google Map') {
if (empty($moduleNames))
return;
if (is_string($moduleNames))
$moduleNames = array($moduleNames);
foreach ($moduleNames as $moduleName) {
$module = Vtiger_Module::getInstance($moduleName);
if ($module) {
$module->deleteLink($widgetType, $widgetName, 'module=Google&view=Map&mode=showMap&viewtype=detail');
}
}
}
/**
* Add widget to other module
* @param String $widgetType
* @param String $widgetName
* @return
*/
function addWidgetforSync($moduleNames, $widgetType = 'LISTVIEWSIDEBARWIDGET') {
if (empty($moduleNames))
return;
if (is_string($moduleNames))
$moduleNames = array($moduleNames);
foreach ($moduleNames as $moduleName => $widgetName) {
$module = Vtiger_Module::getInstance($moduleName);
if ($module) {
$module->addLink($widgetType, $widgetName, "module=Google&view=List&sourcemodule=$moduleName", '', '', '');
}
}
}
/**
* Remove widget from other modules.
* @param String $widgetType
* @param String $widgetName
* @return
*/
function removeWidgetforSync($moduleNames, $widgetType = 'LISTVIEWSIDEBARWIDGET') {
if (empty($moduleNames))
return;
if (is_string($moduleNames))
$moduleNames = array($moduleNames);
foreach ($moduleNames as $moduleName => $widgetName) {
$module = Vtiger_Module::getInstance($moduleName);
if ($module) {
$module->deleteLink($widgetType, $widgetName);
}
}
}
}
?>