From 0e9ebcbedd207ab1c41d646bc858f6eb68089faa Mon Sep 17 00:00:00 2001 From: bruno Date: Sun, 28 Jul 2024 11:12:22 -0400 Subject: [PATCH] colocar o org_id nas query do ramais.php --- admin/funcoes.php | 2 +- admin/ramais.php | 16 ++++++++-------- menuUser.php | 11 ++++++++--- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/admin/funcoes.php b/admin/funcoes.php index 3e4e001f..7666dd73 100644 --- a/admin/funcoes.php +++ b/admin/funcoes.php @@ -111,7 +111,7 @@ function Ajusta_tabelas($opcao, $acao, $conexao, $reload = true, $reloadUra = tr $reloadDialPlan = $dados[4] === 'Y' ? $reloadUra : false; if (($table != 'NOTABLE') && ($opcao)) { - $query = sprintf("update %s set %s = '', %s = '' where %s = %s and org_id = $org_id and %s like %s", $table, $fOpcao, $fAcao, $fOpcao, QuotedStr($opcao), $org_id, $fAcao, QuotedStr($acao)); + $query = sprintf("update %s set %s = '', %s = '' where %s = %s and org_id = %d and %s like %s", $table, $fOpcao, $fAcao, $fOpcao, QuotedStr($opcao), $org_id, $fAcao, QuotedStr($acao)); //WriteLog($query . "\n", $path); if (!pg_query($conexao, $query)) { GeraExcept(sprintf("Comando: [%s] Erro: %s\n", $query, GetLasterror())); diff --git a/admin/ramais.php b/admin/ramais.php index 279153bc..7372c5f9 100644 --- a/admin/ramais.php +++ b/admin/ramais.php @@ -16,13 +16,13 @@ function GetQueryRamal( $compl = "" ){ /* complemento do filtro em sql para pesquisa específica de uma ramal, será inserido na query os filtros */ -function SetFiltroSQL($filtro){ +function SetFiltroSQL($filtro, $org_id){ global $dbcon; $tpParcial = 0; // Procurar ramais específicos, campo procurar no site if (strpos($filtro, ',')) { $tpParcial = 1; } elseif (strpos($filtro, '-')) { - $sql = "select count(*) from pbx_sip_ramais where callerid ilike '%$filtro%'"; + $sql = "select count(*) from pbx_sip_ramais where callerid ilike '%$filtro%' and org_id = $org_id"; $result = pg_query($dbcon, $sql); $param = pg_fetch_row($result); if ($param[0] > 0) { @@ -31,9 +31,9 @@ function SetFiltroSQL($filtro){ $tpParcial = 2; } } - + if ((!empty($filtro)) && ($tpParcial == 0)) { - $compl = " where (nome ilike '%$filtro%' or callerid ilike '%$filtro%')"; + $compl = " where (nome ilike '%$filtro%' or callerid ilike '%$filtro%' and org_id = $org_id)"; } elseif ((!empty($filtro)) && ($tpParcial == 1)) { $params = explode(",", $filtro); $compl = ""; @@ -41,7 +41,7 @@ function SetFiltroSQL($filtro){ foreach ($params as $param) { $dado .= empty($dado) ? "'$param'" : ",'$param'"; } - $compl = " where (nome in($dado) or callerid in($dado))"; + $compl = " where (nome in($dado) or callerid in($dado) and org_id = $org_id)"; } elseif ((!empty($filtro)) && ($tpParcial == 2)) { $params = explode("-", $filtro); $compl = ""; @@ -59,7 +59,7 @@ function SetFiltroSQL($filtro){ } else { $fim1 = $fim; } - $compl = " where nome between '$ini' and '$fim' and ramal between '$ini1' and '$fim1'"; + $compl = " where nome between '$ini' and '$fim' and ramal between '$ini1' and '$fim1' and org_id = $org_id"; } else { $compl = ""; } @@ -72,7 +72,7 @@ function GetRamalFiltro( $idProg, $filtro ){ $org_id = $_SESSION['SSEmpresaPadrao']; global $dbcon; - $compl = SetFiltroSQL( $filtro ); + $compl = SetFiltroSQL( $filtro, $org_id ); $query = GetQueryRamal( $compl ); @@ -150,7 +150,7 @@ if(empty($filtro)){ $ramais = GetALLRamal( $idProg, $filtro ); } else { - $result = GetRamalFiltro($idProg, $filtro); + $ramais = GetRamalFiltro($idProg, $filtro); } ?> diff --git a/menuUser.php b/menuUser.php index 70500836..7db839c2 100644 --- a/menuUser.php +++ b/menuUser.php @@ -1,13 +1,15 @@ assign('conteudo', $conteudo); + */ ob_end_clean(); } ?>