Commit beddc17f5facf966ea0ce6aee7f921ade7672baf
1 parent
c95033c4
Exists in
master
and in
19 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 | 1837 | |
| 1838 | 1838 | $objGenericoBD->cadastrar($objReciboTramiteDTO); |
| 1839 | 1839 | |
| 1840 | + $objReciboEnvio->reciboDeEnvio->hashDoComponenteDigital = !is_array($objReciboEnvio->reciboDeEnvio->hashDoComponenteDigital) ? array($objReciboEnvio->reciboDeEnvio->hashDoComponenteDigital) : $objReciboEnvio->reciboDeEnvio->hashDoComponenteDigital; | |
| 1840 | 1841 | if($objReciboEnvio->reciboDeEnvio->hashDoComponenteDigital && is_array($objReciboEnvio->reciboDeEnvio->hashDoComponenteDigital)){ |
| 1841 | 1842 | |
| 1842 | 1843 | foreach($objReciboEnvio->reciboDeEnvio->hashDoComponenteDigital as $strHashComponenteDigital){ | ... | ... |
rn/ReceberComponenteDigitalRN.php
| ... | ... | @@ -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 | 67 | //Validar o hash do documento recebido com os dados informados pelo remetente |
| 56 | 68 | //$this->validarIntegridadeDoComponenteDigital($objAnexoDTO, $parObjComponenteDigitalDTO); | ... | ... |
rn/ReceberProcedimentoRN.php
| ... | ... | @@ -136,9 +136,10 @@ class ReceberProcedimentoRN extends InfraRN |
| 136 | 136 | |
| 137 | 137 | //Cria o array com a lista de hash |
| 138 | 138 | $arrayHash = array(); |
| 139 | - | |
| 139 | + | |
| 140 | + | |
| 140 | 141 | //Percorre os componentes que precisam ser recebidos |
| 141 | - foreach($objTramite->componenteDigitalPendenteDeRecebimento as $componentePendente){ | |
| 142 | + foreach($objTramite->componenteDigitalPendenteDeRecebimento as $key => $componentePendente){ | |
| 142 | 143 | |
| 143 | 144 | if(!is_null($componentePendente)){ |
| 144 | 145 | |
| ... | ... | @@ -148,13 +149,14 @@ class ReceberProcedimentoRN extends InfraRN |
| 148 | 149 | //Obter os dados do componente digital |
| 149 | 150 | $objComponenteDigital = $this->objProcessoEletronicoRN->receberComponenteDigital($parNumIdentificacaoTramite, $componentePendente, $objTramite->protocolo); |
| 150 | 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 | 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 | 160 | if(count($arrAnexosComponentes) > 0){ |
| 159 | 161 | |
| 160 | 162 | $receberComponenteDigitalRN->setArrAnexos($arrAnexosComponentes); | ... | ... |