Commit 82dbf88c8199d15d51d1e82e712dec0e9f92ed75
1 parent
0864e14e
Exists in
master
and in
19 other branches
Ajustes para multiplos documentos
Showing
1 changed file
with
27 additions
and
26 deletions
Show diff stats
rn/ExpedirProcedimentoRN.php
| ... | ... | @@ -1015,7 +1015,7 @@ class ExpedirProcedimentoRN extends InfraRN { |
| 1015 | 1015 | //TODO: Revisar tal implementação para atender a geração de hash de arquivos grandes |
| 1016 | 1016 | $strAlgoritmoHash = self::ALGORITMO_HASH_DOCUMENTO; |
| 1017 | 1017 | $strConteudoAssinatura = $arrInformacaoArquivo['CONTEUDO']; |
| 1018 | - $hashDoComponenteDigital = hash($strAlgoritmoHash, $strConteudoAssinatura, true); | |
| 1018 | + $hashDoComponenteDigital = hash($strAlgoritmoHash, $strConteudoAssinatura, true); | |
| 1019 | 1019 | $hashDoComponenteDigital = base64_encode($hashDoComponenteDigital); |
| 1020 | 1020 | |
| 1021 | 1021 | $objDocumento->componenteDigital = new stdClass(); |
| ... | ... | @@ -1031,7 +1031,6 @@ class ExpedirProcedimentoRN extends InfraRN { |
| 1031 | 1031 | |
| 1032 | 1032 | |
| 1033 | 1033 | // -------------------------- INICIO DA TAREFA US074 -------------------------------/ |
| 1034 | - | |
| 1035 | 1034 | $objDocumento = $this->atribuirDadosAssinaturaDigital($objDocumentoDTO, $objDocumento, $hashDoComponenteDigital); |
| 1036 | 1035 | // -------------------------- FIM TAREFA US074 -------------------------------// |
| 1037 | 1036 | |
| ... | ... | @@ -1052,6 +1051,8 @@ class ExpedirProcedimentoRN extends InfraRN { |
| 1052 | 1051 | } |
| 1053 | 1052 | |
| 1054 | 1053 | public function atribuirDadosAssinaturaDigital($objDocumentoDTO, $objDocumento, $strHashDocumento) { |
| 1054 | + | |
| 1055 | + | |
| 1055 | 1056 | //Busca as Tarjas |
| 1056 | 1057 | $objDocumentoDTOTarjas = new DocumentoDTO(); |
| 1057 | 1058 | $objDocumentoDTOTarjas->retDblIdDocumento(); |
| ... | ... | @@ -1087,39 +1088,39 @@ class ExpedirProcedimentoRN extends InfraRN { |
| 1087 | 1088 | |
| 1088 | 1089 | $dataTarjas = array_values($dataTarjas); //Reseta os valores da array |
| 1089 | 1090 | |
| 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); | |
| 1091 | + $objAssinaturaDTO = new AssinaturaDTO(); | |
| 1092 | + $objAssinaturaDTO->setDblIdDocumento($objDocumentoDTO->getDblIdDocumento()); | |
| 1093 | + $objAssinaturaDTO->retNumIdAtividade(); | |
| 1094 | + $objAssinaturaDTO->retStrP7sBase64(); | |
| 1095 | + $objAssinaturaRN = new AssinaturaRN(); | |
| 1096 | + $resAssinatura = $objAssinaturaRN->listarRN1323($objAssinaturaDTO); | |
| 1097 | + | |
| 1098 | 1098 | |
| 1099 | 1099 | $objDocumento->componenteDigital->assinaturaDigital = array(); |
| 1100 | 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 | - | |
| 1101 | + foreach ($resAssinatura as $keyOrder => $assinatura) { | |
| 1102 | + | |
| 1103 | + //Busca data da assinatura | |
| 1104 | + $objAtividadeDTO = new AtividadeDTO(); | |
| 1105 | + $objAtividadeDTO->setNumIdAtividade($assinatura->getNumIdAtividade()); | |
| 1106 | + $objAtividadeDTO->setNumIdTarefa(TarefaRN::$TI_ASSINATURA_DOCUMENTO); | |
| 1107 | + $objAtividadeDTO->retDthAbertura(); | |
| 1108 | + $objAtividadeDTO->retNumIdAtividade(); | |
| 1109 | + $objAtividadeRN = new AtividadeRN(); | |
| 1110 | + $objAtividade = $objAtividadeRN->consultarRN0033($objAtividadeDTO); | |
| 1111 | + | |
| 1111 | 1112 | $objAssinaturaDigital = new stdClass(); |
| 1112 | - | |
| 1113 | - $objAssinaturaDigital->dataHora = $this->objProcessoEletronicoRN->converterDataWebService($atividade->getDthAbertura()); | |
| 1114 | - | |
| 1113 | + $objAssinaturaDigital->dataHora = $this->objProcessoEletronicoRN->converterDataWebService($objAtividade->getDthAbertura()); | |
| 1115 | 1114 | $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]); | |
| 1115 | + $objAssinaturaDigital->cadeiaDoCertificado = new SoapVar('<cadeiaDoCertificado formato="PKCS7">'.($assinatura->getStrP7sBase64() ? $assinatura->getStrP7sBase64() : 'null').'</cadeiaDoCertificado>', XSD_ANYXML); | |
| 1116 | + $objAssinaturaDigital->razao = utf8_encode($dataTarjas[$keyOrder]); | |
| 1117 | + $objAssinaturaDigital->observacao = utf8_encode($dataTarjas[count($dataTarjas) - 1]); | |
| 1119 | 1118 | |
| 1120 | 1119 | $objDocumento->componenteDigital->assinaturaDigital[] = $objAssinaturaDigital; |
| 1121 | 1120 | } |
| 1122 | 1121 | |
| 1122 | + | |
| 1123 | + | |
| 1123 | 1124 | return $objDocumento; |
| 1124 | 1125 | } |
| 1125 | 1126 | ... | ... |