Files
crm.clientright.ru/modules/Project/tasks/SendReminder.service
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

54 lines
2.7 KiB
Desktop File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
include_once 'modules/Users/Users.php';
require_once 'include/Webservices/Utils.php';
require_once 'include/utils/WhatsApp.php';
require_once 'include/utils/Telegram.php';
require_once 'includes/Loader.php';
vimport ('includes.runtime.Globals');
vimport ('includes.runtime.BaseModel');
vimport ('includes.runtime.LanguageHandler');
require_once 'modules/Emails/mail.php';
global $HELPDESK_SUPPORT_NAME, $HELPDESK_SUPPORT_EMAIL_ID, $adb;
//$logstring = date('Y-m-d H:i:s').' - вошли в планировщик с отправками писем'.PHP_EOL;
//file_put_contents('schSendReminder.log', $logstring, FILE_APPEND);
$query = 'select p.projectname, cf.cf_1847 as link, cf.cf_1845 as starttime, p.linktoaccountscontacts as contactid, c.email, c.firstname
from vtiger_project p
left join vtiger_projectcf cf on cf.projectid = p.projectid
left join vtiger_contactdetails c on c.contactid = p.linktoaccountscontacts
left join vtiger_crmentity e on e.crmid = p.projectid
where e.deleted = 0 and cf.cf_1843 = CURDATE() and cf.cf_1847 is not null and time_to_sec(cf.cf_1845) - time_to_sec(now()) BETWEEN 60 and 1200';
$result = $adb->pquery($query);
if ($adb->num_rows($result) == 0) {
$logstring = date('Y-m-d H:i:s').' - в ближайшие 20 минут нет напоминаний о встречах'.PHP_EOL;
file_put_contents('schSendReminder.log', $logstring, FILE_APPEND);
} else {
$subject = 'У нас скоро видео встреча!';
for ($i == 0; $i < $adb->num_rows($result); $i++) {
$name = $adb->query_result($result, $i, "projectname");
$link = $adb->query_result($result, $i, "link");
$starttime = $adb->query_result($result, $i, "starttime");
$contactid = $adb->query_result($result, $i, "contactid");
$email = $adb->query_result($result, $i, "email");
$firstname = $adb->query_result($result, 0, "firstname");
$body = 'Добрый день, '.$firstname.'.<br><br>';
$body .= 'Напоминаю, что у нас запланирована видеовстреча сегодя в '.$starttime.'<br>';
$body .= 'Вот ссылка для подключения: <a href="'.$link.'">'.$link.'</a>';
$mail_status = send_mail('Contacts', $email, $HELPDESK_SUPPORT_NAME, $HELPDESK_SUPPORT_EMAIL_ID, $subject, $body);
$logstring = date('Y-m-d H:i:s').' - отправка напоминания на '.$email.': '.$mail_status.PHP_EOL;
file_put_contents('schSendReminder.log', $logstring, FILE_APPEND);
}
}
//send_mail($module,$to_email,$from_name,$from_email,$subject,$contents,$cc='',$bcc='',$attachment='',$emailid='',$logo='', $useGivenFromEmailAddress=false,$useSignature = 'Yes',$inReplyToMessageId='')