From 5717ef990da27331202a3a11c23cb150510adb7f Mon Sep 17 00:00:00 2001 From: mac Date: Mon, 6 Jul 2026 11:44:05 +0300 Subject: [PATCH] Actual prod --- engine/classes/Requisitions.php | 16 ++++++++++++++-- js/crm.js | 12 ------------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/engine/classes/Requisitions.php b/engine/classes/Requisitions.php index 53c44f7..0e89539 100644 --- a/engine/classes/Requisitions.php +++ b/engine/classes/Requisitions.php @@ -4974,8 +4974,20 @@ class Requisitions{ } if ($dealId) { - $this->db->query("UPDATE user_client_events SET calendar_view = 1 WHERE deal_id = $dealId AND calendar_view = 0"); - $this->db->query("UPDATE user_object_events SET calendar_view = 1 WHERE deal_id = $dealId AND calendar_view = 0"); + $this->db->query("UPDATE user_client_events SET calendar_view = 1 WHERE deal_id = $dealId"); + $this->db->query("UPDATE user_object_events SET calendar_view = 1 WHERE deal_id = $dealId"); + + // Обновляем стоимость и комиссию сделки если переданы + $dealUpdateParts = []; + if (isset($post['summa']) && is_numeric($post['summa']) && intval($post['summa']) > 0) { + $dealUpdateParts[] = "contract_price = " . intval($post['summa']); + } + if (isset($post['commission']) && is_numeric($post['commission']) && intval($post['commission']) > 0) { + $dealUpdateParts[] = "total_commission = " . intval($post['commission']); + } + if (!empty($dealUpdateParts)) { + $this->db->query("UPDATE deals SET " . implode(', ', $dealUpdateParts) . " WHERE id = $dealId"); + } } } diff --git a/js/crm.js b/js/crm.js index 6d154e5..779b953 100644 --- a/js/crm.js +++ b/js/crm.js @@ -6294,18 +6294,6 @@ $(document).ready(function() { param.summa = (factPrice !== '' && !isNaN(parseInt(factPrice))) ? parseInt(factPrice) : (window.dealCloseData.contract_price || 0); param.commission = (factCommission !== '' && !isNaN(parseInt(factCommission))) ? parseInt(factCommission) : (window.dealCloseData.total_commission || 0); param.datazakl = Date.parse(dataZZ); - - var factPayload = {}; - if (factPrice !== '' && !isNaN(parseInt(factPrice))) factPayload.contract_price = parseInt(factPrice) || 0; - if (factCommission !== '' && !isNaN(parseInt(factCommission))) factPayload.total_commission = parseInt(factCommission) || 0; - if (Object.keys(factPayload).length > 0) { - $.ajax({ - url: '/deal/index.php?path=deals/' + window.dealCloseData.id, - type: 'PUT', - contentType: 'application/json', - data: JSON.stringify(factPayload) - }); - } } else { if (isNaN(parseInt($('#summa_sdelki').val()))) { alert("Введите сумму сделки");