diff --git a/admin/CadGruposAtendimento.php b/admin/CadGruposAtendimento.php index 1c9dffaa..98828981 100644 --- a/admin/CadGruposAtendimento.php +++ b/admin/CadGruposAtendimento.php @@ -90,9 +90,9 @@ $id"; + $query = "select nome from pbx_grupos_atendimento where nome='$nome' and id <> $id and org_id = $org_id"; } else { - $query = "select nome from pbx_grupos_atendimento where nome='$nome'"; + $query = "select nome from pbx_grupos_atendimento where nome='$nome' and org_id = $org_id"; $numero = GetIdGrupoAtendimento($dbcon); } $msg = ''; @@ -112,10 +112,10 @@ $existe = trim($dados['nome']); if ($existe != '') { - $msg = "JA EXISTE UM GRUPO COM O NOME $existe"; + $msg = "JÁ EXISTE UM GRUPO COM O NOME $existe"; } if ($numero > 63) { - $msg = "� PERMITIDO CADASTRAR APENAS 63 GRUPOS"; + $msg = "É PERMITIDO CADASTRAR APENAS 63 GRUPOS"; } if (!empty($msg)) { @@ -137,9 +137,7 @@ while ($row = pg_fetch_row($result)) $ramaisExistentes[] = $row[0]; - $query = "UPDATE pbx_grupos_atendimento - SET nome='$nome' - WHERE id=$id"; + $query = "UPDATE pbx_grupos_atendimento SET nome='$nome' WHERE id=$id AND org_id = $org_id"; pg_query($dbcon, $query); $query = "delete from pbx_grupos_atendimento_ramais where id_grupo=$id and org_id=$org_id"; @@ -149,11 +147,9 @@ for ($i = 0; $i < count($ramais); $i++) { if ($acao == "edita") { - $ramal_grupo = $org_id . $ramais[$i]; - $query = "insert into pbx_grupos_atendimento_ramais (id_grupo,ramal,org_id) values ($id,'$ramal_grupo', $org_id)"; + $query = "insert into pbx_grupos_atendimento_ramais (id_grupo,ramal,org_id) values ($id,'$ramais[$i]', $org_id)"; } else { - $ramal_grupo = $org_id . $ramais[$i]; - $query = "insert into pbx_grupos_atendimento_ramais (id_grupo,ramal,org_id) values ($id_ult,'$ramal_grupo', $org_id)"; + $query = "insert into pbx_grupos_atendimento_ramais (id_grupo,ramal,org_id) values ($id_ult,'$ramais[$i]', $org_id)"; } pg_query($dbcon, $query); } @@ -174,12 +170,12 @@ } if ($acao == "edita") { - $id = $_GET["id"] ?? "0"; - $query = "SELECT * FROM pbx_grupos_atendimento where id=$id"; + $id = $_GET["id"] ?? 0; + $query = "SELECT * FROM pbx_grupos_atendimento where id=$id AND org_id = $org_id"; $result = pg_query($dbcon, $query); } else { $id = 0; - $query = "SELECT * FROM pbx_grupos_atendimento where id is null"; + $query = "SELECT * FROM pbx_grupos_atendimento where id is null and org_id = $org_id"; } $result = pg_query($dbcon, $query); @@ -214,11 +210,12 @@ { LimpaGruposCapturaRamais($dbcon); - $org_id = GetOrganizacao(); + $org_id = $_SESSION['SSEmpresaPadrao']; $query = "SELECT a.ramal FROM pbx_grupos_atendimento_ramais a, pbx_ramais b - WHERE b.nome = a.ramal - AND a.org_id = {$org_id} + WHERE b.nome = a.ramal + AND a.org_id = b.org_id + AND a.org_id = {$org_id} ORDER BY a.ramal, a.id_grupo"; $result = pg_query($dbcon, $query); $ramais = array(); @@ -230,6 +227,8 @@ $query = "SELECT a.id_grupo, a.ramal, b.tipo_ramal as dispositivo FROM pbx_grupos_atendimento_ramais a, pbx_ramais b WHERE b.nome = a.ramal + AND a.org_id = b.org_id + AND a.org_id = {$org_id} AND a.ramal = '$ramalGrupo' ORDER BY a.ramal, a.id_grupo"; $result = pg_query($dbcon, $query); diff --git a/admin/GruposAtendimento.php b/admin/GruposAtendimento.php index e0ca3711..90ef1d91 100644 --- a/admin/GruposAtendimento.php +++ b/admin/GruposAtendimento.php @@ -1,13 +1,13 @@ - --> @@ -159,7 +163,7 @@ window.history.replaceState(null, null, updatedUrl); - + - +
Id Nome A��esAções
N�o foram encontrados registros
Não foram encontrados registros