Commit acb896d90f563d97da12ca2b75272c8ffee1d94a
1 parent
a49184ab
Exists in
master
and in
1 other branch
[Refact] Refazendo download de documento.
Showing
1 changed file
with
24 additions
and
8 deletions
Show diff stats
rn/MdWsSeiDocumentoRN.php
| ... | ... | @@ -266,7 +266,6 @@ class MdWsSeiDocumentoRN extends DocumentoRN { |
| 266 | 266 | throw new InfraException('Documento não encontrado!'); |
| 267 | 267 | } |
| 268 | 268 | if ($documentoDTO->getStrStaDocumento()==DocumentoRN::$TD_EDITOR_EDOC) { |
| 269 | - echo 444;exit; | |
| 270 | 269 | if ($documentoDTO->getDblIdDocumentoEdoc() == null) { |
| 271 | 270 | throw new InfraException('Documento sem conteúdo!'); |
| 272 | 271 | } |
| ... | ... | @@ -275,7 +274,6 @@ class MdWsSeiDocumentoRN extends DocumentoRN { |
| 275 | 274 | |
| 276 | 275 | return MdWsSeiRest::formataRetornoSucessoREST(null, array('html' => $html)); |
| 277 | 276 | }else if ($documentoDTO->getStrStaDocumento() == DocumentoRN::$TD_EDITOR_INTERNO){ |
| 278 | - echo 333;exit; | |
| 279 | 277 | $editorDTO = new EditorDTO(); |
| 280 | 278 | $editorDTO->setDblIdDocumento($documentoDTO->getDblIdDocumento()); |
| 281 | 279 | $editorDTO->setNumIdBaseConhecimento(null); |
| ... | ... | @@ -287,9 +285,9 @@ class MdWsSeiDocumentoRN extends DocumentoRN { |
| 287 | 285 | $editorRN = new EditorRN(); |
| 288 | 286 | $html = $editorRN->consultarHtmlVersao($editorDTO); |
| 289 | 287 | $auditoriaProtocoloDTO = new AuditoriaProtocoloDTO(); |
| 290 | - $auditoriaProtocoloDTO->setStrRecurso($_GET['acao']); | |
| 288 | + $auditoriaProtocoloDTO->setStrRecurso('visualizar_documento'); | |
| 291 | 289 | $auditoriaProtocoloDTO->setNumIdUsuario(SessaoSEI::getInstance()->getNumIdUsuario()); |
| 292 | - $auditoriaProtocoloDTO->setDblIdProtocolo($_GET['id_documento']); | |
| 290 | + $auditoriaProtocoloDTO->setDblIdProtocolo($protocoloDTOParam->getDblIdProtocolo()); | |
| 293 | 291 | $auditoriaProtocoloDTO->setNumIdAnexo(null); |
| 294 | 292 | $auditoriaProtocoloDTO->setDtaAuditoria(InfraData::getStrDataAtual()); |
| 295 | 293 | $auditoriaProtocoloDTO->setNumVersao($editorDTO->getNumVersao()); |
| ... | ... | @@ -297,9 +295,18 @@ class MdWsSeiDocumentoRN extends DocumentoRN { |
| 297 | 295 | $auditoriaProtocoloRN = new AuditoriaProtocoloRN(); |
| 298 | 296 | $auditoriaProtocoloRN->auditarVisualizacao($auditoriaProtocoloDTO); |
| 299 | 297 | |
| 300 | - return MdWsSeiRest::formataRetornoSucessoREST(null, array('html' => $html)); | |
| 298 | + $anexoDTO = new AnexoDTO(); | |
| 299 | + $anexoDTO->retNumIdAnexo(); | |
| 300 | + $anexoDTO->setDblIdProtocolo($documentoDTO->getDblIdDocumento()); | |
| 301 | + | |
| 302 | + $anexoRN = new AnexoRN(); | |
| 303 | + $arrAnexoDTO = $anexoRN->listarRN0218($anexoDTO); | |
| 304 | + if (count($arrAnexoDTO)) { | |
| 305 | + SeiINT::download($arrAnexoDTO[0]); | |
| 306 | + }else{ | |
| 307 | + return MdWsSeiRest::formataRetornoSucessoREST(null, array('html' => $html)); | |
| 308 | + } | |
| 301 | 309 | }else if ($documentoDTO->getStrStaProtocoloProtocolo() == ProtocoloRN::$TP_DOCUMENTO_RECEBIDO){ |
| 302 | - echo 222;exit; | |
| 303 | 310 | $anexoDTO = new AnexoDTO(); |
| 304 | 311 | $anexoDTO->retNumIdAnexo(); |
| 305 | 312 | $anexoDTO->setDblIdProtocolo($documentoDTO->getDblIdDocumento()); |
| ... | ... | @@ -312,7 +319,6 @@ class MdWsSeiDocumentoRN extends DocumentoRN { |
| 312 | 319 | throw new InfraException('Documento sem conteúdo!'); |
| 313 | 320 | } |
| 314 | 321 | }else{ |
| 315 | - echo 111;exit; | |
| 316 | 322 | $documentoDTO = new DocumentoDTO(); |
| 317 | 323 | $documentoDTO->setDblIdDocumento($protocoloDTOParam->getDblIdProtocolo()); |
| 318 | 324 | $documentoDTO->setObjInfraSessao(SessaoSEI::getInstance()); |
| ... | ... | @@ -331,7 +337,17 @@ class MdWsSeiDocumentoRN extends DocumentoRN { |
| 331 | 337 | $aditoriaProtocoloRN = new AuditoriaProtocoloRN(); |
| 332 | 338 | $aditoriaProtocoloRN->auditarVisualizacao($aditoriaProtocoloDTO); |
| 333 | 339 | |
| 334 | - return MdWsSeiRest::formataRetornoSucessoREST(null, array('html' => $html)); | |
| 340 | + $anexoDTO = new AnexoDTO(); | |
| 341 | + $anexoDTO->retNumIdAnexo(); | |
| 342 | + $anexoDTO->setDblIdProtocolo($documentoDTO->getDblIdDocumento()); | |
| 343 | + | |
| 344 | + $anexoRN = new AnexoRN(); | |
| 345 | + $arrAnexoDTO = $anexoRN->listarRN0218($anexoDTO); | |
| 346 | + if (count($arrAnexoDTO)) { | |
| 347 | + SeiINT::download($arrAnexoDTO[0]); | |
| 348 | + }else{ | |
| 349 | + return MdWsSeiRest::formataRetornoSucessoREST(null, array('html' => $html)); | |
| 350 | + } | |
| 335 | 351 | } |
| 336 | 352 | }catch (Exception $e){ |
| 337 | 353 | return MdWsSeiRest::formataRetornoErroREST($e); | ... | ... |