From a8612f64a41aa5e6548e40d2defbfdd779f5a080 Mon Sep 17 00:00:00 2001 From: amazuecos Date: Wed, 6 Nov 2024 19:56:20 +0100 Subject: [PATCH] fix : notification clientes add where chat_department_id is not NULL --- ci4/app/Models/Chat/ChatModel.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ci4/app/Models/Chat/ChatModel.php b/ci4/app/Models/Chat/ChatModel.php index 2c802ad0..29367da0 100644 --- a/ci4/app/Models/Chat/ChatModel.php +++ b/ci4/app/Models/Chat/ChatModel.php @@ -208,7 +208,8 @@ class ChatModel extends Model "pedidos.id as title" ]) ->join("chat_departments","chat_departments.id = chats.chat_department_id","left") - ->join("pedidos","pedidos.id = chats.pedido_id","left"); + ->join("pedidos","pedidos.id = chats.pedido_id","left") + ->where('chats.chat_department_id is NOT NULL', NULL, FALSE); if(count($pedidos)>0){ $q->whereIn("pedidos.id",$pedidos); }else{ @@ -240,7 +241,9 @@ class ChatModel extends Model "facturas.numero as title" ]) ->join("chat_departments","chat_departments.id = chats.chat_department_id","left") - ->join("facturas","facturas.id = chats.factura_id","left"); + ->join("facturas","facturas.id = chats.factura_id","left") + ->where('chats.chat_department_id is NOT NULL', NULL, FALSE); + if(count($facturas)>0){ $q->whereIn("facturas.id",$facturas); }else{ @@ -272,7 +275,9 @@ class ChatModel extends Model "presupuestos.titulo as title" ]) ->join("chat_departments","chat_departments.id = chats.chat_department_id","left") - ->join("presupuestos","presupuestos.id = chats.presupuesto_id","left"); + ->join("presupuestos","presupuestos.id = chats.presupuesto_id","left") + ->where('chats.chat_department_id is NOT NULL', NULL, FALSE); + if(count($presupuestos)>0){ $q->whereIn("presupuestos.id",$presupuestos); }else{