Browse Source

Colocar org_id nas querys

1.9
bruno 2 months ago
parent
commit
86c9559286
  1. 6
      agente/agentert.php
  2. 2
      audio.php

6
agente/agentert.php

@ -733,6 +733,7 @@ function GetPendenciaDiscador($db, $silent = false)
and b.cmpo_status in(0, 2)
and a.conf_discado = 1
and a.conf_status = '0'
and a.org_id = b.org_id
and a.org_id IN ($org_id, 0)";
if (RegistroInc($db, $query)) {
if ($silent) {
@ -1211,6 +1212,7 @@ function EntraPausa($db, $codMotivo)
$ramal = GetRamalMonitorar(RAMAL_MONITOR_AGENTE);
$motivoPausa = @GetPausaDescricao($db, $codMotivo);
$pausa_produtiva_obs = NullDb(trim($_POST['pausa_produtiva_obs']));
$org_id = $_SESSION['SSEmpresaPadrao'];
$emPausa = GetPausa($db, $matricula, true);
$inTran = 0;
@ -1228,7 +1230,7 @@ function EntraPausa($db, $codMotivo)
GetExcept("Falha ao colocar o agente em pausa na central!");
}
$query = "SELECT canal, canal_transfer, canal_agente, ramal, nome, dac, uniqueid, status FROM pbx_supervisor_agentes WHERE matricula = '$matricula'";
$query = "SELECT canal, canal_transfer, canal_agente, ramal, nome, dac, uniqueid, status FROM pbx_supervisor_agentes WHERE matricula = '$matricula' and org_id = $org_id";
$result = pg_query($db, $query);
if ($result) {
$row = @pg_fetch_array($result);
@ -1249,7 +1251,7 @@ function EntraPausa($db, $codMotivo)
*/
$query = "update pbx_supervisor_agentes
set status = 'PAUSA', motivo_pausa = '$motivoPausa', duracao = now(), origem_destino = ''
where matricula = '$matricula' and status <> 'PAUSA' ";
where matricula = '$matricula' and status <> 'PAUSA' and org_id = $org_id";
$result = pg_query($db, $query);
$result = $result && pg_affected_rows($result);
if (!$result) {

2
audio.php

@ -283,7 +283,7 @@
if ((($tipo == 1) or ( $tipo == 2)) && !($getAgt || $getClass || $getItem)) {
$query = "DROP TABLE IF EXISTS tmp_restricao_ramal$org_id;
CREATE TEMPORARY TABLE tmp_restricao_ramal AS
CREATE TEMPORARY TABLE tmp_restricao_ramal$org_id 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}' and x.org_id = y.org_id and x.org_id = $org_id;
CREATE INDEX \"tmpRestricaoRamalNome\" on tmp_restricao_ramal$org_id(nome);\n\n";
$query .= "DROP TABLE IF EXISTS tmp_restricao_sigame$org_id;

Loading…
Cancel
Save