- 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.
88 lines
4.7 KiB
PHP
88 lines
4.7 KiB
PHP
<?php
|
||
/* +**********************************************************************************
|
||
* The contents of this file are subject to the vtiger CRM Public License Version 1.1
|
||
* ("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.
|
||
* ***********************************************************************************/
|
||
|
||
function vtws_gethotel($id, $user = false) {
|
||
$logstring = date('Y-m-d H:i:s').' - запрос данных по отелю '.$id.$to.PHP_EOL;
|
||
file_put_contents('logs/GetHotel.log', $logstring, FILE_APPEND);
|
||
|
||
global $adb;
|
||
|
||
if(empty($id)){
|
||
throw new WebServiceException(WebServiceErrorCode::$INVALIDID,"Не указан id отеля");
|
||
}
|
||
|
||
$query = 'select a.tickersymbol, a.accountname, a.email1, a.phone, a.inn, cf.cf_1951 as ogrn, a.kpp, a.website, ba.bill_state, ba.bill_city, ba.bill_street, sa.ship_state, sa.ship_city,
|
||
sa.ship_street, cf.cf_2308 as stars, cf.cf_2306 as `type`, cf.cf_2310 as decnum, cf.cf_2312 as decdate, cf.cf_2314 as certnum, cf.cf_2316 as certdate, cf.cf_2318 as expire,
|
||
cf.cf_2304 as regnum, cf.cf_2425 as rating
|
||
from vtiger_account a
|
||
left join vtiger_crmentity e on e.crmid = a.accountid
|
||
left join vtiger_accountshipads sa on sa.accountaddressid = a.accountid
|
||
left join vtiger_accountbillads ba on ba.accountaddressid = a.accountid
|
||
left join vtiger_accountscf cf on cf.accountid = a.accountid
|
||
where e.deleted = 0 and a.accountid = '.$id;
|
||
$result = $adb->pquery($query);
|
||
|
||
if ($adb->num_rows($result) == 0) {
|
||
$logstring = date('Y-m-d H:i:s').' - отель с id = '.$id.' не найден'.PHP_EOL;
|
||
file_put_contents('logs/GetHotel.log', $logstring, FILE_APPEND);
|
||
$output = null;
|
||
} else {
|
||
$logstring = date('Y-m-d H:i:s').' - найден отель '.$adb->query_result($result, 0, 'tickersymbol').PHP_EOL;
|
||
file_put_contents('logs/GetHotel.log', $logstring, FILE_APPEND);
|
||
|
||
$output = [];
|
||
$output['name'] = $adb->query_result($result, 0, 'tickersymbol');
|
||
$output['legal'] = $adb->query_result($result, 0, 'accountname');
|
||
$output['email'] = $adb->query_result($result, 0, 'email1');
|
||
$output['phone'] = $adb->query_result($result, 0, 'phone');
|
||
$output['inn'] = $adb->query_result($result, 0, 'inn');
|
||
$output['ogrn'] = $adb->query_result($result, 0, 'ogrn');
|
||
$output['kpp'] = $adb->query_result($result, 0, 'kpp');
|
||
$output['website'] = $adb->query_result($result, 0, 'website');
|
||
$output['bill_state'] = $adb->query_result($result, 0, 'bill_state');
|
||
$output['bill_city'] = $adb->query_result($result, 0, 'bill_city');
|
||
$output['bill_street'] = $adb->query_result($result, 0, 'bill_street');
|
||
$output['ship_state'] = $adb->query_result($result, 0, 'ship_state');
|
||
$output['ship_city'] = $adb->query_result($result, 0, 'ship_city');
|
||
$output['ship_street'] = $adb->query_result($result, 0, 'ship_street');
|
||
$output['stars'] = $adb->query_result($result, 0, 'stars');
|
||
$output['type'] = explode(' |##| ', $adb->query_result($result, 0, 'type'));
|
||
$output['decnum'] = $adb->query_result($result, 0, 'decnum');
|
||
$output['decdate'] = $adb->query_result($result, 0, 'decdate');
|
||
$output['certnum'] = $adb->query_result($result, 0, 'certnum');
|
||
$output['certdate'] = $adb->query_result($result, 0, 'certdate');
|
||
$output['expire'] = $adb->query_result($result, 0, 'expire');
|
||
$output['regnum'] = $adb->query_result($result, 0, 'regnum');
|
||
$output['rating'] = $adb->query_result($result, 0, 'rating');
|
||
$output['images'] = [];
|
||
|
||
$query = 'select n.title, a.path, a.storedname, s.attachmentsid
|
||
from vtiger_senotesrel r
|
||
left join vtiger_notes n on n.notesid = r.notesid
|
||
left join vtiger_seattachmentsrel s on s.crmid = r.notesid
|
||
left join vtiger_attachments a on a.attachmentsid = s.attachmentsid
|
||
where (n.filetype = "image/png" or n.filetype = "image/jpeg") and n.folderid = 6 and r.crmid = '.$id;
|
||
// n.folderid = 6 - это папка viewhotel, в которой лежат официальные фотки владельцев отелей
|
||
$images = $adb->pquery($query);
|
||
|
||
if ($adb->num_rows($images) > 0) {
|
||
for ($i=0; $i<$adb->num_rows($images); $i++) {
|
||
$output['images'][$i]['title'] = $adb->query_result($images, $i, 'title');
|
||
$output['images'][$i]['path'] = $adb->query_result($images, $i, 'path').$adb->query_result($images, $i, 'attachmentsid').'_'.$adb->query_result($images, $i, 'storedname');
|
||
}
|
||
}
|
||
|
||
|
||
$logstring = date('Y-m-d H:i:s').' - поиск картинок завершен'.PHP_EOL;
|
||
file_put_contents('logs/GetHotel.log', $logstring, FILE_APPEND);
|
||
}
|
||
|
||
return $output;
|
||
} |