From 43bdcb29a99266d0d668ff2a5d2c0f6106bd2686 Mon Sep 17 00:00:00 2001 From: mac Date: Wed, 15 Jul 2026 15:14:48 +0300 Subject: [PATCH] Exclude deal --- api/v2/app/src/controllers/CommonController.php | 2 +- api/v2/app/src/controllers/RequisitionsController.php | 2 +- engine/classes/MaxClass.php | 2 +- engine/classes/Telegram.php | 2 +- engine/classes/User.php | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/api/v2/app/src/controllers/CommonController.php b/api/v2/app/src/controllers/CommonController.php index 9a5a4aa..a690d5a 100755 --- a/api/v2/app/src/controllers/CommonController.php +++ b/api/v2/app/src/controllers/CommonController.php @@ -4211,7 +4211,7 @@ class CommonController extends ApiController $sql = "UPDATE user_client_events SET user_id = $who_work WHERE client_id = $client_id AND type != 'step' AND type != 'file'"; if ($requisition_id > 0) - $sql = "UPDATE user_client_events SET user_id = $who_work WHERE req_id = $requisition_id AND type != 'step' AND type != 'file'"; + $sql = "UPDATE user_client_events SET user_id = $who_work WHERE req_id = $requisition_id AND type != 'step' AND type != 'file' AND (type != 'deal' OR deal_id = 0 OR deal_id IS NULL)"; if (!mysql_query($sql)) { $error = true; diff --git a/api/v2/app/src/controllers/RequisitionsController.php b/api/v2/app/src/controllers/RequisitionsController.php index bdb76ec..edc5abf 100644 --- a/api/v2/app/src/controllers/RequisitionsController.php +++ b/api/v2/app/src/controllers/RequisitionsController.php @@ -1431,7 +1431,7 @@ class RequisitionsController extends ApiController } if ($confirm == 1) { - $sqlup = "UPDATE user_client_events SET user_id=".$new_who_work." WHERE req_id=".$row['id']." and `type` != 'step' and `type` != 'file'"; + $sqlup = "UPDATE user_client_events SET user_id=".$new_who_work." WHERE req_id=".$row['id']." and type NOT IN ('step', 'file') AND NOT (type = 'deal' AND deal_id > 0)"; if (!$pdo->query($sqlup)) { $error = true; $errors[] = $pdo->db->error(); diff --git a/engine/classes/MaxClass.php b/engine/classes/MaxClass.php index c3e6f8f..bcb866c 100644 --- a/engine/classes/MaxClass.php +++ b/engine/classes/MaxClass.php @@ -516,7 +516,7 @@ class MaxClass { $this->db->query("INSERT INTO clients_funnel_step (req_id) VALUES ({$field_val})"); } } - $sql = "UPDATE user_client_events SET user_id={$user_id} WHERE req_id={$field_val} and type != 'step' and type != 'file'"; + $sql = "UPDATE user_client_events SET user_id={$user_id} WHERE req_id={$field_val} and type != 'step' and type != 'file' and (type != 'deal' or deal_id = 0 or deal_id IS NULL)"; $this->db->query($sql); $sql = "UPDATE `events_clients` SET `read` = 1, date_update='".date('Y-m-d H:i:s')."' WHERE req_id = {$field_val} AND event IN ('transmitted', 'notadopted')"; $this->db->query($sql); diff --git a/engine/classes/Telegram.php b/engine/classes/Telegram.php index fdc522a..8509e3d 100644 --- a/engine/classes/Telegram.php +++ b/engine/classes/Telegram.php @@ -418,7 +418,7 @@ class Telegram { $this->db->query("INSERT INTO clients_funnel_step (req_id) VALUES ({$field_val})"); } } - $sql = "UPDATE user_client_events SET user_id={$user_id} WHERE req_id={$field_val} and type != 'step' and type != 'file'"; + $sql = "UPDATE user_client_events SET user_id={$user_id} WHERE req_id={$field_val} and type != 'step' and type != 'file' and (type != 'deal' or deal_id = 0 or deal_id IS NULL)"; $this->db->query($sql); $sql = "UPDATE `events_clients` SET `read` = 1, date_update='".date('Y-m-d H:i:s')."' WHERE req_id = {$field_val} AND event IN ('transmitted', 'notadopted')"; $this->db->query($sql); diff --git a/engine/classes/User.php b/engine/classes/User.php index daf95f1..518fa6c 100644 --- a/engine/classes/User.php +++ b/engine/classes/User.php @@ -683,7 +683,7 @@ class User { $rez=mysql_query($sql); // перенос всех событий тому, кому отдаем заявки - $sql="UPDATE user_client_events SET user_id=$newWhoWorkReq WHERE user_id=$id AND req_id>0"; + $sql="UPDATE user_client_events SET user_id=$newWhoWorkReq WHERE user_id=$id AND req_id>0 AND (type != 'deal' or deal_id = 0 or deal_id IS NULL)"; $rez=mysql_query($sql);