|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
$tpLayout = 1;
|
|
|
|
|
$idCont = $_GET["idContato"];
|
|
|
|
|
$identificador = $_GET["identificador"];
|
|
|
|
|
$idCamp = $_GET["idCamp"];
|
|
|
|
|
$idLista = $_GET["idLista"];
|
|
|
|
|
$nomeTpl = "supervisao/EncerraContatoCampanha.tpl";
|
|
|
|
|
$ListaStatus = GetStatusDiscador(0);
|
|
|
|
|
|
|
|
|
|
$query = "select status, nome from pbx_supervisor_agentes where matricula = (select matricula from pbx_campanha_operacao where cmp_id = $idCamp and list_id = $idLista and cont_id = $idCont)";
|
|
|
|
|
//echo $query;
|
|
|
|
|
$result = @pg_query($dbcon, $query);
|
|
|
|
|
|
|
|
|
|
$dados = pg_fetch_array($result);
|
|
|
|
|
|
|
|
|
|
$agenteStatus = $dados["status"];
|
|
|
|
|
$agenteNome = $dados["nome"];
|
|
|
|
|
|
|
|
|
|
if ($agenteStatus) {
|
|
|
|
|
$msg = $agenteNome; //"Este contato encontra-se pendente de encerramento para o Agente: $agenteNome! ";
|
|
|
|
|
$msg2 = $agenteStatus; //"O status deste agente neste momento <EFBFBD>: $agenteStatus! ";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($_POST["btEncerra"]) {
|
|
|
|
|
$idCont = $_POST["idContato"];
|
|
|
|
|
$identificador = $_GET["identificador"];
|
|
|
|
|
$idCamp = $_POST["idCamp"];
|
|
|
|
|
$idLista = $_POST["idLista"];
|
|
|
|
|
$status = $_POST["ListaStatus"];
|
|
|
|
|
$mensagem = $_POST["msg_discador"];
|
|
|
|
|
$matricula = GetMatricula();
|
|
|
|
|
//$teste = "idContato: ".$idCont."/ IdCamp: ".$idCamp."/ idLista: ".$idLista."/ status: ".$status."/ matricula: ".$matricula."/ mensagem: ".$mensagem;
|
|
|
|
|
//echo $teste;
|
|
|
|
|
if (!$status) {
|
|
|
|
|
$msgErro = "<EFBFBD> necess<EFBFBD>rio selecionar um status!";
|
|
|
|
|
} else if (!$mensagem) {
|
|
|
|
|
$msgErro = "Por favor digite uma mensagem para encerramento!";
|
|
|
|
|
} else {
|
|
|
|
|
$query = "update pbx_campanha_operacao set cmpo_status = 1, matricula = '$matricula' where cmp_id = $idCamp and list_id = $idLista and cont_id = $idCont";
|
|
|
|
|
$result = @pg_query($dbcon, $query);
|
|
|
|
|
//echo $query;
|
|
|
|
|
$query1 = "update pbx_campanha_contato set cont_discado = 1, cont_status = $status, cont_msg = '$mensagem' ,matricula = '$matricula' where cmp_id = $idCamp and list_id = $idLista and cont_id = $idCont;";
|
|
|
|
|
$result = @pg_query($dbcon, $query1);
|
|
|
|
|
//echo $query1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($result) {
|
|
|
|
|
$GLOBALS['jsStartup'][] = "window.close()";
|
|
|
|
|
$GLOBALS['jsStartup'][] = "window.opener.ResetForm();";
|
|
|
|
|
} else {
|
|
|
|
|
if (empty($msgErro))
|
|
|
|
|
$msgErro = "N<EFBFBD>o foi poss<EFBFBD>vel realizar a opera<EFBFBD><EFBFBD>o!";
|
|
|
|
|
$GLOBALS['jsStartup'][] = "alert('$msgErro');";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$sZw = '100%';
|
|
|
|
|
$sZh = '50px';
|
|
|
|
|
$styleAdd = '';
|
|
|
|
|
// $sZmsg_discador = sprintf("width: %s;height: %s;padding:0;margin:0;%s", $sZw, $sZh, $styleAdd);
|
|
|
|
|
// $sZListaStatus = sprintf("width: %s;height: %s;padding:0;margin:0;%s", '80%', '26px', $styleAdd);
|
|
|
|
|
//print $linhas;
|
|
|
|
|
$smarty->assign('ListaStatus', $ListaStatus);
|
|
|
|
|
$smarty->assign('idCont', $idCont);
|
|
|
|
|
$smarty->assign('identificador', $identificador);
|
|
|
|
|
$smarty->assign('idCamp', $idCamp);
|
|
|
|
|
$smarty->assign('idLista', $idLista);
|
|
|
|
|
$smarty->assign('msg', $msg);
|
|
|
|
|
$smarty->assign('msg2', $msg2);
|
|
|
|
|
GetTemplate($smarty, $nomeTpl);
|
|
|
|
|
|
|
|
|
|
function GetStatusDiscador() {
|
|
|
|
|
$lista = '';
|
|
|
|
|
/*
|
|
|
|
|
* Pega a lista de status da opera<EFBFBD><EFBFBD>o.
|
|
|
|
|
*/
|
|
|
|
|
$query = "select ctst_id, ctst_nome from pbx_campanha_contato_status where ctst_status = 1 order by ctst_nome";
|
|
|
|
|
$result = pg_query($query);
|
|
|
|
|
|
|
|
|
|
$sel = $value ? " selected" : "";
|
|
|
|
|
$lista = "<option value=\"0\"$sel>---------------</option>";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while ($dados = @pg_fetch_row($result)) {
|
|
|
|
|
$sel = ($value == $dados[0]) ? " selected" : "";
|
|
|
|
|
$id = $dados[0];
|
|
|
|
|
$desc = $dados[1];
|
|
|
|
|
$lista .= "<option value=\"$id\"$sel>$desc</option>";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$lista .= "</select>";
|
|
|
|
|
return $lista;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
?>
|