Commit 3fe74e7a2d25c22e874ef146e37cd5baa5164127
1 parent
ff263bda
Exists in
master
and in
21 other branches
[Fixed #23] Correção de falha no envio de documentos externos autenticados
Showing
3 changed files
with
29 additions
and
48 deletions
Show diff stats
rn/ExpedirProcedimentoRN.php
@@ -117,10 +117,12 @@ class ExpedirProcedimentoRN extends InfraRN { | @@ -117,10 +117,12 @@ class ExpedirProcedimentoRN extends InfraRN { | ||
117 | return $this->objProcessoEletronicoRN->consultarMotivosUrgencia(); | 117 | return $this->objProcessoEletronicoRN->consultarMotivosUrgencia(); |
118 | } | 118 | } |
119 | 119 | ||
120 | - public function expedirProcedimentoControlado(ExpedirProcedimentoDTO $objExpedirProcedimentoDTO) { | 120 | + public function expedirProcedimentoControlado(ExpedirProcedimentoDTO $objExpedirProcedimentoDTO) |
121 | + { | ||
121 | 122 | ||
122 | $numIdTramite = 0; | 123 | $numIdTramite = 0; |
123 | 124 | ||
125 | + | ||
124 | try { | 126 | try { |
125 | //Valida Permissão | 127 | //Valida Permissão |
126 | SessaoSEI::getInstance()->validarAuditarPermissao('pen_procedimento_expedir',__METHOD__, $objExpedirProcedimentoDTO); | 128 | SessaoSEI::getInstance()->validarAuditarPermissao('pen_procedimento_expedir',__METHOD__, $objExpedirProcedimentoDTO); |
@@ -136,7 +138,6 @@ class ExpedirProcedimentoRN extends InfraRN { | @@ -136,7 +138,6 @@ class ExpedirProcedimentoRN extends InfraRN { | ||
136 | $objProcedimentoDTO = $this->consultarProcedimento($dblIdProcedimento); | 138 | $objProcedimentoDTO = $this->consultarProcedimento($dblIdProcedimento); |
137 | $objProcedimentoDTO->setArrObjDocumentoDTO($this->listarDocumentos($dblIdProcedimento)); | 139 | $objProcedimentoDTO->setArrObjDocumentoDTO($this->listarDocumentos($dblIdProcedimento)); |
138 | $objProcedimentoDTO->setArrObjParticipanteDTO($this->listarInteressados($dblIdProcedimento)); | 140 | $objProcedimentoDTO->setArrObjParticipanteDTO($this->listarInteressados($dblIdProcedimento)); |
139 | - | ||
140 | $this->validarPreCondicoesExpedirProcedimento($objInfraException, $objProcedimentoDTO); | 141 | $this->validarPreCondicoesExpedirProcedimento($objInfraException, $objProcedimentoDTO); |
141 | $this->validarParametrosExpedicao($objInfraException, $objExpedirProcedimentoDTO); | 142 | $this->validarParametrosExpedicao($objInfraException, $objExpedirProcedimentoDTO); |
142 | //Apresentao da mensagens de validao na janela da barra de progresso | 143 | //Apresentao da mensagens de validao na janela da barra de progresso |
@@ -148,12 +149,15 @@ class ExpedirProcedimentoRN extends InfraRN { | @@ -148,12 +149,15 @@ class ExpedirProcedimentoRN extends InfraRN { | ||
148 | 149 | ||
149 | $this->barraProgresso->mover(ProcessoEletronicoINT::NEE_EXPEDICAO_ETAPA_PROCEDIMENTO); | 150 | $this->barraProgresso->mover(ProcessoEletronicoINT::NEE_EXPEDICAO_ETAPA_PROCEDIMENTO); |
150 | $this->barraProgresso->setStrRotulo(sprintf(ProcessoEletronicoINT::TEE_EXPEDICAO_ETAPA_PROCEDIMENTO, $objProcedimentoDTO->getStrProtocoloProcedimentoFormatado())); | 151 | $this->barraProgresso->setStrRotulo(sprintf(ProcessoEletronicoINT::TEE_EXPEDICAO_ETAPA_PROCEDIMENTO, $objProcedimentoDTO->getStrProtocoloProcedimentoFormatado())); |
151 | - | ||
152 | //Construo dos cabecalho para envio do processo | 152 | //Construo dos cabecalho para envio do processo |
153 | $objCabecalho = $this->construirCabecalho($objExpedirProcedimentoDTO); | 153 | $objCabecalho = $this->construirCabecalho($objExpedirProcedimentoDTO); |
154 | + | ||
154 | //Construo do processo para envio | 155 | //Construo do processo para envio |
155 | $objProcesso = $this->construirProcesso($dblIdProcedimento, $objExpedirProcedimentoDTO->getArrIdProcessoApensado()); | 156 | $objProcesso = $this->construirProcesso($dblIdProcedimento, $objExpedirProcedimentoDTO->getArrIdProcessoApensado()); |
157 | + | ||
156 | try { | 158 | try { |
159 | + | ||
160 | + | ||
157 | $param = new stdClass(); | 161 | $param = new stdClass(); |
158 | $param->novoTramiteDeProcesso = new stdClass(); | 162 | $param->novoTramiteDeProcesso = new stdClass(); |
159 | $param->novoTramiteDeProcesso->cabecalho = $objCabecalho; | 163 | $param->novoTramiteDeProcesso->cabecalho = $objCabecalho; |
@@ -164,6 +168,7 @@ class ExpedirProcedimentoRN extends InfraRN { | @@ -164,6 +168,7 @@ class ExpedirProcedimentoRN extends InfraRN { | ||
164 | } catch (\Exception $e) { | 168 | } catch (\Exception $e) { |
165 | throw new InfraException("Error Processing Request", $e); | 169 | throw new InfraException("Error Processing Request", $e); |
166 | } | 170 | } |
171 | + | ||
167 | $this->atualizarPenProtocolo($dblIdProcedimento); | 172 | $this->atualizarPenProtocolo($dblIdProcedimento); |
168 | if (isset($novoTramite->dadosTramiteDeProcessoCriado)) { | 173 | if (isset($novoTramite->dadosTramiteDeProcessoCriado)) { |
169 | $objTramite = $novoTramite->dadosTramiteDeProcessoCriado; | 174 | $objTramite = $novoTramite->dadosTramiteDeProcessoCriado; |
@@ -199,6 +204,7 @@ class ExpedirProcedimentoRN extends InfraRN { | @@ -199,6 +204,7 @@ class ExpedirProcedimentoRN extends InfraRN { | ||
199 | //saber quais precisam ser baixados. O processo poderia ser mais otimizado se o retorno nos metadados j informasse quais os | 204 | //saber quais precisam ser baixados. O processo poderia ser mais otimizado se o retorno nos metadados j informasse quais os |
200 | //componentes precisam ser baixados, semelhante ao que ocorre no enviarProcesso onde o barramento informa quais os componentes | 205 | //componentes precisam ser baixados, semelhante ao que ocorre no enviarProcesso onde o barramento informa quais os componentes |
201 | //que precisam ser enviados | 206 | //que precisam ser enviados |
207 | + | ||
202 | $this->enviarComponentesDigitais($objTramite->NRE, $objTramite->IDT, $objProcesso->protocolo); | 208 | $this->enviarComponentesDigitais($objTramite->NRE, $objTramite->IDT, $objProcesso->protocolo); |
203 | //error_log('after enviarComponentesDigitais'); | 209 | //error_log('after enviarComponentesDigitais'); |
204 | //$strNumeroRegistro, $numIdTramite, $strProtocolo | 210 | //$strNumeroRegistro, $numIdTramite, $strProtocolo |
@@ -371,6 +377,7 @@ class ExpedirProcedimentoRN extends InfraRN { | @@ -371,6 +377,7 @@ class ExpedirProcedimentoRN extends InfraRN { | ||
371 | 377 | ||
372 | private function construirProcesso($dblIdProcedimento, $arrIdProcessoApensado = null) | 378 | private function construirProcesso($dblIdProcedimento, $arrIdProcessoApensado = null) |
373 | { | 379 | { |
380 | + | ||
374 | if(!isset($dblIdProcedimento)){ | 381 | if(!isset($dblIdProcedimento)){ |
375 | throw new InfraException('Parâmetro $dblIdProcedimento não informado.'); | 382 | throw new InfraException('Parâmetro $dblIdProcedimento não informado.'); |
376 | } | 383 | } |
@@ -378,29 +385,24 @@ class ExpedirProcedimentoRN extends InfraRN { | @@ -378,29 +385,24 @@ class ExpedirProcedimentoRN extends InfraRN { | ||
378 | //TODO: Passar dados do ProcedimentoDTO via parâmetro j carregado anteriormente | 385 | //TODO: Passar dados do ProcedimentoDTO via parâmetro j carregado anteriormente |
379 | $objProcedimentoDTO = $this->consultarProcedimento($dblIdProcedimento); | 386 | $objProcedimentoDTO = $this->consultarProcedimento($dblIdProcedimento); |
380 | $objPenRelHipoteseLegalRN = new PenRelHipoteseLegalEnvioRN(); | 387 | $objPenRelHipoteseLegalRN = new PenRelHipoteseLegalEnvioRN(); |
381 | - | ||
382 | $objProcesso = new stdClass(); | 388 | $objProcesso = new stdClass(); |
383 | $objProcesso->protocolo = utf8_encode($objProcedimentoDTO->getStrProtocoloProcedimentoFormatado()); | 389 | $objProcesso->protocolo = utf8_encode($objProcedimentoDTO->getStrProtocoloProcedimentoFormatado()); |
384 | $objProcesso->nivelDeSigilo = $this->obterNivelSigiloPEN($objProcedimentoDTO->getStrStaNivelAcessoLocalProtocolo()); | 390 | $objProcesso->nivelDeSigilo = $this->obterNivelSigiloPEN($objProcedimentoDTO->getStrStaNivelAcessoLocalProtocolo()); |
385 | $objProcesso->processoDeNegocio = utf8_encode($objProcedimentoDTO->getStrNomeTipoProcedimento()); | 391 | $objProcesso->processoDeNegocio = utf8_encode($objProcedimentoDTO->getStrNomeTipoProcedimento()); |
386 | $objProcesso->descricao = utf8_encode($objProcedimentoDTO->getStrDescricaoProtocolo()); | 392 | $objProcesso->descricao = utf8_encode($objProcedimentoDTO->getStrDescricaoProtocolo()); |
387 | $objProcesso->dataHoraDeProducao = $this->objProcessoEletronicoRN->converterDataWebService($objProcedimentoDTO->getDtaGeracaoProtocolo()); | 393 | $objProcesso->dataHoraDeProducao = $this->objProcessoEletronicoRN->converterDataWebService($objProcedimentoDTO->getDtaGeracaoProtocolo()); |
388 | - | ||
389 | if($objProcedimentoDTO->getStrStaNivelAcessoLocalProtocolo() == ProtocoloRN::$NA_RESTRITO){ | 394 | if($objProcedimentoDTO->getStrStaNivelAcessoLocalProtocolo() == ProtocoloRN::$NA_RESTRITO){ |
390 | $objProcesso->hipoteseLegal = new stdClass(); | 395 | $objProcesso->hipoteseLegal = new stdClass(); |
391 | $objProcesso->hipoteseLegal->identificacao = $objPenRelHipoteseLegalRN->getIdHipoteseLegalPEN($objProcedimentoDTO->getNumIdHipoteseLegalProtocolo()); | 396 | $objProcesso->hipoteseLegal->identificacao = $objPenRelHipoteseLegalRN->getIdHipoteseLegalPEN($objProcedimentoDTO->getNumIdHipoteseLegalProtocolo()); |
392 | } | 397 | } |
393 | - | ||
394 | $this->atribuirProdutorProcesso($objProcesso, | 398 | $this->atribuirProdutorProcesso($objProcesso, |
395 | $objProcedimentoDTO->getNumIdUsuarioGeradorProtocolo(), | 399 | $objProcedimentoDTO->getNumIdUsuarioGeradorProtocolo(), |
396 | $objProcedimentoDTO->getNumIdUnidadeGeradoraProtocolo()); | 400 | $objProcedimentoDTO->getNumIdUnidadeGeradoraProtocolo()); |
397 | - | ||
398 | $this->atribuirDataHoraDeRegistro($objProcesso, $objProcedimentoDTO->getDblIdProcedimento()); | 401 | $this->atribuirDataHoraDeRegistro($objProcesso, $objProcedimentoDTO->getDblIdProcedimento()); |
399 | 402 | ||
400 | $this->atribuirDocumentos($objProcesso, $dblIdProcedimento); | 403 | $this->atribuirDocumentos($objProcesso, $dblIdProcedimento); |
401 | $this->atribuirDadosInteressados($objProcesso, $dblIdProcedimento); | 404 | $this->atribuirDadosInteressados($objProcesso, $dblIdProcedimento); |
402 | $this->adicionarProcessosApensados($objProcesso, $arrIdProcessoApensado); | 405 | $this->adicionarProcessosApensados($objProcesso, $arrIdProcessoApensado); |
403 | - | ||
404 | $objProcesso->idProcedimentoSEI = $dblIdProcedimento; | 406 | $objProcesso->idProcedimentoSEI = $dblIdProcedimento; |
405 | return $objProcesso; | 407 | return $objProcesso; |
406 | } | 408 | } |
@@ -788,29 +790,23 @@ class ExpedirProcedimentoRN extends InfraRN { | @@ -788,29 +790,23 @@ class ExpedirProcedimentoRN extends InfraRN { | ||
788 | if(!isset($arrDocumentosDTO)) { | 790 | if(!isset($arrDocumentosDTO)) { |
789 | throw new InfraException('Documentos não encontrados.'); | 791 | throw new InfraException('Documentos não encontrados.'); |
790 | } | 792 | } |
791 | - | ||
792 | $ordemDocumento = 1; | 793 | $ordemDocumento = 1; |
793 | $objProcesso->documento = array(); | 794 | $objProcesso->documento = array(); |
794 | - | ||
795 | foreach ($arrDocumentosDTO as $documentoDTO) { | 795 | foreach ($arrDocumentosDTO as $documentoDTO) { |
796 | 796 | ||
797 | //$protocoloDocumentoDTO = $this->consultarProtocoloDocumento($documeto->getDblIdProcedimento()); | 797 | //$protocoloDocumentoDTO = $this->consultarProtocoloDocumento($documeto->getDblIdProcedimento()); |
798 | - | ||
799 | $documento = new stdClass(); | 798 | $documento = new stdClass(); |
800 | $objPenRelHipoteseLegalRN = new PenRelHipoteseLegalEnvioRN(); | 799 | $objPenRelHipoteseLegalRN = new PenRelHipoteseLegalEnvioRN(); |
801 | //TODO: Atribuir das informações abaixo ao documento | 800 | //TODO: Atribuir das informações abaixo ao documento |
802 | //<protocoloDoDocumentoAnexado>123</protocoloDoDocumentoAnexado> | 801 | //<protocoloDoDocumentoAnexado>123</protocoloDoDocumentoAnexado> |
803 | //<protocoloDoProcessoAnexado>456</protocoloDoProcessoAnexado> | 802 | //<protocoloDoProcessoAnexado>456</protocoloDoProcessoAnexado> |
804 | //Retirado | 803 | //Retirado |
805 | - | ||
806 | //Considera o nmero/nome do documento externo para descrio do documento | 804 | //Considera o nmero/nome do documento externo para descrio do documento |
807 | if($documentoDTO->getStrStaProtocoloProtocolo() == ProtocoloRN::$TP_DOCUMENTO_RECEBIDO && $documentoDTO->getStrNumero() != null) { | 805 | if($documentoDTO->getStrStaProtocoloProtocolo() == ProtocoloRN::$TP_DOCUMENTO_RECEBIDO && $documentoDTO->getStrNumero() != null) { |
808 | $strDescricaoDocumento = $documentoDTO->getStrNumero(); | 806 | $strDescricaoDocumento = $documentoDTO->getStrNumero(); |
809 | - | ||
810 | }else{ | 807 | }else{ |
811 | $strDescricaoDocumento = "***"; | 808 | $strDescricaoDocumento = "***"; |
812 | } | 809 | } |
813 | - | ||
814 | // Não é um documento externo | 810 | // Não é um documento externo |
815 | /*elseif($documentoDTO->isSetNumIdTipoConferencia()){ | 811 | /*elseif($documentoDTO->isSetNumIdTipoConferencia()){ |
816 | 812 | ||
@@ -827,18 +823,14 @@ class ExpedirProcedimentoRN extends InfraRN { | @@ -827,18 +823,14 @@ class ExpedirProcedimentoRN extends InfraRN { | ||
827 | }*/ | 823 | }*/ |
828 | 824 | ||
829 | $documento->retirado = ($documentoDTO->getStrStaEstadoProtocolo() == ProtocoloRN::$TE_DOCUMENTO_CANCELADO) ? true : false; | 825 | $documento->retirado = ($documentoDTO->getStrStaEstadoProtocolo() == ProtocoloRN::$TE_DOCUMENTO_CANCELADO) ? true : false; |
830 | - | ||
831 | $documento->ordem = $ordemDocumento++; | 826 | $documento->ordem = $ordemDocumento++; |
832 | $documento->descricao = utf8_encode($strDescricaoDocumento); | 827 | $documento->descricao = utf8_encode($strDescricaoDocumento); |
833 | $documento->nivelDeSigilo = $this->obterNivelSigiloPEN($documentoDTO->getStrStaNivelAcessoLocalProtocolo()); | 828 | $documento->nivelDeSigilo = $this->obterNivelSigiloPEN($documentoDTO->getStrStaNivelAcessoLocalProtocolo()); |
834 | - | ||
835 | if($documentoDTO->getStrStaNivelAcessoLocalProtocolo() == ProtocoloRN::$NA_RESTRITO){ | 829 | if($documentoDTO->getStrStaNivelAcessoLocalProtocolo() == ProtocoloRN::$NA_RESTRITO){ |
836 | $documento->hipoteseLegal = new stdClass(); | 830 | $documento->hipoteseLegal = new stdClass(); |
837 | $documento->hipoteseLegal->identificacao = $objPenRelHipoteseLegalRN->getIdHipoteseLegalPEN($documentoDTO->getNumIdHipoteseLegalProtocolo()); | 831 | $documento->hipoteseLegal->identificacao = $objPenRelHipoteseLegalRN->getIdHipoteseLegalPEN($documentoDTO->getNumIdHipoteseLegalProtocolo()); |
838 | } | 832 | } |
839 | - | ||
840 | $documento->dataHoraDeProducao = $this->objProcessoEletronicoRN->converterDataWebService($documentoDTO->getDtaGeracaoProtocolo()); | 833 | $documento->dataHoraDeProducao = $this->objProcessoEletronicoRN->converterDataWebService($documentoDTO->getDtaGeracaoProtocolo()); |
841 | - | ||
842 | $documento->produtor = new stdClass(); | 834 | $documento->produtor = new stdClass(); |
843 | $usuarioDTO = $this->consultarUsuario($documentoDTO->getNumIdUsuarioGeradorProtocolo()); | 835 | $usuarioDTO = $this->consultarUsuario($documentoDTO->getNumIdUsuarioGeradorProtocolo()); |
844 | if(isset($usuarioDTO)) { | 836 | if(isset($usuarioDTO)) { |
@@ -848,7 +840,6 @@ class ExpedirProcedimentoRN extends InfraRN { | @@ -848,7 +840,6 @@ class ExpedirProcedimentoRN extends InfraRN { | ||
848 | $documento->produtor->tipo = self::STA_TIPO_PESSOA_FISICA;; | 840 | $documento->produtor->tipo = self::STA_TIPO_PESSOA_FISICA;; |
849 | } | 841 | } |
850 | 842 | ||
851 | - | ||
852 | $unidadeDTO = $this->consultarUnidade($documentoDTO->getNumIdUnidadeResponsavel()); | 843 | $unidadeDTO = $this->consultarUnidade($documentoDTO->getNumIdUnidadeResponsavel()); |
853 | if(isset($unidadeDTO)) { | 844 | if(isset($unidadeDTO)) { |
854 | $documento->produtor->unidade = new stdClass(); | 845 | $documento->produtor->unidade = new stdClass(); |
@@ -856,20 +847,16 @@ class ExpedirProcedimentoRN extends InfraRN { | @@ -856,20 +847,16 @@ class ExpedirProcedimentoRN extends InfraRN { | ||
856 | $documento->produtor->unidade->tipo = self::STA_TIPO_PESSOA_ORGAOPUBLICO; | 847 | $documento->produtor->unidade->tipo = self::STA_TIPO_PESSOA_ORGAOPUBLICO; |
857 | //TODO: Informar dados da estrutura organizacional (estruturaOrganizacional) | 848 | //TODO: Informar dados da estrutura organizacional (estruturaOrganizacional) |
858 | } | 849 | } |
859 | - | ||
860 | $documento->produtor->numeroDeIdentificacao = $documentoDTO->getStrProtocoloDocumentoFormatado(); | 850 | $documento->produtor->numeroDeIdentificacao = $documentoDTO->getStrProtocoloDocumentoFormatado(); |
861 | 851 | ||
862 | $this->atribuirDataHoraDeRegistro($documento, $documentoDTO->getDblIdProcedimento(), $documentoDTO->getDblIdDocumento()); | 852 | $this->atribuirDataHoraDeRegistro($documento, $documentoDTO->getDblIdProcedimento(), $documentoDTO->getDblIdDocumento()); |
863 | - | ||
864 | //TODO: Implementar mapeamento de espécies documentais | 853 | //TODO: Implementar mapeamento de espécies documentais |
865 | $documento->especie = new stdClass(); | 854 | $documento->especie = new stdClass(); |
866 | $documento->especie->codigo = $this->obterEspecieMapeada($documentoDTO->getNumIdSerie()); | 855 | $documento->especie->codigo = $this->obterEspecieMapeada($documentoDTO->getNumIdSerie()); |
867 | $documento->especie->nomeNoProdutor = utf8_encode($documentoDTO->getStrNomeSerie()); | 856 | $documento->especie->nomeNoProdutor = utf8_encode($documentoDTO->getStrNomeSerie()); |
868 | //TODO: Tratar campos adicionais do documento | 857 | //TODO: Tratar campos adicionais do documento |
869 | - | ||
870 | //Identificao do documento | 858 | //Identificao do documento |
871 | $this->atribuirNumeracaoDocumento($documento, $documentoDTO); | 859 | $this->atribuirNumeracaoDocumento($documento, $documentoDTO); |
872 | - | ||
873 | if($documento->retirado === true){ | 860 | if($documento->retirado === true){ |
874 | 861 | ||
875 | $penComponenteDigitalDTO = new ComponenteDigitalDTO(); | 862 | $penComponenteDigitalDTO = new ComponenteDigitalDTO(); |
@@ -893,7 +880,6 @@ class ExpedirProcedimentoRN extends InfraRN { | @@ -893,7 +880,6 @@ class ExpedirProcedimentoRN extends InfraRN { | ||
893 | $documento->componenteDigital->idAnexo = $componenteDigital->getNumIdAnexo(); | 880 | $documento->componenteDigital->idAnexo = $componenteDigital->getNumIdAnexo(); |
894 | 881 | ||
895 | 882 | ||
896 | - | ||
897 | // -------------------------- INICIO DA TAREFA US074 -------------------------------// | 883 | // -------------------------- INICIO DA TAREFA US074 -------------------------------// |
898 | $documento = $this->atribuirDadosAssinaturaDigital($documentoDTO, $documento, $componenteDigital->getStrHashConteudo()); | 884 | $documento = $this->atribuirDadosAssinaturaDigital($documentoDTO, $documento, $componenteDigital->getStrHashConteudo()); |
899 | // -------------------------- FIM TAREFA US074 -------------------------------// | 885 | // -------------------------- FIM TAREFA US074 -------------------------------// |
@@ -908,7 +894,6 @@ class ExpedirProcedimentoRN extends InfraRN { | @@ -908,7 +894,6 @@ class ExpedirProcedimentoRN extends InfraRN { | ||
908 | 894 | ||
909 | } | 895 | } |
910 | 896 | ||
911 | - | ||
912 | }else{ | 897 | }else{ |
913 | $this->atribuirComponentesDigitais($documento, $documentoDTO); | 898 | $this->atribuirComponentesDigitais($documento, $documentoDTO); |
914 | } | 899 | } |
@@ -922,7 +907,6 @@ class ExpedirProcedimentoRN extends InfraRN { | @@ -922,7 +907,6 @@ class ExpedirProcedimentoRN extends InfraRN { | ||
922 | $documento->idDocumentoSEI = $documentoDTO->getDblIdDocumento(); | 907 | $documento->idDocumentoSEI = $documentoDTO->getDblIdDocumento(); |
923 | $objProcesso->documento[] = $documento; | 908 | $objProcesso->documento[] = $documento; |
924 | } | 909 | } |
925 | - | ||
926 | } | 910 | } |
927 | 911 | ||
928 | public function atribuirComponentesDigitaisRetirados($documentoDTO){ | 912 | public function atribuirComponentesDigitaisRetirados($documentoDTO){ |
@@ -976,6 +960,7 @@ class ExpedirProcedimentoRN extends InfraRN { | @@ -976,6 +960,7 @@ class ExpedirProcedimentoRN extends InfraRN { | ||
976 | private function atribuirComponentesDigitais($objDocumento, DocumentoDTO $objDocumentoDTO) | 960 | private function atribuirComponentesDigitais($objDocumento, DocumentoDTO $objDocumentoDTO) |
977 | { | 961 | { |
978 | 962 | ||
963 | + | ||
979 | if(!isset($objDocumento)){ | 964 | if(!isset($objDocumento)){ |
980 | throw new InfraException('Parâmetro $objDocumento não informado.'); | 965 | throw new InfraException('Parâmetro $objDocumento não informado.'); |
981 | } | 966 | } |
@@ -989,30 +974,25 @@ class ExpedirProcedimentoRN extends InfraRN { | @@ -989,30 +974,25 @@ class ExpedirProcedimentoRN extends InfraRN { | ||
989 | if(!isset($arrInformacaoArquivo) || count($arrInformacaoArquivo) == 0){ | 974 | if(!isset($arrInformacaoArquivo) || count($arrInformacaoArquivo) == 0){ |
990 | throw new InfraException('Erro durante obtenção de informações sobre o componente digital do documento {$objDocumentoDTO->getStrProtocoloDocumentoFormatado()}.'); | 975 | throw new InfraException('Erro durante obtenção de informações sobre o componente digital do documento {$objDocumentoDTO->getStrProtocoloDocumentoFormatado()}.'); |
991 | } | 976 | } |
992 | - | ||
993 | //TODO: Revisar tal implementao para atender a gerao de hash de arquivos grandes | 977 | //TODO: Revisar tal implementao para atender a gerao de hash de arquivos grandes |
994 | $strAlgoritmoHash = self::ALGORITMO_HASH_DOCUMENTO; | 978 | $strAlgoritmoHash = self::ALGORITMO_HASH_DOCUMENTO; |
995 | $strConteudoAssinatura = $arrInformacaoArquivo['CONTEUDO']; | 979 | $strConteudoAssinatura = $arrInformacaoArquivo['CONTEUDO']; |
996 | $hashDoComponenteDigital = hash($strAlgoritmoHash, $strConteudoAssinatura, true); | 980 | $hashDoComponenteDigital = hash($strAlgoritmoHash, $strConteudoAssinatura, true); |
997 | $hashDoComponenteDigital = base64_encode($hashDoComponenteDigital); | 981 | $hashDoComponenteDigital = base64_encode($hashDoComponenteDigital); |
998 | - | ||
999 | $objDocumento->componenteDigital = new stdClass(); | 982 | $objDocumento->componenteDigital = new stdClass(); |
1000 | $objDocumento->componenteDigital->ordem = 1; | 983 | $objDocumento->componenteDigital->ordem = 1; |
1001 | $objDocumento->componenteDigital->nome = utf8_encode($arrInformacaoArquivo["NOME"]); | 984 | $objDocumento->componenteDigital->nome = utf8_encode($arrInformacaoArquivo["NOME"]); |
1002 | $objDocumento->componenteDigital->hash = new SoapVar("<hash algoritmo='{$strAlgoritmoHash}'>{$hashDoComponenteDigital}</hash>", XSD_ANYXML); | 985 | $objDocumento->componenteDigital->hash = new SoapVar("<hash algoritmo='{$strAlgoritmoHash}'>{$hashDoComponenteDigital}</hash>", XSD_ANYXML); |
1003 | $objDocumento->componenteDigital->tamanhoEmBytes = $arrInformacaoArquivo['TAMANHO']; | 986 | $objDocumento->componenteDigital->tamanhoEmBytes = $arrInformacaoArquivo['TAMANHO']; |
1004 | - | ||
1005 | //TODO: Validar os tipos de mimetype de acordo com o WSDL do SEI | 987 | //TODO: Validar os tipos de mimetype de acordo com o WSDL do SEI |
1006 | //Caso no identifique o tipo correto, informar o valor [outro] | 988 | //Caso no identifique o tipo correto, informar o valor [outro] |
1007 | $objDocumento->componenteDigital->mimeType = $arrInformacaoArquivo['MIME_TYPE']; | 989 | $objDocumento->componenteDigital->mimeType = $arrInformacaoArquivo['MIME_TYPE']; |
1008 | $objDocumento->componenteDigital->tipoDeConteudo = $this->obterTipoDeConteudo($arrInformacaoArquivo['MIME_TYPE']); | 990 | $objDocumento->componenteDigital->tipoDeConteudo = $this->obterTipoDeConteudo($arrInformacaoArquivo['MIME_TYPE']); |
1009 | 991 | ||
1010 | - | ||
1011 | // -------------------------- INICIO DA TAREFA US074 -------------------------------/ | 992 | // -------------------------- INICIO DA TAREFA US074 -------------------------------/ |
1012 | $objDocumento = $this->atribuirDadosAssinaturaDigital($objDocumentoDTO, $objDocumento, $hashDoComponenteDigital); | 993 | $objDocumento = $this->atribuirDadosAssinaturaDigital($objDocumentoDTO, $objDocumento, $hashDoComponenteDigital); |
1013 | // -------------------------- FIM TAREFA US074 -------------------------------// | 994 | // -------------------------- FIM TAREFA US074 -------------------------------// |
1014 | 995 | ||
1015 | - | ||
1016 | if($arrInformacaoArquivo['MIME_TYPE'] == 'outro'){ | 996 | if($arrInformacaoArquivo['MIME_TYPE'] == 'outro'){ |
1017 | $objDocumento->componenteDigital->dadosComplementaresDoTipoDeArquivo = $arrInformacaoArquivo['dadosComplementaresDoTipoDeArquivo']; | 997 | $objDocumento->componenteDigital->dadosComplementaresDoTipoDeArquivo = $arrInformacaoArquivo['dadosComplementaresDoTipoDeArquivo']; |
1018 | } | 998 | } |
@@ -1020,7 +1000,6 @@ class ExpedirProcedimentoRN extends InfraRN { | @@ -1020,7 +1000,6 @@ class ExpedirProcedimentoRN extends InfraRN { | ||
1020 | //TODO: Preencher dados complementares do tipo de arquivo | 1000 | //TODO: Preencher dados complementares do tipo de arquivo |
1021 | //$objDocumento->componenteDigital->dadosComplementaresDoTipoDeArquivo = ''; | 1001 | //$objDocumento->componenteDigital->dadosComplementaresDoTipoDeArquivo = ''; |
1022 | 1002 | ||
1023 | - | ||
1024 | //TODO: Carregar informações da assinatura digital | 1003 | //TODO: Carregar informações da assinatura digital |
1025 | //$this->atribuirAssinaturaEletronica($objDocumento->componenteDigital, $objDocumentoDTO); | 1004 | //$this->atribuirAssinaturaEletronica($objDocumento->componenteDigital, $objDocumentoDTO); |
1026 | 1005 | ||
@@ -1047,12 +1026,13 @@ class ExpedirProcedimentoRN extends InfraRN { | @@ -1047,12 +1026,13 @@ class ExpedirProcedimentoRN extends InfraRN { | ||
1047 | $objDocumentoDTOTarjas->retNumIdUnidadeGeradoraProtocolo(); | 1026 | $objDocumentoDTOTarjas->retNumIdUnidadeGeradoraProtocolo(); |
1048 | $objDocumentoDTOTarjas->retStrDescricaoTipoConferencia(); | 1027 | $objDocumentoDTOTarjas->retStrDescricaoTipoConferencia(); |
1049 | $objDocumentoDTOTarjas->setDblIdDocumento($objDocumentoDTO->getDblIdDocumento()); | 1028 | $objDocumentoDTOTarjas->setDblIdDocumento($objDocumentoDTO->getDblIdDocumento()); |
1029 | + | ||
1050 | $objDocumentoRN = new DocumentoRN(); | 1030 | $objDocumentoRN = new DocumentoRN(); |
1051 | $objDocumentoDTOTarjas = $objDocumentoRN->consultarRN0005($objDocumentoDTOTarjas); | 1031 | $objDocumentoDTOTarjas = $objDocumentoRN->consultarRN0005($objDocumentoDTOTarjas); |
1032 | + | ||
1052 | $objAssinaturaRN = new AssinaturaRN(); | 1033 | $objAssinaturaRN = new AssinaturaRN(); |
1053 | $tarjas = $objAssinaturaRN->montarTarjas($objDocumentoDTOTarjas); | 1034 | $tarjas = $objAssinaturaRN->montarTarjas($objDocumentoDTOTarjas); |
1054 | 1035 | ||
1055 | - | ||
1056 | //Remove todos os 12 espaos padres aps remover as tags. | 1036 | //Remove todos os 12 espaos padres aps remover as tags. |
1057 | $dataTarjas = explode(' ', strip_tags($tarjas)); | 1037 | $dataTarjas = explode(' ', strip_tags($tarjas)); |
1058 | foreach ($dataTarjas as $key => $content) { | 1038 | foreach ($dataTarjas as $key => $content) { |
@@ -1063,42 +1043,46 @@ class ExpedirProcedimentoRN extends InfraRN { | @@ -1063,42 +1043,46 @@ class ExpedirProcedimentoRN extends InfraRN { | ||
1063 | $dataTarjas[$key] = html_entity_decode($contentTrim); //Decodifica por causa do strip_tags | 1043 | $dataTarjas[$key] = html_entity_decode($contentTrim); //Decodifica por causa do strip_tags |
1064 | } | 1044 | } |
1065 | } | 1045 | } |
1066 | - | ||
1067 | $dataTarjas = array_values($dataTarjas); //Reseta os valores da array | 1046 | $dataTarjas = array_values($dataTarjas); //Reseta os valores da array |
1068 | 1047 | ||
1069 | $objAssinaturaDTO = new AssinaturaDTO(); | 1048 | $objAssinaturaDTO = new AssinaturaDTO(); |
1070 | $objAssinaturaDTO->setDblIdDocumento($objDocumentoDTO->getDblIdDocumento()); | 1049 | $objAssinaturaDTO->setDblIdDocumento($objDocumentoDTO->getDblIdDocumento()); |
1071 | $objAssinaturaDTO->retNumIdAtividade(); | 1050 | $objAssinaturaDTO->retNumIdAtividade(); |
1051 | + $objAssinaturaDTO->retStrStaFormaAutenticacao(); | ||
1072 | $objAssinaturaDTO->retStrP7sBase64(); | 1052 | $objAssinaturaDTO->retStrP7sBase64(); |
1053 | + | ||
1073 | $objAssinaturaRN = new AssinaturaRN(); | 1054 | $objAssinaturaRN = new AssinaturaRN(); |
1074 | $resAssinatura = $objAssinaturaRN->listarRN1323($objAssinaturaDTO); | 1055 | $resAssinatura = $objAssinaturaRN->listarRN1323($objAssinaturaDTO); |
1075 | 1056 | ||
1076 | - | ||
1077 | $objDocumento->componenteDigital->assinaturaDigital = array(); | 1057 | $objDocumento->componenteDigital->assinaturaDigital = array(); |
1078 | //Para cada assinatura | 1058 | //Para cada assinatura |
1079 | foreach ($resAssinatura as $keyOrder => $assinatura) { | 1059 | foreach ($resAssinatura as $keyOrder => $assinatura) { |
1080 | - | ||
1081 | //Busca data da assinatura | 1060 | //Busca data da assinatura |
1082 | $objAtividadeDTO = new AtividadeDTO(); | 1061 | $objAtividadeDTO = new AtividadeDTO(); |
1083 | $objAtividadeDTO->setNumIdAtividade($assinatura->getNumIdAtividade()); | 1062 | $objAtividadeDTO->setNumIdAtividade($assinatura->getNumIdAtividade()); |
1084 | - $objAtividadeDTO->setNumIdTarefa(TarefaRN::$TI_ASSINATURA_DOCUMENTO); | 1063 | + $objAtividadeDTO->setNumIdTarefa(array(TarefaRN::$TI_ASSINATURA_DOCUMENTO, TarefaRN::$TI_AUTENTICACAO_DOCUMENTO), InfraDTO::$OPER_IN); |
1085 | $objAtividadeDTO->retDthAbertura(); | 1064 | $objAtividadeDTO->retDthAbertura(); |
1086 | $objAtividadeDTO->retNumIdAtividade(); | 1065 | $objAtividadeDTO->retNumIdAtividade(); |
1087 | $objAtividadeRN = new AtividadeRN(); | 1066 | $objAtividadeRN = new AtividadeRN(); |
1088 | $objAtividade = $objAtividadeRN->consultarRN0033($objAtividadeDTO); | 1067 | $objAtividade = $objAtividadeRN->consultarRN0033($objAtividadeDTO); |
1089 | 1068 | ||
1090 | $objAssinaturaDigital = new stdClass(); | 1069 | $objAssinaturaDigital = new stdClass(); |
1091 | - $objAssinaturaDigital->dataHora = $this->objProcessoEletronicoRN->converterDataWebService($objAtividade->getDthAbertura()); | ||
1092 | - $objAssinaturaDigital->hash = new SoapVar("<hash algoritmo='".self::ALGORITMO_HASH_ASSINATURA."'>{$strHashDocumento}</hash>", XSD_ANYXML); | ||
1093 | - $objAssinaturaDigital->cadeiaDoCertificado = new SoapVar('<cadeiaDoCertificado formato="PKCS7">'.($assinatura->getStrP7sBase64() ? $assinatura->getStrP7sBase64() : 'null').'</cadeiaDoCertificado>', XSD_ANYXML); | ||
1094 | $objAssinaturaDigital->razao = utf8_encode($dataTarjas[$keyOrder]); | 1070 | $objAssinaturaDigital->razao = utf8_encode($dataTarjas[$keyOrder]); |
1095 | $objAssinaturaDigital->observacao = utf8_encode($dataTarjas[count($dataTarjas) - 1]); | 1071 | $objAssinaturaDigital->observacao = utf8_encode($dataTarjas[count($dataTarjas) - 1]); |
1072 | + $objAssinaturaDigital->dataHora = $this->objProcessoEletronicoRN->converterDataWebService($objAtividade->getDthAbertura()); | ||
1073 | + | ||
1074 | + if($assinatura->getStrStaFormaAutenticacao() == AssinaturaRN::$TA_CERTIFICADO_DIGITAL){ | ||
1075 | + $objAssinaturaDigital->hash = new SoapVar("<hash algoritmo='".self::ALGORITMO_HASH_ASSINATURA."'>{$strHashDocumento}</hash>", XSD_ANYXML); | ||
1076 | + $objAssinaturaDigital->cadeiaDoCertificado = new SoapVar('<cadeiaDoCertificado formato="PKCS7">'.($assinatura->getStrP7sBase64() ? $assinatura->getStrP7sBase64() : 'null').'</cadeiaDoCertificado>', XSD_ANYXML); | ||
1077 | + } else { | ||
1078 | + $objAssinaturaDigital->hash = new SoapVar("<hash algoritmo='".self::ALGORITMO_HASH_ASSINATURA."'>null</hash>", XSD_ANYXML); | ||
1079 | + $objAssinaturaDigital->cadeiaDoCertificado = new SoapVar('<cadeiaDoCertificado formato="PKCS7">null</cadeiaDoCertificado>', XSD_ANYXML); | ||
1080 | + } | ||
1096 | 1081 | ||
1097 | $objDocumento->componenteDigital->assinaturaDigital[] = $objAssinaturaDigital; | 1082 | $objDocumento->componenteDigital->assinaturaDigital[] = $objAssinaturaDigital; |
1098 | } | 1083 | } |
1099 | 1084 | ||
1100 | 1085 | ||
1101 | - | ||
1102 | return $objDocumento; | 1086 | return $objDocumento; |
1103 | } | 1087 | } |
1104 | 1088 |
rn/PenAtualizarSeiRN.php
@@ -604,7 +604,7 @@ class PenAtualizarSeiRN extends PenAtualizadorRN { | @@ -604,7 +604,7 @@ class PenAtualizarSeiRN extends PenAtualizadorRN { | ||
604 | } | 604 | } |
605 | }; | 605 | }; |
606 | 606 | ||
607 | - | 607 | + //TODO: Corrigir mensagem com português errado |
608 | $fnCadastrar('Processo trâmitado externamente para a entidade @UNIDADE_DESTINO@ - @REPOSITORIO_DESTINO@ (@PROCESSO@, @UNIDADE@, @USUARIO@)', 'S', 'S', 'N', 'S', 'N', 'PEN_PROCESSO_EXPEDIDO'); | 608 | $fnCadastrar('Processo trâmitado externamente para a entidade @UNIDADE_DESTINO@ - @REPOSITORIO_DESTINO@ (@PROCESSO@, @UNIDADE@, @USUARIO@)', 'S', 'S', 'N', 'S', 'N', 'PEN_PROCESSO_EXPEDIDO'); |
609 | $fnCadastrar('Processo recebido da entidade @ENTIDADE_ORIGEM@ - @REPOSITORIO_ORIGEM@ (@PROCESSO@, @ENTIDADE_ORIGEM@, @UNIDADE_DESTINO@, @USUARIO@)', 'S', 'S', 'N', 'S', 'N', 'PEN_PROCESSO_RECEBIDO'); | 609 | $fnCadastrar('Processo recebido da entidade @ENTIDADE_ORIGEM@ - @REPOSITORIO_ORIGEM@ (@PROCESSO@, @ENTIDADE_ORIGEM@, @UNIDADE_DESTINO@, @USUARIO@)', 'S', 'S', 'N', 'S', 'N', 'PEN_PROCESSO_RECEBIDO'); |
610 | $fnCadastrar('O processo foi recusado pelo orgão @UNIDADE_DESTINO@ pelo seguinte motivo: @MOTIVO@', 'S', 'S', 'N', 'N', 'S', 'PEN_PROCESSO_RECUSADO'); | 610 | $fnCadastrar('O processo foi recusado pelo orgão @UNIDADE_DESTINO@ pelo seguinte motivo: @MOTIVO@', 'S', 'S', 'N', 'N', 'S', 'PEN_PROCESSO_RECUSADO'); |
rn/ReceberProcedimentoRN.php
@@ -1823,19 +1823,16 @@ protected function receberTramiteRecusadoInternoControlado(ReceberTramiteRecusad | @@ -1823,19 +1823,16 @@ protected function receberTramiteRecusadoInternoControlado(ReceberTramiteRecusad | ||
1823 | * @param integer $parIdTramite | 1823 | * @param integer $parIdTramite |
1824 | * @throws InfraException | 1824 | * @throws InfraException |
1825 | */ | 1825 | */ |
1826 | - public function verificarPermissoesDiretorios($parIdTramite){ | ||
1827 | - | 1826 | + public function verificarPermissoesDiretorios($parIdTramite) |
1827 | + { | ||
1828 | //Verifica se o usuário possui permissões de escrita no repositório de arquivos externos | 1828 | //Verifica se o usuário possui permissões de escrita no repositório de arquivos externos |
1829 | - if(!is_writable(ConfiguracaoSEI::getInstance()->getValor('SEI', 'RepositorioArquivos'))){ | ||
1830 | - | 1829 | + if(!is_writable(ConfiguracaoSEI::getInstance()->getValor('SEI', 'RepositorioArquivos'))) { |
1831 | $this->objProcessoEletronicoRN->recusarTramite($parIdTramite, 'O sistema não possui permissão de escrita no diretório de armazenamento de documentos externos', ProcessoEletronicoRN::MTV_RCSR_TRAM_CD_OUTROU); | 1830 | $this->objProcessoEletronicoRN->recusarTramite($parIdTramite, 'O sistema não possui permissão de escrita no diretório de armazenamento de documentos externos', ProcessoEletronicoRN::MTV_RCSR_TRAM_CD_OUTROU); |
1832 | throw new InfraException('O sistema não possui permissão de escrita no diretório de armazenamento de documentos externos'); | 1831 | throw new InfraException('O sistema não possui permissão de escrita no diretório de armazenamento de documentos externos'); |
1833 | - | ||
1834 | } | 1832 | } |
1835 | 1833 | ||
1836 | //Verifica se o usuário possui permissões de escrita no diretório temporário de arquivos | 1834 | //Verifica se o usuário possui permissões de escrita no diretório temporário de arquivos |
1837 | if(!is_writable(DIR_SEI_TEMP)){ | 1835 | if(!is_writable(DIR_SEI_TEMP)){ |
1838 | - | ||
1839 | $this->objProcessoEletronicoRN->recusarTramite($parIdTramite, 'O sistema não possui permissão de escrita no diretório de armazenamento de arquivos temporários do sistema.', ProcessoEletronicoRN::MTV_RCSR_TRAM_CD_OUTROU); | 1836 | $this->objProcessoEletronicoRN->recusarTramite($parIdTramite, 'O sistema não possui permissão de escrita no diretório de armazenamento de arquivos temporários do sistema.', ProcessoEletronicoRN::MTV_RCSR_TRAM_CD_OUTROU); |
1840 | throw new InfraException('O sistema não possui permissão de escrita no diretório de armazenamento de arquivos temporários do sistema.'); | 1837 | throw new InfraException('O sistema não possui permissão de escrita no diretório de armazenamento de arquivos temporários do sistema.'); |
1841 | 1838 |