- 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.
101 lines
4.3 KiB
PHP
101 lines
4.3 KiB
PHP
<?php
|
||
/*********************************************************************************
|
||
* API-интерфейс для создания Проекта
|
||
* All Rights Reserved.
|
||
* Contributor(s): Илья Руденко itsaturn@yandex.ru
|
||
********************************************************************************/
|
||
|
||
include_once 'include/Webservices/Query.php';
|
||
include_once 'modules/Users/Users.php';
|
||
require_once('include/Webservices/Utils.php');
|
||
require_once 'include/Webservices/Create.php';
|
||
require_once 'includes/Loader.php';
|
||
vimport ('includes.runtime.Globals');
|
||
vimport ('includes.runtime.BaseModel');
|
||
vimport ('includes.runtime.LanguageHandler');
|
||
|
||
function vtws_createproject($contactid, $offenderid, $agentid, $sms, $ip, $source, $region, $formid, $category, $direction, $agrprice, $subject, $agrdate, $startdate, $finishdate, $loss, $servicecost, $progress, $country, $hotel, $transport, $insurance, $other, $description, $independently, $claimdate, $returned, $user = false) {
|
||
$output = 'Внутрення ошибка CRM, данные не сохранены';
|
||
|
||
$logstring = date("Y-m-d H:i:s").' '.json_encode($_REQUEST);
|
||
file_put_contents('logs/CreateProject.log', $logstring.PHP_EOL, FILE_APPEND);
|
||
|
||
if(empty($contactid) or empty($offenderid)){
|
||
$logstring = date("Y-m-d H:i:s").' Не указано одно из обязательных полей: id клиента-физлица или id контрагента-обидчика';
|
||
file_put_contents('logs/CreateProject.log', $logstring.PHP_EOL, FILE_APPEND);
|
||
throw new WebServiceException(WebServiceErrorCode::$INVALIDID, "Не указаны обязательные поля");
|
||
}
|
||
|
||
global $adb, $current_user;
|
||
|
||
$query = "select c.lastname
|
||
from vtiger_contactdetails c
|
||
left join vtiger_crmentity e on e.crmid = c.contactid
|
||
where e.deleted = 0 and c.contactid = ?
|
||
limit 1";
|
||
$result = $adb->pquery($query, array($contactid));
|
||
$name = $adb->query_result($result, 0, 'lastname'); // Первая часть названия Проекта - фамилия терпилы
|
||
|
||
$query = "select a.accountname
|
||
from vtiger_account a
|
||
left join vtiger_crmentity e on e.crmid = a.accountid
|
||
where e.deleted = 0 and a.accountid = ?
|
||
limit 1";
|
||
$result = $adb->pquery($query, array($offenderid));
|
||
$name .= ' '.$adb->query_result($result, 0, 'accountname'); // Вторая часть названия Проекта - название злодея
|
||
|
||
// Основные поля модуля Проекты
|
||
$params = array (
|
||
'projectname' => $name,
|
||
'linktoaccountscontacts' => '12x'.$contactid,
|
||
'cf_2274' => '11x'.$offenderid,
|
||
'projectstatus' => 'модерация',
|
||
'projecttype' => 'Претензионно - исковая работа',
|
||
'cf_2206' => $sms,
|
||
'cf_2210' => $ip,
|
||
'cf_2212' => $source,
|
||
'cf_2214' => $region,
|
||
'cf_2208' => $formid,
|
||
'cf_1830' => $category,
|
||
'cf_1469' => $direction,
|
||
'assigned_user_id' => vtws_getWebserviceEntityId('Users', $current_user->id)
|
||
);
|
||
if (!empty($agentid)) {
|
||
$params['cf_2276'] = '11x'.$agentid;
|
||
}
|
||
// Блок с условиями договора
|
||
$params['cf_1191'] = $agrprice;
|
||
$params['cf_1189'] = $subject;
|
||
$params['cf_1203'] = $agrdate;
|
||
$params['cf_1839'] = $startdate;
|
||
$params['cf_1841'] = $finishdate;
|
||
$params['cf_1207'] = $loss;
|
||
$params['cf_1479'] = $servicecost;
|
||
$params['cf_1227'] = $progress;
|
||
$params['cf_1231'] = $country;
|
||
$params['cf_1239'] = $hotel;
|
||
$params['cf_1566'] = $transport;
|
||
$params['cf_1564'] = $insurance;
|
||
$params['cf_1249'] = $other;
|
||
$params['description'] = $description;
|
||
|
||
// Блок про претензионный порядок
|
||
$params['cf_1471'] = $independently;
|
||
$params['cf_1473'] = $claimdate;
|
||
$params['cf_1475'] = $returned;
|
||
|
||
|
||
$logstring = date('Y-m-d H:i:s').' Массив для создания Контакта: '.json_encode($params).PHP_EOL;
|
||
file_put_contents('logs/CreateProject.log', $logstring, FILE_APPEND);
|
||
try {
|
||
$project = vtws_create('Project', $params, $current_user);
|
||
$output = substr($project['id'], 3);
|
||
$logstring = date('Y-m-d H:i:s').' создан Проект с id '.$output.PHP_EOL;
|
||
file_put_contents('logs/CreateProject.log', $logstring, FILE_APPEND);
|
||
} catch (WebServiceException $ex) {
|
||
$logstring = date('Y-m-d H:i:s').' '.$ex->getMessage().PHP_EOL;
|
||
file_put_contents('logs/CreateProject.log', $logstring, FILE_APPEND);
|
||
}
|
||
|
||
return $output;
|
||
} |