Files
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

149 lines
5.0 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 'modules/com_vtiger_workflow/include.inc';
require_once 'modules/com_vtiger_workflow/expression_engine/VTExpressionsManager.inc';
class Settings_Workflows_Module_Model extends Settings_Vtiger_Module_Model {
var $baseTable = 'com_vtiger_workflows';
var $baseIndex = 'workflow_id';
// var $listFields = array('summary' => 'Summary', 'module_name' => 'Module', 'execution_condition' => 'Execution Condition');
var $listFields = array('module_name' => 'Module', 'workflowname' => 'Workflow Name', 'summary'=>'Description', 'execution_condition' => 'Trigger', 'test' => 'Conditions');
var $name = 'Workflows';
static $metaVariables = array(
'Current Date' => '(general : (__VtigerMeta__) date) ($_DATE_FORMAT_)',
'Current Time' => '(general : (__VtigerMeta__) time)',
'System Timezone' => '(general : (__VtigerMeta__) dbtimezone)',
'User Timezone' => '(general : (__VtigerMeta__) usertimezone)',
'CRM Detail View URL' => '(general : (__VtigerMeta__) crmdetailviewurl)',
'Portal Detail View URL' => '(general : (__VtigerMeta__) portaldetailviewurl)',
'Site Url' => '(general : (__VtigerMeta__) siteurl)',
'Portal Url' => '(general : (__VtigerMeta__) portalurl)',
'Record Id' => '(general : (__VtigerMeta__) recordId)',
'LBL_HELPDESK_SUPPORT_NAME' => '(general : (__VtigerMeta__) supportName)',
'LBL_HELPDESK_SUPPORT_EMAILID' => '(general : (__VtigerMeta__) supportEmailid)',
);
static $triggerTypes = array(
1 => 'ON_FIRST_SAVE',
2 => 'ONCE',
3 => 'ON_EVERY_SAVE',
4 => 'ON_MODIFY',
// Reserving 5 & 6 for ON_DELETE and ON_SCHEDULED types.
6=> 'ON_SCHEDULE'
);
/**
* Function to get the url for default view of the module
* @return <string> - url
*/
public static function getDefaultUrl() {
return 'index.php?module=Workflows&parent=Settings&view=List';
}
/**
* Function to get the url for create view of the module
* @return <string> - url
*/
public static function getCreateViewUrl() {
return "javascript:Settings_Workflows_List_Js.triggerCreate('index.php?module=Workflows&parent=Settings&view=Edit')";
}
public static function getCreateRecordUrl() {
return 'index.php?module=Workflows&parent=Settings&view=Edit';
}
public static function getSupportedModules() {
$moduleModels = Vtiger_Module_Model::getAll(array(0,2));
$supportedModuleModels = array();
foreach($moduleModels as $tabId => $moduleModel) {
if($moduleModel->isWorkflowSupported() && $moduleModel->getName() != 'Webmails') {
$supportedModuleModels[$tabId] = $moduleModel;
}
}
return $supportedModuleModels;
}
public static function getTriggerTypes() {
return self::$triggerTypes;
}
public static function getExpressions() {
$db = PearDatabase::getInstance();
$mem = new VTExpressionsManager($db);
return $mem->expressionFunctions();
}
public static function getMetaVariables() {
return self::$metaVariables;
}
public function getListFields() {
if(!$this->listFieldModels) {
$fields = $this->listFields;
$fieldObjects = array();
foreach($fields as $fieldName => $fieldLabel) {
if($fieldName == 'module_name' || $fieldName == 'execution_condition') {
$fieldObjects[$fieldName] = new Vtiger_Base_Model(array('name' => $fieldName, 'label' => $fieldLabel, 'sort'=>false));
} else {
$fieldObjects[$fieldName] = new Vtiger_Base_Model(array('name' => $fieldName, 'label' => $fieldLabel));
}
}
$this->listFieldModels = $fieldObjects;
}
return $this->listFieldModels;
}
/**
* Function to get the count of active workflows
* @return <Integer> count of active workflows
*/
public function getActiveWorkflowCount($moduleCount = false){
$db = PearDatabase::getInstance();
$query = 'SELECT count(*) AS count, vtiger_tab.tabid FROM com_vtiger_workflows
INNER JOIN vtiger_tab ON vtiger_tab.name = com_vtiger_workflows.module_name
AND vtiger_tab.presence IN (0,2) WHERE com_vtiger_workflows.status = ? ';
if($moduleCount){
$query .=' GROUP BY com_vtiger_workflows.module_name';
}
$result = $db->pquery($query, array(1));
$count = 0;
$wfModulesCount = array();
$noOfRows = $db->num_rows($result);
for($i=0; $i<$noOfRows; ++$i) {
$row = $db->query_result_rowdata($result, $i);
$count = $count+$row['count'];
$wfModulesCount[$row['tabid']] = $row['count'];
}
if($moduleCount){
$wfModulesCount['All'] = $count;
return $wfModulesCount;
} else {
return $count;
}
}
public function getFields() {
return array();
}
public function getModuleBasicLinks(){
return array();
}
}