Add deal_id in user_client_events

This commit is contained in:
mac 2026-06-22 08:33:07 +03:00
parent d490bcade9
commit c7d8320e12
3 changed files with 6 additions and 3 deletions

View File

@ -2322,7 +2322,7 @@ if($request == 'saveOpenPrevStep'){
mysql_query("UPDATE requisitions SET deal_id = NULL WHERE id IN (" . implode(',', $linkedReqs) . ")");
}
// Запись в историю
mysql_query("INSERT INTO user_client_events (user_id, req_id, type, name, comment, create_date) VALUES ({$userId}, {$reqId}, 'deal', 'Отмена сделки', 'Сделка отменена при возврате на предыдущий этап', NOW())");
//mysql_query("INSERT INTO user_client_events (user_id, req_id, deal_id, type, name, comment, create_date) VALUES ({$userId}, {$reqId}, {$dealId}, 'deal', 'Отмена сделки', 'Сделка отменена при возврате на предыдущий этап', NOW())");
}
}

View File

@ -1086,7 +1086,10 @@ ORDER BY date_sort ASC";
<div class="chat-message <?=($event['cancel']==1) ? 'cancel' : ''?> deal">
<?php
$deal_id_for_edit = null;
if (!empty($event['req_id'])) {
// Если в событии есть deal_id — используем его напрямую (включая отменённые сделки)
if (!empty($event['deal_id'])) {
$deal_id_for_edit = intval($event['deal_id']);
} elseif (!empty($event['req_id'])) {
$sql_deal = "SELECT id FROM deals WHERE (side_one_requisition_id = " . intval($event['req_id']) . " OR side_two_requisition_id = " . intval($event['req_id']) . ") AND status != 2 LIMIT 1";
$rez_deal = mysql_query($sql_deal);
if ($rez_deal && mysql_num_rows($rez_deal) > 0) {

View File

@ -4880,7 +4880,7 @@
if (!$otherReqsOpen) {
$comment .= " Все заявки сделки закрыты. Сделка завершена.";
}
$this->db->query("INSERT INTO user_client_events (user_id, req_id, type, name, comment, create_date) VALUES ($user_id, $id, 'deal', 'Закрытие сделки', '".addslashes($comment)."', NOW())");
$this->db->query("INSERT INTO user_client_events (user_id, req_id, deal_id, type, name, comment, create_date) VALUES ($user_id, $id, $dealId, 'deal', 'Закрытие сделки', '".addslashes($comment)."', NOW())");
}
}