Commit beddc17f5facf966ea0ce6aee7f921ade7672baf
1 parent
c95033c4
Exists in
master
and in
21 other branches
Correção no recebimento dos componentes digitais iguais para o mesmo processo e …
…dos hashs nos recibos
Showing
3 changed files
with
21 additions
and
6 deletions
Show diff stats
rn/ExpedirProcedimentoRN.php
@@ -1837,6 +1837,7 @@ class ExpedirProcedimentoRN extends InfraRN { | @@ -1837,6 +1837,7 @@ class ExpedirProcedimentoRN extends InfraRN { | ||
1837 | 1837 | ||
1838 | $objGenericoBD->cadastrar($objReciboTramiteDTO); | 1838 | $objGenericoBD->cadastrar($objReciboTramiteDTO); |
1839 | 1839 | ||
1840 | + $objReciboEnvio->reciboDeEnvio->hashDoComponenteDigital = !is_array($objReciboEnvio->reciboDeEnvio->hashDoComponenteDigital) ? array($objReciboEnvio->reciboDeEnvio->hashDoComponenteDigital) : $objReciboEnvio->reciboDeEnvio->hashDoComponenteDigital; | ||
1840 | if($objReciboEnvio->reciboDeEnvio->hashDoComponenteDigital && is_array($objReciboEnvio->reciboDeEnvio->hashDoComponenteDigital)){ | 1841 | if($objReciboEnvio->reciboDeEnvio->hashDoComponenteDigital && is_array($objReciboEnvio->reciboDeEnvio->hashDoComponenteDigital)){ |
1841 | 1842 | ||
1842 | foreach($objReciboEnvio->reciboDeEnvio->hashDoComponenteDigital as $strHashComponenteDigital){ | 1843 | foreach($objReciboEnvio->reciboDeEnvio->hashDoComponenteDigital as $strHashComponenteDigital){ |
rn/ReceberComponenteDigitalRN.php
@@ -50,7 +50,19 @@ class ReceberComponenteDigitalRN extends InfraRN | @@ -50,7 +50,19 @@ class ReceberComponenteDigitalRN extends InfraRN | ||
50 | 50 | ||
51 | 51 | ||
52 | 52 | ||
53 | - $objAnexoDTO = $this->arrAnexos[$parObjComponenteDigitalDTO->getStrHashConteudo()]; | 53 | + $objAnexoDTO = null; |
54 | + | ||
55 | + foreach($this->arrAnexos as $key => $objAnexo){ | ||
56 | + if(array_key_exists($parObjComponenteDigitalDTO->getStrHashConteudo(), $objAnexo) && $objAnexo['recebido'] == false){ | ||
57 | + $objAnexoDTO = $objAnexo[$parObjComponenteDigitalDTO->getStrHashConteudo()]; | ||
58 | + $this->arrAnexos[$key]['recebido'] = true; | ||
59 | + break; | ||
60 | + } | ||
61 | + } | ||
62 | + | ||
63 | + if(is_null($objAnexoDTO)){ | ||
64 | + throw new InfraException('Anexo '.$parObjComponenteDigitalDTO->getStrHashConteudo().' não encontrado'.var_export($this->arrAnexos, true)); | ||
65 | + } | ||
54 | 66 | ||
55 | //Validar o hash do documento recebido com os dados informados pelo remetente | 67 | //Validar o hash do documento recebido com os dados informados pelo remetente |
56 | //$this->validarIntegridadeDoComponenteDigital($objAnexoDTO, $parObjComponenteDigitalDTO); | 68 | //$this->validarIntegridadeDoComponenteDigital($objAnexoDTO, $parObjComponenteDigitalDTO); |
rn/ReceberProcedimentoRN.php
@@ -136,9 +136,10 @@ class ReceberProcedimentoRN extends InfraRN | @@ -136,9 +136,10 @@ class ReceberProcedimentoRN extends InfraRN | ||
136 | 136 | ||
137 | //Cria o array com a lista de hash | 137 | //Cria o array com a lista de hash |
138 | $arrayHash = array(); | 138 | $arrayHash = array(); |
139 | - | 139 | + |
140 | + | ||
140 | //Percorre os componentes que precisam ser recebidos | 141 | //Percorre os componentes que precisam ser recebidos |
141 | - foreach($objTramite->componenteDigitalPendenteDeRecebimento as $componentePendente){ | 142 | + foreach($objTramite->componenteDigitalPendenteDeRecebimento as $key => $componentePendente){ |
142 | 143 | ||
143 | if(!is_null($componentePendente)){ | 144 | if(!is_null($componentePendente)){ |
144 | 145 | ||
@@ -148,13 +149,14 @@ class ReceberProcedimentoRN extends InfraRN | @@ -148,13 +149,14 @@ class ReceberProcedimentoRN extends InfraRN | ||
148 | //Obter os dados do componente digital | 149 | //Obter os dados do componente digital |
149 | $objComponenteDigital = $this->objProcessoEletronicoRN->receberComponenteDigital($parNumIdentificacaoTramite, $componentePendente, $objTramite->protocolo); | 150 | $objComponenteDigital = $this->objProcessoEletronicoRN->receberComponenteDigital($parNumIdentificacaoTramite, $componentePendente, $objTramite->protocolo); |
150 | //Copia o componente para a pasta temporária | 151 | //Copia o componente para a pasta temporária |
151 | - $arrAnexosComponentes[$componentePendente] = $receberComponenteDigitalRN->copiarComponenteDigitalPastaTemporaria($objComponenteDigital); | 152 | + $arrAnexosComponentes[$key][$componentePendente] = $receberComponenteDigitalRN->copiarComponenteDigitalPastaTemporaria($objComponenteDigital); |
153 | + $arrAnexosComponentes[$key]['recebido'] = false; | ||
152 | 154 | ||
153 | //Valida a integridade do hash | 155 | //Valida a integridade do hash |
154 | - $receberComponenteDigitalRN->validarIntegridadeDoComponenteDigital($arrAnexosComponentes[$componentePendente], $componentePendente, $parNumIdentificacaoTramite); | 156 | + $receberComponenteDigitalRN->validarIntegridadeDoComponenteDigital($arrAnexosComponentes[$key][$componentePendente], $componentePendente, $parNumIdentificacaoTramite); |
155 | } | 157 | } |
156 | } | 158 | } |
157 | - | 159 | + |
158 | if(count($arrAnexosComponentes) > 0){ | 160 | if(count($arrAnexosComponentes) > 0){ |
159 | 161 | ||
160 | $receberComponenteDigitalRN->setArrAnexos($arrAnexosComponentes); | 162 | $receberComponenteDigitalRN->setArrAnexos($arrAnexosComponentes); |