From 5a99d48c7a102203b333b1d484df6e6537d1f112 Mon Sep 17 00:00:00 2001 From: Lucas Awade Date: Thu, 19 Oct 2023 19:40:40 +0000 Subject: [PATCH] correcao empresa cadastros --- .../ServicosChamadas/servicosChamadas.php | 33 +++-- .../classificaAtendimento.php | 29 ++-- .../classificaAtendimento/classificaDac.php | 104 ++++---------- .../classificaDetIns.php | 14 +- .../classificaAtendimento/classificaIns.php | 7 +- cadastros/motivosPausa/motivosPausaInsert.php | 20 +-- cadastros/motivosPausa/motivosPausaSelect.php | 21 +-- contacteFunc.php | 20 +-- include/util/funcoesApl.php | 13 +- projeto/base/sql/versao-1.9.0.sql | 6 + seguranca/grupos/grupoInsert.php | 24 ++-- seguranca/grupos/grupoSelect.php | 19 +-- seguranca/grupos/gruposAudiosRamais.php | 19 +-- seguranca/grupos/gruposUsuario.php | 81 ++++++----- seguranca/licencaUsuarioFixo.php | 41 ++++-- seguranca/perfil/perfilGrupo.php | 92 ++++++------- seguranca/usuario.php | 50 ++++--- seguranca/usuarioCad.php | 130 +++++++++--------- 18 files changed, 336 insertions(+), 387 deletions(-) diff --git a/cadastros/ServicosChamadas/servicosChamadas.php b/cadastros/ServicosChamadas/servicosChamadas.php index fa8066e7..ccdf6ae0 100644 --- a/cadastros/ServicosChamadas/servicosChamadas.php +++ b/cadastros/ServicosChamadas/servicosChamadas.php @@ -9,6 +9,7 @@ $filtro = isset($_REQUEST["paramPesquisa"]) ? trim($_REQUEST["paramPesquisa"]) : $filtroNovo = !isset($_REQUEST["pgn"]) ? '' : sprintf("¶mPesquisa%s&pgn=%s&bloco=%s&pg=%s", $_REQUEST["paramPesquisa"], $_REQUEST["pgn"], $_REQUEST["bloco"], $_REQUEST["pg"]); $recontaPag = ($acao == 'novo') || (GetFormAcao() == 'apagar') || isset($_POST['pesquisa']); $imgNovo = sprintf('Novo Serviço', QuotedStr($filtroNovo)); +$org_id = GetOrganizacao(); if ($acao == 'apagar') { $serv_id = strtoupper(trim($_REQUEST['serv_id'])); @@ -21,10 +22,11 @@ if ($acao == 'apagar') { GeraExcept("Desvincule o serviço das rotas de entrada para desativa-lo!"); } - $query = sprintf("update pbx_servicos set serv_status = $status where serv_id = %s", QuotedStr($serv_id)); - $result = pg_query($query); - if (!$result) + $query = sprintf("UPDATE pbx_servicos SET serv_status = $status WHERE serv_id = %s", QuotedStr($serv_id)); + $result = pg_query($dbcon, $query); + if (!$result) { GeraExcept("Erro ao realizar a operação!"); + } $jsStartup[] = sprintf("alert('%s');", 'Operação realizada com sucesso!'); } catch (Exception $ex) { @@ -39,11 +41,11 @@ if ($acao == 'apagar') { GeraExcept("Serviço já cadastrado!"); } - - $query = sprintf("insert into pbx_servicos(serv_id)values(%s)", QuotedStr($serv_id)); - $result = pg_query($query); - if (!$result) + $query = sprintf("INSERT INTO pbx_servicos(serv_id, org_id) VALUES(%s, %s)", QuotedStr($serv_id), $org_id); + $result = pg_query($dbcon, $query); + if (!$result) { GeraExcept("Erro ao realizar a operação!"); + } $jsStartup[] = sprintf("alert('%s');", 'Operação realizada com sucesso!'); } catch (Exception $ex) { @@ -57,7 +59,7 @@ if (isset($_REQUEST['paramPesquisa']) && $_REQUEST['paramPesquisa']) { $compl = sprintf("and (a.serv_id ilike %s)", $compl); } -switch($filtroStatus){ +switch ($filtroStatus) { case 'A': $compl .= 'AND serv_status = 1'; break; @@ -66,7 +68,7 @@ switch($filtroStatus){ break; } -$query = "select serv_id, serv_status from pbx_servicos a where 1=1 $compl order by 1"; +$query = "SELECT serv_id, serv_status FROM pbx_servicos WHERE 1=1 $compl order by 1"; $linha = ""; $params = "¶mPesquisa=$filtro"; $links = PaginaDados($idProg, $query, $params, $regPagina, $offSet, $pagMostra, true); @@ -105,12 +107,15 @@ $smarty->assign('filtroStatus', $filtroStatus); GetTemplate($smarty, $tpl); -function ServicosRotas($serv_id) { - $query = sprintf("select id, nome from pbx_rotas_entrada where serv_id = %s order by nome", QuotedStr($serv_id)); - $result = pg_query($query); +function ServicosRotas($serv_id) +{ + global $dbcon; + $query = sprintf("SELECT id, nome FROM pbx_rotas_entrada WHERE serv_id = %s ORDER BY nome", QuotedStr($serv_id)); + $result = pg_query($dbcon, $query); - if (!$result || !pg_num_rows($result)) + if (!$result || !pg_num_rows($result)) { return ''; + } $str = 'Rotas associadas a este serviço: '; while ($dados = pg_fetch_array($result)) { $str .= $dados['id'] . '-' . $dados['nome'] . '; '; @@ -118,5 +123,3 @@ function ServicosRotas($serv_id) { return $str; } - -?> diff --git a/cadastros/classificaAtendimento/classificaAtendimento.php b/cadastros/classificaAtendimento/classificaAtendimento.php index 48dbd84f..4bd56ff1 100644 --- a/cadastros/classificaAtendimento/classificaAtendimento.php +++ b/cadastros/classificaAtendimento/classificaAtendimento.php @@ -1,8 +1,6 @@ " ; -//$imgClass = "$imgClass Novo Item"; $janW = 510; $janH = 35; $acao = isset($acao) ? $acao : FORM_SELECT; @@ -13,6 +11,7 @@ $recontaPag = ($acao == 'inseri') || (GetFormAcao() == FORM_DELETE) || isset($_P $imgNovo = ""; $imgClass = "$imgNovo Nova Classificação"; $filtroStatus = isset($_POST['status']) ? $_POST['status'] : 'A'; +$org_id = GetOrganizacao(); if (!IsAjax()) { @@ -28,7 +27,7 @@ if (!IsAjax()) { $linhaDados = ""; $codDetalhe = 0; - switch($filtroStatus){ + switch ($filtroStatus) { case 'A': $compl .= "AND clas_status = '1'"; break; @@ -37,12 +36,12 @@ if (!IsAjax()) { break; } - $query = "select clas_id as id, clas_descricao as desc, clas_status as status from pbx_classifica_atendimento a where 1=1 $compl order by 2"; + $query = "SELECT clas_id AS id, clas_descricao AS desc, clas_status AS status FROM pbx_classifica_atendimento a WHERE 1=1 $compl ORDER BY 2"; $params = "¶mPesquisa=$filtro"; $links = PaginaDados($idProg, $query, $params, $regPagina, $offSet, $pagMostra, true); $query .= " limit $regPagina offset $offSet"; $result = pg_query($dbcon, $query); - While ($row = pg_fetch_array($result)) { + while ($row = pg_fetch_array($result)) { $codigo = $row["id"]; $descricao = $row["desc"]; @@ -84,9 +83,10 @@ if (IsAjax()) { $desc = $_GET["desc"]; } -$query = "select clit_id as id, clas_id, clit_descricao as desc, clit_status as status - from pbx_classifica_item - where clas_id = '$codItem' "; +$query = "SELECT clit_id AS id, clas_id, clit_descricao AS desc, clit_status AS status + FROM pbx_classifica_item + WHERE clas_id = '$codItem' + AND org_id = $org_id "; $imgItem = ""; $imgItem = "$imgItem Novo Item"; @@ -94,19 +94,15 @@ $totalDet = 0; $descDet = ""; $linhaDet = GetDetalhes($query, $codItem); - if (IsAjax()) { echo GetHtmlDetalhe($linhaDet, $imgItem) . "#" . "[" . $codItem . " - " . $_REQUEST["desc"] . "]"; exit; } else { - //$jsJQuery[] = "\$('#dataIni').change(function(){GetAgtFromTransfer();}) "; - - $jsJQuery[] = "\$('input').click( - function() { - \$('input').removeClass('btSelect'); - \$(this).addClass('btSelect'); - } + $jsJQuery[] = "$('input').click(function() { + $('input').removeClass('btSelect'); + $(this).addClass('btSelect'); + } );"; $smarty->assign("linhas", $linhaDados); @@ -127,4 +123,3 @@ if (IsAjax()) { $smarty->assign('filtroStatus', $filtroStatus); GetTemplate($smarty, 'cadastros/classificaAtendimento/classificaItem.tpl'); } -?> diff --git a/cadastros/classificaAtendimento/classificaDac.php b/cadastros/classificaAtendimento/classificaDac.php index 3f8c47e6..c4548d94 100644 --- a/cadastros/classificaAtendimento/classificaDac.php +++ b/cadastros/classificaAtendimento/classificaDac.php @@ -4,17 +4,17 @@ $tpLayout = 1; $clasId = $_REQUEST["clas_id"]; $clasDesc = $_REQUEST["clas_descricao"]; - if (isset($_POST["btIncDac"])) { $dacs = $_POST["dacs"]; pg_query($dbcon, 'begin'); foreach ($dacs as $idDac) { - $query = "insert into pbx_classifica_dacs(clas_id, id_dac ) - select '$clasId', '$idDac' - where not exists(select '' from pbx_classifica_dacs where id_dac = '$idDac' and clas_id = '$clasId')"; + $query = "INSERT INTO pbx_classifica_dacs(clas_id, id_dac ) + SELECT '$clasId', '$idDac' + WHERE NOT EXISTS(SELECT '' FROM pbx_classifica_dacs WHERE id_dac = '$idDac' AND clas_id = '$clasId')"; $result = pg_query($dbcon, $query); - if (!$result) + if (!$result) { break; + } } if ($result) { @@ -29,10 +29,11 @@ if (isset($_POST["btIncDac"])) { $dacs = $_POST["dacsInc"]; pg_query($dbcon, 'begin'); foreach ($dacs as $idDac) { - $query = "delete from pbx_classifica_dacs where id_dac = '$idDac' and clas_id = '$clasId' "; + $query = "DELETE FROM pbx_classifica_dacs WHERE id_dac = '$idDac' AND clas_id = '$clasId' "; $result = pg_query($dbcon, $query); - if (!$result) + if (!$result) { break; + } } if ($result) { @@ -45,13 +46,11 @@ if (isset($_POST["btIncDac"])) { } } - $dacs = GetDacClas($dbcon, $clasId); $dacsIncs = GetDacClasInc($dbcon, $clasId); GetDac($dbcon, $codDac); - $smarty->assign("clas_id", $clasId); $smarty->assign("clas_descricao", $clasDesc); $smarty->assign("dacs", $dacs); @@ -59,97 +58,50 @@ $smarty->assign("dacsIncs", $dacsIncs); $smarty->assign("erro", $msg); GetTemplate($smarty, 'cadastros/classificaAtendimento/classificacaoDacs.htm'); -function GetDacClas($dbcon, $clasId) { +function GetDacClas($dbcon, $clasId) +{ /* * Carrega lista de dacs disponivel * para ser inserdo entre as tags */ + $org_id = GetOrganizacao(); + $query = "SELECT DISTINCT id, nome AS nome, 'Receptivo' AS tipo + FROM pbx_queues_grupos d + WHERE status = 'A' + AND org_id = $org_id + AND id NOT IN(SELECT id_dac FROM pbx_classifica_dacs WHERE clas_id = $clasId) + ORDER BY 2"; - $isAdm = (IsAdmin() && !$matricula); - - $idUser = !$matricula ? GetIdUser() : GetIdUserFromMatricula($dbcon, $matricula); - $matricula = GetMatricula(); - - - - $query = "select distinct id, nome as nome, 'Receptivo' as tipo - from pbx_dacs d - where status = 'A' - and id not in(select id_dac from pbx_classifica_dacs where clas_id = $clasId) - order by 2"; - /* - if($isAdm) - { - } - else - { - $query = "select distinct d.id, d.nome, 'Receptivo' as tipo, 'false' as padrao - from pbx_usuarios a, pbx_grupo_usuario b, pbx_fila_grupos c, pbx_dacs d - where b.user_id = a.id - and c.gp_id = b.gp_id - and d.id = c.id - and lower(a.matricula) = lower('$matricula') - and d.id in (select id_dac from pbx_classifica_dacs where clas_id = $clasId) - and d.status = 'A' - order by 1, 2 "; - - } */ - - // echo $query; $result = pg_query($dbcon, $query); $dacs = ""; return $dacs; } -function GetDacClasInc($dbcon, $clasId) { +function GetDacClasInc($dbcon, $clasId) +{ /* * Carrega lista de dacs disponivel * para ser inserdo entre as tags */ + $org_id = GetOrganizacao(); + $query = "SELECT DISTINCT id, nome AS nome, 'Receptivo' AS tipo + FROM pbx_queues_grupos d + WHERE status = 'A' + AND org_id = $org_id + AND id IN(SELECT id_dac FROM pbx_classifica_dacs WHERE clas_id = $clasId) + ORDER BY 2"; - $isAdm = (IsAdmin() && !$matricula); - $matricula = GetMatricula(); - - - - $query = "select distinct id, nome as nome, 'Receptivo' as tipo - from pbx_dacs d - where status = 'A' - and id in(select id_dac from pbx_classifica_dacs where clas_id = $clasId) - order by 2"; - /* - if($isAdm) - { - } - else - { - $query = "select distinct d.id, d.nome, 'Receptivo' as tipo, 'false' as padrao - from pbx_usuarios a, pbx_grupo_usuario b, pbx_fila_grupos c, pbx_dacs d - where b.user_id = a.id - and c.gp_id = b.gp_id - and d.id = c.id - and lower(a.matricula) = lower('$matricula') - and d.id not in (select id_dac from pbx_classifica_dacs where clas_id = $clasId) - and d.status = 'A' - order by 1, 2 "; - - } */ - //echo $query; $result = pg_query($dbcon, $query); $dacs = ""; return $dacs; } - -?> diff --git a/cadastros/classificaAtendimento/classificaDetIns.php b/cadastros/classificaAtendimento/classificaDetIns.php index a8f63674..56c5a171 100644 --- a/cadastros/classificaAtendimento/classificaDetIns.php +++ b/cadastros/classificaAtendimento/classificaDetIns.php @@ -1,17 +1,13 @@ assign("msg", $msg); $smarty->assign("clas_id", $clas_id); $smarty->assign("descitem", $descitem); - - - GetTemplate($smarty, 'cadastros/classificaAtendimento/classificaCad.tpl'); -?> diff --git a/cadastros/classificaAtendimento/classificaIns.php b/cadastros/classificaAtendimento/classificaIns.php index 9c0300d4..254e2415 100644 --- a/cadastros/classificaAtendimento/classificaIns.php +++ b/cadastros/classificaAtendimento/classificaIns.php @@ -3,8 +3,8 @@ $tpLayout = 1; $clasMsg = "msgWarn"; $desc = isset($_POST["clas_descricao"]) ? $_POST["clas_descricao"] : ""; -//$status = isset($_POST["btGravar"]) $_POST["btGravar"] ? "checked" : "" ? : ""; $acaoUser = "Incluir"; +$org_id = GetOrganizacao(); if (isset($_POST["btGravar"])) { if (empty($desc)) { @@ -13,8 +13,8 @@ if (isset($_POST["btGravar"])) { $jsStartup[] = "alert('$msg');"; } else { $desc = mb_strtoupper(RemoveAcentos($desc)); - $query = "insert into pbx_classifica_atendimento(clas_descricao, clas_status)values(%s, %s)"; - $query = sprintf($query, QuotedStr($desc), '1'); + $query = "INSERT INTO pbx_classifica_atendimento(clas_descricao, clas_status, org_id) VALUES(%s, %s, %s)"; + $query = sprintf($query, QuotedStr($desc), '1', $org_id); $result = pg_query($dbcon, $query); if ($result) { $desc = ""; @@ -37,4 +37,3 @@ $smarty->assign("msg", $msg); GetTemplate($smarty, 'cadastros/classificaAtendimento/classificaCad.tpl'); -?> diff --git a/cadastros/motivosPausa/motivosPausaInsert.php b/cadastros/motivosPausa/motivosPausaInsert.php index 88d0d50d..d09eeed4 100644 --- a/cadastros/motivosPausa/motivosPausaInsert.php +++ b/cadastros/motivosPausa/motivosPausaInsert.php @@ -25,6 +25,7 @@ $id = 0; $flag = 0; $motivo = ""; $produtiva = 0; +$org_id = GetOrganizacao(); /* * Verifica se o usuario pressionou o botão para inserir @@ -40,8 +41,7 @@ if ($formAction == FORM_NEW) { $msgUser = sprintf("alert('O \"Motivo: %s\" já existe na base de dados!');", $_POST["motivo"]); } else { //string para inserção do registro - $query = "insert into pbx_motivos_pausas(motivo, flag, produtiva, tempo_alerta) - values(%s, %s, %s, %s)"; + $query = "INSERT INTO pbx_motivos_pausas(motivo, flag, produtiva, tempo_alerta, org_id) VALUES(%s, %s, %s, %s, %s)"; GetGpValues(); @@ -50,13 +50,14 @@ if ($formAction == FORM_NEW) { if ($result) { //Prepara a query para inserir o registro no banco - $query = sprintf($query, QuotedStr($motivo), QuotedStr($flag), QuotedStr($produtiva), QuotedStr($tempo_alerta)); + $query = sprintf($query, QuotedStr($motivo), QuotedStr($flag), QuotedStr($produtiva), QuotedStr($tempo_alerta), $org_id); //Executa a query no banco $result = pg_query($dbcon, $query); - if ($result) + if ($result) { $result = pg_query($dbcon, "commit"); + } } if ($result) { $acaoUser = 'Incluir'; @@ -74,8 +75,9 @@ if ($formAction == FORM_NEW) { } } -if (!empty($msgUser)) +if (!empty($msgUser)) { $jsStartup[] = $msgUser; +} $smarty->assign("id", $id); $smarty->assign("motivo", $motivo); @@ -88,7 +90,8 @@ $smarty->assign("erro", $msgErro); GetTemplate($smarty, 'cadastros/motivosPausa/motivosPausaCadastro.tpl'); -function LimpaGpVar() { +function LimpaGpVar() +{ $GLOBALS["motivo"] = ""; $GLOBALS["flag"] = 1; $GLOBALS["id"] = 0; @@ -96,12 +99,11 @@ function LimpaGpVar() { $GLOBALS["tempo_alerta"] = 0; } -function GetGpValues() { +function GetGpValues() +{ $GLOBALS["id"] = $_POST["id"]; $GLOBALS["motivo"] = mb_strtoupper(RemoveAcentos($_POST["motivo"])); $GLOBALS["flag"] = $_POST["flag"] ? 1 : 0; $GLOBALS["produtiva"] = $_POST["produtiva"]; $GLOBALS["tempo_alerta"] = $_POST["tempo_alerta"] * 60; } - -?> diff --git a/cadastros/motivosPausa/motivosPausaSelect.php b/cadastros/motivosPausa/motivosPausaSelect.php index c8a04ba8..27b79ab7 100644 --- a/cadastros/motivosPausa/motivosPausaSelect.php +++ b/cadastros/motivosPausa/motivosPausaSelect.php @@ -32,10 +32,14 @@ if (isset($_REQUEST['paramPesquisa']) && $_REQUEST['paramPesquisa']) { $compl = sprintf("and (a.motivo ilike %s )", $compl); } -$query = "select id, motivo, flag, produtiva,tempo_alerta from pbx_motivos_pausas a \n"; -$query .= "where 1=1 and upper(motivo) not in('AUSENTE', 'LOGIN', 'RECUSADA') $compl"; -$query .= " and flag = '$active' "; -$query .= " order by motivo"; +$query = "SELECT id, motivo, flag, produtiva,tempo_alerta + FROM pbx_motivos_pausas + WHERE 1=1 + AND upper(motivo) + NOT IN('AUSENTE', 'LOGIN', 'RECUSADA') + $compl + AND flag = '$active' + ORDER BY motivo"; $params = "¶mPesquisa=$filtro"; $links = PaginaDados($idProg, $query, $params, $regPagina, $offSet, $pagMostra, true); @@ -57,12 +61,12 @@ while (($result) && ($dados = @pg_fetch_array($result))) { $imgEdit = GetLinkFormUpdate("&id=$id", "updMotivosPausa"); $status = $dados["flag"] ? $imgYes : $imgNo; - if($dados["flag"] == 0){ + if ($dados["flag"] == 0) { $delete = ""; } else { $delete = GetLinkFormDelete($id . '|' . $params, 'DeltetaMotivoPausa'); } - + SetDimensoes(610, 275); $pausaGrupo = " $imgPausaGrupo"; $pausaGrupo = UsePausaGrupo() ? "$pausaGrupo" : ""; @@ -109,8 +113,7 @@ GetTemplate($smarty, $tpl); * Apresenta uma informação ao usuário ou um mensagem de erro */ -function GetLinhaInfo($mensagem, $colspan) { +function GetLinhaInfo($mensagem, $colspan) +{ return " $mensagem"; } - -?> diff --git a/contacteFunc.php b/contacteFunc.php index a90740a2..d66e4b3f 100644 --- a/contacteFunc.php +++ b/contacteFunc.php @@ -84,7 +84,8 @@ function GetDac($dbcon, $codDac, $disableb = "", $incTodos = 0, $soAtivo = 1, $i function GetDacs($dbcon, $codDac, $disableb = "", $incTodos = 1, $soAtivo = 1) { - $query = "select distinct id, nome as nome from pbx_dacs d where 1=1 " . ($soAtivo ? " and status = 'A' " : "") . " order by 2"; + $org_id = GetOrganizacao(); + $query = "SELECT DISTINCT id, nome as nome FROM pbx_queues_grupos WHERE org_id = $org_id " . ($soAtivo ? " AND status = 'A' " : "") . " ORDER BY 2"; $result = pg_query($dbcon, $query); $codSel = $codDac; @@ -2387,25 +2388,21 @@ function GetCampanhas($dbcon, $codDac = -1, $matricula = 0, $dataIni = '', $data $dacs = ""; return $dacs; } function _VerificaNomeTronco($db, $nome) { - $sql = "select '' from pbx_troncos where upper(nome) = upper('$nome')"; $result = pg_query($db, $sql); if (pg_num_rows($result)) { @@ -2418,21 +2415,14 @@ function _VerificaNomeTronco($db, $nome) if (pg_num_rows($result)) { return "Este \"Nome\" já esta associado a um \"Ramal\"!"; } - - return false; } function base64ToFile($base64) { $file = tempnam(sys_get_temp_dir(), time()); - // open the output file for writing $ifp = fopen($file, 'wb'); - - // we could add validation here with ensuring count( $data ) > 1 fwrite($ifp, base64_decode($base64)); - - // clean up the file resource fclose($ifp); return $file; @@ -2444,7 +2434,11 @@ function base64ToFile($base64) function GetNotExistsDacUser($dacPadraoSel, $idUser) { - $query = sprintf("select '' from pbx_fila_grupos where id = %s and gp_id in(select gp_id from pbx_grupo_usuario where user_id = %s);", QuotedStr($dacPadraoSel), QuotedStr($idUser)); + $query = sprintf( + "SELECT '' FROM pbx_fila_grupos WHERE id = %s AND gp_id IN(SELECT gp_id FROM pbx_grupo_usuario WHERE user_id = %s);", + QuotedStr($dacPadraoSel), + QuotedStr($idUser) + ); $result = pg_query($query); return pg_num_rows($result) ? true : false; } diff --git a/include/util/funcoesApl.php b/include/util/funcoesApl.php index 60491761..bf725945 100755 --- a/include/util/funcoesApl.php +++ b/include/util/funcoesApl.php @@ -3024,7 +3024,16 @@ function RegistroInc($db, $query) function ExisteRegistro($db, $table, $where, $id, $queryParam = null) { - $query = "select count(*) from $table where $where = '$id' "; + $org_id = GetOrganizacao(); + $compl = ""; + $join = ""; + if ($table == 'pbx_usuarios') { + $join = "a INNER JOIN pbx_organizacao_usuarios b ON b.id_usuario = a.id "; + $compl = " 1=1 AND id_organizacao = $org_id AND "; + } + $query = "SELECT count(*) FROM $table $join WHERE $compl $where = '$id' "; + + echo $query; if ($queryParam) { $query .= " and {$queryParam} "; @@ -4077,7 +4086,7 @@ function PaginaDados($idProg, &$sql, &$params, &$regPagina, &$offSet, &$pagMostr */ $org_id = GetOrganizacao(); - if (strpos($sql, 'org_id') === false) { + if (strpos($sql, 'org_id') === false && strpos($sql, 'id_organizacao') === false) { if (strpos($sql, 'where') !== false) { $sql = str_replace("where", "where org_id = {$org_id} and", $sql); } else if (strpos($sql, 'WHERE') !== false) { diff --git a/projeto/base/sql/versao-1.9.0.sql b/projeto/base/sql/versao-1.9.0.sql index ddc0f6b2..ccadc1f7 100644 --- a/projeto/base/sql/versao-1.9.0.sql +++ b/projeto/base/sql/versao-1.9.0.sql @@ -54,3 +54,9 @@ ALTER TABLE pbx_facilidades ADD COLUMN id SERIAL PRIMARY KEY; ALTER TABLE pbx_features_general ADD COLUMN id SERIAL PRIMARY KEY; ALTER TABLE pbx_features_featuremap ADD COLUMN id SERIAL PRIMARY KEY; ALTER TABLE pbx_voicemail_general ADD COLUMN id SERIAL PRIMARY KEY; +ALTER TABLE pbx_usuarios DROP CONSTRAINT pbx_usuarios_new_matricula_key; +DROP INDEX "pbx_usuarios_matricula_key"; +DROP INDEX "idxUsuariosApelido"; +ALTER TABLE pbx_grupo DROP CONSTRAINT "idxGrupNome"; +DROP INDEX "idxGrupNome"; +ALTER TABLE pbx_grupo_usuario DROP CONSTRAINT "pkGpUserId"; \ No newline at end of file diff --git a/seguranca/grupos/grupoInsert.php b/seguranca/grupos/grupoInsert.php index 2f95598f..b82fd745 100644 --- a/seguranca/grupos/grupoInsert.php +++ b/seguranca/grupos/grupoInsert.php @@ -11,6 +11,7 @@ $msgErro = ""; $setFocus = "document.getElementById('gp_nome').focus();"; $jsStartup[] = $setFocus; +$org_id = GetOrganizacao(); /* * Verifica se o usuario pressionou o botão para inserir @@ -24,8 +25,7 @@ if ($formAction == FORM_NEW) { $msgUser = "alert('O nome do grupo é campo de preenchimento obrigatório!');"; } else { //string para inserção do registro - $query = "insert into pbx_grupo(gp_nome, gp_status, gp_user, gp_system) - values(%s, %s, %s, '0')"; + $query = "INSERT INTO pbx_grupo(gp_nome, gp_status, gp_user, gp_system, org_id) VALUES(%s, %s, %s, '0', $org_id)"; GetGpValues(); @@ -41,26 +41,26 @@ if ($formAction == FORM_NEW) { if (!IsAdmin() && $result) { //Insere o grupo para o criador e seus antecessores na ordem inversa de criação - $query = "select max(gp_id) from pbx_grupo"; + $query = "SELECT max(gp_id) FROM pbx_grupo WHERE org_id = $org_id"; $result = pg_query($dbcon, $query); $row = @pg_fetch_row($result); $idGrupo = $row[0]; $idUser = GetIdUser(); - + /* * Usuario administrador não é inserido no grupo. */ if ($result && !IsUserAdmin()) { - $query = " insert into pbx_grupo_usuario(user_id, gp_id)values(%s, %s)"; - $query = sprintf($query, $idUser, $idGrupo); + $query = " INSERT INTO pbx_grupo_usuario(user_id, gp_id, org_id)values(%s, %s, %s)"; + $query = sprintf($query, $idUser, $idGrupo, $org_id); $result = pg_query($dbcon, $query); } if ($result) { - $query = " insert into pbx_grupo_usuario(user_id, gp_id)values(%s, %s)"; + $query = "INSERT INTO pbx_grupo_usuario(user_id, gp_id, org_id)values(%s, %s, %s)"; $idUser = GetIdSysAdmin($dbcon); - $query = sprintf($query, $idUser, $idGrupo); + $query = sprintf($query, $idUser, $idGrupo, $org_id); $result = pg_query($dbcon, $query); } } @@ -97,16 +97,16 @@ $smarty->assign("erro", $msgErro); GetTemplate($smarty, 'seguranca/grupos/gruposCadastro.tpl'); -function LimpaGpVar() { +function LimpaGpVar() +{ $GLOBALS["gp_nome"] = ""; $GLOBALS["gp_status"] = 1; $GLOBALS["gp_id"] = 0; } -function GetGpValues() { +function GetGpValues() +{ $GLOBALS["gp_nome"] = mb_strtoupper(RemoveAcentos($_POST["gp_nome"])); $GLOBALS["gp_status"] = $_POST["gp_status"]; $GLOBALS["gp_id"] = $_POST["gp_id"]; } - -?> diff --git a/seguranca/grupos/grupoSelect.php b/seguranca/grupos/grupoSelect.php index e3190e73..3e7fa0b9 100644 --- a/seguranca/grupos/grupoSelect.php +++ b/seguranca/grupos/grupoSelect.php @@ -24,7 +24,7 @@ $paramPesquisa = isset($_REQUEST['paramPesquisa']) ? $_REQUEST['paramPesquisa'] $filtro = isset($_REQUEST["paramPesquisa"]) ? trim($_REQUEST["paramPesquisa"]) : ''; $filtroNovo = !isset($_REQUEST["pgn"]) ? '' : sprintf("¶mPesquisa%s&pgn=%s&bloco=%s&pg=%s", $_REQUEST["paramPesquisa"], $_REQUEST["pgn"], $_REQUEST["bloco"], $_REQUEST["pg"]); $recontaPag = ($acao == 'inseri') || (GetFormAcao() == FORM_DELETE) || isset($_POST['pesquisa']); - +$org_id = GetOrganizacao(); /* * Se o usuario nao for admimistrador carrega apenas * os grupos ao qual o mesmo pertence @@ -66,8 +66,10 @@ if (isset($_REQUEST['paramPesquisa']) && $_REQUEST['paramPesquisa']) { $compl = sprintf("and (a.gp_nome ilike %s)", $compl); } -$query = "select gp_id, gp_nome, gp_status, user_id, 0 as gp_lgpd, case when(user_id = 0)then 0 else 1 end as ord from pbx_grupo a\n"; -$query .= "where a.gp_system = '0' $compl $gpCompl $restringLgpd $liberaLgpd $permissoesAdmin order by 5, gp_nome"; +$compl .= "AND org_id = $org_id "; + +$query = "SELECT gp_id, gp_nome, gp_status, user_id, 0 as gp_lgpd, case when(user_id = 0)then 0 else 1 end as ord FROM pbx_grupo a\n"; +$query .= "WHERE a.gp_system = '0' $compl $gpCompl $restringLgpd $liberaLgpd $permissoesAdmin order by 5, gp_nome"; $params = "¶mPesquisa=$filtro"; $links = PaginaDados($idProg, $query, $params, $regPagina, $offSet, $pagMostra, true); @@ -149,13 +151,16 @@ GetTemplate($smarty, $tpl); * Apresenta uma informação ao usuário ou um mensagem de erro */ -function GetLinhaInfo($mensagem, $colspan) { +function GetLinhaInfo($mensagem, $colspan) +{ return " $mensagem"; } -function GetCampanhaPrevenda($grupo, $userGrupo) { +function GetCampanhaPrevenda($grupo, $userGrupo) +{ + global $dbcon; $query = "SELECT * FROM pbx_grupo_funcoes WHERE fun_id = 209 AND gp_id = {$grupo}"; - $result = pg_query($query); + $result = pg_query($dbcon, $query); $linkGrupo = "%s"; $img = ""; @@ -171,5 +176,3 @@ function GetCampanhaPrevenda($grupo, $userGrupo) { return $link; } - -?> diff --git a/seguranca/grupos/gruposAudiosRamais.php b/seguranca/grupos/gruposAudiosRamais.php index e7a12d6b..4fd343ff 100644 --- a/seguranca/grupos/gruposAudiosRamais.php +++ b/seguranca/grupos/gruposAudiosRamais.php @@ -5,7 +5,7 @@ $templateName = 'seguranca/grupos/gruposAudioRamal.htm'; //define tipo de formulario $tpLayout = 1; $upload = 1; - +$org_id = GetOrganizacao(); $fieldsForm = array(); $fieldsForm = IsPostBack() ? $_POST : $_GET; @@ -27,8 +27,8 @@ if (isset($fieldsForm['btInclui'])) { if ($result) { $cont = 0; foreach ($fieldsForm['listaRamaisDisponiveis'] as $ramal) { - $query = "insert into pbx_grupo_audio_ramal(nome, gp_id)values('%s', '%s')"; - $query = sprintf($query, $ramal, $fieldsForm['gp_id']); + $query = "INSERT INTO pbx_grupo_audio_ramal(nome, gp_id, org_id)values('%s', '%s', %s)"; + $query = sprintf($query, $ramal, $fieldsForm['gp_id'], $org_id); $result = pg_query($dbcon, $query); if (!$result) break; @@ -97,16 +97,19 @@ foreach ($fieldsForm as $key => $value) { GetTemplate($smarty, $templateName); function GetRamaisDisponiveis($dbcon, $codGp, $codSel, $size = 1, $tamPx = "200", $desabilita = 0, $multiple = 0) { + $org_id = GetOrganizacao(); + if (strpos($codGp, '|') !== false) { $codG = explode('|', $codGp); $codGp = $codG[0]; } $nomeLista = 'listaRamaisDisponiveis'; - $query = "select nome, (coalesce(callerid, nome) || case when(callerid = nome)then '' else ( ' [ ' || nome || ' ]') end) as nome_ramal - from pbx_ramais_mesa a - where tipo = 0 - and not exists(select '' from pbx_grupo_audio_ramal where nome = a.nome and gp_id = '$codGp')"; + $query = "SELECT nome, (coalesce(callerid, nome) || case when(callerid = nome)then '' else ( ' [ ' || nome || ' ]') end) as nome_ramal + FROM pbx_ramais_mesa a + WHERE tipo = 0 + AND org_id = $org_id + AND not exists(select '' from pbx_grupo_audio_ramal where nome = a.nome and gp_id = '$codGp')"; $result = pg_query($dbcon, $query); $cont = 0; @@ -158,5 +161,3 @@ function GetRamaisIncluidos($dbcon, $codGp, $codSel, $size = 1, $tamPx = "200", $lista .= "\n"; return $lista; } - -?> diff --git a/seguranca/grupos/gruposUsuario.php b/seguranca/grupos/gruposUsuario.php index 4693d4c2..d02344ad 100644 --- a/seguranca/grupos/gruposUsuario.php +++ b/seguranca/grupos/gruposUsuario.php @@ -2,10 +2,9 @@ require('funcoesFormulario.php'); $templateName = 'seguranca/grupos/gruposUsuario.htm'; -//define tipo de formulario $tpLayout = 1; $upload = 1; - +$org_id = GetOrganizacao(); $fieldsForm = array(); $fieldsForm = IsPostBack() ? $_POST : $_GET; @@ -16,7 +15,6 @@ if (isset($fieldsForm['gp_id']) && (strpos($fieldsForm['gp_id'], '|') !== false) $isLgpd = $fieldsForm["gp_lgpd"]; -//Id da campanha $idCampanha = $fieldsForm['cmp_id']; $fieldsForm['erro'] = ""; @@ -27,7 +25,7 @@ if (isset($fieldsForm['btIncAgente'])) { try { $result = pg_query($dbcon, 'begin'); - $query = sprintf('select count(*) from pbx_grupo_usuario a, pbx_grupo b where b.gp_id = a.gp_id and b.user_id > 0 and b.gp_id = %s', $fieldsForm['gp_id']); + $query = sprintf('SELECT count(*) FROM pbx_grupo_usuario a, pbx_grupo b WHERE b.gp_id = a.gp_id AND b.user_id > 0 AND b.gp_id = %s', $fieldsForm['gp_id']); if (RegistroInc($dbcon, $query)) { throw new Exception('Operação inválida, "Usuários" só podem ser vinculados a "Grupos"!'); } @@ -41,11 +39,12 @@ if (isset($fieldsForm['btIncAgente'])) { if ($isLgpd && ($jaLgpd = JaInseridoLgps($idUser))) { throw new Exception($jaLgpd); } - $query = "insert into pbx_grupo_usuario(user_id, gp_id)values(%s, '%s')"; + $query = "INSERT INTO pbx_grupo_usuario(user_id, gp_id, org_id) VALUES(%s, '%s', $org_id)"; $query = sprintf($query, $idUser, $fieldsForm['gp_id']); $result = pg_query($dbcon, $query); - if (!$result) + if (!$result) { break; + } $cont++; } } @@ -67,20 +66,17 @@ if (isset($fieldsForm['btIncAgente'])) { $fieldsForm['erro'] = fmtMsg('Selecione um agente!'); } else { try { - $result = pg_query($dbcon, 'begin'); - if ($result) { $userAdmin = IsAdmin() || IsUserAdmin() ? 1 : 0; $cont = 0; foreach ($fieldsForm['user_inc'] as $idUser) { - $query = "delete from pbx_grupo_usuario" - . "\nwhere user_id = '%s'" - . "\nand gp_id = '%s'" - . "\nand user_id <> (select id from pbx_usuarios where apelido = 'administrador')" // Não permite remover o administrador. - . "and not exists(select '' from pbx_grupo where gp_id = '%s' and gp_user = case when(%s=0)then '%s' else -1 end)\n"; //Nao permite o usuario remover o pai do grupo(quem criou). + $query = "DELETE from pbx_grupo_usuario + WHERE user_id = '%s' + AND gp_id = '%s' + AND user_id <> (SELECT id FROM pbx_usuarios WHERE apelido = 'administrador') + AND not exists(select '' from pbx_grupo WHERE gp_id = '%s' AND gp_user = CASE WHEN(%s=0)THEN '%s' ELSE -1 END)"; //Nao permite o usuario remover o pai do grupo(quem criou). $query = sprintf($query, $idUser, $fieldsForm['gp_id'], $fieldsForm['gp_id'], $userAdmin, $idUser); - $result = pg_query($dbcon, $query); if (!$result) break; @@ -89,7 +85,6 @@ if (isset($fieldsForm['btIncAgente'])) { } $result = $result && pg_query($dbcon, 'commit'); - if (!$result) { throw new Exception('A operação não pode ser realizada!'); } @@ -102,7 +97,6 @@ if (isset($fieldsForm['btIncAgente'])) { } } - $fieldsForm['user_id'] = GetUser($dbcon, $fieldsForm['gp_id'], $fieldsForm['user_id'], 8, "user_id", "240", 0, 1); $fieldsForm['listaGrupo'] = GetGrupoUser($dbcon, $fieldsForm['gp_id'], 0, 8, "user_inc", "240", 0, 1); @@ -114,20 +108,19 @@ foreach ($fieldsForm as $key => $value) { } GetTemplate($smarty, $templateName); - -function GetGrupoUser($dbcon, $codGp, $codSel, $size = 1, $nomeLista = "user_id", $tamPx = "200", $desabilita = 0, $multiple = 0) { +function GetGrupoUser($dbcon, $codGp, $codSel, $size = 1, $nomeLista = "user_id", $tamPx = "200", $desabilita = 0, $multiple = 0) +{ if (strpos($codGp, '|') !== false) { $codG = explode('|', $codGp); $codGp = $codG[0]; } - $query = "select b.id, b.nome || (case when( (select count(*) from pbx_grupo where gp_id = a.gp_id and gp_user = a.user_id) > 0)then '*' else '' end) as apelido, b.matricula, a.gp_id from pbx_grupo_usuario a, pbx_usuarios b where b.id = a.user_id and a.gp_id = $codGp order by 2"; + $query = "SELECT b.id, b.nome || (CASE WHEN( (SELECT count(*) FROM pbx_grupo WHERE gp_id = a.gp_id AND gp_user = a.user_id) > 0)THEN '*' ELSE '' END) AS apelido, b.matricula, a.gp_id FROM pbx_grupo_usuario a, pbx_usuarios b WHERE b.id = a.user_id AND a.gp_id = $codGp ORDER BY 2"; $result = pg_query($dbcon, $query); $cont = 0; $sel = ""; $lista = '%s'; @@ -166,24 +164,25 @@ function GetUser($dbcon, $codGrupo, $codSel, $size = 1, $nomeLista = "user_id", $cod = $row["id"]; $desc = $row["nome"] . "-" . $row["matricula"]; $sel = ($codSel == $cod) ? "selected" : ""; - $lista .= "\n"; - $cont++; } $lista .= "\n"; return $lista; } -function JaInseridoLgps($userId) { +function JaInseridoLgps($userId) +{ + global $dbcon; + $org_id = GetOrganizacao(); + $query = "SELECT c.id, c.matricula, c.nome, b.gp_id, b.gp_nome + FROM pbx_grupo_usuario a + INNER JOIN pbx_grupo b ON b.gp_id = a.gp_id + INNER JOIN pbx_usuarios c ON c.id = a.user_id + WHERE b.gp_nome ilike 'LGPD_%_%_%' + AND a.user_id = '{$userId}' + AND org_id = $org_id;"; - $query = "select c.id, c.matricula, c.nome, b.gp_id, b.gp_nome - from pbx_grupo_usuario a, pbx_grupo b, pbx_usuarios c - where b.gp_id = a.gp_id - and c.id = a.user_id - and b.gp_nome ilike 'LGPD_%_%_%' - and a.user_id = '{$userId}';"; - - $result = pg_query($query); + $result = pg_query($dbcon, $query); if (!pg_num_rows($result)) { return false; @@ -192,5 +191,3 @@ function JaInseridoLgps($userId) { $row = pg_fetch_array($result); return sprintf("O usuário: %s-%s já esta incluido no grupo %s da LGDP!", $row["matricula"], $row["nome"], $row["gp_nome"]); } - -?> diff --git a/seguranca/licencaUsuarioFixo.php b/seguranca/licencaUsuarioFixo.php index f0907903..23a406f6 100644 --- a/seguranca/licencaUsuarioFixo.php +++ b/seguranca/licencaUsuarioFixo.php @@ -35,11 +35,11 @@ foreach ($fieldsForm as $key => $value) { GetTemplate($smarty, $templateName); -function AtualizaLicenca($dbcon, $field, $status) { +function AtualizaLicenca($dbcon, $field, $status) +{ try { if (!$field) { - //fmtMsg('Selecione um usuário!'); throw new Exception('Selecione um usuário'); } @@ -54,11 +54,11 @@ function AtualizaLicenca($dbcon, $field, $status) { $result = pg_query($dbcon, $query); if ($result && pg_num_rows($result) > 0) { $result = pg_fetch_assoc($result); - + $limitUpdate = strtotime($result['limit_update']); $freeUpadate = strtotime($result['last_update'] . '+24 hours'); $currentTime = strtotime($result['current_time']); - + if ($currentTime > $limitUpdate && $currentTime < $freeUpadate) { throw new Exception('Não é possível realizar a alteração neste momento, tente novamente mais tarde!'); } @@ -77,7 +77,7 @@ function AtualizaLicenca($dbcon, $field, $status) { $query = sprintf("UPDATE pbx_licenca_pa_fixo SET id_user = %s, last_update = NOW(), limit_update = NOW() + INTERVAL '5 MINUTE' ", $status == 1 ? "'" . $idUser . "'" : 'NULL'); $status == 1 ? $query .= "WHERE id = (SELECT id FROM pbx_licenca_pa_fixo WHERE id_user IS NULL ORDER BY id LIMIT 1)" : - $query .= sprintf("WHERE id_user = '%s' ", $idUser); + $query .= sprintf("WHERE id_user = '%s' ", $idUser); if (!pg_query($dbcon, $query)) { throw new Exception('A operação não pode ser realizada!'); @@ -98,13 +98,15 @@ function AtualizaLicenca($dbcon, $field, $status) { } } -function AtualizaLicencaX($dbcon, $field, $status) { +function AtualizaLicencaX($dbcon, $field, $status) +{ $cont = 0; + $org_id = GetOrganizacao(); try { if ($status == 1) { - $query = "SELECT COUNT(*) AS qtd_pa_fixo FROM pbx_licenca_pa_fixo WHERE matricula IS NOT NULL;"; + $query = "SELECT COUNT(*) AS qtd_pa_fixo FROM pbx_licenca_pa_fixo WHERE matricula IS NOT NULL AND org_id = $org_id;"; $result = pg_query($dbcon, $query); $result = pg_fetch_assoc($result); @@ -122,7 +124,7 @@ function AtualizaLicencaX($dbcon, $field, $status) { @pg_query($dbcon, 'begin'); foreach ($field as $id) { - $query = "update pbx_usuarios set pa_fixo = {$status} where id = {$id};"; + $query = "UPDATE pbx_usuarios SET pa_fixo = {$status} WHERE id = {$id};"; $result = @pg_query($dbcon, $query); $cont++; } @@ -140,10 +142,16 @@ function AtualizaLicencaX($dbcon, $field, $status) { } } -function GetGrupoUser($dbcon, $codSel, $infos) { +function GetGrupoUser($dbcon, $codSel, $infos) +{ + $org_id = GetOrganizacao(); $sel = ""; $infos['name'] = $infos['name'] . "rm"; - $query = "SELECT * FROM pbx_usuarios WHERE pa_fixo = 1 ORDER BY apelido;"; + $query = "SELECT * FROM pbx_usuarios a + INNER JOIN pbx_organizacao_usuarios b on b.id_usuario = a.id + WHERE pa_fixo = 1 + AND b.id_organizacao = $org_id + ORDER BY apelido;"; $result = @pg_query($dbcon, $query); $lista = '%s'; @@ -173,5 +188,3 @@ function GetUser($dbcon, $codSel, $infos) { $lista .= "\n"; return $lista; } - -?> diff --git a/seguranca/perfil/perfilGrupo.php b/seguranca/perfil/perfilGrupo.php index 1415e33b..ca77888e 100644 --- a/seguranca/perfil/perfilGrupo.php +++ b/seguranca/perfil/perfilGrupo.php @@ -1,9 +1,5 @@ assign("nameGrupo", $nomeGp); GetTemplate($smarty, 'seguranca/perfilGrupos.tpl'); -function GetGrupoDef($dbcon, &$codGp, &$nomeGp, $idUser) { +function GetGrupoDef($dbcon, &$codGp, &$nomeGp, $idUser) +{ + $org_id = GetOrganizacao(); $flagSystem = (IsAdmin() && IsLocalServer()) ? '1=1' : " gp_system = '0' "; - $query = "select gp_id, gp_nome from pbx_grupo g where $flagSystem and gp_status = 1 {REST} order by gp_nome limit 1"; + $query = "SELECT gp_id, gp_nome FROM pbx_grupo g WHERE $flagSystem and gp_status = 1 {REST} AND org_id = $org_id ORDER BY gp_nome LIMIT 1"; //restricao se o usuario nao for admin $query = strtoupper(GetLogin()) == "ADMIN" ? str_replace("{REST}", "", $query) : str_replace("{REST}", " and exists(select '' from pbx_grupo_usuario where gp_id = g.gp_id and user_id = $idUser)", $query); $result = pg_query($dbcon, $query); @@ -50,12 +49,21 @@ function GetGrupoDef($dbcon, &$codGp, &$nomeGp, $idUser) { $nomeGp = $row["gp_nome"]; } -function GetGrupo($dbcon, $codGp, $size = 1) { +function GetGrupo($dbcon, $codGp, $size = 1) +{ + $org_id = GetOrganizacao(); $flagSystem = (IsAdmin() && IsLocalServer()) ? '1=1' : " gp_system = '0' "; $idUser = GetIdUser(); - //$query = "select gp_id, gp_nome from pbx_grupo g where $flagSystem and gp_status = 1 {REST} order by 2"; - $query = "select gp_id, case when(gp_system = 1)then (gp_nome || '#') else case when(user_id = 0)then gp_nome else (gp_nome || '**') end end gp_nome, case when(user_id = 0)then 0 else 1 end as ord from pbx_grupo g where $flagSystem and gp_status = 1 {REST} order by 3,2"; - //restricao se o usuario nao for admin + $query = "SELECT gp_id, + CASE WHEN(gp_system = 1) THEN (gp_nome || '#') + ELSE + CASE WHEN(user_id = 0)THEN gp_nome + ELSE (gp_nome || '**') END END gp_nome, + CASE WHEN(user_id = 0)THEN 0 ELSE 1 END AS ord + FROM pbx_grupo g + WHERE $flagSystem + AND org_id = $org_id + AND gp_status = 1 {REST} ORDER BY 3,2"; $query = strtoupper(GetLogin()) == "ADMIN" ? str_replace("{REST}", "", $query) : str_replace("{REST}", " and exists(select '' from pbx_grupo_usuario where gp_id = g.gp_id and user_id = $idUser)", $query); $result = pg_query($dbcon, $query); $sel = ""; @@ -72,27 +80,17 @@ function GetGrupo($dbcon, $codGp, $size = 1) { return $lista; } -function GetFunc($dbcon, $idGrupo, $notMenu = 0) { - //$dadosMenu = Menu($dbcon, QueryPerfilHead($idGrupo), QueryPerfilItens($idGrupo)); +function GetFunc($dbcon, $idGrupo, $notMenu = 0) +{ $_SESSION["SStreRoot"] = GetLogin(); $_SESSION["SStreView"] = 1; $_SESSION["SSperfilAcao"] = "add"; $idUser = GetIdUser(); - //$dadosMenu = Menu($dbcon, QueryMenuHead($idUser), QueryMenuItens($idUser, true)); $dadosMenu = MontaMenu(0, $idUser, 2, $notMenu, "add"); $dadosMenu = str_replace("MENU_ITEMS", "TREE_ITEMS", $dadosMenu); $GLOBALS["jsBlok"][] = $dadosMenu; - /* - $menu = "
\n"; - $menu .= "\n"; - $menu .= "
\n"; - */ $menu = "
\n"; $menu .= "