- 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.
82 lines
3.5 KiB
PHP
82 lines
3.5 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 'include/Webservices/Revise.php';
|
||
require_once 'includes/Loader.php';
|
||
vimport ('includes.runtime.Globals');
|
||
vimport ('includes.runtime.BaseModel');
|
||
vimport ('includes.runtime.LanguageHandler');
|
||
|
||
function vtws_CreateAccount($accountname, $address, $email, $website, $phone, $inn, $ogrn, $user = false) {
|
||
|
||
$logstring = date("Y-m-d H:i:s").' '.json_encode($_REQUEST);
|
||
file_put_contents('logs/CreateAccount.log', $logstring.PHP_EOL, FILE_APPEND);
|
||
|
||
if(empty($accountname) or empty($inn) or empty($ogrn)){
|
||
$logstring = date("Y-m-d H:i:s").' Не указано одно из обязательных полей: Наименование контрагента, ИНН или ОГРН';
|
||
file_put_contents('logs/CreateAccount.log', $logstring.PHP_EOL, FILE_APPEND);
|
||
throw new WebServiceException(WebServiceErrorCode::$INVALIDID, "Не заполнены обязательные поля");
|
||
}
|
||
|
||
$output = 'Внутрення ошибка CRM, данные не сохранены';
|
||
|
||
$params = array (
|
||
'accountname' => $accountname,
|
||
'bill_street' => $address,
|
||
'email1' => $email,
|
||
'website' => $website,
|
||
'phone' => $phone,
|
||
'inn' => $inn,
|
||
'cf_1951' => $ogrn
|
||
);
|
||
|
||
global $adb, $current_user;
|
||
|
||
$query = "select a.accountid
|
||
from vtiger_account a
|
||
left join vtiger_crmentity e on e.crmid = a.accountid
|
||
where e.deleted = 0 and a.inn = ?
|
||
limit 1";
|
||
$result = $adb->pquery($query, array($inn));
|
||
if ($adb->num_rows($result) > 0) {
|
||
//$params['id'] = '11x'.$adb->query_result($result, 0, 'accountid');
|
||
$output = $adb->query_result($result, 0, 'accountid');
|
||
$logstring = date('Y-m-d H:i:s').' Найден контрагент с id = '.$output.', просто вернем его наружу'.PHP_EOL;
|
||
file_put_contents('logs/CreateAccount.log', $logstring, FILE_APPEND);
|
||
/*
|
||
try {
|
||
$account = vtws_revise($params, $current_user);
|
||
$output = substr($account['id'], 3);
|
||
$logstring = date('Y-m-d H:i:s').' обновлен Контрагент с id '.$output.PHP_EOL;
|
||
file_put_contents('logs/CreateAccount.log', $logstring, FILE_APPEND);
|
||
} catch (WebServiceException $ex) {
|
||
$logstring = date('Y-m-d H:i:s').' '.$ex->getMessage().PHP_EOL;
|
||
file_put_contents('logs/CreateAccount.log', $logstring, FILE_APPEND);
|
||
}
|
||
*/
|
||
} else {
|
||
$params['assigned_user_id'] = vtws_getWebserviceEntityId('Users', $user->id);
|
||
$logstring = date('Y-m-d H:i:s').' Массив для создания Контрагента: '.json_encode($params).PHP_EOL;
|
||
file_put_contents('logs/CreateAccount.log', $logstring, FILE_APPEND);
|
||
|
||
try {
|
||
$account = vtws_create('Accounts', $params, $user);
|
||
$output = substr($account['id'], 3);
|
||
$logstring = date('Y-m-d H:i:s').' создан Контрагент с id '.$output.PHP_EOL;
|
||
file_put_contents('logs/CreateAccount.log', $logstring, FILE_APPEND);
|
||
} catch (WebServiceException $ex) {
|
||
$logstring = date('Y-m-d H:i:s').' '.$ex->getMessage().PHP_EOL;
|
||
file_put_contents('logs/CreateAccount.log', $logstring, FILE_APPEND);
|
||
}
|
||
}
|
||
|
||
return $output;
|
||
} |