Browse Source

colocar o org_id nas query do ramais.php

1.9
bruno 2 months ago
parent
commit
0e9ebcbedd
  1. 2
      admin/funcoes.php
  2. 16
      admin/ramais.php
  3. 11
      menuUser.php

2
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()));

16
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);
}
?>

11
menuUser.php

@ -1,13 +1,15 @@
<?php
if ($isPbxRequest) {
ob_start();
ob_start(); /* para iniciar o buffer de saída.
* Qualquer saída gerada após ob_start() será capturada no buffer.
*/
}
$info = array();
if (VerificaPerfilAcesso($dbcon, $idProg, $info)) {
if ($info !== false) {
include($info["arquivo"]);
include($info["arquivo"]);
if ($info["exit"])
exit;
}
@ -18,7 +20,10 @@ else {
}
if ($isPbxRequest) {
$conteudo = ob_get_contents();
$conteudo = ob_get_contents(); /* Use ob_get_contents() para obter o conteúdo capturado.
* Esse conteúdo será inserido no master.tpl
* $smarty->assign('conteudo', $conteudo);
*/
ob_end_clean();
}
?>

Loading…
Cancel
Save