Commit 0864e14e69d9dcbb1869bfdfc2211ba20f8f80ab
1 parent
550b522e
Exists in
master
and in
21 other branches
Ajustes + US074
Showing
3 changed files
with
118 additions
and
5 deletions
Show diff stats
pen_procedimento_expedir_validar.php
@@ -17,7 +17,7 @@ $objInfraException = new InfraException(); | @@ -17,7 +17,7 @@ $objInfraException = new InfraException(); | ||
17 | 17 | ||
18 | 18 | ||
19 | try { | 19 | try { |
20 | - | 20 | + |
21 | if(!array_key_exists('id_procedimento', $_GET) || empty($_GET['id_procedimento'])) { | 21 | if(!array_key_exists('id_procedimento', $_GET) || empty($_GET['id_procedimento'])) { |
22 | throw new InfraException('Nenhum procedimento foi informado', 'Desconhecido'); | 22 | throw new InfraException('Nenhum procedimento foi informado', 'Desconhecido'); |
23 | } | 23 | } |
@@ -34,6 +34,35 @@ try { | @@ -34,6 +34,35 @@ try { | ||
34 | // Utilizamos o protocolo para criar um indice para separar os erros entre o | 34 | // Utilizamos o protocolo para criar um indice para separar os erros entre o |
35 | // processo e os seus processos apensados | 35 | // processo e os seus processos apensados |
36 | $strProtocoloFormatado = $objProcedimentoDTO->getStrProtocoloProcedimentoFormatado(); | 36 | $strProtocoloFormatado = $objProcedimentoDTO->getStrProtocoloProcedimentoFormatado(); |
37 | + | ||
38 | + $objRelProtocoloProtocoloRN = new RelProtocoloProtocoloRN(); | ||
39 | + | ||
40 | + //Consulta do ID Pai | ||
41 | + $objRelProtocoloProtocoloDTO1 = new RelProtocoloProtocoloDTO(); | ||
42 | + $objRelProtocoloProtocoloDTO1->setDblIdProtocolo1($dblIdProcedimento); | ||
43 | + $objRelProtocoloProtocoloDTO1->setStrStaAssociacao(RelProtocoloProtocoloRN ::$TA_PROCEDIMENTO_ANEXADO); | ||
44 | + $objRelProtocoloProtocoloDTO1->retDblIdProtocolo1(); | ||
45 | + | ||
46 | + //Consulta do ID Filhos | ||
47 | + $objRelProtocoloProtocoloDTO2 = new RelProtocoloProtocoloDTO(); | ||
48 | + $objRelProtocoloProtocoloDTO2->setDblIdProtocolo2($dblIdProcedimento); | ||
49 | + $objRelProtocoloProtocoloDTO2->setStrStaAssociacao(RelProtocoloProtocoloRN ::$TA_PROCEDIMENTO_ANEXADO); | ||
50 | + $objRelProtocoloProtocoloDTO2->retDblIdProtocolo2(); | ||
51 | + | ||
52 | + $numCount1 = $objRelProtocoloProtocoloRN->contarRN0843($objRelProtocoloProtocoloDTO1); | ||
53 | + $numCount2 = $objRelProtocoloProtocoloRN->contarRN0843($objRelProtocoloProtocoloDTO2); | ||
54 | + | ||
55 | + if ($numCount1 > 0 && $numCount2 > 0) { | ||
56 | + $objInfraException->adicionarValidacao('Esse processo está anexado a outro processo e possui outros em anexo, portanto não pode ser tramitado.', $strProtocoloFormatado); | ||
57 | + } else { | ||
58 | + if ($numCount1 > 0) { | ||
59 | + $objInfraException->adicionarValidacao('Esse processo possuí outros em anexo, portanto não pode ser tramitado externamente.', $strProtocoloFormatado); | ||
60 | + } | ||
61 | + | ||
62 | + if ($numCount2 > 0) { | ||
63 | + $objInfraException->adicionarValidacao('Esse processo está anexado a outro processo, portanto não pode ser tramitado.', $strProtocoloFormatado); | ||
64 | + } | ||
65 | + } | ||
37 | 66 | ||
38 | if(!array_key_exists('txtProtocoloExibir', $_POST) || empty($_POST['txtProtocoloExibir'])) { | 67 | if(!array_key_exists('txtProtocoloExibir', $_POST) || empty($_POST['txtProtocoloExibir'])) { |
39 | $objInfraException->adicionarValidacao('Informe o Protocolo', $strProtocoloFormatado); | 68 | $objInfraException->adicionarValidacao('Informe o Protocolo', $strProtocoloFormatado); |
rn/ExpedirProcedimentoRN.php
@@ -892,7 +892,6 @@ class ExpedirProcedimentoRN extends InfraRN { | @@ -892,7 +892,6 @@ class ExpedirProcedimentoRN extends InfraRN { | ||
892 | //Identificação do documento | 892 | //Identificação do documento |
893 | $this->atribuirNumeracaoDocumento($documento, $documentoDTO); | 893 | $this->atribuirNumeracaoDocumento($documento, $documentoDTO); |
894 | 894 | ||
895 | - | ||
896 | if($documento->retirado === true){ | 895 | if($documento->retirado === true){ |
897 | 896 | ||
898 | $penComponenteDigitalDTO = new ComponenteDigitalDTO(); | 897 | $penComponenteDigitalDTO = new ComponenteDigitalDTO(); |
@@ -915,14 +914,23 @@ class ExpedirProcedimentoRN extends InfraRN { | @@ -915,14 +914,23 @@ class ExpedirProcedimentoRN extends InfraRN { | ||
915 | $documento->componenteDigital->tipoDeConteudo = $componenteDigital->getStrTipoConteudo(); | 914 | $documento->componenteDigital->tipoDeConteudo = $componenteDigital->getStrTipoConteudo(); |
916 | $documento->componenteDigital->idAnexo = $componenteDigital->getNumIdAnexo(); | 915 | $documento->componenteDigital->idAnexo = $componenteDigital->getNumIdAnexo(); |
917 | 916 | ||
917 | + | ||
918 | + | ||
919 | + // -------------------------- INICIO DA TAREFA US074 -------------------------------// | ||
920 | + $documento = $this->atribuirDadosAssinaturaDigital($documentoDTO, $documento, $componenteDigital->getStrHashConteudo()); | ||
921 | + // -------------------------- FIM TAREFA US074 -------------------------------// | ||
922 | + | ||
923 | + | ||
918 | if($componenteDigital->getStrMimeType() == 'outro'){ | 924 | if($componenteDigital->getStrMimeType() == 'outro'){ |
919 | $documento->componenteDigital->dadosComplementaresDoTipoDeArquivo = 'outro'; | 925 | $documento->componenteDigital->dadosComplementaresDoTipoDeArquivo = 'outro'; |
920 | } | 926 | } |
921 | 927 | ||
922 | }else{ | 928 | }else{ |
923 | $this->atribuirComponentesDigitais($documento, $documentoDTO); | 929 | $this->atribuirComponentesDigitais($documento, $documentoDTO); |
930 | + | ||
924 | } | 931 | } |
925 | 932 | ||
933 | + | ||
926 | }else{ | 934 | }else{ |
927 | $this->atribuirComponentesDigitais($documento, $documentoDTO); | 935 | $this->atribuirComponentesDigitais($documento, $documentoDTO); |
928 | } | 936 | } |
@@ -1021,6 +1029,13 @@ class ExpedirProcedimentoRN extends InfraRN { | @@ -1021,6 +1029,13 @@ class ExpedirProcedimentoRN extends InfraRN { | ||
1021 | $objDocumento->componenteDigital->mimeType = $arrInformacaoArquivo['MIME_TYPE']; | 1029 | $objDocumento->componenteDigital->mimeType = $arrInformacaoArquivo['MIME_TYPE']; |
1022 | $objDocumento->componenteDigital->tipoDeConteudo = $this->obterTipoDeConteudo($arrInformacaoArquivo['MIME_TYPE']); | 1030 | $objDocumento->componenteDigital->tipoDeConteudo = $this->obterTipoDeConteudo($arrInformacaoArquivo['MIME_TYPE']); |
1023 | 1031 | ||
1032 | + | ||
1033 | + // -------------------------- INICIO DA TAREFA US074 -------------------------------/ | ||
1034 | + | ||
1035 | + $objDocumento = $this->atribuirDadosAssinaturaDigital($objDocumentoDTO, $objDocumento, $hashDoComponenteDigital); | ||
1036 | + // -------------------------- FIM TAREFA US074 -------------------------------// | ||
1037 | + | ||
1038 | + | ||
1024 | if($arrInformacaoArquivo['MIME_TYPE'] == 'outro'){ | 1039 | if($arrInformacaoArquivo['MIME_TYPE'] == 'outro'){ |
1025 | $objDocumento->componenteDigital->dadosComplementaresDoTipoDeArquivo = $arrInformacaoArquivo['dadosComplementaresDoTipoDeArquivo']; | 1040 | $objDocumento->componenteDigital->dadosComplementaresDoTipoDeArquivo = $arrInformacaoArquivo['dadosComplementaresDoTipoDeArquivo']; |
1026 | } | 1041 | } |
@@ -1035,12 +1050,82 @@ class ExpedirProcedimentoRN extends InfraRN { | @@ -1035,12 +1050,82 @@ class ExpedirProcedimentoRN extends InfraRN { | ||
1035 | $objDocumento->componenteDigital->idAnexo = $arrInformacaoArquivo['ID_ANEXO']; | 1050 | $objDocumento->componenteDigital->idAnexo = $arrInformacaoArquivo['ID_ANEXO']; |
1036 | return $objDocumento; | 1051 | return $objDocumento; |
1037 | } | 1052 | } |
1053 | + | ||
1054 | + public function atribuirDadosAssinaturaDigital($objDocumentoDTO, $objDocumento, $strHashDocumento) { | ||
1055 | + //Busca as Tarjas | ||
1056 | + $objDocumentoDTOTarjas = new DocumentoDTO(); | ||
1057 | + $objDocumentoDTOTarjas->retDblIdDocumento(); | ||
1058 | + $objDocumentoDTOTarjas->retStrNomeSerie(); | ||
1059 | + $objDocumentoDTOTarjas->retStrProtocoloDocumentoFormatado(); | ||
1060 | + $objDocumentoDTOTarjas->retStrProtocoloProcedimentoFormatado(); | ||
1061 | + $objDocumentoDTOTarjas->retStrCrcAssinatura(); | ||
1062 | + $objDocumentoDTOTarjas->retStrQrCodeAssinatura(); | ||
1063 | + $objDocumentoDTOTarjas->retObjPublicacaoDTO(); | ||
1064 | + $objDocumentoDTOTarjas->retNumIdConjuntoEstilos(); | ||
1065 | + $objDocumentoDTOTarjas->retStrSinBloqueado(); | ||
1066 | + $objDocumentoDTOTarjas->retStrStaDocumento(); | ||
1067 | + $objDocumentoDTOTarjas->retStrStaProtocoloProtocolo(); | ||
1068 | + $objDocumentoDTOTarjas->retNumIdUnidadeGeradoraProtocolo(); | ||
1069 | + $objDocumentoDTOTarjas->retStrDescricaoTipoConferencia(); | ||
1070 | + $objDocumentoDTOTarjas->setDblIdDocumento($objDocumentoDTO->getDblIdDocumento()); | ||
1071 | + $objDocumentoRN = new DocumentoRN(); | ||
1072 | + $objDocumentoDTOTarjas = $objDocumentoRN->consultarRN0005($objDocumentoDTOTarjas); | ||
1073 | + $objAssinaturaRN = new AssinaturaRN(); | ||
1074 | + $tarjas = $objAssinaturaRN->montarTarjas($objDocumentoDTOTarjas); | ||
1075 | + | ||
1076 | + | ||
1077 | + //Remove todos os 12 espaços padrões após remover as tags. | ||
1078 | + $dataTarjas = explode(' ', strip_tags($tarjas)); | ||
1079 | + foreach ($dataTarjas as $key => $content) { | ||
1080 | + $contentTrim = trim($content); //Limpa os espaços no inicio e fim de cada texto. | ||
1081 | + if (empty($contentTrim)) { | ||
1082 | + unset($dataTarjas[$key]); | ||
1083 | + } else { | ||
1084 | + $dataTarjas[$key] = html_entity_decode($contentTrim); //Decodifica por causa do strip_tags | ||
1085 | + } | ||
1086 | + } | ||
1087 | + | ||
1088 | + $dataTarjas = array_values($dataTarjas); //Reseta os valores da array | ||
1089 | + | ||
1090 | + //Busca data da assinatura | ||
1091 | + $objAtividadeDTO = new AtividadeDTO(); | ||
1092 | + $objAtividadeDTO->setDblIdProtocolo($objDocumentoDTO->getDblIdProcedimento()); | ||
1093 | + $objAtividadeDTO->setNumIdTarefa(TarefaRN::$TI_ASSINATURA_DOCUMENTO); | ||
1094 | + $objAtividadeDTO->retDthAbertura(); | ||
1095 | + $objAtividadeDTO->retNumIdAtividade(); | ||
1096 | + $objAtividadeRN = new AtividadeRN(); | ||
1097 | + $objAtividade = $objAtividadeRN->listarRN0036($objAtividadeDTO); | ||
1098 | + | ||
1099 | + $objDocumento->componenteDigital->assinaturaDigital = array(); | ||
1100 | + //Para cada assinatura | ||
1101 | + foreach ($objAtividade as $keyOrder => $atividade) { | ||
1102 | + | ||
1103 | + //Busca outros dados da assinatura | ||
1104 | + $objAssinaturaDTO = new AssinaturaDTO(); | ||
1105 | + $objAssinaturaDTO->setDblIdDocumento($objDocumentoDTO->getDblIdDocumento()); | ||
1106 | + $objAssinaturaDTO->setNumIdAtividade($atividade->getNumIdAtividade()); | ||
1107 | + $objAssinaturaDTO->retStrP7sBase64(); | ||
1108 | + $objAssinaturaRN = new AssinaturaRN(); | ||
1109 | + $objAssinatura = $objAssinaturaRN->consultarRN1322($objAssinaturaDTO); | ||
1110 | + | ||
1111 | + $objAssinaturaDigital = new stdClass(); | ||
1112 | + | ||
1113 | + $objAssinaturaDigital->dataHora = $this->objProcessoEletronicoRN->converterDataWebService($atividade->getDthAbertura()); | ||
1114 | + | ||
1115 | + $objAssinaturaDigital->hash = new SoapVar("<hash algoritmo='".self::ALGORITMO_HASH_ASSINATURA."'>{$strHashDocumento}</hash>", XSD_ANYXML); | ||
1116 | + $objAssinaturaDigital->cadeiaDoCertificado = new SoapVar('<cadeiaDoCertificado formato="PKCS7">'.($objAssinatura->getStrP7sBase64() ? $objAssinatura->getStrP7sBase64() : 'null').'</cadeiaDoCertificado>', XSD_ANYXML); | ||
1117 | + $objAssinaturaDigital->razao = utf8_encode($dataTarjas[$keyOrder]); | ||
1118 | + $objAssinaturaDigital->observacao = utf8_encode($dataTarjas[count($dataTarjas) - 1]); | ||
1119 | + | ||
1120 | + $objDocumento->componenteDigital->assinaturaDigital[] = $objAssinaturaDigital; | ||
1121 | + } | ||
1122 | + | ||
1123 | + return $objDocumento; | ||
1124 | + } | ||
1038 | 1125 | ||
1039 | private function obterDadosArquivo(DocumentoDTO $objDocumentoDTO) | 1126 | private function obterDadosArquivo(DocumentoDTO $objDocumentoDTO) |
1040 | { | 1127 | { |
1041 | 1128 | ||
1042 | - | ||
1043 | - | ||
1044 | if(!isset($objDocumentoDTO)){ | 1129 | if(!isset($objDocumentoDTO)){ |
1045 | throw new InfraException('Parâmetro $objDocumentoDTO não informado.'); | 1130 | throw new InfraException('Parâmetro $objDocumentoDTO não informado.'); |
1046 | } | 1131 | } |
rn/PenTramiteProcessadoRN.php
@@ -108,7 +108,6 @@ class PenTramiteProcessadoRN extends InfraRN { | @@ -108,7 +108,6 @@ class PenTramiteProcessadoRN extends InfraRN { | ||
108 | $objDTO = $objBD->consultar($objDTO); | 108 | $objDTO = $objBD->consultar($objDTO); |
109 | 109 | ||
110 | if(empty($objDTO)) { | 110 | if(empty($objDTO)) { |
111 | - | ||
112 | throw new InfraException(sprintf('ID do tramite %s não foi localizado', $dblIdTramite)); | 111 | throw new InfraException(sprintf('ID do tramite %s não foi localizado', $dblIdTramite)); |
113 | } | 112 | } |
114 | 113 |