Files
crm.clientright.ru/task.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

98 lines
3.0 KiB
PHP

<?php
require_once(realpath(dirname(__FILE__).'/../autoload_wf.php'));
class WfTaskPLZService extends \Workflow\Task
{
protected $_internalConfiguration = true;
protected $_configFields = array(
"WebService" => array(
array(
"key" => "username",
"label" => "geonames.org Username<br/><a href='http://www.geonames.org/login'>http://www.geonames.org/login</a>",
"type" => "templatefield"
),
array(
"key" => "token",
"label" => "geonames.org Token to access API",
"type" => "templatefield"
),
),
"INPUT" => array(
array(
"key" => "input_plz",
"label" => "Postalcode",
"type" => "templatefield"
),
array(
"key" => "input_country",
"label" => "Country:<br><span style='font-size:11px;font-style:italic;'>(if available)</span>",
"type" => "templatefield"
)
),
"OUTPUT" => array(
array(
"key" => "output_city",
"label" => "City",
"type" => "envvar"
),
array(
"key" => "output_state",
"label" => "State",
"type" => "envvar"
),
array(
"key" => "output_country",
"label" => "Country",
"type" => "envvar"
),
)
);
public function handleTask(&$context) {
/* Insert here source code to execute the task */
set_include_path($this->getAdditionalPath('plzservice').PATH_SEPARATOR.get_include_path());
require_once 'Services/GeoNames.php';
$wsUsername = $this->get("username", $context);
$wsToken = $this->get("token", $context);
$geo = new Services_GeoNames($wsUsername, $wsToken);
$postalcode = $this->get("input_plz", $context);
$country = $this->get("input_country", $context);
if(empty($country) || strlen($country) > 2) {
$country = "DE";
}
try {
$return = $geo->postalCodeLookup(array("postalcode" => $postalcode, "country" => $country));
} catch (\Exception $exp) {
return 'yes';
}
if(count($return) == 0) {
$state = "";
$country = "";
$city = "";
} else {
$return = $return[0];
$state = $return->adminName1;
$country = $return->countryCode;
$city = $return->placeName;
}
$fieldCity = $this->get("output_city");
$fieldState = $this->get("output_state");
$fieldCountry = $this->get("output_country");
if(!empty($fieldCity)) $context->setEnvironment($fieldCity, $city);
if(!empty($fieldState)) $context->setEnvironment($fieldState, $state);
if(!empty($fieldCountry)) $context->setEnvironment($fieldCountry, $country);
return "yes";
}
}