- 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.
119 lines
4.0 KiB
PHP
119 lines
4.0 KiB
PHP
<?php
|
|
/* * *******************************************************************************
|
|
* The content of this file is subject to the ITS4YouEmailMarketing license.
|
|
* ("License"); You may not use this file except in compliance with the License
|
|
* The Initial Developer of the Original Code is IT-Solutions4You s.r.o.
|
|
* Portions created by IT-Solutions4You s.r.o. are Copyright(C) IT-Solutions4You s.r.o.
|
|
* All Rights Reserved.
|
|
* ****************************************************************************** */
|
|
|
|
class ITS4YouEmailMarketing_TemplateRecords_Model extends Vtiger_Base_Model
|
|
{
|
|
/**
|
|
* @param int $record
|
|
* @return ITS4YouEmailMarketing_TemplateRecords_Model
|
|
* @throws Exception
|
|
*/
|
|
public static function getInstanceById($record)
|
|
{
|
|
$self = new self();
|
|
$self->set('records_id', $record);
|
|
$self->retrieveData();
|
|
|
|
return $self;
|
|
}
|
|
|
|
/**
|
|
* @param array $values
|
|
* @return ITS4YouEmailMarketing_TemplateRecords_Model
|
|
* @throws Exception
|
|
*/
|
|
public static function getInstanceFromArray($values)
|
|
{
|
|
$self = new self();
|
|
$self->setData($values);
|
|
$self->retrieveData();
|
|
|
|
return $self;
|
|
}
|
|
|
|
/**
|
|
* @throws Exception
|
|
*/
|
|
public function retrieveData()
|
|
{
|
|
if(!$this->isEmpty('records_id')) {
|
|
$query = 'SELECT * FROM its4you_emailmarketing_records WHERE records_id=?';
|
|
$params = array($this->get('records_id'));
|
|
} elseif(!$this->isEmpty('emailmarketingid') && !$this->isEmpty('source_record')) {
|
|
$query = 'SELECT * FROM its4you_emailmarketing_records WHERE emailmarketingid=? AND source_record=?';
|
|
$params = array($this->get('emailmarketingid'), $this->get('source_record'));
|
|
}
|
|
|
|
if(isset($query, $params)) {
|
|
$adb = PearDatabase::getInstance();
|
|
$result = $adb->pquery($query, $params);
|
|
$data = $adb->query_result_rowdata($result);
|
|
|
|
if(!empty($data)) {
|
|
$this->setData($data);
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @throws Exception
|
|
*/
|
|
public function save()
|
|
{
|
|
$params = [
|
|
'emailmarketingid' => $this->get('emailmarketingid'),
|
|
'source_module' => $this->get('source_module'),
|
|
'source_record' => $this->get('source_record'),
|
|
];
|
|
|
|
if ($this->isEmpty('records_id')) {
|
|
$query = 'INSERT INTO its4you_emailmarketing_records (' . implode(',', array_keys($params)). ') VALUES (' . generateQuestionMarks($params) .')';
|
|
} else {
|
|
$query = 'UPDATE its4you_emailmarketing_records SET ' . implode('=?,', array_keys($params)). '=? WHERE records_id = ?';
|
|
$params['records_id'] = $this->get('records_id');
|
|
}
|
|
|
|
$adb = PearDatabase::getInstance();
|
|
$adb->pquery($query, $params);
|
|
$this->retrieveData();
|
|
}
|
|
|
|
public function delete()
|
|
{
|
|
if(!$this->isEmpty('records_id')) {
|
|
$adb = PearDatabase::getInstance();
|
|
$adb->pquery('DELETE FROM its4you_emailmarketing_records WHERE records_id=?', [$this->get('records_id')]);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @param int $record
|
|
* @return array
|
|
* @throws Exception
|
|
*/
|
|
public static function getRecords($record) {
|
|
$adb = PearDatabase::getInstance();
|
|
$result = $adb->pquery('SELECT records_id FROM its4you_emailmarketing_records WHERE emailmarketingid=?', [$record]);
|
|
$records = [];
|
|
|
|
while($row = $adb->fetchByAssoc($result)) {
|
|
$record = self::getInstanceById($row['records_id']);
|
|
$records[$record->get('source_module')][] = $record;
|
|
}
|
|
|
|
return $records;
|
|
}
|
|
|
|
protected $sourceRecord;
|
|
|
|
public function getSourceRecord()
|
|
{
|
|
return Vtiger_Record_Model::getInstanceById($this->get('source_record'), $this->get('source_module'));
|
|
}
|
|
} |