Commit e17aa178722ff01d650e999ff4ad5705a91a3be9
1 parent
3e8c94b4
Exists in
master
and in
16 other branches
[Fixed #44] Correção de erro de validação de encode utf-8
Showing
3 changed files
with
36 additions
and
43 deletions
Show diff stats
pen_procedimento_expedir.php
| ... | ... | @@ -163,13 +163,12 @@ try { |
| 163 | 163 | try { |
| 164 | 164 | $respostaExpedir = $objExpedirProcedimentosRN->expedirProcedimento($objExpedirProcedimentoDTO); |
| 165 | 165 | |
| 166 | - echo '<input type="button" onclick="javascript:window.close()" class="botao_fechar" value="Fechar" ' | |
| 167 | - . 'style="margin-left: 84%; margin-top: 4%;"/>'; //Botão para fechar a janela | |
| 166 | + //Adiciona o botão Fechar para a janela | |
| 167 | + echo '<input type="button" onclick="javascript:window.close()" class="botao_fechar" value="Fechar" style="margin-left: 84%; margin-top: 4%;"/>'; | |
| 168 | 168 | } catch(\Exception $e) { |
| 169 | 169 | $objPaginaSEI->processarExcecao($e); |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | - // Faz o die(); | |
| 173 | 172 | $objPaginaSEI->finalizarBarraProgresso(null, false); |
| 174 | 173 | } |
| 175 | 174 | //------------------------------------------------------------------ | ... | ... |
rn/ExpedirProcedimentoRN.php
| ... | ... | @@ -136,20 +136,15 @@ class ExpedirProcedimentoRN extends InfraRN { |
| 136 | 136 | //Construo dos cabecalho para envio do processo |
| 137 | 137 | $objCabecalho = $this->construirCabecalho($objExpedirProcedimentoDTO); |
| 138 | 138 | |
| 139 | - //Construo do processo para envio | |
| 139 | + //Construção do processo para envio | |
| 140 | 140 | $objProcesso = $this->construirProcesso($dblIdProcedimento, $objExpedirProcedimentoDTO->getArrIdProcessoApensado()); |
| 141 | 141 | |
| 142 | - try { | |
| 143 | - $param = new stdClass(); | |
| 144 | - $param->novoTramiteDeProcesso = new stdClass(); | |
| 145 | - $param->novoTramiteDeProcesso->cabecalho = $objCabecalho; | |
| 146 | - $param->novoTramiteDeProcesso->processo = $objProcesso; | |
| 147 | - $novoTramite = $this->objProcessoEletronicoRN->enviarProcesso($param); | |
| 148 | - $numIdTramite = $novoTramite->dadosTramiteDeProcessoCriado->IDT; | |
| 149 | - | |
| 150 | - } catch (\Exception $e) { | |
| 151 | - throw new InfraException("Error Processing Request", $e); | |
| 152 | - } | |
| 142 | + $param = new stdClass(); | |
| 143 | + $param->novoTramiteDeProcesso = new stdClass(); | |
| 144 | + $param->novoTramiteDeProcesso->cabecalho = $objCabecalho; | |
| 145 | + $param->novoTramiteDeProcesso->processo = $objProcesso; | |
| 146 | + $novoTramite = $this->objProcessoEletronicoRN->enviarProcesso($param); | |
| 147 | + $numIdTramite = $novoTramite->dadosTramiteDeProcessoCriado->IDT; | |
| 153 | 148 | |
| 154 | 149 | $this->atualizarPenProtocolo($dblIdProcedimento); |
| 155 | 150 | |
| ... | ... | @@ -1256,26 +1251,26 @@ class ExpedirProcedimentoRN extends InfraRN { |
| 1256 | 1251 | |
| 1257 | 1252 | if($strStaNumeracao == SerieRN::$TN_SEQUENCIAL_UNIDADE) { |
| 1258 | 1253 | $objDocumento->identificacao = new stdClass(); |
| 1259 | - $objDocumento->identificacao->numero = $parObjDocumentoDTO->getStrNumero(); | |
| 1260 | - $objDocumento->identificacao->siglaDaUnidadeProdutora = $parObjDocumentoDTO->getStrSiglaUnidadeGeradoraProtocolo(); | |
| 1254 | + $objDocumento->identificacao->numero = utf8_encode($parObjDocumentoDTO->getStrNumero()); | |
| 1255 | + $objDocumento->identificacao->siglaDaUnidadeProdutora = utf8_encode($parObjDocumentoDTO->getStrSiglaUnidadeGeradoraProtocolo()); | |
| 1261 | 1256 | $objDocumento->identificacao->complemento = utf8_encode($parObjDocumentoDTO->getStrDescricaoUnidadeGeradoraProtocolo()); |
| 1262 | 1257 | }else if($strStaNumeracao == SerieRN::$TN_SEQUENCIAL_ORGAO){ |
| 1263 | 1258 | $objOrgaoDTO = $this->consultarOrgao($parObjDocumentoDTO->getNumIdOrgaoUnidadeGeradoraProtocolo()); |
| 1264 | 1259 | $objDocumento->identificacao = new stdClass(); |
| 1265 | - $objDocumento->identificacao->numero = $parObjDocumentoDTO->getStrNumero(); | |
| 1266 | - $objDocumento->identificacao->siglaDaUnidadeProdutora = $objOrgaoDTO->getStrSigla(); | |
| 1260 | + $objDocumento->identificacao->numero = utf8_encode($parObjDocumentoDTO->getStrNumero()); | |
| 1261 | + $objDocumento->identificacao->siglaDaUnidadeProdutora = utf8_encode($objOrgaoDTO->getStrSigla()); | |
| 1267 | 1262 | $objDocumento->identificacao->complemento = utf8_encode($objOrgaoDTO->getStrDescricao()); |
| 1268 | 1263 | }else if($strStaNumeracao == SerieRN::$TN_SEQUENCIAL_ANUAL_UNIDADE){ |
| 1269 | 1264 | $objDocumento->identificacao = new stdClass(); |
| 1270 | - $objDocumento->identificacao->siglaDaUnidadeProdutora = $parObjDocumentoDTO->getStrSiglaUnidadeGeradoraProtocolo(); | |
| 1265 | + $objDocumento->identificacao->siglaDaUnidadeProdutora = utf8_encode($parObjDocumentoDTO->getStrSiglaUnidadeGeradoraProtocolo()); | |
| 1271 | 1266 | $objDocumento->identificacao->complemento = utf8_encode($parObjDocumentoDTO->getStrDescricaoUnidadeGeradoraProtocolo()); |
| 1272 | - $objDocumento->identificacao->numero = $parObjDocumentoDTO->getStrNumero(); | |
| 1267 | + $objDocumento->identificacao->numero = utf8_encode($parObjDocumentoDTO->getStrNumero()); | |
| 1273 | 1268 | $objDocumento->identificacao->ano = substr($parObjDocumentoDTO->getDtaGeracaoProtocolo(),6,4); |
| 1274 | 1269 | }else if($strStaNumeracao == SerieRN::$TN_SEQUENCIAL_ANUAL_ORGAO){ |
| 1275 | 1270 | $objOrgaoDTO = $this->consultarOrgao($parObjDocumentoDTO->getNumIdOrgaoUnidadeGeradoraProtocolo()); |
| 1276 | 1271 | $objDocumento->identificacao = new stdClass(); |
| 1277 | - $objDocumento->identificacao->numero = $parObjDocumentoDTO->getStrNumero(); | |
| 1278 | - $objDocumento->identificacao->siglaDaUnidadeProdutora = $objOrgaoDTO->getStrSigla(); | |
| 1272 | + $objDocumento->identificacao->numero = utf8_encode($parObjDocumentoDTO->getStrNumero()); | |
| 1273 | + $objDocumento->identificacao->siglaDaUnidadeProdutora = utf8_encode($objOrgaoDTO->getStrSigla()); | |
| 1279 | 1274 | $objDocumento->identificacao->complemento = utf8_encode($objOrgaoDTO->getStrDescricao()); |
| 1280 | 1275 | $objDocumento->identificacao->ano = substr($parObjDocumentoDTO->getDtaGeracaoProtocolo(),6,4); |
| 1281 | 1276 | } | ... | ... |
rn/ProcessoEletronicoRN.php
| ... | ... | @@ -405,13 +405,12 @@ class ProcessoEletronicoRN extends InfraRN { |
| 405 | 405 | try { |
| 406 | 406 | return $this->getObjPenWs()->enviarProcesso($parametros); |
| 407 | 407 | } catch (\Exception $e) { |
| 408 | - $mensagem = "Falha no envio externo do processo: "; | |
| 408 | + $mensagem = "Falha no envio externo do processo. Verifique log de erros do sistema para maiores informações."; | |
| 409 | 409 | $detalhes = InfraString::formatarJavaScript($this->tratarFalhaWebService($e)); |
| 410 | 410 | if ($e instanceof \SoapFault && !empty($e->detail->interoperabilidadeException->codigoErro) && $e->detail->interoperabilidadeException->codigoErro == '0005') { |
| 411 | 411 | $detalhes = 'O código mapeado para a unidade ' . utf8_decode($parametros->novoTramiteDeProcesso->processo->documento[0]->produtor->unidade->nome) . ' está incorreto.'; |
| 412 | 412 | } |
| 413 | 413 | |
| 414 | - $mensagem .= $detalhes; | |
| 415 | 414 | throw new InfraException($mensagem, $e, $detalhes); |
| 416 | 415 | } |
| 417 | 416 | } |
| ... | ... | @@ -450,25 +449,25 @@ class ProcessoEletronicoRN extends InfraRN { |
| 450 | 449 | } |
| 451 | 450 | |
| 452 | 451 | //TODO: Tratar cada um dos possíveis erros gerados pelos serviços de integração do PEN |
| 453 | - private function tratarFalhaWebService(Exception $fault) | |
| 454 | - { | |
| 455 | - $mensagem = InfraException::inspecionar($fault); | |
| 456 | - if($fault instanceof SoapFault && isset($fault->detail->interoperabilidadeException)){ | |
| 457 | - $strWsException = $fault->detail->interoperabilidadeException; | |
| 458 | - | |
| 459 | - switch ($strWsException->codigoErro) { | |
| 460 | - case '0044': | |
| 461 | - $mensagem = 'Processo já possui um trâmite em andamento'; | |
| 462 | - break; | |
| 463 | - | |
| 464 | - default: | |
| 465 | - $mensagem = utf8_decode($fault->detail->interoperabilidadeException->mensagem); | |
| 466 | - break; | |
| 467 | - } | |
| 468 | - } | |
| 452 | + private function tratarFalhaWebService(Exception $fault) | |
| 453 | + { | |
| 454 | + $mensagem = InfraException::inspecionar($fault); | |
| 455 | + if($fault instanceof SoapFault && isset($fault->detail->interoperabilidadeException)) { | |
| 469 | 456 | |
| 470 | - return $mensagem; | |
| 471 | - } | |
| 457 | + $strWsException = $fault->detail->interoperabilidadeException; | |
| 458 | + switch ($strWsException->codigoErro) { | |
| 459 | + case '0044': | |
| 460 | + $mensagem = 'Processo já possui um trâmite em andamento'; | |
| 461 | + break; | |
| 462 | + | |
| 463 | + default: | |
| 464 | + $mensagem = utf8_decode($fault->detail->interoperabilidadeException->mensagem); | |
| 465 | + break; | |
| 466 | + } | |
| 467 | + } | |
| 468 | + | |
| 469 | + return $mensagem; | |
| 470 | + } | |
| 472 | 471 | |
| 473 | 472 | public function construirCabecalho($strNumeroRegistro, $idRepositorioOrigem, $idUnidadeOrigem, $idRepositorioDestino, |
| 474 | 473 | $idUnidadeDestino, $urgente = false, $motivoUrgencia = 0, $enviarTodosDocumentos = false) | ... | ... |