Files
crm.clientright.ru/modules/Workflow2/extends/conditions/CustomView.inc.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

93 lines
3.2 KiB
PHP

<?php
/**
* Created by JetBrains PhpStorm.
* User: Stefan Warnat <support@stefanwarnat.de>
* Date: 18.06.15 16:21
* You must not use this file without permission.
*/
namespace Workflow\Plugin;
class CustomViewConditionOperator extends \Workflow\ConditionPlugin
{
public function getOperators($moduleName) {
$adb = \PearDatabase::getInstance();
$sql = 'SELECT cvid, viewname FROM vtiger_customview WHERE entitytype = ?';
$result = $adb->pquery($sql, array($moduleName));
$filters = array();
while($row = $adb->fetchByAssoc($result)) {
$filters[$row['cvid']] = $row['viewname'];
}
$operators = array(
'within_cv' => array (
'config' => array (
'customview' => array (
'type' => 'picklist',
'options' => $filters,
'label' => 'within Filter',
),
),
'label' => 'within filter',
'fieldtypes' => array ('crmid'),
),
);
return $operators;
}
public function generateSQLCondition($key, $columnName, $config, $not) {
$adb = \PearDatabase::getInstance();
if(is_string($config)) {
$config = array('customview' => $config);
}
$sql = 'SELECT entitytype from vtiger_customview WHERE cvid = '.intval($config['customview']);
$result = $adb->query($sql);
$queryGenerator = new \QueryGenerator($adb->query_result($result, 0, 'entitytype'), \Users::getActiveAdminUser());
$queryGenerator->initForCustomViewById($config['customview']);
$query = $queryGenerator->getQuery();
$parts = preg_split('/FROM/i', $query);
$sqlQuery = 'SELECT vtiger_crmentity.crmid as id_col FROM '.$parts[1];
// default calculations
switch($key) {
case 'within_cv':
return "".$columnName." " . ($not ? "NOT" : "" ) . " IN (".$sqlQuery.")";
break;
}
}
public function checkValue($context, $key, $fieldvalue, $config, $checkConfig) {
$adb = \PearDatabase::getInstance();
switch ($key) {
case "within_cv":
$sql = 'SELECT entitytype from vtiger_customview WHERE cvid = '.intval($config['customview']);
$result = $adb->query($sql);
$queryGenerator = new \QueryGenerator($adb->query_result($result, 0, 'entitytype'), \Users::getActiveAdminUser());
$queryGenerator->initForCustomViewById($config['customview']);
$query = $queryGenerator->getQuery();
$parts = preg_split('/FROM/i', $query);
$sqlQuery = 'SELECT vtiger_crmentity.crmid as id_col FROM '.$parts[1];
$result = $adb->query($sqlQuery, true);
while($row = $adb->fetchByAssoc($result)) {
if($fieldvalue == $row["id_col"]) {
return true;
break;
}
}
}
return false;
}
}
\Workflow\ConditionPlugin::register('customview', '\\Workflow\\Plugin\\CustomViewConditionOperator');