diff --git a/ci4/app/Models/Chat/ChatModel.php b/ci4/app/Models/Chat/ChatModel.php index ddc06bcc..88bbad19 100644 --- a/ci4/app/Models/Chat/ChatModel.php +++ b/ci4/app/Models/Chat/ChatModel.php @@ -770,7 +770,7 @@ class ChatModel extends Model ->join("users u", "u.id = cm.sender_id", 'left') ->where("chats.presupuesto_id is NOT NULL", NULL, FALSE); - if (auth()->user()->inGroup("admin") == false) { + if (auth()->user()->inGroup("cliente-administrador","cliente")) { $query->where('presupuestos.cliente_id', auth()->user()->cliente_id) ->where("chats.chat_department_id is NOT NULL", NULL, FALSE); } @@ -801,7 +801,7 @@ class ChatModel extends Model ->join("presupuestos", "presupuestos.id = pedidos_linea.presupuesto_id", 'left') ->where("chats.pedido_id is NOT NULL", NULL, FALSE); - if (auth()->user()->inGroup("admin") == false) { + if (auth()->user()->inGroup("cliente-administrador","cliente")) { $query->where('presupuestos.cliente_id', auth()->user()->cliente_id) ->where("chats.chat_department_id is NOT NULL", NULL, FALSE); } @@ -831,12 +831,10 @@ class ChatModel extends Model ->join("facturas", "facturas.id = chats.factura_id", "left") ->where("chats.factura_id is NOT NULL", NULL, FALSE); - if (auth()->user()->inGroup("admin") == false) { - if (auth()->user()->inGroup("admin") == false) { + if (auth()->user()->inGroup("cliente-administrador","cliente")) { $query->where('facturas.cliente_id', auth()->user()->cliente_id) ->where("chats.chat_department_id is NOT NULL", NULL, FALSE); } - } return $query->groupBy('chatMessageId'); } public function createNewDirectChat(string $title, string $message, array $users)