forked from Claudio/integracao
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.7 KiB
37 lines
1.7 KiB
3 years ago
|
<?php
|
||
|
|
||
|
include 'HubSoft.php';
|
||
|
$hub = new HubSoft();
|
||
|
|
||
|
$documento = $hub->agi()->get_variable('URA', true);
|
||
|
$retorno = $hub->identificarDocumento($documento);
|
||
|
$reg_pass = $hub->agi()->get_variable("REG_PASS", true);
|
||
|
|
||
|
$servico = end($retorno['clientes'][0]['servicos']);
|
||
|
|
||
|
// INFORMACOES ESSENCIAIS
|
||
|
$hub->agi()->set_variable('CODCLIENTE', $retorno['clientes'][0]['codigo_cliente']);
|
||
|
$hub->agi()->set_variable('IDCLIENTESERVICO', $servico['id_cliente_servico']);
|
||
|
$hub->agi()->set_variable('NOME', $retorno['clientes'][0]['codigo_cliente']."-".$retorno['clientes'][0]['nome_razaosocial']);
|
||
|
$hub->agi()->set_variable('TELEFONEPRIMARIO', $retorno['clientes'][0]['telefone_primario']);
|
||
|
|
||
|
// INTEGRACAO DE TELA
|
||
|
$hub->agi()->set_variable('DOCUMENTO', $documento);
|
||
|
$hub->agi()->set_variable('PLANO', str_replace("|","-", $servico['nome']));
|
||
|
$hub->agi()->set_variable('ENDERECO', str_replace("|","-",$servico['endereco_instalacao']['completo']));
|
||
|
$hub->agi()->set_variable('IP', $servico['ipv4']);
|
||
|
$hub->agi()->set_variable('STATUS', str_replace("|","-",$servico['status']));
|
||
|
$hub->agi()->set_variable('OBSERVACOES', str_replace("|","-",$servico['anotacoes']));
|
||
|
|
||
|
if ($retorno['clientes'][0]['codigo_cliente']) {
|
||
|
$hub->executarFluxo('ANUNCIO', 'INT_CADASTRO_ENCONTRADO_ATEND'.CONF_NOME_EMPRESA); // Sucesso
|
||
|
} else if ($reg_pass <= 1) {
|
||
|
$reg_pass += 1;
|
||
|
$hub->agi()->set_variable("REG_PASS", $reg_pass);
|
||
|
$hub->executarFluxo('ANUNCIO', 'INT_CADASTRO_FALHA_ATEND'.CONF_NOME_EMPRESA); // Falha
|
||
|
} else {
|
||
|
$hub->executarFluxo('ANUNCIO', 'INT_TRANSFERE_ATENDIMENTO'.CONF_NOME_EMPRESA);
|
||
|
}
|
||
|
|
||
|
?>
|