Commit c905ee55bf5db3edaa7f684bdd6820415ca13923
1 parent
04c1cf58
Exists in
master
and in
16 other branches
[Fixed #42] Correção de erro StartTag invalid element name in Entity
Showing
1 changed file
with
961 additions
and
987 deletions
Show diff stats
rn/ExpedirProcedimentoRN.php
| ... | ... | @@ -4,50 +4,50 @@ require_once dirname(__FILE__) . '/../../../SEI.php'; |
| 4 | 4 | |
| 5 | 5 | class ExpedirProcedimentoRN extends InfraRN { |
| 6 | 6 | |
| 7 | - const STA_SIGILO_PUBLICO = '1'; | |
| 8 | - const STA_SIGILO_RESTRITO = '2'; | |
| 9 | - const STA_SIGILO_SIGILOSO = '3'; | |
| 10 | - | |
| 11 | - const STA_TIPO_PESSOA_FISICA = 'fisica'; | |
| 12 | - const STA_TIPO_PESSOA_JURIDICA = 'juridica'; | |
| 13 | - const STA_TIPO_PESSOA_ORGAOPUBLICO = 'orgaopublico'; | |
| 14 | - | |
| 15 | - const ALGORITMO_HASH_DOCUMENTO = 'SHA256'; | |
| 16 | - const ALGORITMO_HASH_ASSINATURA = 'SHA256withRSA'; | |
| 17 | - | |
| 18 | - const REGEX_ARQUIVO_TEXTO = '/^application\/|^text\//'; | |
| 19 | - const REGEX_ARQUIVO_IMAGEM = '/^image\//'; | |
| 20 | - const REGEX_ARQUIVO_AUDIO = '/^audio\//'; | |
| 21 | - const REGEX_ARQUIVO_VIDEO = '/^video\//'; | |
| 22 | - | |
| 23 | - const TC_TIPO_CONTEUDO_TEXTO = 'txt'; | |
| 24 | - const TC_TIPO_CONTEUDO_IMAGEM = 'img'; | |
| 25 | - const TC_TIPO_CONTEUDO_AUDIO = 'aud'; | |
| 26 | - const TC_TIPO_CONTEUDO_VIDEO = 'vid'; | |
| 27 | - const TC_TIPO_CONTEUDO_OUTROS = 'out'; | |
| 28 | - | |
| 29 | - //TODO: Alterar codificao do SEI para reconhecer esse novo estado do processo | |
| 30 | - //Esse estado ser utilizado juntamente com os estados da expedio | |
| 31 | - const TE_PROCEDIMENTO_BLOQUEADO = '4'; | |
| 32 | - const TE_PROCEDIMENTO_EM_PROCESSAMENTO = '5'; | |
| 33 | - | |
| 34 | - //Verso com mudana na API relacionada obrigatoriedade do carimbo de publicao | |
| 35 | - const VERSAO_CARIMBO_PUBLICACAO_OBRIGATORIO = '3.0.7'; | |
| 36 | - | |
| 37 | - private $objProcessoEletronicoRN; | |
| 38 | - private $objParticipanteRN; | |
| 39 | - private $objProcedimentoRN; | |
| 40 | - private $objProtocoloRN; | |
| 41 | - private $objDocumentoRN; | |
| 42 | - private $objAtividadeRN; | |
| 43 | - private $objUsuarioRN; | |
| 44 | - private $objUnidadeRN; | |
| 45 | - private $objOrgaoRN; | |
| 46 | - private $objSerieRN; | |
| 47 | - private $objAnexoRN; | |
| 48 | - private $barraProgresso; | |
| 49 | - private $objProcedimentoAndamentoRN; | |
| 50 | - private $arrPenMimeTypes = array( | |
| 7 | + const STA_SIGILO_PUBLICO = '1'; | |
| 8 | + const STA_SIGILO_RESTRITO = '2'; | |
| 9 | + const STA_SIGILO_SIGILOSO = '3'; | |
| 10 | + | |
| 11 | + const STA_TIPO_PESSOA_FISICA = 'fisica'; | |
| 12 | + const STA_TIPO_PESSOA_JURIDICA = 'juridica'; | |
| 13 | + const STA_TIPO_PESSOA_ORGAOPUBLICO = 'orgaopublico'; | |
| 14 | + | |
| 15 | + const ALGORITMO_HASH_DOCUMENTO = 'SHA256'; | |
| 16 | + const ALGORITMO_HASH_ASSINATURA = 'SHA256withRSA'; | |
| 17 | + | |
| 18 | + const REGEX_ARQUIVO_TEXTO = '/^application\/|^text\//'; | |
| 19 | + const REGEX_ARQUIVO_IMAGEM = '/^image\//'; | |
| 20 | + const REGEX_ARQUIVO_AUDIO = '/^audio\//'; | |
| 21 | + const REGEX_ARQUIVO_VIDEO = '/^video\//'; | |
| 22 | + | |
| 23 | + const TC_TIPO_CONTEUDO_TEXTO = 'txt'; | |
| 24 | + const TC_TIPO_CONTEUDO_IMAGEM = 'img'; | |
| 25 | + const TC_TIPO_CONTEUDO_AUDIO = 'aud'; | |
| 26 | + const TC_TIPO_CONTEUDO_VIDEO = 'vid'; | |
| 27 | + const TC_TIPO_CONTEUDO_OUTROS = 'out'; | |
| 28 | + | |
| 29 | + //TODO: Alterar codificao do SEI para reconhecer esse novo estado do processo | |
| 30 | + //Esse estado ser utilizado juntamente com os estados da expedio | |
| 31 | + const TE_PROCEDIMENTO_BLOQUEADO = '4'; | |
| 32 | + const TE_PROCEDIMENTO_EM_PROCESSAMENTO = '5'; | |
| 33 | + | |
| 34 | + //Verso com mudana na API relacionada obrigatoriedade do carimbo de publicao | |
| 35 | + const VERSAO_CARIMBO_PUBLICACAO_OBRIGATORIO = '3.0.7'; | |
| 36 | + | |
| 37 | + private $objProcessoEletronicoRN; | |
| 38 | + private $objParticipanteRN; | |
| 39 | + private $objProcedimentoRN; | |
| 40 | + private $objProtocoloRN; | |
| 41 | + private $objDocumentoRN; | |
| 42 | + private $objAtividadeRN; | |
| 43 | + private $objUsuarioRN; | |
| 44 | + private $objUnidadeRN; | |
| 45 | + private $objOrgaoRN; | |
| 46 | + private $objSerieRN; | |
| 47 | + private $objAnexoRN; | |
| 48 | + private $barraProgresso; | |
| 49 | + private $objProcedimentoAndamentoRN; | |
| 50 | + private $arrPenMimeTypes = array( | |
| 51 | 51 | "application/vnd.oasis.opendocument.text", |
| 52 | 52 | "application/vnd.oasis.opendocument.formula", |
| 53 | 53 | "application/vnd.oasis.opendocument.spreadsheet", |
| ... | ... | @@ -74,48 +74,33 @@ class ExpedirProcedimentoRN extends InfraRN { |
| 74 | 74 | "video/webm" |
| 75 | 75 | ); |
| 76 | 76 | |
| 77 | - public function __construct() { | |
| 78 | - parent::__construct(); | |
| 79 | - | |
| 80 | - //TODO: Remover criao de objetos de negcio no construtor da classe para evitar problemas de performance desnecessrios | |
| 81 | - $this->objProcessoEletronicoRN = new ProcessoEletronicoRN(); | |
| 82 | - $this->objParticipanteRN = new ParticipanteRN(); | |
| 83 | - $this->objProcedimentoRN = new ProcedimentoRN(); | |
| 84 | - $this->objProtocoloRN = new ProtocoloRN(); | |
| 85 | - $this->objDocumentoRN = new DocumentoRN(); | |
| 86 | - $this->objAtividadeRN = new AtividadeRN(); | |
| 87 | - $this->objUsuarioRN = new UsuarioRN(); | |
| 88 | - $this->objUnidadeRN = new UnidadeRN(); | |
| 89 | - $this->objOrgaoRN = new OrgaoRN(); | |
| 90 | - $this->objSerieRN = new SerieRN(); | |
| 91 | - $this->objAnexoRN = new AnexoRN(); | |
| 92 | - $this->objProcedimentoAndamentoRN = new ProcedimentoAndamentoRN(); | |
| 93 | - | |
| 94 | - $this->barraProgresso = new InfraBarraProgresso(); | |
| 95 | - $this->barraProgresso->setNumMin(0); | |
| 96 | - $this->barraProgresso->setNumMax(ProcessoEletronicoINT::NEE_EXPEDICAO_ETAPA_CONCLUSAO); | |
| 97 | - } | |
| 98 | - | |
| 99 | - protected function inicializarObjInfraIBanco() | |
| 100 | - { | |
| 101 | - return BancoSEI::getInstance(); | |
| 102 | - } | |
| 103 | - | |
| 104 | - public function listarRepositoriosDeEstruturas() | |
| 105 | - { | |
| 106 | - $dadosArray = array(); | |
| 107 | - $arrObjRepositorioDTO = $this->objProcessoEletronicoRN->listarRepositoriosDeEstruturas(); | |
| 108 | - foreach ($arrObjRepositorioDTO as $repositorio) { | |
| 109 | - $dadosArray[$repositorio->getNumId()] = $repositorio->getStrNome(); | |
| 110 | - } | |
| 111 | - | |
| 112 | - return $dadosArray; | |
| 113 | - } | |
| 114 | - | |
| 115 | - public function consultarMotivosUrgencia() | |
| 116 | - { | |
| 117 | - return $this->objProcessoEletronicoRN->consultarMotivosUrgencia(); | |
| 118 | - } | |
| 77 | + public function __construct() | |
| 78 | + { | |
| 79 | + parent::__construct(); | |
| 80 | + | |
| 81 | + //TODO: Remover criao de objetos de negcio no construtor da classe para evitar problemas de performance desnecessrios | |
| 82 | + $this->objProcessoEletronicoRN = new ProcessoEletronicoRN(); | |
| 83 | + $this->objParticipanteRN = new ParticipanteRN(); | |
| 84 | + $this->objProcedimentoRN = new ProcedimentoRN(); | |
| 85 | + $this->objProtocoloRN = new ProtocoloRN(); | |
| 86 | + $this->objDocumentoRN = new DocumentoRN(); | |
| 87 | + $this->objAtividadeRN = new AtividadeRN(); | |
| 88 | + $this->objUsuarioRN = new UsuarioRN(); | |
| 89 | + $this->objUnidadeRN = new UnidadeRN(); | |
| 90 | + $this->objOrgaoRN = new OrgaoRN(); | |
| 91 | + $this->objSerieRN = new SerieRN(); | |
| 92 | + $this->objAnexoRN = new AnexoRN(); | |
| 93 | + $this->objProcedimentoAndamentoRN = new ProcedimentoAndamentoRN(); | |
| 94 | + | |
| 95 | + $this->barraProgresso = new InfraBarraProgresso(); | |
| 96 | + $this->barraProgresso->setNumMin(0); | |
| 97 | + $this->barraProgresso->setNumMax(ProcessoEletronicoINT::NEE_EXPEDICAO_ETAPA_CONCLUSAO); | |
| 98 | + } | |
| 99 | + | |
| 100 | + protected function inicializarObjInfraIBanco() | |
| 101 | + { | |
| 102 | + return BancoSEI::getInstance(); | |
| 103 | + } | |
| 119 | 104 | |
| 120 | 105 | public function expedirProcedimentoControlado(ExpedirProcedimentoDTO $objExpedirProcedimentoDTO) |
| 121 | 106 | { |
| ... | ... | @@ -126,10 +111,10 @@ class ExpedirProcedimentoRN extends InfraRN { |
| 126 | 111 | $dblIdProcedimento = $objExpedirProcedimentoDTO->getDblIdProcedimento(); |
| 127 | 112 | |
| 128 | 113 | $this->barraProgresso->exibir(); |
| 129 | - //Valida regras de negócio | |
| 130 | 114 | $this->barraProgresso->mover(ProcessoEletronicoINT::NEE_EXPEDICAO_ETAPA_VALIDACAO); |
| 131 | 115 | $this->barraProgresso->setStrRotulo(ProcessoEletronicoINT::TEE_EXPEDICAO_ETAPA_VALIDACAO); |
| 132 | 116 | |
| 117 | + //Valida regras de negócio | |
| 133 | 118 | $objInfraException = new InfraException(); |
| 134 | 119 | //Carregamento dos dados de processo e documento para validação e envio externo |
| 135 | 120 | $objProcedimentoDTO = $this->consultarProcedimento($dblIdProcedimento); |
| ... | ... | @@ -258,68 +243,84 @@ class ExpedirProcedimentoRN extends InfraRN { |
| 258 | 243 | } |
| 259 | 244 | |
| 260 | 245 | |
| 246 | + public function listarRepositoriosDeEstruturas() | |
| 247 | + { | |
| 248 | + $dadosArray = array(); | |
| 249 | + $arrObjRepositorioDTO = $this->objProcessoEletronicoRN->listarRepositoriosDeEstruturas(); | |
| 250 | + foreach ($arrObjRepositorioDTO as $repositorio) { | |
| 251 | + $dadosArray[$repositorio->getNumId()] = $repositorio->getStrNome(); | |
| 252 | + } | |
| 253 | + | |
| 254 | + return $dadosArray; | |
| 255 | + } | |
| 256 | + | |
| 257 | + public function consultarMotivosUrgencia() | |
| 258 | + { | |
| 259 | + return $this->objProcessoEletronicoRN->consultarMotivosUrgencia(); | |
| 260 | + } | |
| 261 | + | |
| 261 | 262 | |
| 262 | - private function registrarAndamentoExpedicaoProcesso($objExpedirProcedimentoDTO, $objProcesso) | |
| 263 | - { | |
| 263 | + private function registrarAndamentoExpedicaoProcesso($objExpedirProcedimentoDTO, $objProcesso) | |
| 264 | + { | |
| 264 | 265 | //Processo expedido para a entidade @ENTIDADE_DESTINO@ - @REPOSITORIO_ESTRUTURA@ (@PROCESSO@, @UNIDADE@, @USUARIO@) |
| 265 | 266 | //TODO: Atribuir atributos necessrios para formao da mensagem do andamento |
| 266 | 267 | //TODO: Especificar quais andamentos sero registrados |
| 267 | - $arrObjAtributoAndamentoDTO = array(); | |
| 268 | - | |
| 269 | - $objAtributoAndamentoDTO = new AtributoAndamentoDTO(); | |
| 270 | - $objAtributoAndamentoDTO->setStrNome('REPOSITORIO_DESTINO'); | |
| 271 | - $objAtributoAndamentoDTO->setStrValor($objExpedirProcedimentoDTO->getStrRepositorioDestino()); | |
| 272 | - $objAtributoAndamentoDTO->setStrIdOrigem($objExpedirProcedimentoDTO->getNumIdRepositorioOrigem()); | |
| 273 | - $arrObjAtributoAndamentoDTO[] = $objAtributoAndamentoDTO; | |
| 274 | - | |
| 275 | - $objAtributoAndamentoDTO = new AtributoAndamentoDTO(); | |
| 276 | - $objAtributoAndamentoDTO->setStrNome('UNIDADE_DESTINO'); | |
| 277 | - $objAtributoAndamentoDTO->setStrValor($objExpedirProcedimentoDTO->getStrUnidadeDestino()); | |
| 278 | - $objAtributoAndamentoDTO->setStrIdOrigem($objExpedirProcedimentoDTO->getNumIdUnidadeDestino()); | |
| 279 | - $arrObjAtributoAndamentoDTO[] = $objAtributoAndamentoDTO; | |
| 280 | - | |
| 281 | - $objAtributoAndamentoDTO = new AtributoAndamentoDTO(); | |
| 282 | - $objAtributoAndamentoDTO->setStrNome('PROCESSO'); | |
| 283 | - $objAtributoAndamentoDTO->setStrValor($objProcesso->protocolo); | |
| 284 | - $objAtributoAndamentoDTO->setStrIdOrigem($objProcesso->idProcedimentoSEI); | |
| 285 | - $arrObjAtributoAndamentoDTO[] = $objAtributoAndamentoDTO; | |
| 286 | - | |
| 287 | - $objUnidadeDTO = new UnidadeDTO(); | |
| 288 | - $objUnidadeDTO->retStrSigla(); | |
| 289 | - $objUnidadeDTO->retStrDescricao(); | |
| 290 | - $objUnidadeDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | |
| 291 | - $objUnidadeDTO = $this->objUnidadeRN->consultarRN0125($objUnidadeDTO); | |
| 292 | - | |
| 293 | - $objAtributoAndamentoDTO = new AtributoAndamentoDTO(); | |
| 294 | - $objAtributoAndamentoDTO->setStrNome('UNIDADE'); | |
| 295 | - $objAtributoAndamentoDTO->setStrValor($objUnidadeDTO->getStrSigla().''.$objUnidadeDTO->getStrDescricao()); | |
| 296 | - $objAtributoAndamentoDTO->setStrIdOrigem(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | |
| 297 | - $arrObjAtributoAndamentoDTO[] = $objAtributoAndamentoDTO; | |
| 268 | + $arrObjAtributoAndamentoDTO = array(); | |
| 269 | + | |
| 270 | + $objAtributoAndamentoDTO = new AtributoAndamentoDTO(); | |
| 271 | + $objAtributoAndamentoDTO->setStrNome('REPOSITORIO_DESTINO'); | |
| 272 | + $objAtributoAndamentoDTO->setStrValor($objExpedirProcedimentoDTO->getStrRepositorioDestino()); | |
| 273 | + $objAtributoAndamentoDTO->setStrIdOrigem($objExpedirProcedimentoDTO->getNumIdRepositorioOrigem()); | |
| 274 | + $arrObjAtributoAndamentoDTO[] = $objAtributoAndamentoDTO; | |
| 275 | + | |
| 276 | + $objAtributoAndamentoDTO = new AtributoAndamentoDTO(); | |
| 277 | + $objAtributoAndamentoDTO->setStrNome('UNIDADE_DESTINO'); | |
| 278 | + $objAtributoAndamentoDTO->setStrValor($objExpedirProcedimentoDTO->getStrUnidadeDestino()); | |
| 279 | + $objAtributoAndamentoDTO->setStrIdOrigem($objExpedirProcedimentoDTO->getNumIdUnidadeDestino()); | |
| 280 | + $arrObjAtributoAndamentoDTO[] = $objAtributoAndamentoDTO; | |
| 281 | + | |
| 282 | + $objAtributoAndamentoDTO = new AtributoAndamentoDTO(); | |
| 283 | + $objAtributoAndamentoDTO->setStrNome('PROCESSO'); | |
| 284 | + $objAtributoAndamentoDTO->setStrValor($objProcesso->protocolo); | |
| 285 | + $objAtributoAndamentoDTO->setStrIdOrigem($objProcesso->idProcedimentoSEI); | |
| 286 | + $arrObjAtributoAndamentoDTO[] = $objAtributoAndamentoDTO; | |
| 287 | + | |
| 288 | + $objUnidadeDTO = new UnidadeDTO(); | |
| 289 | + $objUnidadeDTO->retStrSigla(); | |
| 290 | + $objUnidadeDTO->retStrDescricao(); | |
| 291 | + $objUnidadeDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | |
| 292 | + $objUnidadeDTO = $this->objUnidadeRN->consultarRN0125($objUnidadeDTO); | |
| 293 | + | |
| 294 | + $objAtributoAndamentoDTO = new AtributoAndamentoDTO(); | |
| 295 | + $objAtributoAndamentoDTO->setStrNome('UNIDADE'); | |
| 296 | + $objAtributoAndamentoDTO->setStrValor($objUnidadeDTO->getStrSigla().''.$objUnidadeDTO->getStrDescricao()); | |
| 297 | + $objAtributoAndamentoDTO->setStrIdOrigem(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | |
| 298 | + $arrObjAtributoAndamentoDTO[] = $objAtributoAndamentoDTO; | |
| 298 | 299 | |
| 299 | 300 | //TODO: Avaliar qual o usurio que deveria ser registrado no atributo andamento abaixo |
| 300 | - $objAtributoAndamentoDTO = new AtributoAndamentoDTO(); | |
| 301 | - $objAtributoAndamentoDTO->setStrNome('USUARIO'); | |
| 302 | - $objAtributoAndamentoDTO->setStrValor(SessaoSEI::getInstance()->getStrSiglaUsuario() . '' . SessaoSEI::getInstance()->getStrNomeUsuario()); | |
| 303 | - $objAtributoAndamentoDTO->setStrIdOrigem(SessaoSEI::getInstance()->getNumIdUsuario()); | |
| 304 | - $arrObjAtributoAndamentoDTO[] = $objAtributoAndamentoDTO; | |
| 305 | - | |
| 306 | - $objAtividadeDTO = new AtividadeDTO(); | |
| 307 | - $objAtividadeDTO->setDblIdProtocolo($objProcesso->idProcedimentoSEI); | |
| 308 | - $objAtividadeDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | |
| 309 | - $objAtividadeDTO->setNumIdUsuario(SessaoSEI::getInstance()->getNumIdUsuario()); | |
| 310 | - $objAtividadeDTO->setNumIdTarefa(ProcessoEletronicoRN::$TI_PROCESSO_ELETRONICO_PROCESSO_EXPEDIDO); | |
| 311 | - $objAtividadeDTO->setArrObjAtributoAndamentoDTO($arrObjAtributoAndamentoDTO); | |
| 312 | - | |
| 313 | - $objAtividadeRN = new AtividadeRN(); | |
| 314 | - $objAtividadeRN->gerarInternaRN0727($objAtividadeDTO); | |
| 301 | + $objAtributoAndamentoDTO = new AtributoAndamentoDTO(); | |
| 302 | + $objAtributoAndamentoDTO->setStrNome('USUARIO'); | |
| 303 | + $objAtributoAndamentoDTO->setStrValor(SessaoSEI::getInstance()->getStrSiglaUsuario() . '' . SessaoSEI::getInstance()->getStrNomeUsuario()); | |
| 304 | + $objAtributoAndamentoDTO->setStrIdOrigem(SessaoSEI::getInstance()->getNumIdUsuario()); | |
| 305 | + $arrObjAtributoAndamentoDTO[] = $objAtributoAndamentoDTO; | |
| 306 | + | |
| 307 | + $objAtividadeDTO = new AtividadeDTO(); | |
| 308 | + $objAtividadeDTO->setDblIdProtocolo($objProcesso->idProcedimentoSEI); | |
| 309 | + $objAtividadeDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | |
| 310 | + $objAtividadeDTO->setNumIdUsuario(SessaoSEI::getInstance()->getNumIdUsuario()); | |
| 311 | + $objAtividadeDTO->setNumIdTarefa(ProcessoEletronicoRN::$TI_PROCESSO_ELETRONICO_PROCESSO_EXPEDIDO); | |
| 312 | + $objAtividadeDTO->setArrObjAtributoAndamentoDTO($arrObjAtributoAndamentoDTO); | |
| 313 | + | |
| 314 | + $objAtividadeRN = new AtividadeRN(); | |
| 315 | + $objAtividadeRN->gerarInternaRN0727($objAtividadeDTO); | |
| 315 | 316 | |
| 316 | 317 | //Registra andamento para processos apensados que foram expedidos |
| 317 | - if(isset($objProcesso->processoApensado) && is_array($objProcesso->processoApensado)) { | |
| 318 | - foreach($objProcesso->processoApensado as $objProcessoApensado) { | |
| 319 | - $this->registrarAndamentoExpedicaoProcesso($objExpedirProcedimentoDTO, $objProcessoApensado); | |
| 320 | - } | |
| 318 | + if(isset($objProcesso->processoApensado) && is_array($objProcesso->processoApensado)) { | |
| 319 | + foreach($objProcesso->processoApensado as $objProcessoApensado) { | |
| 320 | + $this->registrarAndamentoExpedicaoProcesso($objExpedirProcedimentoDTO, $objProcessoApensado); | |
| 321 | + } | |
| 322 | + } | |
| 321 | 323 | } |
| 322 | - } | |
| 323 | 324 | |
| 324 | 325 | private function construirCabecalho(ExpedirProcedimentoDTO $objExpedirProcedimentoDTO) |
| 325 | 326 | { |
| ... | ... | @@ -399,51 +400,51 @@ class ExpedirProcedimentoRN extends InfraRN { |
| 399 | 400 | } |
| 400 | 401 | |
| 401 | 402 | //TODO: Implementar mapeamento de atividades que sero enviadas para barramento (semelhante Protocolo Integrado) |
| 402 | - private function atribuirDadosHistorico($objProcesso, $dblIdProcedimento) | |
| 403 | - { | |
| 404 | - $objProcedimentoHistoricoDTO = new ProcedimentoHistoricoDTO(); | |
| 405 | - $objProcedimentoHistoricoDTO->setDblIdProcedimento($dblIdProcedimento); | |
| 406 | - $objProcedimentoHistoricoDTO->setStrStaHistorico(ProcedimentoRN::$TH_TOTAL); | |
| 403 | + private function atribuirDadosHistorico($objProcesso, $dblIdProcedimento) | |
| 404 | + { | |
| 405 | + $objProcedimentoHistoricoDTO = new ProcedimentoHistoricoDTO(); | |
| 406 | + $objProcedimentoHistoricoDTO->setDblIdProcedimento($dblIdProcedimento); | |
| 407 | + $objProcedimentoHistoricoDTO->setStrStaHistorico(ProcedimentoRN::$TH_TOTAL); | |
| 407 | 408 | |
| 408 | - $objProcedimentoRN = new ProcedimentoRN(); | |
| 409 | - $objProcedimentoDTO = $objProcedimentoRN->consultarHistoricoRN1025($objProcedimentoHistoricoDTO); | |
| 410 | - $arrObjAtividadeDTO = $objProcedimentoDTO->getArrObjAtividadeDTO(); | |
| 409 | + $objProcedimentoRN = new ProcedimentoRN(); | |
| 410 | + $objProcedimentoDTO = $objProcedimentoRN->consultarHistoricoRN1025($objProcedimentoHistoricoDTO); | |
| 411 | + $arrObjAtividadeDTO = $objProcedimentoDTO->getArrObjAtividadeDTO(); | |
| 411 | 412 | |
| 412 | - if($arrObjAtividadeDTO == null || count($arrObjAtividadeDTO) == 0) { | |
| 413 | - throw new InfraException("Não foi possível obter andamentos do processo {$objProcesso->protocolo}"); | |
| 414 | - } | |
| 413 | + if($arrObjAtividadeDTO == null || count($arrObjAtividadeDTO) == 0) { | |
| 414 | + throw new InfraException("Não foi possível obter andamentos do processo {$objProcesso->protocolo}"); | |
| 415 | + } | |
| 415 | 416 | |
| 416 | - $arrObjOperacao = array(); | |
| 417 | - foreach ($arrObjAtividadeDTO as $objAtividadeDTO) { | |
| 417 | + $arrObjOperacao = array(); | |
| 418 | + foreach ($arrObjAtividadeDTO as $objAtividadeDTO) { | |
| 418 | 419 | |
| 419 | 420 | //TODO: Avaliar necessidade de repassar dados da pessoa que realizou a operao |
| 420 | - $objOperacao = new stdClass(); | |
| 421 | + $objOperacao = new stdClass(); | |
| 421 | 422 | |
| 422 | 423 | //TODO: Adicionar demais informações da pessoa e sua unidade |
| 423 | - $objOperacao->pessoa = new stdClass(); | |
| 424 | - $objOperacao->pessoa->nome = utf8_encode($objAtividadeDTO->getStrNomeUsuarioOrigem()); | |
| 425 | - $objOperacao->codigo = $this->objProcessoEletronicoRN->obterCodigoOperacaoPENMapeado($objAtividadeDTO->getNumIdTarefa()); | |
| 426 | - $objOperacao->dataHora = $this->objProcessoEletronicoRN->converterDataWebService($objAtividadeDTO->getDthAbertura()); | |
| 427 | - $strComplemento = strip_tags($objAtividadeDTO->getStrNomeTarefa()); | |
| 428 | - $objOperacao->complemento = utf8_encode($strComplemento); | |
| 429 | - | |
| 430 | - $arrObjOperacao[] = $objOperacao; | |
| 431 | - } | |
| 432 | - | |
| 433 | - $objProcesso->historico = new stdClass(); | |
| 434 | - $objProcesso->historico->operacao = $arrObjOperacao; | |
| 435 | - } | |
| 436 | - | |
| 437 | - /** | |
| 438 | - * Muda o estado de um procedimento | |
| 439 | - * | |
| 440 | - * @param object $objProcesso | |
| 441 | - * @param string $strStaEstado | |
| 442 | - * @throws InfraException | |
| 443 | - * @return null | |
| 444 | - */ | |
| 445 | - public static function mudarEstadoProcedimento($objProcesso, $strStaEstado){ | |
| 424 | + $objOperacao->pessoa = new stdClass(); | |
| 425 | + $objOperacao->pessoa->nome = utf8_encode($objAtividadeDTO->getStrNomeUsuarioOrigem()); | |
| 426 | + $objOperacao->codigo = $this->objProcessoEletronicoRN->obterCodigoOperacaoPENMapeado($objAtividadeDTO->getNumIdTarefa()); | |
| 427 | + $objOperacao->dataHora = $this->objProcessoEletronicoRN->converterDataWebService($objAtividadeDTO->getDthAbertura()); | |
| 428 | + $strComplemento = strip_tags($objAtividadeDTO->getStrNomeTarefa()); | |
| 429 | + $objOperacao->complemento = utf8_encode($strComplemento); | |
| 430 | + | |
| 431 | + $arrObjOperacao[] = $objOperacao; | |
| 432 | + } | |
| 446 | 433 | |
| 434 | + $objProcesso->historico = new stdClass(); | |
| 435 | + $objProcesso->historico->operacao = $arrObjOperacao; | |
| 436 | + } | |
| 437 | + | |
| 438 | + /** | |
| 439 | + * Muda o estado de um procedimento | |
| 440 | + * | |
| 441 | + * @param object $objProcesso | |
| 442 | + * @param string $strStaEstado | |
| 443 | + * @throws InfraException | |
| 444 | + * @return null | |
| 445 | + */ | |
| 446 | + public static function mudarEstadoProcedimento($objProcesso, $strStaEstado) | |
| 447 | + { | |
| 447 | 448 | if(!isset($objProcesso)) { |
| 448 | 449 | throw new InfraException('Parâmetro $objProcesso não informado.'); |
| 449 | 450 | } |
| ... | ... | @@ -491,8 +492,8 @@ class ExpedirProcedimentoRN extends InfraRN { |
| 491 | 492 | * @throws InfraException |
| 492 | 493 | * @return null |
| 493 | 494 | */ |
| 494 | - public static function mudarEstadoProcedimentoNormal($objProcesso, $strStaEstado){ | |
| 495 | - | |
| 495 | + public static function mudarEstadoProcedimentoNormal($objProcesso, $strStaEstado) | |
| 496 | + { | |
| 496 | 497 | //Muda o estado do Protocolo para normal |
| 497 | 498 | $objProtocoloDTO = new ProtocoloDTO(); |
| 498 | 499 | $objProtocoloDTO->setStrStaEstado($strStaEstado); |
| ... | ... | @@ -500,12 +501,11 @@ class ExpedirProcedimentoRN extends InfraRN { |
| 500 | 501 | |
| 501 | 502 | $objProtocoloRN = new ProtocoloRN(); |
| 502 | 503 | $objProtocoloRN->alterarRN0203($objProtocoloDTO); |
| 503 | - | |
| 504 | 504 | } |
| 505 | 505 | |
| 506 | 506 | |
| 507 | - public function bloquearProcedimentoExpedicao($objExpedirProcedimentoDTO, $numIdProcedimento) { | |
| 508 | - | |
| 507 | + public function bloquearProcedimentoExpedicao($objExpedirProcedimentoDTO, $numIdProcedimento) | |
| 508 | + { | |
| 509 | 509 | //Instancia a API do SEI para bloquei do processo |
| 510 | 510 | $objEntradaBloquearProcessoAPI = new EntradaBloquearProcessoAPI(); |
| 511 | 511 | $objEntradaBloquearProcessoAPI->setIdProcedimento($numIdProcedimento); |
| ... | ... | @@ -514,7 +514,6 @@ class ExpedirProcedimentoRN extends InfraRN { |
| 514 | 514 | $objSeiRN = new SeiRN(); |
| 515 | 515 | $objSeiRN->bloquearProcesso($objEntradaBloquearProcessoAPI); |
| 516 | 516 | |
| 517 | - | |
| 518 | 517 | $arrObjAtributoAndamentoDTO = array(); |
| 519 | 518 | |
| 520 | 519 | //Seta o repositrio de destino para constar no histrico |
| ... | ... | @@ -526,7 +525,7 @@ class ExpedirProcedimentoRN extends InfraRN { |
| 526 | 525 | |
| 527 | 526 | //Compe o atributo que ir compor a estrutura |
| 528 | 527 | $objEstrutura = $this->objProcessoEletronicoRN->consultarEstrutura( |
| 529 | - $objExpedirProcedimentoDTO->getNumIdRepositorioDestino(), $objExpedirProcedimentoDTO->getNumIdUnidadeDestino(), true | |
| 528 | + $objExpedirProcedimentoDTO->getNumIdRepositorioDestino(), $objExpedirProcedimentoDTO->getNumIdUnidadeDestino(), true | |
| 530 | 529 | ); |
| 531 | 530 | |
| 532 | 531 | if (isset($objEstrutura->hierarquia)) { |
| ... | ... | @@ -589,8 +588,8 @@ class ExpedirProcedimentoRN extends InfraRN { |
| 589 | 588 | return $atividade->getNumIdAtividade(); |
| 590 | 589 | } |
| 591 | 590 | |
| 592 | - public function desbloquearProcessoExpedicao($numIdProcedimento){ | |
| 593 | - | |
| 591 | + public function desbloquearProcessoExpedicao($numIdProcedimento) | |
| 592 | + { | |
| 594 | 593 | //Intancia o objeto de desbloqueio da API do SEI |
| 595 | 594 | $objEntradaDesbloquearProcessoAPI = new EntradaDesbloquearProcessoAPI(); |
| 596 | 595 | $objEntradaDesbloquearProcessoAPI->setIdProcedimento($numIdProcedimento); |
| ... | ... | @@ -598,11 +597,11 @@ class ExpedirProcedimentoRN extends InfraRN { |
| 598 | 597 | //Solicita o Desbloqueio do Processo |
| 599 | 598 | $objSeiRN = new SeiRN(); |
| 600 | 599 | $objSeiRN->desbloquearProcesso($objEntradaDesbloquearProcessoAPI); |
| 601 | - | |
| 602 | 600 | } |
| 603 | 601 | |
| 604 | - public function registrarAndamentoExpedicaoAbortada($dblIdProtocolo) { | |
| 605 | 602 | |
| 603 | + public function registrarAndamentoExpedicaoAbortada($dblIdProtocolo) | |
| 604 | + { | |
| 606 | 605 | //Seta todos os atributos do histrico de aborto da expedio |
| 607 | 606 | $objAtividadeDTO = new AtividadeDTO(); |
| 608 | 607 | $objAtividadeDTO->setDblIdProtocolo($dblIdProtocolo); |
| ... | ... | @@ -618,42 +617,37 @@ class ExpedirProcedimentoRN extends InfraRN { |
| 618 | 617 | |
| 619 | 618 | public static function receberRecusaProcedimento($motivo, $unidade_destino, $numUnidadeDestino = null, $idProtocolo) |
| 620 | 619 | { |
| 621 | - | |
| 622 | 620 | try{ |
| 623 | - //Muda o status do protocolo para "Normal" | |
| 624 | - | |
| 625 | - | |
| 626 | - $arrObjAtributoAndamentoDTO = array(); | |
| 627 | - | |
| 628 | - $objAtributoAndamentoDTO = new AtributoAndamentoDTO(); | |
| 629 | - $objAtributoAndamentoDTO->setStrNome('MOTIVO'); | |
| 630 | - $objAtributoAndamentoDTO->setStrValor($motivo); | |
| 631 | - $objAtributoAndamentoDTO->setStrIdOrigem($numUnidadeDestino); | |
| 632 | - $arrObjAtributoAndamentoDTO[] = $objAtributoAndamentoDTO; | |
| 633 | - | |
| 621 | + //Muda o status do protocolo para "Normal" | |
| 622 | + $arrObjAtributoAndamentoDTO = array(); | |
| 634 | 623 | |
| 635 | - $objAtributoAndamentoDTO = new AtributoAndamentoDTO(); | |
| 636 | - $objAtributoAndamentoDTO->setStrNome('UNIDADE_DESTINO'); | |
| 637 | - $objAtributoAndamentoDTO->setStrValor($unidade_destino); | |
| 638 | - $objAtributoAndamentoDTO->setStrIdOrigem($numUnidadeDestino); | |
| 639 | - $arrObjAtributoAndamentoDTO[] = $objAtributoAndamentoDTO; | |
| 624 | + $objAtributoAndamentoDTO = new AtributoAndamentoDTO(); | |
| 625 | + $objAtributoAndamentoDTO->setStrNome('MOTIVO'); | |
| 626 | + $objAtributoAndamentoDTO->setStrValor($motivo); | |
| 627 | + $objAtributoAndamentoDTO->setStrIdOrigem($numUnidadeDestino); | |
| 628 | + $arrObjAtributoAndamentoDTO[] = $objAtributoAndamentoDTO; | |
| 640 | 629 | |
| 630 | + $objAtributoAndamentoDTO = new AtributoAndamentoDTO(); | |
| 631 | + $objAtributoAndamentoDTO->setStrNome('UNIDADE_DESTINO'); | |
| 632 | + $objAtributoAndamentoDTO->setStrValor($unidade_destino); | |
| 633 | + $objAtributoAndamentoDTO->setStrIdOrigem($numUnidadeDestino); | |
| 634 | + $arrObjAtributoAndamentoDTO[] = $objAtributoAndamentoDTO; | |
| 641 | 635 | |
| 642 | - $objAtividadeDTO = new AtividadeDTO(); | |
| 643 | - $objAtividadeDTO->setDblIdProtocolo($idProtocolo); | |
| 644 | - $objAtividadeDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | |
| 645 | - $objAtividadeDTO->setNumIdTarefa(ProcessoEletronicoRN::$TI_PROCESSO_ELETRONICO_PROCESSO_TRAMITE_RECUSADO); | |
| 646 | - $objAtividadeDTO->setArrObjAtributoAndamentoDTO($arrObjAtributoAndamentoDTO); | |
| 636 | + $objAtividadeDTO = new AtividadeDTO(); | |
| 637 | + $objAtividadeDTO->setDblIdProtocolo($idProtocolo); | |
| 638 | + $objAtividadeDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | |
| 639 | + $objAtividadeDTO->setNumIdTarefa(ProcessoEletronicoRN::$TI_PROCESSO_ELETRONICO_PROCESSO_TRAMITE_RECUSADO); | |
| 640 | + $objAtividadeDTO->setArrObjAtributoAndamentoDTO($arrObjAtributoAndamentoDTO); | |
| 647 | 641 | |
| 648 | - $objAtividadeRN = new AtividadeRN(); | |
| 649 | - $atividade = $objAtividadeRN->gerarInternaRN0727($objAtividadeDTO); | |
| 642 | + $objAtividadeRN = new AtividadeRN(); | |
| 643 | + $atividade = $objAtividadeRN->gerarInternaRN0727($objAtividadeDTO); | |
| 650 | 644 | |
| 651 | - $objProtocoloDTO = new ProtocoloDTO(); | |
| 652 | - $objProtocoloDTO->setStrStaEstado(ProtocoloRN::$TE_NORMAL); | |
| 653 | - $objProtocoloDTO->setDblIdProtocolo($idProtocolo); | |
| 645 | + $objProtocoloDTO = new ProtocoloDTO(); | |
| 646 | + $objProtocoloDTO->setStrStaEstado(ProtocoloRN::$TE_NORMAL); | |
| 647 | + $objProtocoloDTO->setDblIdProtocolo($idProtocolo); | |
| 654 | 648 | |
| 655 | - $objProtocoloRN = new ProtocoloRN(); | |
| 656 | - $objProtocoloRN->alterarRN0203($objProtocoloDTO); | |
| 649 | + $objProtocoloRN = new ProtocoloRN(); | |
| 650 | + $objProtocoloRN->alterarRN0203($objProtocoloDTO); | |
| 657 | 651 | |
| 658 | 652 | |
| 659 | 653 | }catch (InfraException $e){ |
| ... | ... | @@ -664,231 +658,225 @@ class ExpedirProcedimentoRN extends InfraRN { |
| 664 | 658 | } |
| 665 | 659 | } |
| 666 | 660 | |
| 667 | - private function bloquearProcedimento($objProcesso) | |
| 668 | - { | |
| 669 | - if(!isset($objProcesso)) { | |
| 670 | - throw new InfraException('Parâmetro $objProcesso não informado.'); | |
| 671 | - } | |
| 661 | + private function bloquearProcedimento($objProcesso) | |
| 662 | + { | |
| 663 | + if(!isset($objProcesso)) { | |
| 664 | + throw new InfraException('Parâmetro $objProcesso não informado.'); | |
| 665 | + } | |
| 672 | 666 | |
| 673 | 667 | //TODO: Solicitar ao TRF4 um meio de bloquear o processo, indicando que ele encontra-se em |
| 674 | 668 | //expedio e possui tratamento diferenciado |
| 675 | 669 | |
| 676 | - $objRelProtocoloProtocoloDTO = new RelProtocoloProtocoloDTO(); | |
| 670 | + $objRelProtocoloProtocoloDTO = new RelProtocoloProtocoloDTO(); | |
| 677 | 671 | //$objRelProtocoloProtocoloDTO->setDblIdProtocolo1($dblIdProcedimentoApensado); |
| 678 | - $objRelProtocoloProtocoloDTO->setDblIdProtocolo1(null); | |
| 679 | - $objRelProtocoloProtocoloDTO->setDblIdProtocolo2($objProcesso->idProcedimentoSEI); | |
| 680 | - $objRelProtocoloProtocoloDTO->setStrMotivo("Processo sobrestado devido sua expedição para outra entidade."); | |
| 681 | - $this->objProcedimentoRN->sobrestarRN1014(array($objRelProtocoloProtocoloDTO)); | |
| 682 | - | |
| 683 | - if(isset($objProcesso->processoApensado) && is_array($objProcesso->processoApensado)) { | |
| 684 | - foreach($objProcesso->processoApensado as $objProcessoApensado) { | |
| 685 | - $this->bloquearProcedimento($objProcessoApensado); | |
| 686 | - } | |
| 672 | + $objRelProtocoloProtocoloDTO->setDblIdProtocolo1(null); | |
| 673 | + $objRelProtocoloProtocoloDTO->setDblIdProtocolo2($objProcesso->idProcedimentoSEI); | |
| 674 | + $objRelProtocoloProtocoloDTO->setStrMotivo("Processo sobrestado devido sua expedição para outra entidade."); | |
| 675 | + $this->objProcedimentoRN->sobrestarRN1014(array($objRelProtocoloProtocoloDTO)); | |
| 676 | + | |
| 677 | + if(isset($objProcesso->processoApensado) && is_array($objProcesso->processoApensado)) { | |
| 678 | + foreach($objProcesso->processoApensado as $objProcessoApensado) { | |
| 679 | + $this->bloquearProcedimento($objProcessoApensado); | |
| 680 | + } | |
| 681 | + } | |
| 687 | 682 | } |
| 688 | 683 | |
| 689 | - } | |
| 690 | - | |
| 691 | - private function atribuirDataHoraDeRegistro($objContexto, $dblIdProcedimento, $dblIdDocumento = null) | |
| 692 | - { | |
| 684 | + private function atribuirDataHoraDeRegistro($objContexto, $dblIdProcedimento, $dblIdDocumento = null) | |
| 685 | + { | |
| 693 | 686 | //Validar parâmetro $objContexto |
| 694 | - if(!isset($objContexto)) { | |
| 695 | - throw new InfraException('Parâmetro $objContexto não informado.'); | |
| 696 | - } | |
| 687 | + if(!isset($objContexto)) { | |
| 688 | + throw new InfraException('Parâmetro $objContexto não informado.'); | |
| 689 | + } | |
| 697 | 690 | |
| 698 | 691 | //Validar parâmetro $dbIdProcedimento |
| 699 | - if(!isset($dblIdProcedimento)) { | |
| 700 | - throw new InfraException('Parâmetro $dbIdProcedimento não informado.'); | |
| 701 | - } | |
| 702 | - | |
| 703 | - $objProcedimentoHistoricoDTO = new ProcedimentoHistoricoDTO(); | |
| 704 | - $objProcedimentoHistoricoDTO->setDblIdProcedimento($dblIdProcedimento); | |
| 705 | - $objProcedimentoHistoricoDTO->setStrStaHistorico(ProcedimentoRN::$TH_PERSONALIZADO); | |
| 706 | - $objProcedimentoHistoricoDTO->adicionarCriterio(array('IdTarefa','IdTarefa'), array(InfraDTO::$OPER_IGUAL,InfraDTO::$OPER_IGUAL), array(TarefaRN::$TI_GERACAO_PROCEDIMENTO, ProcessoeletronicoRN::$TI_PROCESSO_ELETRONICO_PROCESSO_RECEBIDO), InfraDTO::$OPER_LOGICO_OR); | |
| 707 | - $objProcedimentoHistoricoDTO->setStrSinGerarLinksHistorico('N'); | |
| 708 | - $objProcedimentoHistoricoDTO->setNumMaxRegistrosRetorno(1); | |
| 709 | - $objProcedimentoHistoricoDTO->setOrdNumIdTarefa(InfraDTO::$TIPO_ORDENACAO_ASC); | |
| 692 | + if(!isset($dblIdProcedimento)) { | |
| 693 | + throw new InfraException('Parâmetro $dbIdProcedimento não informado.'); | |
| 694 | + } | |
| 710 | 695 | |
| 711 | - if(isset($dblIdDocumento)){ | |
| 712 | - $objProcedimentoHistoricoDTO->setDblIdDocumento($dblIdDocumento); | |
| 713 | - $objProcedimentoHistoricoDTO->setNumIdTarefa(array(TarefaRN::$TI_GERACAO_DOCUMENTO, TarefaRN::$TI_RECEBIMENTO_DOCUMENTO), InfraDTO::$OPER_IN); | |
| 714 | - } | |
| 696 | + $objProcedimentoHistoricoDTO = new ProcedimentoHistoricoDTO(); | |
| 697 | + $objProcedimentoHistoricoDTO->setDblIdProcedimento($dblIdProcedimento); | |
| 698 | + $objProcedimentoHistoricoDTO->setStrStaHistorico(ProcedimentoRN::$TH_PERSONALIZADO); | |
| 699 | + $objProcedimentoHistoricoDTO->adicionarCriterio(array('IdTarefa','IdTarefa'), array(InfraDTO::$OPER_IGUAL,InfraDTO::$OPER_IGUAL), array(TarefaRN::$TI_GERACAO_PROCEDIMENTO, ProcessoeletronicoRN::$TI_PROCESSO_ELETRONICO_PROCESSO_RECEBIDO), InfraDTO::$OPER_LOGICO_OR); | |
| 700 | + $objProcedimentoHistoricoDTO->setStrSinGerarLinksHistorico('N'); | |
| 701 | + $objProcedimentoHistoricoDTO->setNumMaxRegistrosRetorno(1); | |
| 702 | + $objProcedimentoHistoricoDTO->setOrdNumIdTarefa(InfraDTO::$TIPO_ORDENACAO_ASC); | |
| 703 | + | |
| 704 | + if(isset($dblIdDocumento)){ | |
| 705 | + $objProcedimentoHistoricoDTO->setDblIdDocumento($dblIdDocumento); | |
| 706 | + $objProcedimentoHistoricoDTO->setNumIdTarefa(array(TarefaRN::$TI_GERACAO_DOCUMENTO, TarefaRN::$TI_RECEBIMENTO_DOCUMENTO), InfraDTO::$OPER_IN); | |
| 707 | + } | |
| 715 | 708 | |
| 716 | - $objProcedimentoDTOHistorico = $this->objProcedimentoRN->consultarHistoricoRN1025($objProcedimentoHistoricoDTO); | |
| 717 | - $arrObjAtividadeDTOHistorico = $objProcedimentoDTOHistorico->getArrObjAtividadeDTO(); | |
| 709 | + $objProcedimentoDTOHistorico = $this->objProcedimentoRN->consultarHistoricoRN1025($objProcedimentoHistoricoDTO); | |
| 710 | + $arrObjAtividadeDTOHistorico = $objProcedimentoDTOHistorico->getArrObjAtividadeDTO(); | |
| 718 | 711 | |
| 719 | - if(isset($arrObjAtividadeDTOHistorico) && count($arrObjAtividadeDTOHistorico) == 1){ | |
| 720 | - $objContexto->dataHoraDeRegistro = $this->objProcessoEletronicoRN->converterDataWebService($arrObjAtividadeDTOHistorico[0]->getDthAbertura()); | |
| 712 | + if(isset($arrObjAtividadeDTOHistorico) && count($arrObjAtividadeDTOHistorico) == 1){ | |
| 713 | + $objContexto->dataHoraDeRegistro = $this->objProcessoEletronicoRN->converterDataWebService($arrObjAtividadeDTOHistorico[0]->getDthAbertura()); | |
| 714 | + } | |
| 721 | 715 | } |
| 722 | - } | |
| 723 | 716 | |
| 724 | - private function atribuirProdutorProcesso($objProcesso, $dblIdProcedimento, $numIdUnidadeGeradora) | |
| 725 | - { | |
| 726 | - if(!isset($objProcesso)){ | |
| 727 | - throw new InfraException('Parâmetro $objProcesso não informado.'); | |
| 728 | - } | |
| 717 | + private function atribuirProdutorProcesso($objProcesso, $dblIdProcedimento, $numIdUnidadeGeradora) | |
| 718 | + { | |
| 719 | + if(!isset($objProcesso)){ | |
| 720 | + throw new InfraException('Parâmetro $objProcesso não informado.'); | |
| 721 | + } | |
| 729 | 722 | |
| 730 | - $objProcesso->produtor = new stdClass(); | |
| 731 | - $objUsuarioProdutor = $this->consultarUsuario($dblIdProcedimento); | |
| 732 | - if(isset($objUsuarioProdutor)) { | |
| 733 | - //Dados do produtor do processo | |
| 734 | - $objProcesso->produtor->nome = utf8_encode($objUsuarioProdutor->getStrNome()); | |
| 735 | - //TODO: Obter tipo de pessoa fsica dos contatos do SEI | |
| 736 | - $objProcesso->produtor->numeroDeIdentificacao = $objUsuarioProdutor->getDblCpfContato(); | |
| 737 | - $objProcesso->produtor->tipo = self::STA_TIPO_PESSOA_FISICA; | |
| 723 | + $objProcesso->produtor = new stdClass(); | |
| 724 | + $objUsuarioProdutor = $this->consultarUsuario($dblIdProcedimento); | |
| 725 | + if(isset($objUsuarioProdutor)) { | |
| 726 | + //Dados do produtor do processo | |
| 727 | + $objProcesso->produtor->nome = utf8_encode($objUsuarioProdutor->getStrNome()); | |
| 728 | + //TODO: Obter tipo de pessoa fsica dos contatos do SEI | |
| 729 | + $objProcesso->produtor->numeroDeIdentificacao = $objUsuarioProdutor->getDblCpfContato(); | |
| 730 | + $objProcesso->produtor->tipo = self::STA_TIPO_PESSOA_FISICA; | |
| 738 | 731 | //TODO: Informar dados da estrutura organizacional (estruturaOrganizacional) |
| 732 | + } | |
| 739 | 733 | |
| 740 | - } | |
| 741 | - | |
| 742 | - $objUnidadeGeradora = $this->consultarUnidade($dblIdProcedimento); | |
| 743 | - if(isset($objUnidadeGeradora)){ | |
| 744 | - $objProcesso->produtor->unidade = new stdClass(); | |
| 745 | - $objProcesso->produtor->unidade->nome = utf8_encode($objUnidadeGeradora->getStrDescricao()); | |
| 746 | - $objProcesso->produtor->unidade->tipo = self::STA_TIPO_PESSOA_ORGAOPUBLICO; | |
| 734 | + $objUnidadeGeradora = $this->consultarUnidade($dblIdProcedimento); | |
| 735 | + if(isset($objUnidadeGeradora)){ | |
| 736 | + $objProcesso->produtor->unidade = new stdClass(); | |
| 737 | + $objProcesso->produtor->unidade->nome = utf8_encode($objUnidadeGeradora->getStrDescricao()); | |
| 738 | + $objProcesso->produtor->unidade->tipo = self::STA_TIPO_PESSOA_ORGAOPUBLICO; | |
| 747 | 739 | //TODO: Informar dados da estrutura organizacional (estruturaOrganizacional) |
| 748 | - } | |
| 749 | - } | |
| 750 | - | |
| 751 | - private function atribuirDadosInteressados($objProcesso, $dblIdProcedimento) | |
| 752 | - { | |
| 753 | - if(!isset($objProcesso)){ | |
| 754 | - throw new InfraException('Parâmetro $objProcesso não informado.'); | |
| 740 | + } | |
| 755 | 741 | } |
| 756 | 742 | |
| 757 | - $arrParticipantesDTO = $this->listarInteressados($dblIdProcedimento); | |
| 758 | - | |
| 759 | - if(isset($arrParticipantesDTO) && count($arrParticipantesDTO) > 0) | |
| 743 | + private function atribuirDadosInteressados($objProcesso, $dblIdProcedimento) | |
| 760 | 744 | { |
| 761 | - $objProcesso->interessado = array(); | |
| 745 | + if(!isset($objProcesso)){ | |
| 746 | + throw new InfraException('Parâmetro $objProcesso não informado.'); | |
| 747 | + } | |
| 762 | 748 | |
| 763 | - foreach ($arrParticipantesDTO as $participanteDTO) { | |
| 764 | - $interessado = new stdClass(); | |
| 765 | - $interessado->nome = utf8_encode($participanteDTO->getStrNomeContato()); | |
| 766 | - $objProcesso->interessado[] = $interessado; | |
| 767 | - } | |
| 768 | - } | |
| 769 | - } | |
| 749 | + $arrParticipantesDTO = $this->listarInteressados($dblIdProcedimento); | |
| 770 | 750 | |
| 751 | + if(isset($arrParticipantesDTO) && count($arrParticipantesDTO) > 0){ | |
| 752 | + $objProcesso->interessado = array(); | |
| 771 | 753 | |
| 772 | - private function atribuirDocumentos($objProcesso, $dblIdProcedimento) | |
| 773 | - { | |
| 774 | - if(!isset($objProcesso)) { | |
| 775 | - throw new InfraException('Parâmetro $objProcesso não informado.'); | |
| 754 | + foreach ($arrParticipantesDTO as $participanteDTO) { | |
| 755 | + $interessado = new stdClass(); | |
| 756 | + $interessado->nome = utf8_encode($participanteDTO->getStrNomeContato()); | |
| 757 | + $objProcesso->interessado[] = $interessado; | |
| 758 | + } | |
| 759 | + } | |
| 776 | 760 | } |
| 777 | 761 | |
| 762 | + private function atribuirDocumentos($objProcesso, $dblIdProcedimento) | |
| 763 | + { | |
| 764 | + if(!isset($objProcesso)) { | |
| 765 | + throw new InfraException('Parâmetro $objProcesso não informado.'); | |
| 766 | + } | |
| 767 | + | |
| 778 | 768 | //TODO: Passar dados do ProcedimentoDTO via parâmetro j carregado anteriormente |
| 779 | - $arrDocumentosDTO = $this->listarDocumentos($dblIdProcedimento); | |
| 769 | + $arrDocumentosDTO = $this->listarDocumentos($dblIdProcedimento); | |
| 780 | 770 | |
| 781 | - if(!isset($arrDocumentosDTO)) { | |
| 782 | - throw new InfraException('Documentos não encontrados.'); | |
| 783 | - } | |
| 784 | - $ordemDocumento = 1; | |
| 785 | - $objProcesso->documento = array(); | |
| 786 | - foreach ($arrDocumentosDTO as $documentoDTO) { | |
| 771 | + if(!isset($arrDocumentosDTO)) { | |
| 772 | + throw new InfraException('Documentos não encontrados.'); | |
| 773 | + } | |
| 774 | + | |
| 775 | + $ordemDocumento = 1; | |
| 776 | + $objProcesso->documento = array(); | |
| 777 | + foreach ($arrDocumentosDTO as $documentoDTO) { | |
| 787 | 778 | |
| 788 | 779 | //$protocoloDocumentoDTO = $this->consultarProtocoloDocumento($documeto->getDblIdProcedimento()); |
| 789 | - $documento = new stdClass(); | |
| 790 | - $objPenRelHipoteseLegalRN = new PenRelHipoteseLegalEnvioRN(); | |
| 780 | + $documento = new stdClass(); | |
| 781 | + $objPenRelHipoteseLegalRN = new PenRelHipoteseLegalEnvioRN(); | |
| 791 | 782 | //TODO: Atribuir das informações abaixo ao documento |
| 792 | 783 | //<protocoloDoDocumentoAnexado>123</protocoloDoDocumentoAnexado> |
| 793 | 784 | //<protocoloDoProcessoAnexado>456</protocoloDoProcessoAnexado> |
| 794 | 785 | //Retirado |
| 795 | 786 | //Considera o nmero/nome do documento externo para descrio do documento |
| 796 | - if($documentoDTO->getStrStaProtocoloProtocolo() == ProtocoloRN::$TP_DOCUMENTO_RECEBIDO && $documentoDTO->getStrNumero() != null) { | |
| 797 | - $strDescricaoDocumento = $documentoDTO->getStrNumero(); | |
| 798 | - }else{ | |
| 799 | - $strDescricaoDocumento = "***"; | |
| 800 | - } | |
| 801 | - // Não é um documento externo | |
| 802 | - /*elseif($documentoDTO->isSetNumIdTipoConferencia()){ | |
| 803 | - | |
| 804 | - $objTipoProcedimentoDTO = new PenTipoProcedimentoDTO(true); | |
| 805 | - $objTipoProcedimentoDTO->retStrNome(); | |
| 806 | - $objTipoProcedimentoDTO->setBolExclusaoLogica(false); | |
| 807 | - $objTipoProcedimentoDTO->setDblIdProcedimento($dblIdProcedimento); | |
| 808 | - | |
| 809 | - $objTipoProcedimentoBD = new TipoProcedimentoBD(BancoSEI::getInstance()); | |
| 810 | - | |
| 811 | - $objTipoProcedimentoDTO = $objTipoProcedimentoBD->consultar($objTipoProcedimentoDTO); | |
| 812 | - | |
| 813 | - $strDescricaoDocumento = $objTipoProcedimentoDTO->getStrNome(); | |
| 814 | - }*/ | |
| 815 | - | |
| 816 | - $documento->retirado = ($documentoDTO->getStrStaEstadoProtocolo() == ProtocoloRN::$TE_DOCUMENTO_CANCELADO) ? true : false; | |
| 817 | - $documento->ordem = $ordemDocumento++; | |
| 818 | - $documento->descricao = utf8_encode($strDescricaoDocumento); | |
| 819 | - $documento->nivelDeSigilo = $this->obterNivelSigiloPEN($documentoDTO->getStrStaNivelAcessoLocalProtocolo()); | |
| 820 | - if($documentoDTO->getStrStaNivelAcessoLocalProtocolo() == ProtocoloRN::$NA_RESTRITO){ | |
| 821 | - $documento->hipoteseLegal = new stdClass(); | |
| 822 | - $documento->hipoteseLegal->identificacao = $objPenRelHipoteseLegalRN->getIdHipoteseLegalPEN($documentoDTO->getNumIdHipoteseLegalProtocolo()); | |
| 823 | - //TODO: Adicionar nome da hipótese legal atribuida ao documento | |
| 824 | - } | |
| 825 | - $documento->dataHoraDeProducao = $this->objProcessoEletronicoRN->converterDataWebService($documentoDTO->getDtaGeracaoProtocolo()); | |
| 826 | - $documento->produtor = new stdClass(); | |
| 827 | - $usuarioDTO = $this->consultarUsuario($documentoDTO->getNumIdUsuarioGeradorProtocolo()); | |
| 828 | - if(isset($usuarioDTO)) { | |
| 829 | - $documento->produtor->nome = utf8_encode($usuarioDTO->getStrNome()); | |
| 830 | - $documento->produtor->numeroDeIdentificacao = $usuarioDTO->getDblCpfContato(); | |
| 831 | - //TODO: Obter tipo de pessoa fsica dos contextos/contatos do SEI | |
| 832 | - $documento->produtor->tipo = self::STA_TIPO_PESSOA_FISICA;; | |
| 833 | - } | |
| 834 | - | |
| 835 | - $unidadeDTO = $this->consultarUnidade($documentoDTO->getNumIdUnidadeResponsavel()); | |
| 836 | - if(isset($unidadeDTO)) { | |
| 837 | - $documento->produtor->unidade = new stdClass(); | |
| 838 | - $documento->produtor->unidade->nome = utf8_encode($unidadeDTO->getStrDescricao()); | |
| 839 | - $documento->produtor->unidade->tipo = self::STA_TIPO_PESSOA_ORGAOPUBLICO; | |
| 840 | - //TODO: Informar dados da estrutura organizacional (estruturaOrganizacional) | |
| 841 | - } | |
| 842 | - $documento->produtor->numeroDeIdentificacao = $documentoDTO->getStrProtocoloDocumentoFormatado(); //TODO: Avaliar se informação está correta | |
| 843 | - | |
| 844 | - $this->atribuirDataHoraDeRegistro($documento, $documentoDTO->getDblIdProcedimento(), $documentoDTO->getDblIdDocumento()); | |
| 787 | + if($documentoDTO->getStrStaProtocoloProtocolo() == ProtocoloRN::$TP_DOCUMENTO_RECEBIDO && $documentoDTO->getStrNumero() != null) { | |
| 788 | + $strDescricaoDocumento = $documentoDTO->getStrNumero(); | |
| 789 | + }else{ | |
| 790 | + $strDescricaoDocumento = "***"; | |
| 791 | + } | |
| 792 | + | |
| 793 | + // Não é um documento externo | |
| 794 | + /*elseif($documentoDTO->isSetNumIdTipoConferencia()){ | |
| 795 | + | |
| 796 | + $objTipoProcedimentoDTO = new PenTipoProcedimentoDTO(true); | |
| 797 | + $objTipoProcedimentoDTO->retStrNome(); | |
| 798 | + $objTipoProcedimentoDTO->setBolExclusaoLogica(false); | |
| 799 | + $objTipoProcedimentoDTO->setDblIdProcedimento($dblIdProcedimento); | |
| 800 | + $objTipoProcedimentoBD = new TipoProcedimentoBD(BancoSEI::getInstance()); | |
| 801 | + $objTipoProcedimentoDTO = $objTipoProcedimentoBD->consultar($objTipoProcedimentoDTO); | |
| 802 | + $strDescricaoDocumento = $objTipoProcedimentoDTO->getStrNome(); | |
| 803 | + }*/ | |
| 804 | + | |
| 805 | + $documento->retirado = ($documentoDTO->getStrStaEstadoProtocolo() == ProtocoloRN::$TE_DOCUMENTO_CANCELADO) ? true : false; | |
| 806 | + $documento->ordem = $ordemDocumento++; | |
| 807 | + $documento->descricao = utf8_encode($strDescricaoDocumento); | |
| 808 | + $documento->nivelDeSigilo = $this->obterNivelSigiloPEN($documentoDTO->getStrStaNivelAcessoLocalProtocolo()); | |
| 809 | + if($documentoDTO->getStrStaNivelAcessoLocalProtocolo() == ProtocoloRN::$NA_RESTRITO){ | |
| 810 | + $documento->hipoteseLegal = new stdClass(); | |
| 811 | + $documento->hipoteseLegal->identificacao = $objPenRelHipoteseLegalRN->getIdHipoteseLegalPEN($documentoDTO->getNumIdHipoteseLegalProtocolo()); | |
| 812 | + //TODO: Adicionar nome da hipótese legal atribuida ao documento | |
| 813 | + } | |
| 814 | + $documento->dataHoraDeProducao = $this->objProcessoEletronicoRN->converterDataWebService($documentoDTO->getDtaGeracaoProtocolo()); | |
| 815 | + $documento->produtor = new stdClass(); | |
| 816 | + $usuarioDTO = $this->consultarUsuario($documentoDTO->getNumIdUsuarioGeradorProtocolo()); | |
| 817 | + if(isset($usuarioDTO)) { | |
| 818 | + $documento->produtor->nome = utf8_encode($usuarioDTO->getStrNome()); | |
| 819 | + $documento->produtor->numeroDeIdentificacao = $usuarioDTO->getDblCpfContato(); | |
| 820 | + //TODO: Obter tipo de pessoa fsica dos contextos/contatos do SEI | |
| 821 | + $documento->produtor->tipo = self::STA_TIPO_PESSOA_FISICA;; | |
| 822 | + } | |
| 823 | + | |
| 824 | + $unidadeDTO = $this->consultarUnidade($documentoDTO->getNumIdUnidadeResponsavel()); | |
| 825 | + if(isset($unidadeDTO)) { | |
| 826 | + $documento->produtor->unidade = new stdClass(); | |
| 827 | + $documento->produtor->unidade->nome = utf8_encode($unidadeDTO->getStrDescricao()); | |
| 828 | + $documento->produtor->unidade->tipo = self::STA_TIPO_PESSOA_ORGAOPUBLICO; | |
| 829 | + //TODO: Informar dados da estrutura organizacional (estruturaOrganizacional) | |
| 830 | + } | |
| 831 | + | |
| 832 | + $documento->produtor->numeroDeIdentificacao = $documentoDTO->getStrProtocoloDocumentoFormatado(); //TODO: Avaliar se informação está correta | |
| 833 | + | |
| 834 | + $this->atribuirDataHoraDeRegistro($documento, $documentoDTO->getDblIdProcedimento(), $documentoDTO->getDblIdDocumento()); | |
| 845 | 835 | //TODO: Implementar mapeamento de espécies documentais |
| 846 | - $documento->especie = new stdClass(); | |
| 847 | - $documento->especie->codigo = $this->obterEspecieMapeada($documentoDTO->getNumIdSerie()); | |
| 848 | - $documento->especie->nomeNoProdutor = utf8_encode($documentoDTO->getStrNomeSerie()); | |
| 836 | + $documento->especie = new stdClass(); | |
| 837 | + $documento->especie->codigo = $this->obterEspecieMapeada($documentoDTO->getNumIdSerie()); | |
| 838 | + $documento->especie->nomeNoProdutor = utf8_encode($documentoDTO->getStrNomeSerie()); | |
| 849 | 839 | //TODO: Tratar campos adicionais do documento |
| 850 | 840 | //Identificao do documento |
| 851 | - $this->atribuirNumeracaoDocumento($documento, $documentoDTO); | |
| 852 | - if($documento->retirado === true){ | |
| 841 | + $this->atribuirNumeracaoDocumento($documento, $documentoDTO); | |
| 842 | + if($documento->retirado === true){ | |
| 853 | 843 | |
| 854 | - $penComponenteDigitalDTO = new ComponenteDigitalDTO(); | |
| 855 | - $penComponenteDigitalDTO->retTodos(); | |
| 856 | - $penComponenteDigitalDTO->setDblIdDocumento($documentoDTO->getDblIdDocumento()); | |
| 844 | + $penComponenteDigitalDTO = new ComponenteDigitalDTO(); | |
| 845 | + $penComponenteDigitalDTO->retTodos(); | |
| 846 | + $penComponenteDigitalDTO->setDblIdDocumento($documentoDTO->getDblIdDocumento()); | |
| 857 | 847 | |
| 858 | - $penComponenteDigitalBD = new ComponenteDigitalBD($this->getObjInfraIBanco()); | |
| 848 | + $penComponenteDigitalBD = new ComponenteDigitalBD($this->getObjInfraIBanco()); | |
| 859 | 849 | |
| 860 | - if($penComponenteDigitalBD->contar($penComponenteDigitalDTO) > 0){ | |
| 850 | + if($penComponenteDigitalBD->contar($penComponenteDigitalDTO) > 0){ | |
| 861 | 851 | |
| 862 | - $arrPenComponenteDigitalDTO = $penComponenteDigitalBD->listar($penComponenteDigitalDTO); | |
| 863 | - $componenteDigital = $arrPenComponenteDigitalDTO[0]; | |
| 852 | + $arrPenComponenteDigitalDTO = $penComponenteDigitalBD->listar($penComponenteDigitalDTO); | |
| 853 | + $componenteDigital = $arrPenComponenteDigitalDTO[0]; | |
| 864 | 854 | |
| 865 | - $documento->componenteDigital = new stdClass(); | |
| 866 | - $documento->componenteDigital->ordem = 1; | |
| 867 | - $documento->componenteDigital->nome = utf8_encode($componenteDigital->getStrNome()); | |
| 868 | - $documento->componenteDigital->hash = new SoapVar("<hash algoritmo='{$componenteDigital->getStrAlgoritmoHash()}'>{$componenteDigital->getStrHashConteudo()}</hash>", XSD_ANYXML); | |
| 869 | - $documento->componenteDigital->tamanhoEmBytes = $componenteDigital->getNumTamanho(); | |
| 870 | - $documento->componenteDigital->mimeType = $componenteDigital->getStrMimeType(); | |
| 871 | - $documento->componenteDigital->tipoDeConteudo = $componenteDigital->getStrTipoConteudo(); | |
| 872 | - $documento->componenteDigital->idAnexo = $componenteDigital->getNumIdAnexo(); | |
| 855 | + $documento->componenteDigital = new stdClass(); | |
| 856 | + $documento->componenteDigital->ordem = 1; | |
| 857 | + $documento->componenteDigital->nome = utf8_encode($componenteDigital->getStrNome()); | |
| 858 | + $documento->componenteDigital->hash = new SoapVar("<hash algoritmo='{$componenteDigital->getStrAlgoritmoHash()}'>{$componenteDigital->getStrHashConteudo()}</hash>", XSD_ANYXML); | |
| 859 | + $documento->componenteDigital->tamanhoEmBytes = $componenteDigital->getNumTamanho(); | |
| 860 | + $documento->componenteDigital->mimeType = $componenteDigital->getStrMimeType(); | |
| 861 | + $documento->componenteDigital->tipoDeConteudo = $componenteDigital->getStrTipoConteudo(); | |
| 862 | + $documento->componenteDigital->idAnexo = $componenteDigital->getNumIdAnexo(); | |
| 873 | 863 | |
| 874 | 864 | |
| 875 | - // -------------------------- INICIO DA TAREFA US074 -------------------------------// | |
| 876 | - $documento = $this->atribuirDadosAssinaturaDigital($documentoDTO, $documento, $componenteDigital->getStrHashConteudo()); | |
| 877 | - // -------------------------- FIM TAREFA US074 -------------------------------// | |
| 865 | + // -------------------------- INICIO DA TAREFA US074 -------------------------------// | |
| 866 | + $documento = $this->atribuirDadosAssinaturaDigital($documentoDTO, $documento, $componenteDigital->getStrHashConteudo()); | |
| 867 | + // -------------------------- FIM TAREFA US074 -------------------------------// | |
| 878 | 868 | |
| 879 | 869 | |
| 880 | - if($componenteDigital->getStrMimeType() == 'outro'){ | |
| 881 | - $documento->componenteDigital->dadosComplementaresDoTipoDeArquivo = 'outro'; | |
| 882 | - } | |
| 883 | - | |
| 884 | - }else{ | |
| 885 | - $this->atribuirComponentesDigitais($documento, $documentoDTO); | |
| 886 | - | |
| 887 | - } | |
| 870 | + if($componenteDigital->getStrMimeType() == 'outro'){ | |
| 871 | + $documento->componenteDigital->dadosComplementaresDoTipoDeArquivo = 'outro'; | |
| 872 | + } | |
| 888 | 873 | |
| 889 | - }else{ | |
| 890 | - $this->atribuirComponentesDigitais($documento, $documentoDTO); | |
| 891 | - } | |
| 874 | + }else{ | |
| 875 | + $this->atribuirComponentesDigitais($documento, $documentoDTO); | |
| 876 | + } | |
| 877 | + }else{ | |
| 878 | + $this->atribuirComponentesDigitais($documento, $documentoDTO); | |
| 879 | + } | |
| 892 | 880 | |
| 893 | 881 | //TODO: Necessrio tratar informações abaixo |
| 894 | 882 | //protocoloDoDocumentoAnexado |
| ... | ... | @@ -896,109 +884,98 @@ class ExpedirProcedimentoRN extends InfraRN { |
| 896 | 884 | //retirado |
| 897 | 885 | //protocoloAnterior |
| 898 | 886 | //historico |
| 899 | - $documento->idDocumentoSEI = $documentoDTO->getDblIdDocumento(); | |
| 900 | - $objProcesso->documento[] = $documento; | |
| 887 | + $documento->idDocumentoSEI = $documentoDTO->getDblIdDocumento(); | |
| 888 | + $objProcesso->documento[] = $documento; | |
| 889 | + } | |
| 901 | 890 | } |
| 902 | - } | |
| 903 | - | |
| 904 | - public function atribuirComponentesDigitaisRetirados($documentoDTO){ | |
| 905 | 891 | |
| 906 | - } | |
| 892 | + public function atribuirComponentesDigitaisRetirados($documentoDTO){ | |
| 907 | 893 | |
| 908 | - private function obterEspecieMapeada($parNumIdSerie) | |
| 909 | - { | |
| 910 | - if(!isset($parNumIdSerie) || $parNumIdSerie == 0) { | |
| 911 | - throw new InfraException('Parâmetro $parNumIdSerie não informado.'); | |
| 912 | 894 | } |
| 913 | 895 | |
| 914 | - $objPenRelTipoDocMapEnviadoDTO = new PenRelTipoDocMapEnviadoDTO(); | |
| 915 | - $objPenRelTipoDocMapEnviadoDTO->setNumIdSerie($parNumIdSerie); | |
| 916 | - $objPenRelTipoDocMapEnviadoDTO->retNumCodigoEspecie(); | |
| 896 | + private function obterEspecieMapeada($parNumIdSerie) | |
| 897 | + { | |
| 898 | + if(!isset($parNumIdSerie) || $parNumIdSerie == 0) { | |
| 899 | + throw new InfraException('Parâmetro $parNumIdSerie não informado.'); | |
| 900 | + } | |
| 917 | 901 | |
| 918 | - $objGenericoBD = new GenericoBD($this->getObjInfraIBanco()); | |
| 919 | - $objPenRelTipoDocMapEnviadoDTO = $objGenericoBD->consultar($objPenRelTipoDocMapEnviadoDTO); | |
| 902 | + $objPenRelTipoDocMapEnviadoDTO = new PenRelTipoDocMapEnviadoDTO(); | |
| 903 | + $objPenRelTipoDocMapEnviadoDTO->setNumIdSerie($parNumIdSerie); | |
| 904 | + $objPenRelTipoDocMapEnviadoDTO->retNumCodigoEspecie(); | |
| 920 | 905 | |
| 921 | - if($objPenRelTipoDocMapEnviadoDTO == null) { | |
| 922 | - $objPenRelTipoDocMapEnviadoDTO = new PenRelTipoDocMapEnviadoDTO(); | |
| 923 | - $objPenRelTipoDocMapEnviadoDTO->retNumCodigoEspecie(); | |
| 924 | - $objPenRelTipoDocMapEnviadoDTO->setStrPadrao('S'); | |
| 925 | - $objPenRelTipoDocMapEnviadoDTO->setNumMaxRegistrosRetorno(1); | |
| 926 | - $objPenRelTipoDocMapEnviadoDTO = $objGenericoBD->consultar($objPenRelTipoDocMapEnviadoDTO); | |
| 927 | - } | |
| 906 | + $objGenericoBD = new GenericoBD($this->getObjInfraIBanco()); | |
| 907 | + $objPenRelTipoDocMapEnviadoDTO = $objGenericoBD->consultar($objPenRelTipoDocMapEnviadoDTO); | |
| 928 | 908 | |
| 929 | - if($objPenRelTipoDocMapEnviadoDTO == null) { | |
| 930 | - throw new InfraException("Código de identificação da espécie documental não pode ser localizada para o tipo de documento {$parNumIdSerie}."); | |
| 931 | - } | |
| 932 | - | |
| 933 | - return $objPenRelTipoDocMapEnviadoDTO->getNumCodigoEspecie(); | |
| 934 | - } | |
| 909 | + if($objPenRelTipoDocMapEnviadoDTO == null) { | |
| 910 | + $objPenRelTipoDocMapEnviadoDTO = new PenRelTipoDocMapEnviadoDTO(); | |
| 911 | + $objPenRelTipoDocMapEnviadoDTO->retNumCodigoEspecie(); | |
| 912 | + $objPenRelTipoDocMapEnviadoDTO->setStrPadrao('S'); | |
| 913 | + $objPenRelTipoDocMapEnviadoDTO->setNumMaxRegistrosRetorno(1); | |
| 914 | + $objPenRelTipoDocMapEnviadoDTO = $objGenericoBD->consultar($objPenRelTipoDocMapEnviadoDTO); | |
| 915 | + } | |
| 935 | 916 | |
| 917 | + if($objPenRelTipoDocMapEnviadoDTO == null) { | |
| 918 | + throw new InfraException("Código de identificação da espécie documental não pode ser localizada para o tipo de documento {$parNumIdSerie}."); | |
| 919 | + } | |
| 936 | 920 | |
| 937 | - private function atribuirAssinaturaEletronica($objComponenteDigital, AssinaturaDTO $objAssinaturaDTO) | |
| 938 | - { | |
| 939 | - if(!isset($objComponenteDigital)){ | |
| 940 | - throw new InfraException('Parâmetro $objComponenteDigital não informado.'); | |
| 921 | + return $objPenRelTipoDocMapEnviadoDTO->getNumCodigoEspecie(); | |
| 941 | 922 | } |
| 942 | 923 | |
| 943 | - if(isset($objAssinaturaDTO)) { | |
| 944 | - $objComponenteDigital->assinaturaDigital = new stdClass(); | |
| 945 | - //TODO: Obter as informações corretas dos metadados da assinatura digital | |
| 946 | - $objComponenteDigital->assinaturaDigital->dataHora = $this->objProcessoEletronicoRN->converterDataWebService($objComponenteDigital->getDthAberturaAtividade()); | |
| 947 | - $objComponenteDigital->assinaturaDigital->cadeiaDoCertificado = new SoapVar('<cadeiaDoCertificado formato="PKCS7"></cadeiaDoCertificado>', XSD_ANYXML); | |
| 948 | - $objComponenteDigital->assinaturaDigital->hash = new SoapVar("<hash algoritmo='{self::ALGORITMO_HASH_ASSINATURA}'>{$objAssinaturaDTO->getStrP7sBase64()}</hash>", XSD_ANYXML); | |
| 949 | - } | |
| 950 | - } | |
| 951 | 924 | |
| 952 | - private function atribuirComponentesDigitais($objDocumento, DocumentoDTO $objDocumentoDTO) | |
| 953 | - { | |
| 954 | - if(!isset($objDocumento)){ | |
| 955 | - throw new InfraException('Parâmetro $objDocumento não informado.'); | |
| 956 | - } | |
| 925 | + private function atribuirAssinaturaEletronica($objComponenteDigital, AssinaturaDTO $objAssinaturaDTO) | |
| 926 | + { | |
| 927 | + if(!isset($objComponenteDigital)){ | |
| 928 | + throw new InfraException('Parâmetro $objComponenteDigital não informado.'); | |
| 929 | + } | |
| 957 | 930 | |
| 958 | - if(!isset($objDocumentoDTO)){ | |
| 959 | - throw new InfraException('Parâmetro $objDocumentoDTO não informado.'); | |
| 931 | + if(isset($objAssinaturaDTO)) { | |
| 932 | + $objComponenteDigital->assinaturaDigital = new stdClass(); | |
| 933 | + //TODO: Obter as informações corretas dos metadados da assinatura digital | |
| 934 | + $objComponenteDigital->assinaturaDigital->dataHora = $this->objProcessoEletronicoRN->converterDataWebService($objComponenteDigital->getDthAberturaAtividade()); | |
| 935 | + $objComponenteDigital->assinaturaDigital->cadeiaDoCertificado = new SoapVar('<cadeiaDoCertificado formato="PKCS7"></cadeiaDoCertificado>', XSD_ANYXML); | |
| 936 | + $objComponenteDigital->assinaturaDigital->hash = new SoapVar("<hash algoritmo='{self::ALGORITMO_HASH_ASSINATURA}'>{$objAssinaturaDTO->getStrP7sBase64()}</hash>", XSD_ANYXML); | |
| 937 | + } | |
| 960 | 938 | } |
| 961 | 939 | |
| 962 | - $arrInformacaoArquivo = $this->obterDadosArquivo($objDocumentoDTO); | |
| 940 | + private function atribuirComponentesDigitais($objDocumento, DocumentoDTO $objDocumentoDTO) | |
| 941 | + { | |
| 942 | + if(!isset($objDocumento)){ | |
| 943 | + throw new InfraException('Parâmetro $objDocumento não informado.'); | |
| 944 | + } | |
| 963 | 945 | |
| 964 | - if(!isset($arrInformacaoArquivo) || count($arrInformacaoArquivo) == 0){ | |
| 965 | - throw new InfraException('Erro durante obtenção de informações sobre o componente digital do documento {$objDocumentoDTO->getStrProtocoloDocumentoFormatado()}.'); | |
| 966 | - } | |
| 946 | + if(!isset($objDocumentoDTO)){ | |
| 947 | + throw new InfraException('Parâmetro $objDocumentoDTO não informado.'); | |
| 948 | + } | |
| 967 | 949 | |
| 968 | - $strAlgoritmoHash = self::ALGORITMO_HASH_DOCUMENTO; | |
| 969 | - $strConteudoAssinatura = $arrInformacaoArquivo['CONTEUDO']; | |
| 970 | - $hashDoComponenteDigital = hash($strAlgoritmoHash, $strConteudoAssinatura, true); | |
| 971 | - $hashDoComponenteDigital = base64_encode($hashDoComponenteDigital); | |
| 950 | + $arrInformacaoArquivo = $this->obterDadosArquivo($objDocumentoDTO); | |
| 972 | 951 | |
| 973 | - //Busca registro de tramitações anteriores para este componente digital para identificar se o Barramento do PEN já havia registrado o hash do documento gerado da | |
| 974 | - //forma antiga, ou seja, considerando o link do Número SEI. Este link foi removido para manter o padrão de conteúdo de documentos utilizado pelo SEI para assinatura | |
| 975 | - //Para não bloquear os documentos gerados anteriormente, aqueles já registrados pelo Barramento com o hash antigo deverão manter a geração de conteúdo anteriormente utilizada. | |
| 976 | - $objComponenteDigital = $this->consultarComponenteDigital($objDocumentoDTO->getDblIdDocumento()); | |
| 977 | - $hashDoComponenteDigitalAnterior = (isset($objComponenteDigital)) ? $objComponenteDigital->getStrHashConteudo() : null; | |
| 978 | - if(isset($hashDoComponenteDigitalAnterior) && ($hashDoComponenteDigitalAnterior <> $hashDoComponenteDigital)){ | |
| 979 | - $strConteudoAssinaturaLegado = $arrInformacaoArquivo['CONTEUDO_LEGADO']; | |
| 980 | - $hashDoComponenteDigital = hash($strAlgoritmoHash, $strConteudoAssinaturaLegado, true); | |
| 981 | - $hashDoComponenteDigital = base64_encode($hashDoComponenteDigital); | |
| 982 | - } | |
| 952 | + if(!isset($arrInformacaoArquivo) || count($arrInformacaoArquivo) == 0){ | |
| 953 | + throw new InfraException('Erro durante obtenção de informações sobre o componente digital do documento {$objDocumentoDTO->getStrProtocoloDocumentoFormatado()}.'); | |
| 954 | + } | |
| 983 | 955 | |
| 984 | - //TODO: Revisar tal implementao para atender a gerao de hash de arquivos grandes | |
| 985 | - $objDocumento->componenteDigital = new stdClass(); | |
| 986 | - $objDocumento->componenteDigital->ordem = 1; | |
| 987 | - $objDocumento->componenteDigital->nome = utf8_encode($arrInformacaoArquivo["NOME"]); | |
| 988 | - $objDocumento->componenteDigital->hash = new SoapVar("<hash algoritmo='{$strAlgoritmoHash}'>{$hashDoComponenteDigital}</hash>", XSD_ANYXML); | |
| 989 | - $objDocumento->componenteDigital->tamanhoEmBytes = $arrInformacaoArquivo['TAMANHO']; | |
| 956 | + $strAlgoritmoHash = self::ALGORITMO_HASH_DOCUMENTO; | |
| 957 | + $strConteudoAssinatura = $arrInformacaoArquivo['CONTEUDO']; | |
| 958 | + $hashDoComponenteDigital = $arrInformacaoArquivo['HASH_CONTEUDO']; | |
| 959 | + $strAlgoritmoHash = $arrInformacaoArquivo['ALGORITMO_HASH_CONTEUDO']; | |
| 960 | + | |
| 961 | + //TODO: Revisar tal implementao para atender a gerao de hash de arquivos grandes | |
| 962 | + $objDocumento->componenteDigital = new stdClass(); | |
| 963 | + $objDocumento->componenteDigital->ordem = 1; | |
| 964 | + $objDocumento->componenteDigital->nome = utf8_encode($arrInformacaoArquivo["NOME"]); | |
| 965 | + $objDocumento->componenteDigital->hash = new SoapVar("<hash algoritmo='{$strAlgoritmoHash}'>{$hashDoComponenteDigital}</hash>", XSD_ANYXML); | |
| 966 | + $objDocumento->componenteDigital->tamanhoEmBytes = $arrInformacaoArquivo['TAMANHO']; | |
| 990 | 967 | //TODO: Validar os tipos de mimetype de acordo com o WSDL do SEI |
| 991 | 968 | //Caso no identifique o tipo correto, informar o valor [outro] |
| 992 | - $objDocumento->componenteDigital->mimeType = $arrInformacaoArquivo['MIME_TYPE']; | |
| 993 | - $objDocumento->componenteDigital->tipoDeConteudo = $this->obterTipoDeConteudo($arrInformacaoArquivo['MIME_TYPE']); | |
| 969 | + $objDocumento->componenteDigital->mimeType = $arrInformacaoArquivo['MIME_TYPE']; | |
| 970 | + $objDocumento->componenteDigital->tipoDeConteudo = $this->obterTipoDeConteudo($arrInformacaoArquivo['MIME_TYPE']); | |
| 994 | 971 | |
| 995 | - // -------------------------- INICIO DA TAREFA US074 -------------------------------/ | |
| 996 | - $objDocumento = $this->atribuirDadosAssinaturaDigital($objDocumentoDTO, $objDocumento, $hashDoComponenteDigital); | |
| 997 | - // -------------------------- FIM TAREFA US074 -------------------------------// | |
| 972 | + // -------------------------- INICIO DA TAREFA US074 -------------------------------/ | |
| 973 | + $objDocumento = $this->atribuirDadosAssinaturaDigital($objDocumentoDTO, $objDocumento, $hashDoComponenteDigital); | |
| 974 | + // -------------------------- FIM TAREFA US074 -------------------------------// | |
| 998 | 975 | |
| 999 | - if($arrInformacaoArquivo['MIME_TYPE'] == 'outro'){ | |
| 1000 | - $objDocumento->componenteDigital->dadosComplementaresDoTipoDeArquivo = $arrInformacaoArquivo['dadosComplementaresDoTipoDeArquivo']; | |
| 1001 | - } | |
| 976 | + if($arrInformacaoArquivo['MIME_TYPE'] == 'outro'){ | |
| 977 | + $objDocumento->componenteDigital->dadosComplementaresDoTipoDeArquivo = $arrInformacaoArquivo['dadosComplementaresDoTipoDeArquivo']; | |
| 978 | + } | |
| 1002 | 979 | |
| 1003 | 980 | //TODO: Preencher dados complementares do tipo de arquivo |
| 1004 | 981 | //$objDocumento->componenteDigital->dadosComplementaresDoTipoDeArquivo = ''; |
| ... | ... | @@ -1006,13 +983,12 @@ class ExpedirProcedimentoRN extends InfraRN { |
| 1006 | 983 | //TODO: Carregar informações da assinatura digital |
| 1007 | 984 | //$this->atribuirAssinaturaEletronica($objDocumento->componenteDigital, $objDocumentoDTO); |
| 1008 | 985 | |
| 1009 | - $objDocumento->componenteDigital->idAnexo = $arrInformacaoArquivo['ID_ANEXO']; | |
| 1010 | - return $objDocumento; | |
| 1011 | - } | |
| 1012 | - | |
| 1013 | - public function atribuirDadosAssinaturaDigital($objDocumentoDTO, $objDocumento, $strHashDocumento) { | |
| 1014 | - | |
| 986 | + $objDocumento->componenteDigital->idAnexo = $arrInformacaoArquivo['ID_ANEXO']; | |
| 987 | + return $objDocumento; | |
| 988 | + } | |
| 1015 | 989 | |
| 990 | + public function atribuirDadosAssinaturaDigital($objDocumentoDTO, $objDocumento, $strHashDocumento) | |
| 991 | + { | |
| 1016 | 992 | //Busca as Tarjas |
| 1017 | 993 | $objDocumentoDTOTarjas = new DocumentoDTO(); |
| 1018 | 994 | $objDocumentoDTOTarjas->retDblIdDocumento(); |
| ... | ... | @@ -1041,8 +1017,8 @@ class ExpedirProcedimentoRN extends InfraRN { |
| 1041 | 1017 | foreach ($dataTarjas as $key => $content) { |
| 1042 | 1018 | $contentTrim = trim($content); //Limpa os espaos no inicio e fim de cada texto. |
| 1043 | 1019 | if (empty($contentTrim)) { |
| 1044 | - unset($dataTarjas[$key]); | |
| 1045 | - } else { | |
| 1020 | + unset($dataTarjas[$key]); | |
| 1021 | + } else { | |
| 1046 | 1022 | $dataTarjas[$key] = html_entity_decode($contentTrim); //Decodifica por causa do strip_tags |
| 1047 | 1023 | } |
| 1048 | 1024 | } |
| ... | ... | @@ -1089,118 +1065,122 @@ class ExpedirProcedimentoRN extends InfraRN { |
| 1089 | 1065 | } |
| 1090 | 1066 | |
| 1091 | 1067 | |
| 1092 | - private function consultarComponenteDigital($parDblIdDocumento) | |
| 1068 | + private function consultarComponenteDigital($parDblIdDocumento, $parNumIdTramite=null) | |
| 1093 | 1069 | { |
| 1094 | 1070 | $objComponenteDigitalDTO = new ComponenteDigitalDTO(); |
| 1095 | 1071 | $objComponenteDigitalDTO->setDblIdDocumento($parDblIdDocumento); |
| 1072 | + //$objComponenteDigitalDTO->setNumIdTramite($parNumIdTramite, InfraDTO::$OPER_DIFERENTE); | |
| 1096 | 1073 | $objComponenteDigitalDTO->setNumMaxRegistrosRetorno(1); |
| 1097 | 1074 | $objComponenteDigitalDTO->setOrd('IdTramite', InfraDTO::$TIPO_ORDENACAO_DESC); |
| 1098 | 1075 | $objComponenteDigitalDTO->retTodos(); |
| 1099 | 1076 | |
| 1100 | 1077 | $objComponenteDigitalBD = new ComponenteDigitalBD($this->getObjInfraIBanco()); |
| 1101 | - return $objComponenteDigitalBD->consultar($objComponenteDigitalDTO); | |
| 1078 | + $arrObjComponenteDigitalDTO = $objComponenteDigitalBD->listar($objComponenteDigitalDTO); | |
| 1079 | + return (count($arrObjComponenteDigitalDTO) > 0) ? $arrObjComponenteDigitalDTO[0] : null; | |
| 1102 | 1080 | } |
| 1103 | 1081 | |
| 1104 | - private function obterDadosArquivo(DocumentoDTO $objDocumentoDTO) | |
| 1105 | - { | |
| 1106 | - | |
| 1107 | - if(!isset($objDocumentoDTO)){ | |
| 1108 | - throw new InfraException('Parâmetro $objDocumentoDTO não informado.'); | |
| 1109 | - } | |
| 1082 | + private function obterDadosArquivo(DocumentoDTO $objDocumentoDTO) | |
| 1083 | + { | |
| 1084 | + if(!isset($objDocumentoDTO)){ | |
| 1085 | + throw new InfraException('Parâmetro $objDocumentoDTO não informado.'); | |
| 1086 | + } | |
| 1110 | 1087 | |
| 1111 | - $arrInformacaoArquivo = array(); | |
| 1112 | - $strProtocoloDocumentoFormatado = $objDocumentoDTO->getStrProtocoloDocumentoFormatado(); | |
| 1088 | + $arrInformacaoArquivo = array(); | |
| 1089 | + $strProtocoloDocumentoFormatado = $objDocumentoDTO->getStrProtocoloDocumentoFormatado(); | |
| 1113 | 1090 | |
| 1114 | - $objInfraParametro = new InfraParametro($this->getObjInfraIBanco()); | |
| 1115 | - $idSerieEmail = $objInfraParametro->getValor('ID_SERIE_EMAIL'); | |
| 1116 | - $docEmailEnviado = $objDocumentoDTO->getNumIdSerie() == $idSerieEmail && $objDocumentoDTO->getStrStaDocumento() == DocumentoRN::$TD_FORMULARIO_AUTOMATICO ? true : false; | |
| 1091 | + $objInfraParametro = new InfraParametro($this->getObjInfraIBanco()); | |
| 1092 | + $idSerieEmail = $objInfraParametro->getValor('ID_SERIE_EMAIL'); | |
| 1093 | + $docEmailEnviado = $objDocumentoDTO->getNumIdSerie() == $idSerieEmail && $objDocumentoDTO->getStrStaDocumento() == DocumentoRN::$TD_FORMULARIO_AUTOMATICO ? true : false; | |
| 1117 | 1094 | |
| 1118 | - if($objDocumentoDTO->getStrStaDocumento() == DocumentoRN::$TD_EDITOR_INTERNO) { | |
| 1119 | - $strConteudoAssinatura = $this->obterConteudoInternoAssinatura($objDocumentoDTO->getDblIdDocumento()); | |
| 1120 | - $strConteudoAssinaturaLegado = $this->obterConteudoInternoAssinatura($objDocumentoDTO->getDblIdDocumento(), true); | |
| 1095 | + if($objDocumentoDTO->getStrStaDocumento() == DocumentoRN::$TD_EDITOR_INTERNO) { | |
| 1096 | + $strConteudoAssinatura = $this->obterConteudoInternoAssinatura($objDocumentoDTO->getDblIdDocumento()); | |
| 1097 | + $hashDoComponenteDigital = base64_encode(hash(self::ALGORITMO_HASH_DOCUMENTO, $strConteudoAssinatura, true)); | |
| 1121 | 1098 | |
| 1122 | - $arrInformacaoArquivo['NOME'] = $strProtocoloDocumentoFormatado . ".html"; | |
| 1123 | - $arrInformacaoArquivo['CONTEUDO'] = $strConteudoAssinatura; | |
| 1124 | - $arrInformacaoArquivo['CONTEUDO_LEGADO'] = $strConteudoAssinaturaLegado; | |
| 1125 | - $arrInformacaoArquivo['TAMANHO'] = strlen($strConteudoAssinatura); | |
| 1126 | - $arrInformacaoArquivo['MIME_TYPE'] = 'text/html'; | |
| 1127 | - $arrInformacaoArquivo['ID_ANEXO'] = null; | |
| 1099 | + //Busca registro de tramitações anteriores para este componente digital para identificar se o Barramento do PEN já havia registrado o hash do documento gerado da | |
| 1100 | + //forma antiga, ou seja, considerando o link do Número SEI. Este link foi removido para manter o padrão de conteúdo de documentos utilizado pelo SEI para assinatura | |
| 1101 | + //Para não bloquear os documentos gerados anteriormente, aqueles já registrados pelo Barramento com o hash antigo deverão manter a geração de conteúdo anteriormente utilizada. | |
| 1102 | + $objComponenteDigital = $this->consultarComponenteDigital($objDocumentoDTO->getDblIdDocumento()); | |
| 1103 | + $hashDoComponenteDigitalAnterior = (isset($objComponenteDigital)) ? $objComponenteDigital->getStrHashConteudo() : null; | |
| 1104 | + if(isset($hashDoComponenteDigitalAnterior) && ($hashDoComponenteDigitalAnterior <> $hashDoComponenteDigital)){ | |
| 1105 | + $strConteudoAssinatura = $this->obterConteudoInternoAssinatura($objDocumentoDTO->getDblIdDocumento(), true); | |
| 1106 | + } | |
| 1128 | 1107 | |
| 1129 | - } else if($objDocumentoDTO->getStrStaProtocoloProtocolo() == ProtocoloRN::$TP_DOCUMENTO_RECEBIDO) { | |
| 1108 | + $arrInformacaoArquivo['NOME'] = $strProtocoloDocumentoFormatado . ".html"; | |
| 1109 | + $arrInformacaoArquivo['CONTEUDO'] = $strConteudoAssinatura; | |
| 1110 | + $arrInformacaoArquivo['TAMANHO'] = strlen($strConteudoAssinatura); | |
| 1111 | + $arrInformacaoArquivo['MIME_TYPE'] = 'text/html'; | |
| 1112 | + $arrInformacaoArquivo['ID_ANEXO'] = null; | |
| 1113 | + } else if($objDocumentoDTO->getStrStaProtocoloProtocolo() == ProtocoloRN::$TP_DOCUMENTO_RECEBIDO) { | |
| 1130 | 1114 | |
| 1131 | - $objAnexoDTO = $this->consultarAnexo($objDocumentoDTO->getDblIdDocumento()); | |
| 1115 | + $objAnexoDTO = $this->consultarAnexo($objDocumentoDTO->getDblIdDocumento()); | |
| 1132 | 1116 | |
| 1133 | - if(!isset($objAnexoDTO)){ | |
| 1134 | - throw new InfraException("Componente digital do documento {$strProtocoloDocumentoFormatado} não pode ser localizado."); | |
| 1135 | - } | |
| 1117 | + if(!isset($objAnexoDTO)){ | |
| 1118 | + throw new InfraException("Componente digital do documento {$strProtocoloDocumentoFormatado} não pode ser localizado."); | |
| 1119 | + } | |
| 1136 | 1120 | |
| 1137 | - //VALIDAO DE TAMANHO DE DOCUMENTOS EXTERNOS PARA A EXPEDIO | |
| 1138 | - $objPenParametroRN = new PenParametroRN(); | |
| 1139 | - if($objAnexoDTO->getNumTamanho() > ($objPenParametroRN->getParametro('PEN_TAMANHO_MAXIMO_DOCUMENTO_EXPEDIDO') * 1024 * 1024) && $objDocumentoDTO->getStrStaEstadoProtocolo() != ProtocoloRN::$TE_DOCUMENTO_CANCELADO){ | |
| 1140 | - $strTamanhoFormatado = round(($objAnexoDTO->getNumTamanho() / 1024) / 1024,2); | |
| 1141 | - throw new InfraException("O tamanho do documento {$strTamanhoFormatado} MB é maior que os {$objPenParametroRN->getParametro('PEN_TAMANHO_MAXIMO_DOCUMENTO_EXPEDIDO')} MB permitidos para trâmite externo de documentos."); | |
| 1142 | - } | |
| 1121 | + //VALIDAO DE TAMANHO DE DOCUMENTOS EXTERNOS PARA A EXPEDIO | |
| 1122 | + $objPenParametroRN = new PenParametroRN(); | |
| 1123 | + if($objAnexoDTO->getNumTamanho() > ($objPenParametroRN->getParametro('PEN_TAMANHO_MAXIMO_DOCUMENTO_EXPEDIDO') * 1024 * 1024) && $objDocumentoDTO->getStrStaEstadoProtocolo() != ProtocoloRN::$TE_DOCUMENTO_CANCELADO){ | |
| 1124 | + $strTamanhoFormatado = round(($objAnexoDTO->getNumTamanho() / 1024) / 1024,2); | |
| 1125 | + throw new InfraException("O tamanho do documento {$strTamanhoFormatado} MB é maior que os {$objPenParametroRN->getParametro('PEN_TAMANHO_MAXIMO_DOCUMENTO_EXPEDIDO')} MB permitidos para trâmite externo de documentos."); | |
| 1126 | + } | |
| 1143 | 1127 | |
| 1144 | 1128 | //Obtenção do conteúdo do documento externo |
| 1145 | 1129 | //TODO: Particionar o documento em tamanho menor caso ultrapasse XX megabytes |
| 1146 | - $strCaminhoAnexo = $this->objAnexoRN->obterLocalizacao($objAnexoDTO); | |
| 1147 | - | |
| 1148 | - $fp = fopen($strCaminhoAnexo, "rb"); | |
| 1149 | - try { | |
| 1150 | - $strConteudoAssinatura = fread($fp, filesize($strCaminhoAnexo)); | |
| 1151 | - fclose($fp); | |
| 1152 | - } catch(Exception $e) { | |
| 1153 | - fclose($fp); | |
| 1154 | - throw new InfraException("Erro obtendo conteúdo do anexo do documento {$strProtocoloDocumentoFormatado}", $e); | |
| 1155 | - } | |
| 1156 | - | |
| 1157 | - $finfo = finfo_open(FILEINFO_MIME_TYPE); | |
| 1158 | - try { | |
| 1159 | - $strMimeType = finfo_file($finfo, $strCaminhoAnexo); | |
| 1160 | - | |
| 1161 | - $strDadosComplementaresDoTipoDeArquivo = ""; | |
| 1130 | + $strCaminhoAnexo = $this->objAnexoRN->obterLocalizacao($objAnexoDTO); | |
| 1162 | 1131 | |
| 1163 | - if(!array_search($strMimeType, $this->arrPenMimeTypes)){ | |
| 1164 | - $strDadosComplementaresDoTipoDeArquivo = $strMimeType; | |
| 1165 | - $strMimeType = 'outro'; | |
| 1166 | - } | |
| 1167 | - | |
| 1168 | - finfo_close($finfo); | |
| 1169 | - } catch(Exception $e) { | |
| 1170 | - finfo_close($finfo); | |
| 1171 | - throw new InfraException("Erro obtendo informações do anexo do documento {$strProtocoloDocumentoFormatado}", $e); | |
| 1172 | - } | |
| 1173 | - | |
| 1174 | - $arrInformacaoArquivo['NOME'] = $objAnexoDTO->getStrNome(); | |
| 1175 | - $arrInformacaoArquivo['CONTEUDO'] = $strConteudoAssinatura; | |
| 1176 | - $arrInformacaoArquivo['TAMANHO'] = $objAnexoDTO->getNumTamanho(); | |
| 1177 | - $arrInformacaoArquivo['MIME_TYPE'] = $strMimeType; | |
| 1178 | - $arrInformacaoArquivo['ID_ANEXO'] = $objAnexoDTO->getNumIdAnexo(); | |
| 1179 | - $arrInformacaoArquivo['dadosComplementaresDoTipoDeArquivo'] = $strDadosComplementaresDoTipoDeArquivo; | |
| 1132 | + $fp = fopen($strCaminhoAnexo, "rb"); | |
| 1133 | + try { | |
| 1134 | + $strConteudoAssinatura = fread($fp, filesize($strCaminhoAnexo)); | |
| 1135 | + fclose($fp); | |
| 1136 | + } catch(Exception $e) { | |
| 1137 | + fclose($fp); | |
| 1138 | + throw new InfraException("Erro obtendo conteúdo do anexo do documento {$strProtocoloDocumentoFormatado}", $e); | |
| 1139 | + } | |
| 1180 | 1140 | |
| 1181 | - } | |
| 1182 | - else { | |
| 1141 | + $finfo = finfo_open(FILEINFO_MIME_TYPE); | |
| 1142 | + try { | |
| 1143 | + $strMimeType = finfo_file($finfo, $strCaminhoAnexo); | |
| 1144 | + $strDadosComplementaresDoTipoDeArquivo = ""; | |
| 1145 | + if(!array_search($strMimeType, $this->arrPenMimeTypes)){ | |
| 1146 | + $strDadosComplementaresDoTipoDeArquivo = $strMimeType; | |
| 1147 | + $strMimeType = 'outro'; | |
| 1148 | + } | |
| 1183 | 1149 | |
| 1184 | - $objDocumentoDTO2 = new DocumentoDTO(); | |
| 1185 | - $objDocumentoDTO2->setDblIdDocumento($objDocumentoDTO->getDblIdDocumento()); | |
| 1186 | - $objDocumentoDTO2->setObjInfraSessao(SessaoSEI::getInstance()); | |
| 1187 | - // $objDocumentoDTO2->setStrLinkDownload('controlador.php?acao=documento_download_anexo'); | |
| 1150 | + finfo_close($finfo); | |
| 1151 | + } catch(Exception $e) { | |
| 1152 | + finfo_close($finfo); | |
| 1153 | + throw new InfraException("Erro obtendo informações do anexo do documento {$strProtocoloDocumentoFormatado}", $e); | |
| 1154 | + } | |
| 1188 | 1155 | |
| 1189 | - $objDocumentoRN = new DocumentoRN(); | |
| 1190 | - $strResultado = $objDocumentoRN->consultarHtmlFormulario($objDocumentoDTO2); | |
| 1156 | + $arrInformacaoArquivo['NOME'] = $objAnexoDTO->getStrNome(); | |
| 1157 | + $arrInformacaoArquivo['CONTEUDO'] = $strConteudoAssinatura; | |
| 1158 | + $arrInformacaoArquivo['TAMANHO'] = $objAnexoDTO->getNumTamanho(); | |
| 1159 | + $arrInformacaoArquivo['MIME_TYPE'] = $strMimeType; | |
| 1160 | + $arrInformacaoArquivo['ID_ANEXO'] = $objAnexoDTO->getNumIdAnexo(); | |
| 1161 | + $arrInformacaoArquivo['dadosComplementaresDoTipoDeArquivo'] = $strDadosComplementaresDoTipoDeArquivo; | |
| 1191 | 1162 | |
| 1192 | - $arrInformacaoArquivo['NOME'] = $strProtocoloDocumentoFormatado . ".html"; | |
| 1193 | - $arrInformacaoArquivo['CONTEUDO'] = $strResultado; | |
| 1194 | - $arrInformacaoArquivo['TAMANHO'] = strlen($strResultado); | |
| 1195 | - $arrInformacaoArquivo['MIME_TYPE'] = 'text/html'; | |
| 1196 | - $arrInformacaoArquivo['ID_ANEXO'] = null; | |
| 1163 | + } | |
| 1164 | + else { | |
| 1165 | + $objDocumentoDTO2 = new DocumentoDTO(); | |
| 1166 | + $objDocumentoDTO2->setDblIdDocumento($objDocumentoDTO->getDblIdDocumento()); | |
| 1167 | + $objDocumentoDTO2->setObjInfraSessao(SessaoSEI::getInstance()); | |
| 1168 | + $objDocumentoRN = new DocumentoRN(); | |
| 1169 | + $strResultado = $objDocumentoRN->consultarHtmlFormulario($objDocumentoDTO2); | |
| 1170 | + | |
| 1171 | + $arrInformacaoArquivo['NOME'] = $strProtocoloDocumentoFormatado . ".html"; | |
| 1172 | + $arrInformacaoArquivo['CONTEUDO'] = $strResultado; | |
| 1173 | + $arrInformacaoArquivo['TAMANHO'] = strlen($strResultado); | |
| 1174 | + $arrInformacaoArquivo['MIME_TYPE'] = 'text/html'; | |
| 1175 | + $arrInformacaoArquivo['ID_ANEXO'] = null; | |
| 1176 | + } | |
| 1197 | 1177 | |
| 1178 | + $arrInformacaoArquivo['ALGORITMO_HASH_CONTEUDO'] = self::ALGORITMO_HASH_DOCUMENTO; | |
| 1179 | + $hashDoComponenteDigital = hash(self::ALGORITMO_HASH_DOCUMENTO, $arrInformacaoArquivo['CONTEUDO'], true); | |
| 1180 | + $arrInformacaoArquivo['HASH_CONTEUDO'] = base64_encode($hashDoComponenteDigital); | |
| 1181 | + return $arrInformacaoArquivo; | |
| 1198 | 1182 | } |
| 1199 | 1183 | |
| 1200 | - return $arrInformacaoArquivo; | |
| 1201 | - } | |
| 1202 | - | |
| 1203 | - | |
| 1204 | 1184 | /** |
| 1205 | 1185 | * Método de obtenção do conteúdo do documento interno para envio e cálculo de hash |
| 1206 | 1186 | * |
| ... | ... | @@ -1237,163 +1217,163 @@ class ExpedirProcedimentoRN extends InfraRN { |
| 1237 | 1217 | |
| 1238 | 1218 | $objEditorRN = new EditorRN(); |
| 1239 | 1219 | return $objEditorRN->consultarHtmlVersao($objEditorDTO); |
| 1240 | - } | |
| 1241 | - | |
| 1242 | - | |
| 1243 | - private function obterTipoDeConteudo($strMimeType) | |
| 1244 | - { | |
| 1245 | - if(!isset($strMimeType)){ | |
| 1246 | - throw new InfraException('Parâmetro $strMimeType não informado.'); | |
| 1247 | - } | |
| 1248 | - | |
| 1249 | - $resultado = self::TC_TIPO_CONTEUDO_OUTROS; | |
| 1250 | - | |
| 1251 | - if(preg_match(self::REGEX_ARQUIVO_TEXTO, $strMimeType)){ | |
| 1252 | - $resultado = self::TC_TIPO_CONTEUDO_TEXTO; | |
| 1253 | - } else if(preg_match(self::REGEX_ARQUIVO_IMAGEM, $strMimeType)){ | |
| 1254 | - $resultado = self::TC_TIPO_CONTEUDO_IMAGEM; | |
| 1255 | - } else if(preg_match(self::REGEX_ARQUIVO_AUDIO, $strMimeType)){ | |
| 1256 | - $resultado = self::TC_TIPO_CONTEUDO_AUDIO; | |
| 1257 | - } else if(preg_match(self::REGEX_ARQUIVO_VIDEO, $strMimeType)){ | |
| 1258 | - $resultado = self::TC_TIPO_CONTEUDO_VIDEO; | |
| 1259 | - } | |
| 1260 | - | |
| 1261 | - return $resultado; | |
| 1262 | - } | |
| 1263 | - | |
| 1264 | - private function atribuirNumeracaoDocumento($objDocumento, DocumentoDTO $parObjDocumentoDTO) | |
| 1265 | - { | |
| 1266 | - $objSerieDTO = $this->consultarSerie($parObjDocumentoDTO->getNumIdSerie()); | |
| 1267 | - $strStaNumeracao = $objSerieDTO->getStrStaNumeracao(); | |
| 1268 | - | |
| 1269 | - if($strStaNumeracao == SerieRN::$TN_SEQUENCIAL_UNIDADE) { | |
| 1270 | - $objDocumento->identificacao = new stdClass(); | |
| 1271 | - $objDocumento->identificacao->numero = $parObjDocumentoDTO->getStrNumero(); | |
| 1272 | - $objDocumento->identificacao->siglaDaUnidadeProdutora = $parObjDocumentoDTO->getStrSiglaUnidadeGeradoraProtocolo(); | |
| 1273 | - $objDocumento->identificacao->complemento = utf8_encode($parObjDocumentoDTO->getStrDescricaoUnidadeGeradoraProtocolo()); | |
| 1274 | - }else if($strStaNumeracao == SerieRN::$TN_SEQUENCIAL_ORGAO){ | |
| 1275 | - $objOrgaoDTO = $this->consultarOrgao($parObjDocumentoDTO->getNumIdOrgaoUnidadeGeradoraProtocolo()); | |
| 1276 | - $objDocumento->identificacao = new stdClass(); | |
| 1277 | - $objDocumento->identificacao->numero = $parObjDocumentoDTO->getStrNumero(); | |
| 1278 | - $objDocumento->identificacao->siglaDaUnidadeProdutora = $objOrgaoDTO->getStrSigla(); | |
| 1279 | - $objDocumento->identificacao->complemento = utf8_encode($objOrgaoDTO->getStrDescricao()); | |
| 1280 | - }else if($strStaNumeracao == SerieRN::$TN_SEQUENCIAL_ANUAL_UNIDADE){ | |
| 1281 | - $objDocumento->identificacao = new stdClass(); | |
| 1282 | - $objDocumento->identificacao->siglaDaUnidadeProdutora = $parObjDocumentoDTO->getStrSiglaUnidadeGeradoraProtocolo(); | |
| 1283 | - $objDocumento->identificacao->complemento = utf8_encode($parObjDocumentoDTO->getStrDescricaoUnidadeGeradoraProtocolo()); | |
| 1284 | - $objDocumento->identificacao->numero = $parObjDocumentoDTO->getStrNumero(); | |
| 1285 | - $objDocumento->identificacao->ano = substr($parObjDocumentoDTO->getDtaGeracaoProtocolo(),6,4); | |
| 1286 | - }else if($strStaNumeracao == SerieRN::$TN_SEQUENCIAL_ANUAL_ORGAO){ | |
| 1287 | - $objOrgaoDTO = $this->consultarOrgao($parObjDocumentoDTO->getNumIdOrgaoUnidadeGeradoraProtocolo()); | |
| 1288 | - $objDocumento->identificacao = new stdClass(); | |
| 1289 | - $objDocumento->identificacao->numero = $parObjDocumentoDTO->getStrNumero(); | |
| 1290 | - $objDocumento->identificacao->siglaDaUnidadeProdutora = $objOrgaoDTO->getStrSigla(); | |
| 1291 | - $objDocumento->identificacao->complemento = utf8_encode($objOrgaoDTO->getStrDescricao()); | |
| 1292 | - $objDocumento->identificacao->ano = substr($parObjDocumentoDTO->getDtaGeracaoProtocolo(),6,4); | |
| 1293 | - } | |
| 1294 | - } | |
| 1295 | - | |
| 1296 | - private function adicionarProcessosApensados($objProcesso, $arrIdProcessoApensado) | |
| 1297 | - { | |
| 1298 | - if(isset($arrIdProcessoApensado) && is_array($arrIdProcessoApensado) && count($arrIdProcessoApensado) > 0) { | |
| 1299 | - $objProcesso->processoApensado = array(); | |
| 1300 | - foreach($arrIdProcessoApensado as $idProcedimentoApensado) { | |
| 1301 | - $objProcesso->processoApensado[] = $this->construirProcesso($idProcedimentoApensado); | |
| 1302 | - } | |
| 1303 | - } | |
| 1304 | - } | |
| 1305 | - | |
| 1306 | - private function consultarUnidade($numIdUnidade) | |
| 1307 | - { | |
| 1308 | - if(!isset($numIdUnidade)){ | |
| 1309 | - throw new InfraException('Parâmetro $numIdUnidade não informado.'); | |
| 1310 | - } | |
| 1311 | - | |
| 1312 | - $objUnidadeDTO = new UnidadeDTO(); | |
| 1313 | - $objUnidadeDTO->setNumIdUnidade($numIdUnidade); | |
| 1314 | - $objUnidadeDTO->retStrDescricao(); | |
| 1315 | - | |
| 1316 | - return $this->objUnidadeRN->consultarRN0125($objUnidadeDTO); | |
| 1317 | - } | |
| 1318 | - | |
| 1319 | - private function consultarSerie($numIdSerie) | |
| 1320 | - { | |
| 1321 | - if(!isset($numIdSerie)){ | |
| 1322 | - throw new InfraException('Parâmetro $numIdSerie não informado.'); | |
| 1323 | - } | |
| 1324 | - | |
| 1325 | - $objSerieDTO = new SerieDTO(); | |
| 1326 | - $objSerieDTO->setNumIdSerie($numIdSerie); | |
| 1327 | - $objSerieDTO->retStrStaNumeracao(); | |
| 1328 | - | |
| 1329 | - return $this->objSerieRN->consultarRN0644($objSerieDTO); | |
| 1330 | - } | |
| 1331 | - | |
| 1332 | - private function consultarOrgao($numIdOrgao) | |
| 1333 | - { | |
| 1334 | - $objOrgaoDTO = new OrgaoDTO(); | |
| 1335 | - $objOrgaoDTO->setNumIdOrgao($numIdOrgao); | |
| 1336 | - $objOrgaoDTO->retStrSigla(); | |
| 1337 | - $objOrgaoDTO->retStrDescricao(); | |
| 1338 | - | |
| 1339 | - return $this->objOrgaoRN->consultarRN1352($objOrgaoDTO); | |
| 1340 | - } | |
| 1341 | - | |
| 1342 | - public function consultarProcedimento($numIdProcedimento) | |
| 1343 | - { | |
| 1344 | - if(!isset($numIdProcedimento)){ | |
| 1345 | - throw new InfraException('Parâmetro $numIdProcedimento não informado.'); | |
| 1346 | - } | |
| 1347 | - | |
| 1348 | - $objProcedimentoDTO = new ProcedimentoDTO(); | |
| 1349 | - $objProcedimentoDTO->setDblIdProcedimento($numIdProcedimento); | |
| 1350 | - $objProcedimentoDTO->retStrProtocoloProcedimentoFormatado(); | |
| 1351 | - $objProcedimentoDTO->retStrStaNivelAcessoGlobalProtocolo(); | |
| 1352 | - $objProcedimentoDTO->retStrStaNivelAcessoLocalProtocolo(); | |
| 1353 | - $objProcedimentoDTO->retNumIdUnidadeGeradoraProtocolo(); | |
| 1354 | - $objProcedimentoDTO->retNumIdUsuarioGeradorProtocolo(); | |
| 1355 | - $objProcedimentoDTO->retStrNomeTipoProcedimento(); | |
| 1356 | - $objProcedimentoDTO->retStrDescricaoProtocolo(); | |
| 1357 | - $objProcedimentoDTO->retDtaGeracaoProtocolo(); | |
| 1358 | - $objProcedimentoDTO->retStrStaEstadoProtocolo(); | |
| 1359 | - $objProcedimentoDTO->retDblIdProcedimento(); | |
| 1360 | - $objProcedimentoDTO->retNumIdHipoteseLegalProtocolo(); | |
| 1361 | - | |
| 1362 | - return $this->objProcedimentoRN->consultarRN0201($objProcedimentoDTO); | |
| 1363 | - } | |
| 1364 | - | |
| 1365 | - public function listarInteressados($numIdProtocolo) | |
| 1366 | - { | |
| 1367 | - if(!isset($numIdProtocolo)){ | |
| 1368 | - throw new InfraException('Parâmetro $numIdProtocolo não informado.'); | |
| 1369 | - } | |
| 1370 | - | |
| 1371 | - $objParticipanteDTO = new ParticipanteDTO(); | |
| 1372 | - $objParticipanteDTO->retNumIdContato(); | |
| 1373 | - $objParticipanteDTO->retStrNomeContato(); | |
| 1374 | - $objParticipanteDTO->setDblIdProtocolo($numIdProtocolo); | |
| 1375 | - $objParticipanteDTO->setStrStaParticipacao(ParticipanteRN::$TP_INTERESSADO); | |
| 1376 | - | |
| 1377 | - return $this->objParticipanteRN->listarRN0189($objParticipanteDTO); | |
| 1378 | - } | |
| 1379 | - | |
| 1380 | - private function consultarProtocoloDocumento($numIdProcedimento) | |
| 1381 | - { | |
| 1382 | - $objProtocoloDTO = new ProtocoloDTO(); | |
| 1383 | - | |
| 1384 | - $objProtocoloDTO->setStrStaProtocolo(array(ProtocoloRN::$TP_DOCUMENTO_GERADO,ProtocoloRN::$TP_DOCUMENTO_RECEBIDO),InfraDTO::$OPER_IN); | |
| 1385 | - $objProtocoloDTO->setStrStaProtocolo($staProtocolo); | |
| 1386 | - $objProtocoloDTO->setDblIdProtocolo($numIdProcedimento); | |
| 1387 | - $objProtocoloDTO->retTodos(); | |
| 1388 | - $objProtocoloDTO->retNumIdSerie(); | |
| 1220 | + } | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + private function obterTipoDeConteudo($strMimeType) | |
| 1224 | + { | |
| 1225 | + if(!isset($strMimeType)){ | |
| 1226 | + throw new InfraException('Parâmetro $strMimeType não informado.'); | |
| 1227 | + } | |
| 1228 | + | |
| 1229 | + $resultado = self::TC_TIPO_CONTEUDO_OUTROS; | |
| 1230 | + | |
| 1231 | + if(preg_match(self::REGEX_ARQUIVO_TEXTO, $strMimeType)){ | |
| 1232 | + $resultado = self::TC_TIPO_CONTEUDO_TEXTO; | |
| 1233 | + } else if(preg_match(self::REGEX_ARQUIVO_IMAGEM, $strMimeType)){ | |
| 1234 | + $resultado = self::TC_TIPO_CONTEUDO_IMAGEM; | |
| 1235 | + } else if(preg_match(self::REGEX_ARQUIVO_AUDIO, $strMimeType)){ | |
| 1236 | + $resultado = self::TC_TIPO_CONTEUDO_AUDIO; | |
| 1237 | + } else if(preg_match(self::REGEX_ARQUIVO_VIDEO, $strMimeType)){ | |
| 1238 | + $resultado = self::TC_TIPO_CONTEUDO_VIDEO; | |
| 1239 | + } | |
| 1240 | + | |
| 1241 | + return $resultado; | |
| 1242 | + } | |
| 1243 | + | |
| 1244 | + private function atribuirNumeracaoDocumento($objDocumento, DocumentoDTO $parObjDocumentoDTO) | |
| 1245 | + { | |
| 1246 | + $objSerieDTO = $this->consultarSerie($parObjDocumentoDTO->getNumIdSerie()); | |
| 1247 | + $strStaNumeracao = $objSerieDTO->getStrStaNumeracao(); | |
| 1248 | + | |
| 1249 | + if($strStaNumeracao == SerieRN::$TN_SEQUENCIAL_UNIDADE) { | |
| 1250 | + $objDocumento->identificacao = new stdClass(); | |
| 1251 | + $objDocumento->identificacao->numero = $parObjDocumentoDTO->getStrNumero(); | |
| 1252 | + $objDocumento->identificacao->siglaDaUnidadeProdutora = $parObjDocumentoDTO->getStrSiglaUnidadeGeradoraProtocolo(); | |
| 1253 | + $objDocumento->identificacao->complemento = utf8_encode($parObjDocumentoDTO->getStrDescricaoUnidadeGeradoraProtocolo()); | |
| 1254 | + }else if($strStaNumeracao == SerieRN::$TN_SEQUENCIAL_ORGAO){ | |
| 1255 | + $objOrgaoDTO = $this->consultarOrgao($parObjDocumentoDTO->getNumIdOrgaoUnidadeGeradoraProtocolo()); | |
| 1256 | + $objDocumento->identificacao = new stdClass(); | |
| 1257 | + $objDocumento->identificacao->numero = $parObjDocumentoDTO->getStrNumero(); | |
| 1258 | + $objDocumento->identificacao->siglaDaUnidadeProdutora = $objOrgaoDTO->getStrSigla(); | |
| 1259 | + $objDocumento->identificacao->complemento = utf8_encode($objOrgaoDTO->getStrDescricao()); | |
| 1260 | + }else if($strStaNumeracao == SerieRN::$TN_SEQUENCIAL_ANUAL_UNIDADE){ | |
| 1261 | + $objDocumento->identificacao = new stdClass(); | |
| 1262 | + $objDocumento->identificacao->siglaDaUnidadeProdutora = $parObjDocumentoDTO->getStrSiglaUnidadeGeradoraProtocolo(); | |
| 1263 | + $objDocumento->identificacao->complemento = utf8_encode($parObjDocumentoDTO->getStrDescricaoUnidadeGeradoraProtocolo()); | |
| 1264 | + $objDocumento->identificacao->numero = $parObjDocumentoDTO->getStrNumero(); | |
| 1265 | + $objDocumento->identificacao->ano = substr($parObjDocumentoDTO->getDtaGeracaoProtocolo(),6,4); | |
| 1266 | + }else if($strStaNumeracao == SerieRN::$TN_SEQUENCIAL_ANUAL_ORGAO){ | |
| 1267 | + $objOrgaoDTO = $this->consultarOrgao($parObjDocumentoDTO->getNumIdOrgaoUnidadeGeradoraProtocolo()); | |
| 1268 | + $objDocumento->identificacao = new stdClass(); | |
| 1269 | + $objDocumento->identificacao->numero = $parObjDocumentoDTO->getStrNumero(); | |
| 1270 | + $objDocumento->identificacao->siglaDaUnidadeProdutora = $objOrgaoDTO->getStrSigla(); | |
| 1271 | + $objDocumento->identificacao->complemento = utf8_encode($objOrgaoDTO->getStrDescricao()); | |
| 1272 | + $objDocumento->identificacao->ano = substr($parObjDocumentoDTO->getDtaGeracaoProtocolo(),6,4); | |
| 1273 | + } | |
| 1274 | + } | |
| 1275 | + | |
| 1276 | + private function adicionarProcessosApensados($objProcesso, $arrIdProcessoApensado) | |
| 1277 | + { | |
| 1278 | + if(isset($arrIdProcessoApensado) && is_array($arrIdProcessoApensado) && count($arrIdProcessoApensado) > 0) { | |
| 1279 | + $objProcesso->processoApensado = array(); | |
| 1280 | + foreach($arrIdProcessoApensado as $idProcedimentoApensado) { | |
| 1281 | + $objProcesso->processoApensado[] = $this->construirProcesso($idProcedimentoApensado); | |
| 1282 | + } | |
| 1283 | + } | |
| 1284 | + } | |
| 1285 | + | |
| 1286 | + private function consultarUnidade($numIdUnidade) | |
| 1287 | + { | |
| 1288 | + if(!isset($numIdUnidade)){ | |
| 1289 | + throw new InfraException('Parâmetro $numIdUnidade não informado.'); | |
| 1290 | + } | |
| 1291 | + | |
| 1292 | + $objUnidadeDTO = new UnidadeDTO(); | |
| 1293 | + $objUnidadeDTO->setNumIdUnidade($numIdUnidade); | |
| 1294 | + $objUnidadeDTO->retStrDescricao(); | |
| 1295 | + | |
| 1296 | + return $this->objUnidadeRN->consultarRN0125($objUnidadeDTO); | |
| 1297 | + } | |
| 1298 | + | |
| 1299 | + private function consultarSerie($numIdSerie) | |
| 1300 | + { | |
| 1301 | + if(!isset($numIdSerie)){ | |
| 1302 | + throw new InfraException('Parâmetro $numIdSerie não informado.'); | |
| 1303 | + } | |
| 1304 | + | |
| 1305 | + $objSerieDTO = new SerieDTO(); | |
| 1306 | + $objSerieDTO->setNumIdSerie($numIdSerie); | |
| 1307 | + $objSerieDTO->retStrStaNumeracao(); | |
| 1308 | + | |
| 1309 | + return $this->objSerieRN->consultarRN0644($objSerieDTO); | |
| 1310 | + } | |
| 1311 | + | |
| 1312 | + private function consultarOrgao($numIdOrgao) | |
| 1313 | + { | |
| 1314 | + $objOrgaoDTO = new OrgaoDTO(); | |
| 1315 | + $objOrgaoDTO->setNumIdOrgao($numIdOrgao); | |
| 1316 | + $objOrgaoDTO->retStrSigla(); | |
| 1317 | + $objOrgaoDTO->retStrDescricao(); | |
| 1318 | + | |
| 1319 | + return $this->objOrgaoRN->consultarRN1352($objOrgaoDTO); | |
| 1320 | + } | |
| 1321 | + | |
| 1322 | + public function consultarProcedimento($numIdProcedimento) | |
| 1323 | + { | |
| 1324 | + if(!isset($numIdProcedimento)){ | |
| 1325 | + throw new InfraException('Parâmetro $numIdProcedimento não informado.'); | |
| 1326 | + } | |
| 1327 | + | |
| 1328 | + $objProcedimentoDTO = new ProcedimentoDTO(); | |
| 1329 | + $objProcedimentoDTO->setDblIdProcedimento($numIdProcedimento); | |
| 1330 | + $objProcedimentoDTO->retStrProtocoloProcedimentoFormatado(); | |
| 1331 | + $objProcedimentoDTO->retStrStaNivelAcessoGlobalProtocolo(); | |
| 1332 | + $objProcedimentoDTO->retStrStaNivelAcessoLocalProtocolo(); | |
| 1333 | + $objProcedimentoDTO->retNumIdUnidadeGeradoraProtocolo(); | |
| 1334 | + $objProcedimentoDTO->retNumIdUsuarioGeradorProtocolo(); | |
| 1335 | + $objProcedimentoDTO->retStrNomeTipoProcedimento(); | |
| 1336 | + $objProcedimentoDTO->retStrDescricaoProtocolo(); | |
| 1337 | + $objProcedimentoDTO->retDtaGeracaoProtocolo(); | |
| 1338 | + $objProcedimentoDTO->retStrStaEstadoProtocolo(); | |
| 1339 | + $objProcedimentoDTO->retDblIdProcedimento(); | |
| 1340 | + $objProcedimentoDTO->retNumIdHipoteseLegalProtocolo(); | |
| 1341 | + | |
| 1342 | + return $this->objProcedimentoRN->consultarRN0201($objProcedimentoDTO); | |
| 1343 | + } | |
| 1344 | + | |
| 1345 | + public function listarInteressados($numIdProtocolo) | |
| 1346 | + { | |
| 1347 | + if(!isset($numIdProtocolo)){ | |
| 1348 | + throw new InfraException('Parâmetro $numIdProtocolo não informado.'); | |
| 1349 | + } | |
| 1350 | + | |
| 1351 | + $objParticipanteDTO = new ParticipanteDTO(); | |
| 1352 | + $objParticipanteDTO->retNumIdContato(); | |
| 1353 | + $objParticipanteDTO->retStrNomeContato(); | |
| 1354 | + $objParticipanteDTO->setDblIdProtocolo($numIdProtocolo); | |
| 1355 | + $objParticipanteDTO->setStrStaParticipacao(ParticipanteRN::$TP_INTERESSADO); | |
| 1356 | + | |
| 1357 | + return $this->objParticipanteRN->listarRN0189($objParticipanteDTO); | |
| 1358 | + } | |
| 1359 | + | |
| 1360 | + private function consultarProtocoloDocumento($numIdProcedimento) | |
| 1361 | + { | |
| 1362 | + $objProtocoloDTO = new ProtocoloDTO(); | |
| 1363 | + | |
| 1364 | + $objProtocoloDTO->setStrStaProtocolo(array(ProtocoloRN::$TP_DOCUMENTO_GERADO,ProtocoloRN::$TP_DOCUMENTO_RECEBIDO),InfraDTO::$OPER_IN); | |
| 1365 | + $objProtocoloDTO->setStrStaProtocolo($staProtocolo); | |
| 1366 | + $objProtocoloDTO->setDblIdProtocolo($numIdProcedimento); | |
| 1367 | + $objProtocoloDTO->retTodos(); | |
| 1368 | + $objProtocoloDTO->retNumIdSerie(); | |
| 1389 | 1369 | |
| 1390 | 1370 | return $this->objProtocoloRN->consultarRN0186($objProtocoloDTO); //TODO: Verificar regra de busca |
| 1391 | - } | |
| 1371 | + } | |
| 1392 | 1372 | |
| 1393 | - private function consultarAnexo($dblIdDocumento) | |
| 1394 | - { | |
| 1373 | + private function consultarAnexo($dblIdDocumento) | |
| 1374 | + { | |
| 1395 | 1375 | if(!isset($dblIdDocumento)){ |
| 1396 | - throw new InfraException('Parâmetro $dblIdDocumento não informado.'); | |
| 1376 | + throw new InfraException('Parâmetro $dblIdDocumento não informado.'); | |
| 1397 | 1377 | } |
| 1398 | 1378 | |
| 1399 | 1379 | $objAnexoDTO = new AnexoDTO(); |
| ... | ... | @@ -1406,12 +1386,12 @@ class ExpedirProcedimentoRN extends InfraRN { |
| 1406 | 1386 | $objAnexoDTO->setDblIdProtocolo($dblIdDocumento); |
| 1407 | 1387 | |
| 1408 | 1388 | return $this->objAnexoRN->consultarRN0736($objAnexoDTO); |
| 1409 | - } | |
| 1389 | + } | |
| 1410 | 1390 | |
| 1411 | - private function consultarUsuario($numIdUsuario) | |
| 1412 | - { | |
| 1391 | + private function consultarUsuario($numIdUsuario) | |
| 1392 | + { | |
| 1413 | 1393 | if(!isset($numIdUsuario)){ |
| 1414 | - throw new InfraException('Parâmetro $numIdUsuario não informado.'); | |
| 1394 | + throw new InfraException('Parâmetro $numIdUsuario não informado.'); | |
| 1415 | 1395 | } |
| 1416 | 1396 | |
| 1417 | 1397 | $objUsuarioDTO = new UsuarioDTO(); |
| ... | ... | @@ -1421,12 +1401,12 @@ class ExpedirProcedimentoRN extends InfraRN { |
| 1421 | 1401 | $objUsuarioDTO->retDblCpfContato(); |
| 1422 | 1402 | |
| 1423 | 1403 | return $this->objUsuarioRN->consultarRN0489($objUsuarioDTO); |
| 1424 | - } | |
| 1404 | + } | |
| 1425 | 1405 | |
| 1426 | - public function listarDocumentos($idProcedimento) | |
| 1427 | - { | |
| 1406 | + public function listarDocumentos($idProcedimento) | |
| 1407 | + { | |
| 1428 | 1408 | if(!isset($idProcedimento)){ |
| 1429 | - throw new InfraException('Parâmetro $idProcedimento não informado.'); | |
| 1409 | + throw new InfraException('Parâmetro $idProcedimento não informado.'); | |
| 1430 | 1410 | } |
| 1431 | 1411 | |
| 1432 | 1412 | $documentoDTO = new DocumentoDTO(); |
| ... | ... | @@ -1454,7 +1434,7 @@ class ExpedirProcedimentoRN extends InfraRN { |
| 1454 | 1434 | $documentoDTO->setOrdStrProtocoloDocumentoFormatado(InfraDTO::$TIPO_ORDENACAO_ASC); |
| 1455 | 1435 | |
| 1456 | 1436 | return $this->objDocumentoRN->listarRN0008($documentoDTO); |
| 1457 | - } | |
| 1437 | + } | |
| 1458 | 1438 | |
| 1459 | 1439 | /** |
| 1460 | 1440 | * Retorna o nome do documento no PEN |
| ... | ... | @@ -1483,10 +1463,10 @@ class ExpedirProcedimentoRN extends InfraRN { |
| 1483 | 1463 | return $strNome; |
| 1484 | 1464 | } |
| 1485 | 1465 | |
| 1486 | - private function consultarDocumento($dblIdDocumento) | |
| 1487 | - { | |
| 1466 | + private function consultarDocumento($dblIdDocumento) | |
| 1467 | + { | |
| 1488 | 1468 | if(!isset($dblIdDocumento)){ |
| 1489 | - throw new InfraException('Parâmetro $dblIdDocumento não informado.'); | |
| 1469 | + throw new InfraException('Parâmetro $dblIdDocumento não informado.'); | |
| 1490 | 1470 | } |
| 1491 | 1471 | |
| 1492 | 1472 | $documentoDTO = new DocumentoDTO(); |
| ... | ... | @@ -1512,9 +1492,9 @@ class ExpedirProcedimentoRN extends InfraRN { |
| 1512 | 1492 | //$documentoDTO->retStrNumero(); |
| 1513 | 1493 | |
| 1514 | 1494 | return $this->objDocumentoRN->consultarRN0005($documentoDTO); |
| 1515 | - } | |
| 1495 | + } | |
| 1516 | 1496 | |
| 1517 | - private function enviarComponentesDigitais($strNumeroRegistro, $numIdTramite, $strProtocolo) { | |
| 1497 | + private function enviarComponentesDigitais($strNumeroRegistro, $numIdTramite, $strProtocolo) { | |
| 1518 | 1498 | if (!isset($strNumeroRegistro)) { |
| 1519 | 1499 | throw new InfraException('Parâmetro $strNumeroRegistro não informado.'); |
| 1520 | 1500 | } |
| ... | ... | @@ -1549,103 +1529,103 @@ class ExpedirProcedimentoRN extends InfraRN { |
| 1549 | 1529 | |
| 1550 | 1530 | //TODO: Valida inconsistncia da quantidade de documentos solicitados e aqueles cadastrados no SEI |
| 1551 | 1531 | |
| 1552 | - | |
| 1553 | 1532 | //Construir objeto Componentes digitais |
| 1554 | 1533 | foreach ($arrComponentesDigitaisDTO as $objComponenteDigitalDTO) { |
| 1555 | 1534 | |
| 1556 | - $this->barraProgresso->mover(ProcessoEletronicoINT::NEE_EXPEDICAO_ETAPA_DOCUMENTO); | |
| 1557 | - $this->barraProgresso->setStrRotulo(sprintf(ProcessoEletronicoINT::TEE_EXPEDICAO_ETAPA_DOCUMENTO, $objComponenteDigitalDTO->getStrProtocoloDocumentoFormatado())); | |
| 1535 | + $this->barraProgresso->mover(ProcessoEletronicoINT::NEE_EXPEDICAO_ETAPA_DOCUMENTO); | |
| 1536 | + $this->barraProgresso->setStrRotulo(sprintf(ProcessoEletronicoINT::TEE_EXPEDICAO_ETAPA_DOCUMENTO, $objComponenteDigitalDTO->getStrProtocoloDocumentoFormatado())); | |
| 1558 | 1537 | |
| 1559 | - $dadosDoComponenteDigital = new stdClass(); | |
| 1560 | - $dadosDoComponenteDigital->ticketParaEnvioDeComponentesDigitais = $objComponenteDigitalDTO->getNumTicketEnvioComponentes(); | |
| 1538 | + $dadosDoComponenteDigital = new stdClass(); | |
| 1539 | + $dadosDoComponenteDigital->ticketParaEnvioDeComponentesDigitais = $objComponenteDigitalDTO->getNumTicketEnvioComponentes(); | |
| 1561 | 1540 | |
| 1562 | 1541 | //TODO: Problema no barramento de servios quando um mesmo arquivo est contido em dois diferentes |
| 1563 | 1542 | //processos apensados. Mesmo erro relatado com dois arquivos iguais em docs diferentes no mesmo processo |
| 1564 | - $dadosDoComponenteDigital->protocolo = $objComponenteDigitalDTO->getStrProtocolo(); | |
| 1565 | - $dadosDoComponenteDigital->hashDoComponenteDigital = $objComponenteDigitalDTO->getStrHashConteudo(); | |
| 1543 | + $dadosDoComponenteDigital->protocolo = $objComponenteDigitalDTO->getStrProtocolo(); | |
| 1544 | + $dadosDoComponenteDigital->hashDoComponenteDigital = $objComponenteDigitalDTO->getStrHashConteudo(); | |
| 1566 | 1545 | |
| 1567 | 1546 | //TODO: Particionar o arquivo em vrias partes caso for muito grande seu tamanho |
| 1568 | 1547 | //TODO: Obter dados do conteudo do documento, sendo Interno ou Externo |
| 1569 | 1548 | //$strConteudoDocumento = $this->consultarConteudoDocumento($objComponenteDigitalDTO->getDblIdDocumento()); |
| 1570 | 1549 | //$strConteudoAssinatura = $objComponenteDigitalDTO->getStrConteudoAssinaturaDocumento(); |
| 1571 | - $objDocumentoDTO = $this->consultarDocumento($objComponenteDigitalDTO->getDblIdDocumento()); | |
| 1572 | - $strNomeDocumento = $this->consultarNomeDocumentoPEN($objDocumentoDTO); | |
| 1573 | - $arrInformacaoArquivo = $this->obterDadosArquivo($objDocumentoDTO); | |
| 1574 | - $dadosDoComponenteDigital->conteudoDoComponenteDigital = new SoapVar($arrInformacaoArquivo['CONTEUDO'], XSD_BASE64BINARY); | |
| 1550 | + $objDocumentoDTO = $this->consultarDocumento($objComponenteDigitalDTO->getDblIdDocumento()); | |
| 1551 | + $strNomeDocumento = $this->consultarNomeDocumentoPEN($objDocumentoDTO); | |
| 1552 | + $arrInformacaoArquivo = $this->obterDadosArquivo($objDocumentoDTO); | |
| 1553 | + | |
| 1554 | + $dadosDoComponenteDigital->conteudoDoComponenteDigital = new SoapVar($arrInformacaoArquivo['CONTEUDO'], XSD_BASE64BINARY); | |
| 1575 | 1555 | |
| 1576 | - try { | |
| 1556 | + try { | |
| 1577 | 1557 | //Enviar componentes digitais |
| 1578 | - $parametros = new stdClass(); | |
| 1579 | - $parametros->dadosDoComponenteDigital = $dadosDoComponenteDigital; | |
| 1580 | - $result = $this->objProcessoEletronicoRN->enviarComponenteDigital($parametros); | |
| 1558 | + $parametros = new stdClass(); | |
| 1559 | + $parametros->dadosDoComponenteDigital = $dadosDoComponenteDigital; | |
| 1560 | + $result = $this->objProcessoEletronicoRN->enviarComponenteDigital($parametros); | |
| 1581 | 1561 | |
| 1582 | 1562 | //Bloquea documento para atualizao, j que ele foi visualizado |
| 1583 | - $this->objDocumentoRN->bloquearConteudo($objDocumentoDTO); | |
| 1563 | + $this->objDocumentoRN->bloquearConteudo($objDocumentoDTO); | |
| 1584 | 1564 | // @join_tec US008.05 (#23092) |
| 1585 | - $this->objProcedimentoAndamentoRN->cadastrar(ProcedimentoAndamentoDTO::criarAndamento(sprintf('Enviando %s %s', $strNomeDocumento, $objComponenteDigitalDTO->getStrProtocoloDocumentoFormatado()), 'S')); | |
| 1586 | - } catch (Exception $e) { | |
| 1565 | + $this->objProcedimentoAndamentoRN->cadastrar(ProcedimentoAndamentoDTO::criarAndamento(sprintf('Enviando %s %s', $strNomeDocumento, $objComponenteDigitalDTO->getStrProtocoloDocumentoFormatado()), 'S')); | |
| 1566 | + } catch (Exception $e) { | |
| 1587 | 1567 | // @join_tec US008.05 (#23092) |
| 1588 | - $this->objProcedimentoAndamentoRN->cadastrar(ProcedimentoAndamentoDTO::criarAndamento(sprintf('Enviando %s %s', $strNomeDocumento, $objComponenteDigitalDTO->getStrProtocoloDocumentoFormatado()), 'N')); | |
| 1589 | - throw new InfraException("Error Processing Request", $e); | |
| 1590 | - } | |
| 1568 | + $this->objProcedimentoAndamentoRN->cadastrar(ProcedimentoAndamentoDTO::criarAndamento(sprintf('Enviando %s %s', $strNomeDocumento, $objComponenteDigitalDTO->getStrProtocoloDocumentoFormatado()), 'N')); | |
| 1569 | + throw new InfraException("Error Processing Request", $e); | |
| 1570 | + } | |
| 1591 | 1571 | } |
| 1592 | 1572 | |
| 1593 | 1573 | } |
| 1594 | 1574 | } |
| 1595 | 1575 | |
| 1596 | 1576 | private function validarParametrosExpedicao(InfraException $objInfraException, ExpedirProcedimentoDTO $objExpedirProcedimentoDTO) |
| 1597 | - { | |
| 1577 | + { | |
| 1598 | 1578 | if(!isset($objExpedirProcedimentoDTO)){ |
| 1599 | - $objInfraException->adicionarValidacao('Parâmetro $objExpedirProcedimentoDTO não informado.'); | |
| 1579 | + $objInfraException->adicionarValidacao('Parâmetro $objExpedirProcedimentoDTO não informado.'); | |
| 1600 | 1580 | } |
| 1601 | 1581 | |
| 1602 | 1582 | //TODO: Validar se repositrio de origem foi informado |
| 1603 | 1583 | if (InfraString::isBolVazia($objExpedirProcedimentoDTO->getNumIdRepositorioOrigem())){ |
| 1604 | - $objInfraException->adicionarValidacao('Identificação do repositório de estruturas da unidade atual não informado.'); | |
| 1584 | + $objInfraException->adicionarValidacao('Identificação do repositório de estruturas da unidade atual não informado.'); | |
| 1605 | 1585 | } |
| 1606 | 1586 | |
| 1607 | 1587 | //TODO: Validar se unidade de origem foi informado |
| 1608 | 1588 | if (InfraString::isBolVazia($objExpedirProcedimentoDTO->getNumIdUnidadeOrigem())){ |
| 1609 | - $objInfraException->adicionarValidacao('Identificação da unidade atual no repositório de estruturas organizacionais não informado.'); | |
| 1589 | + $objInfraException->adicionarValidacao('Identificação da unidade atual no repositório de estruturas organizacionais não informado.'); | |
| 1610 | 1590 | } |
| 1611 | 1591 | |
| 1612 | 1592 | //TODO: Validar se repositrio foi devidamente informado |
| 1613 | 1593 | if (InfraString::isBolVazia($objExpedirProcedimentoDTO->getNumIdRepositorioDestino())){ |
| 1614 | - $objInfraException->adicionarValidacao('Repositório de estruturas organizacionais não informado.'); | |
| 1594 | + $objInfraException->adicionarValidacao('Repositório de estruturas organizacionais não informado.'); | |
| 1615 | 1595 | } |
| 1616 | 1596 | |
| 1617 | 1597 | //TODO: Validar se unidade foi devidamente informada |
| 1618 | 1598 | if (InfraString::isBolVazia($objExpedirProcedimentoDTO->getNumIdUnidadeDestino())){ |
| 1619 | - $objInfraException->adicionarValidacao('Unidade de destino não informado.'); | |
| 1599 | + $objInfraException->adicionarValidacao('Unidade de destino não informado.'); | |
| 1620 | 1600 | } |
| 1621 | 1601 | |
| 1622 | 1602 | //TODO: Validar se motivo de urgncia foi devidamente informado, caso expedio urgente |
| 1623 | 1603 | if ($objExpedirProcedimentoDTO->getBolSinUrgente() && InfraString::isBolVazia($objExpedirProcedimentoDTO->getNumIdMotivoUrgencia())){ |
| 1624 | - $objInfraException->adicionarValidacao('Motivo de urgência não informado.'); | |
| 1604 | + $objInfraException->adicionarValidacao('Motivo de urgência não informado.'); | |
| 1625 | 1605 | } |
| 1626 | - } | |
| 1606 | + } | |
| 1627 | 1607 | |
| 1628 | - private function validarDocumentacaoExistende(InfraException $objInfraException, ProcedimentoDTO $objProcedimentoDTO, $strAtributoValidacao = null) | |
| 1629 | - { | |
| 1608 | + private function validarDocumentacaoExistende(InfraException $objInfraException, ProcedimentoDTO $objProcedimentoDTO, $strAtributoValidacao = null) | |
| 1609 | + { | |
| 1630 | 1610 | $arrObjDocumentoDTO = $objProcedimentoDTO->getArrObjDocumentoDTO(); |
| 1631 | 1611 | if(!isset($arrObjDocumentoDTO) || count($arrObjDocumentoDTO) == 0) { |
| 1632 | - $objInfraException->adicionarValidacao('Não é possível trâmitar um processo sem documentos', $strAtributoValidacao); | |
| 1612 | + $objInfraException->adicionarValidacao('Não é possível trâmitar um processo sem documentos', $strAtributoValidacao); | |
| 1633 | 1613 | } |
| 1634 | - } | |
| 1614 | + } | |
| 1635 | 1615 | |
| 1636 | - private function validarDadosProcedimento(InfraException $objInfraException, ProcedimentoDTO $objProcedimentoDTO, $strAtributoValidacao = null) | |
| 1637 | - { | |
| 1616 | + private function validarDadosProcedimento(InfraException $objInfraException, ProcedimentoDTO $objProcedimentoDTO, $strAtributoValidacao = null) | |
| 1617 | + { | |
| 1638 | 1618 | if($objProcedimentoDTO->isSetStrDescricaoProtocolo() && InfraString::isBolVazia($objProcedimentoDTO->getStrDescricaoProtocolo())) { |
| 1639 | - $objInfraException->adicionarValidacao("Descrição do processo {$objProcedimentoDTO->getStrProtocoloProcedimentoFormatado()} não informado.", $strAtributoValidacao); | |
| 1619 | + $objInfraException->adicionarValidacao("Descrição do processo {$objProcedimentoDTO->getStrProtocoloProcedimentoFormatado()} não informado.", $strAtributoValidacao); | |
| 1640 | 1620 | } |
| 1641 | 1621 | |
| 1642 | 1622 | if(!$objProcedimentoDTO->isSetArrObjParticipanteDTO() || count($objProcedimentoDTO->getArrObjParticipanteDTO()) == 0) { |
| 1643 | - $objInfraException->adicionarValidacao("Interessados do processo {$objProcedimentoDTO->getStrProtocoloProcedimentoFormatado()} não informados.", $strAtributoValidacao); | |
| 1623 | + $objInfraException->adicionarValidacao("Interessados do processo {$objProcedimentoDTO->getStrProtocoloProcedimentoFormatado()} não informados.", $strAtributoValidacao); | |
| 1644 | 1624 | } |
| 1645 | - } | |
| 1646 | - | |
| 1647 | - private function validarDadosDocumentos(InfraException $objInfraException, $arrDocumentoDTO, $strAtributoValidacao = null) { | |
| 1625 | + } | |
| 1648 | 1626 | |
| 1627 | + private function validarDadosDocumentos(InfraException $objInfraException, $arrDocumentoDTO, $strAtributoValidacao = null) | |
| 1628 | + { | |
| 1649 | 1629 | if(!empty($arrDocumentoDTO)) { |
| 1650 | 1630 | |
| 1651 | 1631 | $objDocMapDTO = new PenRelTipoDocMapEnviadoDTO(); |
| ... | ... | @@ -1667,8 +1647,7 @@ class ExpedirProcedimentoRN extends InfraRN { |
| 1667 | 1647 | $objInfraException->adicionarValidacao($strDescricao, $strAtributoValidacao); |
| 1668 | 1648 | } |
| 1669 | 1649 | |
| 1670 | - if (!empty($objDocumentoDTO->getNumIdHipoteseLegalProtocolo()) | |
| 1671 | - && empty($objPenRelHipoteseLegalEnvioRN->getIdHipoteseLegalPEN($objDocumentoDTO->getNumIdHipoteseLegalProtocolo()))) { | |
| 1650 | + if (!empty($objDocumentoDTO->getNumIdHipoteseLegalProtocolo()) && empty($objPenRelHipoteseLegalEnvioRN->getIdHipoteseLegalPEN($objDocumentoDTO->getNumIdHipoteseLegalProtocolo()))) { | |
| 1672 | 1651 | |
| 1673 | 1652 | $objHipoteseLegalDTO = new HipoteseLegalDTO(); |
| 1674 | 1653 | $objHipoteseLegalDTO->setNumIdHipoteseLegal($objDocumentoDTO->getNumIdHipoteseLegalProtocolo()); |
| ... | ... | @@ -1684,19 +1663,19 @@ class ExpedirProcedimentoRN extends InfraRN { |
| 1684 | 1663 | |
| 1685 | 1664 | private function validarProcessoAbertoUnidade(InfraException $objInfraException, ProcedimentoDTO $objProcedimentoDTO, $strAtributoValidacao = null) |
| 1686 | 1665 | { |
| 1687 | - $objAtividadeDTO = new AtividadeDTO(); | |
| 1688 | - $objAtividadeDTO->setDistinct(true); | |
| 1689 | - $objAtividadeDTO->retStrSiglaUnidade(); | |
| 1690 | - $objAtividadeDTO->setOrdStrSiglaUnidade(InfraDTO::$TIPO_ORDENACAO_ASC); | |
| 1691 | - $objAtividadeDTO->setDblIdProtocolo($objProcedimentoDTO->getDblIdProcedimento()); | |
| 1692 | - $objAtividadeDTO->setDthConclusao(null); | |
| 1666 | + $objAtividadeDTO = new AtividadeDTO(); | |
| 1667 | + $objAtividadeDTO->setDistinct(true); | |
| 1668 | + $objAtividadeDTO->retStrSiglaUnidade(); | |
| 1669 | + $objAtividadeDTO->setOrdStrSiglaUnidade(InfraDTO::$TIPO_ORDENACAO_ASC); | |
| 1670 | + $objAtividadeDTO->setDblIdProtocolo($objProcedimentoDTO->getDblIdProcedimento()); | |
| 1671 | + $objAtividadeDTO->setDthConclusao(null); | |
| 1693 | 1672 | |
| 1694 | - $arrObjAtividadeDTO = $this->objAtividadeRN->listarRN0036($objAtividadeDTO); | |
| 1673 | + $arrObjAtividadeDTO = $this->objAtividadeRN->listarRN0036($objAtividadeDTO); | |
| 1695 | 1674 | |
| 1696 | - if(isset($arrObjAtividadeDTO) && count($arrObjAtividadeDTO) > 1) { | |
| 1697 | - $strSiglaUnidade = implode(', ', InfraArray::converterArrInfraDTO($arrObjAtividadeDTO, 'SiglaUnidade')); | |
| 1698 | - $objInfraException->adicionarValidacao("Não é possível trâmitar um processo aberto em mais de uma unidade. ($strSiglaUnidade)", $strAtributoValidacao); | |
| 1699 | - } | |
| 1675 | + if(isset($arrObjAtividadeDTO) && count($arrObjAtividadeDTO) > 1) { | |
| 1676 | + $strSiglaUnidade = implode(', ', InfraArray::converterArrInfraDTO($arrObjAtividadeDTO, 'SiglaUnidade')); | |
| 1677 | + $objInfraException->adicionarValidacao("Não é possível trâmitar um processo aberto em mais de uma unidade. ($strSiglaUnidade)", $strAtributoValidacao); | |
| 1678 | + } | |
| 1700 | 1679 | } |
| 1701 | 1680 | |
| 1702 | 1681 | private function validarNivelAcessoProcesso(InfraException $objInfraException, ProcedimentoDTO $objProcedimentoDTO, $strAtributoValidacao = null) |
| ... | ... | @@ -1708,9 +1687,9 @@ class ExpedirProcedimentoRN extends InfraRN { |
| 1708 | 1687 | |
| 1709 | 1688 | // $objProcedimentoDTO = $this->objProcedimentoRN->consultarRN0201($objProcedimentoDTO); |
| 1710 | 1689 | |
| 1711 | - if ($objProcedimentoDTO->getStrStaNivelAcessoLocalProtocolo() == ProtocoloRN::$NA_SIGILOSO) { | |
| 1712 | - $objInfraException->adicionarValidacao('Não é possível trâmitar um processo com informações sigilosas.', $strAtributoValidacao); | |
| 1713 | - } | |
| 1690 | + if ($objProcedimentoDTO->getStrStaNivelAcessoLocalProtocolo() == ProtocoloRN::$NA_SIGILOSO) { | |
| 1691 | + $objInfraException->adicionarValidacao('Não é possível trâmitar um processo com informações sigilosas.', $strAtributoValidacao); | |
| 1692 | + } | |
| 1714 | 1693 | } |
| 1715 | 1694 | |
| 1716 | 1695 | /** |
| ... | ... | @@ -1776,90 +1755,92 @@ class ExpedirProcedimentoRN extends InfraRN { |
| 1776 | 1755 | public function validarPreCondicoesExpedirProcedimento(InfraException $objInfraException, ProcedimentoDTO $objProcedimentoDTO, $strAtributoValidacao = null) |
| 1777 | 1756 | { |
| 1778 | 1757 | //TODO: Validar pr-condies dos processos e documentos apensados |
| 1779 | - $this->validarDadosProcedimento($objInfraException, $objProcedimentoDTO, $strAtributoValidacao); | |
| 1780 | - $this->validarDadosDocumentos($objInfraException, $objProcedimentoDTO->getArrObjDocumentoDTO(), $strAtributoValidacao); | |
| 1758 | + $this->validarDadosProcedimento($objInfraException, $objProcedimentoDTO, $strAtributoValidacao); | |
| 1759 | + $this->validarDadosDocumentos($objInfraException, $objProcedimentoDTO->getArrObjDocumentoDTO(), $strAtributoValidacao); | |
| 1781 | 1760 | |
| 1782 | - $this->validarDocumentacaoExistende($objInfraException, $objProcedimentoDTO, $strAtributoValidacao); | |
| 1783 | - $this->validarProcessoAbertoUnidade($objInfraException, $objProcedimentoDTO, $strAtributoValidacao); | |
| 1784 | - $this->validarNivelAcessoProcesso($objInfraException, $objProcedimentoDTO, $strAtributoValidacao); | |
| 1785 | - $this->validarHipoteseLegalEnvio($objInfraException, $objProcedimentoDTO, $strAtributoValidacao); | |
| 1786 | - $this->validarAssinaturas($objInfraException, $objProcedimentoDTO, $strAtributoValidacao); | |
| 1761 | + $this->validarDocumentacaoExistende($objInfraException, $objProcedimentoDTO, $strAtributoValidacao); | |
| 1762 | + $this->validarProcessoAbertoUnidade($objInfraException, $objProcedimentoDTO, $strAtributoValidacao); | |
| 1763 | + $this->validarNivelAcessoProcesso($objInfraException, $objProcedimentoDTO, $strAtributoValidacao); | |
| 1764 | + $this->validarHipoteseLegalEnvio($objInfraException, $objProcedimentoDTO, $strAtributoValidacao); | |
| 1765 | + $this->validarAssinaturas($objInfraException, $objProcedimentoDTO, $strAtributoValidacao); | |
| 1787 | 1766 | } |
| 1788 | 1767 | |
| 1789 | 1768 | |
| 1790 | - private function obterNivelSigiloPEN($strNivelSigilo) { | |
| 1791 | - switch ($strNivelSigilo) { | |
| 1792 | - case ProtocoloRN::$NA_PUBLICO: return self::STA_SIGILO_PUBLICO; | |
| 1793 | - break; | |
| 1794 | - case ProtocoloRN::$NA_RESTRITO: return self::STA_SIGILO_RESTRITO; | |
| 1795 | - break; | |
| 1796 | - case ProtocoloRN::$NA_SIGILOSO: return self::STA_SIGILO_SIGILOSO; | |
| 1797 | - break; | |
| 1798 | - default: | |
| 1799 | - break; | |
| 1800 | - } | |
| 1769 | + private function obterNivelSigiloPEN($strNivelSigilo) | |
| 1770 | + { | |
| 1771 | + switch ($strNivelSigilo) { | |
| 1772 | + case ProtocoloRN::$NA_PUBLICO: return self::STA_SIGILO_PUBLICO; | |
| 1773 | + break; | |
| 1774 | + case ProtocoloRN::$NA_RESTRITO: return self::STA_SIGILO_RESTRITO; | |
| 1775 | + break; | |
| 1776 | + case ProtocoloRN::$NA_SIGILOSO: return self::STA_SIGILO_SIGILOSO; | |
| 1777 | + break; | |
| 1778 | + default: | |
| 1779 | + break; | |
| 1780 | + } | |
| 1801 | 1781 | } |
| 1802 | 1782 | |
| 1803 | 1783 | |
| 1804 | - public function listarProcessosApensados($dblIdProcedimentoAtual, $idUnidadeAtual, $strPalavrasPesquisa = '', $numRegistros = 15) { | |
| 1784 | + public function listarProcessosApensados($dblIdProcedimentoAtual, $idUnidadeAtual, $strPalavrasPesquisa = '', $numRegistros = 15) | |
| 1785 | + { | |
| 1805 | 1786 | |
| 1806 | - $arrObjProcessosApensados = array(); | |
| 1787 | + $arrObjProcessosApensados = array(); | |
| 1807 | 1788 | |
| 1808 | - try{ | |
| 1809 | - $objInfraException = new InfraException(); | |
| 1810 | - $idUnidadeAtual = filter_var($idUnidadeAtual, FILTER_SANITIZE_NUMBER_INT); | |
| 1789 | + try{ | |
| 1790 | + $objInfraException = new InfraException(); | |
| 1791 | + $idUnidadeAtual = filter_var($idUnidadeAtual, FILTER_SANITIZE_NUMBER_INT); | |
| 1811 | 1792 | |
| 1812 | - if(!$idUnidadeAtual){ | |
| 1813 | - $objInfraException->adicionarValidacao('Processo inválido.'); | |
| 1814 | - } | |
| 1793 | + if(!$idUnidadeAtual){ | |
| 1794 | + $objInfraException->adicionarValidacao('Processo inválido.'); | |
| 1795 | + } | |
| 1815 | 1796 | |
| 1816 | - $objInfraException->lancarValidacoes(); | |
| 1797 | + $objInfraException->lancarValidacoes(); | |
| 1817 | 1798 | //Pesquisar procedimentos que esto abertos na unidade atual |
| 1818 | - $objAtividadeDTO = new AtividadeDTO(); | |
| 1819 | - $objAtividadeDTO->setDistinct(true); | |
| 1820 | - $objAtividadeDTO->retDblIdProtocolo(); | |
| 1821 | - $objAtividadeDTO->retStrProtocoloFormatadoProtocolo(); | |
| 1822 | - $objAtividadeDTO->retNumIdUnidade(); | |
| 1823 | - $objAtividadeDTO->retStrDescricaoUnidadeOrigem(); | |
| 1824 | - $objAtividadeDTO->setNumIdUnidade($idUnidadeAtual); | |
| 1825 | - $objAtividadeDTO->setDblIdProtocolo($dblIdProcedimentoAtual, InfraDTO::$OPER_DIFERENTE); | |
| 1826 | - $objAtividadeDTO->setDthConclusao(null); | |
| 1827 | - $objAtividadeDTO->setStrStaEstadoProtocolo(ProtocoloRN::$TE_NORMAL); | |
| 1828 | - | |
| 1829 | - $arrPalavrasPesquisa = explode(' ',$strPalavrasPesquisa); | |
| 1830 | - for($i=0; $i<count($arrPalavrasPesquisa); $i++) { | |
| 1831 | - $arrPalavrasPesquisa[$i] = '%'.$arrPalavrasPesquisa[$i].'%'; | |
| 1832 | - } | |
| 1799 | + $objAtividadeDTO = new AtividadeDTO(); | |
| 1800 | + $objAtividadeDTO->setDistinct(true); | |
| 1801 | + $objAtividadeDTO->retDblIdProtocolo(); | |
| 1802 | + $objAtividadeDTO->retStrProtocoloFormatadoProtocolo(); | |
| 1803 | + $objAtividadeDTO->retNumIdUnidade(); | |
| 1804 | + $objAtividadeDTO->retStrDescricaoUnidadeOrigem(); | |
| 1805 | + $objAtividadeDTO->setNumIdUnidade($idUnidadeAtual); | |
| 1806 | + $objAtividadeDTO->setDblIdProtocolo($dblIdProcedimentoAtual, InfraDTO::$OPER_DIFERENTE); | |
| 1807 | + $objAtividadeDTO->setDthConclusao(null); | |
| 1808 | + $objAtividadeDTO->setStrStaEstadoProtocolo(ProtocoloRN::$TE_NORMAL); | |
| 1809 | + | |
| 1810 | + $arrPalavrasPesquisa = explode(' ',$strPalavrasPesquisa); | |
| 1811 | + for($i=0; $i<count($arrPalavrasPesquisa); $i++) { | |
| 1812 | + $arrPalavrasPesquisa[$i] = '%'.$arrPalavrasPesquisa[$i].'%'; | |
| 1813 | + } | |
| 1833 | 1814 | |
| 1834 | - if (count($arrPalavrasPesquisa)==1){ | |
| 1835 | - $objAtividadeDTO->setStrProtocoloFormatadoProtocolo($arrPalavrasPesquisa[0],InfraDTO::$OPER_LIKE); | |
| 1836 | - }else{ | |
| 1837 | - $objAtividadeDTO->unSetStrProtocoloFormatadoProtocolo(); | |
| 1838 | - $a = array_fill(0,count($arrPalavrasPesquisa),'ProtocoloFormatadoProtocolo'); | |
| 1839 | - $b = array_fill(0,count($arrPalavrasPesquisa),InfraDTO::$OPER_LIKE); | |
| 1840 | - $d = array_fill(0,count($arrPalavrasPesquisa)-1,InfraDTO::$OPER_LOGICO_AND); | |
| 1841 | - $objAtividadeDTO->adicionarCriterio($a,$b,$arrPalavrasPesquisa,$d); | |
| 1842 | - } | |
| 1815 | + if (count($arrPalavrasPesquisa)==1){ | |
| 1816 | + $objAtividadeDTO->setStrProtocoloFormatadoProtocolo($arrPalavrasPesquisa[0],InfraDTO::$OPER_LIKE); | |
| 1817 | + }else{ | |
| 1818 | + $objAtividadeDTO->unSetStrProtocoloFormatadoProtocolo(); | |
| 1819 | + $a = array_fill(0,count($arrPalavrasPesquisa),'ProtocoloFormatadoProtocolo'); | |
| 1820 | + $b = array_fill(0,count($arrPalavrasPesquisa),InfraDTO::$OPER_LIKE); | |
| 1821 | + $d = array_fill(0,count($arrPalavrasPesquisa)-1,InfraDTO::$OPER_LOGICO_AND); | |
| 1822 | + $objAtividadeDTO->adicionarCriterio($a,$b,$arrPalavrasPesquisa,$d); | |
| 1823 | + } | |
| 1843 | 1824 | |
| 1844 | - $arrResultado = array(); | |
| 1845 | - $arrObjAtividadeDTO = $this->objAtividadeRN->listarRN0036($objAtividadeDTO); | |
| 1825 | + $arrResultado = array(); | |
| 1826 | + $arrObjAtividadeDTO = $this->objAtividadeRN->listarRN0036($objAtividadeDTO); | |
| 1846 | 1827 | //$arrObjAtividadeDTOIndexado = $arrObjAtividadeDTO; |
| 1847 | - $arrObjAtividadeDTOIndexado = InfraArray::indexarArrInfraDTO($arrObjAtividadeDTO, 'ProtocoloFormatadoProtocolo', true); | |
| 1828 | + $arrObjAtividadeDTOIndexado = InfraArray::indexarArrInfraDTO($arrObjAtividadeDTO, 'ProtocoloFormatadoProtocolo', true); | |
| 1848 | 1829 | |
| 1849 | - foreach ($arrObjAtividadeDTOIndexado as $key => $value) { | |
| 1830 | + foreach ($arrObjAtividadeDTOIndexado as $key => $value) { | |
| 1850 | 1831 | |
| 1851 | - if(is_array($value) && count($value) == 1) { | |
| 1852 | - $arrResultado[] = $value[0]; | |
| 1853 | - } | |
| 1854 | - } | |
| 1832 | + if(is_array($value) && count($value) == 1) { | |
| 1833 | + $arrResultado[] = $value[0]; | |
| 1834 | + } | |
| 1835 | + } | |
| 1855 | 1836 | |
| 1856 | - $arrObjProcessosApensados = array_slice($arrResultado, 0, $numRegistros); | |
| 1837 | + $arrObjProcessosApensados = array_slice($arrResultado, 0, $numRegistros); | |
| 1857 | 1838 | |
| 1858 | - } catch(Exception $e) { | |
| 1859 | - throw new InfraException("Error Processing Request", $e); | |
| 1860 | - } | |
| 1839 | + } catch(Exception $e) { | |
| 1840 | + throw new InfraException("Error Processing Request", $e); | |
| 1841 | + } | |
| 1861 | 1842 | |
| 1862 | - return $arrObjProcessosApensados; | |
| 1843 | + return $arrObjProcessosApensados; | |
| 1863 | 1844 | } |
| 1864 | 1845 | |
| 1865 | 1846 | |
| ... | ... | @@ -1886,63 +1867,63 @@ class ExpedirProcedimentoRN extends InfraRN { |
| 1886 | 1867 | |
| 1887 | 1868 | public function listarProcessosApensadosAvancado(AtividadeDTO $objAtividadeDTO, $dblIdProcedimentoAtual, $idUnidadeAtual, $strPalavrasPesquisa = '', $strDescricaoPesquisa = '', $numRegistros = 15) { |
| 1888 | 1869 | |
| 1889 | - $arrObjProcessosApensados = array(); | |
| 1870 | + $arrObjProcessosApensados = array(); | |
| 1890 | 1871 | |
| 1891 | - try{ | |
| 1892 | - $objInfraException = new InfraException(); | |
| 1893 | - $idUnidadeAtual = filter_var($idUnidadeAtual, FILTER_SANITIZE_NUMBER_INT); | |
| 1872 | + try { | |
| 1873 | + $objInfraException = new InfraException(); | |
| 1874 | + $idUnidadeAtual = filter_var($idUnidadeAtual, FILTER_SANITIZE_NUMBER_INT); | |
| 1894 | 1875 | |
| 1895 | - if(!$idUnidadeAtual){ | |
| 1896 | - $objInfraException->adicionarValidacao('Processo inválido.'); | |
| 1897 | - } | |
| 1876 | + if(!$idUnidadeAtual){ | |
| 1877 | + $objInfraException->adicionarValidacao('Processo inválido.'); | |
| 1878 | + } | |
| 1898 | 1879 | |
| 1899 | - $objInfraException->lancarValidacoes(); | |
| 1880 | + $objInfraException->lancarValidacoes(); | |
| 1900 | 1881 | //Pesquisar procedimentos que esto abertos na unidade atual |
| 1901 | 1882 | |
| 1902 | - $objAtividadeDTO->setDistinct(true); | |
| 1903 | - $objAtividadeDTO->retDblIdProtocolo(); | |
| 1904 | - $objAtividadeDTO->retStrProtocoloFormatadoProtocolo(); | |
| 1905 | - $objAtividadeDTO->retNumIdUnidade(); | |
| 1906 | - $objAtividadeDTO->retStrDescricaoUnidadeOrigem(); | |
| 1907 | - $objAtividadeDTO->setNumIdUnidade($idUnidadeAtual); | |
| 1908 | - $objAtividadeDTO->setDblIdProtocolo($dblIdProcedimentoAtual, InfraDTO::$OPER_DIFERENTE); | |
| 1909 | - $objAtividadeDTO->setDthConclusao(null); | |
| 1910 | - $objAtividadeDTO->setStrStaEstadoProtocolo(ProtocoloRN::$TE_NORMAL); | |
| 1911 | - ///$objAtividadeDTO->setStrDescricaoProtocolo('%'.$strDescricaoPesquisa.'%',InfraDTO::$OPER_LIKE); | |
| 1912 | - | |
| 1913 | - $arrPalavrasPesquisa = explode(' ',$strPalavrasPesquisa); | |
| 1914 | - for($i=0; $i<count($arrPalavrasPesquisa); $i++) { | |
| 1915 | - $arrPalavrasPesquisa[$i] = '%'.$arrPalavrasPesquisa[$i].'%'; | |
| 1916 | - } | |
| 1883 | + $objAtividadeDTO->setDistinct(true); | |
| 1884 | + $objAtividadeDTO->retDblIdProtocolo(); | |
| 1885 | + $objAtividadeDTO->retStrProtocoloFormatadoProtocolo(); | |
| 1886 | + $objAtividadeDTO->retNumIdUnidade(); | |
| 1887 | + $objAtividadeDTO->retStrDescricaoUnidadeOrigem(); | |
| 1888 | + $objAtividadeDTO->setNumIdUnidade($idUnidadeAtual); | |
| 1889 | + $objAtividadeDTO->setDblIdProtocolo($dblIdProcedimentoAtual, InfraDTO::$OPER_DIFERENTE); | |
| 1890 | + $objAtividadeDTO->setDthConclusao(null); | |
| 1891 | + $objAtividadeDTO->setStrStaEstadoProtocolo(ProtocoloRN::$TE_NORMAL); | |
| 1892 | + ///$objAtividadeDTO->setStrDescricaoProtocolo('%'.$strDescricaoPesquisa.'%',InfraDTO::$OPER_LIKE); | |
| 1893 | + | |
| 1894 | + $arrPalavrasPesquisa = explode(' ',$strPalavrasPesquisa); | |
| 1895 | + for($i=0; $i<count($arrPalavrasPesquisa); $i++) { | |
| 1896 | + $arrPalavrasPesquisa[$i] = '%'.$arrPalavrasPesquisa[$i].'%'; | |
| 1897 | + } | |
| 1917 | 1898 | |
| 1918 | - if (count($arrPalavrasPesquisa)==1){ | |
| 1919 | - $objAtividadeDTO->setStrProtocoloFormatadoProtocolo($arrPalavrasPesquisa[0],InfraDTO::$OPER_LIKE); | |
| 1920 | - }else{ | |
| 1921 | - $objAtividadeDTO->unSetStrProtocoloFormatadoProtocolo(); | |
| 1922 | - $a = array_fill(0,count($arrPalavrasPesquisa),'ProtocoloFormatadoProtocolo'); | |
| 1923 | - $b = array_fill(0,count($arrPalavrasPesquisa),InfraDTO::$OPER_LIKE); | |
| 1924 | - $d = array_fill(0,count($arrPalavrasPesquisa)-1,InfraDTO::$OPER_LOGICO_AND); | |
| 1925 | - $objAtividadeDTO->adicionarCriterio($a,$b,$arrPalavrasPesquisa,$d); | |
| 1926 | - } | |
| 1899 | + if (count($arrPalavrasPesquisa)==1){ | |
| 1900 | + $objAtividadeDTO->setStrProtocoloFormatadoProtocolo($arrPalavrasPesquisa[0],InfraDTO::$OPER_LIKE); | |
| 1901 | + }else{ | |
| 1902 | + $objAtividadeDTO->unSetStrProtocoloFormatadoProtocolo(); | |
| 1903 | + $a = array_fill(0,count($arrPalavrasPesquisa),'ProtocoloFormatadoProtocolo'); | |
| 1904 | + $b = array_fill(0,count($arrPalavrasPesquisa),InfraDTO::$OPER_LIKE); | |
| 1905 | + $d = array_fill(0,count($arrPalavrasPesquisa)-1,InfraDTO::$OPER_LOGICO_AND); | |
| 1906 | + $objAtividadeDTO->adicionarCriterio($a,$b,$arrPalavrasPesquisa,$d); | |
| 1907 | + } | |
| 1927 | 1908 | |
| 1928 | - $arrResultado = array(); | |
| 1929 | - $arrObjAtividadeDTO = $this->objAtividadeRN->listarRN0036($objAtividadeDTO); | |
| 1930 | - $arrObjAtividadeDTOIndexado = InfraArray::indexarArrInfraDTO($arrObjAtividadeDTO, 'ProtocoloFormatadoProtocolo', true); | |
| 1909 | + $arrResultado = array(); | |
| 1910 | + $arrObjAtividadeDTO = $this->objAtividadeRN->listarRN0036($objAtividadeDTO); | |
| 1911 | + $arrObjAtividadeDTOIndexado = InfraArray::indexarArrInfraDTO($arrObjAtividadeDTO, 'ProtocoloFormatadoProtocolo', true); | |
| 1931 | 1912 | |
| 1932 | - foreach ($arrObjAtividadeDTOIndexado as $key => $value) { | |
| 1913 | + foreach ($arrObjAtividadeDTOIndexado as $key => $value) { | |
| 1933 | 1914 | |
| 1934 | - if(is_array($value) && count($value) == 1) { | |
| 1935 | - $arrResultado[] = $value[0]; | |
| 1936 | - } | |
| 1937 | - } | |
| 1915 | + if(is_array($value) && count($value) == 1) { | |
| 1916 | + $arrResultado[] = $value[0]; | |
| 1917 | + } | |
| 1918 | + } | |
| 1938 | 1919 | |
| 1939 | - $arrObjProcessosApensados = array_slice($arrResultado, 0, $numRegistros); | |
| 1920 | + $arrObjProcessosApensados = array_slice($arrResultado, 0, $numRegistros); | |
| 1940 | 1921 | |
| 1941 | - } catch(Exception $e) { | |
| 1942 | - throw new InfraException("Error Processing Request", $e); | |
| 1943 | - } | |
| 1922 | + } catch(Exception $e) { | |
| 1923 | + throw new InfraException("Error Processing Request", $e); | |
| 1924 | + } | |
| 1944 | 1925 | |
| 1945 | - return $arrObjProcessosApensados; | |
| 1926 | + return $arrObjProcessosApensados; | |
| 1946 | 1927 | } |
| 1947 | 1928 | |
| 1948 | 1929 | |
| ... | ... | @@ -1979,22 +1960,22 @@ class ExpedirProcedimentoRN extends InfraRN { |
| 1979 | 1960 | |
| 1980 | 1961 | $objGenericoBD->cadastrar($objReciboTramiteDTO); |
| 1981 | 1962 | |
| 1982 | - if(isset($objReciboEnvio->reciboDeEnvio->hashDoComponenteDigital)) { | |
| 1983 | - $objReciboEnvio->reciboDeEnvio->hashDoComponenteDigital = !is_array($objReciboEnvio->reciboDeEnvio->hashDoComponenteDigital) ? array($objReciboEnvio->reciboDeEnvio->hashDoComponenteDigital) : $objReciboEnvio->reciboDeEnvio->hashDoComponenteDigital; | |
| 1984 | - if($objReciboEnvio->reciboDeEnvio->hashDoComponenteDigital && is_array($objReciboEnvio->reciboDeEnvio->hashDoComponenteDigital)){ | |
| 1963 | + if(isset($objReciboEnvio->reciboDeEnvio->hashDoComponenteDigital)) { | |
| 1964 | + $objReciboEnvio->reciboDeEnvio->hashDoComponenteDigital = !is_array($objReciboEnvio->reciboDeEnvio->hashDoComponenteDigital) ? array($objReciboEnvio->reciboDeEnvio->hashDoComponenteDigital) : $objReciboEnvio->reciboDeEnvio->hashDoComponenteDigital; | |
| 1965 | + if($objReciboEnvio->reciboDeEnvio->hashDoComponenteDigital && is_array($objReciboEnvio->reciboDeEnvio->hashDoComponenteDigital)){ | |
| 1985 | 1966 | |
| 1986 | - foreach($objReciboEnvio->reciboDeEnvio->hashDoComponenteDigital as $strHashComponenteDigital){ | |
| 1967 | + foreach($objReciboEnvio->reciboDeEnvio->hashDoComponenteDigital as $strHashComponenteDigital){ | |
| 1987 | 1968 | |
| 1988 | - $objReciboTramiteHashDTO = new ReciboTramiteHashDTO(); | |
| 1989 | - $objReciboTramiteHashDTO->setStrNumeroRegistro($objReciboEnvio->reciboDeEnvio->NRE); | |
| 1990 | - $objReciboTramiteHashDTO->setNumIdTramite($objReciboEnvio->reciboDeEnvio->IDT); | |
| 1991 | - $objReciboTramiteHashDTO->setStrHashComponenteDigital($strHashComponenteDigital); | |
| 1992 | - $objReciboTramiteHashDTO->setStrTipoRecibo(ProcessoEletronicoRN::$STA_TIPO_RECIBO_ENVIO); | |
| 1969 | + $objReciboTramiteHashDTO = new ReciboTramiteHashDTO(); | |
| 1970 | + $objReciboTramiteHashDTO->setStrNumeroRegistro($objReciboEnvio->reciboDeEnvio->NRE); | |
| 1971 | + $objReciboTramiteHashDTO->setNumIdTramite($objReciboEnvio->reciboDeEnvio->IDT); | |
| 1972 | + $objReciboTramiteHashDTO->setStrHashComponenteDigital($strHashComponenteDigital); | |
| 1973 | + $objReciboTramiteHashDTO->setStrTipoRecibo(ProcessoEletronicoRN::$STA_TIPO_RECIBO_ENVIO); | |
| 1993 | 1974 | |
| 1994 | - $objGenericoBD->cadastrar($objReciboTramiteHashDTO); | |
| 1975 | + $objGenericoBD->cadastrar($objReciboTramiteHashDTO); | |
| 1976 | + } | |
| 1995 | 1977 | } |
| 1996 | 1978 | } |
| 1997 | - } | |
| 1998 | 1979 | |
| 1999 | 1980 | return true; |
| 2000 | 1981 | } |
| ... | ... | @@ -2031,17 +2012,18 @@ class ExpedirProcedimentoRN extends InfraRN { |
| 2031 | 2012 | } |
| 2032 | 2013 | |
| 2033 | 2014 | |
| 2034 | - /** | |
| 2035 | - * @author Fabio.braga@softimais.com.br | |
| 2036 | - * @deprecated consulta processo | |
| 2037 | - * data : 28/05/2015 | |
| 2038 | - * @return objet | |
| 2039 | - */ | |
| 2040 | - public function listarTramiteParaCancelar($idProcedimento) { | |
| 2041 | - $objProtocoloDTO = $this->consultarProtocoloPk($idProcedimento); | |
| 2042 | - $result = $this->objProcessoEletronicoRN->serviceConsultarTramitesProtocolo( $objProtocoloDTO->getStrProtocoloFormatado( ) ); | |
| 2043 | - return $result; | |
| 2044 | - } | |
| 2015 | + /** | |
| 2016 | + * @author Fabio.braga@softimais.com.br | |
| 2017 | + * @deprecated consulta processo | |
| 2018 | + * data : 28/05/2015 | |
| 2019 | + * @return objet | |
| 2020 | + */ | |
| 2021 | + public function listarTramiteParaCancelar($idProcedimento) | |
| 2022 | + { | |
| 2023 | + $objProtocoloDTO = $this->consultarProtocoloPk($idProcedimento); | |
| 2024 | + $result = $this->objProcessoEletronicoRN->serviceConsultarTramitesProtocolo( $objProtocoloDTO->getStrProtocoloFormatado( ) ); | |
| 2025 | + return $result; | |
| 2026 | + } | |
| 2045 | 2027 | |
| 2046 | 2028 | |
| 2047 | 2029 | /** |
| ... | ... | @@ -2050,8 +2032,8 @@ class ExpedirProcedimentoRN extends InfraRN { |
| 2050 | 2032 | * @param int $dblIdProcedimento |
| 2051 | 2033 | * @throws InfraException |
| 2052 | 2034 | */ |
| 2053 | - public function cancelarTramite($dblIdProcedimento) { | |
| 2054 | - | |
| 2035 | + public function cancelarTramite($dblIdProcedimento) | |
| 2036 | + { | |
| 2055 | 2037 | //Busca os dados do protocolo |
| 2056 | 2038 | $objDtoProtocolo = new ProtocoloDTO(); |
| 2057 | 2039 | $objDtoProtocolo->retStrProtocoloFormatado(); |
| ... | ... | @@ -2065,9 +2047,8 @@ class ExpedirProcedimentoRN extends InfraRN { |
| 2065 | 2047 | |
| 2066 | 2048 | } |
| 2067 | 2049 | |
| 2068 | - protected function cancelarTramiteInternoControlado(ProtocoloDTO $objDtoProtocolo) { | |
| 2069 | - | |
| 2070 | - | |
| 2050 | + protected function cancelarTramiteInternoControlado(ProtocoloDTO $objDtoProtocolo) | |
| 2051 | + { | |
| 2071 | 2052 | //Obtem o id_rh que representa a unidade no barramento |
| 2072 | 2053 | $objPenParametroRN = new PenParametroRN(); |
| 2073 | 2054 | $numIdRespositorio = $objPenParametroRN->getParametro('PEN_ID_REPOSITORIO_ORIGEM'); |
| ... | ... | @@ -2131,17 +2112,17 @@ class ExpedirProcedimentoRN extends InfraRN { |
| 2131 | 2112 | //Valida os status |
| 2132 | 2113 | switch ($numSituacaoAtual) { |
| 2133 | 2114 | case ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_RECIBO_ENVIADO_DESTINATARIO: |
| 2134 | - throw new InfraException("O sistema destinatário já iniciou o recebimento desse processo, portanto não é possível realizar o cancelamento"); | |
| 2135 | - break; | |
| 2115 | + throw new InfraException("O sistema destinatário já iniciou o recebimento desse processo, portanto não é possível realizar o cancelamento"); | |
| 2116 | + break; | |
| 2136 | 2117 | case ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_RECIBO_RECEBIDO_REMETENTE: |
| 2137 | - throw new InfraException("O sistema destinatário já recebeu esse processo, portanto não é possivel realizar o cancelamento"); | |
| 2138 | - break; | |
| 2118 | + throw new InfraException("O sistema destinatário já recebeu esse processo, portanto não é possivel realizar o cancelamento"); | |
| 2119 | + break; | |
| 2139 | 2120 | case ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_CANCELADO: |
| 2140 | - throw new InfraException("O trâmite externo para esse processo já se encontra cancelado."); | |
| 2141 | - break; | |
| 2121 | + throw new InfraException("O trâmite externo para esse processo já se encontra cancelado."); | |
| 2122 | + break; | |
| 2142 | 2123 | case ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_RECUSADO: |
| 2143 | - throw new InfraException("O trâmite externo para esse processo encontra-se recusado."); | |
| 2144 | - break; | |
| 2124 | + throw new InfraException("O trâmite externo para esse processo encontra-se recusado."); | |
| 2125 | + break; | |
| 2145 | 2126 | } |
| 2146 | 2127 | |
| 2147 | 2128 | $this->objProcessoEletronicoRN->cancelarTramite($tramite->IDT); |
| ... | ... | @@ -2195,8 +2176,8 @@ class ExpedirProcedimentoRN extends InfraRN { |
| 2195 | 2176 | * @param integer $parNumIdProcedimento |
| 2196 | 2177 | * @return boolean|object |
| 2197 | 2178 | */ |
| 2198 | - public function verificarProcessoEmExpedicao($parNumIdProcedimento){ | |
| 2199 | - | |
| 2179 | + public function verificarProcessoEmExpedicao($parNumIdProcedimento) | |
| 2180 | + { | |
| 2200 | 2181 | $objProcedimentoDTO = new ProcedimentoDTO(); |
| 2201 | 2182 | $objProcedimentoDTO->setDblIdProcedimento($parNumIdProcedimento); |
| 2202 | 2183 | $objProcedimentoDTO->retStrStaEstadoProtocolo(); |
| ... | ... | @@ -2211,14 +2192,14 @@ class ExpedirProcedimentoRN extends InfraRN { |
| 2211 | 2192 | $objAtividadeDTO = new AtividadeDTO(); |
| 2212 | 2193 | $objAtividadeDTO->setDblIdProtocolo($objProcedimentoDTO->getDblIdProcedimento()); |
| 2213 | 2194 | $objAtividadeDTO->setNumIdTarefa( |
| 2214 | - array(ProcessoEletronicoRN::obterIdTarefaModulo(ProcessoEletronicoRN::$TI_PROCESSO_ELETRONICO_PROCESSO_EXPEDIDO), | |
| 2215 | - ProcessoEletronicoRN::obterIdTarefaModulo(ProcessoEletronicoRN::$TI_PROCESSO_ELETRONICO_PROCESSO_RECEBIDO), | |
| 2216 | - ProcessoEletronicoRN::obterIdTarefaModulo(ProcessoEletronicoRN::$TI_PROCESSO_ELETRONICO_PROCESSO_TRAMITE_CANCELADO), | |
| 2217 | - ProcessoEletronicoRN::obterIdTarefaModulo(ProcessoEletronicoRN::$TI_PROCESSO_ELETRONICO_PROCESSO_TRAMITE_RECUSADO), | |
| 2218 | - ProcessoEletronicoRN::obterIdTarefaModulo(ProcessoEletronicoRN::$TI_PROCESSO_ELETRONICO_PROCESSO_TRAMITE_EXTERNO), | |
| 2219 | - ProcessoEletronicoRN::obterIdTarefaModulo(ProcessoEletronicoRN::$TI_PROCESSO_ELETRONICO_PROCESSO_ABORTADO), | |
| 2220 | - ), | |
| 2221 | - InfraDTO::$OPER_IN); | |
| 2195 | + array(ProcessoEletronicoRN::obterIdTarefaModulo(ProcessoEletronicoRN::$TI_PROCESSO_ELETRONICO_PROCESSO_EXPEDIDO), | |
| 2196 | + ProcessoEletronicoRN::obterIdTarefaModulo(ProcessoEletronicoRN::$TI_PROCESSO_ELETRONICO_PROCESSO_RECEBIDO), | |
| 2197 | + ProcessoEletronicoRN::obterIdTarefaModulo(ProcessoEletronicoRN::$TI_PROCESSO_ELETRONICO_PROCESSO_TRAMITE_CANCELADO), | |
| 2198 | + ProcessoEletronicoRN::obterIdTarefaModulo(ProcessoEletronicoRN::$TI_PROCESSO_ELETRONICO_PROCESSO_TRAMITE_RECUSADO), | |
| 2199 | + ProcessoEletronicoRN::obterIdTarefaModulo(ProcessoEletronicoRN::$TI_PROCESSO_ELETRONICO_PROCESSO_TRAMITE_EXTERNO), | |
| 2200 | + ProcessoEletronicoRN::obterIdTarefaModulo(ProcessoEletronicoRN::$TI_PROCESSO_ELETRONICO_PROCESSO_ABORTADO), | |
| 2201 | + ), | |
| 2202 | + InfraDTO::$OPER_IN); | |
| 2222 | 2203 | $objAtividadeDTO->setNumMaxRegistrosRetorno(1); |
| 2223 | 2204 | $objAtividadeDTO->setOrdDthAbertura(InfraDTO::$TIPO_ORDENACAO_DESC); |
| 2224 | 2205 | $objAtividadeDTO->retNumIdAtividade(); |
| ... | ... | @@ -2240,60 +2221,53 @@ class ExpedirProcedimentoRN extends InfraRN { |
| 2240 | 2221 | } |
| 2241 | 2222 | |
| 2242 | 2223 | |
| 2243 | - public function consultaUnidadePk($idUnidade) { | |
| 2244 | - | |
| 2245 | - $objUnidadeDTO = new UnidadeDTO(); | |
| 2246 | - $objUnidadeDTO->setNumIdUnidade($idUnidade); | |
| 2247 | - $objUnidadeDTO->retTodos(); | |
| 2248 | - | |
| 2249 | - $objUnidadeDTO = $this->objUnidadeRN->consultarRN0125($objUnidadeDTO); | |
| 2250 | - | |
| 2251 | - return $objUnidadeDTO; | |
| 2252 | - } | |
| 2253 | - | |
| 2254 | - public function consultaUsuarioPk($idUsuario) { | |
| 2255 | - | |
| 2256 | - $objUsuarioDTO = new UsuarioDTO(); | |
| 2257 | - $objUsuarioDTO->setNumIdUsuario($idUsuario); | |
| 2258 | - $objUsuarioDTO->retTodos(); | |
| 2259 | - | |
| 2260 | - $objUsuarioDTO = $this->objUsuarioRN->consultarRN0489($objUsuarioDTO); | |
| 2261 | - | |
| 2262 | - return $objUsuarioDTO; | |
| 2263 | - } | |
| 2264 | - | |
| 2265 | - public function consultarProtocoloPk($idPrtocedimento) { | |
| 2224 | + public function consultaUnidadePk($idUnidade) { | |
| 2266 | 2225 | |
| 2267 | - $idPrtocedimento = (int)$idPrtocedimento; | |
| 2226 | + $objUnidadeDTO = new UnidadeDTO(); | |
| 2227 | + $objUnidadeDTO->setNumIdUnidade($idUnidade); | |
| 2228 | + $objUnidadeDTO->retTodos(); | |
| 2268 | 2229 | |
| 2269 | - $objProtocoloDTO = new ProtocoloDTO(); | |
| 2270 | - $objProtocoloDTO->setDblIdProtocolo($idPrtocedimento); | |
| 2271 | - $objProtocoloDTO->retTodos(); | |
| 2230 | + $objUnidadeDTO = $this->objUnidadeRN->consultarRN0125($objUnidadeDTO); | |
| 2272 | 2231 | |
| 2232 | + return $objUnidadeDTO; | |
| 2233 | + } | |
| 2273 | 2234 | |
| 2274 | - $objProtocoloDTO = $this->objProtocoloRN->consultarRN0186($objProtocoloDTO); | |
| 2275 | - | |
| 2276 | - | |
| 2277 | - $objProtocoloDTO->UnidadeGeradora = $this->consultaUnidadePk($objProtocoloDTO->getNumIdUnidadeGeradora()); | |
| 2278 | - | |
| 2279 | - $objProtocoloDTO->UsuarioCriador = $this->consultaUsuarioPk($objProtocoloDTO->getNumIdUsuarioGerador()); | |
| 2280 | - | |
| 2281 | - $objProtocoloDTO->Documentos = $this->consultaDocumentosProcesso($idPrtocedimento); | |
| 2282 | - | |
| 2283 | - return $objProtocoloDTO; | |
| 2284 | - } | |
| 2285 | - | |
| 2235 | + public function consultaUsuarioPk($idUsuario) | |
| 2236 | + { | |
| 2286 | 2237 | |
| 2287 | - public function consultaDocumentosProcesso($idPrtocedimento) { | |
| 2238 | + $objUsuarioDTO = new UsuarioDTO(); | |
| 2239 | + $objUsuarioDTO->setNumIdUsuario($idUsuario); | |
| 2240 | + $objUsuarioDTO->retTodos(); | |
| 2288 | 2241 | |
| 2289 | - $documentoRespArray = array(); | |
| 2242 | + $objUsuarioDTO = $this->objUsuarioRN->consultarRN0489($objUsuarioDTO); | |
| 2290 | 2243 | |
| 2291 | - $documentoDTO = new DocumentoDTO(); | |
| 2292 | - $documentoDTO->setDblIdProcedimento($idPrtocedimento); | |
| 2293 | - $documentoDTO->retTodos(); | |
| 2244 | + return $objUsuarioDTO; | |
| 2245 | + } | |
| 2294 | 2246 | |
| 2295 | - $documentoDTO = $this->objDocumentoRN->listarRN0008($documentoDTO); | |
| 2247 | + public function consultarProtocoloPk($idPrtocedimento) | |
| 2248 | + { | |
| 2296 | 2249 | |
| 2297 | - return $documentoDTO; | |
| 2298 | - } | |
| 2250 | + $idPrtocedimento = (int)$idPrtocedimento; | |
| 2251 | + $objProtocoloDTO = new ProtocoloDTO(); | |
| 2252 | + $objProtocoloDTO->setDblIdProtocolo($idPrtocedimento); | |
| 2253 | + $objProtocoloDTO->retTodos(); | |
| 2254 | + | |
| 2255 | + $objProtocoloDTO = $this->objProtocoloRN->consultarRN0186($objProtocoloDTO); | |
| 2256 | + $objProtocoloDTO->UnidadeGeradora = $this->consultaUnidadePk($objProtocoloDTO->getNumIdUnidadeGeradora()); | |
| 2257 | + $objProtocoloDTO->UsuarioCriador = $this->consultaUsuarioPk($objProtocoloDTO->getNumIdUsuarioGerador()); | |
| 2258 | + $objProtocoloDTO->Documentos = $this->consultaDocumentosProcesso($idPrtocedimento); | |
| 2259 | + | |
| 2260 | + return $objProtocoloDTO; | |
| 2261 | + } | |
| 2262 | + | |
| 2263 | + | |
| 2264 | + public function consultaDocumentosProcesso($idPrtocedimento) | |
| 2265 | + { | |
| 2266 | + $documentoRespArray = array(); | |
| 2267 | + $documentoDTO = new DocumentoDTO(); | |
| 2268 | + $documentoDTO->setDblIdProcedimento($idPrtocedimento); | |
| 2269 | + $documentoDTO->retTodos(); | |
| 2270 | + $documentoDTO = $this->objDocumentoRN->listarRN0008($documentoDTO); | |
| 2271 | + return $documentoDTO; | |
| 2272 | + } | |
| 2299 | 2273 | } | ... | ... |