Browse Source

Colocar org_id nas querys dos arquivos audio.php audio_algar.php configGeral.php contacteFunc.php dacConsulta.php

1.9
bruno 3 months ago
parent
commit
bcc58ef108
  1. 24
      audio.php
  2. 21
      audio_algar.php
  3. 36
      configGeral.php
  4. 214
      contacteFunc.php
  5. 5
      dacConsulta.php

24
audio.php

@ -282,13 +282,13 @@
if ((($tipo == 1) or ( $tipo == 2)) && !($getAgt || $getClass || $getItem)) { if ((($tipo == 1) or ( $tipo == 2)) && !($getAgt || $getClass || $getItem)) {
$query = "DROP TABLE IF EXISTS tmp_restricao_ramal; $query = "DROP TABLE IF EXISTS tmp_restricao_ramal$org_id;
CREATE TEMPORARY TABLE tmp_restricao_ramal AS CREATE TEMPORARY TABLE tmp_restricao_ramal AS
SELECT DISTINCT x.nome FROM pbx_grupo_audio_ramal x, pbx_grupo_usuario y WHERE y.gp_id = x.gp_id AND y.user_id = '{$idUser}'; SELECT DISTINCT x.nome FROM pbx_grupo_audio_ramal x, pbx_grupo_usuario y WHERE y.gp_id = x.gp_id AND y.user_id = '{$idUser}' and x.org_id = y.org_id and x.org_id = $org_id;
CREATE INDEX \"tmpRestricaoRamalNome\" on tmp_restricao_ramal(nome);\n\n"; CREATE INDEX \"tmpRestricaoRamalNome\" on tmp_restricao_ramal$org_id(nome);\n\n";
$query .= "DROP TABLE IF EXISTS tmp_restricao_sigame; $query .= "DROP TABLE IF EXISTS tmp_restricao_sigame$org_id;
CREATE TEMPORARY TABLE tmp_restricao_sigame as CREATE TEMPORARY TABLE tmp_restricao_sigame$org_id as
SELECT sigame_externo FROM pbx_sip_ramais WHERE nome IN (SELECT nome FROM tmp_restricao_ramal) AND sigame_externo <> ''; "; SELECT sigame_externo FROM pbx_sip_ramais WHERE nome IN (SELECT nome FROM tmp_restricao_ramal) AND sigame_externo <> '' and org_id = $org_id; ";
} }
$addPdx = !($getAgt || $getClass || $getItem); $addPdx = !($getAgt || $getClass || $getItem);
@ -312,13 +312,13 @@
} }
$query .= "FROM pbx_bilhetes a $query .= "FROM pbx_bilhetes a
LEFT JOIN pbx_eventos_dacs b ON b.uid2 = a.uniqueid AND b.evento IN('COMPLETAAGENT','COMPLETACALLER','TRANSFERORIG', 'COMPLETECALLER', 'COMPLETEAGENT', 'TRANSFER','COMPLETEAGENTRAMAL','COMPLETECALLERRAMAL') LEFT JOIN pbx_eventos_dacs b ON b.uid2 = a.uniqueid AND b.evento IN('COMPLETAAGENT','COMPLETACALLER','TRANSFERORIG', 'COMPLETECALLER', 'COMPLETEAGENT', 'TRANSFER','COMPLETEAGENTRAMAL','COMPLETECALLERRAMAL') and b.org_id = a.org_id
LEFT JOIN pbx_dacs c ON c.nome = b.fila LEFT JOIN pbx_dacs c ON c.nome = b.fila and c.org_id = b.org_id
LEFT JOIN pbx_usuarios d ON d.matricula = SUBSTRING(b.agente, 7,4) LEFT JOIN pbx_usuarios d ON d.matricula = SUBSTRING(b.agente, 7,4)
LEFT JOIN pbx_protocolo_reg e ON e.uniqueid = a.uniqueid LEFT JOIN pbx_protocolo_reg e ON e.uniqueid = a.uniqueid and e.org_id = a.org_id
LEFT JOIN pbx_classifica_reg f ON f.id_bilhetes = a.uniqueid LEFT JOIN pbx_classifica_reg f ON f.id_bilhetes = a.uniqueid and f.org_id = a.org_id
LEFT JOIN pbx_classifica_item g ON g.clas_id = f.clas_id and g.clit_id = f.clit_id LEFT JOIN pbx_classifica_item g ON g.clas_id = f.clas_id and g.clit_id = f.clit_id and g.org_id = f.org_id
LEFT JOIN pbx_classifica_atendimento h ON h.clas_id = f.clas_id LEFT JOIN pbx_classifica_atendimento h ON h.clas_id = f.clas_id and h.org_id = f.org_id
WHERE a.org_id = {$org_id} AND a.billsec > 3 \n WHERE a.org_id = {$org_id} AND a.billsec > 3 \n
AND exists(SELECT '' FROM pbx_fila_audios x, pbx_grupo_usuario y WHERE x.org_id = {$org_id} AND y.gp_id = x.gp_id AND y.user_id = '{$idUser}' and x.id = c.id)\n"; AND exists(SELECT '' FROM pbx_fila_audios x, pbx_grupo_usuario y WHERE x.org_id = {$org_id} AND y.gp_id = x.gp_id AND y.user_id = '{$idUser}' and x.id = c.id)\n";
if ($isProto) { if ($isProto) {

21
audio_algar.php

@ -172,16 +172,19 @@ function GetAudioApi($servidor, $audio, $create = false) {
function GetQuery($dataIni, $dataFim, $src, $dst, $protocolo, $empId, $agente, $classificacao, $item, $revendasUser, $param = null) { function GetQuery($dataIni, $dataFim, $src, $dst, $protocolo, $empId, $agente, $classificacao, $item, $revendasUser, $param = null) {
global $contaReg; global $contaReg;
$org_id = GetOrganizacao();
if ($param == 'query') { if ($param == 'query') {
$query = "SELECT a.uid,e.emp_nome_fantasia,emp_cnpj,chm_fila,vdr_apelido,chm_calldate,chm_duration,chm_src, $query = "SELECT a.uid,e.emp_nome_fantasia,emp_cnpj,chm_fila,vdr_apelido,chm_calldate,chm_duration,chm_src,
chm_dst,prt_proto_parceiro,clas_descricao,clas_descricao_item,a.uid,chm_userfield,emp_vpn,emp_diretorio_ftp chm_dst,prt_proto_parceiro,clas_descricao,clas_descricao_item,a.uid,chm_userfield,emp_vpn,emp_diretorio_ftp
FROM vds_chamadas a FROM vds_chamadas a
INNER JOIN vds_vendedores b ON a.emp_id = b.emp_id INNER JOIN vds_vendedores b ON a.emp_id = b.emp_id and a.org_id = b.org_id
INNER JOIN vds_classificacoes c ON c.uid = a.uid INNER JOIN vds_classificacoes c ON c.uid = a.uid and c.org_id = a.org_id
INNER JOIN vds_protcolos d ON d.uid = a.uid INNER JOIN vds_protcolos d ON d.uid = a.uid and d.org_id = a.org_id
INNER JOIN vds_empresas e ON e.emp_id = a.emp_id INNER JOIN vds_empresas e ON e.emp_id = a.emp_id and e.org_id = a.org_id
WHERE chm_matricula = vdr_matricula WHERE chm_matricula = vdr_matricula
AND a.chm_evento IN ('COMPLETEAGENT','COMPLETECALLER','COMPLETAAGENT','COMPLETACALLER', 'TRANSFER') "; AND a.chm_evento IN ('COMPLETEAGENT','COMPLETECALLER','COMPLETAAGENT','COMPLETACALLER', 'TRANSFER')
AND a.org_id = $org_id";
if (!$protocolo) { if (!$protocolo) {
$query .= $dataIni && $dataFim ? sprintf(" AND chm_data_bilhete >= '%s' AND chm_data_bilhete <= '%s' ", FormatDtMssql($dataIni), FormatDtMssql($dataFim)) : ''; $query .= $dataIni && $dataFim ? sprintf(" AND chm_data_bilhete >= '%s' AND chm_data_bilhete <= '%s' ", FormatDtMssql($dataIni), FormatDtMssql($dataFim)) : '';
@ -266,16 +269,18 @@ function ___GetEmpresa($dataIni, $dataFim, $revendaUser, $empId = null) {
function ___GetAgente($revendaUser, $agente = null, $empId = null) { function ___GetAgente($revendaUser, $agente = null, $empId = null) {
global $dataIni, $dataFim; global $dataIni, $dataFim;
$org_id = GetOrganizacao();
if (!$empId) { if (!$empId) {
$query = "SELECT vdr_apelido AS apelido, vdr_matricula AS matricula, emp_id $query = "SELECT vdr_apelido AS apelido, vdr_matricula AS matricula, emp_id
FROM vds_vendedores FROM vds_vendedores
WHERE "; WHERE ";
$query .= "emp_id IN ($revendaUser) ORDER BY apelido"; $query .= "emp_id IN ($revendaUser) and org_id = $org_id ORDER BY apelido";
} else { } else {
$query = sprintf("SELECT DISTINCT vdr_apelido AS apelido, vdr_matricula AS matricula, a.emp_id $query = sprintf("SELECT DISTINCT vdr_apelido AS apelido, vdr_matricula AS matricula, a.emp_id
FROM vds_chamadas a FROM vds_chamadas a
INNER JOIN vds_vendedores b ON a.emp_id = b.emp_id INNER JOIN vds_vendedores b ON a.emp_id = b.emp_id and a.org_id = b.org_id
WHERE chm_data_bilhete >= '%s' AND chm_data_bilhete <= '%s' AND b.emp_id = %s", FormatDtMssql($dataIni), FormatDtMssql($dataFim), $empId); WHERE chm_data_bilhete >= '%s' AND chm_data_bilhete <= '%s' AND b.emp_id = %s and org_id = %d", FormatDtMssql($dataIni), FormatDtMssql($dataFim), $empId, $org_id);
$query .= " ORDER BY apelido"; $query .= " ORDER BY apelido";
} }
$select = $agente ? '' : 'selected="selected"'; $select = $agente ? '' : 'selected="selected"';

36
configGeral.php

@ -147,7 +147,7 @@ if ($idSubProg == CONFIG_BASE_DADOS) {
prm_abandonada_semretorno = {prm_abandonada_semretorno}, prm_max_licenca = {prm_max_licenca}, prm_max_ramal = {prm_max_ramal}, prm_abandonada_semretorno = {prm_abandonada_semretorno}, prm_max_licenca = {prm_max_licenca}, prm_max_ramal = {prm_max_ramal},
prm_normaliza_agenda = {prm_normaliza_agenda}, prm_max_dias_relatorio = {prm_max_dias_relatorio}, prm_ocultar_telefone = {prm_ocultar_telefone}, prm_normaliza_agenda = {prm_normaliza_agenda}, prm_max_dias_relatorio = {prm_max_dias_relatorio}, prm_ocultar_telefone = {prm_ocultar_telefone},
prm_ocultar_email = {prm_ocultar_email}, prm_ocultar_documento = {prm_ocultar_documento}, prm_max_licenca_fixo = {prm_max_licenca_fixo}, prm_relatorio_servico = {prm_relatorio_servico} prm_ocultar_email = {prm_ocultar_email}, prm_ocultar_documento = {prm_ocultar_documento}, prm_max_licenca_fixo = {prm_max_licenca_fixo}, prm_relatorio_servico = {prm_relatorio_servico}
WHERE id = {$_SESSION['prm_id']}"; WHERE id = {$_SESSION['prm_id']} and org_id = $org_id";
} }
$fileLogo = MoveLogo(); $fileLogo = MoveLogo();
@ -247,7 +247,7 @@ if ($idSubProg == CONFIG_BASE_DADOS) {
prm_exige_proto_vendas, prm_bloqueio, prm_bloqueio_data, prm_abandonada_semretorno, prm_max_licenca, prm_exige_proto_vendas, prm_bloqueio, prm_bloqueio_data, prm_abandonada_semretorno, prm_max_licenca,
prm_max_ramal,prm_normaliza_agenda, prm_max_dias_relatorio, prm_ocultar_telefone, prm_ocultar_email, prm_max_ramal,prm_normaliza_agenda, prm_max_dias_relatorio, prm_ocultar_telefone, prm_ocultar_email,
prm_ocultar_documento,prm_max_licenca_fixo, prm_relatorio_servico prm_ocultar_documento,prm_max_licenca_fixo, prm_relatorio_servico
FROM pbx_parametros WHERE id = {$_SESSION['prm_id']}"; FROM pbx_parametros WHERE id = {$_SESSION['prm_id']} and org_id = $org_id";
$result = pg_query($dbcon, $query); $result = pg_query($dbcon, $query);
$dados = @pg_fetch_array($result); $dados = @pg_fetch_array($result);
foreach ($fields as $value) { foreach ($fields as $value) {
@ -295,7 +295,7 @@ if ($idSubProg == CONFIG_BASE_DADOS) {
custom_beep, wrapuptime, prm_agente_nova_janela, prm_label_protoco_pesquisa, prm_label_protoco_texto, prm_label_protoco_grid, prm_alerta_classificacao, prm_use_proto_parceiro, custom_beep, wrapuptime, prm_agente_nova_janela, prm_label_protoco_pesquisa, prm_label_protoco_texto, prm_label_protoco_grid, prm_alerta_classificacao, prm_use_proto_parceiro,
prm_ativa_integracao, prm_select_integracao, prm_aviso_desconnect, prm_link_audio prm_ativa_integracao, prm_select_integracao, prm_aviso_desconnect, prm_link_audio
FROM pbx_parametros FROM pbx_parametros
WHERE id = {$_SESSION['prm_id']}"; WHERE id = {$_SESSION['prm_id']} and org_id = $org_id";
$result = pg_query($dbcon, $query); $result = pg_query($dbcon, $query);
$dados = @pg_fetch_array($result); $dados = @pg_fetch_array($result);
foreach ($fields as $value) { foreach ($fields as $value) {
@ -304,8 +304,8 @@ if ($idSubProg == CONFIG_BASE_DADOS) {
} else { } else {
if (!ExisteRegistro($dbcon, 'pbx_parametros', 'id', '1')) { if (!ExisteRegistro($dbcon, 'pbx_parametros', 'id', '1')) {
$query = "INSERT INTO pbx_parametros $query = "INSERT INTO pbx_parametros
(prm_agente_classifica, prm_agente_atualiza, prm_agente_proto, prm_agente_contribuinte, prm_classifica_municipio, prm_disponivel_fila, prm_boloco_notas_key, prm_exige_classificacao, prm_obs_pausaprod, autologoff, autologoffunavail, endcall, custom_beep, wrapuptime,prm_agente_nova_janela, prm_label_protoco_pesquisa, prm_label_protoco_texto, prm_label_protoco_grid, prm_alerta_classificacao, prm_use_proto_parceiro, prm_ativa_integracao,prm_select_integracao,prm_aviso_desconnect,prm_validacao_protocolo,prm_link_audio) (prm_agente_classifica, prm_agente_atualiza, prm_agente_proto, prm_agente_contribuinte, prm_classifica_municipio, prm_disponivel_fila, prm_boloco_notas_key, prm_exige_classificacao, prm_obs_pausaprod, autologoff, autologoffunavail, endcall, custom_beep, wrapuptime,prm_agente_nova_janela, prm_label_protoco_pesquisa, prm_label_protoco_texto, prm_label_protoco_grid, prm_alerta_classificacao, prm_use_proto_parceiro, prm_ativa_integracao,prm_select_integracao,prm_aviso_desconnect,prm_validacao_protocolo,prm_link_audio, org_id)
VALUES({prm_agente_classifica}, {prm_agente_atualiza}, {prm_agente_proto}, {prm_agente_contribuinte}, '0', {prm_disponivel_fila}, {prm_boloco_notas_key}, '0', '0', {autologoff}, {autologoffunavail}, {endcall}, {custom_beep}, {wrapuptime}, {prm_agente_nova_janela}, {prm_label_protoco_pesquisa}, {prm_label_protoco_texto}, {prm_label_protoco_grid}, {prm_alerta_classificacao}, {prm_use_proto_parceiro},{prm_ativa_integracao},{prm_select_integracao},{prm_aviso_desconnect},{prm_validacao_protocolo},{prm_link_audio})"; VALUES({prm_agente_classifica}, {prm_agente_atualiza}, {prm_agente_proto}, {prm_agente_contribuinte}, '0', {prm_disponivel_fila}, {prm_boloco_notas_key}, '0', '0', {autologoff}, {autologoffunavail}, {endcall}, {custom_beep}, {wrapuptime}, {prm_agente_nova_janela}, {prm_label_protoco_pesquisa}, {prm_label_protoco_texto}, {prm_label_protoco_grid}, {prm_alerta_classificacao}, {prm_use_proto_parceiro},{prm_ativa_integracao},{prm_select_integracao},{prm_aviso_desconnect},{prm_validacao_protocolo},{prm_link_audio}, $org_id)";
} else { } else {
$query = "UPDATE pbx_parametros $query = "UPDATE pbx_parametros
SET prm_agente_classifica = {prm_agente_classifica}, prm_agente_atualiza = {prm_agente_atualiza}, SET prm_agente_classifica = {prm_agente_classifica}, prm_agente_atualiza = {prm_agente_atualiza},
@ -318,7 +318,7 @@ if ($idSubProg == CONFIG_BASE_DADOS) {
prm_label_protoco_grid = {prm_label_protoco_grid}, prm_alerta_classificacao = {prm_alerta_classificacao}, prm_use_proto_parceiro = {prm_use_proto_parceiro}, prm_label_protoco_grid = {prm_label_protoco_grid}, prm_alerta_classificacao = {prm_alerta_classificacao}, prm_use_proto_parceiro = {prm_use_proto_parceiro},
prm_ativa_integracao = {prm_ativa_integracao}, prm_select_integracao = {prm_select_integracao}, prm_aviso_desconnect = {prm_aviso_desconnect}, prm_ativa_integracao = {prm_ativa_integracao}, prm_select_integracao = {prm_select_integracao}, prm_aviso_desconnect = {prm_aviso_desconnect},
prm_validacao_protocolo = {prm_validacao_protocolo}, prm_link_audio = {prm_link_audio} prm_validacao_protocolo = {prm_validacao_protocolo}, prm_link_audio = {prm_link_audio}
WHERE id = {$_SESSION['prm_id']}"; WHERE id = {$_SESSION['prm_id']} and org_$org_id";
} }
foreach ($fields as $value) { foreach ($fields as $value) {
@ -363,7 +363,7 @@ if ($idSubProg == CONFIG_BASE_DADOS) {
if (isset($_GET["idSubProg"])) { if (isset($_GET["idSubProg"])) {
$query = "SELECT id, COALESCE(prm_super_atualiza, 5) AS prm_super_atualiza, $query = "SELECT id, COALESCE(prm_super_atualiza, 5) AS prm_super_atualiza,
prm_super_alerta_atende, prm_super_alerta_pausa, prm_super_alerta_livre, prm_max_agente_pausa, prm_aviso_lgpd_monitoria prm_super_alerta_atende, prm_super_alerta_pausa, prm_super_alerta_livre, prm_max_agente_pausa, prm_aviso_lgpd_monitoria
FROM pbx_parametros WHERE id = {$_SESSION['prm_id']}"; FROM pbx_parametros WHERE id = {$_SESSION['prm_id']} and org_id = $org_id";
$result = pg_query($dbcon, $query); $result = pg_query($dbcon, $query);
$dados = @pg_fetch_array($result); $dados = @pg_fetch_array($result);
foreach ($fields as $value) foreach ($fields as $value)
@ -371,8 +371,8 @@ if ($idSubProg == CONFIG_BASE_DADOS) {
} else { } else {
if (!ExisteRegistro($dbcon, 'pbx_parametros', 'id', '1')) { if (!ExisteRegistro($dbcon, 'pbx_parametros', 'id', '1')) {
$query = "INSERT INTO pbx_parametros $query = "INSERT INTO pbx_parametros
(prm_super_atualiza, prm_super_alerta_atende, prm_super_alerta_pausa, prm_super_alerta_livre, prm_max_agente_pausa, prm_aviso_lgpd_monitoria) (prm_super_atualiza, prm_super_alerta_atende, prm_super_alerta_pausa, prm_super_alerta_livre, prm_max_agente_pausa, prm_aviso_lgpd_monitoria, org_id)
VALUES({prm_super_atualiza}, {prm_super_alerta_atende}, {prm_super_alerta_pausa}, {prm_super_alerta_livre}, {prm_max_agente_pausa}, {prm_aviso_lgpd_monitoria})"; VALUES({prm_super_atualiza}, {prm_super_alerta_atende}, {prm_super_alerta_pausa}, {prm_super_alerta_livre}, {prm_max_agente_pausa}, {prm_aviso_lgpd_monitoria}, $org_id)";
} else { } else {
$query = "UPDATE pbx_parametros $query = "UPDATE pbx_parametros
SET prm_super_atualiza = {prm_super_atualiza}, SET prm_super_atualiza = {prm_super_atualiza},
@ -381,7 +381,7 @@ if ($idSubProg == CONFIG_BASE_DADOS) {
prm_super_alerta_livre = {prm_super_alerta_livre}, prm_super_alerta_livre = {prm_super_alerta_livre},
prm_max_agente_pausa = {prm_max_agente_pausa}, prm_max_agente_pausa = {prm_max_agente_pausa},
prm_aviso_lgpd_monitoria = {prm_aviso_lgpd_monitoria} prm_aviso_lgpd_monitoria = {prm_aviso_lgpd_monitoria}
WHERE id = {$_SESSION['prm_id']}"; WHERE id = {$_SESSION['prm_id']} and org_id = $org_id";
} }
if ($values['prm_super_alerta_pausa'] != $_POST['prm_super_alerta_pausa'] && $_POST['prm_super_alerta_pausa_checkebox']) { if ($values['prm_super_alerta_pausa'] != $_POST['prm_super_alerta_pausa'] && $_POST['prm_super_alerta_pausa_checkebox']) {
@ -422,7 +422,7 @@ if ($idSubProg == CONFIG_BASE_DADOS) {
$fields = array('prm_sk_host', 'prm_sk_port', 'prm_sk_login', 'prm_sk_password', 'prm_sk_host_externo', 'prm_sk_api_centrais'); $fields = array('prm_sk_host', 'prm_sk_port', 'prm_sk_login', 'prm_sk_password', 'prm_sk_host_externo', 'prm_sk_api_centrais');
$values = array(); $values = array();
if (isset($_GET["idSubProg"])) { if (isset($_GET["idSubProg"])) {
$query = "SELECT id, prm_sk_host, prm_sk_port, prm_sk_login, prm_sk_password, prm_sk_host_externo, prm_sk_api_centrais FROM pbx_parametros WHERE id = {$_SESSION['prm_id']}"; $query = "SELECT id, prm_sk_host, prm_sk_port, prm_sk_login, prm_sk_password, prm_sk_host_externo, prm_sk_api_centrais FROM pbx_parametros WHERE id = {$_SESSION['prm_id']} and org_id = $org_id";
$result = pg_query($dbcon, $query); $result = pg_query($dbcon, $query);
$dados = pg_fetch_array($result); $dados = pg_fetch_array($result);
foreach ($fields as $value) { foreach ($fields as $value) {
@ -444,13 +444,13 @@ if ($idSubProg == CONFIG_BASE_DADOS) {
} else { } else {
if (!ExisteRegistro($dbcon, 'pbx_parametros', 'id', '1')) { if (!ExisteRegistro($dbcon, 'pbx_parametros', 'id', '1')) {
$query = "INSERT INTO pbx_parametros $query = "INSERT INTO pbx_parametros
(prm_sk_host, prm_sk_port, prm_sk_login, prm_sk_password, prm_sk_host_externo, prm_sk_api_centrais) (prm_sk_host, prm_sk_port, prm_sk_login, prm_sk_password, prm_sk_host_externo, prm_sk_api_centrais, org_id)
VALUES ({prm_sk_host}, {prm_sk_port}, {prm_sk_login}, {prm_sk_password}, {prm_sk_host_externo}, {prm_sk_api_centrais})"; VALUES ({prm_sk_host}, {prm_sk_port}, {prm_sk_login}, {prm_sk_password}, {prm_sk_host_externo}, {prm_sk_api_centrais}, $org_id)";
} else { } else {
$query = "UPDATE pbx_parametros $query = "UPDATE pbx_parametros
SET prm_sk_host = {prm_sk_host}, prm_sk_port = {prm_sk_port}, prm_sk_login = {prm_sk_login}, SET prm_sk_host = {prm_sk_host}, prm_sk_port = {prm_sk_port}, prm_sk_login = {prm_sk_login},
prm_sk_password = {prm_sk_password}, prm_sk_host_externo = {prm_sk_host_externo}, prm_sk_api_centrais = {prm_sk_api_centrais} prm_sk_password = {prm_sk_password}, prm_sk_host_externo = {prm_sk_host_externo}, prm_sk_api_centrais = {prm_sk_api_centrais}
WHERE id = {$_SESSION['prm_id']}"; WHERE id = {$_SESSION['prm_id']} and org_id = $org_id";
} }
foreach ($fields as $value) { foreach ($fields as $value) {
@ -497,7 +497,7 @@ if ($idSubProg == CONFIG_BASE_DADOS) {
$values = array(); $values = array();
if (isset($_GET["idSubProg"])) { if (isset($_GET["idSubProg"])) {
$query = "SELECT id, prm_sk_host_chat, prm_chat_api, prm_url_meet FROM pbx_parametros WHERE id = {$_SESSION['prm_id']}"; $query = "SELECT id, prm_sk_host_chat, prm_chat_api, prm_url_meet FROM pbx_parametros WHERE id = {$_SESSION['prm_id']} and org_id = $org_id";
$result = pg_query($dbcon, $query); $result = pg_query($dbcon, $query);
$dados = pg_fetch_array($result); $dados = pg_fetch_array($result);
foreach ($fields as $value) { foreach ($fields as $value) {
@ -506,14 +506,14 @@ if ($idSubProg == CONFIG_BASE_DADOS) {
} else { } else {
if (!ExisteRegistro($dbcon, 'pbx_parametros', 'id', '1')) { if (!ExisteRegistro($dbcon, 'pbx_parametros', 'id', '1')) {
$query = "INSERT INTO pbx_parametros $query = "INSERT INTO pbx_parametros
(prm_sk_host_chat, prm_chat_api, prm_url_meet) (prm_sk_host_chat, prm_chat_api, prm_url_meet, org_id)
values({prm_sk_host_chat}, {prm_chat_api}, {prm_url_meet})"; values({prm_sk_host_chat}, {prm_chat_api}, {prm_url_meet}, $org_id)";
} else { } else {
$query = "UPDATE pbx_parametros $query = "UPDATE pbx_parametros
SET prm_sk_host_chat = {prm_sk_host_chat}, SET prm_sk_host_chat = {prm_sk_host_chat},
prm_chat_api = {prm_chat_api}, prm_chat_api = {prm_chat_api},
prm_url_meet = {prm_url_meet} prm_url_meet = {prm_url_meet}
WHERE id = {$_SESSION['prm_id']}"; WHERE id = {$_SESSION['prm_id']} and org_id = $org_id";
} }
foreach ($fields as $value) { foreach ($fields as $value) {

214
contacteFunc.php

@ -26,7 +26,7 @@ function GetDac($dbcon, $codDac, $disableb = "", $incTodos = 0, $soAtivo = 1, $i
if ($isAdm) { if ($isAdm) {
$query = "SELECT DISTINCT id, nome AS nome, 'Receptivo' AS tipo $query = "SELECT DISTINCT id, nome AS nome, 'Receptivo' AS tipo
FROM pbx_queues_grupos d FROM pbx_queues_grupos d
WHERE 1=1 AND org_id IN ($org_id, 0) " . ($soAtivo ? " AND status = 'A' " : "") . " ORDER BY 2"; WHERE 1=1 AND org_id = $org_id " . ($soAtivo ? " AND status = 'A' " : "") . " ORDER BY 2";
} else { } else {
$query = "SELECT DISTINCT d.id, d.nome, 'Receptivo' AS tipo, 'false' AS padrao $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 FROM pbx_usuarios a, pbx_grupo_usuario b, pbx_fila_grupos c, pbx_dacs d
@ -35,7 +35,7 @@ function GetDac($dbcon, $codDac, $disableb = "", $incTodos = 0, $soAtivo = 1, $i
AND c.org_id = d.org_id AND c.org_id = d.org_id
AND c.gp_id = b.gp_id AND c.gp_id = b.gp_id
AND d.id = c.id AND d.id = c.id
AND c.org_id IN ($org_id, 0) AND c.org_id = $org_id
AND lower(a.matricula) = lower('$matricula') " . ($soAtivo ? " and d.status = 'A' " : "") . " order by 1, 2 "; AND lower(a.matricula) = lower('$matricula') " . ($soAtivo ? " and d.status = 'A' " : "") . " order by 1, 2 ";
} }
@ -156,6 +156,9 @@ function GetCombo($dbCon, $query, $codSel, $incTodos = true)
function GetDacAgente($dbcon, $idUser, $codDac, $disableb = "", $getDac = 0) function GetDacAgente($dbcon, $idUser, $codDac, $disableb = "", $getDac = 0)
{ {
$org_id = $_SESSION['SSEmpresaPadrao'];
/* /*
* Carrega lista de dacs por usuarios * Carrega lista de dacs por usuarios
* *
@ -163,9 +166,10 @@ function GetDacAgente($dbcon, $idUser, $codDac, $disableb = "", $getDac = 0)
$query = "select d.id, d.nome $query = "select d.id, d.nome
from pbx_usuarios a, pbx_grupo_usuario b, pbx_fila_grupos c, pbx_dacs d from pbx_usuarios a, pbx_grupo_usuario b, pbx_fila_grupos c, pbx_dacs d
where b.user_id = a.id where b.user_id = a.id
and c.gp_id = b.gp_id and c.gp_id = b.gp_id and c.org_id = d.org_id
and d.id = c.id and d.id = c.id
and a.id = '$idUser' "; and a.id = '$idUser'
c.org_id = $org_id";
/* $query = "select d.id, d.nome /* $query = "select d.id, d.nome
from pbx_dac_usuario u, pbx_dacs d from pbx_dac_usuario u, pbx_dacs d
where d.id = u.id_dac where d.id = u.id_dac
@ -194,9 +198,10 @@ function GetIdDacPadrao($dbcon, $idUser)
{ {
if (IsAdmin()) { if (IsAdmin()) {
return ; return ;
} else {
$query = "select dac_padrao from pbx_usuarios where id = $idUser";
} }
$query = "select dac_padrao from pbx_usuarios where id = $idUser";
$result = pg_query($dbcon, $query); $result = pg_query($dbcon, $query);
$ret = 0; $ret = 0;
@ -209,10 +214,12 @@ function GetIdDacPadrao($dbcon, $idUser)
function SetIdDacPadrao($dbcon, $idUser) function SetIdDacPadrao($dbcon, $idUser)
{ {
$org_id = $_SESSION['SSEmpresaPadrao'];
$query = "SELECT DISTINCT id_dac,nome_dac $query = "SELECT DISTINCT id_dac,nome_dac
FROM pbx_usuarios a FROM pbx_usuarios a
INNER JOIN pbx_usuarios_dacs b ON a.id = b.id_usuario INNER JOIN pbx_usuarios_dacs b ON a.id = b.id_usuario
INNER JOIN pbx_dacs c ON id_dac = c.id INNER JOIN pbx_dacs c ON id_dac = c.id and c.org_id = $org_id
WHERE a.id = $idUser WHERE a.id = $idUser
AND c.status = 'A' AND c.status = 'A'
ORDER BY 1 ORDER BY 1
@ -237,15 +244,18 @@ function GetLoginFromId($dbcon, $idUser)
function GetNomeDacPadrao($dbcon, $idUser) function GetNomeDacPadrao($dbcon, $idUser)
{ {
$org_id = $_SESSION['SSEmpresaPadrao'];
$isAdm = !$idUser && IsAdmin(); $isAdm = !$idUser && IsAdmin();
if ($isAdm) { if ($isAdm) {
$query = "select d.id, d.nome $query = "select d.id, d.nome
from pbx_dacs d from pbx_dacs d
where d.status = 'A' limit 1"; where d.status = 'A' org_id = $org_id limit 1";
} else { } else {
$query = "select b.id, b.nome from pbx_usuarios a, pbx_dacs b where b.id = a.dac_padrao and a.id = '$idUser' $query = "select b.id, b.nome from pbx_usuarios a, pbx_dacs b where b.id = a.dac_padrao and a.id = '$idUser' and b.org_id = $org_id
union union
select b.cmp_id as id, b.cmp_descricao as nome from pbx_usuarios a, pbx_campanha b where b.cmp_id = a.dac_padrao and a.id = '$idUser' "; select b.cmp_id as id, b.cmp_descricao as nome from pbx_usuarios a, pbx_campanha b where b.cmp_id = a.dac_padrao and b.org_id = $org_id and a.id = '$idUser' ";
} }
$result = pg_query($dbcon, $query); $result = pg_query($dbcon, $query);
@ -271,13 +281,16 @@ function GetDacDesc($dbcon, $id)
function GetPausa($dbcon, $mat, $verPausa = false) function GetPausa($dbcon, $mat, $verPausa = false)
{ {
$org_id = $_SESSION['SSEmpresaPadrao'];
/* /*
* Quando $verPausa é definido como true indica que apenas queremos * Quando $verPausa é definido como true indica que apenas queremos
* nos certificar se o agente entrou em pausa. Quando a pausa é ativa- * nos certificar se o agente entrou em pausa. Quando a pausa é ativa-
* da pelo supervisor precisamos alimentar os parametro da sessao cor- * da pelo supervisor precisamos alimentar os parametro da sessao cor-
* rente entao $verPausa é definido como false. * rente entao $verPausa é definido como false.
*/ */
$query = "SELECT count(*) FROM pbx_supervisor_agentes WHERE matricula = '$mat' AND upper(status) = 'PAUSA'"; $query = "SELECT count(*) FROM pbx_supervisor_agentes WHERE matricula = '$mat' AND upper(status) = 'PAUSA' and org_id = $org_id";
$result = pg_query($dbcon, $query); $result = pg_query($dbcon, $query);
$row = @pg_fetch_row($result); $row = @pg_fetch_row($result);
$ret = $row[0]; $ret = $row[0];
@ -293,7 +306,7 @@ function GetPausa($dbcon, $mat, $verPausa = false)
FROM pbx_eventos_agentes a FROM pbx_eventos_agentes a
WHERE matricula = '$mat' WHERE matricula = '$mat'
AND entrada_pausa IS NOT NULL AND entrada_pausa IS NOT NULL
AND id = (SELECT max(id) FROM pbx_eventos_agentes WHERE matricula = a.matricula)"; AND id = (SELECT max(id) FROM pbx_eventos_agentes WHERE matricula = a.matricula and pbx_eventos_agentes.org_id = $org_id) and a.org_id = $org_id";
$result = pg_query($dbcon, $query); $result = pg_query($dbcon, $query);
$row = pg_fetch_row($result); $row = pg_fetch_row($result);
$_SESSION[AGT_ID_PAUSA] = $row[0]; $_SESSION[AGT_ID_PAUSA] = $row[0];
@ -306,7 +319,9 @@ function GetPausa($dbcon, $mat, $verPausa = false)
function GetPausaDescricao($dbcon, $codigo) function GetPausaDescricao($dbcon, $codigo)
{ {
$query = "SELECT motivo FROM pbx_motivos_pausas WHERE id = '$codigo'"; $org_id = $_SESSION['SSEmpresaPadrao'];
$query = "SELECT motivo FROM pbx_motivos_pausas WHERE id = '$codigo' and org_id IN ($org_id, 0)";
$result = pg_query($dbcon, $query); $result = pg_query($dbcon, $query);
$row = pg_fetch_row($result); $row = pg_fetch_row($result);
return $row[0]; return $row[0];
@ -314,7 +329,9 @@ function GetPausaDescricao($dbcon, $codigo)
function GetDacCod($dbcon, $dac) function GetDacCod($dbcon, $dac)
{ {
$query = "SELECT d.id FROM pbx_dacs d WHERE upper(d.nome) = upper('$dac')"; $org_id = $_SESSION['SSEmpresaPadrao'];
$query = "SELECT d.id FROM pbx_dacs d WHERE upper(d.nome) = upper('$dac') and d.org_id IN ($org_id, 0)";
$result = pg_query($dbcon, $query); $result = pg_query($dbcon, $query);
$row = pg_fetch_row($result); $row = pg_fetch_row($result);
$ret = $row[0]; $ret = $row[0];
@ -323,11 +340,13 @@ function GetDacCod($dbcon, $dac)
function GetDacPadraoAgente($dbcon, $getId = true) function GetDacPadraoAgente($dbcon, $getId = true)
{ {
$org_id = $_SESSION['SSEmpresaPadrao'];
$idUser = GetIdUser(); $idUser = GetIdUser();
if (IsAdmin()) if (IsAdmin())
return 0; return 0;
else
$query = "SELECT dac_padrao AS id_dac, b.nome FROM pbx_usuarios a, pbx_dacs b WHERE b.id = a.dac_padrao AND a.id = $idUser "; $query = "SELECT dac_padrao AS id_dac, b.nome FROM pbx_usuarios a, pbx_dacs b WHERE b.id = a.dac_padrao AND a.id = $idUser b.org_id = $org_id";
//echo $query; //echo $query;
$result = pg_query($dbcon, $query); $result = pg_query($dbcon, $query);
$row = @pg_fetch_row($result); $row = @pg_fetch_row($result);
@ -337,7 +356,9 @@ function GetDacPadraoAgente($dbcon, $getId = true)
function GetSiteDesc($dbcon, $id) function GetSiteDesc($dbcon, $id)
{ {
$query = "SELECT d.descricao FROM pbx_sites d WHERE id = $id"; $org_id = $_SESSION['SSEmpresaPadrao'];
$query = "SELECT d.descricao FROM pbx_sites d WHERE id = $id and org_id = $org_id";
$result = pg_query($dbcon, $query); $result = pg_query($dbcon, $query);
$row = pg_fetch_row($result); $row = pg_fetch_row($result);
$ret = $row[0]; $ret = $row[0];
@ -415,13 +436,16 @@ function GetMotivo($dbcon, $codMotivo, $disableb = "", $incTodos = 0, $incTpPaus
function SetPbx($db, $idUser) function SetPbx($db, $idUser)
{ {
$org_id = $_SESSION['SSEmpresaPadrao'];
// //
// Esta funcao retorna true se o usuario tiver algum menu ativado // Esta funcao retorna true se o usuario tiver algum menu ativado
// para pbx // para pbx
$query = "select count(*) $query = "select count(*)
from pbx_grupo_usuario a, pbx_grupo_funcoes b, pbx_funcoes_menu_pbx c from pbx_grupo_usuario a, pbx_grupo_funcoes b, pbx_funcoes_menu_pbx c
where b.gp_id = a.gp_id where b.gp_id = a.gp_id and a.org_id = b.org_id
and c.fun_id = b.fun_id and c.fun_id = b.fun_id and c.org_id = b.org_id
and a.org_id = $org_id
and a.user_id = $idUser"; and a.user_id = $idUser";
@ -709,8 +733,10 @@ function GetMenuAgente($idSub)
function GetRamalSip($dbcon, $ramalAgente) function GetRamalSip($dbcon, $ramalAgente)
{ {
$org_id = $_SESSION['SSEmpresaPadrao'];
//$query = "select dispositivo from pbx_ramais where nome = '$ramalAgente'"; //$query = "select dispositivo from pbx_ramais where nome = '$ramalAgente'";
$query = "select case when( upper(tipo_ramal) = 'KHOMP')then upper(tipo_ramal) || '/r' || nome else dispositivo end as dispositivo from pbx_ramais where nome = '$ramalAgente'"; $query = "select case when( upper(tipo_ramal) = 'KHOMP')then upper(tipo_ramal) || '/r' || nome else dispositivo end as dispositivo from pbx_ramais where nome = '$ramalAgente' and org_id = $org_id";
$result = pg_query($dbcon, $query); $result = pg_query($dbcon, $query);
$row = pg_fetch_row($result); $row = pg_fetch_row($result);
$ret = $row[0]; $ret = $row[0];
@ -719,7 +745,9 @@ function GetRamalSip($dbcon, $ramalAgente)
function GetIdUserFromMatricula($dbcon, $matricula) function GetIdUserFromMatricula($dbcon, $matricula)
{ {
$query = "select id from pbx_usuarios where matricula = '$matricula'"; $org_id = $_SESSION['SSEmpresaPadrao'];
$query = "select id from pbx_usuarios where matricula = '$matricula' and org_id = $org_id";
$result = pg_query($dbcon, $query); $result = pg_query($dbcon, $query);
$row = @pg_fetch_row($result); $row = @pg_fetch_row($result);
$ret = $row[0]; $ret = $row[0];
@ -728,7 +756,9 @@ function GetIdUserFromMatricula($dbcon, $matricula)
function GetAgenteRamais($dbcon, $ramalAgente) function GetAgenteRamais($dbcon, $ramalAgente)
{ {
$query = "select nome, nome from pbx_ramais"; $org_id = $_SESSION['SSEmpresaPadrao'];
$query = "select nome, nome from pbx_ramais and org_id = $org_id";
$result = pg_query($dbcon, $query); $result = pg_query($dbcon, $query);
$codSel = $ramalAgente; $codSel = $ramalAgente;
$ramais = "<select name=\"agtRamal\" id=\"agtRamal\" size=\"1\" $disableb>"; $ramais = "<select name=\"agtRamal\" id=\"agtRamal\" size=\"1\" $disableb>";
@ -763,7 +793,9 @@ function VerificaRamalLogado($db, &$dac, &$agente, $org_id)
function VerificaModoAtendimento($db, $dac) function VerificaModoAtendimento($db, $dac)
{ {
$query = "SELECT modo_atendimento FROM pbx_queues_grupos WHERE id = $dac"; $org_id = $_SESSION['SSEmpresaPadrao'];
$query = "SELECT modo_atendimento FROM pbx_queues_grupos WHERE id = $dac and org_id = $org_id";
$result = pg_query($db, $query); $result = pg_query($db, $query);
$modo = pg_fetch_assoc($result); $modo = pg_fetch_assoc($result);
return $modo['modo_atendimento']; return $modo['modo_atendimento'];
@ -876,7 +908,7 @@ function VerificaMaxAgenteLogado($db, $org_id)
count(*) as num_total_pa, count(*) as num_total_pa,
coalesce(sum((select 1 from pbx_usuarios where matricula = a.matricula and pa_fixo = 0 )),0) + 1 as num_pa_dinamico, coalesce(sum((select 1 from pbx_usuarios where matricula = a.matricula and pa_fixo = 0 )),0) + 1 as num_pa_dinamico,
coalesce(sum((select 1 from pbx_usuarios where matricula = a.matricula and pa_fixo = 1 )),0) + 1 as num_pa_fixo coalesce(sum((select 1 from pbx_usuarios where matricula = a.matricula and pa_fixo = 1 )),0) + 1 as num_pa_fixo
from pbx_supervisor_agentes a"; from pbx_supervisor_agentes a where org_id = $org_id";
$result = pg_query($db, $query); $result = pg_query($db, $query);
$dadosConexao = pg_fetch_assoc($result); $dadosConexao = pg_fetch_assoc($result);
@ -904,10 +936,12 @@ function VerificaAgenteLogadoAstrisk($login)
function IsSupervisor($db) function IsSupervisor($db)
{ {
$org_id = $_SESSION['SSEmpresaPadrao'];
$matricula = GetMatricula(); $matricula = GetMatricula();
$query = "SELECT user_id, gp_id $query = "SELECT user_id, gp_id
FROM pbx_usuarios a FROM pbx_usuarios a
INNER JOIN pbx_grupo_usuario b ON a.id = b.user_id INNER JOIN pbx_grupo_usuario b ON a.id = b.user_id and b.org_id = $org_id
WHERE matricula = '$matricula' WHERE matricula = '$matricula'
AND gp_id = 30"; AND gp_id = 30";
@ -925,7 +959,9 @@ function IsSupervisor($db)
function GetClassificacao($db, $idClas, $dac, $useSelect = 1) function GetClassificacao($db, $idClas, $dac, $useSelect = 1)
{ {
$query = " SELECT clas_id, clas_descricao FROM pbx_classifica_atendimento where clas_status = 1 and clas_id in(select clas_id from pbx_classifica_dacs where id_dac = '$dac' ) order by 2"; $org_id = $_SESSION['SSEmpresaPadrao'];
$query = " SELECT clas_id, clas_descricao FROM pbx_classifica_atendimento where org_id = $org_id and clas_status = 1 and clas_id in (select clas_id from pbx_classifica_dacs where id_dac = '$dac' and org_id = $org_id) order by 2";
$result = pg_query($db, $query); $result = pg_query($db, $query);
if (!$result) { if (!$result) {
@ -959,7 +995,9 @@ function GetClassificacao($db, $idClas, $dac, $useSelect = 1)
function GetItem($db, $idClas, $idItem, $useSelect = 1) function GetItem($db, $idClas, $idItem, $useSelect = 1)
{ {
$query = " SELECT clit_id, clit_descricao FROM pbx_classifica_item where clas_id = $idClas and clit_status = 1 order by 2"; $org_id = $_SESSION['SSEmpresaPadrao'];
$query = "SELECT clit_id, clit_descricao FROM pbx_classifica_item where clas_id = $idClas and clit_status = 1 and org_id = $org_id order by 2";
$result = pg_query($db, $query); $result = pg_query($db, $query);
$clas = $useSelect ? "<select name=\"listaItem\" style=\"width:250px;\">" : ""; $clas = $useSelect ? "<select name=\"listaItem\" style=\"width:250px;\">" : "";
@ -1015,20 +1053,23 @@ function GetEmpresa()
function GetAgentes($dbcon, $codSel, $idDac, $query = "") function GetAgentes($dbcon, $codSel, $idDac, $query = "")
{ {
$org_id = $_SESSION['SSEmpresaPadrao'];
//carrega Atendente //carrega Atendente
$codSel = ((!$_SESSION["listaAgente"]) || ($trocaDac)) ? 0 : $_SESSION["listaAgente"]; $codSel = ((!$_SESSION["listaAgente"]) || ($trocaDac)) ? 0 : $_SESSION["listaAgente"];
$sel = !$codSel ? "selected" : ""; $sel = !$codSel ? "selected" : "";
$agentes = "<select name=\"listaAgente\" id=\"listaAgente\" size=\"1\">"; $agentes = "<select name=\"listaAgente\" id=\"listaAgente\" size=\"1\">";
$agentes .= "<option value=\"0\" $sel>Todos</option>"; $agentes .= "<option value=\"0\" $sel>Todos</option>";
$dac = $idDac ? " and fila = (select nome from pbx_dacs where id = $idDac )" : ""; $dac = $idDac ? " and fila = (select nome from pbx_dacs where id = $idDac and org_id = $org_id )" : "";
if (empty($query)) { if (empty($query)) {
$query = "select matricula, nome $query = "select matricula, nome
from pbx_usuarios u from pbx_usuarios u
inner join pbx_organizacao_usuarios pou ON pou.id_usuario = u.id and pou.id_organizacao = $org_id
where exists(select '' from pbx_eventos_dacs where exists(select '' from pbx_eventos_dacs
where substring(agente, 7, 4) = u.matricula where substring(agente, 7, 4) = u.matricula
$dac ) $dac and org_id = $org_id)
order by 2"; order by 2";
} }
@ -1072,12 +1113,14 @@ function GetTodosAgentes($dbcon, $codSel, $incTodos = 1, $sql = '')
function GetTodasContas($dbcon, $codSel) function GetTodasContas($dbcon, $codSel)
{ {
$org_id = $_SESSION['SSEmpresaPadrao'];
$sel = !$codSel ? "selected" : ""; $sel = !$codSel ? "selected" : "";
$agentes = "<select name=\"listaAgente\" id=\"listaAgente\" size=\"1\">"; $agentes = "<select name=\"listaAgente\" id=\"listaAgente\" size=\"1\">";
//$agentes .= "<option value=\"0\" $sel>Todos</option>"; //$agentes .= "<option value=\"0\" $sel>Todos</option>";
$result = pg_query($dbcon, "select matricula, apelido as nome from pbx_usuarios_cs u order by 2"); $result = pg_query($dbcon, "select matricula, apelido as nome from pbx_usuarios_cs u where org_id = $org_id order by 2");
while ($dados = pg_fetch_row($result)) { while ($dados = pg_fetch_row($result)) {
if ($codSel == $dados[0]) { if ($codSel == $dados[0]) {
@ -1109,7 +1152,9 @@ function GetFileAgente()
function GetUsuario($dbcon, $matricula) function GetUsuario($dbcon, $matricula)
{ {
$query = "SELECT id, nome, apelido, matricula, email FROM pbx_usuarios WHERE matricula = '{$matricula}'"; $org_id = $_SESSION['SSEmpresaPadrao'];
$query = "SELECT id, nome, apelido, matricula, email FROM pbx_usuarios pu INNER JOIN pbx_organizacao_usuarios pou ON pu.id = pou.id_usuario and pou.id_organizacao = $org_id WHERE matricula = '{$matricula}'";
$result = pg_query($dbcon, $query); $result = pg_query($dbcon, $query);
$data = pg_fetch_assoc($result); $data = pg_fetch_assoc($result);
return $data; return $data;
@ -1127,9 +1172,12 @@ function VerificaCharFinal($str, $ch = "/")
function GetHeadMenu($db) function GetHeadMenu($db)
{ {
$org_id = $_SESSION['SSEmpresaPadrao'];
$query = "select fun_id, fun_nome, fun_menu, fun_menu_text, fun_menu_url, fun_menu_img, fun_id_pai $query = "select fun_id, fun_nome, fun_menu, fun_menu_text, fun_menu_url, fun_menu_img, fun_id_pai
from pbx_funcoes from pbx_funcoes
where fun_id_pai is null where fun_id_pai is null
and org_id = $org_id
order by 4"; order by 4";
$head = array(); $head = array();
$result = pg_query($db, $query); $result = pg_query($db, $query);
@ -1140,11 +1188,13 @@ function GetHeadMenu($db)
function GetSites($dbcon, $codSite, $disableb = "") function GetSites($dbcon, $codSite, $disableb = "")
{ {
$org_id = $_SESSION['SSEmpresaPadrao'];
/* /*
* Carrega lista de dacs disponivel * Carrega lista de dacs disponivel
* para ser inserdo entre as tags <select></select> * para ser inserdo entre as tags <select></select>
*/ */
$query = "select id, descricao from pbx_sites where status = 1 order by upper(descricao)"; $query = "select id, descricao from pbx_sites where status = 1 order by upper(descricao) and org_id = $org_id";
$result = pg_query($dbcon, $query); $result = pg_query($dbcon, $query);
$codSel = $codSite; $codSel = $codSite;
$site = "<select name=\"listaSites\" id=\"listaSites\" size=\"1\" $disableb onchange=\"submit()\">"; $site = "<select name=\"listaSites\" id=\"listaSites\" size=\"1\" $disableb onchange=\"submit()\">";
@ -1247,7 +1297,9 @@ function GetDeptos($dbcon, $empresa, $depto, $disableb = "", $incTodos = 0, $use
function GetDefCodEmpresa($dbcon) function GetDefCodEmpresa($dbcon)
{ {
$query = "select min(id) from pbx_empresa"; $org_id = $_SESSION['SSEmpresaPadrao'];
$query = "select min(id) from pbx_empresa where org_id = $org_id";
$result = pg_query($dbcon, $query); $result = pg_query($dbcon, $query);
$dados = @pg_fetch_row($result); $dados = @pg_fetch_row($result);
return $dados[0]; return $dados[0];
@ -1255,27 +1307,29 @@ function GetDefCodEmpresa($dbcon)
function __GetProto__($db) function __GetProto__($db)
{ {
$org_id = $_SESSION['SSEmpresaPadrao'];
//registra o protocolo para o id corrente //registra o protocolo para o id corrente
$mat = GetMatricula(); $mat = GetMatricula();
$query = "select uniqueid from pbx_supervisor_agentes where matricula = '$mat'"; $query = "select uniqueid from pbx_supervisor_agentes where matricula = '$mat' and org_id = $org_id";
$result = pg_query($db, $query); $result = pg_query($db, $query);
$row = pg_fetch_row($result); $row = pg_fetch_row($result);
$uniqueId = $row[0]; $uniqueId = $row[0];
//Geraprotocolo //Geraprotocolo
$anoAtu = date('Y'); $anoAtu = date('Y');
$query = "select max(numProto) from pbx_protocolo_reg where ano = '$anoAtu'"; $query = "select max(numProto) from pbx_protocolo_reg where ano = '$anoAtu' and org_id = $org_id";
$result = pg_query($db, $query); $result = pg_query($db, $query);
$row = pg_fetch_row($result); $row = pg_fetch_row($result);
$numProto = $row[0] ? $row[0] + 1 : 1; $numProto = $row[0] ? $row[0] + 1 : 1;
$proto = $anoAtu . str_pad($numProto, 6, '0', STR_PAD_LEFT); $proto = $anoAtu . str_pad($numProto, 6, '0', STR_PAD_LEFT);
$query = "insert into pbx_protocolo_reg(uniqueid, ano, numProto, protocolo) $query = "insert into pbx_protocolo_reg(uniqueid, ano, numProto, protocolo, org_id)
select '$uniqueId', $anoAtu, $numProto, $proto where not exists(select '' from pbx_protocolo_reg where uniqueid = '$uniqueId')"; select '$uniqueId', $anoAtu, $numProto, $proto, org_id where not exists(select '' from pbx_protocolo_reg where uniqueid = '$uniqueId' and org_id = $org_id)";
$result = pg_query($db, $query); $result = pg_query($db, $query);
if (pg_affected_rows($result) == 0) { if (pg_affected_rows($result) == 0) {
$query = "select ano, numProto from pbx_protocolo_reg where uniqueid = '$uniqueId'"; $query = "select ano, numProto from pbx_protocolo_reg where uniqueid = '$uniqueId' and org_id = $org_id";
$result = pg_query($db, $query); $result = pg_query($db, $query);
$row = pg_fetch_row($result); $row = pg_fetch_row($result);
$proto = trim($row[0]) . "-" . trim(str_pad($row[1], 6, '0', STR_PAD_LEFT)); $proto = trim($row[0]) . "-" . trim(str_pad($row[1], 6, '0', STR_PAD_LEFT));
@ -1498,11 +1552,14 @@ function GetTipoIdentificaDesc($tpIdent)
function GetRelacionaEventos($db, $matricula) function GetRelacionaEventos($db, $matricula)
{ {
$org_id = $_SESSION['SSEmpresaPadrao'];
//and cast(login as date) = cast(now as date) //and cast(login as date) = cast(now as date)
$query = "select relaciona_eventos from pbx_eventos_agentes a $query = "select relaciona_eventos from pbx_eventos_agentes a
where matricula = '$matricula' where matricula = '$matricula'
and login is not null and login is not null
and login = (select max(login) from pbx_eventos_agentes where matricula = a.matricula)"; and login = (select max(login) from pbx_eventos_agentes where matricula = a.matricula and org_id = $org_id)
and org_id = $org_id";
$result = pg_query($db, $query); $result = pg_query($db, $query);
if ($result) { if ($result) {
@ -1515,7 +1572,9 @@ function GetRelacionaEventos($db, $matricula)
function SetHosts($dbcon) function SetHosts($dbcon)
{ {
$query = "select id, descricao, host, usuario, senha, basedados, porta from pbx_sites "; $org_id = $_SESSION['SSEmpresaPadrao'];
$query = "select id, descricao, host, usuario, senha, basedados, porta from pbx_sites where org_id = $org_id ";
$result = pg_query($dbcon, $query); $result = pg_query($dbcon, $query);
$hosts = array(); $hosts = array();
@ -1615,9 +1674,11 @@ function GetGrupoRamais($dbcon, $codSel)
function GetGrupoId($dbcon) function GetGrupoId($dbcon)
{ {
$org_id = $_SESSION['SSEmpresaPadrao'];
$id = array(); $id = array();
$query = "SELECT DISTINCT gp_id FROM pbx_grupo_usuario "; $query = "SELECT DISTINCT gp_id FROM pbx_grupo_usuario ";
$query .= GetIdUser() ? " WHERE user_id = " . GetIdUser() : ''; $query .= GetIdUser() ? " WHERE org_id = $org_id and user_id = " . GetIdUser() : "where org_id = $org_id";
$query .= ' ORDER BY gp_id'; $query .= ' ORDER BY gp_id';
$result = pg_query($dbcon, $query); $result = pg_query($dbcon, $query);
$data = pg_fetch_all($result); $data = pg_fetch_all($result);
@ -1683,7 +1744,9 @@ function GetCentroCusto($dbcon, $codSel)
function GetUserFromConta($dbcon, $matricula, $incMatricula = 0) function GetUserFromConta($dbcon, $matricula, $incMatricula = 0)
{ {
$query = "select matricula, apelido from pbx_cs_usuarios where matricula = '$matricula' "; $org_id = $_SESSION['SSEmpresaPadrao'];
$query = "select matricula, apelido from pbx_cs_usuarios where matricula = '$matricula' and org_id = $org_id";
$result = pg_query($dbcon, $query); $result = pg_query($dbcon, $query);
if (!$result) { if (!$result) {
$nome = 'Não foi possível realizar a operação!'; $nome = 'Não foi possível realizar a operação!';
@ -1744,7 +1807,9 @@ function GetMotivoLogin($db)
function GetMotivoDef($db) function GetMotivoDef($db)
{ {
$query = "select min(id) from pbx_motivos_pausas where upper(motivo) not in('LOGIN','AUSENTE', 'RECUSADA')"; $org_id = $_SESSION['SSEmpresaPadrao'];
$query = "select min(id) from pbx_motivos_pausas where upper(motivo) not in('LOGIN','AUSENTE', 'RECUSADA') and org_id IN ($org_id, 0)";
$result = pg_query($db, $query); $result = pg_query($db, $query);
$row = @pg_fetch_array($result); $row = @pg_fetch_array($result);
return $row[0]; return $row[0];
@ -1828,8 +1893,10 @@ function MascaraDisp()
function GetTroncosDisponiveis($dbcon) function GetTroncosDisponiveis($dbcon)
{ {
$org_id = $_SESSION['SSEmpresaPadrao'];
$arBuff = array(); $arBuff = array();
$query = "select id, nome, tipo from pbx_troncos "; $query = "select id, nome, tipo from pbx_troncos and org_id = $org_id";
$result = pg_query($dbcon, $query); $result = pg_query($dbcon, $query);
@ -1847,7 +1914,9 @@ function GetIdResult($result)
function GetAudio($dbcon, $codSel) function GetAudio($dbcon, $codSel)
{ {
$query = "select nome from pbx_musichold_grupos"; $org_id = $_SESSION['SSEmpresaPadrao'];
$query = "select nome from pbx_musichold_grupos where org_id = $org_id";
$result = pg_query($dbcon, $query); $result = pg_query($dbcon, $query);
$ret = '<select name="cmp_audio" style="width:500px">'; $ret = '<select name="cmp_audio" style="width:500px">';
$ret .= "<option value=\"0\">--------------</option>"; $ret .= "<option value=\"0\">--------------</option>";
@ -1900,9 +1969,11 @@ function GetFormatoAudio($codSel, $nomeCampo = 'cmp_formato_gravacao')
function GetStatusCampanha($dbcon, $codSel, $desabStatus, $filtro = "") function GetStatusCampanha($dbcon, $codSel, $desabStatus, $filtro = "")
{ {
$org_id = $_SESSION['SSEmpresaPadrao'];
$desab = $desabStatus ? "disabled" : ""; $desab = $desabStatus ? "disabled" : "";
$filtro = $filtro ? " and cpst_id not in($filtro) " : ""; $filtro = $filtro ? " and cpst_id not in($filtro) " : "";
$query = "select cpst_id as id, cpst_nome as nome from pbx_campanha_status where cpst_status = 1 $filtro order by 2"; $query = "select cpst_id as id, cpst_nome as nome from pbx_campanha_status where org_id = $org_id and cpst_status = 1 $filtro order by 2";
//if(IsAdmin()) echo $query; //if(IsAdmin()) echo $query;
$result = pg_query($dbcon, $query); $result = pg_query($dbcon, $query);
@ -1927,7 +1998,9 @@ function GetStatusCampanha($dbcon, $codSel, $desabStatus, $filtro = "")
function GetCofigPadrao($dbcon) function GetCofigPadrao($dbcon)
{ {
$query = "SELECT * FROM pbx_conf_padrao"; $org_id = $_SESSION['SSEmpresaPadrao'];
$query = "SELECT * FROM pbx_conf_padrao where org_id = $org_id";
$result = pg_query($dbcon, $query); $result = pg_query($dbcon, $query);
$dados = pg_fetch_array($result); $dados = pg_fetch_array($result);
@ -1940,6 +2013,8 @@ function GetCofigPadrao($dbcon)
function GravaCampanha($dbcon) function GravaCampanha($dbcon)
{ {
$org_id = $_SESSION['SSEmpresaPadrao'];
$caminho_producao = $_SESSION[CONF_PADRAO_CAMINHO_PRODUCAO]; $caminho_producao = $_SESSION[CONF_PADRAO_CAMINHO_PRODUCAO];
$arq = $caminho_producao . "extensions_campanha.conf"; $arq = $caminho_producao . "extensions_campanha.conf";
$escreve = fopen($arq, 'w+'); $escreve = fopen($arq, 'w+');
@ -1947,7 +2022,7 @@ function GravaCampanha($dbcon)
if (!$escreve) if (!$escreve)
throw new Exception("Não foi possível abrir o arquivo $caminho_producao\"extensions_campanha.conf\""); throw new Exception("Não foi possível abrir o arquivo $caminho_producao\"extensions_campanha.conf\"");
$query = "select cmp_id, cmp_numero,cmp_descricao, cmp_formato_gravacao, cmp_habilitar_gravacao, cmp_status, cmp_qt_tronco_pa from pbx_campanha where cmp_status not in(0)"; $query = "select cmp_id, cmp_numero,cmp_descricao, cmp_formato_gravacao, cmp_habilitar_gravacao, cmp_status, cmp_qt_tronco_pa from pbx_campanha where org_id = $org_id and cmp_status not in(0)";
$result = pg_query($dbcon, $query); $result = pg_query($dbcon, $query);
if (!$result) if (!$result)
@ -2054,7 +2129,7 @@ function GravaCampanha($dbcon)
if (!$escreve) if (!$escreve)
throw new Exception("Não foi possível acessar o arquivo \"extensions_transfere_campanha.conf\"!"); throw new Exception("Não foi possível acessar o arquivo \"extensions_transfere_campanha.conf\"!");
$query = "select cmp_id, cmp_numero from pbx_campanha where cmp_status not in(0)"; $query = "select cmp_id, cmp_numero from pbx_campanha where org_id = $org_id and cmp_status not in(0)";
$result = pg_query($dbcon, $query); $result = pg_query($dbcon, $query);
if (!$result) if (!$result)
@ -2089,7 +2164,7 @@ function GravaCampanha($dbcon)
throw new Exception("Não foi possível acessar o arquivo \"queues_campanha.conf\"!"); throw new Exception("Não foi possível acessar o arquivo \"queues_campanha.conf\"!");
$query = "select cmp_id, cmp_descricao, cmp_estrategia_distribuicao, cmp_formato_gravacao, cmp_habilitar_gravacao from pbx_campanha where cmp_status not in(0)"; $query = "select cmp_id, cmp_descricao, cmp_estrategia_distribuicao, cmp_formato_gravacao, cmp_habilitar_gravacao from pbx_campanha where org_id = $org_id and cmp_status not in(0)";
$result = pg_query($dbcon, $query); $result = pg_query($dbcon, $query);
if (!$result) if (!$result)
@ -2144,12 +2219,14 @@ function GravaCampanha($dbcon)
if (!$escreve) if (!$escreve)
throw new Exception("Não foi possível acessar o arquivo \"extensions_rotas_saida_campanha.conf\"!"); throw new Exception("Não foi possível acessar o arquivo \"extensions_rotas_saida_campanha.conf\"!");
$query = "select cmp_id, cmp_descricao, cmp_estrategia_distribuicao, cmp_formato_gravacao, cmp_habilitar_gravacao from pbx_campanha where cmp_status not in(0)"; $query = "select cmp_id, cmp_descricao, cmp_estrategia_distribuicao, cmp_formato_gravacao, cmp_habilitar_gravacao from pbx_campanha where org_id = $org_id and cmp_status not in(0)";
$queryModelo = "select cpmd_id, cmp_id, cpmd_modelo, cpmd_recorte, cpmd_acrescenta from pbx_campanha_modelos where cmp_id = '%s' "; $queryModelo = "select cpmd_id, cmp_id, cpmd_modelo, cpmd_recorte, cpmd_acrescenta from pbx_campanha_modelos where org_id = $org_id and cmp_id = '%s' ";
$queryTronco = "select a.cptr_id, a.cmp_id, a.cpmd_id, a.cptr_tronco, a.cptr_nome_tronco, $queryTronco = "select a.cptr_id, a.cmp_id, a.cpmd_id, a.cptr_tronco, a.cptr_nome_tronco,
b.tipo, b.username b.tipo, b.username
from pbx_campanha_troncos a, pbx_troncos b from pbx_campanha_troncos a, pbx_troncos b
where b.id = a.cptr_tronco where b.id = a.cptr_tronco
and a.org_id = b.org_id
and a.org_id = $org_id
and a.cpmd_id = '%s' order by a.cptr_tronco"; and a.cpmd_id = '%s' order by a.cptr_tronco";
$result = pg_query($dbcon, $query); $result = pg_query($dbcon, $query);
@ -2244,6 +2321,8 @@ function GravaCampanha($dbcon)
function SetAgente($db) function SetAgente($db)
{ {
$org_id = $_SESSION['SSEmpresaPadrao'];
$idUser = GetIdUser(); $idUser = GetIdUser();
$query = "select $query = "select
case when( case when(
@ -2254,6 +2333,8 @@ function SetAgente($db)
and c.matricula = b.matricula and c.matricula = b.matricula
and d.cmp_id = c.cmp_id and d.cmp_id = c.cmp_id
and a.user_id = u.id and a.user_id = u.id
and a.org_id = d.org_id
and a.org_id = $org_id
) > 0 ) > 0
)then 1 else 0 end as campanha, )then 1 else 0 end as campanha,
case when( case when(
@ -2263,9 +2344,13 @@ function SetAgente($db)
where b.gp_id = a.gp_id where b.gp_id = a.gp_id
and c.id = b.id and c.id = b.id
and a.user_id = u.id and a.user_id = u.id
and a.org_id = b.org_id
and a.org_id = c.org_id
and a.org_id = $org_id
) > 0 ) > 0
)then 1 else 0 end as fila )then 1 else 0 end as fila
from pbx_usuarios u from pbx_usuarios u
inner join pbx_organizacao_usuarios pou ON pou.id_usuario = u.id and pou.id_organizacao = $org_id
where u.id = '$idUser' "; where u.id = '$idUser' ";
@ -2276,7 +2361,9 @@ function SetAgente($db)
function IncluiAgenteFile($dbcon) function IncluiAgenteFile($dbcon)
{ {
$query = "select matricula, apelido from pbx_usuarios where delete_ = 0"; $org_id = $_SESSION['SSEmpresaPadrao'];
$query = "select matricula, apelido from pbx_usuarios pu inner join pbx_organizacao_usuarios pou ON pou.id_usuarios = pu.id and pou.id_organizacao = $org_id where delete_ = 0";
$result = pg_query($dbcon, $query); $result = pg_query($dbcon, $query);
if (!$result) { if (!$result) {
@ -2304,10 +2391,14 @@ function IncluiAgenteFile($dbcon)
function GetListaCampanha($dbcon, $idCamp, $listId, $dtIni = '', $dtFim = '') function GetListaCampanha($dbcon, $idCamp, $listId, $dtIni = '', $dtFim = '')
{ {
$org_id = $_SESSION['SSEmpresaPadrao'];
$query = "select distinct a.list_id, a.list_nome || ' [' || a.list_id::text || ']' as list_nome $query = "select distinct a.list_id, a.list_nome || ' [' || a.list_id::text || ']' as list_nome
from pbx_campanha_lista a, pbx_campanha_contato_fone b where b.cmp_id = a.cmp_id from pbx_campanha_lista a, pbx_campanha_contato_fone b where b.cmp_id = a.cmp_id
and b.list_id = a.list_id and b.list_id = a.list_id
and b.cmp_id = $idCamp\n"; and b.cmp_id = $idCamp
and a.org_id = b.org_id
and a.org_id = $org_id\n";
if ($dtIni) if ($dtIni)
$query .= "and b.conf_data::date >= '$dtIni'\n"; $query .= "and b.conf_data::date >= '$dtIni'\n";
if ($dtIni) if ($dtIni)
@ -2337,7 +2428,9 @@ function GetListaCampanha($dbcon, $idCamp, $listId, $dtIni = '', $dtFim = '')
function GetCampanhaRetorno($dbcon, $codDac = -1, $matricula = 0, $size = 12, $mult = 1, $disableb = "") function GetCampanhaRetorno($dbcon, $codDac = -1, $matricula = 0, $size = 12, $mult = 1, $disableb = "")
{ {
$query = " select distinct cmp_id as id, cmp_descricao as nome from pbx_campanha where 1=1 order by 2 ";
$org_id = $_SESSION['SSEmpresaPadrao'];
$query = " select distinct cmp_id as id, cmp_descricao as nome from pbx_campanha where 1=1 and org_id = $org_id order by 2 ";
$result = pg_query($dbcon, $query); $result = pg_query($dbcon, $query);
$codSel = $codDac; $codSel = $codDac;
@ -2367,6 +2460,7 @@ function GetCampanhas($dbcon, $codDac = -1, $matricula = 0, $dataIni = '', $data
* Carrega lista de dacs disponivel * Carrega lista de dacs disponivel
* para ser inserdo entre as tags <select></select> * para ser inserdo entre as tags <select></select>
*/ */
$org_id = $_SESSION['SSEmpresaPadrao'];
$size = 1; $size = 1;
$mult = 0; $mult = 0;
$disableb = ""; $disableb = "";
@ -2387,17 +2481,17 @@ function GetCampanhas($dbcon, $codDac = -1, $matricula = 0, $dataIni = '', $data
if ($isAdm) { if ($isAdm) {
$query = " select distinct cmp_id as id, cmp_descricao as nome, 'A' as tipo, false as padrao from pbx_campanha a where 1=1 " . ($soAtivo ? " and cmp_status <> '0' " : "") . $query = " select distinct cmp_id as id, cmp_descricao as nome, 'A' as tipo, false as padrao from pbx_campanha a where 1=1 and org_id = $org_id " . ($soAtivo ? " and cmp_status <> '0' " : "") .
" and cmp_id in(select cmp_id from pbx_campanha_contato_fone where conf_data::date >= '$dtIni' and conf_data::date <= '$dtFim' and cmp_id = a.cmp_id) order by 3 desc, 4 desc, 2 asc "; " and cmp_id in(select cmp_id from pbx_campanha_contato_fone where org_id = $org_id and conf_data::date >= '$dtIni' and conf_data::date <= '$dtFim' and cmp_id = a.cmp_id) order by 3 desc, 4 desc, 2 asc ";
// echo $query; // echo $query;
} else { } else {
$query = "select distinct cmp_id as id, cmp_descricao as nome, 'A' as tipo, 'false' as padrao from pbx_campanha a where 1=1 and cmp_status <> '0' $query = "select distinct cmp_id as id, cmp_descricao as nome, 'A' as tipo, 'false' as padrao from pbx_campanha a where 1=1 org_id = $org_id and cmp_status <> '0'
and exists( and exists(
select '' select ''
from pbx_campanha_usuarios b from pbx_campanha_usuarios b
where matricula = '$matricula' where matricula = '$matricula' and b.org_id = $org_id
) )
and exists(select '' from pbx_campanha_contato_fone where conf_data::date >= '$dtIni' and conf_data::date <= '$dtFim' and cmp_id = a.cmp_id) and exists(select '' from pbx_campanha_contato_fone where org_id = $org_id and conf_data::date >= '$dtIni' and conf_data::date <= '$dtFim' and cmp_id = a.cmp_id)
order by 1, 2 "; order by 1, 2 ";
} }

5
dacConsulta.php

@ -18,12 +18,13 @@ $tpl = 'dacConsulta.tpl';
$linha = ""; $linha = "";
$imgNovo = "<img src=\"imgSite/novoUser.png\" width=\"16\" height=\"16\" border=\"0\" title=\"Inclui novo Dac\">"; $imgNovo = "<img src=\"imgSite/novoUser.png\" width=\"16\" height=\"16\" border=\"0\" title=\"Inclui novo Dac\">";
$imgNovo = "<a href=\"javaScript:NovaJanela('index.php?idProg=25&idDac=0', 'dacCad', '$janW', '$janH', 'resizable=NO,scrollbars=NO');\">$imgNovo</a>"; $imgNovo = "<a href=\"javaScript:NovaJanela('index.php?idProg=25&idDac=0', 'dacCad', '$janW', '$janH', 'resizable=NO,scrollbars=NO');\">$imgNovo</a>";
$org_id = $_SESSION['SSEmpresaPadrao'];
if (isset($_POST["btConsulta"]) && !empty($_POST["txtConsulta"])) { if (isset($_POST["btConsulta"]) && !empty($_POST["txtConsulta"])) {
$query = "select * from pbx_dacs where dacStatus = 0 and upper(nome) like upper('%" . $_POST["txtConsulta"] . "%') order by nome"; $query = "select * from pbx_dacs where org_id = $org_id and dacStatus = 0 and upper(nome) like upper('%" . $_POST["txtConsulta"] . "%') order by nome";
$param = $_POST["txtConsulta"]; $param = $_POST["txtConsulta"];
} else { } else {
$query = "select * from pbx_dacs where dacStatus = 0 order by nome"; $query = "select * from pbx_dacs where org_id = $org_id and dacStatus = 0 order by nome";
} }
$result = pg_query($dbcon, $query); $result = pg_query($dbcon, $query);

Loading…
Cancel
Save