Commit 57c82ac3b90d61e4396d9f79d719e8383c836d9b
1 parent
acb896d9
Exists in
master
and in
1 other branch
[Refact] Refazendo download de documento.
Showing
1 changed file
with
9 additions
and
6 deletions
Show diff stats
rn/MdWsSeiDocumentoRN.php
| ... | ... | @@ -249,6 +249,7 @@ class MdWsSeiDocumentoRN extends DocumentoRN { |
| 249 | 249 | if(!$protocoloDTOParam->isSetDblIdProtocolo() || !$protocoloDTOParam->getDblIdProtocolo()){ |
| 250 | 250 | throw new InfraException('O protocolo deve ser informado!'); |
| 251 | 251 | } |
| 252 | + $strContentDisposition = 'attachment'; | |
| 252 | 253 | $documentoDTO = new DocumentoDTO(); |
| 253 | 254 | $documentoDTO->retDblIdDocumento(); |
| 254 | 255 | $documentoDTO->retStrNomeSerie(); |
| ... | ... | @@ -284,6 +285,7 @@ class MdWsSeiDocumentoRN extends DocumentoRN { |
| 284 | 285 | $editorDTO->setStrSinProcessarLinks('S'); |
| 285 | 286 | $editorRN = new EditorRN(); |
| 286 | 287 | $html = $editorRN->consultarHtmlVersao($editorDTO); |
| 288 | + | |
| 287 | 289 | $auditoriaProtocoloDTO = new AuditoriaProtocoloDTO(); |
| 288 | 290 | $auditoriaProtocoloDTO->setStrRecurso('visualizar_documento'); |
| 289 | 291 | $auditoriaProtocoloDTO->setNumIdUsuario(SessaoSEI::getInstance()->getNumIdUsuario()); |
| ... | ... | @@ -296,25 +298,26 @@ class MdWsSeiDocumentoRN extends DocumentoRN { |
| 296 | 298 | $auditoriaProtocoloRN->auditarVisualizacao($auditoriaProtocoloDTO); |
| 297 | 299 | |
| 298 | 300 | $anexoDTO = new AnexoDTO(); |
| 299 | - $anexoDTO->retNumIdAnexo(); | |
| 301 | + $anexoDTO->retTodos(); | |
| 300 | 302 | $anexoDTO->setDblIdProtocolo($documentoDTO->getDblIdDocumento()); |
| 301 | 303 | |
| 302 | 304 | $anexoRN = new AnexoRN(); |
| 303 | 305 | $arrAnexoDTO = $anexoRN->listarRN0218($anexoDTO); |
| 306 | + | |
| 304 | 307 | if (count($arrAnexoDTO)) { |
| 305 | - SeiINT::download($arrAnexoDTO[0]); | |
| 308 | + SeiINT::download($arrAnexoDTO[0], null, null, $strContentDisposition); | |
| 306 | 309 | }else{ |
| 307 | 310 | return MdWsSeiRest::formataRetornoSucessoREST(null, array('html' => $html)); |
| 308 | 311 | } |
| 309 | 312 | }else if ($documentoDTO->getStrStaProtocoloProtocolo() == ProtocoloRN::$TP_DOCUMENTO_RECEBIDO){ |
| 310 | 313 | $anexoDTO = new AnexoDTO(); |
| 311 | - $anexoDTO->retNumIdAnexo(); | |
| 314 | + $anexoDTO->retTodos(); | |
| 312 | 315 | $anexoDTO->setDblIdProtocolo($documentoDTO->getDblIdDocumento()); |
| 313 | 316 | |
| 314 | 317 | $anexoRN = new AnexoRN(); |
| 315 | 318 | $arrAnexoDTO = $anexoRN->listarRN0218($anexoDTO); |
| 316 | 319 | if (count($arrAnexoDTO)){ |
| 317 | - SeiINT::download($arrAnexoDTO[0]); | |
| 320 | + SeiINT::download($arrAnexoDTO[0], null, null, $strContentDisposition); | |
| 318 | 321 | }else{ |
| 319 | 322 | throw new InfraException('Documento sem conteúdo!'); |
| 320 | 323 | } |
| ... | ... | @@ -338,13 +341,13 @@ class MdWsSeiDocumentoRN extends DocumentoRN { |
| 338 | 341 | $aditoriaProtocoloRN->auditarVisualizacao($aditoriaProtocoloDTO); |
| 339 | 342 | |
| 340 | 343 | $anexoDTO = new AnexoDTO(); |
| 341 | - $anexoDTO->retNumIdAnexo(); | |
| 344 | + $anexoDTO->retTodos(); | |
| 342 | 345 | $anexoDTO->setDblIdProtocolo($documentoDTO->getDblIdDocumento()); |
| 343 | 346 | |
| 344 | 347 | $anexoRN = new AnexoRN(); |
| 345 | 348 | $arrAnexoDTO = $anexoRN->listarRN0218($anexoDTO); |
| 346 | 349 | if (count($arrAnexoDTO)) { |
| 347 | - SeiINT::download($arrAnexoDTO[0]); | |
| 350 | + SeiINT::download($arrAnexoDTO[0], null, null, $strContentDisposition); | |
| 348 | 351 | }else{ |
| 349 | 352 | return MdWsSeiRest::formataRetornoSucessoREST(null, array('html' => $html)); |
| 350 | 353 | } | ... | ... |