Commit 0d2ff516ef1a196dbd5fc6c9fa2907c62673b566
1 parent
55907536
Exists in
master
and in
21 other branches
Correções de compatibilidade com SQLServer e compatibilidade de versão do módulo
Showing
10 changed files
with
1213 additions
and
1195 deletions
Show diff stats
... | ... | @@ -0,0 +1,14 @@ |
1 | +# EditorConfig is awesome: http://EditorConfig.org | |
2 | + | |
3 | +# top-most EditorConfig file | |
4 | +root = true | |
5 | + | |
6 | +# Unix-style newlines with a newline ending every file | |
7 | +[*.php] | |
8 | +indent_style = space | |
9 | +indent_size = 4 | |
10 | +end_of_line = crlf | |
11 | +insert_final_newline = true | |
12 | +charset = latin1 | |
13 | +trim_trailing_whitespace = true | |
14 | +insert_final_newline = true | ... | ... |
PENIntegracao.php
... | ... | @@ -2,6 +2,8 @@ |
2 | 2 | |
3 | 3 | class PENIntegracao extends SeiIntegracao { |
4 | 4 | |
5 | + const COMPATIBILIDADE_MODULO_SEI = array('3.0.5', '3.0.6', '3.0.7', '3.0.8', '3.0.9', '3.0.11'); | |
6 | + | |
5 | 7 | private static $strDiretorio; |
6 | 8 | |
7 | 9 | public function getNome() { |
... | ... | @@ -9,9 +11,10 @@ class PENIntegracao extends SeiIntegracao { |
9 | 11 | } |
10 | 12 | |
11 | 13 | public function getVersao() { |
12 | - return '1.1.1'; | |
14 | + return '1.1.2'; | |
13 | 15 | } |
14 | 16 | |
17 | + | |
15 | 18 | public function getInstituicao() { |
16 | 19 | return 'Ministério do Planejamento - MPDG (Projeto Colaborativo no Portal do SPB)'; |
17 | 20 | } |
... | ... | @@ -21,7 +24,7 @@ class PENIntegracao extends SeiIntegracao { |
21 | 24 | $objProcedimentoDTO = new ProcedimentoDTO(); |
22 | 25 | $objProcedimentoDTO->setDblIdProcedimento($objSeiIntegracaoDTO->getIdProcedimento()); |
23 | 26 | $objProcedimentoDTO->retTodos(); |
24 | - | |
27 | + | |
25 | 28 | $objProcedimentoRN = new ProcedimentoRN(); |
26 | 29 | $objProcedimentoDTO = $objProcedimentoRN->consultarRN0201($objProcedimentoDTO); |
27 | 30 | |
... | ... | @@ -32,8 +35,8 @@ class PENIntegracao extends SeiIntegracao { |
32 | 35 | $dblIdProcedimento = $objProcedimentoDTO->getDblIdProcedimento(); |
33 | 36 | $numIdUsuario = SessaoSEI::getInstance()->getNumIdUsuario(); |
34 | 37 | $numIdUnidadeAtual = SessaoSEI::getInstance()->getNumIdUnidadeAtual(); |
35 | - $objInfraParametro = new InfraParametro(BancoSEI::getInstance()); | |
36 | - | |
38 | + $objInfraParametro = new InfraParametro(BancoSEI::getInstance()); | |
39 | + | |
37 | 40 | //Verifica se o processo encontra-se aberto na unidade atual |
38 | 41 | $objAtividadeRN = new AtividadeRN(); |
39 | 42 | $objPesquisaPendenciaDTO = new PesquisaPendenciaDTO(); |
... | ... | @@ -65,7 +68,7 @@ class PENIntegracao extends SeiIntegracao { |
65 | 68 | if($objPenUnidadeRN->contar($objPenUnidadeDTO) != 0) { |
66 | 69 | $numTabBotao = $objPaginaSEI->getProxTabBarraComandosSuperior(); |
67 | 70 | $strAcoesProcedimento .= '<a id="validar_expedir_processo" href="' . $objPaginaSEI->formatarXHTML($objSessaoSEI->assinarLink('controlador.php?acao=pen_procedimento_expedir&acao_origem=procedimento_visualizar&acao_retorno=arvore_visualizar&id_procedimento=' . $dblIdProcedimento . '&arvore=1')) . '" tabindex="' . $numTabBotao . '" class="botaoSEI"><img class="infraCorBarraSistema" src="' . $this->getDiretorioImagens() . '/pen_expedir_procedimento.gif" alt="Envio Externo de Processo" title="Envio Externo de Processo" /></a>'; |
68 | - } | |
71 | + } | |
69 | 72 | } |
70 | 73 | |
71 | 74 | //Apresenta o botão da página de recibos |
... | ... | @@ -80,20 +83,20 @@ class PENIntegracao extends SeiIntegracao { |
80 | 83 | $strAcoesProcedimento .= '</a>'; |
81 | 84 | } |
82 | 85 | } |
83 | - | |
86 | + | |
84 | 87 | //Apresenta o botão de cancelar trâmite |
85 | 88 | $objAtividadeDTO = $objExpedirProcedimentoRN->verificarProcessoEmExpedicao($objSeiIntegracaoDTO->getIdProcedimento()); |
86 | 89 | if ($objAtividadeDTO && $objAtividadeDTO->getNumIdTarefa() == ProcessoEletronicoRN::obterIdTarefaModulo(ProcessoEletronicoRN::$TI_PROCESSO_ELETRONICO_PROCESSO_EXPEDIDO)) { |
87 | 90 | $strAcoesProcedimento .= '<a href="' . $objPaginaSEI->formatarXHTML($objSessaoSEI->assinarLink('controlador.php?acao=pen_procedimento_cancelar_expedir&acao_origem=procedimento_visualizar&acao_retorno=arvore_visualizar&id_procedimento=' . $dblIdProcedimento . '&arvore=1')) . '" tabindex="' . $numTabBotao . '" class="botaoSEI">'; |
88 | 91 | $strAcoesProcedimento .= '<img class="infraCorBarraSistema" src="' . $this->getDiretorioImagens() . '/sei_desanexar_processo.gif" alt="Cancelar Tramitação Externa" title="Cancelar Tramitação Externa" />'; |
89 | 92 | $strAcoesProcedimento .= '</a>'; |
90 | - } | |
91 | - | |
93 | + } | |
94 | + | |
92 | 95 | return array($strAcoesProcedimento); |
93 | 96 | } |
94 | 97 | |
95 | 98 | public function montarIconeControleProcessos($arrObjProcedimentoAPI = array()) { |
96 | - | |
99 | + | |
97 | 100 | $arrStrIcone = array(); |
98 | 101 | $arrDblIdProcedimento = array(); |
99 | 102 | |
... | ... | @@ -131,7 +134,7 @@ class PENIntegracao extends SeiIntegracao { |
131 | 134 | |
132 | 135 | return $arrStrIcone; |
133 | 136 | } |
134 | - | |
137 | + | |
135 | 138 | public function montarIconeProcesso(ProcedimentoAPI $objProcedimentoAP) { |
136 | 139 | $dblIdProcedimento = $objProcedimentoAP->getIdProcedimento(); |
137 | 140 | |
... | ... | @@ -146,15 +149,15 @@ class PENIntegracao extends SeiIntegracao { |
146 | 149 | $objArvoreAcaoItemAPI->setHref('javascript:alert(\'Um trâmite para esse processo foi recusado\');'); |
147 | 150 | |
148 | 151 | $objArvoreAcaoItemAPI->setSinHabilitado('S'); |
149 | - | |
152 | + | |
150 | 153 | $objProcedimentoDTO = new ProcedimentoDTO(); |
151 | 154 | $objProcedimentoDTO->setDblIdProcedimento($dblIdProcedimento); |
152 | 155 | $objProcedimentoDTO->retDblIdProcedimento(); |
153 | 156 | $objProcedimentoDTO->retStrStaEstadoProtocolo(); |
154 | - | |
157 | + | |
155 | 158 | $objProcedimentoBD = new ProcedimentoBD(BancoSEI::getInstance()); |
156 | 159 | $arrObjProcedimentoDTO = $objProcedimentoBD->consultar($objProcedimentoDTO); |
157 | - | |
160 | + | |
158 | 161 | if (!empty($arrObjProcedimentoDTO)) { |
159 | 162 | $dblIdProcedimento = $objProcedimentoDTO->getDblIdProcedimento(); |
160 | 163 | $objPenProtocoloDTO = new PenProtocoloDTO(); |
... | ... | @@ -176,7 +179,7 @@ class PENIntegracao extends SeiIntegracao { |
176 | 179 | } |
177 | 180 | |
178 | 181 | public function montarIconeAcompanhamentoEspecial($arrObjProcedimentoDTO) { |
179 | - | |
182 | + | |
180 | 183 | } |
181 | 184 | |
182 | 185 | public function getDiretorioImagens() { |
... | ... | @@ -203,110 +206,121 @@ class PENIntegracao extends SeiIntegracao { |
203 | 206 | } |
204 | 207 | |
205 | 208 | public static function getDiretorio() { |
206 | - | |
207 | - | |
208 | 209 | $arrConfig = ConfiguracaoSEI::getInstance()->getValor('SEI', 'Modulos'); |
209 | 210 | $strModulo = $arrConfig['PENIntegracao']; |
210 | - | |
211 | 211 | return "modulos/".$strModulo; |
212 | 212 | } |
213 | 213 | |
214 | - public function processarControlador($strAcao) { | |
214 | + public function processarControlador($strAcao) | |
215 | + { | |
216 | + //Configuração de páginas do contexto da árvore do processo para apresentação de erro de forma correta | |
217 | + $bolArvore = in_array($strAcao, array('pen_procedimento_expedir', 'pen_procedimento_estado')); | |
218 | + PaginaSEI::getInstance()->setBolArvore($bolArvore); | |
219 | + | |
220 | + if (strpos($strAcao, 'pen_') === false) { | |
221 | + return false; | |
222 | + } | |
223 | + | |
224 | + PENIntegracao::validarCompatibilidadeModulo(); | |
225 | + | |
215 | 226 | switch ($strAcao) { |
216 | 227 | case 'pen_procedimento_expedir': |
217 | 228 | require_once dirname(__FILE__) . '/pen_procedimento_expedir.php'; |
218 | - return true; | |
219 | - //TODO: Alterar nome do recurso para pen_procedimento_expedir_unidade_sel | |
229 | + break; | |
230 | + | |
220 | 231 | case 'pen_unidade_sel_expedir_procedimento': |
221 | 232 | require_once dirname(__FILE__) . '/pen_unidade_sel_expedir_procedimento.php'; |
222 | - return true; | |
233 | + break; | |
223 | 234 | |
224 | 235 | case 'pen_procedimento_processo_anexado': |
225 | 236 | require_once dirname(__FILE__) . '/pen_procedimento_processo_anexado.php'; |
226 | - return true; | |
237 | + break; | |
227 | 238 | |
228 | 239 | case 'pen_procedimento_cancelar_expedir': |
229 | 240 | require_once dirname(__FILE__) . '/pen_procedimento_cancelar_expedir.php'; |
230 | - return true; | |
241 | + break; | |
231 | 242 | |
232 | 243 | case 'pen_procedimento_expedido_listar': |
233 | 244 | require_once dirname(__FILE__) . '/pen_procedimento_expedido_listar.php'; |
234 | - return true; | |
245 | + break; | |
235 | 246 | |
236 | 247 | case 'pen_map_tipo_documento_envio_listar': |
237 | 248 | case 'pen_map_tipo_documento_envio_excluir': |
238 | 249 | case 'pen_map_tipo_documento_envio_desativar': |
239 | 250 | case 'pen_map_tipo_documento_envio_ativar': |
240 | 251 | require_once dirname(__FILE__) . '/pen_map_tipo_documento_envio_listar.php'; |
241 | - return true; | |
252 | + break; | |
242 | 253 | |
243 | 254 | case 'pen_map_tipo_documento_envio_cadastrar': |
244 | 255 | case 'pen_map_tipo_documento_envio_visualizar': |
245 | 256 | require_once dirname(__FILE__) . '/pen_map_tipo_documento_envio_cadastrar.php'; |
246 | - return true; | |
257 | + break; | |
247 | 258 | |
248 | 259 | case 'pen_map_tipo_documento_recebimento_listar': |
249 | 260 | case 'pen_map_tipo_documento_recebimento_excluir': |
250 | 261 | require_once dirname(__FILE__) . '/pen_map_tipo_documento_recebimento_listar.php'; |
251 | - return true; | |
262 | + break; | |
252 | 263 | |
253 | 264 | case 'pen_map_tipo_documento_recebimento_cadastrar': |
254 | 265 | case 'pen_map_tipo_documento_recebimento_visualizar': |
255 | 266 | require_once dirname(__FILE__) . '/pen_map_tipo_documento_recebimento_cadastrar.php'; |
256 | - return true; | |
267 | + break; | |
257 | 268 | |
258 | 269 | case 'pen_apensados_selecionar_expedir_procedimento': |
259 | 270 | require_once dirname(__FILE__) . '/apensados_selecionar_expedir_procedimento.php'; |
260 | - return true; | |
271 | + break; | |
261 | 272 | |
262 | 273 | case 'pen_procedimento_estado': |
263 | 274 | require_once dirname(__FILE__) . '/pen_procedimento_estado.php'; |
264 | - return true; | |
265 | - | |
275 | + break; | |
276 | + | |
266 | 277 | // Mapeamento de Hipóteses Legais de Envio |
267 | 278 | case 'pen_map_hipotese_legal_envio_cadastrar': |
268 | 279 | case 'pen_map_hipotese_legal_envio_visualizar': |
269 | 280 | require_once dirname(__FILE__) . '/pen_map_hipotese_legal_envio_cadastrar.php'; |
270 | - return true; | |
271 | - | |
281 | + break; | |
282 | + | |
272 | 283 | case 'pen_map_hipotese_legal_envio_listar': |
273 | 284 | case 'pen_map_hipotese_legal_envio_excluir': |
274 | 285 | require_once dirname(__FILE__) . '/pen_map_hipotese_legal_envio_listar.php'; |
275 | - return true; | |
276 | - | |
286 | + break; | |
287 | + | |
277 | 288 | // Mapeamento de Hipóteses Legais de Recebimento |
278 | 289 | case 'pen_map_hipotese_legal_recebimento_cadastrar': |
279 | 290 | case 'pen_map_hipotese_legal_recebimento_visualizar': |
280 | 291 | require_once dirname(__FILE__) . '/pen_map_hipotese_legal_recebimento_cadastrar.php'; |
281 | - return true; | |
282 | - | |
292 | + break; | |
293 | + | |
283 | 294 | case 'pen_map_hipotese_legal_recebimento_listar': |
284 | 295 | case 'pen_map_hipotese_legal_recebimento_excluir': |
285 | 296 | require_once dirname(__FILE__) . '/pen_map_hipotese_legal_recebimento_listar.php'; |
286 | - return true; | |
287 | - | |
297 | + break; | |
298 | + | |
288 | 299 | case 'pen_map_hipotese_legal_padrao_cadastrar': |
289 | 300 | case 'pen_map_hipotese_legal_padrao_visualizar': |
290 | 301 | require_once dirname(__FILE__) . '/pen_map_hipotese_legal_padrao_cadastrar.php'; |
291 | - return true; | |
292 | - | |
302 | + break; | |
303 | + | |
293 | 304 | case 'pen_map_unidade_cadastrar': |
294 | 305 | case 'pen_map_unidade_visualizar': |
295 | 306 | require_once dirname(__FILE__) . '/pen_map_unidade_cadastrar.php'; |
296 | - return true; | |
297 | - | |
307 | + break; | |
308 | + | |
298 | 309 | case 'pen_map_unidade_listar': |
299 | 310 | case 'pen_map_unidade_excluir': |
300 | 311 | require_once dirname(__FILE__) . '/pen_map_unidade_listar.php'; |
301 | - return true; | |
302 | - | |
312 | + break; | |
313 | + | |
303 | 314 | case 'pen_parametros_configuracao': |
304 | 315 | case 'pen_parametros_configuracao_salvar': |
305 | 316 | require_once dirname(__FILE__) . '/pen_parametros_configuracao.php'; |
306 | - return true; | |
317 | + break; | |
318 | + default: | |
319 | + return false; | |
320 | + break; | |
307 | 321 | } |
308 | 322 | |
309 | - return false; | |
323 | + return true; | |
310 | 324 | } |
311 | 325 | |
312 | 326 | public function processarControladorAjax($strAcao) { |
... | ... | @@ -325,7 +339,7 @@ class PENIntegracao extends SeiIntegracao { |
325 | 339 | break; |
326 | 340 | |
327 | 341 | case 'pen_apensados_auto_completar_expedir_procedimento': |
328 | - //TODO: Validar parâmetros passados via ajax | |
342 | + //TODO: Validar parâmetros passados via ajax | |
329 | 343 | $dblIdProcedimentoAtual = $_POST['id_procedimento_atual']; |
330 | 344 | $numIdUnidadeAtual = SessaoSEI::getInstance()->getNumIdUnidadeAtual(); |
331 | 345 | $arrObjProcedimentoDTO = ProcessoEletronicoINT::autoCompletarProcessosApensados($dblIdProcedimentoAtual, $numIdUnidadeAtual, $_POST['palavras_pesquisa']); |
... | ... | @@ -340,4 +354,10 @@ class PENIntegracao extends SeiIntegracao { |
340 | 354 | return $xml; |
341 | 355 | } |
342 | 356 | |
343 | -} | |
344 | 357 | \ No newline at end of file |
358 | + public static function validarCompatibilidadeModulo($bolGerarExcecao = true, $strVersaoSEI = SEI_VERSAO) { | |
359 | + $objPENIntegracao = new PENIntegracao(); | |
360 | + if(!in_array($strVersaoSEI, self::COMPATIBILIDADE_MODULO_SEI)) { | |
361 | + throw new InfraException(sprintf("Módulo %s (versão %s) não é compatível com a versão %s do SEI.", $objPENIntegracao->getNome(), $objPENIntegracao->getVersao(), $strVersaoSEI)); | |
362 | + } | |
363 | + } | |
364 | +} | ... | ... |
pen_procedimento_expedir.php
... | ... | @@ -12,11 +12,11 @@ try { |
12 | 12 | |
13 | 13 | $objSessaoSEI = SessaoSEI::getInstance(); |
14 | 14 | $objPaginaSEI = PaginaSEI::getInstance(); |
15 | - | |
15 | + | |
16 | 16 | $objSessaoSEI->validarLink(); |
17 | 17 | $objSessaoSEI->validarPermissao($_GET['acao']); |
18 | 18 | |
19 | - | |
19 | + | |
20 | 20 | $strParametros = ''; |
21 | 21 | $bolErrosValidacao = false; |
22 | 22 | $executarExpedicao = false; |
... | ... | @@ -41,21 +41,18 @@ try { |
41 | 41 | if (isset($_GET['executar'])) { |
42 | 42 | $executarExpedicao = filter_var($_GET['executar'], FILTER_VALIDATE_BOOLEAN); |
43 | 43 | } |
44 | - | |
45 | - | |
46 | - | |
47 | - | |
44 | + | |
48 | 45 | //$objPaginaSEI->setBolExibirMensagens(false); |
49 | 46 | |
50 | 47 | //$resultProcessosAnexados = $objExpedirProcedimentosRN->consultarProcessosApensados($idProcedimento); |
51 | - | |
48 | + | |
52 | 49 | //$strLinkAssuntosSelecao = $objSessaoSEI->assinarLink('controlador.php?acao=pen_procedimento_processo_anexado&tipo_selecao=2&id_object=objLupaAssuntos'); |
53 | 50 | |
54 | - | |
51 | + | |
55 | 52 | switch ($_GET['acao']) { |
56 | 53 | |
57 | 54 | case 'pen_procedimento_expedir': |
58 | - | |
55 | + | |
59 | 56 | $strTitulo = 'Envio Externo de Processo'; |
60 | 57 | $arrComandos[] = '<button type="button" accesskey="E" onclick="enviarForm(this)" value="Enviar" class="infraButton" style="width:8%;"><span class="infraTeclaAtalho">E</span>nviar</button>'; |
61 | 58 | $arrComandos[] = '<button type="button" accesskey="C" name="btnCancelar" value="Cancelar" onclick="location.href=\'' . $objPaginaSEI->formatarXHTML($objSessaoSEI->assinarLink('controlador.php?acao=' . $objPaginaSEI->getAcaoRetorno() . '&acao_origem=' . $_GET['acao'] . '&acao_destino=' . $_GET['acao'] . $strParametros)) . '\';" class="infraButton"><span class="infraTeclaAtalho">C</span>ancelar</button>'; |
... | ... | @@ -64,57 +61,57 @@ try { |
64 | 61 | //Obter dados do repositório em que o SEI está registrado (Repositório de Origem) |
65 | 62 | $objPenParametroRN = new PenParametroRN(); |
66 | 63 | $numIdRepositorioOrigem = $objPenParametroRN->getParametro('PEN_ID_REPOSITORIO_ORIGEM'); |
67 | - | |
64 | + | |
68 | 65 | //Preparação dos dados para montagem da tela de expedição de processos |
69 | - $repositorios = $objExpedirProcedimentosRN->listarRepositoriosDeEstruturas(); | |
66 | + $repositorios = $objExpedirProcedimentosRN->listarRepositoriosDeEstruturas(); | |
70 | 67 | $motivosDeUrgencia = $objExpedirProcedimentosRN->consultarMotivosUrgencia(); |
71 | 68 | |
72 | 69 | $idRepositorioSelecionado = (isset($numIdRepositorio)) ? $numIdRepositorio : ''; |
73 | 70 | $strItensSelRepositorioEstruturas = InfraINT::montarSelectArray('', 'Selecione', $idRepositorioSelecionado, $repositorios); |
74 | - | |
71 | + | |
75 | 72 | $idMotivosUrgenciaSelecionado = (isset($idMotivosUrgenciaSelecionado)) ? $idMotivosUrgenciaSelecionado : ''; |
76 | - $strItensSelMotivosUrgencia = InfraINT::montarSelectArray('', 'Selecione', $idMotivosUrgenciaSelecionado, $motivosDeUrgencia); | |
73 | + $strItensSelMotivosUrgencia = InfraINT::montarSelectArray('', 'Selecione', $idMotivosUrgenciaSelecionado, $motivosDeUrgencia); | |
77 | 74 | |
78 | - $strLinkAjaxUnidade = $objSessaoSEI->assinarLink('controlador_ajax.php?acao_ajax=pen_unidade_auto_completar_expedir_procedimento'); | |
75 | + $strLinkAjaxUnidade = $objSessaoSEI->assinarLink('controlador_ajax.php?acao_ajax=pen_unidade_auto_completar_expedir_procedimento'); | |
79 | 76 | $strLinkAjaxProcedimentoApensado = $objSessaoSEI->assinarLink('controlador_ajax.php?acao_ajax=pen_apensados_auto_completar_expedir_procedimento'); |
80 | - | |
77 | + | |
81 | 78 | //$strLinkUnidadeSelecao = $objSessaoSEI->assinarLink('controlador.php?acao=pen_unidade_sel_expedir_procedimento&tipo_selecao=2&id_object=objLupaUnidades'); |
82 | 79 | //$strLinkRepositorioSelecao = $objSessaoSEI->assinarLink('controlador.php?acao=pen_repositorio_selecionar_expedir_procedimento&tipo_selecao=2&id_object=objLupaProcedimentosApensados'); |
83 | 80 | $strLinkProcedimentosApensadosSelecao = $objSessaoSEI->assinarLink('controlador.php?acao=pen_apensados_selecionar_expedir_procedimento&tipo_selecao=2&id_object=objLupaProcedimentosApensados&id_procedimento='.$idProcedimento.''); |
84 | 81 | |
85 | 82 | //TODO: Obter dados do repositório e unidade de orígem através de serviço do PEN |
86 | 83 | //Obtenção dos parâmetros selecionados pelo usuário |
87 | - | |
84 | + | |
88 | 85 | //TODO: Obter repositório de origem a partir dos parâmetros do sistema |
89 | 86 | //$numIdRepositorioOrigem = 1; |
90 | 87 | //$numIdUnidadeOrigem = 161313; |
91 | - | |
92 | - //TODO: Atualmente, o campo ID Unidade RH irá conter o código da unidade registrado no barramento. | |
88 | + | |
89 | + //TODO: Atualmente, o campo ID Unidade RH irá conter o código da unidade registrado no barramento. | |
93 | 90 | //A ideia é que no futura, o campo contenha o código do SIORG e busque no barramento qual o código da estrutura |
94 | 91 | |
95 | 92 | //$objSessaoSEI->getNumIdUnidadeAtual() |
96 | - $objUnidadeDTO = new PenUnidadeDTO(); | |
93 | + $objUnidadeDTO = new PenUnidadeDTO(); | |
97 | 94 | $objUnidadeDTO->retNumIdUnidadeRH(); |
98 | 95 | $objUnidadeDTO->setNumIdUnidade($objSessaoSEI->getNumIdUnidadeAtual()); |
99 | - | |
96 | + | |
100 | 97 | $objUnidadeRN = new UnidadeRN(); |
101 | 98 | $objUnidadeDTO = $objUnidadeRN->consultarRN0125($objUnidadeDTO); |
102 | - | |
99 | + | |
103 | 100 | if (!$objUnidadeDTO) { |
104 | 101 | throw new InfraException("A unidade atual não foi mapeada."); |
105 | 102 | } |
106 | - | |
107 | - $numIdUnidadeOrigem = $objUnidadeDTO->getNumIdUnidadeRH(); | |
103 | + | |
104 | + $numIdUnidadeOrigem = $objUnidadeDTO->getNumIdUnidadeRH(); | |
108 | 105 | $numIdProcedimento = $_POST['hdnIdProcedimento']; |
109 | 106 | $strProtocoloProcedimentoFormatado = $_POST['txtProtocoloExibir']; |
110 | 107 | $numIdRepositorio = $_POST['selRepositorioEstruturas']; |
111 | 108 | $strRepositorio = (array_key_exists($numIdRepositorio, $repositorios) ? $repositorios[$numIdRepositorio] : ''); |
112 | 109 | $numIdUnidadeDestino = $_POST['hdnIdUnidade']; |
113 | - $strNomeUnidadeDestino = $_POST['txtUnidade']; | |
110 | + $strNomeUnidadeDestino = $_POST['txtUnidade']; | |
114 | 111 | $numIdMotivoUrgente = $_POST['selMotivosUrgencia']; |
115 | - $boolSinUrgente = $objPaginaSEI->getCheckbox($_POST['chkSinUrgente'], true, false); | |
112 | + $boolSinUrgente = $objPaginaSEI->getCheckbox($_POST['chkSinUrgente'], true, false); | |
116 | 113 | $arrIdProcedimentosApensados = $objPaginaSEI->getArrValuesSelect($_POST['hdnProcedimentosApensados']); |
117 | - | |
114 | + | |
118 | 115 | //Carregar dados do procedimento na primeiro acesso à página |
119 | 116 | if (!isset($_POST['hdnIdProcedimento'])) { |
120 | 117 | |
... | ... | @@ -125,13 +122,13 @@ try { |
125 | 122 | // |
126 | 123 | // try { |
127 | 124 | // //Validação das pré-condições para que o processo possa ser expedido |
128 | -// $objInfraException = new InfraException(); | |
125 | +// $objInfraException = new InfraException(); | |
129 | 126 | // $objExpedirProcedimentosRN->validarPreCondicoesExpedirProcedimento($objInfraException, $objProcedimentoDTO); |
130 | 127 | // $objInfraException->lancarValidacoes(); |
131 | 128 | // } catch(Exception $e){ |
132 | 129 | // $bolErrosValidacao = true; |
133 | 130 | // $objPaginaSEI->processarExcecao($e); |
134 | -// } | |
131 | +// } | |
135 | 132 | |
136 | 133 | $numIdProcedimento = $objProcedimentoDTO->getDblIdProcedimento(); |
137 | 134 | $strProtocoloProcedimentoFormatado = $objProcedimentoDTO->getStrProtocoloProcedimentoFormatado(); |
... | ... | @@ -141,14 +138,14 @@ try { |
141 | 138 | // Executado dentro da window |
142 | 139 | //------------------------------------------------------------------ |
143 | 140 | //Tratamento da ação de expedir o procedimento |
144 | - if(isset($_POST['sbmExpedir'])) { | |
141 | + if(isset($_POST['sbmExpedir'])) { | |
145 | 142 | |
146 | 143 | $strTituloPagina = "Envio externo do processo $strProtocoloProcedimentoFormatado"; |
147 | - $objPaginaSEI->prepararBarraProgresso($strTitulo, $strTituloPagina); | |
148 | - | |
149 | - $objExpedirProcedimentoDTO = new ExpedirProcedimentoDTO(); | |
150 | - | |
151 | - //TODO: Remover atribuição de tais parâmetros de | |
144 | + $objPaginaSEI->prepararBarraProgresso($strTitulo, $strTituloPagina); | |
145 | + | |
146 | + $objExpedirProcedimentoDTO = new ExpedirProcedimentoDTO(); | |
147 | + | |
148 | + //TODO: Remover atribuição de tais parâmetros de | |
152 | 149 | $objExpedirProcedimentoDTO->setNumIdRepositorioOrigem($numIdRepositorioOrigem); |
153 | 150 | $objExpedirProcedimentoDTO->setNumIdUnidadeOrigem($numIdUnidadeOrigem); |
154 | 151 | |
... | ... | @@ -165,10 +162,10 @@ try { |
165 | 162 | |
166 | 163 | try { |
167 | 164 | $respostaExpedir = $objExpedirProcedimentosRN->expedirProcedimento($objExpedirProcedimentoDTO); |
168 | - | |
165 | + | |
169 | 166 | echo '<input type="button" onclick="javascript:window.close()" class="botao_fechar" value="Fechar" ' |
170 | 167 | . 'style="margin-left: 84%; margin-top: 4%;"/>'; //Botão para fechar a janela |
171 | - } catch(\Exception $e) { | |
168 | + } catch(\Exception $e) { | |
172 | 169 | $objPaginaSEI->processarExcecao($e); |
173 | 170 | } |
174 | 171 | |
... | ... | @@ -181,11 +178,11 @@ try { |
181 | 178 | throw new InfraException("Ação '" . $_GET['acao'] . "' não reconhecida."); |
182 | 179 | } |
183 | 180 | |
184 | -} catch (Exception $e) { | |
181 | +} catch (Exception $e) { | |
185 | 182 | //$objPaginaSEI->finalizarBarraProgresso($objSessaoSEI->assinarLink('controlador.php?acao='.$objPaginaSEI->getAcaoRetorno().'&acao_origem='.$_GET['acao'].'#ID-'.$IdProcedimento)); |
186 | 183 | //$objPaginaSEI->processarExcecao($e); |
187 | 184 | throw new InfraException("Error Processing Request 11", $e); |
188 | - | |
185 | + | |
189 | 186 | } |
190 | 187 | |
191 | 188 | $objPaginaSEI->montarDocType(); |
... | ... | @@ -231,28 +228,28 @@ var objJanelaExpedir = null; |
231 | 228 | var evnJanelaExpedir = null; |
232 | 229 | |
233 | 230 | function inicializar() { |
234 | - | |
231 | + | |
235 | 232 | objLupaProcedimentosApensados = new infraLupaSelect('selProcedimentosApensados','hdnProcedimentosApensados','<?=$strLinkProcedimentosApensadosSelecao ?>'); |
236 | - | |
233 | + | |
237 | 234 | objAutoCompletarEstrutura = new infraAjaxAutoCompletar('hdnIdUnidade','txtUnidade','<?=$strLinkAjaxUnidade?>', "Nenhuma unidade foi encontrada"); |
238 | 235 | objAutoCompletarEstrutura.bolExecucaoAutomatica = false; |
239 | 236 | objAutoCompletarEstrutura.mostrarAviso = true; |
240 | 237 | //objAutoCompletarEstrutura.tamanhoMinimo = 3; |
241 | - objAutoCompletarEstrutura.limparCampo = false; | |
238 | + objAutoCompletarEstrutura.limparCampo = false; | |
242 | 239 | //objAutoCompletarEstrutura.mostrarImagemVerificado = true; |
243 | 240 | objAutoCompletarEstrutura.tempoAviso = 10000000; |
244 | 241 | |
245 | 242 | objAutoCompletarEstrutura.prepararExecucao = function(){ |
246 | 243 | var selRepositorioEstruturas = document.getElementById('selRepositorioEstruturas'); |
247 | 244 | var parametros = 'palavras_pesquisa=' + document.getElementById('txtUnidade').value; |
248 | - parametros += '&id_repositorio=' + selRepositorioEstruturas.options[selRepositorioEstruturas.selectedIndex].value | |
245 | + parametros += '&id_repositorio=' + selRepositorioEstruturas.options[selRepositorioEstruturas.selectedIndex].value | |
249 | 246 | return parametros; |
250 | 247 | }; |
251 | 248 | |
252 | 249 | objAutoCompletarEstrutura.processarResultado = function(id,descricao,complemento){ |
253 | - window.infraAvisoCancelar(); | |
250 | + window.infraAvisoCancelar(); | |
254 | 251 | }; |
255 | - | |
252 | + | |
256 | 253 | $('#hdnIdUnidade2').click(function() { |
257 | 254 | objAutoCompletarEstrutura.executar(); |
258 | 255 | objAutoCompletarEstrutura.procurar(); |
... | ... | @@ -367,28 +364,28 @@ function avaliarPreCondicoes() { |
367 | 364 | infraDesabilitarCamposDiv(document.getElementById('divProcedimentosApensados')); |
368 | 365 | infraDesabilitarCamposDiv(document.getElementById('divSinUrgente')); |
369 | 366 | infraDesabilitarCamposDiv(document.getElementById('divMotivosUrgencia')); |
370 | - | |
367 | + | |
371 | 368 | var smbExpedir = document.getElementById('sbmExpedir'); |
372 | 369 | smbExpedir.disabled = true; |
373 | - smbExpedir.className += ' infraReadOnly'; | |
374 | - } | |
370 | + smbExpedir.className += ' infraReadOnly'; | |
371 | + } | |
375 | 372 | } |
376 | 373 | |
377 | 374 | /** |
378 | 375 | * Simula o evento onclose do pop-up |
379 | - * | |
376 | + * | |
380 | 377 | * @return {null} |
381 | 378 | */ |
382 | 379 | function monitorarJanela(){ |
383 | - | |
380 | + | |
384 | 381 | if(objJanelaExpedir.closed) { |
385 | - | |
382 | + | |
386 | 383 | window.clearInterval(evnJanelaExpedir); |
387 | - | |
384 | + | |
388 | 385 | jQuery('#divInfraModalFundo', window.parent.document).css('visibility', 'hidden'); |
389 | 386 | |
390 | 387 | var strDestino = '<?php print $objSessaoSEI->assinarLink('controlador.php?acao=procedimento_trabalhar&acao_origem=procedimento_controlar&acao_retorno=procedimento_controlar&id_procedimento='.$idProcedimento); ?>'; |
391 | - | |
388 | + | |
392 | 389 | if(strDestino) { |
393 | 390 | window.top.location = strDestino; |
394 | 391 | } |
... | ... | @@ -397,22 +394,22 @@ function monitorarJanela(){ |
397 | 394 | |
398 | 395 | /** |
399 | 396 | * Gera a pop-up de expedir procedimento e cria os gatilho para o próprio fechamento |
400 | - * | |
397 | + * | |
401 | 398 | * @return {null} |
402 | 399 | */ |
403 | 400 | function abrirJanela(nome,largura,altura){ |
404 | - | |
401 | + | |
405 | 402 | var opcoes = 'location=0,status=0,resizable=0,scrollbars=1,width=' + largura + ',height=' + altura; |
406 | 403 | var largura = largura || 100; |
407 | 404 | var altura = altura || 100; |
408 | - | |
405 | + | |
409 | 406 | var janela = window.open('', nome, opcoes); |
410 | - | |
407 | + | |
411 | 408 | try{ |
412 | 409 | if (INFRA_CHROME>17) { |
413 | 410 | setTimeout(function() { |
414 | 411 | janela.moveTo(((screen.availWidth/2) - (largura/2)),((screen.availHeight/2) - (altura/2))); |
415 | - },100); | |
412 | + },100); | |
416 | 413 | } |
417 | 414 | else { |
418 | 415 | janela.moveTo(((screen.availWidth/2) - (largura/2)),((screen.availHeight/2) - (altura/2))); |
... | ... | @@ -420,8 +417,8 @@ function abrirJanela(nome,largura,altura){ |
420 | 417 | janela.focus(); |
421 | 418 | } |
422 | 419 | catch(e){} |
423 | - | |
424 | - | |
420 | + | |
421 | + | |
425 | 422 | infraJanelaModal = janela; |
426 | 423 | |
427 | 424 | var div = parent.document.getElementById('divInfraModalFundo'); |
... | ... | @@ -430,11 +427,11 @@ function abrirJanela(nome,largura,altura){ |
430 | 427 | div = parent.document.createElement('div'); |
431 | 428 | div.id = 'divInfraModalFundo'; |
432 | 429 | div.className = 'infraFundoTransparente'; |
433 | - | |
430 | + | |
434 | 431 | if (INFRA_IE > 0 && INFRA_IE < 7){ |
435 | 432 | ifr = parent.document.createElement('iframe'); |
436 | 433 | ifr.className = 'infraFundoIE'; |
437 | - div.appendChild(ifr); | |
434 | + div.appendChild(ifr); | |
438 | 435 | }else{ |
439 | 436 | div.onclick = function(){ |
440 | 437 | try{ |
... | ... | @@ -442,19 +439,19 @@ function abrirJanela(nome,largura,altura){ |
442 | 439 | }catch(exc){ } |
443 | 440 | } |
444 | 441 | } |
445 | - parent.document.body.appendChild(div); | |
442 | + parent.document.body.appendChild(div); | |
446 | 443 | } |
447 | - | |
444 | + | |
448 | 445 | if (INFRA_IE==0 || INFRA_IE>=7){ |
449 | 446 | div.style.position = 'fixed'; |
450 | 447 | } |
451 | - | |
448 | + | |
452 | 449 | div.style.width = parent.infraClientWidth() + 'px'; |
453 | 450 | div.style.height = parent.infraClientHeight() + 'px'; |
454 | 451 | div.style.visibility = 'visible'; |
455 | - | |
452 | + | |
456 | 453 | evnJanelaExpedir = window.setInterval('monitorarJanela()', 100); |
457 | - | |
454 | + | |
458 | 455 | return janela; |
459 | 456 | } |
460 | 457 | |
... | ... | @@ -473,58 +470,58 @@ function abrirBarraProgresso(form, action, largura, altura){ |
473 | 470 | |
474 | 471 | |
475 | 472 | function enviarForm(el){ |
476 | - | |
473 | + | |
477 | 474 | var button = jQuery(el); |
478 | 475 | var label = button.html(); |
479 | - | |
476 | + | |
480 | 477 | button.attr('disabled', 'disabled').html('Validando...'); |
481 | 478 | |
482 | 479 | var strUrl = '<?php print $objPaginaSEI->formatarXHTML($objSessaoSEI->assinarLink('controlador_ajax.php?acao_ajax=pen_procedimento_expedir_validar'.$strParametros)); ?>'; |
483 | - var objData = {}; | |
480 | + var objData = {}; | |
484 | 481 | |
485 | 482 | jQuery.each(['txtProtocoloExibir', 'selRepositorioEstruturas', 'hdnIdUnidade'], function(index, name){ |
486 | - | |
483 | + | |
487 | 484 | var objInput = jQuery('#' + name); |
488 | - | |
485 | + | |
489 | 486 | objData[name] = objInput.val(); |
490 | 487 | }); |
491 | - | |
488 | + | |
492 | 489 | jQuery('option', 'select#selProcedimentosApensados').each(function(index, element){ |
493 | - | |
490 | + | |
494 | 491 | objData['selProcedimentosApensados['+ index +']'] = jQuery(element).attr('value'); |
495 | 492 | }); |
496 | - | |
493 | + | |
497 | 494 | jQuery.ajax({ |
498 | - | |
495 | + | |
499 | 496 | url:strUrl, |
500 | 497 | method:'POST', |
501 | 498 | dataType:'json', |
502 | 499 | data:objData, |
503 | 500 | success:function(resp, textStatus, jqXHR) { |
504 | - | |
501 | + | |
505 | 502 | if(!resp.sucesso) { |
506 | - | |
503 | + | |
507 | 504 | var strRespMensagem = "Verifique alguns erros no processo antes de tramitar:\n\n"; |
508 | - | |
505 | + | |
509 | 506 | jQuery.each(resp.erros, function(strProtocoloFormatado, arrStrMensagem){ |
510 | - | |
507 | + | |
511 | 508 | strRespMensagem += "Nr. Processo: " + strProtocoloFormatado + ".\n"; |
512 | - | |
509 | + | |
513 | 510 | jQuery.each(arrStrMensagem, function(index, strMensagem){ |
514 | - | |
511 | + | |
515 | 512 | strRespMensagem += " - " + strMensagem + "\n"; |
516 | 513 | }); |
517 | - | |
514 | + | |
518 | 515 | strRespMensagem += "\n"; |
519 | 516 | }); |
520 | 517 | alert(strRespMensagem); |
521 | 518 | return false; |
522 | 519 | } |
523 | - var strAction = '<?php print $objPaginaSEI->formatarXHTML($objSessaoSEI->assinarLink('controlador.php?acao='.$_GET['acao'] . '&acao_origem=' . $_GET['acao'] . '&acao_destino=' . $_GET['acao'] .'&'.$strParametros.'&executar=1')); ?>'; | |
520 | + var strAction = '<?php print $objPaginaSEI->formatarXHTML($objSessaoSEI->assinarLink('controlador.php?acao='.$_GET['acao'] . '&acao_origem=' . $_GET['acao'] . '&acao_destino=' . $_GET['acao'] .'&'.$strParametros.'&executar=1')); ?>'; | |
524 | 521 | abrirBarraProgresso(document.forms['frmExpedirProcedimento'], strAction, 600, 200); |
525 | 522 | } |
526 | 523 | }).done(function(){ |
527 | - | |
524 | + | |
528 | 525 | button.removeAttr('disabled').html(label); |
529 | 526 | }); |
530 | 527 | } |
... | ... | @@ -542,55 +539,55 @@ $objPaginaSEI->abrirBody($strTitulo, 'onload="inicializar();"'); |
542 | 539 | //$objPaginaSEI->montarBarraLocalizacao($strTitulo); |
543 | 540 | $objPaginaSEI->montarBarraComandosSuperior($arrComandos); |
544 | 541 | //$objPaginaSEI->montarAreaValidacao(); |
545 | -?> | |
542 | +?> | |
546 | 543 | <div id="divProtocoloExibir" class="infraAreaDados" style="height: 4.5em;"> |
547 | - <label id="lblProtocoloExibir" for="txtProtocoloExibir" accesskey="" class="infraLabelObrigatorio">Protocolo:</label> | |
544 | + <label id="lblProtocoloExibir" for="txtProtocoloExibir" accesskey="" class="infraLabelObrigatorio">Protocolo:</label> | |
548 | 545 | <input type="text" id="txtProtocoloExibir" name="txtProtocoloExibir" class="infraText infraReadOnly" readonly="readonly" value="<?=$strProtocoloProcedimentoFormatado; ?>" tabindex="<?= $objPaginaSEI->getProxTabDados() ?>" /> |
549 | 546 | </div> |
550 | 547 | |
551 | 548 | <div id="divRepositorioEstruturas" class="infraAreaDados" style="height: 4.5em;"> |
552 | - <label id="lblRepositorioEstruturas" for="selRepositorioEstruturas" accesskey="" class="infraLabelObrigatorio">Repositório de Estruturas Organizacionais:</label> | |
549 | + <label id="lblRepositorioEstruturas" for="selRepositorioEstruturas" accesskey="" class="infraLabelObrigatorio">Repositório de Estruturas Organizacionais:</label> | |
553 | 550 | <select id="selRepositorioEstruturas" name="selRepositorioEstruturas" class="infraSelect" onchange="selecionarRepositorio();" tabindex="<?= $objPaginaSEI->getProxTabDados() ?>" > |
554 | 551 | <?= $strItensSelRepositorioEstruturas ?> |
555 | 552 | </select> |
556 | 553 | </div> |
557 | 554 | |
558 | 555 | <div id="divUnidades" class="infraAreaDados" style="height: 4.5em;"> |
559 | - <label id="lblUnidades" for="selUnidades" class="infraLabelObrigatorio">Unidade:</label> | |
556 | + <label id="lblUnidades" for="selUnidades" class="infraLabelObrigatorio">Unidade:</label> | |
560 | 557 | <div class="alinhamentoBotaoImput"> |
561 | 558 | <input type="text" id="txtUnidade" name="txtUnidade" class="infraText infraReadOnly" disabled="disabled" value="<?=$strNomeUnidadeDestino ?>" tabindex="<?= $objPaginaSEI->getProxTabDados() ?>" value="" /> |
562 | - <button id="hdnIdUnidade2" type="button" class="infraText">Pesquisar</button> | |
559 | + <button id="hdnIdUnidade2" type="button" class="infraText">Pesquisar</button> | |
563 | 560 | </div> |
564 | - | |
565 | - <input type="hidden" id="hdnIdUnidade" name="hdnIdUnidade" class="infraText" value="<?=$numIdUnidadeDestino; ?>" /> | |
561 | + | |
562 | + <input type="hidden" id="hdnIdUnidade" name="hdnIdUnidade" class="infraText" value="<?=$numIdUnidadeDestino; ?>" /> | |
566 | 563 | <?php /* ?><img id="imgLupaUnidades" src="/infra_css/imagens/lupa.gif" alt="Selecionar Unidades" title="Selecionar Unidades" class="infraImg" tabindex="<?= $objPaginaSEI->getProxTabDados() ?>" /><?php */ ?> |
567 | - | |
564 | + | |
568 | 565 | </div> |
569 | 566 | |
570 | 567 | <div id="divProcedimentosApensados" class="infraAreaDados" style="height: 12em; display: none; "> |
571 | - <label id="lblProcedimentosApensados" for="selProcedimentosApensados" class="infraLabelObrigatorio">Processos Apensados:</label> | |
572 | - <input type="text" id="txtProcedimentoApensado" name="txtProcedimentoApensado" class="infraText" tabindex="<?= $objPaginaSEI->getProxTabDados() ?>" /> | |
573 | - <input type="hidden" id="hdnIdProcedimentoApensado" name="hdnIdProcedimentoApensado" class="infraText" value="" /> | |
574 | - <select id="selProcedimentosApensados" name="selProcedimentosApensados[ ]" size="4" multiple="multiple" class="infraSelect" tabindex="<?= $objPaginaSEI->getProxTabDados() ?>"></select> | |
575 | - <img id="imgLupaProcedimentosApensados" onclick="objLupaProcedimentosApensados.selecionar(700,500);" src="/infra_css/imagens/lupa.gif" alt="Selecionar Processos Apensados" title="Selecionar Processos Apensados" class="infraImg" tabindex="<?= $objPaginaSEI->getProxTabDados() ?>" /> | |
568 | + <label id="lblProcedimentosApensados" for="selProcedimentosApensados" class="infraLabelObrigatorio">Processos Apensados:</label> | |
569 | + <input type="text" id="txtProcedimentoApensado" name="txtProcedimentoApensado" class="infraText" tabindex="<?= $objPaginaSEI->getProxTabDados() ?>" /> | |
570 | + <input type="hidden" id="hdnIdProcedimentoApensado" name="hdnIdProcedimentoApensado" class="infraText" value="" /> | |
571 | + <select id="selProcedimentosApensados" name="selProcedimentosApensados[ ]" size="4" multiple="multiple" class="infraSelect" tabindex="<?= $objPaginaSEI->getProxTabDados() ?>"></select> | |
572 | + <img id="imgLupaProcedimentosApensados" onclick="objLupaProcedimentosApensados.selecionar(700,500);" src="/infra_css/imagens/lupa.gif" alt="Selecionar Processos Apensados" title="Selecionar Processos Apensados" class="infraImg" tabindex="<?= $objPaginaSEI->getProxTabDados() ?>" /> | |
576 | 573 | <img id="imgExcluirProcedimentosApensados" onclick="objLupaProcedimentosApensados.remover();" src="/infra_css/imagens/remover.gif" alt="Remover Processo Apensado" title="Remover Processo Apensado" class="infraImg" tabindex="<?= $objPaginaSEI->getProxTabDados() ?>" /> |
577 | 574 | </div> |
578 | 575 | |
579 | 576 | <div id="divSinUrgente" class="infraDivCheckbox"> |
580 | - <input type="checkbox" id="chkSinUrgente" name="chkSinUrgente" class="infraCheckbox" onclick="selecionarUrgencia();" <?= $objPaginaSEI->setCheckbox($boolSinUrgente, true, false) ?> tabindex="<?= $objPaginaSEI->getProxTabDados() ?>" /> | |
577 | + <input type="checkbox" id="chkSinUrgente" name="chkSinUrgente" class="infraCheckbox" onclick="selecionarUrgencia();" <?= $objPaginaSEI->setCheckbox($boolSinUrgente, true, false) ?> tabindex="<?= $objPaginaSEI->getProxTabDados() ?>" /> | |
581 | 578 | <label id="lblSinUrgente" for="chkSinUrgente" accesskey="" class="infraLabelCheckbox">Urgente</label> |
582 | 579 | </div> |
583 | 580 | |
584 | 581 | <div id="divMotivosUrgencia" class="infraAreaDados" style="height: 4.5em; display:none"> |
585 | - <label id="lblMotivosUrgencia" for="selMotivosUrgencia" accesskey="" class="infraLabel">Motivo da Urgência:</label> | |
582 | + <label id="lblMotivosUrgencia" for="selMotivosUrgencia" accesskey="" class="infraLabel">Motivo da Urgência:</label> | |
586 | 583 | <select id="selMotivosUrgencia" name="selMotivosUrgencia" class="infraSelect infraReadOnly" disabled="disabled" tabindex="<?= $objPaginaSEI->getProxTabDados() ?>"> |
587 | 584 | <?= $strItensSelMotivosUrgencia ?> |
588 | 585 | </select> |
589 | 586 | </div> |
590 | 587 | |
591 | - <input type="hidden" id="hdnIdProcedimento" name="hdnIdProcedimento" value="<?=$numIdProcedimento ?>" /> | |
592 | - <input type="hidden" id="hdnErrosValidacao" name="hdnErrosValidacao" value="<?=$bolErrosValidacao ?>" /> | |
593 | - <input type="hidden" id="hdnProcedimentosApensados" name="hdnProcedimentosApensados" value="<?=$_POST['hdnProcedimentosApensados']?>" /> | |
588 | + <input type="hidden" id="hdnIdProcedimento" name="hdnIdProcedimento" value="<?=$numIdProcedimento ?>" /> | |
589 | + <input type="hidden" id="hdnErrosValidacao" name="hdnErrosValidacao" value="<?=$bolErrosValidacao ?>" /> | |
590 | + <input type="hidden" id="hdnProcedimentosApensados" name="hdnProcedimentosApensados" value="<?=$_POST['hdnProcedimentosApensados']?>" /> | |
594 | 591 | <? |
595 | 592 | //$objPaginaSEI->montarBarraComandosInferior($arrComandos); |
596 | 593 | ?> |
... | ... | @@ -599,4 +596,4 @@ $objPaginaSEI->montarBarraComandosSuperior($arrComandos); |
599 | 596 | $objPaginaSEI->montarAreaDebug(); |
600 | 597 | $objPaginaSEI->fecharBody(); |
601 | 598 | $objPaginaSEI->fecharHtml(); |
602 | -?> | |
603 | 599 | \ No newline at end of file |
600 | +?> | ... | ... |
rn/PENAgendamentoRN.php
... | ... | @@ -174,7 +174,7 @@ class PENAgendamentoRN extends InfraRN { |
174 | 174 | |
175 | 175 | if ($objProcessoEletronico) { |
176 | 176 | |
177 | - //Busca o processo | |
177 | + //Busca o processo | |
178 | 178 | $objProtocolo = new PenProtocoloDTO(); |
179 | 179 | $objProtocolo->setDblIdProtocolo($objProcessoEletronico->getDblIdProcedimento()); |
180 | 180 | |
... | ... | @@ -242,12 +242,12 @@ class PENAgendamentoRN extends InfraRN { |
242 | 242 | $cont++; |
243 | 243 | $servico[] = 'ProcessarPendenciasRN.php'; |
244 | 244 | } |
245 | - | |
245 | + | |
246 | 246 | $strServicos = array_map(function($item){ return "- $item"; }, $servico); |
247 | 247 | $strServicos = implode("\n", $strServicos); |
248 | 248 | |
249 | 249 | if ($cont > 0) { |
250 | - $msg = "Identificada inconsistência nos serviços de integração com o Processo Eletrônico Nacional - PEN.\n" . | |
250 | + $msg = "Identificada inconsistência nos serviços de integração com o Processo Eletrônico Nacional - PEN.\n" . | |
251 | 251 | "Os seguintes serviços necessários para o correto funcionamento da integração não estão ativos: \n $strServicos \n\n" . |
252 | 252 | "Favor, entrar em contato com a equipe de suporte técnico."; |
253 | 253 | throw new InfraException($msg, $e); |
... | ... | @@ -265,12 +265,14 @@ class PENAgendamentoRN extends InfraRN { |
265 | 265 | */ |
266 | 266 | public function atualizarHipotesesLegais() { |
267 | 267 | try { |
268 | + | |
269 | + PENIntegracao::validarCompatibilidadeModulo(); | |
268 | 270 | $objBD = new PenHipoteseLegalBD($this->inicializarObjInfraIBanco()); |
269 | 271 | $processoEletronicoRN = new ProcessoEletronicoRN(); |
270 | 272 | $hipotesesPen = $processoEletronicoRN->consultarHipotesesLegais(); |
271 | 273 | |
272 | 274 | if(empty($hipotesesPen)){ |
273 | - throw new InfraException('Não foi possível obter as hipóteses legais dos serviços de integração'); | |
275 | + throw new InfraException('Não foi possível obter as hipóteses legais dos serviços de integração'); | |
274 | 276 | } |
275 | 277 | |
276 | 278 | //Para cada hipótese vinda do PEN será verificado a existencia. | ... | ... |
rn/PendenciasTramiteRN.php
1 | -<?php | |
2 | - | |
3 | -require_once dirname(__FILE__) . '/../../../SEI.php'; | |
4 | - | |
5 | -error_reporting(E_ALL); | |
6 | - | |
7 | -//TODO: Modificar nome da classe e mtodo para outro mais apropriado | |
8 | -class PendenciasTramiteRN extends InfraRN { | |
9 | - | |
10 | - private static $instance = null; | |
11 | - private $strEnderecoServicoPendencias = null; | |
12 | - private $strLocalizacaoCertificadoDigital = null; | |
13 | - private $strSenhaCertificadoDigital = null; | |
14 | - | |
15 | - protected function inicializarObjInfraIBanco(){ | |
16 | - return BancoSEI::getInstance(); | |
17 | - } | |
18 | - | |
19 | - public static function getInstance() { | |
20 | - if (self::$instance == null) { | |
21 | - self::$instance = new PendenciasTramiteRN(ConfiguracaoSEI::getInstance(), SessaoSEI::getInstance(), BancoSEI::getInstance(), LogSEI::getInstance()); | |
22 | - } | |
23 | - | |
24 | - return self::$instance; | |
25 | - } | |
26 | - | |
27 | - public function __construct() { | |
28 | - $objPenParametroRN = new PenParametroRN(); | |
29 | - | |
30 | - $this->strLocalizacaoCertificadoDigital = $objPenParametroRN->getParametro('PEN_LOCALIZACAO_CERTIFICADO_DIGITAL'); | |
31 | - $this->strEnderecoServicoPendencias = $objPenParametroRN->getParametro('PEN_ENDERECO_WEBSERVICE_PENDENCIAS'); | |
32 | - //TODO: Urgente - Remover senha do certificado de autenticao dos servios do PEN da tabela de parâmetros | |
33 | - $this->strSenhaCertificadoDigital = $objPenParametroRN->getParametro('PEN_SENHA_CERTIFICADO_DIGITAL'); | |
34 | - | |
35 | - if (InfraString::isBolVazia($this->strEnderecoServicoPendencias)) { | |
36 | - throw new InfraException('Endereço do serviço de pendências de trâmite do Processo Eletrônico Nacional (PEN) não informado.'); | |
37 | - } | |
38 | - | |
39 | - if (!@file_get_contents($this->strLocalizacaoCertificadoDigital)) { | |
40 | - throw new InfraException("Certificado digital de autenticação do serviço de integração do Processo Eletrônico Nacional(PEN) não encontrado."); | |
41 | - } | |
42 | - | |
43 | - if (InfraString::isBolVazia($this->strSenhaCertificadoDigital)) { | |
44 | - throw new InfraException('Dados de autenticação do serviço de integração do Processo Eletrónico Nacional(PEN) não informados.'); | |
45 | - } | |
46 | - } | |
47 | - | |
48 | - public function monitorarPendencias() { | |
49 | - try{ | |
50 | - ini_set('max_execution_time','0'); | |
51 | - ini_set('memory_limit','-1'); | |
52 | - | |
53 | - InfraDebug::getInstance()->setBolLigado(true); | |
54 | - InfraDebug::getInstance()->setBolDebugInfra(false); | |
55 | - InfraDebug::getInstance()->setBolEcho(false); | |
56 | - InfraDebug::getInstance()->limpar(); | |
57 | - | |
58 | - $objPenParametroRN = new PenParametroRN(); | |
59 | - SessaoSEI::getInstance(false)->simularLogin('SEI', null, null, $objPenParametroRN->getParametro('PEN_UNIDADE_GERADORA_DOCUMENTO_RECEBIDO')); | |
60 | - | |
61 | - $numSeg = InfraUtil::verificarTempoProcessamento(); | |
62 | - InfraDebug::getInstance()->gravar('MONITORANDO OS TRÂMITES PENDENTES ENVIADOS PARA O RGO (PEN)'); | |
63 | - echo "[".date("d/m/Y H:i:s")."] Iniciando serviço de monitoramento de pendências de trâmites de processos...\n"; | |
64 | - | |
65 | - try{ | |
66 | - $numIdTramiteRecebido = 0; | |
67 | - $strStatusTramiteRecebido = ''; | |
68 | - $numQuantidadeErroTramite = 0; | |
69 | - $arrQuantidadeErrosTramite = array(); | |
70 | - | |
71 | - //TODO: Tratar quantidade de erros o sistema consecutivos para um tramite de processo | |
72 | - //Alcanado est quantidade, uma pendncia posterior dever ser obtida do barramento | |
73 | - while (true) { | |
74 | - $objPendenciaDTO = $this->obterPendenciasTramite($numIdTramiteRecebido); | |
75 | - if(isset($objPendenciaDTO)) { | |
76 | - if($numIdTramiteRecebido != $objPendenciaDTO->getNumIdentificacaoTramite() || | |
77 | - $strStatusTramiteRecebido != $objPendenciaDTO->getStrStatus()) { | |
78 | - $numIdTramiteRecebido = $objPendenciaDTO->getNumIdentificacaoTramite(); | |
79 | - $strStatusTramiteRecebido = $objPendenciaDTO->getStrStatus(); | |
80 | - $this->enviarPendenciaFilaProcessamento($objPendenciaDTO); | |
81 | - } | |
82 | - } | |
83 | - sleep(5); | |
84 | - } | |
85 | - } | |
86 | - //TODO: Urgente: Tratar erro especfico de timeout e refazer a requisio | |
87 | - catch(Exception $e) { | |
88 | - $strAssunto = 'Erro monitorando pendências.'; | |
89 | - $strErro = InfraException::inspecionar($e); | |
90 | - LogSEI::getInstance()->gravar($strAssunto."\n\n".$strErro); | |
91 | - } | |
92 | - | |
93 | - $numSeg = InfraUtil::verificarTempoProcessamento($numSeg); | |
94 | - InfraDebug::getInstance()->gravar('TEMPO TOTAL DE EXECUCAO: '.$numSeg.' s'); | |
95 | - InfraDebug::getInstance()->gravar('FIM'); | |
96 | - LogSEI::getInstance()->gravar(InfraDebug::getInstance()->getStrDebug()); | |
97 | - | |
98 | - } | |
99 | - catch(Exception $e) { | |
100 | - InfraDebug::getInstance()->setBolLigado(false); | |
101 | - InfraDebug::getInstance()->setBolDebugInfra(false); | |
102 | - InfraDebug::getInstance()->setBolEcho(false); | |
103 | - throw new InfraException('Erro processando pendências de integração com o PEN - Processo Eletrônico Nacional.',$e); | |
104 | - } | |
105 | - } | |
106 | - | |
107 | - private function configurarRequisicao() | |
108 | - { | |
109 | - $curl = curl_init($this->strEnderecoServicoPendencias); | |
110 | - curl_setopt($curl, CURLOPT_URL, $this->strEnderecoServicoPendencias); | |
111 | - curl_setopt($curl, CURLOPT_HEADER, 0); | |
112 | - curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); | |
113 | - curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); | |
114 | - curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); | |
115 | - curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); | |
116 | - curl_setopt($curl, CURLOPT_SSLCERT, $this->strLocalizacaoCertificadoDigital); | |
117 | - curl_setopt($curl, CURLOPT_SSLCERTPASSWD, $this->strSenhaCertificadoDigital); | |
118 | - curl_setopt($curl, CURLOPT_TIMEOUT, 60); //timeout in seconds | |
119 | - return $curl; | |
120 | - } | |
121 | - | |
122 | - private function obterPendenciasTramite($parNumIdTramiteRecebido) | |
123 | - { | |
124 | - $resultado = null; | |
125 | - $curl = $this->configurarRequisicao(); | |
126 | - | |
127 | - try{ | |
128 | - if(isset($parNumIdTramiteRecebido)) { | |
129 | - curl_setopt($curl, CURLOPT_URL, $this->strEnderecoServicoPendencias . "?idTramiteDaPendenciaRecebida=" . $parNumIdTramiteRecebido); | |
130 | - } | |
131 | - | |
132 | - //A seguinte requisio ir aguardar a notificao do PEN sobre uma nova pendncia | |
133 | - //ou at o lanamento da exceo de timeout definido pela infraestrutura da soluo | |
134 | - //Ambos os comportamentos so esperados para a requisio abaixo. | |
135 | - $strResultadoJSON = curl_exec($curl); | |
136 | - | |
137 | - if(curl_errno($curl)) { | |
138 | - if (curl_errno($curl) != 28) | |
139 | - throw new InfraException("Erro na requisição do serviço de monitoramento de pendências. Curl: " . curl_errno($curl)); | |
140 | - } | |
141 | - | |
142 | - if(!InfraString::isBolVazia($strResultadoJSON)) { | |
143 | - $strResultadoJSON = json_decode($strResultadoJSON); | |
144 | - | |
145 | - if(isset($strResultadoJSON) && $strResultadoJSON->encontrou) { | |
146 | - $objPendenciaDTO = new PendenciaDTO(); | |
147 | - $objPendenciaDTO->setNumIdentificacaoTramite($strResultadoJSON->IDT); | |
148 | - $objPendenciaDTO->setStrStatus($strResultadoJSON->status); | |
149 | - $resultado = $objPendenciaDTO; | |
150 | - } | |
151 | - } | |
152 | - } | |
153 | - catch(Exception $e){ | |
154 | - curl_close($curl); | |
155 | - throw $e; | |
156 | - } | |
157 | - | |
158 | - curl_close($curl); | |
159 | - return $resultado; | |
160 | - } | |
161 | - | |
162 | - private function enviarPendenciaFilaProcessamento($objPendencia) | |
163 | - { | |
164 | - if(isset($objPendencia)) { | |
165 | - | |
166 | - $client = new GearmanClient(); | |
167 | - $client->addServer('localhost', 4730); | |
168 | - //$client->setCreatedCallback("create_change"); | |
169 | - //$client->setDataCallback("data_change"); | |
170 | - //$client->setStatusCallback("status_change"); | |
171 | - //$client->setCompleteCallback("complete_change"); | |
172 | - //$client->setFailCallback("fail_change"); | |
173 | - | |
174 | - $strWorkload = strval($objPendencia->getNumIdentificacaoTramite()); | |
175 | - | |
176 | - switch ($objPendencia->getStrStatus()) { | |
177 | - | |
178 | - case ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_INICIADO: | |
179 | - $client->addTaskBackground('enviarComponenteDigital', $strWorkload, null); | |
180 | - break; | |
181 | - | |
182 | - case ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_COMPONENTES_ENVIADOS_REMETENTE: | |
183 | - case ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_METADADOS_RECEBIDO_DESTINATARIO: | |
184 | - case ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_COMPONENTES_RECEBIDOS_DESTINATARIO: | |
185 | - $objPenParametroRN = new PenParametroRN(); | |
186 | - $numTentativas = $objPenParametroRN->getParametro(PenTramiteProcessadoRN::PARAM_NUMERO_TENTATIVAS, false); | |
187 | - $numCont = 0; | |
188 | - // Executa sempre + 1 alm do configurado no parâmetro para executar a recusa | |
189 | - while($numCont <= $numTentativas) { | |
190 | - $client->addTaskBackground('receberProcedimento', $strWorkload, null); | |
191 | - $numCont++; | |
192 | - } | |
193 | - break; | |
194 | - | |
195 | - case ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_RECIBO_ENVIADO_DESTINATARIO: | |
196 | - $objPenParametroRN = new PenParametroRN(); | |
197 | - $numTentativas = $objPenParametroRN->getParametro(PenTramiteProcessadoRN::PARAM_NUMERO_TENTATIVAS, false); | |
198 | - $numCont = 0; | |
199 | - | |
200 | - while($numCont < $numTentativas) { | |
201 | - $client->addTaskBackground('receberReciboTramite', $strWorkload, null); | |
202 | - $numCont++; | |
203 | - } | |
204 | - break; | |
205 | - | |
206 | - case ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_RECIBO_RECEBIDO_REMETENTE: | |
207 | - break; | |
208 | - | |
209 | - case ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_CANCELADO: | |
210 | - break; | |
211 | - | |
212 | - case ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_RECUSADO: | |
213 | - $client->addTaskBackground("receberTramitesRecusados", $strWorkload, null);; | |
214 | - break; | |
215 | - | |
216 | - default: | |
217 | - //TODO: Alterar lgica para no deixar de processar demais pendncias retornadas pelo PEN | |
218 | - throw new Exception('Situação do trâmite não pode ser identificada.'); | |
219 | - break; | |
220 | - } | |
221 | - | |
222 | - $client->runTasks(); | |
223 | - } | |
224 | - } | |
225 | -} | |
226 | - | |
227 | -SessaoSEI::getInstance(false); | |
228 | -PendenciasTramiteRN::getInstance()->monitorarPendencias(); | |
1 | +<?php | |
2 | + | |
3 | +require_once dirname(__FILE__) . '/../../../SEI.php'; | |
4 | + | |
5 | +error_reporting(E_ALL); | |
6 | + | |
7 | +//TODO: Modificar nome da classe e mtodo para outro mais apropriado | |
8 | +class PendenciasTramiteRN extends InfraRN { | |
9 | + | |
10 | + private static $instance = null; | |
11 | + private $strEnderecoServicoPendencias = null; | |
12 | + private $strLocalizacaoCertificadoDigital = null; | |
13 | + private $strSenhaCertificadoDigital = null; | |
14 | + | |
15 | + protected function inicializarObjInfraIBanco(){ | |
16 | + return BancoSEI::getInstance(); | |
17 | + } | |
18 | + | |
19 | + public static function getInstance() { | |
20 | + if (self::$instance == null) { | |
21 | + self::$instance = new PendenciasTramiteRN(ConfiguracaoSEI::getInstance(), SessaoSEI::getInstance(), BancoSEI::getInstance(), LogSEI::getInstance()); | |
22 | + } | |
23 | + | |
24 | + return self::$instance; | |
25 | + } | |
26 | + | |
27 | + public function __construct() { | |
28 | + $objPenParametroRN = new PenParametroRN(); | |
29 | + | |
30 | + $this->strLocalizacaoCertificadoDigital = $objPenParametroRN->getParametro('PEN_LOCALIZACAO_CERTIFICADO_DIGITAL'); | |
31 | + $this->strEnderecoServicoPendencias = $objPenParametroRN->getParametro('PEN_ENDERECO_WEBSERVICE_PENDENCIAS'); | |
32 | + //TODO: Urgente - Remover senha do certificado de autenticao dos servios do PEN da tabela de parâmetros | |
33 | + $this->strSenhaCertificadoDigital = $objPenParametroRN->getParametro('PEN_SENHA_CERTIFICADO_DIGITAL'); | |
34 | + | |
35 | + if (InfraString::isBolVazia($this->strEnderecoServicoPendencias)) { | |
36 | + throw new InfraException('Endereço do serviço de pendências de trâmite do Processo Eletrônico Nacional (PEN) não informado.'); | |
37 | + } | |
38 | + | |
39 | + if (!@file_get_contents($this->strLocalizacaoCertificadoDigital)) { | |
40 | + throw new InfraException("Certificado digital de autenticação do serviço de integração do Processo Eletrônico Nacional(PEN) não encontrado."); | |
41 | + } | |
42 | + | |
43 | + if (InfraString::isBolVazia($this->strSenhaCertificadoDigital)) { | |
44 | + throw new InfraException('Dados de autenticação do serviço de integração do Processo Eletrónico Nacional(PEN) não informados.'); | |
45 | + } | |
46 | + } | |
47 | + | |
48 | + public function monitorarPendencias() { | |
49 | + try{ | |
50 | + ini_set('max_execution_time','0'); | |
51 | + ini_set('memory_limit','-1'); | |
52 | + | |
53 | + InfraDebug::getInstance()->setBolLigado(false); | |
54 | + InfraDebug::getInstance()->setBolDebugInfra(false); | |
55 | + InfraDebug::getInstance()->setBolEcho(false); | |
56 | + InfraDebug::getInstance()->limpar(); | |
57 | + | |
58 | + PENIntegracao::validarCompatibilidadeModulo(); | |
59 | + | |
60 | + $objPenParametroRN = new PenParametroRN(); | |
61 | + SessaoSEI::getInstance(false)->simularLogin('SEI', null, null, $objPenParametroRN->getParametro('PEN_UNIDADE_GERADORA_DOCUMENTO_RECEBIDO')); | |
62 | + | |
63 | + $numSeg = InfraUtil::verificarTempoProcessamento(); | |
64 | + InfraDebug::getInstance()->gravar('MONITORANDO OS TRÂMITES PENDENTES ENVIADOS PARA O RGO (PEN)'); | |
65 | + echo "[".date("d/m/Y H:i:s")."] Iniciando serviço de monitoramento de pendências de trâmites de processos...\n"; | |
66 | + | |
67 | + try{ | |
68 | + $numIdTramiteRecebido = 0; | |
69 | + $strStatusTramiteRecebido = ''; | |
70 | + $numQuantidadeErroTramite = 0; | |
71 | + $arrQuantidadeErrosTramite = array(); | |
72 | + | |
73 | + //TODO: Tratar quantidade de erros o sistema consecutivos para um tramite de processo | |
74 | + //Alcanado est quantidade, uma pendncia posterior dever ser obtida do barramento | |
75 | + while (true) { | |
76 | + $objPendenciaDTO = $this->obterPendenciasTramite($numIdTramiteRecebido); | |
77 | + if(isset($objPendenciaDTO)) { | |
78 | + if($numIdTramiteRecebido != $objPendenciaDTO->getNumIdentificacaoTramite() || | |
79 | + $strStatusTramiteRecebido != $objPendenciaDTO->getStrStatus()) { | |
80 | + $numIdTramiteRecebido = $objPendenciaDTO->getNumIdentificacaoTramite(); | |
81 | + $strStatusTramiteRecebido = $objPendenciaDTO->getStrStatus(); | |
82 | + $this->enviarPendenciaFilaProcessamento($objPendenciaDTO); | |
83 | + } | |
84 | + } | |
85 | + sleep(5); | |
86 | + } | |
87 | + } | |
88 | + //TODO: Urgente: Tratar erro especfico de timeout e refazer a requisio | |
89 | + catch(Exception $e) { | |
90 | + $strAssunto = 'Erro monitorando pendências.'; | |
91 | + $strErro = InfraException::inspecionar($e); | |
92 | + LogSEI::getInstance()->gravar($strAssunto."\n\n".$strErro); | |
93 | + } | |
94 | + | |
95 | + $numSeg = InfraUtil::verificarTempoProcessamento($numSeg); | |
96 | + InfraDebug::getInstance()->gravar('TEMPO TOTAL DE EXECUCAO: '.$numSeg.' s'); | |
97 | + InfraDebug::getInstance()->gravar('FIM'); | |
98 | + LogSEI::getInstance()->gravar(InfraDebug::getInstance()->getStrDebug()); | |
99 | + | |
100 | + } | |
101 | + catch(Exception $e) { | |
102 | + InfraDebug::getInstance()->setBolLigado(false); | |
103 | + InfraDebug::getInstance()->setBolDebugInfra(false); | |
104 | + InfraDebug::getInstance()->setBolEcho(false); | |
105 | + throw new InfraException('Erro processando pendências de integração com o PEN - Processo Eletrônico Nacional.',$e); | |
106 | + } | |
107 | + } | |
108 | + | |
109 | + private function configurarRequisicao() | |
110 | + { | |
111 | + $curl = curl_init($this->strEnderecoServicoPendencias); | |
112 | + curl_setopt($curl, CURLOPT_URL, $this->strEnderecoServicoPendencias); | |
113 | + curl_setopt($curl, CURLOPT_HEADER, 0); | |
114 | + curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); | |
115 | + curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); | |
116 | + curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); | |
117 | + curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); | |
118 | + curl_setopt($curl, CURLOPT_SSLCERT, $this->strLocalizacaoCertificadoDigital); | |
119 | + curl_setopt($curl, CURLOPT_SSLCERTPASSWD, $this->strSenhaCertificadoDigital); | |
120 | + curl_setopt($curl, CURLOPT_TIMEOUT, 60); //timeout in seconds | |
121 | + return $curl; | |
122 | + } | |
123 | + | |
124 | + private function obterPendenciasTramite($parNumIdTramiteRecebido) | |
125 | + { | |
126 | + $resultado = null; | |
127 | + $curl = $this->configurarRequisicao(); | |
128 | + | |
129 | + try{ | |
130 | + if(isset($parNumIdTramiteRecebido)) { | |
131 | + curl_setopt($curl, CURLOPT_URL, $this->strEnderecoServicoPendencias . "?idTramiteDaPendenciaRecebida=" . $parNumIdTramiteRecebido); | |
132 | + } | |
133 | + | |
134 | + //A seguinte requisio ir aguardar a notificao do PEN sobre uma nova pendncia | |
135 | + //ou at o lanamento da exceo de timeout definido pela infraestrutura da soluo | |
136 | + //Ambos os comportamentos so esperados para a requisio abaixo. | |
137 | + $strResultadoJSON = curl_exec($curl); | |
138 | + | |
139 | + if(curl_errno($curl)) { | |
140 | + if (curl_errno($curl) != 28) | |
141 | + throw new InfraException("Erro na requisição do serviço de monitoramento de pendências. Curl: " . curl_errno($curl)); | |
142 | + } | |
143 | + | |
144 | + if(!InfraString::isBolVazia($strResultadoJSON)) { | |
145 | + $strResultadoJSON = json_decode($strResultadoJSON); | |
146 | + | |
147 | + if(isset($strResultadoJSON) && $strResultadoJSON->encontrou) { | |
148 | + $objPendenciaDTO = new PendenciaDTO(); | |
149 | + $objPendenciaDTO->setNumIdentificacaoTramite($strResultadoJSON->IDT); | |
150 | + $objPendenciaDTO->setStrStatus($strResultadoJSON->status); | |
151 | + $resultado = $objPendenciaDTO; | |
152 | + } | |
153 | + } | |
154 | + } | |
155 | + catch(Exception $e){ | |
156 | + curl_close($curl); | |
157 | + throw $e; | |
158 | + } | |
159 | + | |
160 | + curl_close($curl); | |
161 | + return $resultado; | |
162 | + } | |
163 | + | |
164 | + private function enviarPendenciaFilaProcessamento($objPendencia) | |
165 | + { | |
166 | + if(isset($objPendencia)) { | |
167 | + | |
168 | + $client = new GearmanClient(); | |
169 | + $client->addServer('localhost', 4730); | |
170 | + //$client->setCreatedCallback("create_change"); | |
171 | + //$client->setDataCallback("data_change"); | |
172 | + //$client->setStatusCallback("status_change"); | |
173 | + //$client->setCompleteCallback("complete_change"); | |
174 | + //$client->setFailCallback("fail_change"); | |
175 | + | |
176 | + $strWorkload = strval($objPendencia->getNumIdentificacaoTramite()); | |
177 | + | |
178 | + switch ($objPendencia->getStrStatus()) { | |
179 | + | |
180 | + case ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_INICIADO: | |
181 | + $client->addTaskBackground('enviarComponenteDigital', $strWorkload, null); | |
182 | + break; | |
183 | + | |
184 | + case ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_COMPONENTES_ENVIADOS_REMETENTE: | |
185 | + case ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_METADADOS_RECEBIDO_DESTINATARIO: | |
186 | + case ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_COMPONENTES_RECEBIDOS_DESTINATARIO: | |
187 | + $objPenParametroRN = new PenParametroRN(); | |
188 | + $numTentativas = $objPenParametroRN->getParametro(PenTramiteProcessadoRN::PARAM_NUMERO_TENTATIVAS, false); | |
189 | + $numCont = 0; | |
190 | + // Executa sempre + 1 alm do configurado no parâmetro para executar a recusa | |
191 | + while($numCont <= $numTentativas) { | |
192 | + $client->addTaskBackground('receberProcedimento', $strWorkload, null); | |
193 | + $numCont++; | |
194 | + } | |
195 | + break; | |
196 | + | |
197 | + case ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_RECIBO_ENVIADO_DESTINATARIO: | |
198 | + $objPenParametroRN = new PenParametroRN(); | |
199 | + $numTentativas = $objPenParametroRN->getParametro(PenTramiteProcessadoRN::PARAM_NUMERO_TENTATIVAS, false); | |
200 | + $numCont = 0; | |
201 | + | |
202 | + while($numCont < $numTentativas) { | |
203 | + $client->addTaskBackground('receberReciboTramite', $strWorkload, null); | |
204 | + $numCont++; | |
205 | + } | |
206 | + break; | |
207 | + | |
208 | + case ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_RECIBO_RECEBIDO_REMETENTE: | |
209 | + break; | |
210 | + | |
211 | + case ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_CANCELADO: | |
212 | + break; | |
213 | + | |
214 | + case ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_RECUSADO: | |
215 | + $client->addTaskBackground("receberTramitesRecusados", $strWorkload, null);; | |
216 | + break; | |
217 | + | |
218 | + default: | |
219 | + //TODO: Alterar lgica para no deixar de processar demais pendncias retornadas pelo PEN | |
220 | + throw new Exception('Situação do trâmite não pode ser identificada.'); | |
221 | + break; | |
222 | + } | |
223 | + | |
224 | + $client->runTasks(); | |
225 | + } | |
226 | + } | |
227 | +} | |
228 | + | |
229 | +SessaoSEI::getInstance(false); | |
230 | +PendenciasTramiteRN::getInstance()->monitorarPendencias(); | ... | ... |
rn/ProcessarPendenciasRN.php
... | ... | @@ -2,194 +2,176 @@ |
2 | 2 | |
3 | 3 | require_once dirname(__FILE__) . '/../../../SEI.php'; |
4 | 4 | |
5 | -class ProcessarPendenciasRN extends InfraAgendamentoTarefa { | |
6 | - | |
7 | - private static $instance = null; | |
8 | - private $objGearmanWorker = null; | |
9 | - | |
10 | - protected function inicializarObjInfraIBanco(){ | |
11 | - return BancoSEI::getInstance(); | |
12 | - } | |
13 | - | |
14 | - public static function getInstance() { | |
15 | - if (self::$instance == null) { | |
16 | - self::$instance = new ProcessarPendenciasRN(ConfiguracaoSEI::getInstance(), SessaoSEI::getInstance(), BancoSEI::getInstance(), LogSEI::getInstance()); | |
5 | +class ProcessarPendenciasRN extends InfraAgendamentoTarefa | |
6 | +{ | |
7 | + private static $instance = null; | |
8 | + private $objGearmanWorker = null; | |
9 | + | |
10 | + protected function inicializarObjInfraIBanco() | |
11 | + { | |
12 | + return BancoSEI::getInstance(); | |
17 | 13 | } |
18 | - return self::$instance; | |
19 | - } | |
20 | - | |
21 | - public function __construct() { | |
22 | - //Configuração do worker do Gearman para realizar o processamento de tarefas | |
23 | - $this->objGearmanWorker = new GearmanWorker(); | |
24 | - $this->objGearmanWorker->addServer('localhost', 4730); | |
25 | - $this->configurarCallbacks(); | |
26 | - } | |
27 | - | |
28 | - public function processarPendencias() | |
29 | - { | |
30 | - try{ | |
31 | - ini_set('max_execution_time','0'); | |
32 | - ini_set('memory_limit','-1'); | |
33 | - | |
34 | - InfraDebug::getInstance()->setBolLigado(true); | |
35 | - InfraDebug::getInstance()->setBolDebugInfra(true); | |
36 | - InfraDebug::getInstance()->setBolEcho(false); | |
37 | - InfraDebug::getInstance()->limpar(); | |
38 | - | |
39 | - $objPenParametroRN = new PenParametroRN(); | |
40 | - SessaoSEI::getInstance(false)->simularLogin('SEI', null, null, $objPenParametroRN->getParametro('PEN_UNIDADE_GERADORA_DOCUMENTO_RECEBIDO')); | |
41 | - | |
42 | - $numSeg = InfraUtil::verificarTempoProcessamento(); | |
43 | - | |
44 | - InfraDebug::getInstance()->gravar('ANALISANDO OS TRÂMITES PENDENTES ENVIADOS PARA O ÓRGÃO (PEN)'); | |
45 | - echo "[".date("d/m/Y H:i:s")."] Iniciando serviço de processamento de pendências de trâmites de processos...\n"; | |
46 | - | |
47 | - while($this->objGearmanWorker->work()) | |
48 | - { | |
49 | - if ($this->objGearmanWorker->returnCode() != GEARMAN_SUCCESS) | |
50 | - { | |
51 | - $strAssunto = 'Erro executando agendamentos'; | |
52 | - $strErro = InfraException::inspecionar($e); | |
53 | - echo $strAssunto."\n\n".$strErro; | |
54 | - LogSEI::getInstance()->gravar($strAssunto."\n\n".$strErro); | |
55 | - break; | |
56 | - } | |
14 | + | |
15 | + public static function getInstance() | |
16 | + { | |
17 | + if (self::$instance == null) { | |
18 | + self::$instance = new ProcessarPendenciasRN(ConfiguracaoSEI::getInstance(), SessaoSEI::getInstance(), BancoSEI::getInstance(), LogSEI::getInstance()); | |
57 | 19 | } |
20 | + return self::$instance; | |
21 | + } | |
58 | 22 | |
59 | - $numSeg = InfraUtil::verificarTempoProcessamento($numSeg); | |
60 | - InfraDebug::getInstance()->gravar('TEMPO TOTAL DE EXECUCAO: '.$numSeg.' s'); | |
61 | - InfraDebug::getInstance()->gravar('FIM'); | |
62 | - LogSEI::getInstance()->gravar(InfraDebug::getInstance()->getStrDebug()); | |
63 | - } | |
64 | - catch(Exception $e){ | |
65 | - $strAssunto = 'Agendamento FALHOU'; | |
66 | - $strErro = ''; | |
67 | - $strErro .= 'Servidor: '.gethostname()."\n\n"; | |
68 | - $strErro .= 'Data/Hora: '.InfraData::getStrDataHoraAtual()."\n\n"; | |
69 | - $strErro .= 'Erro: '.InfraException::inspecionar($e); | |
70 | - LogSEI::getInstance()->gravar($strAssunto."\n\n".$strErro); | |
23 | + public function __construct() | |
24 | + { | |
25 | + //Configuração do worker do Gearman para realizar o processamento de tarefas | |
26 | + $this->objGearmanWorker = new GearmanWorker(); | |
27 | + $this->objGearmanWorker->addServer('localhost', 4730); | |
28 | + $this->configurarCallbacks(); | |
71 | 29 | } |
72 | - } | |
73 | - | |
74 | - private function configurarCallbacks() | |
75 | - { | |
76 | - //PROCESSAMENTO DE TAREFAS RELACIONADAS AO ENVIO DE UM PROCESSO ELETRÔNICO | |
77 | - ////////////////////////////////////////////////////////////////////////// | |
78 | - | |
79 | - //Etapa 01 - Processamento de pendências envio dos metadados do processo | |
80 | - $this->objGearmanWorker->addFunction("enviarProcesso", function ($job) { | |
81 | - | |
82 | - InfraDebug::getInstance()->gravar("[".date("d/m/Y H:i:s")."] Processando tarefa [enviarProcesso] " . $job->workload()); | |
83 | - //TODO: Implementar tarefa relacionada | |
84 | - //... | |
85 | - | |
86 | - //Agendamento de nova tarefa para envio dos componentes digitais do processo | |
87 | - //$this->objGearmanClient->addTask("enviarComponenteDigital", $numIdentificacaoTramite, null); | |
88 | - | |
89 | - }); | |
90 | - | |
91 | - //Etapa 02 - Processamento de pendências envio dos componentes digitais do processo | |
92 | - $this->objGearmanWorker->addFunction("enviarComponenteDigital", function ($job) { | |
93 | - | |
94 | - InfraDebug::getInstance()->gravar("[".date("d/m/Y H:i:s")."] Processando tarefa [enviarComponenteDigital] " . $job->workload()); | |
95 | - //TODO: Implementar tarefa relacionada | |
96 | - //... | |
97 | - | |
98 | - //Agendamento de nova tarefa para recebimento do recibo de envio do processo | |
99 | - //$this->objGearmanClient->addTask("receberReciboTramite", $numIdentificacaoTramite, null); | |
100 | - | |
101 | - }); | |
102 | - | |
103 | - //Etapa 03 - Processamento de pendências de recebimento do recibo de envio do processo | |
104 | - $this->objGearmanWorker->addFunction("receberReciboTramite", function ($job) { | |
105 | - | |
106 | - $numIdentificacaoTramite = intval($job->workload()); | |
107 | - | |
108 | - InfraDebug::getInstance()->gravar("[".date("d/m/Y H:i:s")."] Processando tarefa [receberReciboTramite] " . $job->workload()); | |
109 | - //TODO: Implementar tarefa relacionada | |
110 | - | |
111 | - $objPenTramiteProcessadoRN = new PenTramiteProcessadoRN(PenTramiteProcessadoRN::STR_TIPO_RECIBO); | |
112 | - | |
113 | - if(!$objPenTramiteProcessadoRN->isProcedimentoRecebido($numIdentificacaoTramite)){ | |
114 | - | |
115 | - $objReceberReciboTramiteRN = new ReceberReciboTramiteRN(); | |
116 | - $objReceberReciboTramiteRN->receberReciboDeTramite($numIdentificacaoTramite); | |
30 | + | |
31 | + public function processarPendencias() | |
32 | + { | |
33 | + try{ | |
34 | + ini_set('max_execution_time','0'); | |
35 | + ini_set('memory_limit','-1'); | |
36 | + | |
37 | + InfraDebug::getInstance()->setBolLigado(false); | |
38 | + InfraDebug::getInstance()->setBolDebugInfra(false); | |
39 | + InfraDebug::getInstance()->setBolEcho(false); | |
40 | + InfraDebug::getInstance()->limpar(); | |
41 | + | |
42 | + PENIntegracao::validarCompatibilidadeModulo(); | |
43 | + | |
44 | + $objPenParametroRN = new PenParametroRN(); | |
45 | + SessaoSEI::getInstance(false)->simularLogin('SEI', null, null, $objPenParametroRN->getParametro('PEN_UNIDADE_GERADORA_DOCUMENTO_RECEBIDO')); | |
46 | + | |
47 | + $numSeg = InfraUtil::verificarTempoProcessamento(); | |
48 | + | |
49 | + InfraDebug::getInstance()->gravar('ANALISANDO OS TRÂMITES PENDENTES ENVIADOS PARA O ÓRGÃO (PEN)'); | |
50 | + echo "[".date("d/m/Y H:i:s")."] Iniciando serviço de processamento de pendências de trâmites de processos...\n"; | |
51 | + | |
52 | + while($this->objGearmanWorker->work()) | |
53 | + { | |
54 | + if ($this->objGearmanWorker->returnCode() != GEARMAN_SUCCESS) { | |
55 | + $strErro = 'Erro no processamento de pendências do PEN. ErrorCode: ' . $this->objGearmanWorker->returnCode(); | |
56 | + LogSEI::getInstance()->gravar($strErro); | |
57 | + break; | |
58 | + } | |
59 | + } | |
60 | + | |
61 | + $numSeg = InfraUtil::verificarTempoProcessamento($numSeg); | |
62 | + InfraDebug::getInstance()->gravar('TEMPO TOTAL DE EXECUCAO: '.$numSeg.' s'); | |
63 | + InfraDebug::getInstance()->gravar('FIM'); | |
64 | + LogSEI::getInstance()->gravar(InfraDebug::getInstance()->getStrDebug()); | |
117 | 65 | } |
118 | - }); | |
119 | - | |
120 | - | |
121 | - //PROCESSAMENTO DE TAREFAS RELACIONADAS AO RECEBIMENTO DE UM PROCESSO ELETRÔNICO | |
122 | - ////////////////////////////////////////////////////////////////////////// | |
123 | - | |
124 | - //Processamento de pendências de recebimento dos metadados do processo | |
125 | - $this->objGearmanWorker->addFunction("receberProcedimento", function ($job) { | |
126 | - | |
127 | - $numIdentificacaoTramite = intval($job->workload()); | |
128 | - | |
129 | - InfraDebug::getInstance()->gravar("[".date("d/m/Y H:i:s")."] Processando tarefa [receberProcedimento] " . $job->workload()); | |
130 | - | |
131 | - $objPenTramiteProcessadoRN = new PenTramiteProcessadoRN(PenTramiteProcessadoRN::STR_TIPO_PROCESSO); | |
132 | - | |
133 | - if(!$objPenTramiteProcessadoRN->isProcedimentoRecebido($numIdentificacaoTramite)){ | |
134 | - | |
135 | - $objReceberProcedimentoRN = new ReceberProcedimentoRN(); | |
136 | - $objReceberProcedimentoRN->receberProcedimento($numIdentificacaoTramite); | |
137 | - | |
138 | - //TODO: A próxima etapa deveria ser o recebimento dos componentes digitais, rotina tradada na função receberProcedimento(...) | |
139 | - //Agendamento de nova tarefa para envio do recibo de conclusão do trãmite | |
140 | - //ProcessarPendenciasRN::processarTarefa("enviarReciboTramiteProcesso", $job->workload()); | |
141 | - | |
142 | - /* $objEnviarReciboTramiteRN = new EnviarReciboTramiteRN(); | |
143 | - $objEnviarReciboTramiteRN->enviarReciboTramiteProcesso($numIdentificacaoTramite, $arrayHash);*/ | |
66 | + catch(Exception $e) { | |
67 | + $strAssunto = 'Falha no processamento de pendências do PEN'; | |
68 | + $strErro = ''; | |
69 | + $strErro .= 'Servidor: '.gethostname()."\n\n"; | |
70 | + $strErro .= 'Data/Hora: '.InfraData::getStrDataHoraAtual()."\n\n"; | |
71 | + $strErro .= 'Erro: '.InfraException::inspecionar($e); | |
72 | + LogSEI::getInstance()->gravar($strAssunto."\n\n".$strErro); | |
144 | 73 | } |
145 | - }); | |
146 | - | |
147 | - // Verifica no barramento os procedimentos que foram enviados por esta unidade | |
148 | - // e foram recusados pelas mesmas | |
149 | - $this->objGearmanWorker->addFunction("receberTramitesRecusados", function ($job) { | |
150 | - | |
151 | - InfraDebug::getInstance()->gravar("[".date("d/m/Y H:i:s")."] Processando tarefa [receberRecusaTramite] " . $job->workload()); | |
152 | - $numIdentificacaoTramite = intval($job->workload()); | |
153 | - | |
154 | - $objReceberProcedimentoRN = new ReceberProcedimentoRN(); | |
155 | - $objReceberProcedimentoRN->receberTramitesRecusados($numIdentificacaoTramite); | |
156 | - }); | |
157 | - | |
158 | - //Processamento de pendências de recebimento dos componentes digitais do processo | |
159 | - $this->objGearmanWorker->addFunction("receberComponenteDigital", function ($job) { | |
160 | - | |
161 | - InfraDebug::getInstance()->gravar("[".date("d/m/Y H:i:s")."] Processando tarefa [receberComponenteDigital] " . $job->workload()); | |
162 | - //TODO: A próxima etapa deveria ser o recebimento dos componentes digitais, rotina tradada na função receberProcedimento(...) | |
163 | - //... | |
164 | - | |
165 | - //Agendamento de nova tarefa para envio do recibo de conclusão do trâmite | |
166 | - ProcessarPendenciasRN::processarTarefa("enviarReciboTramiteProcesso", $job->workload()); | |
167 | - //$this->objGearmanClient->addTaskBackground("enviarReciboTramiteProcesso", $numIdentificacaoTramite, null); | |
168 | - }); | |
169 | - | |
170 | - //Processamento de pendências de envio do recibo de conclusão do trãmite do processo | |
171 | - $this->objGearmanWorker->addFunction("enviarReciboTramiteProcesso", function ($job) { | |
172 | - | |
173 | - InfraDebug::getInstance()->gravar("[".date("d/m/Y H:i:s")."] Processando tarefa [enviarReciboTramiteProcesso] " . $job->workload()); | |
174 | - | |
175 | - $numIdentificacaoTramite = intval($job->workload()); | |
176 | - $objEnviarReciboTramiteRN = new EnviarReciboTramiteRN(); | |
177 | - $objEnviarReciboTramiteRN->enviarReciboTramiteProcesso($numIdentificacaoTramite); | |
178 | - }); | |
179 | - } | |
180 | - | |
181 | - static function processarTarefa($strNomeTarefa, $strWorkload) | |
182 | - { | |
183 | - $objClient = new GearmanClient(); | |
184 | - $objClient->addServer('localhost', 4730); | |
185 | - //$objClient->addTaskBackground($strNomeTarefa, $strWorkload); | |
186 | - //$objClient->runTasks(); | |
187 | - $objClient->doBackground($strNomeTarefa, $strWorkload); | |
188 | - } | |
74 | + } | |
75 | + | |
76 | + private function configurarCallbacks() | |
77 | + { | |
78 | + | |
79 | + //PROCESSAMENTO DE TAREFAS RELACIONADAS AO ENVIO DE UM PROCESSO ELETRÔNICO | |
80 | + ////////////////////////////////////////////////////////////////////////// | |
81 | + | |
82 | + //Etapa 01 - Processamento de pendências envio dos metadados do processo | |
83 | + $this->objGearmanWorker->addFunction("enviarProcesso", function ($job) { | |
84 | + | |
85 | + InfraDebug::getInstance()->gravar("[".date("d/m/Y H:i:s")."] Processando tarefa [enviarProcesso] " . $job->workload()); | |
86 | + //TODO: Implementar tarefa relacionada | |
87 | + //... | |
88 | + | |
89 | + //Agendamento de nova tarefa para envio dos componentes digitais do processo | |
90 | + //$this->objGearmanClient->addTask("enviarComponenteDigital", $numIdentificacaoTramite, null); | |
91 | + }); | |
92 | + | |
93 | + //Etapa 02 - Processamento de pendências envio dos componentes digitais do processo | |
94 | + $this->objGearmanWorker->addFunction("enviarComponenteDigital", function ($job) { | |
95 | + | |
96 | + InfraDebug::getInstance()->gravar("[".date("d/m/Y H:i:s")."] Processando tarefa [enviarComponenteDigital] " . $job->workload()); | |
97 | + //TODO: Implementar tarefa relacionada | |
98 | + //... | |
99 | + | |
100 | + //Agendamento de nova tarefa para recebimento do recibo de envio do processo | |
101 | + //$this->objGearmanClient->addTask("receberReciboTramite", $numIdentificacaoTramite, null); | |
102 | + }); | |
103 | + | |
104 | + //Etapa 03 - Processamento de pendências de recebimento do recibo de envio do processo | |
105 | + $this->objGearmanWorker->addFunction("receberReciboTramite", function ($job) { | |
106 | + $numIdentificacaoTramite = intval($job->workload()); | |
107 | + InfraDebug::getInstance()->gravar("[".date("d/m/Y H:i:s")."] Processando tarefa [receberReciboTramite] " . $job->workload()); | |
108 | + $objPenTramiteProcessadoRN = new PenTramiteProcessadoRN(PenTramiteProcessadoRN::STR_TIPO_RECIBO); | |
109 | + if(!$objPenTramiteProcessadoRN->isProcedimentoRecebido($numIdentificacaoTramite)){ | |
110 | + $objReceberReciboTramiteRN = new ReceberReciboTramiteRN(); | |
111 | + $objReceberReciboTramiteRN->receberReciboDeTramite($numIdentificacaoTramite); | |
112 | + } | |
113 | + }); | |
114 | + | |
115 | + //PROCESSAMENTO DE TAREFAS RELACIONADAS AO RECEBIMENTO DE UM PROCESSO ELETRÔNICO | |
116 | + ////////////////////////////////////////////////////////////////////////// | |
117 | + | |
118 | + //Processamento de pendências de recebimento dos metadados do processo | |
119 | + $this->objGearmanWorker->addFunction("receberProcedimento", function ($job) { | |
120 | + try{ | |
121 | + $numIdentificacaoTramite = intval($job->workload()); | |
122 | + InfraDebug::getInstance()->gravar("[".date("d/m/Y H:i:s")."] Processando tarefa [receberProcedimento] " . $job->workload()); | |
123 | + $objPenTramiteProcessadoRN = new PenTramiteProcessadoRN(PenTramiteProcessadoRN::STR_TIPO_PROCESSO); | |
124 | + | |
125 | + if(!$objPenTramiteProcessadoRN->isProcedimentoRecebido($numIdentificacaoTramite)){ | |
126 | + $objReceberProcedimentoRN = new ReceberProcedimentoRN(); | |
127 | + $objReceberProcedimentoRN->receberProcedimento($numIdentificacaoTramite); | |
128 | + } | |
129 | + } | |
130 | + catch(Exception $e){ | |
131 | + LogSEI::getInstance()->gravar(InfraException::inspecionar($e)); | |
132 | + $objProcessoEletronicoRN = new ProcessoEletronicoRN(); | |
133 | + $strMensagem = ($e instanceof InfraException) ? $e->__toString() : $e->getMessage(); | |
134 | + $objProcessoEletronicoRN->recusarTramite($numIdentificacaoTramite, $strMensagem, ProcessoEletronicoRN::MTV_RCSR_TRAM_CD_OUTROU); | |
135 | + } | |
136 | + }); | |
137 | + | |
138 | + // Verifica no barramento os procedimentos que foram enviados por esta unidade e foram recusados pelas mesmas | |
139 | + $this->objGearmanWorker->addFunction("receberTramitesRecusados", function ($job) { | |
140 | + InfraDebug::getInstance()->gravar("[".date("d/m/Y H:i:s")."] Processando tarefa [receberRecusaTramite] " . $job->workload()); | |
141 | + $numIdentificacaoTramite = intval($job->workload()); | |
142 | + $objReceberProcedimentoRN = new ReceberProcedimentoRN(); | |
143 | + $objReceberProcedimentoRN->receberTramitesRecusados($numIdentificacaoTramite); | |
144 | + }); | |
145 | + | |
146 | + //Processamento de pendências de recebimento dos componentes digitais do processo | |
147 | + $this->objGearmanWorker->addFunction("receberComponenteDigital", function ($job) { | |
148 | + | |
149 | + InfraDebug::getInstance()->gravar("[".date("d/m/Y H:i:s")."] Processando tarefa [receberComponenteDigital] " . $job->workload()); | |
150 | + //TODO: A próxima etapa deveria ser o recebimento dos componentes digitais, rotina tradada na função receberProcedimento(...) | |
151 | + | |
152 | + //Agendamento de nova tarefa para envio do recibo de conclusão do trâmite | |
153 | + ProcessarPendenciasRN::processarTarefa("enviarReciboTramiteProcesso", $job->workload()); | |
154 | + //$this->objGearmanClient->addTaskBackground("enviarReciboTramiteProcesso", $numIdentificacaoTramite, null); | |
155 | + }); | |
156 | + | |
157 | + //Processamento de pendências de envio do recibo de conclusão do trãmite do processo | |
158 | + $this->objGearmanWorker->addFunction("enviarReciboTramiteProcesso", function ($job) { | |
159 | + InfraDebug::getInstance()->gravar("[".date("d/m/Y H:i:s")."] Processando tarefa [enviarReciboTramiteProcesso] " . $job->workload()); | |
160 | + $numIdentificacaoTramite = intval($job->workload()); | |
161 | + $objEnviarReciboTramiteRN = new EnviarReciboTramiteRN(); | |
162 | + $objEnviarReciboTramiteRN->enviarReciboTramiteProcesso($numIdentificacaoTramite); | |
163 | + }); | |
164 | + } | |
165 | + | |
166 | + static function processarTarefa($strNomeTarefa, $strWorkload) | |
167 | + { | |
168 | + $objClient = new GearmanClient(); | |
169 | + $objClient->addServer('localhost', 4730); | |
170 | + $objClient->doBackground($strNomeTarefa, $strWorkload); | |
171 | + } | |
189 | 172 | } |
190 | 173 | |
191 | -//TODO: Tratar envio de e-mail em caso de falhas de execução | |
192 | 174 | SessaoSEI::getInstance(false); |
193 | 175 | ProcessarPendenciasRN::getInstance()->processarPendencias(); |
194 | 176 | |
195 | -?> | |
196 | 177 | \ No newline at end of file |
178 | +?> | ... | ... |
rn/ProcessoEletronicoRN.php
1 | 1 | <?php |
2 | -//@TODOJOIN: VERIFICAR SE NÃO EXISTEM TRY CATCH QUE OCULTAM ERROS. CASO EXISTAM CATCH COM EXEPTION DO PHP, RETIRALOS | |
2 | +//@TODOJOIN: VERIFICAR SE NÃO EXISTEM TRY CATCH QUE OCULTAM ERROS. CASO EXISTAM CATCH COM EXEPTION DO PHP, RETIRALOS | |
3 | 3 | class ProcessoEletronicoRN extends InfraRN { |
4 | 4 | |
5 | 5 | //const PEN_WEBSERVICE_LOCATION = 'https://desenv-api-pen.intra.planejamento/interoperabilidade/soap/v1_1/'; |
6 | - | |
6 | + | |
7 | 7 | /* TAREFAS DE EXPEDIÇÃO DE PROCESSOS */ |
8 | 8 | //Está definindo o comportamento para a tarefa $TI_PROCESSO_EM_PROCESSAMENTO |
9 | 9 | public static $TI_PROCESSO_ELETRONICO_PROCESSO_EXPEDIDO = 'PEN_PROCESSO_EXPEDIDO'; |
... | ... | @@ -19,21 +19,21 @@ class ProcessoEletronicoRN extends InfraRN { |
19 | 19 | public static $STA_SIGILO_RESTRITO = '2'; |
20 | 20 | public static $STA_SIGILO_SIGILOSO = '3'; |
21 | 21 | |
22 | - /* RELAÇÃO DE SITUAÇÕES POSSÍVEIS EM UM TRÂMITE */ | |
23 | - public static $STA_SITUACAO_TRAMITE_INICIADO = 1; // Iniciado - Metadados recebidos pela solução | |
24 | - public static $STA_SITUACAO_TRAMITE_COMPONENTES_ENVIADOS_REMETENTE = 2; // Componentes digitais recebidos pela solução | |
22 | + /* RELAÇÃO DE SITUAÇÕES POSSÍVEIS EM UM TRÂMITE */ | |
23 | + public static $STA_SITUACAO_TRAMITE_INICIADO = 1; // Iniciado - Metadados recebidos pela solução | |
24 | + public static $STA_SITUACAO_TRAMITE_COMPONENTES_ENVIADOS_REMETENTE = 2; // Componentes digitais recebidos pela solução | |
25 | 25 | public static $STA_SITUACAO_TRAMITE_METADADOS_RECEBIDO_DESTINATARIO = 3; // Metadados recebidos pelo destinatário |
26 | 26 | public static $STA_SITUACAO_TRAMITE_COMPONENTES_RECEBIDOS_DESTINATARIO = 4; // Componentes digitais recebidos pelo destinatário |
27 | 27 | public static $STA_SITUACAO_TRAMITE_RECIBO_ENVIADO_DESTINATARIO = 5; // Recibo de conclusão do trâmite enviado pelo destinatário do processo |
28 | 28 | public static $STA_SITUACAO_TRAMITE_RECIBO_RECEBIDO_REMETENTE = 6; // Recibo de conclusão do trâmite recebido pelo remetente do processo |
29 | - public static $STA_SITUACAO_TRAMITE_CANCELADO = 7; // Trâmite do processo ou documento cancelado pelo usuário (Qualquer situação diferente de 5 e 6) | |
29 | + public static $STA_SITUACAO_TRAMITE_CANCELADO = 7; // Trâmite do processo ou documento cancelado pelo usuário (Qualquer situação diferente de 5 e 6) | |
30 | 30 | public static $STA_SITUACAO_TRAMITE_RECUSADO = 8; // Trâmite do processo recusado pelo destinatário (Situações 2, 3, 4) |
31 | 31 | public static $STA_SITUACAO_TRAMITE_CIENCIA_RECUSA = 9; // Remetente ciente da recusa do trâmite |
32 | 32 | |
33 | 33 | public static $STA_TIPO_RECIBO_ENVIO = '1'; // Recibo de envio |
34 | 34 | public static $STA_TIPO_RECIBO_CONCLUSAO_ENVIADO = '2'; // Recibo de recebimento enviado |
35 | 35 | public static $STA_TIPO_RECIBO_CONCLUSAO_RECEBIDO = '3'; // Recibo de recebimento recebido |
36 | - | |
36 | + | |
37 | 37 | /* OPERAÇÕES DO HISTÓRICO DO PROCESSO */ |
38 | 38 | // 02 a 18 estão registrados na tabela rel_tarefa_operacao |
39 | 39 | public static $OP_OPERACAO_REGISTRO = "01"; |
... | ... | @@ -41,7 +41,7 @@ class ProcessoEletronicoRN extends InfraRN { |
41 | 41 | |
42 | 42 | |
43 | 43 | const ALGORITMO_HASH_DOCUMENTO = 'SHA256'; |
44 | - | |
44 | + | |
45 | 45 | /** |
46 | 46 | * Motivo para recusar de tramite de componente digital pelo formato |
47 | 47 | */ |
... | ... | @@ -54,17 +54,17 @@ class ProcessoEletronicoRN extends InfraRN { |
54 | 54 | * Motivo para recusar de tramite de componente digital que não foi enviado |
55 | 55 | */ |
56 | 56 | const MTV_RCSR_TRAM_CD_FALTA = '03'; |
57 | - | |
57 | + | |
58 | 58 | /** |
59 | 59 | * Espécie documentoal não mapeada |
60 | 60 | */ |
61 | 61 | const MTV_RCSR_TRAM_CD_ESPECIE_NAO_MAPEADA = '03'; |
62 | - | |
62 | + | |
63 | 63 | /** |
64 | 64 | * Motivo para recusar de tramite de componente digital |
65 | 65 | */ |
66 | 66 | const MTV_RCSR_TRAM_CD_OUTROU = '99'; |
67 | - | |
67 | + | |
68 | 68 | public static $MOTIVOS_RECUSA = array( |
69 | 69 | "01" => "Formato de componente digital não suportado", |
70 | 70 | "02" => "Componente digital corrompido", |
... | ... | @@ -72,7 +72,7 @@ class ProcessoEletronicoRN extends InfraRN { |
72 | 72 | "04" => "Espécie documental não mapeada no destinatário", |
73 | 73 | "99" => "Outro" |
74 | 74 | ); |
75 | - | |
75 | + | |
76 | 76 | |
77 | 77 | private $strWSDL = null; |
78 | 78 | private $objPenWs = null; |
... | ... | @@ -80,7 +80,7 @@ class ProcessoEletronicoRN extends InfraRN { |
80 | 80 | |
81 | 81 | public function __construct() { |
82 | 82 | $objPenParametroRN = new PenParametroRN(); |
83 | - | |
83 | + | |
84 | 84 | $strEnderecoWebService = $objPenParametroRN->getParametro('PEN_ENDERECO_WEBSERVICE'); |
85 | 85 | $strLocalizacaoCertificadoDigital = $objPenParametroRN->getParametro('PEN_LOCALIZACAO_CERTIFICADO_DIGITAL'); |
86 | 86 | $strSenhaCertificadoDigital = $objPenParametroRN->getParametro('PEN_SENHA_CERTIFICADO_DIGITAL'); |
... | ... | @@ -121,17 +121,17 @@ class ProcessoEletronicoRN extends InfraRN { |
121 | 121 | { |
122 | 122 | return BancoSEI::getInstance(); |
123 | 123 | } |
124 | - | |
124 | + | |
125 | 125 | /** |
126 | 126 | * Verifica se o uma url esta ativa |
127 | - * | |
127 | + * | |
128 | 128 | * @param string $strUrl url a ser testada |
129 | 129 | * @param string $strLocalCert local físico do certificado .pem |
130 | 130 | * @throws InfraException |
131 | 131 | * @return null |
132 | 132 | */ |
133 | 133 | private function testaUrl($strUrl = '', $strLocalCert = ''){ |
134 | - | |
134 | + | |
135 | 135 | $arrParseUrl = parse_url($this->strWSDL); |
136 | 136 | // é melhor a página inicial que todo o arquivo wsdl |
137 | 137 | $strUrl = $arrParseUrl['scheme'].'://'.$arrParseUrl['host']; |
... | ... | @@ -147,37 +147,37 @@ class ProcessoEletronicoRN extends InfraRN { |
147 | 147 | throw new InfraException('Falha de comunicação com o Barramento de Serviços. Por favor, tente novamente mais tarde.', $e); |
148 | 148 | } |
149 | 149 | } |
150 | - | |
150 | + | |
151 | 151 | public function testarDisponibilidade(){ |
152 | - | |
152 | + | |
153 | 153 | try{ |
154 | 154 | $this->testaUrl($this->strWSDL, $this->options['local_cert']); |
155 | 155 | return true; |
156 | 156 | } catch (Exception $ex) { |
157 | 157 | return false; |
158 | 158 | } |
159 | - | |
159 | + | |
160 | 160 | } |
161 | - | |
161 | + | |
162 | 162 | private function getObjPenWs() { |
163 | - | |
164 | - if($this->objPenWs == null) { | |
163 | + | |
164 | + if($this->objPenWs == null) { | |
165 | 165 | $this->testaUrl($this->strWSDL, $this->options['local_cert']); |
166 | 166 | try { |
167 | - | |
167 | + | |
168 | 168 | $objConfig = ConfiguracaoSEI::getInstance(); |
169 | - | |
169 | + | |
170 | 170 | if($objConfig->isSetValor('SEI', 'LogPenWs')){ |
171 | - | |
171 | + | |
172 | 172 | $this->objPenWs = new LogPenWs($objConfig->getValor('SEI', 'LogPenWs'), $this->strWSDL, $this->options); |
173 | 173 | } |
174 | 174 | else { |
175 | - | |
175 | + | |
176 | 176 | $this->objPenWs = new BeSimple\SoapClient\SoapClient($this->strWSDL, $this->options); |
177 | 177 | } |
178 | 178 | } catch (Exception $e) { |
179 | 179 | throw new InfraException('Erro acessando serviço.', $e); |
180 | - } | |
180 | + } | |
181 | 181 | } |
182 | 182 | |
183 | 183 | return $this->objPenWs; |
... | ... | @@ -198,7 +198,7 @@ class ProcessoEletronicoRN extends InfraRN { |
198 | 198 | if(isset($result->repositoriosEncontrados->repositorio)){ |
199 | 199 | |
200 | 200 | if(!is_array($result->repositoriosEncontrados->repositorio)) { |
201 | - $result->repositoriosEncontrados->repositorio = array($result->repositoriosEncontrados->repositorio); | |
201 | + $result->repositoriosEncontrados->repositorio = array($result->repositoriosEncontrados->repositorio); | |
202 | 202 | } |
203 | 203 | |
204 | 204 | foreach ($result->repositoriosEncontrados->repositorio as $repositorio) { |
... | ... | @@ -211,7 +211,7 @@ class ProcessoEletronicoRN extends InfraRN { |
211 | 211 | } |
212 | 212 | } |
213 | 213 | } catch(Exception $e){ |
214 | - throw new InfraException("Erro durante obtenção dos repositórios", $e); | |
214 | + throw new InfraException("Erro durante obtenção dos repositórios", $e); | |
215 | 215 | } |
216 | 216 | |
217 | 217 | return $objRepositorioDTO; |
... | ... | @@ -231,7 +231,7 @@ class ProcessoEletronicoRN extends InfraRN { |
231 | 231 | if(isset($result->repositoriosEncontrados->repositorio)){ |
232 | 232 | |
233 | 233 | if(!is_array($result->repositoriosEncontrados->repositorio)) { |
234 | - $result->repositoriosEncontrados->repositorio = array($result->repositoriosEncontrados->repositorio); | |
234 | + $result->repositoriosEncontrados->repositorio = array($result->repositoriosEncontrados->repositorio); | |
235 | 235 | } |
236 | 236 | |
237 | 237 | foreach ($result->repositoriosEncontrados->repositorio as $repositorio) { |
... | ... | @@ -243,7 +243,7 @@ class ProcessoEletronicoRN extends InfraRN { |
243 | 243 | } |
244 | 244 | } |
245 | 245 | } catch(Exception $e){ |
246 | - throw new InfraException("Erro durante obtenção dos repositórios", $e); | |
246 | + throw new InfraException("Erro durante obtenção dos repositórios", $e); | |
247 | 247 | } |
248 | 248 | |
249 | 249 | return $arrObjRepositorioDTO; |
... | ... | @@ -257,30 +257,30 @@ class ProcessoEletronicoRN extends InfraRN { |
257 | 257 | $parametros->filtroDeEstruturas->identificacaoDoRepositorioDeEstruturas = $idRepositorioEstrutura; |
258 | 258 | $parametros->filtroDeEstruturas->numeroDeIdentificacaoDaEstrutura = $numeroDeIdentificacaoDaEstrutura; |
259 | 259 | $parametros->filtroDeEstruturas->apenasAtivas = false; |
260 | - | |
260 | + | |
261 | 261 | $result = $this->getObjPenWs()->consultarEstruturas($parametros); |
262 | 262 | |
263 | 263 | if ($result->estruturasEncontradas->totalDeRegistros == 1) { |
264 | 264 | |
265 | 265 | $arrObjEstrutura = is_array($result->estruturasEncontradas->estrutura) ? $result->estruturasEncontradas->estrutura : array($result->estruturasEncontradas->estrutura); |
266 | 266 | $objEstrutura = current($arrObjEstrutura); |
267 | - | |
267 | + | |
268 | 268 | $objEstrutura->nome = utf8_decode($objEstrutura->nome); |
269 | 269 | $objEstrutura->sigla = utf8_decode($objEstrutura->sigla); |
270 | - | |
270 | + | |
271 | 271 | if ($bolRetornoRaw !== false) { |
272 | 272 | if (isset($objEstrutura->hierarquia) && isset($objEstrutura->hierarquia->nivel)) { |
273 | 273 | if (!is_array($objEstrutura->hierarquia->nivel)) { |
274 | 274 | $objEstrutura->hierarquia->nivel = array($objEstrutura->hierarquia->nivel); |
275 | 275 | } |
276 | - | |
276 | + | |
277 | 277 | $objEstrutura->hierarquia->nivel = (array) $objEstrutura->hierarquia->nivel; |
278 | 278 | foreach ($objEstrutura->hierarquia->nivel as &$objNivel) { |
279 | 279 | $objNivel->nome = utf8_decode($objNivel->nome); |
280 | - } | |
280 | + } | |
281 | 281 | } |
282 | 282 | return $objEstrutura; |
283 | - } | |
283 | + } | |
284 | 284 | else { |
285 | 285 | |
286 | 286 | $objEstruturaDTO = new EstruturaDTO(); |
... | ... | @@ -293,27 +293,28 @@ class ProcessoEletronicoRN extends InfraRN { |
293 | 293 | return $objEstruturaDTO; |
294 | 294 | } |
295 | 295 | } |
296 | - } | |
296 | + } | |
297 | 297 | catch (Exception $e) { |
298 | 298 | throw new InfraException("Erro durante obtenção das unidades", $e); |
299 | 299 | } |
300 | 300 | } |
301 | 301 | |
302 | - public function listarEstruturas($idRepositorioEstrutura, $nome='') | |
302 | + public function listarEstruturas($idRepositorioEstrutura, $nome='') | |
303 | 303 | { |
304 | 304 | $arrObjEstruturaDTO = array(); |
305 | 305 | |
306 | 306 | try{ |
307 | 307 | $idRepositorioEstrutura = filter_var($idRepositorioEstrutura, FILTER_SANITIZE_NUMBER_INT); |
308 | 308 | if(!$idRepositorioEstrutura) { |
309 | - throw new InfraException("Repositório de Estruturas inválido"); | |
309 | + throw new InfraException("Repositório de Estruturas inválido"); | |
310 | 310 | } |
311 | 311 | |
312 | 312 | $parametros = new stdClass(); |
313 | 313 | $parametros->filtroDeEstruturas = new stdClass(); |
314 | 314 | $parametros->filtroDeEstruturas->identificacaoDoRepositorioDeEstruturas = $idRepositorioEstrutura; |
315 | 315 | $parametros->filtroDeEstruturas->apenasAtivas = false; |
316 | - | |
316 | + | |
317 | + $nome = trim($nome); | |
317 | 318 | if(is_numeric($nome)) { |
318 | 319 | $parametros->filtroDeEstruturas->numeroDeIdentificacaoDaEstrutura = intval($nome); |
319 | 320 | } else { |
... | ... | @@ -325,7 +326,7 @@ class ProcessoEletronicoRN extends InfraRN { |
325 | 326 | if($result->estruturasEncontradas->totalDeRegistros > 0) { |
326 | 327 | |
327 | 328 | if(!is_array($result->estruturasEncontradas->estrutura)) { |
328 | - $result->estruturasEncontradas->estrutura = array($result->estruturasEncontradas->estrutura); | |
329 | + $result->estruturasEncontradas->estrutura = array($result->estruturasEncontradas->estrutura); | |
329 | 330 | } |
330 | 331 | |
331 | 332 | foreach ($result->estruturasEncontradas->estrutura as $estrutura) { |
... | ... | @@ -336,25 +337,25 @@ class ProcessoEletronicoRN extends InfraRN { |
336 | 337 | $item->setBolAtivo($estrutura->ativo); |
337 | 338 | $item->setBolAptoParaReceberTramites($estrutura->aptoParaReceberTramites); |
338 | 339 | $item->setStrCodigoNoOrgaoEntidade($estrutura->codigoNoOrgaoEntidade); |
339 | - | |
340 | + | |
340 | 341 | if(!empty($estrutura->hierarquia->nivel)) { |
341 | - | |
342 | + | |
342 | 343 | $array = array(); |
343 | - | |
344 | + | |
344 | 345 | foreach($estrutura->hierarquia->nivel as $nivel) { |
345 | - | |
346 | + | |
346 | 347 | $array[] = utf8_decode($nivel->sigla); |
347 | 348 | } |
348 | - | |
349 | + | |
349 | 350 | $item->setArrHierarquia($array); |
350 | 351 | } |
351 | - | |
352 | + | |
352 | 353 | $arrObjEstruturaDTO[] = $item; |
353 | 354 | } |
354 | - } | |
355 | + } | |
355 | 356 | |
356 | 357 | } catch (Exception $e) { |
357 | - throw new InfraException("Erro durante obtenção das unidades", $e); | |
358 | + throw new InfraException("Erro durante obtenção das unidades", $e); | |
358 | 359 | } |
359 | 360 | |
360 | 361 | return $arrObjEstruturaDTO; |
... | ... | @@ -380,7 +381,7 @@ class ProcessoEletronicoRN extends InfraRN { |
380 | 381 | $xpath = new DOMXPath($dom); |
381 | 382 | |
382 | 383 | $rootNamespace = $dom->lookupNamespaceUri($dom->namespaceURI); |
383 | - $xpath->registerNamespace('x', $rootNamespace); | |
384 | + $xpath->registerNamespace('x', $rootNamespace); | |
384 | 385 | $entries = $xpath->query('/x:schema/x:simpleType[@name="motivoDaUrgencia"]/x:restriction/x:enumeration'); |
385 | 386 | |
386 | 387 | $resultado = array(); |
... | ... | @@ -394,16 +395,16 @@ class ProcessoEletronicoRN extends InfraRN { |
394 | 395 | } |
395 | 396 | |
396 | 397 | return $resultado; |
397 | - } | |
398 | + } | |
398 | 399 | |
399 | - public function enviarProcesso($parametros) | |
400 | + public function enviarProcesso($parametros) | |
400 | 401 | { |
401 | 402 | try { |
402 | 403 | //error_log("PARAMETROS:" . print_r($parametros, true)); |
403 | - return $this->getObjPenWs()->enviarProcesso($parametros); | |
404 | + return $this->getObjPenWs()->enviarProcesso($parametros); | |
404 | 405 | } catch (\SoapFault $fault) { |
405 | - | |
406 | - | |
406 | + | |
407 | + | |
407 | 408 | if (!empty($fault->detail->interoperabilidadeException->codigoErro) && $fault->detail->interoperabilidadeException->codigoErro == '0005') { |
408 | 409 | $mensagem = 'O código mapeado para a unidade ' . utf8_decode($parametros->novoTramiteDeProcesso->processo->documento[0]->produtor->unidade->nome) . ' está incorreto.'; |
409 | 410 | } else { |
... | ... | @@ -416,7 +417,7 @@ class ProcessoEletronicoRN extends InfraRN { |
416 | 417 | |
417 | 418 | } catch (\Exception $e) { |
418 | 419 | throw new InfraException("Error Processing Request", $e); |
419 | - } | |
420 | + } | |
420 | 421 | } |
421 | 422 | |
422 | 423 | public function listarPendencias($bolTodasPendencias) |
... | ... | @@ -427,7 +428,7 @@ class ProcessoEletronicoRN extends InfraRN { |
427 | 428 | try { |
428 | 429 | $parametros = new stdClass(); |
429 | 430 | $parametros->filtroDePendencias = new stdClass(); |
430 | - $parametros->filtroDePendencias->todasAsPendencias = $bolTodasPendencias; | |
431 | + $parametros->filtroDePendencias->todasAsPendencias = $bolTodasPendencias; | |
431 | 432 | $result = $this->getObjPenWs()->listarPendencias($parametros); |
432 | 433 | |
433 | 434 | if(isset($result->listaDePendencias->IDT)){ |
... | ... | @@ -441,7 +442,7 @@ class ProcessoEletronicoRN extends InfraRN { |
441 | 442 | $item->setNumIdentificacaoTramite($idt->_); |
442 | 443 | $item->setStrStatus($idt->status); |
443 | 444 | $arrObjPendenciaDTO[] = $item; |
444 | - } | |
445 | + } | |
445 | 446 | } |
446 | 447 | } catch (\SoapFault $fault) { |
447 | 448 | $mensagem = $this->tratarFalhaWebService($fault); |
... | ... | @@ -451,13 +452,13 @@ class ProcessoEletronicoRN extends InfraRN { |
451 | 452 | } |
452 | 453 | |
453 | 454 | return $arrObjPendenciaDTO; |
454 | - } | |
455 | + } | |
455 | 456 | |
456 | 457 | //TODO: Tratar cada um dos possíveis erros gerados pelos serviços de integração do PEN |
457 | 458 | private function tratarFalhaWebService(SoapFault $fault) |
458 | 459 | { |
459 | 460 | error_log('$e->faultcode:' . $fault->faultcode); |
460 | - error_log('$e->detail:' . print_r($fault->detail, true)); | |
461 | + error_log('$e->detail:' . print_r($fault->detail, true)); | |
461 | 462 | |
462 | 463 | $mensagem = $fault->getMessage(); |
463 | 464 | if(isset($fault->detail->interoperabilidadeException)){ |
... | ... | @@ -477,13 +478,13 @@ class ProcessoEletronicoRN extends InfraRN { |
477 | 478 | return $mensagem; |
478 | 479 | } |
479 | 480 | |
480 | - public function construirCabecalho($strNumeroRegistro = null, $idRepositorioOrigem = 0, $idUnidadeOrigem = 0, $idRepositorioDestino = 0, | |
481 | + public function construirCabecalho($strNumeroRegistro = null, $idRepositorioOrigem = 0, $idUnidadeOrigem = 0, $idRepositorioDestino = 0, | |
481 | 482 | $idUnidadeDestino = 0, $urgente = false, $motivoUrgencia = 0, $enviarTodosDocumentos = false) |
482 | 483 | { |
483 | 484 | $cabecalho = new stdClass(); |
484 | 485 | |
485 | 486 | if(isset($strNumeroRegistro)) { |
486 | - $cabecalho->NRE = $strNumeroRegistro; | |
487 | + $cabecalho->NRE = $strNumeroRegistro; | |
487 | 488 | } |
488 | 489 | |
489 | 490 | $cabecalho->remetente = new stdClass(); |
... | ... | @@ -506,7 +507,7 @@ class ProcessoEletronicoRN extends InfraRN { |
506 | 507 | try { |
507 | 508 | //error_log('$this->getObjPenWs()->enviarComponenteDigital($parametros)'); |
508 | 509 | //error_log("||||||||||||||||||" . print_r($parametros, true)); |
509 | - return $this->getObjPenWs()->enviarComponenteDigital($parametros); | |
510 | + return $this->getObjPenWs()->enviarComponenteDigital($parametros); | |
510 | 511 | |
511 | 512 | } catch (\SoapFault $fault) { |
512 | 513 | //error_log("REQUEST:" . $this->getObjPenWs()->__getLastRequest()); |
... | ... | @@ -521,7 +522,7 @@ class ProcessoEletronicoRN extends InfraRN { |
521 | 522 | } catch (\Exception $e) { |
522 | 523 | |
523 | 524 | throw new InfraException("Error Processing Request", $e); |
524 | - } | |
525 | + } | |
525 | 526 | |
526 | 527 | } |
527 | 528 | |
... | ... | @@ -529,9 +530,9 @@ class ProcessoEletronicoRN extends InfraRN { |
529 | 530 | public function solicitarMetadados($parNumIdentificacaoTramite) { |
530 | 531 | |
531 | 532 | try |
532 | - { | |
533 | + { | |
533 | 534 | $parametros = new stdClass(); |
534 | - $parametros->IDT = $parNumIdentificacaoTramite; | |
535 | + $parametros->IDT = $parNumIdentificacaoTramite; | |
535 | 536 | return $this->getObjPenWs()->solicitarMetadados($parametros); |
536 | 537 | } catch (\SoapFault $fault) { |
537 | 538 | $mensagem = $this->tratarFalhaWebService($fault); |
... | ... | @@ -542,10 +543,10 @@ class ProcessoEletronicoRN extends InfraRN { |
542 | 543 | |
543 | 544 | } catch (\Exception $e) { |
544 | 545 | throw new InfraException("Error Processing Request", $e); |
545 | - } | |
546 | - } | |
546 | + } | |
547 | + } | |
547 | 548 | |
548 | - public static function converterDataWebService($dataHoraSEI) | |
549 | + public static function converterDataWebService($dataHoraSEI) | |
549 | 550 | { |
550 | 551 | $resultado = ''; |
551 | 552 | if(isset($dataHoraSEI)){ |
... | ... | @@ -556,7 +557,7 @@ class ProcessoEletronicoRN extends InfraRN { |
556 | 557 | return $resultado; |
557 | 558 | } |
558 | 559 | |
559 | - public static function converterDataSEI($dataHoraWebService) | |
560 | + public static function converterDataSEI($dataHoraWebService) | |
560 | 561 | { |
561 | 562 | $resultado = null; |
562 | 563 | if(isset($dataHoraWebService)){ |
... | ... | @@ -566,7 +567,7 @@ class ProcessoEletronicoRN extends InfraRN { |
566 | 567 | |
567 | 568 | return $resultado; |
568 | 569 | } |
569 | - | |
570 | + | |
570 | 571 | public static function obterIdTarefaModulo($strIdTarefaModulo) |
571 | 572 | { |
572 | 573 | $objTarefaDTO = new TarefaDTO(); |
... | ... | @@ -581,25 +582,25 @@ class ProcessoEletronicoRN extends InfraRN { |
581 | 582 | }else{ |
582 | 583 | return false; |
583 | 584 | } |
584 | - | |
585 | + | |
585 | 586 | } |
586 | 587 | |
587 | 588 | public function cadastrarTramiteDeProcesso($parDblIdProcedimento, $parStrNumeroRegistro, $parNumIdentificacaoTramite, $parDthRegistroTramite, $parObjProcesso, $parNumTicketComponentesDigitais = null, $parObjComponentesDigitaisSolicitados = null) |
588 | 589 | { |
589 | 590 | if(!isset($parDblIdProcedimento) || $parDblIdProcedimento == 0) { |
590 | - throw new InfraException('Parâmetro $parDblIdProcedimento não informado.'); | |
591 | + throw new InfraException('Parâmetro $parDblIdProcedimento não informado.'); | |
591 | 592 | } |
592 | 593 | |
593 | 594 | if(!isset($parStrNumeroRegistro)) { |
594 | - throw new InfraException('Parâmetro $parStrNumeroRegistro não informado.'); | |
595 | + throw new InfraException('Parâmetro $parStrNumeroRegistro não informado.'); | |
595 | 596 | } |
596 | 597 | |
597 | 598 | if(!isset($parNumIdentificacaoTramite) || $parNumIdentificacaoTramite == 0) { |
598 | - throw new InfraException('Parâmetro $parStrNumeroRegistro não informado.'); | |
599 | + throw new InfraException('Parâmetro $parStrNumeroRegistro não informado.'); | |
599 | 600 | } |
600 | 601 | |
601 | 602 | if(!isset($parObjProcesso)) { |
602 | - throw new InfraException('Parâmetro $objProcesso não informado.'); | |
603 | + throw new InfraException('Parâmetro $objProcesso não informado.'); | |
603 | 604 | } |
604 | 605 | |
605 | 606 | //Monta dados do processo eletrônico |
... | ... | @@ -607,12 +608,12 @@ class ProcessoEletronicoRN extends InfraRN { |
607 | 608 | $objProcessoEletronicoDTO->setStrNumeroRegistro($parStrNumeroRegistro); |
608 | 609 | $objProcessoEletronicoDTO->setDblIdProcedimento($parDblIdProcedimento); |
609 | 610 | |
610 | - //Montar dados dos procedimentos apensados | |
611 | + //Montar dados dos procedimentos apensados | |
611 | 612 | if(isset($parObjProcesso->processoApensado)){ |
612 | 613 | if(!is_array($parObjProcesso->processoApensado)){ |
613 | 614 | $parObjProcesso->processoApensado = array($parObjProcesso->processoApensado); |
614 | 615 | } |
615 | - | |
616 | + | |
616 | 617 | $arrObjRelProcessoEletronicoApensadoDTO = array(); |
617 | 618 | $objRelProcessoEletronicoApensadoDTO = null; |
618 | 619 | foreach ($parObjProcesso->processoApensado as $objProcessoApensado) { |
... | ... | @@ -631,14 +632,14 @@ class ProcessoEletronicoRN extends InfraRN { |
631 | 632 | $objTramiteDTO->setStrNumeroRegistro($parStrNumeroRegistro); |
632 | 633 | $objTramiteDTO->setNumIdTramite($parNumIdentificacaoTramite); |
633 | 634 | $objTramiteDTO->setNumTicketEnvioComponentes($parNumTicketComponentesDigitais); |
634 | - $objTramiteDTO->setDthRegistro($this->converterDataSEI($parDthRegistroTramite)); | |
635 | + $objTramiteDTO->setDthRegistro($this->converterDataSEI($parDthRegistroTramite)); | |
635 | 636 | $objTramiteDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); |
636 | 637 | $objTramiteDTO->setNumIdUsuario(SessaoSEI::getInstance()->getNumIdUsuario()); |
637 | 638 | $objProcessoEletronicoDTO->setArrObjTramiteDTO(array($objTramiteDTO)); |
638 | 639 | |
639 | 640 | //Monta dados dos componentes digitais |
640 | 641 | $arrObjComponenteDigitalDTO = $this->montarDadosComponenteDigital($parStrNumeroRegistro, $parNumIdentificacaoTramite, $parObjProcesso, $parObjComponentesDigitaisSolicitados); |
641 | - | |
642 | + | |
642 | 643 | $objTramiteDTO->setArrObjComponenteDigitalDTO($arrObjComponenteDigitalDTO); |
643 | 644 | $objProcessoEletronicoDTO = $this->cadastrarTramiteDeProcessoInterno($objProcessoEletronicoDTO); |
644 | 645 | |
... | ... | @@ -650,11 +651,11 @@ class ProcessoEletronicoRN extends InfraRN { |
650 | 651 | protected function cadastrarTramiteDeProcessoInternoControlado(ProcessoEletronicoDTO $parObjProcessoEletronicoDTO) { |
651 | 652 | |
652 | 653 | if(!isset($parObjProcessoEletronicoDTO)) { |
653 | - throw new InfraException('Parâmetro $parObjProcessoEletronicoDTO não informado.'); | |
654 | + throw new InfraException('Parâmetro $parObjProcessoEletronicoDTO não informado.'); | |
654 | 655 | } |
655 | 656 | |
656 | 657 | $idProcedimento = $parObjProcessoEletronicoDTO->getDblIdProcedimento(); |
657 | - | |
658 | + | |
658 | 659 | //Registra os dados do processo eletrônico |
659 | 660 | //TODO: Revisar a forma como o barramento tratar o NRE para os processos apensados |
660 | 661 | $objProcessoEletronicoDTOFiltro = new ProcessoEletronicoDTO(); |
... | ... | @@ -667,7 +668,7 @@ class ProcessoEletronicoRN extends InfraRN { |
667 | 668 | $objProcessoEletronicoDTO = $objProcessoEletronicoBD->consultar($objProcessoEletronicoDTOFiltro); |
668 | 669 | |
669 | 670 | if(empty($objProcessoEletronicoDTO)) { |
670 | - | |
671 | + | |
671 | 672 | $objProcessoEletronicoDTO = $objProcessoEletronicoBD->cadastrar($objProcessoEletronicoDTOFiltro); |
672 | 673 | } |
673 | 674 | |
... | ... | @@ -675,20 +676,20 @@ class ProcessoEletronicoRN extends InfraRN { |
675 | 676 | if($parObjProcessoEletronicoDTO->isSetArrObjRelProcessoEletronicoApensado()) { |
676 | 677 | |
677 | 678 | $objRelProcessoEletronicoApensadoBD = new RelProcessoEletronicoApensadoBD($this->getObjInfraIBanco()); |
678 | - | |
679 | + | |
679 | 680 | foreach ($parObjProcessoEletronicoDTO->getArrObjRelProcessoEletronicoApensado() as $objRelProcessoEletronicoApensadoDTOFiltro) { |
680 | - | |
681 | + | |
681 | 682 | if($objRelProcessoEletronicoApensadoBD->contar($objRelProcessoEletronicoApensadoDTOFiltro) < 1){ |
682 | - | |
683 | - $objRelProcessoEletronicoApensadoBD->cadastrar($objRelProcessoEletronicoApensadoDTOFiltro); | |
683 | + | |
684 | + $objRelProcessoEletronicoApensadoBD->cadastrar($objRelProcessoEletronicoApensadoDTOFiltro); | |
684 | 685 | } |
685 | 686 | } |
686 | 687 | } |
687 | 688 | |
688 | 689 | //Registrar informações sobre o trâmite do processo |
689 | 690 | $arrObjTramiteDTO = $parObjProcessoEletronicoDTO->getArrObjTramiteDTO(); |
690 | - $parObjTramiteDTO = $arrObjTramiteDTO[0]; | |
691 | - | |
691 | + $parObjTramiteDTO = $arrObjTramiteDTO[0]; | |
692 | + | |
692 | 693 | $objTramiteDTO = new TramiteDTO(); |
693 | 694 | $objTramiteDTO->retNumIdTramite(); |
694 | 695 | $objTramiteDTO->setStrNumeroRegistro($parObjTramiteDTO->getStrNumeroRegistro()); |
... | ... | @@ -699,57 +700,57 @@ class ProcessoEletronicoRN extends InfraRN { |
699 | 700 | |
700 | 701 | if($objTramiteDTO == null) { |
701 | 702 | $objTramiteDTO = $objTramiteBD->cadastrar($parObjTramiteDTO); |
702 | - } | |
703 | + } | |
703 | 704 | |
704 | 705 | $objProcessoEletronicoDTO->setArrObjTramiteDTO(array($objTramiteDTO)); |
705 | 706 | |
706 | 707 | //Registra informações sobre o componente digital do documento |
707 | 708 | $arrObjComponenteDigitalDTO = array(); |
708 | 709 | $objComponenteDigitalBD = new ComponenteDigitalBD($this->getObjInfraIBanco()); |
709 | - | |
710 | + | |
710 | 711 | $numOrdem = 1; |
711 | - | |
712 | + | |
712 | 713 | foreach ($parObjTramiteDTO->getArrObjComponenteDigitalDTO() as $objComponenteDigitalDTO) { |
713 | - | |
714 | + | |
714 | 715 | $objComponenteDigitalDTOFiltro = new ComponenteDigitalDTO(); |
715 | - | |
716 | + | |
716 | 717 | $objComponenteDigitalDTOFiltro->setStrNumeroRegistro($objComponenteDigitalDTO->getStrNumeroRegistro()); |
717 | - $objComponenteDigitalDTOFiltro->setDblIdProcedimento($objComponenteDigitalDTO->getDblIdProcedimento()); | |
718 | - $objComponenteDigitalDTOFiltro->setDblIdDocumento($objComponenteDigitalDTO->getDblIdDocumento()); | |
719 | - | |
718 | + $objComponenteDigitalDTOFiltro->setDblIdProcedimento($objComponenteDigitalDTO->getDblIdProcedimento()); | |
719 | + $objComponenteDigitalDTOFiltro->setDblIdDocumento($objComponenteDigitalDTO->getDblIdDocumento()); | |
720 | + | |
720 | 721 | if($objComponenteDigitalBD->contar($objComponenteDigitalDTOFiltro) > 0){ |
721 | 722 | $numOrdem++; |
722 | 723 | } |
723 | - | |
724 | + | |
724 | 725 | } |
725 | - | |
726 | + | |
726 | 727 | foreach ($parObjTramiteDTO->getArrObjComponenteDigitalDTO() as $objComponenteDigitalDTO) { |
727 | - | |
728 | + | |
728 | 729 | //Verifica se o documento foi inserido pelo trâmite atual |
729 | 730 | if($objComponenteDigitalDTO->getDblIdDocumento() != null){ |
730 | - | |
731 | + | |
731 | 732 | $objComponenteDigitalDTO->setDblIdProcedimento($idProcedimento); |
732 | - | |
733 | + | |
733 | 734 | $objComponenteDigitalDTOFiltro = new ComponenteDigitalDTO(); |
734 | - | |
735 | + | |
735 | 736 | $objComponenteDigitalDTOFiltro->setStrNumeroRegistro($objComponenteDigitalDTO->getStrNumeroRegistro()); |
736 | - $objComponenteDigitalDTOFiltro->setDblIdProcedimento($objComponenteDigitalDTO->getDblIdProcedimento()); | |
737 | - $objComponenteDigitalDTOFiltro->setDblIdDocumento($objComponenteDigitalDTO->getDblIdDocumento()); | |
738 | - | |
737 | + $objComponenteDigitalDTOFiltro->setDblIdProcedimento($objComponenteDigitalDTO->getDblIdProcedimento()); | |
738 | + $objComponenteDigitalDTOFiltro->setDblIdDocumento($objComponenteDigitalDTO->getDblIdDocumento()); | |
739 | + | |
739 | 740 | if($objComponenteDigitalBD->contar($objComponenteDigitalDTOFiltro) < 1){ |
740 | - | |
741 | + | |
741 | 742 | $objComponenteDigitalDTO->setNumOrdem($numOrdem); |
742 | 743 | $objComponenteDigitalDTO->unSetStrDadosComplementares(); |
743 | 744 | $objComponenteDigitalDTO = $objComponenteDigitalBD->cadastrar($objComponenteDigitalDTO); |
744 | 745 | $numOrdem++; |
745 | 746 | } |
746 | 747 | else { |
747 | - | |
748 | + | |
748 | 749 | //Verifica se foi setado o envio |
749 | 750 | if(!$objComponenteDigitalDTO->isSetStrSinEnviar()){ |
750 | 751 | $objComponenteDigitalDTO->setStrSinEnviar('N'); |
751 | 752 | } |
752 | - | |
753 | + | |
753 | 754 | // Muda a ID do tramite e o arquivo pode ser enviado |
754 | 755 | $objComponenteDigitalBD->alterar($objComponenteDigitalDTO); |
755 | 756 | } |
... | ... | @@ -765,17 +766,17 @@ class ProcessoEletronicoRN extends InfraRN { |
765 | 766 | |
766 | 767 | return $objProcessoEletronicoDTO; |
767 | 768 | } |
768 | - | |
769 | + | |
769 | 770 | /** |
770 | 771 | * Retorna o hash do objecto do solicitarMetadadosResponse |
771 | - * | |
772 | + * | |
772 | 773 | * @param object $objMeta tem que ser o componenteDigital->hash |
773 | 774 | * @return string |
774 | 775 | */ |
775 | 776 | public static function getHashFromMetaDados($objMeta){ |
776 | 777 | |
777 | 778 | $strHashConteudo = ''; |
778 | - | |
779 | + | |
779 | 780 | if (isset($objMeta)) { |
780 | 781 | $matches = array(); |
781 | 782 | $strHashConteudo = (isset($objMeta->enc_value)) ? $objMeta->enc_value : $objMeta->_; |
... | ... | @@ -787,16 +788,16 @@ class ProcessoEletronicoRN extends InfraRN { |
787 | 788 | |
788 | 789 | return $strHashConteudo; |
789 | 790 | } |
790 | - | |
791 | - private function montarDadosComponenteDigital($parStrNumeroRegistro, $parNumIdentificacaoTramite, $parObjProcesso, $parObjComponentesDigitaisSolicitados) | |
791 | + | |
792 | + private function montarDadosComponenteDigital($parStrNumeroRegistro, $parNumIdentificacaoTramite, $parObjProcesso, $parObjComponentesDigitaisSolicitados) | |
792 | 793 | { |
793 | 794 | //Monta dados dos componentes digitais |
794 | 795 | $arrObjComponenteDigitalDTO = array(); |
795 | 796 | if(!is_array($parObjProcesso->documento)) { |
796 | 797 | $parObjProcesso->documento = array($parObjProcesso->documento); |
797 | 798 | } |
798 | - | |
799 | - foreach ($parObjProcesso->documento as $objDocumento) { | |
799 | + | |
800 | + foreach ($parObjProcesso->documento as $objDocumento) { | |
800 | 801 | $objComponenteDigitalDTO = new ComponenteDigitalDTO(); |
801 | 802 | $objComponenteDigitalDTO->setStrNumeroRegistro($parStrNumeroRegistro); |
802 | 803 | $objComponenteDigitalDTO->setDblIdProcedimento($parObjProcesso->idProcedimentoSEI); //TODO: Error utilizar idProcedimentoSEI devido processos apensados |
... | ... | @@ -807,12 +808,12 @@ class ProcessoEletronicoRN extends InfraRN { |
807 | 808 | |
808 | 809 | //Por enquanto, considera que o documento possui apenas um componente digital |
809 | 810 | if(is_array($objDocumento->componenteDigital) && count($objDocumento->componenteDigital) != 1) { |
810 | - throw new InfraException("Erro processando componentes digitais do processo " . $parObjProcesso->protocolo . "\n Somente é permitido o recebimento de documentos com apenas um Componente Digital."); | |
811 | + throw new InfraException("Erro processando componentes digitais do processo " . $parObjProcesso->protocolo . "\n Somente é permitido o recebimento de documentos com apenas um Componente Digital."); | |
811 | 812 | } |
812 | 813 | |
813 | 814 | $objComponenteDigital = $objDocumento->componenteDigital; |
814 | 815 | $objComponenteDigitalDTO->setStrNome($objComponenteDigital->nome); |
815 | - | |
816 | + | |
816 | 817 | $strHashConteudo = static::getHashFromMetaDados($objComponenteDigital->hash); |
817 | 818 | |
818 | 819 | $objComponenteDigitalDTO->setStrHashConteudo($strHashConteudo); |
... | ... | @@ -820,8 +821,8 @@ class ProcessoEletronicoRN extends InfraRN { |
820 | 821 | $objComponenteDigitalDTO->setStrTipoConteudo($objComponenteDigital->tipoDeConteudo); |
821 | 822 | $objComponenteDigitalDTO->setStrMimeType($objComponenteDigital->mimeType); |
822 | 823 | $objComponenteDigitalDTO->setStrDadosComplementares($objComponenteDigital->dadosComplementaresDoTipoDeArquivo); |
823 | - | |
824 | - //Registrar componente digital necessita ser enviado pelo trâmite espefífico //TODO: Teste $parObjComponentesDigitaisSolicitados aqui | |
824 | + | |
825 | + //Registrar componente digital necessita ser enviado pelo trâmite espefífico //TODO: Teste $parObjComponentesDigitaisSolicitados aqui | |
825 | 826 | if(isset($parObjComponentesDigitaisSolicitados)){ |
826 | 827 | $arrObjItensSolicitados = is_array($parObjComponentesDigitaisSolicitados->processo) ? $parObjComponentesDigitaisSolicitados->processo : array($parObjComponentesDigitaisSolicitados->processo); |
827 | 828 | |
... | ... | @@ -830,16 +831,16 @@ class ProcessoEletronicoRN extends InfraRN { |
830 | 831 | $objItemSolicitado->hash = is_array($objItemSolicitado->hash) ? $objItemSolicitado->hash : array($objItemSolicitado->hash); |
831 | 832 | |
832 | 833 | if($objItemSolicitado->protocolo == $objComponenteDigitalDTO->getStrProtocolo() && in_array($strHashConteudo, $objItemSolicitado->hash) && !$objDocumento->retirado) { |
833 | - $objComponenteDigitalDTO->setStrSinEnviar("S"); | |
834 | + $objComponenteDigitalDTO->setStrSinEnviar("S"); | |
834 | 835 | } |
835 | 836 | } |
836 | - } | |
837 | + } | |
837 | 838 | } |
838 | 839 | |
839 | 840 | //TODO: Avaliar dados do tamanho do documento em bytes salvo na base de dados |
840 | 841 | $objComponenteDigitalDTO->setNumTamanho($objComponenteDigital->tamanhoEmBytes); |
841 | 842 | $objComponenteDigitalDTO->setNumIdAnexo($objComponenteDigital->idAnexo); |
842 | - | |
843 | + | |
843 | 844 | $arrObjComponenteDigitalDTO[] = $objComponenteDigitalDTO; |
844 | 845 | } |
845 | 846 | |
... | ... | @@ -847,7 +848,7 @@ class ProcessoEletronicoRN extends InfraRN { |
847 | 848 | if(isset($parObjProcesso->processoApensado) && count($parObjProcesso->processoApensado)) { |
848 | 849 | foreach ($parObjProcesso->processoApensado as $objProcessoApensado) { |
849 | 850 | $arrObj = $this->montarDadosComponenteDigital($parStrNumeroRegistro, $parNumIdentificacaoTramite, $objProcessoApensado, $parObjComponentesDigitaisSolicitados); |
850 | - $arrObjComponenteDigitalDTO = array_merge($arrObjComponenteDigitalDTO, $arrObj); | |
851 | + $arrObjComponenteDigitalDTO = array_merge($arrObjComponenteDigitalDTO, $arrObj); | |
851 | 852 | } |
852 | 853 | } |
853 | 854 | |
... | ... | @@ -855,16 +856,16 @@ class ProcessoEletronicoRN extends InfraRN { |
855 | 856 | } |
856 | 857 | |
857 | 858 | |
858 | - public function receberComponenteDigital($parNumIdentificacaoTramite, $parStrHashComponenteDigital, $parStrProtocolo) | |
859 | + public function receberComponenteDigital($parNumIdentificacaoTramite, $parStrHashComponenteDigital, $parStrProtocolo) | |
859 | 860 | { |
860 | 861 | try |
861 | - { | |
862 | + { | |
862 | 863 | $parametros = new stdClass(); |
863 | 864 | $parametros->parametrosParaRecebimentoDeComponenteDigital = new stdClass(); |
864 | 865 | $parametros->parametrosParaRecebimentoDeComponenteDigital->identificacaoDoComponenteDigital = new stdClass(); |
865 | 866 | $parametros->parametrosParaRecebimentoDeComponenteDigital->identificacaoDoComponenteDigital->IDT = $parNumIdentificacaoTramite; |
866 | 867 | $parametros->parametrosParaRecebimentoDeComponenteDigital->identificacaoDoComponenteDigital->protocolo = $parStrProtocolo; |
867 | - $parametros->parametrosParaRecebimentoDeComponenteDigital->identificacaoDoComponenteDigital->hashDoComponenteDigital = $parStrHashComponenteDigital; | |
868 | + $parametros->parametrosParaRecebimentoDeComponenteDigital->identificacaoDoComponenteDigital->hashDoComponenteDigital = $parStrHashComponenteDigital; | |
868 | 869 | |
869 | 870 | return $this->getObjPenWs()->receberComponenteDigital($parametros); |
870 | 871 | |
... | ... | @@ -880,40 +881,40 @@ class ProcessoEletronicoRN extends InfraRN { |
880 | 881 | |
881 | 882 | } catch (\Exception $e) { |
882 | 883 | throw new InfraException("Error Processing Request", $e); |
883 | - } | |
884 | - } | |
884 | + } | |
885 | + } | |
885 | 886 | |
886 | - | |
887 | 887 | |
888 | - public function consultarTramites($parNumIdTramite = null, $parNumeroRegistro = null, $parNumeroUnidadeRemetente = null, $parNumeroUnidadeDestino = null, $parProtocolo = null, $parNumeroRepositorioEstruturas = null) | |
888 | + | |
889 | + public function consultarTramites($parNumIdTramite = null, $parNumeroRegistro = null, $parNumeroUnidadeRemetente = null, $parNumeroUnidadeDestino = null, $parProtocolo = null, $parNumeroRepositorioEstruturas = null) | |
889 | 890 | { |
890 | 891 | try |
891 | - { | |
892 | + { | |
892 | 893 | $arrObjTramite = array(); |
893 | 894 | $parametro = new stdClass(); |
894 | 895 | $parametro->filtroDeConsultaDeTramites = new stdClass(); |
895 | 896 | $parametro->filtroDeConsultaDeTramites->IDT = $parNumIdTramite; |
896 | - | |
897 | + | |
897 | 898 | if(!is_null($parNumeroRegistro)){ |
898 | 899 | $parametro->filtroDeConsultaDeTramites->NRE = $parNumeroRegistro; |
899 | 900 | } |
900 | - | |
901 | + | |
901 | 902 | if(!is_null($parNumeroUnidadeRemetente) && !is_null($parNumeroRepositorioEstruturas)){ |
902 | 903 | $parametro->filtroDeConsultaDeTramites->remetente = new stdClass(); |
903 | 904 | $parametro->filtroDeConsultaDeTramites->remetente->identificacaoDoRepositorioDeEstruturas = $parNumeroRepositorioEstruturas; |
904 | 905 | $parametro->filtroDeConsultaDeTramites->remetente->numeroDeIdentificacaoDaEstrutura = $parNumeroUnidadeRemetente; |
905 | 906 | } |
906 | - | |
907 | + | |
907 | 908 | if(!is_null($parNumeroUnidadeDestino) && !is_null($parNumeroRepositorioEstruturas)){ |
908 | 909 | $parametro->filtroDeConsultaDeTramites->destinatario = new stdClass(); |
909 | 910 | $parametro->filtroDeConsultaDeTramites->destinatario->identificacaoDoRepositorioDeEstruturas = $parNumeroRepositorioEstruturas; |
910 | 911 | $parametro->filtroDeConsultaDeTramites->destinatario->numeroDeIdentificacaoDaEstrutura = $parNumeroUnidadeDestino; |
911 | 912 | } |
912 | - | |
913 | + | |
913 | 914 | if(!is_null($parProtocolo)){ |
914 | 915 | $parametro->filtroDeConsultaDeTramites->protocolo = $parProtocolo; |
915 | 916 | } |
916 | - | |
917 | + | |
917 | 918 | $objTramitesEncontrados = $this->getObjPenWs()->consultarTramites($parametro); |
918 | 919 | |
919 | 920 | if(isset($objTramitesEncontrados->tramitesEncontrados)) { |
... | ... | @@ -932,13 +933,13 @@ class ProcessoEletronicoRN extends InfraRN { |
932 | 933 | |
933 | 934 | } catch (\Exception $e) { |
934 | 935 | throw new InfraException("Error Processing Request", $e); |
935 | - } | |
936 | - } | |
937 | - | |
938 | - public function consultarTramitesProtocolo($parProtocoloFormatado) | |
936 | + } | |
937 | + } | |
938 | + | |
939 | + public function consultarTramitesProtocolo($parProtocoloFormatado) | |
939 | 940 | { |
940 | 941 | try |
941 | - { | |
942 | + { | |
942 | 943 | $arrObjTramite = array(); |
943 | 944 | $parametro = new stdClass(); |
944 | 945 | $parametro->filtroDeConsultaDeTramites = new stdClass(); |
... | ... | @@ -962,13 +963,13 @@ class ProcessoEletronicoRN extends InfraRN { |
962 | 963 | |
963 | 964 | } catch (\Exception $e) { |
964 | 965 | throw new InfraException("Error Processing Request", $e); |
965 | - } | |
966 | + } | |
966 | 967 | } |
967 | - | |
968 | - public function cienciaRecusa($parNumIdTramite) | |
968 | + | |
969 | + public function cienciaRecusa($parNumIdTramite) | |
969 | 970 | { |
970 | 971 | try |
971 | - { | |
972 | + { | |
972 | 973 | $parametro = new stdClass(); |
973 | 974 | $parametro->IDT = $parNumIdTramite; |
974 | 975 | |
... | ... | @@ -980,12 +981,12 @@ class ProcessoEletronicoRN extends InfraRN { |
980 | 981 | |
981 | 982 | } catch (\Exception $e) { |
982 | 983 | throw new InfraException("Error Processing Request", $e); |
983 | - } | |
984 | + } | |
984 | 985 | } |
985 | - | |
986 | + | |
986 | 987 | /** |
987 | 988 | * Retorna o estado atual do procedimento no api-pen |
988 | - * | |
989 | + * | |
989 | 990 | * @param integer $dblIdProcedimento |
990 | 991 | * @param integer $numIdRepositorio |
991 | 992 | * @param integer $numIdEstrutura |
... | ... | @@ -994,14 +995,14 @@ class ProcessoEletronicoRN extends InfraRN { |
994 | 995 | public function consultarEstadoProcedimento($strProtocoloFormatado = '', $numIdRepositorio = null, $numIdEstrutura = null) { |
995 | 996 | |
996 | 997 | $objBD = new GenericoBD($this->inicializarObjInfraIBanco()); |
997 | - | |
998 | + | |
998 | 999 | $objProtocoloDTO = new ProtocoloDTO(); |
999 | 1000 | $objProtocoloDTO->setStrProtocoloFormatado($strProtocoloFormatado); |
1000 | 1001 | $objProtocoloDTO->setNumMaxRegistrosRetorno(1); |
1001 | 1002 | $objProtocoloDTO->retDblIdProtocolo(); |
1002 | 1003 | $objProtocoloDTO->retStrProtocoloFormatado(); |
1003 | 1004 | $objProtocoloDTO->retStrStaEstado(); |
1004 | - | |
1005 | + | |
1005 | 1006 | $objProtocoloDTO = $objBD->consultar($objProtocoloDTO); |
1006 | 1007 | |
1007 | 1008 | if (empty($objProtocoloDTO)) { |
... | ... | @@ -1017,24 +1018,24 @@ class ProcessoEletronicoRN extends InfraRN { |
1017 | 1018 | $objTramiteDTO->setOrd('Registro', InfraDTO::$TIPO_ORDENACAO_DESC); |
1018 | 1019 | $objTramiteDTO->setNumMaxRegistrosRetorno(1); |
1019 | 1020 | $objTramiteDTO->retNumIdTramite(); |
1020 | - | |
1021 | + | |
1021 | 1022 | $objTramiteBD = new TramiteBD($this->getObjInfraIBanco()); |
1022 | 1023 | $arrObjTramiteDTO = $objTramiteBD->listar($objTramiteDTO); |
1023 | - | |
1024 | + | |
1024 | 1025 | if(!$arrObjTramiteDTO){ |
1025 | 1026 | throw new InfraException('Trâmite não encontrado'); |
1026 | 1027 | } |
1027 | - | |
1028 | + | |
1028 | 1029 | $objTramiteDTO = $arrObjTramiteDTO[0]; |
1029 | - | |
1030 | + | |
1030 | 1031 | $objFiltro = new stdClass(); |
1031 | 1032 | $objFiltro->filtroDeConsultaDeTramites = new stdClass(); |
1032 | 1033 | $objFiltro->filtroDeConsultaDeTramites->IDT = $objTramiteDTO->getNumIdTramite(); |
1033 | 1034 | |
1034 | 1035 | $objResultado = $this->getObjPenWs()->consultarTramites($objFiltro); |
1035 | 1036 | |
1036 | - $objTramitesEncontrados = $objResultado->tramitesEncontrados; | |
1037 | - | |
1037 | + $objTramitesEncontrados = $objResultado->tramitesEncontrados; | |
1038 | + | |
1038 | 1039 | if (empty($objTramitesEncontrados) || !isset($objTramitesEncontrados->tramite)) { |
1039 | 1040 | throw new InfraException(utf8_encode(sprintf('Nenhum tramite foi encontrado para o procedimento %s', $strProtocoloFormatado))); |
1040 | 1041 | } |
... | ... | @@ -1042,19 +1043,19 @@ class ProcessoEletronicoRN extends InfraRN { |
1042 | 1043 | if(!is_array($objTramitesEncontrados->tramite)){ |
1043 | 1044 | $objTramitesEncontrados->tramite = array($objTramitesEncontrados->tramite); |
1044 | 1045 | } |
1045 | - | |
1046 | + | |
1046 | 1047 | $arrObjTramite = (array) $objTramitesEncontrados->tramite; |
1047 | - | |
1048 | + | |
1048 | 1049 | $objTramite = array_pop($arrObjTramite); |
1049 | - | |
1050 | + | |
1050 | 1051 | if (empty($numIdRepositorio)) { |
1051 | 1052 | $objPenParametroRN = new PenParametroRN(); |
1052 | 1053 | $numIdRepositorio = $objPenParametroRN->getParametro('PEN_ID_REPOSITORIO_ORIGEM'); |
1053 | - | |
1054 | + | |
1054 | 1055 | } |
1055 | 1056 | |
1056 | 1057 | if (empty($numIdEstrutura)) { |
1057 | - | |
1058 | + | |
1058 | 1059 | $objPenUnidadeDTO = new PenUnidadeDTO(); |
1059 | 1060 | $objPenUnidadeDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); |
1060 | 1061 | $objPenUnidadeDTO->retNumIdUnidadeRH(); |
... | ... | @@ -1064,22 +1065,22 @@ class ProcessoEletronicoRN extends InfraRN { |
1064 | 1065 | if (empty($objPenUnidadeDTO)) { |
1065 | 1066 | throw new InfraException(utf8_encode('Número da Unidade RH não foi encontrado')); |
1066 | 1067 | } |
1067 | - | |
1068 | + | |
1068 | 1069 | $numIdEstrutura = $objPenUnidadeDTO->getNumIdUnidadeRH(); |
1069 | 1070 | } |
1070 | 1071 | |
1071 | 1072 | if ($objTramite->remetente->numeroDeIdentificacaoDaEstrutura != $numIdEstrutura || |
1072 | 1073 | $objTramite->remetente->identificacaoDoRepositorioDeEstruturas != $numIdRepositorio) { |
1073 | - | |
1074 | + | |
1074 | 1075 | throw new InfraException(utf8_encode('O último trâmite desse processo não pertence a esse órgão')); |
1075 | 1076 | } |
1076 | - | |
1077 | + | |
1077 | 1078 | switch ($objTramite->situacaoAtual) { |
1078 | 1079 | |
1079 | 1080 | case static::$STA_SITUACAO_TRAMITE_RECIBO_ENVIADO_DESTINATARIO: |
1080 | 1081 | // @todo: caso command-line informar o procedimento que será executado |
1081 | 1082 | $objPenTramiteProcessadoRN = new PenTramiteProcessadoRN(PenTramiteProcessadoRN::STR_TIPO_RECIBO); |
1082 | - | |
1083 | + | |
1083 | 1084 | if(!$objPenTramiteProcessadoRN->isProcedimentoRecebido($objTramite->IDT)){ |
1084 | 1085 | |
1085 | 1086 | $objReceberReciboTramiteRN = new ReceberReciboTramiteRN(); |
... | ... | @@ -1104,28 +1105,28 @@ class ProcessoEletronicoRN extends InfraRN { |
1104 | 1105 | |
1105 | 1106 | $objProtocoloDTO->setStrStaEstado(ProtocoloRN::$TE_NORMAL); |
1106 | 1107 | $objBD->alterar($objProtocoloDTO); |
1107 | - | |
1108 | + | |
1108 | 1109 | if($objTramite->situacaoAtual == static::$STA_SITUACAO_TRAMITE_COMPONENTES_RECEBIDOS_DESTINATARIO && $objTramite->situacaoAtual == static::$STA_SITUACAO_TRAMITE_METADADOS_RECEBIDO_DESTINATARIO){ |
1109 | 1110 | $this->cancelarTramite($objTramite->IDT); |
1110 | 1111 | } |
1111 | - | |
1112 | - return PenConsoleRN::format(sprintf('Processo %s foi atualizado com sucesso', $objProtocoloDTO->getStrProtocoloFormatado()), 'blue'); | |
1112 | + | |
1113 | + return PenConsoleRN::format(sprintf('Processo %s foi atualizado com sucesso', $objProtocoloDTO->getStrProtocoloFormatado()), 'blue'); | |
1113 | 1114 | } |
1114 | 1115 | } |
1115 | 1116 | |
1116 | - public function enviarReciboDeTramite($parNumIdTramite, $parDthRecebimento, $parStrReciboTramite) | |
1117 | + public function enviarReciboDeTramite($parNumIdTramite, $parDthRecebimento, $parStrReciboTramite) | |
1117 | 1118 | { |
1118 | 1119 | try |
1119 | - { | |
1120 | + { | |
1120 | 1121 | $strHashAssinatura = null; |
1121 | 1122 | $objPrivatekey = openssl_pkey_get_private("file://".$this->strLocalCert, $this->strLocalCertPassword); |
1122 | 1123 | |
1123 | 1124 | if ($objPrivatekey === FALSE) { |
1124 | - throw new InfraException("Erro ao obter chave privada do certificado digital."); | |
1125 | + throw new InfraException("Erro ao obter chave privada do certificado digital."); | |
1125 | 1126 | } |
1126 | 1127 | |
1127 | - | |
1128 | - openssl_sign($parStrReciboTramite, $strHashAssinatura, $objPrivatekey, 'sha256'); | |
1128 | + | |
1129 | + openssl_sign($parStrReciboTramite, $strHashAssinatura, $objPrivatekey, 'sha256'); | |
1129 | 1130 | $strHashDaAssinaturaBase64 = base64_encode($strHashAssinatura); |
1130 | 1131 | |
1131 | 1132 | $parametro = new stdClass(); |
... | ... | @@ -1133,21 +1134,21 @@ class ProcessoEletronicoRN extends InfraRN { |
1133 | 1134 | $parametro->dadosDoReciboDeTramite->IDT = $parNumIdTramite; |
1134 | 1135 | $parametro->dadosDoReciboDeTramite->dataDeRecebimento = $parDthRecebimento; |
1135 | 1136 | $parametro->dadosDoReciboDeTramite->hashDaAssinatura = $strHashDaAssinaturaBase64; |
1136 | - | |
1137 | - | |
1137 | + | |
1138 | + | |
1138 | 1139 | $this->getObjPenWs()->enviarReciboDeTramite($parametro); |
1139 | - | |
1140 | + | |
1140 | 1141 | return $strHashDaAssinaturaBase64; |
1141 | 1142 | |
1142 | 1143 | } catch (\SoapFault $fault) { |
1143 | - | |
1144 | + | |
1144 | 1145 | $strMensagem = '[ SOAP Request ]'.PHP_EOL; |
1145 | 1146 | $strMensagem .= 'Method: enviarReciboDeTramite (FAIL)'.PHP_EOL; |
1146 | 1147 | $strMensagem .= 'Request: '.$this->getObjPenWs()->__getLastRequest().PHP_EOL; |
1147 | 1148 | $strMensagem .= 'Response: '.$this->getObjPenWs()->__getLastResponse().PHP_EOL; |
1148 | - | |
1149 | + | |
1149 | 1150 | file_put_contents('/tmp/pen.log', $strMensagem.PHP_EOL, FILE_APPEND); |
1150 | - | |
1151 | + | |
1151 | 1152 | if(isset($objPrivatekey)){ |
1152 | 1153 | openssl_free_key($objPrivatekey); |
1153 | 1154 | } |
... | ... | @@ -1167,51 +1168,51 @@ class ProcessoEletronicoRN extends InfraRN { |
1167 | 1168 | } |
1168 | 1169 | |
1169 | 1170 | throw new InfraException("Error Processing Request", $e); |
1170 | - } | |
1171 | - } | |
1171 | + } | |
1172 | + } | |
1172 | 1173 | |
1173 | - public function receberReciboDeTramite($parNumIdTramite) | |
1174 | + public function receberReciboDeTramite($parNumIdTramite) | |
1174 | 1175 | { |
1175 | 1176 | try |
1176 | - { | |
1177 | + { | |
1177 | 1178 | $parametro = new stdClass(); |
1178 | 1179 | $parametro->IDT = $parNumIdTramite; |
1179 | 1180 | |
1180 | 1181 | $resultado = $this->getObjPenWs()->receberReciboDeTramite($parametro); |
1181 | 1182 | |
1182 | 1183 | return $resultado; |
1183 | - } | |
1184 | + } | |
1184 | 1185 | catch (\SoapFault $fault) { |
1185 | 1186 | $mensagem = $this->tratarFalhaWebService($fault); |
1186 | 1187 | throw new InfraException(InfraString::formatarJavaScript($mensagem), $fault); |
1187 | 1188 | } catch (\Exception $e) { |
1188 | 1189 | throw new InfraException("Error Processing Request", $e); |
1189 | - } | |
1190 | - } | |
1191 | - | |
1190 | + } | |
1191 | + } | |
1192 | + | |
1192 | 1193 | /** |
1193 | 1194 | * Retorna um objeto DTO do recibo de envio do processo ao barramento |
1194 | - * | |
1195 | + * | |
1195 | 1196 | * @param int $parNumIdTramite |
1196 | 1197 | * @return ReciboTramiteEnviadoDTO |
1197 | 1198 | */ |
1198 | 1199 | public function receberReciboDeEnvio($parNumIdTramite) { |
1199 | - | |
1200 | + | |
1200 | 1201 | try { |
1201 | 1202 | $parametro = new stdClass(); |
1202 | 1203 | $parametro->IDT = $parNumIdTramite; |
1203 | - | |
1204 | + | |
1204 | 1205 | $resultado = $this->getObjPenWs()->receberReciboDeEnvio($parametro); |
1205 | 1206 | |
1206 | 1207 | return $resultado->conteudoDoReciboDeEnvio; |
1207 | - } | |
1208 | + } | |
1208 | 1209 | catch (\SoapFault $fault) { |
1209 | 1210 | $mensagem = $this->tratarFalhaWebService($fault); |
1210 | 1211 | throw new InfraException(InfraString::formatarJavaScript($mensagem), $fault); |
1211 | - } | |
1212 | + } | |
1212 | 1213 | catch (\Exception $e) { |
1213 | 1214 | throw new InfraException("Error Processing Request", $e); |
1214 | - } | |
1215 | + } | |
1215 | 1216 | throw new InfraException("Error Processing Request", $e); |
1216 | 1217 | } |
1217 | 1218 | |
... | ... | @@ -1219,7 +1220,7 @@ class ProcessoEletronicoRN extends InfraRN { |
1219 | 1220 | public function converterOperacaoDTO($objOperacaoPEN) |
1220 | 1221 | { |
1221 | 1222 | if(!isset($objOperacaoPEN)) { |
1222 | - throw new InfraException('Parâmetro $objOperacaoPEN não informado.'); | |
1223 | + throw new InfraException('Parâmetro $objOperacaoPEN não informado.'); | |
1223 | 1224 | } |
1224 | 1225 | |
1225 | 1226 | $objOperacaoDTO = new OperacaoDTO(); |
... | ... | @@ -1251,19 +1252,19 @@ class ProcessoEletronicoRN extends InfraRN { |
1251 | 1252 | case "15": $objOperacaoDTO->setStrNome("Desmembramento"); break; |
1252 | 1253 | case "16": $objOperacaoDTO->setStrNome("Desentranhamento"); break; |
1253 | 1254 | case "17": $objOperacaoDTO->setStrNome("Encerramento/abertura de volume no processo"); break; |
1254 | - case "18": $objOperacaoDTO->setStrNome("Registro de extravio"); break; | |
1255 | + case "18": $objOperacaoDTO->setStrNome("Registro de extravio"); break; | |
1255 | 1256 | default: $objOperacaoDTO->setStrNome("Registro"); break; |
1256 | 1257 | } |
1257 | 1258 | |
1258 | 1259 | return $objOperacaoDTO; |
1259 | - } | |
1260 | + } | |
1260 | 1261 | |
1261 | 1262 | //TODO: Implementar mapeamento entre operações do PEN e tarefas do SEI |
1262 | 1263 | public function obterCodigoOperacaoPENMapeado($numIdTarefa) |
1263 | 1264 | { |
1264 | 1265 | $strCodigoOperacao = self::$OP_OPERACAO_REGISTRO; |
1265 | 1266 | |
1266 | - if(isset($numIdTarefa) && $numIdTarefa != 0) { | |
1267 | + if(isset($numIdTarefa) && $numIdTarefa != 0) { | |
1267 | 1268 | $objRelTarefaOperacaoDTO = new RelTarefaOperacaoDTO(); |
1268 | 1269 | $objRelTarefaOperacaoDTO->retStrCodigoOperacao(); |
1269 | 1270 | $objRelTarefaOperacaoDTO->setNumIdTarefa($numIdTarefa); |
... | ... | @@ -1273,24 +1274,24 @@ class ProcessoEletronicoRN extends InfraRN { |
1273 | 1274 | $objRelTarefaOperacaoDTO = $objRelTarefaOperacaoBD->consultar($objRelTarefaOperacaoDTO); |
1274 | 1275 | |
1275 | 1276 | if($objRelTarefaOperacaoDTO != null) { |
1276 | - $strCodigoOperacao = $objRelTarefaOperacaoDTO->getStrCodigoOperacao(); | |
1277 | + $strCodigoOperacao = $objRelTarefaOperacaoDTO->getStrCodigoOperacao(); | |
1277 | 1278 | } |
1278 | 1279 | } |
1279 | 1280 | |
1280 | 1281 | return $strCodigoOperacao; |
1281 | - } | |
1282 | + } | |
1282 | 1283 | |
1283 | 1284 | //TODO: Implementar mapeamento entre operações do PEN e tarefas do SEI |
1284 | 1285 | public function obterIdTarefaSEIMapeado($strCodigoOperacao) |
1285 | 1286 | { |
1286 | 1287 | return self::$TI_PROCESSO_ELETRONICO_PROCESSO_TRAMITE_EXTERNO; |
1287 | - } | |
1288 | - | |
1289 | - | |
1288 | + } | |
1289 | + | |
1290 | + | |
1290 | 1291 | /** |
1291 | 1292 | * Cancela um tramite externo de um procedimento para outra unidade, gera |
1292 | 1293 | * falha caso a unidade de destino já tenha começado a receber o procedimento. |
1293 | - * | |
1294 | + * | |
1294 | 1295 | * @param type $idTramite |
1295 | 1296 | * @param type $idProtocolo |
1296 | 1297 | * @throws Exception|InfraException |
... | ... | @@ -1308,18 +1309,18 @@ class ProcessoEletronicoRN extends InfraRN { |
1308 | 1309 | //Requisita o cancelamento |
1309 | 1310 | $parametros = new stdClass(); |
1310 | 1311 | $parametros->IDT = $idTramite; |
1311 | - | |
1312 | + | |
1312 | 1313 | try{ |
1313 | 1314 | $this->getObjPenWs()->cancelarEnvioDeTramite($parametros); |
1314 | - } | |
1315 | + } | |
1315 | 1316 | catch(\SoapFault $e) { |
1316 | 1317 | throw new InfraException($e->getMessage(), null, $e); |
1317 | - } | |
1318 | + } | |
1318 | 1319 | } |
1319 | - | |
1320 | + | |
1320 | 1321 | /** |
1321 | 1322 | * Método que faz a recusa de um trâmite |
1322 | - * | |
1323 | + * | |
1323 | 1324 | * @param integer $idTramite |
1324 | 1325 | * @param string $justificativa |
1325 | 1326 | * @param integer $motivo |
... | ... | @@ -1328,7 +1329,7 @@ class ProcessoEletronicoRN extends InfraRN { |
1328 | 1329 | */ |
1329 | 1330 | public function recusarTramite($idTramite, $justificativa, $motivo) { |
1330 | 1331 | try { |
1331 | - | |
1332 | + | |
1332 | 1333 | //@TODOJOIN: Adicionar a seguinte linha abaixo dessa : $parametros->recusaDeTramite = new stdClass() |
1333 | 1334 | $parametros = new stdClass(); |
1334 | 1335 | $parametros->recusaDeTramite = new stdClass(); |
... | ... | @@ -1337,12 +1338,12 @@ class ProcessoEletronicoRN extends InfraRN { |
1337 | 1338 | $parametros->recusaDeTramite->motivo = $motivo; |
1338 | 1339 | |
1339 | 1340 | $resultado = $this->getObjPenWs()->recusarTramite($parametros); |
1340 | - | |
1341 | + | |
1341 | 1342 | } catch (SoapFault $fault) { |
1342 | 1343 | |
1343 | 1344 | $mensagem = $this->tratarFalhaWebService($fault); |
1344 | 1345 | throw new InfraException(InfraString::formatarJavaScript($mensagem), $fault); |
1345 | - | |
1346 | + | |
1346 | 1347 | } catch (Exception $e) { |
1347 | 1348 | return $e->getMessage(); |
1348 | 1349 | } |
... | ... | @@ -1357,7 +1358,7 @@ class ProcessoEletronicoRN extends InfraRN { |
1357 | 1358 | |
1358 | 1359 | $tramitePendenteBD = new TramitePendenteBD($this->getObjInfraIBanco()); |
1359 | 1360 | $tramitePendenteBD->cadastrar($tramitePendenteDTO); |
1360 | - | |
1361 | + | |
1361 | 1362 | } catch (\InfraException $ex) { |
1362 | 1363 | throw new InfraException($ex->getStrDescricao()); |
1363 | 1364 | } catch (\Exception $ex) { |
... | ... | @@ -1370,38 +1371,38 @@ class ProcessoEletronicoRN extends InfraRN { |
1370 | 1371 | //Obtem o id_rh que representa a unidade no barramento |
1371 | 1372 | $objPenParametroRN = new PenParametroRN(); |
1372 | 1373 | $numIdRespositorio = $objPenParametroRN->getParametro('PEN_ID_REPOSITORIO_ORIGEM'); |
1373 | - | |
1374 | + | |
1374 | 1375 | //Obtem os dados da unidade |
1375 | 1376 | $objPenUnidadeDTO = new PenUnidadeDTO(); |
1376 | 1377 | $objPenUnidadeDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); |
1377 | 1378 | $objPenUnidadeDTO->retNumIdUnidadeRH(); |
1378 | - | |
1379 | + | |
1379 | 1380 | $objGenericoBD = new GenericoBD($this->inicializarObjInfraIBanco()); |
1380 | 1381 | $objPenUnidadeDTO = $objGenericoBD->consultar($objPenUnidadeDTO); |
1381 | - | |
1382 | + | |
1382 | 1383 | //Obtem os dados do último trâmite desse processo no barramento |
1383 | 1384 | $objProtocoloDTO = new ProtocoloDTO(); |
1384 | 1385 | $objProtocoloDTO->setStrProtocoloFormatado($strProtocolo); |
1385 | 1386 | $objProtocoloDTO->retDblIdProtocolo(); |
1386 | - | |
1387 | + | |
1387 | 1388 | $objProtocoloRN = new ProtocoloRN(); |
1388 | 1389 | $objProtocoloDTO = $objProtocoloRN->consultarRN0186($objProtocoloDTO); |
1389 | - | |
1390 | + | |
1390 | 1391 | $objTramiteDTO = new TramiteDTO(); |
1391 | 1392 | $objTramiteDTO->setNumIdProcedimento($objProtocoloDTO->retDblIdProtocolo()); |
1392 | 1393 | $objTramiteDTO->setOrd('Registro', InfraDTO::$TIPO_ORDENACAO_DESC); |
1393 | 1394 | $objTramiteDTO->setNumMaxRegistrosRetorno(1); |
1394 | 1395 | $objTramiteDTO->retNumIdTramite(); |
1395 | - | |
1396 | + | |
1396 | 1397 | $objTramiteBD = new TramiteBD($this->getObjInfraIBanco()); |
1397 | 1398 | $arrObjTramiteDTO = $objTramiteBD->listar($objTramiteDTO); |
1398 | - | |
1399 | + | |
1399 | 1400 | if(!$arrObjTramiteDTO){ |
1400 | 1401 | return false; |
1401 | 1402 | } |
1402 | - | |
1403 | + | |
1403 | 1404 | $objTramiteDTO = $arrObjTramiteDTO[0]; |
1404 | - | |
1405 | + | |
1405 | 1406 | try { |
1406 | 1407 | |
1407 | 1408 | $parametro = (object)array( |
... | ... | @@ -1413,15 +1414,15 @@ class ProcessoEletronicoRN extends InfraRN { |
1413 | 1414 | ), |
1414 | 1415 | ) |
1415 | 1416 | ); |
1416 | - | |
1417 | - | |
1417 | + | |
1418 | + | |
1418 | 1419 | $objMeta = $this->getObjPenWs()->consultarTramites($parametro); |
1419 | - | |
1420 | - | |
1420 | + | |
1421 | + | |
1421 | 1422 | if($objMeta->tramitesEncontrados) { |
1422 | - | |
1423 | + | |
1423 | 1424 | $arrObjMetaTramite = !is_array($objMeta->tramitesEncontrados->tramite) ? array($objMeta->tramitesEncontrados->tramite) : $objMeta->tramitesEncontrados->tramite; |
1424 | - | |
1425 | + | |
1425 | 1426 | $objMetaTramite = $arrObjMetaTramite[0]; |
1426 | 1427 | |
1427 | 1428 | switch($objMetaTramite->situacaoAtual){ |
... | ... | @@ -1435,7 +1436,7 @@ class ProcessoEletronicoRN extends InfraRN { |
1435 | 1436 | |
1436 | 1437 | } |
1437 | 1438 | } |
1438 | - | |
1439 | + | |
1439 | 1440 | return false; |
1440 | 1441 | } |
1441 | 1442 | catch(SoapFault $e) { |
... | ... | @@ -1445,7 +1446,7 @@ class ProcessoEletronicoRN extends InfraRN { |
1445 | 1446 | return false; |
1446 | 1447 | } |
1447 | 1448 | } |
1448 | - | |
1449 | + | |
1449 | 1450 | public function consultarHipotesesLegais() { |
1450 | 1451 | try{ |
1451 | 1452 | $hipoteses = $this->getObjPenWs()->consultarHipotesesLegais(); |
... | ... | @@ -1455,7 +1456,7 @@ class ProcessoEletronicoRN extends InfraRN { |
1455 | 1456 | return $hipoteses; |
1456 | 1457 | |
1457 | 1458 | } catch(Exception $e){ |
1458 | - throw new InfraException("Erro durante obtenção da resposta das hipóteses legais", $e); | |
1459 | + throw new InfraException("Erro durante obtenção da resposta das hipóteses legais", $e); | |
1459 | 1460 | } |
1460 | 1461 | } |
1461 | 1462 | |
... | ... | @@ -1466,7 +1467,7 @@ class ProcessoEletronicoRN extends InfraRN { |
1466 | 1467 | }catch(Exception $e){ |
1467 | 1468 | throw new InfraException('Erro contando Processos Externos.',$e); |
1468 | 1469 | } |
1469 | - } | |
1470 | + } | |
1470 | 1471 | } |
1471 | 1472 | |
1472 | 1473 | ... | ... |
rn/ProcessoExpedidoRN.php
... | ... | @@ -13,70 +13,76 @@ class ProcessoExpedidoRN extends InfraRN { |
13 | 13 | } |
14 | 14 | |
15 | 15 | public function listarProcessoExpedido(ProtocoloDTO &$objProtocoloDTO) { |
16 | - | |
17 | - | |
18 | - $sql = "SELECT | |
19 | - p.id_protocolo, | |
20 | - p.protocolo_formatado, | |
21 | - a.id_unidade id_unidade, | |
22 | - atd.valor unidade_destino, | |
16 | + | |
17 | + $bolSqlServer = $this->getObjInfraIBanco() instanceof InfraSqlServer; | |
18 | + $numLimit = $objProtocoloDTO->getNumMaxRegistrosRetorno(); | |
19 | + $numOffset = $objProtocoloDTO->getNumPaginaAtual() * $objProtocoloDTO->getNumMaxRegistrosRetorno(); | |
20 | + | |
21 | + $sql = "SELECT " . | |
22 | + (($bolSqlServer) ? "TOP $numLimit " : "") . | |
23 | + " | |
24 | + p.id_protocolo, | |
25 | + p.protocolo_formatado, | |
26 | + a.id_unidade id_unidade, | |
27 | + atd.valor unidade_destino, | |
23 | 28 | us.id_usuario id_usuario, |
24 | 29 | us.nome nome_usuario, |
25 | 30 | a.dth_abertura |
26 | - FROM protocolo p | |
27 | - INNER JOIN atividade a ON a.id_protocolo = p.id_protocolo | |
31 | + FROM protocolo p | |
32 | + INNER JOIN atividade a ON a.id_protocolo = p.id_protocolo | |
28 | 33 | INNER JOIN atributo_andamento atd ON a.id_atividade = atd.id_atividade AND atd.nome = 'UNIDADE_DESTINO' |
29 | 34 | INNER JOIN md_pen_processo_eletronico pe ON pe.id_procedimento = p.id_protocolo |
30 | 35 | INNER JOIN md_pen_tramite ptra ON ptra.numero_registro = pe.numero_registro |
31 | 36 | INNER JOIN usuario us ON ptra.id_usuario = us.id_usuario |
32 | - WHERE | |
37 | + WHERE | |
33 | 38 | p.sta_estado = " . $objProtocoloDTO->getStrStaEstado() . " |
34 | - AND | |
35 | - a.id_tarefa = ". ProcessoEletronicoRN::obterIdTarefaModulo(ProcessoEletronicoRN::$TI_PROCESSO_ELETRONICO_PROCESSO_TRAMITE_EXTERNO) ." | |
36 | - AND | |
39 | + AND | |
40 | + a.id_tarefa = ". ProcessoEletronicoRN::obterIdTarefaModulo(ProcessoEletronicoRN::$TI_PROCESSO_ELETRONICO_PROCESSO_TRAMITE_EXTERNO) ." | |
41 | + AND | |
37 | 42 | ptra.dth_registro = (SELECT MAX(pt.dth_registro) dth_registro FROM md_pen_tramite pt WHERE pt.numero_registro = pe.numero_registro) |
38 | - AND | |
39 | - NOT EXISTS ( | |
40 | - SELECT at2.* FROM atividade as at2 | |
41 | - WHERE at2.id_protocolo = p.id_protocolo | |
42 | - AND at2.id_tarefa = ". ProcessoEletronicoRN::obterIdTarefaModulo(ProcessoEletronicoRN::$TI_PROCESSO_ELETRONICO_PROCESSO_RECEBIDO) ." | |
43 | - AND at2.dth_abertura > a.dth_abertura ) | |
43 | + AND | |
44 | + NOT EXISTS ( | |
45 | + SELECT at2.* FROM atividade as at2 | |
46 | + WHERE at2.id_protocolo = p.id_protocolo | |
47 | + AND at2.id_tarefa = ". ProcessoEletronicoRN::obterIdTarefaModulo(ProcessoEletronicoRN::$TI_PROCESSO_ELETRONICO_PROCESSO_RECEBIDO) ." | |
48 | + AND at2.dth_abertura > a.dth_abertura ) | |
44 | 49 | GROUP BY |
45 | - p.id_protocolo, p.protocolo_formatado, a.id_unidade , atd.valor , us.id_usuario, us.nome, a.dth_abertura ORDER BY a.dth_abertura DESC LIMIT ".$objProtocoloDTO->getNumPaginaAtual() * $objProtocoloDTO->getNumMaxRegistrosRetorno().",".$objProtocoloDTO->getNumMaxRegistrosRetorno()." "; | |
46 | - | |
47 | - | |
48 | - $sqlCount = "SELECT | |
50 | + p.id_protocolo, p.protocolo_formatado, a.id_unidade , atd.valor , us.id_usuario, us.nome, a.dth_abertura ORDER BY a.dth_abertura DESC ". | |
51 | + (($bolSqlServer) ? "OFFSET $numOffset ROWS" : "LIMIT ".$numOffset.",".$numLimit." "); | |
52 | + | |
53 | + | |
54 | + $sqlCount = "SELECT | |
49 | 55 | count(*) total |
50 | - FROM protocolo p | |
51 | - INNER JOIN atividade a ON a.id_protocolo = p.id_protocolo | |
56 | + FROM protocolo p | |
57 | + INNER JOIN atividade a ON a.id_protocolo = p.id_protocolo | |
52 | 58 | INNER JOIN atributo_andamento atd ON a.id_atividade = atd.id_atividade AND atd.nome = 'UNIDADE_DESTINO' |
53 | 59 | INNER JOIN md_pen_processo_eletronico pe ON pe.id_procedimento = p.id_protocolo |
54 | 60 | INNER JOIN md_pen_tramite ptra ON ptra.numero_registro = pe.numero_registro |
55 | 61 | INNER JOIN usuario us ON ptra.id_usuario = us.id_usuario |
56 | - WHERE | |
62 | + WHERE | |
57 | 63 | p.sta_estado = " . $objProtocoloDTO->getStrStaEstado() . " |
58 | - AND | |
59 | - a.id_tarefa = ". ProcessoEletronicoRN::obterIdTarefaModulo(ProcessoEletronicoRN::$TI_PROCESSO_ELETRONICO_PROCESSO_TRAMITE_EXTERNO) ." | |
60 | - AND | |
64 | + AND | |
65 | + a.id_tarefa = ". ProcessoEletronicoRN::obterIdTarefaModulo(ProcessoEletronicoRN::$TI_PROCESSO_ELETRONICO_PROCESSO_TRAMITE_EXTERNO) ." | |
66 | + AND | |
61 | 67 | ptra.dth_registro = (SELECT MAX(pt.dth_registro) dth_registro FROM md_pen_tramite pt WHERE pt.numero_registro = pe.numero_registro) |
62 | - AND | |
63 | - NOT EXISTS ( | |
64 | - SELECT at2.* FROM atividade as at2 | |
65 | - WHERE at2.id_protocolo = p.id_protocolo | |
66 | - AND at2.id_tarefa = ". ProcessoEletronicoRN::obterIdTarefaModulo(ProcessoEletronicoRN::$TI_PROCESSO_ELETRONICO_PROCESSO_RECEBIDO) ." | |
68 | + AND | |
69 | + NOT EXISTS ( | |
70 | + SELECT at2.* FROM atividade as at2 | |
71 | + WHERE at2.id_protocolo = p.id_protocolo | |
72 | + AND at2.id_tarefa = ". ProcessoEletronicoRN::obterIdTarefaModulo(ProcessoEletronicoRN::$TI_PROCESSO_ELETRONICO_PROCESSO_RECEBIDO) ." | |
67 | 73 | AND at2.dth_abertura > a.dth_abertura ) "; |
68 | - | |
69 | - | |
74 | + | |
75 | + | |
70 | 76 | |
71 | 77 | $pag = $this->getObjInfraIBanco()->consultarSql($sql); |
72 | 78 | $count = $this->getObjInfraIBanco()->consultarSql($sqlCount); |
73 | 79 | $total = $count ? $count[0]['total'] : 0; |
74 | - | |
80 | + | |
75 | 81 | $arrProcessosExpedidos = array(); |
76 | 82 | |
77 | 83 | $objProtocoloDTO->setNumTotalRegistros($total); |
78 | 84 | $objProtocoloDTO->setNumRegistrosPaginaAtual(count($pag)); |
79 | - | |
85 | + | |
80 | 86 | foreach ($pag as $res) { |
81 | 87 | $data = new \DateTime($res['dth_abertura']); |
82 | 88 | $objProcessoExpedidoDTO = new ProcessoExpedidoDTO(); |
... | ... | @@ -85,14 +91,10 @@ class ProcessoExpedidoRN extends InfraRN { |
85 | 91 | $objProcessoExpedidoDTO->setStrNomeUsuario($res['nome_usuario']); |
86 | 92 | $objProcessoExpedidoDTO->setDthExpedido($data->format('d/m/Y H:i:s')); |
87 | 93 | $objProcessoExpedidoDTO->setStrDestino($res['unidade_destino']); |
88 | - | |
89 | - | |
90 | - | |
91 | - | |
94 | + | |
92 | 95 | $arrProcessosExpedidos[] = $objProcessoExpedidoDTO; |
93 | 96 | } |
94 | - | |
97 | + | |
95 | 98 | return $arrProcessosExpedidos; |
96 | 99 | } |
97 | - | |
98 | 100 | } | ... | ... |
rn/ReceberProcedimentoRN.php
... | ... | @@ -3,6 +3,7 @@ require_once dirname(__FILE__) . '/../../../SEI.php'; |
3 | 3 | |
4 | 4 | //TODO: Implementar validação sobre tamanho do documento a ser recebido (Parâmetros SEI) |
5 | 5 | |
6 | + | |
6 | 7 | class ReceberProcedimentoRN extends InfraRN |
7 | 8 | { |
8 | 9 | const STR_APENSACAO_PROCEDIMENTOS = 'Relacionamento representando a apensação de processos recebidos externamente'; |
... | ... | @@ -11,7 +12,7 @@ class ReceberProcedimentoRN extends InfraRN |
11 | 12 | private $objInfraParametro; |
12 | 13 | private $objProcedimentoAndamentoRN; |
13 | 14 | private $documentosRetirados = array(); |
14 | - | |
15 | + | |
15 | 16 | public $destinatarioReal = null; |
16 | 17 | |
17 | 18 | public function __construct() |
... | ... | @@ -35,11 +36,11 @@ class ReceberProcedimentoRN extends InfraRN |
35 | 36 | } |
36 | 37 | |
37 | 38 | public function fecharProcedimentoEmOutraUnidades(ProcedimentoDTO $objProcedimentoDTO, $parObjMetadadosProcedimento){ |
38 | - | |
39 | + | |
39 | 40 | $objPenUnidadeDTO = new PenUnidadeDTO(); |
40 | 41 | $objPenUnidadeDTO->setNumIdUnidadeRH($parObjMetadadosProcedimento->metadados->destinatario->numeroDeIdentificacaoDaEstrutura); |
41 | 42 | $objPenUnidadeDTO->retNumIdUnidade(); |
42 | - | |
43 | + | |
43 | 44 | $objGenericoBD = new GenericoBD($this->inicializarObjInfraIBanco()); |
44 | 45 | $objPenUnidadeDTO = $objGenericoBD->consultar($objPenUnidadeDTO); |
45 | 46 | |
... | ... | @@ -63,40 +64,39 @@ class ReceberProcedimentoRN extends InfraRN |
63 | 64 | |
64 | 65 | $objAtividadeRN = new AtividadeRN(); |
65 | 66 | $arrObjAtividadeDTO = (array)$objAtividadeRN->listarRN0036($objAtividadeDTO); |
66 | - | |
67 | + | |
67 | 68 | $objInfraSessao = SessaoSEI::getInstance(); |
68 | 69 | $numIdUnidade = $objInfraSessao->getNumIdUnidadeAtual(); |
69 | - | |
70 | + | |
70 | 71 | foreach($arrObjAtividadeDTO as $objAtividadeDTO) { |
71 | 72 | |
72 | 73 | $objInfraSessao->setNumIdUnidadeAtual($objAtividadeDTO->getNumIdUnidade()); |
73 | 74 | $objInfraSessao->trocarUnidadeAtual(); |
74 | - | |
75 | + | |
75 | 76 | $objProcedimentoRN = new ProcedimentoRN(); |
76 | 77 | $objProcedimentoRN->concluir(array($objProcedimentoDTO)); |
77 | 78 | } |
78 | 79 | $objInfraSessao->setNumIdUnidadeAtual($numIdUnidade); |
79 | 80 | $objInfraSessao->trocarUnidadeAtual(); |
80 | 81 | } |
81 | - | |
82 | + | |
82 | 83 | // TODO: Adicionar comandos de debug. Vide SeiWs.php gerarProcedimento |
83 | 84 | protected function receberProcedimentoControlado($parNumIdentificacaoTramite) |
84 | - { | |
85 | - $objPenParametroRN = new PenParametroRN(); | |
86 | - SessaoSEI::getInstance(false)->simularLogin('SEI', null, null, $objPenParametroRN->getParametro('PEN_UNIDADE_GERADORA_DOCUMENTO_RECEBIDO')); | |
87 | - | |
85 | + { | |
86 | + $objPenParametroRN = new PenParametroRN(); | |
87 | + SessaoSEI::getInstance(false)->simularLogin('SEI', null, null, $objPenParametroRN->getParametro('PEN_UNIDADE_GERADORA_DOCUMENTO_RECEBIDO')); | |
88 | + | |
88 | 89 | $objSeiRN = new SeiRN(); |
89 | - | |
90 | + | |
90 | 91 | error_log(__METHOD__.'('.$parNumIdentificacaoTramite.')'); |
91 | - | |
92 | + | |
92 | 93 | if (!isset($parNumIdentificacaoTramite)) { |
93 | 94 | throw new InfraException('Parâmetro $parNumIdentificacaoTramite não informado.'); |
94 | 95 | } |
95 | - | |
96 | - | |
96 | + | |
97 | 97 | //TODO: Urgente: Verificar o status do trâmite e verificar se ele já foi salvo na base de dados |
98 | 98 | $objMetadadosProcedimento = $this->objProcessoEletronicoRN->solicitarMetadados($parNumIdentificacaoTramite); |
99 | - | |
99 | + | |
100 | 100 | //!Substituir a unidade destinatária para a receptora (!1!) |
101 | 101 | if (isset($objMetadadosProcedimento->metadados->unidadeReceptora)) { |
102 | 102 | $this->destinatarioReal = $objMetadadosProcedimento->metadados->destinatario; |
... | ... | @@ -113,108 +113,108 @@ class ReceberProcedimentoRN extends InfraRN |
113 | 113 | if($this->tramiteRegistrado($strNumeroRegistro, $parNumIdentificacaoTramite)) { |
114 | 114 | return ; |
115 | 115 | } |
116 | - | |
116 | + | |
117 | 117 | // Validação dos dados do processo recebido |
118 | 118 | $objInfraException = new InfraException(); |
119 | 119 | $this->validarDadosDestinatario($objInfraException, $objMetadadosProcedimento); |
120 | 120 | $objInfraException->lancarValidacoes(); |
121 | - | |
121 | + | |
122 | 122 | #############################INICIA O RECEBIMENTO DOS COMPONENTES DIGITAIS US010################################################ |
123 | 123 | $arrObjTramite = $this->objProcessoEletronicoRN->consultarTramites($parNumIdentificacaoTramite); |
124 | 124 | $objTramite = $arrObjTramite[0]; |
125 | - | |
125 | + | |
126 | 126 | //Obtém lista de componentes digitais que precisam ser obtidos |
127 | 127 | if(!is_array($objTramite->componenteDigitalPendenteDeRecebimento)){ |
128 | 128 | $objTramite->componenteDigitalPendenteDeRecebimento = array($objTramite->componenteDigitalPendenteDeRecebimento); |
129 | 129 | } |
130 | 130 | |
131 | - //Faz a validação do tamanho e espécie dos componentes digitais | |
131 | + //Faz a validação do tamanho e espécie dos componentes digitais | |
132 | 132 | $this->validarComponentesDigitais($objProcesso, $parNumIdentificacaoTramite); |
133 | - | |
133 | + | |
134 | 134 | //Faz a validação da extensão dos componentes digitais a serem recebidos |
135 | 135 | $this->validarExtensaoComponentesDigitais($parNumIdentificacaoTramite, $objProcesso); |
136 | - | |
137 | - //Faz a validação das permissões de leitura e escrita | |
136 | + | |
137 | + //Faz a validação das permissões de leitura e escrita | |
138 | 138 | $this->verificarPermissoesDiretorios($parNumIdentificacaoTramite); |
139 | - | |
139 | + | |
140 | 140 | $arrStrNomeDocumento = $this->listarMetaDadosComponentesDigitais($objProcesso); |
141 | - | |
141 | + | |
142 | 142 | //Instancia a RN que faz o recebimento dos componentes digitais |
143 | 143 | $receberComponenteDigitalRN = new ReceberComponenteDigitalRN(); |
144 | 144 | |
145 | 145 | //Cria o array que receberá os anexos após os arquivos físicos serem salvos |
146 | 146 | $arrAnexosComponentes = array(); |
147 | - | |
147 | + | |
148 | 148 | //Cria o array com a lista de hash |
149 | 149 | $arrayHash = array(); |
150 | - | |
151 | - | |
150 | + | |
151 | + | |
152 | 152 | //Percorre os componentes que precisam ser recebidos |
153 | 153 | foreach($objTramite->componenteDigitalPendenteDeRecebimento as $key => $componentePendente){ |
154 | - | |
154 | + | |
155 | 155 | if(!is_null($componentePendente)){ |
156 | - | |
156 | + | |
157 | 157 | //Adiciona o hash do componente digital ao array |
158 | 158 | $arrayHash[] = $componentePendente; |
159 | - | |
159 | + | |
160 | 160 | //Obter os dados do componente digital |
161 | 161 | $objComponenteDigital = $this->objProcessoEletronicoRN->receberComponenteDigital($parNumIdentificacaoTramite, $componentePendente, $objTramite->protocolo); |
162 | 162 | //Copia o componente para a pasta temporária |
163 | 163 | $arrAnexosComponentes[$key][$componentePendente] = $receberComponenteDigitalRN->copiarComponenteDigitalPastaTemporaria($objComponenteDigital); |
164 | 164 | $arrAnexosComponentes[$key]['recebido'] = false; |
165 | - | |
165 | + | |
166 | 166 | //Valida a integridade do hash |
167 | 167 | $receberComponenteDigitalRN->validarIntegridadeDoComponenteDigital($arrAnexosComponentes[$key][$componentePendente], $componentePendente, $parNumIdentificacaoTramite); |
168 | 168 | } |
169 | 169 | } |
170 | - | |
170 | + | |
171 | 171 | if(count($arrAnexosComponentes) > 0){ |
172 | - | |
172 | + | |
173 | 173 | $receberComponenteDigitalRN->setArrAnexos($arrAnexosComponentes); |
174 | 174 | } |
175 | 175 | #############################TERMINA O RECEBIMENTO DOS COMPONENTES DIGITAIS US010################################################ |
176 | - | |
176 | + | |
177 | 177 | $arrObjTramite = $this->objProcessoEletronicoRN->consultarTramites($parNumIdentificacaoTramite); |
178 | 178 | $objTramite = $arrObjTramite[0]; |
179 | - | |
179 | + | |
180 | 180 | //Verifica se o trâmite está recusado |
181 | 181 | if($objTramite->situacaoAtual == ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_RECUSADO) { |
182 | 182 | return; |
183 | 183 | } |
184 | - | |
184 | + | |
185 | 185 | $objProcedimentoDTO = $this->registrarProcesso($strNumeroRegistro, $parNumIdentificacaoTramite, $objProcesso, $objMetadadosProcedimento); |
186 | 186 | |
187 | - | |
188 | 187 | |
189 | - | |
190 | - | |
188 | + | |
189 | + | |
190 | + | |
191 | 191 | // @join_tec US008.08 (#23092) |
192 | 192 | $this->objProcedimentoAndamentoRN->setOpts($objProcedimentoDTO->getDblIdProcedimento(), $parNumIdentificacaoTramite, ProcessoEletronicoRN::obterIdTarefaModulo(ProcessoEletronicoRN::$TI_PROCESSO_ELETRONICO_PROCESSO_RECEBIDO)); |
193 | - $this->objProcedimentoAndamentoRN->cadastrar('Obtendo metadados do processo', 'S'); | |
193 | + $this->objProcedimentoAndamentoRN->cadastrar('Obtendo metadados do processo', 'S'); | |
194 | 194 | |
195 | 195 | //Verificar se procedimento já existia na base de dados do sistema |
196 | 196 | //$dblIdProcedimento = $this->consultarProcedimentoExistente($strNumeroRegistro, $strProtocolo); |
197 | 197 | |
198 | 198 | //if(isset($dblIdProcedimento)){ |
199 | 199 | //TODO: Tratar situação em que o processo (NUP) já existia na base do sistema mas não havia nenhum NRE registrado para ele |
200 | - // $objProcedimentoDTO = $this->atualizarProcedimento($dblIdProcedimento, $objMetadadosProcedimento, $objProcesso); | |
200 | + // $objProcedimentoDTO = $this->atualizarProcedimento($dblIdProcedimento, $objMetadadosProcedimento, $objProcesso); | |
201 | 201 | //} |
202 | - //else { | |
202 | + //else { | |
203 | 203 | //TODO: Gerar Procedimento com status BLOQUEADO, aguardando o recebimento dos componentes digitais |
204 | 204 | // $objProcedimentoDTO = $this->gerarProcedimento($objMetadadosProcedimento, $objProcesso); |
205 | 205 | //} |
206 | 206 | |
207 | 207 | //TODO: Fazer o envio de cada um dos procedimentos apensados (Processo principal e seus apensados, caso exista) |
208 | - //... | |
208 | + //... | |
209 | 209 | //TODO: Parei aqui!!! Recebimento de processos apensados |
210 | - | |
211 | - $objProcessoEletronicoDTO = $this->objProcessoEletronicoRN->cadastrarTramiteDeProcesso($objProcedimentoDTO->getDblIdProcedimento(), | |
210 | + | |
211 | + $objProcessoEletronicoDTO = $this->objProcessoEletronicoRN->cadastrarTramiteDeProcesso($objProcedimentoDTO->getDblIdProcedimento(), | |
212 | 212 | $strNumeroRegistro, $parNumIdentificacaoTramite, null, $objProcesso); |
213 | - | |
214 | 213 | |
215 | - | |
214 | + | |
215 | + | |
216 | 216 | //TODO: Passar implementação para outra classe de negócio |
217 | - //Verifica se o tramite se encontra na situação correta | |
217 | + //Verifica se o tramite se encontra na situação correta | |
218 | 218 | $arrObjTramite = $this->objProcessoEletronicoRN->consultarTramites($parNumIdentificacaoTramite); |
219 | 219 | if(!isset($arrObjTramite) || count($arrObjTramite) != 1) { |
220 | 220 | throw new InfraException("Trâmite não pode ser localizado pelo identificado $parNumIdentificacaoTramite."); |
... | ... | @@ -222,18 +222,18 @@ class ReceberProcedimentoRN extends InfraRN |
222 | 222 | |
223 | 223 | |
224 | 224 | $objTramite = $arrObjTramite[0]; |
225 | - | |
225 | + | |
226 | 226 | |
227 | 227 | if($objTramite->situacaoAtual != ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_COMPONENTES_RECEBIDOS_DESTINATARIO) { |
228 | 228 | return; |
229 | 229 | } |
230 | - | |
231 | 230 | |
232 | - | |
231 | + | |
232 | + | |
233 | 233 | // throw new InfraException("COMPONENTES DIGITAIS A SEREM ANEXADOS: ".var_export($arrayHash, true)); |
234 | 234 | if(count($arrayHash) > 0){ |
235 | - | |
236 | - //Obter dados dos componetes digitais | |
235 | + | |
236 | + //Obter dados dos componetes digitais | |
237 | 237 | $objComponenteDigitalDTO = new ComponenteDigitalDTO(); |
238 | 238 | $objComponenteDigitalDTO->setStrNumeroRegistro($strNumeroRegistro); |
239 | 239 | $objComponenteDigitalDTO->setNumIdTramite($parNumIdentificacaoTramite); |
... | ... | @@ -249,54 +249,54 @@ class ReceberProcedimentoRN extends InfraRN |
249 | 249 | $objComponenteDigitalDTO->retNumIdTramite(); |
250 | 250 | $objComponenteDigitalDTO->retStrNome(); |
251 | 251 | $objComponenteDigitalDTO->retStrStaEstadoProtocolo(); |
252 | - | |
252 | + | |
253 | 253 | $objComponenteDigitalBD = new ComponenteDigitalBD($this->getObjInfraIBanco()); |
254 | 254 | $arrObjComponentesDigitaisDTO = $objComponenteDigitalBD->listar($objComponenteDigitalDTO); |
255 | - | |
255 | + | |
256 | 256 | // throw new InfraException('Componentes encontrados: '.var_export($arrObjComponentesDigitaisDTO, true)); |
257 | - | |
257 | + | |
258 | 258 | if ($objComponenteDigitalBD->contar($objComponenteDigitalDTO) > 0) { |
259 | - | |
259 | + | |
260 | 260 | $objReceberComponenteDigitalRN = $receberComponenteDigitalRN; |
261 | - | |
261 | + | |
262 | 262 | foreach($arrObjComponentesDigitaisDTO as $objComponenteDigitalDTOEnviado) { |
263 | 263 | if($objComponenteDigitalDTOEnviado->getStrStaEstadoProtocolo() != ProtocoloRN::$TE_DOCUMENTO_CANCELADO){ |
264 | - $strHash = $objComponenteDigitalDTOEnviado->getStrHashConteudo(); | |
264 | + $strHash = $objComponenteDigitalDTOEnviado->getStrHashConteudo(); | |
265 | 265 | $strNomeDocumento = (array_key_exists($strHash, $arrStrNomeDocumento)) ? $arrStrNomeDocumento[$strHash]['especieNome'] : '[Desconhecido]'; |
266 | - | |
266 | + | |
267 | 267 | $objReceberComponenteDigitalRN->receberComponenteDigital($objComponenteDigitalDTOEnviado); |
268 | 268 | |
269 | 269 | // @join_tec US008.09 (#23092) |
270 | 270 | $this->objProcedimentoAndamentoRN->cadastrar(sprintf('Recebendo %s %s', $strNomeDocumento, $objComponenteDigitalDTOEnviado->getStrProtocoloDocumentoFormatado()), 'S'); |
271 | 271 | } |
272 | - | |
272 | + | |
273 | 273 | } |
274 | 274 | // @join_tec US008.10 (#23092) |
275 | 275 | $this->objProcedimentoAndamentoRN->cadastrar('Todos os componentes digitais foram recebidos', 'S'); |
276 | 276 | |
277 | 277 | }else{ |
278 | 278 | $this->objProcedimentoAndamentoRN->cadastrar('Nenhum componente digital para receber', 'S'); |
279 | - } | |
279 | + } | |
280 | 280 | } |
281 | 281 | } |
282 | - | |
282 | + | |
283 | 283 | //$this->fecharProcedimentoEmOutraUnidades($objProcedimentoDTO, $objMetadadosProcedimento); |
284 | - | |
284 | + | |
285 | 285 | $objEnviarReciboTramiteRN = new EnviarReciboTramiteRN(); |
286 | 286 | $objEnviarReciboTramiteRN->enviarReciboTramiteProcesso($parNumIdentificacaoTramite, $arrayHash); |
287 | - | |
287 | + | |
288 | 288 | $objPenTramiteProcessadoRN = new PenTramiteProcessadoRN(PenTramiteProcessadoRN::STR_TIPO_PROCESSO); |
289 | 289 | $objPenTramiteProcessadoRN->setRecebido($parNumIdentificacaoTramite); |
290 | - | |
290 | + | |
291 | 291 | } |
292 | - | |
292 | + | |
293 | 293 | /** |
294 | 294 | * Retorna um array com alguns metadados, onde o indice de é o hash do arquivo |
295 | - * | |
295 | + * | |
296 | 296 | * @return array[String] |
297 | 297 | */ |
298 | 298 | private function listarMetaDadosComponentesDigitais($objProcesso){ |
299 | - | |
299 | + | |
300 | 300 | $objMapBD = new GenericoBD($this->getObjInfraIBanco()); |
301 | 301 | $arrMetadadoDocumento = array(); |
302 | 302 | $arrObjDocumento = is_array($objProcesso->documento) ? $objProcesso->documento : array($objProcesso->documento); |
... | ... | @@ -304,7 +304,7 @@ class ReceberProcedimentoRN extends InfraRN |
304 | 304 | foreach($arrObjDocumento as $objDocumento){ |
305 | 305 | |
306 | 306 | $strHash = ProcessoEletronicoRN::getHashFromMetaDados($objDocumento->componenteDigital->hash); |
307 | - | |
307 | + | |
308 | 308 | $objMapDTO = new PenRelTipoDocMapRecebidoDTO(true); |
309 | 309 | $objMapDTO->setNumMaxRegistrosRetorno(1); |
310 | 310 | $objMapDTO->setNumCodigoEspecie($objDocumento->especie->codigo); |
... | ... | @@ -318,15 +318,15 @@ class ReceberProcedimentoRN extends InfraRN |
318 | 318 | else { |
319 | 319 | $strNomeDocumento = $objMapDTO->getStrNomeSerie(); |
320 | 320 | } |
321 | - | |
321 | + | |
322 | 322 | $arrMetadadoDocumento[$strHash] = array( |
323 | 323 | 'especieNome' => $strNomeDocumento |
324 | - ); | |
324 | + ); | |
325 | 325 | } |
326 | - | |
326 | + | |
327 | 327 | return $arrMetadadoDocumento; |
328 | 328 | } |
329 | - | |
329 | + | |
330 | 330 | /** |
331 | 331 | * Valida cada componente digital, se não algum não for aceito recusa o tramite |
332 | 332 | * do procedimento para esta unidade |
... | ... | @@ -334,7 +334,7 @@ class ReceberProcedimentoRN extends InfraRN |
334 | 334 | private function validarComponentesDigitais($objProcesso, $parNumIdentificacaoTramite){ |
335 | 335 | |
336 | 336 | $arrObjDocumentos = is_array($objProcesso->documento) ? $objProcesso->documento : array($objProcesso->documento); |
337 | - | |
337 | + | |
338 | 338 | foreach($arrObjDocumentos as $objDocument){ |
339 | 339 | |
340 | 340 | $objPenRelTipoDocMapEnviadoDTO = new PenRelTipoDocMapRecebidoDTO(); |
... | ... | @@ -349,7 +349,7 @@ class ReceberProcedimentoRN extends InfraRN |
349 | 349 | if($numContador <= 0) { |
350 | 350 | $this->objProcessoEletronicoRN->recusarTramite($parNumIdentificacaoTramite, sprintf('Documento do tipo %s não está mapeado', utf8_decode($objDocument->especie->nomeNoProdutor)), ProcessoEletronicoRN::MTV_RCSR_TRAM_CD_ESPECIE_NAO_MAPEADA); |
351 | 351 | throw new InfraException(sprintf('Documento do tipo %s não está mapeado. Motivo da Recusa no Barramento: %s', $objDocument->especie->nomeNoProdutor, ProcessoEletronicoRN::$MOTIVOS_RECUSA[ProcessoEletronicoRN::MTV_RCSR_TRAM_CD_ESPECIE_NAO_MAPEADA])); |
352 | - } | |
352 | + } | |
353 | 353 | } |
354 | 354 | |
355 | 355 | |
... | ... | @@ -362,10 +362,10 @@ class ReceberProcedimentoRN extends InfraRN |
362 | 362 | foreach($arrObjDocumentos as $objDocument) { |
363 | 363 | |
364 | 364 | |
365 | - if (is_null($objDocument->componenteDigital->tamanhoEmBytes) || $objDocument->componenteDigital->tamanhoEmBytes == 0){ | |
366 | - | |
365 | + if (is_null($objDocument->componenteDigital->tamanhoEmBytes) || $objDocument->componenteDigital->tamanhoEmBytes == 0){ | |
366 | + | |
367 | 367 | throw new InfraException('Tamanho de componente digital não informado.', null, 'RECUSA: '.ProcessoEletronicoRN::MTV_RCSR_TRAM_CD_OUTROU); |
368 | - | |
368 | + | |
369 | 369 | } |
370 | 370 | |
371 | 371 | if($objDocument->componenteDigital->tamanhoEmBytes > ($numTamDocExterno * 1024 * 1024)){ |
... | ... | @@ -376,20 +376,20 @@ class ReceberProcedimentoRN extends InfraRN |
376 | 376 | |
377 | 377 | } |
378 | 378 | } |
379 | - | |
379 | + | |
380 | 380 | } |
381 | 381 | |
382 | 382 | |
383 | 383 | private function registrarProcesso($parStrNumeroRegistro, $parNumIdentificacaoTramite, $parObjProcesso, $parObjMetadadosProcedimento) |
384 | 384 | { |
385 | - | |
386 | - | |
385 | + | |
386 | + | |
387 | 387 | // Validação dos dados do processo recebido |
388 | 388 | $objInfraException = new InfraException(); |
389 | 389 | $this->validarDadosProcesso($objInfraException, $parObjProcesso); |
390 | 390 | $this->validarDadosDocumentos($objInfraException, $parObjProcesso); |
391 | 391 | |
392 | - //TODO: Regra de Negócio - Processos recebidos pelo Barramento não poderão disponibilizar a opção de reordenação e cancelamento de documentos | |
392 | + //TODO: Regra de Negócio - Processos recebidos pelo Barramento não poderão disponibilizar a opção de reordenação e cancelamento de documentos | |
393 | 393 | //para o usuário final, mesmo possuindo permissão para isso |
394 | 394 | |
395 | 395 | $objInfraException->lancarValidacoes(); |
... | ... | @@ -398,18 +398,18 @@ class ReceberProcedimentoRN extends InfraRN |
398 | 398 | $dblIdProcedimento = $this->consultarProcedimentoExistente($parStrNumeroRegistro, $parObjProcesso->protocolo); |
399 | 399 | |
400 | 400 | if(isset($dblIdProcedimento)){ |
401 | - | |
401 | + | |
402 | 402 | //TODO: Tratar situação em que o processo (NUP) já existia na base do sistema mas não havia nenhum NRE registrado para ele |
403 | - $objProcedimentoDTO = $this->atualizarProcedimento($dblIdProcedimento, $parObjMetadadosProcedimento, $parObjProcesso); | |
403 | + $objProcedimentoDTO = $this->atualizarProcedimento($dblIdProcedimento, $parObjMetadadosProcedimento, $parObjProcesso); | |
404 | 404 | } |
405 | - else { | |
406 | - | |
405 | + else { | |
406 | + | |
407 | 407 | //TODO: Gerar Procedimento com status BLOQUEADO, aguardando o recebimento dos componentes digitais |
408 | 408 | $objProcedimentoDTO = $this->gerarProcedimento($parObjMetadadosProcedimento, $parObjProcesso); |
409 | 409 | } |
410 | 410 | |
411 | 411 | //TODO: Fazer o envio de cada um dos procedimentos apensados (Processo principal e seus apensados, caso exista) |
412 | - //... | |
412 | + //... | |
413 | 413 | |
414 | 414 | //Chamada recursiva para registro dos processos apensados |
415 | 415 | if(isset($objProcesso->processoApensado)) { |
... | ... | @@ -419,7 +419,7 @@ class ReceberProcedimentoRN extends InfraRN |
419 | 419 | |
420 | 420 | foreach ($objProcesso->processoApensado as $objProcessoApensado) { |
421 | 421 | $this->registrarProcesso($parStrNumeroRegistro, $parNumIdentificacaoTramite, $objProcessoApensado, $parObjMetadadosProcedimento); |
422 | - } | |
422 | + } | |
423 | 423 | } |
424 | 424 | |
425 | 425 | return $objProcedimentoDTO; |
... | ... | @@ -437,7 +437,7 @@ class ReceberProcedimentoRN extends InfraRN |
437 | 437 | |
438 | 438 | private function consultarProcedimentoExistente($parStrNumeroRegistro, $parStrProtocolo = null) { |
439 | 439 | |
440 | - $dblIdProcedimento = null; | |
440 | + $dblIdProcedimento = null; | |
441 | 441 | |
442 | 442 | $objProcessoEletronicoDTO = new ProcessoEletronicoDTO(); |
443 | 443 | $objProcessoEletronicoDTO->retDblIdProcedimento(); |
... | ... | @@ -455,31 +455,31 @@ class ReceberProcedimentoRN extends InfraRN |
455 | 455 | } |
456 | 456 | |
457 | 457 | private function atualizarProcedimento($parDblIdProcedimento, $objMetadadosProcedimento, $objProcesso){ |
458 | - | |
459 | - | |
458 | + | |
459 | + | |
460 | 460 | if(!isset($parDblIdProcedimento)){ |
461 | 461 | throw new InfraException('Parâmetro $parDblIdProcedimento não informado.'); |
462 | - } | |
462 | + } | |
463 | 463 | |
464 | 464 | if(!isset($objMetadadosProcedimento)){ |
465 | 465 | throw new InfraException('Parâmetro $objMetadadosProcedimento não informado.'); |
466 | 466 | } |
467 | - | |
468 | - | |
467 | + | |
468 | + | |
469 | 469 | if ($this->destinatarioReal) { |
470 | 470 | $objDestinatario = $this->destinatarioReal; |
471 | 471 | } else { |
472 | 472 | $objDestinatario = $objMetadadosProcedimento->metadados->destinatario; |
473 | 473 | } |
474 | - | |
474 | + | |
475 | 475 | //TODO: Refatorar código para criar método de pesquisa do procedimento e reutilizá-la |
476 | 476 | |
477 | 477 | //$objProcedimentoDTO = new ProcedimentoDTO(); |
478 | 478 | //$objProcedimentoDTO->setDblIdProcedimento($parDblIdProcedimento); |
479 | 479 | //$objProcedimentoDTO->retTodos(); |
480 | - //$objProcedimentoDTO->retStrProtocoloProcedimentoFormatado(); | |
480 | + //$objProcedimentoDTO->retStrProtocoloProcedimentoFormatado(); | |
481 | 481 | //$objProcedimentoDTO->setStrSinDocTodos('S'); |
482 | - | |
482 | + | |
483 | 483 | //$objProcedimentoRN = new ProcedimentoRN(); |
484 | 484 | //$arrObjProcedimentoDTO = $objProcedimentoRN->listarCompleto($objProcedimentoDTO); |
485 | 485 | |
... | ... | @@ -488,25 +488,25 @@ class ReceberProcedimentoRN extends InfraRN |
488 | 488 | //} |
489 | 489 | |
490 | 490 | //$objProcedimentoDTO = $arrObjProcedimentoDTO[0]; |
491 | - | |
491 | + | |
492 | 492 | $objAtividadeDTO = new AtividadeDTO(); |
493 | 493 | $objAtividadeDTO->setStrIdTarefaModuloTarefa(ProcessoEletronicoRN::$TI_PROCESSO_ELETRONICO_PROCESSO_EXPEDIDO); |
494 | 494 | $objAtividadeDTO->setDblIdProcedimentoProtocolo($parDblIdProcedimento); |
495 | 495 | $objAtividadeDTO->setOrd('Conclusao', InfraDTO::$TIPO_ORDENACAO_DESC); |
496 | 496 | $objAtividadeDTO->setNumMaxRegistrosRetorno(1); |
497 | 497 | $objAtividadeDTO->retNumIdUnidade(); |
498 | - | |
498 | + | |
499 | 499 | $objAtividadeRN = new AtividadeRN(); |
500 | 500 | $arrObjAtividadeDTO = $objAtividadeRN->listarRN0036($objAtividadeDTO); |
501 | 501 | $numIdUnidade = SessaoSEI::getInstance()->getNumIdUnidadeAtual(); |
502 | - | |
502 | + | |
503 | 503 | if($arrObjAtividadeDTO){ |
504 | 504 | $objAtividadeDTO = $arrObjAtividadeDTO[0]; |
505 | 505 | $numIdUnidade = $objAtividadeDTO->getNumIdUnidade(); |
506 | 506 | } |
507 | - | |
507 | + | |
508 | 508 | $objSeiRN = new SeiRN(); |
509 | - | |
509 | + | |
510 | 510 | $objAtividadeDTO = new AtividadeDTO(); |
511 | 511 | $objAtividadeDTO->retDthConclusao(); |
512 | 512 | $objAtividadeDTO->setDblIdProtocolo($parDblIdProcedimento); |
... | ... | @@ -514,13 +514,13 @@ class ReceberProcedimentoRN extends InfraRN |
514 | 514 | |
515 | 515 | $arrObjAtividadeDTO = $objAtividadeRN->listarRN0036($objAtividadeDTO); |
516 | 516 | $flgReabrir = true; |
517 | - | |
517 | + | |
518 | 518 | foreach ($arrObjAtividadeDTO as $objAtividadeDTO) { |
519 | 519 | if ($objAtividadeDTO->getDthConclusao() == null) { |
520 | 520 | $flgReabrir = false; |
521 | 521 | } |
522 | 522 | } |
523 | - | |
523 | + | |
524 | 524 | $objProcedimentoDTO = new ProcedimentoDTO(); |
525 | 525 | $objProcedimentoDTO->setDblIdProcedimento($parDblIdProcedimento); |
526 | 526 | $objProcedimentoDTO->retTodos(); |
... | ... | @@ -528,40 +528,40 @@ class ReceberProcedimentoRN extends InfraRN |
528 | 528 | |
529 | 529 | $objProcedimentoRN = new ProcedimentoRN(); |
530 | 530 | $objProcedimentoDTO = $objProcedimentoRN->consultarRN0201($objProcedimentoDTO); |
531 | - | |
531 | + | |
532 | 532 | $this->registrarAndamentoRecebimentoProcesso($objProcedimentoDTO, $objMetadadosProcedimento); |
533 | - | |
534 | - | |
533 | + | |
534 | + | |
535 | 535 | if($flgReabrir){ |
536 | 536 | $objEntradaReabrirProcessoAPI = new EntradaReabrirProcessoAPI(); |
537 | 537 | $objEntradaReabrirProcessoAPI->setIdProcedimento($parDblIdProcedimento); |
538 | 538 | $objSeiRN->reabrirProcesso($objEntradaReabrirProcessoAPI); |
539 | 539 | } |
540 | - | |
540 | + | |
541 | 541 | //Cadastro das atividades para quando o destinatário é desviado pelo receptor (!3!) |
542 | 542 | if ($this->destinatarioReal->numeroDeIdentificacaoDaEstrutura) { |
543 | 543 | $this->gerarAndamentoUnidadeReceptora($parDblIdProcedimento); |
544 | 544 | } |
545 | 545 | |
546 | - | |
546 | + | |
547 | 547 | $objEntradaDesbloquearProcessoAPI = new EntradaDesbloquearProcessoAPI(); |
548 | - $objEntradaDesbloquearProcessoAPI->setIdProcedimento($parDblIdProcedimento); | |
548 | + $objEntradaDesbloquearProcessoAPI->setIdProcedimento($parDblIdProcedimento); | |
549 | 549 | $objSeiRN->desbloquearProcesso($objEntradaDesbloquearProcessoAPI); |
550 | - | |
550 | + | |
551 | 551 | //TODO: Obter código da unidade através de mapeamento entre SEI e Barramento |
552 | 552 | $objUnidadeDTO = $this->atribuirDadosUnidade($objProcedimentoDTO, $objDestinatario); |
553 | 553 | |
554 | - $this->atribuirDocumentos($objProcedimentoDTO, $objProcesso, $objUnidadeDTO, $objMetadadosProcedimento); | |
554 | + $this->atribuirDocumentos($objProcedimentoDTO, $objProcesso, $objUnidadeDTO, $objMetadadosProcedimento); | |
555 | 555 | $this->registrarProcedimentoNaoVisualizado($objProcedimentoDTO); |
556 | 556 | |
557 | 557 | //TODO: Avaliar necessidade de restringir referência circular entre processos |
558 | 558 | //TODO: Registrar que o processo foi recebido com outros apensados. Necessário para posterior reenvio |
559 | 559 | $this->atribuirProcessosApensados($objProcedimentoDTO, $objProcesso->processoApensado); |
560 | - | |
560 | + | |
561 | 561 | //Realiza a alteração dos metadados do processo |
562 | 562 | //TODO: Implementar alteração de todos os metadados |
563 | 563 | $this->alterarMetadadosProcedimento($objProcedimentoDTO->getDblIdProcedimento(), $objProcesso); |
564 | - | |
564 | + | |
565 | 565 | //TODO: Finalizar o envio do documento para a respectiva unidade |
566 | 566 | $this->enviarProcedimentoUnidade($objProcedimentoDTO, true); |
567 | 567 | |
... | ... | @@ -578,14 +578,14 @@ class ReceberProcedimentoRN extends InfraRN |
578 | 578 | |
579 | 579 | |
580 | 580 | } |
581 | - | |
581 | + | |
582 | 582 | private function gerarAndamentoUnidadeReceptora($parNumIdProcedimento) { |
583 | - | |
583 | + | |
584 | 584 | $objUnidadeDTO = new PenUnidadeDTO(); |
585 | 585 | $objUnidadeDTO->setNumIdUnidadeRH($this->destinatarioReal->numeroDeIdentificacaoDaEstrutura); |
586 | 586 | $objUnidadeDTO->setStrSinAtivo('S'); |
587 | 587 | $objUnidadeDTO->retStrDescricao(); //descricao |
588 | - | |
588 | + | |
589 | 589 | $objUnidadeRN = new UnidadeRN(); |
590 | 590 | $objUnidadeDTO = $objUnidadeRN->consultarRN0125($objUnidadeDTO); |
591 | 591 | |
... | ... | @@ -617,7 +617,7 @@ class ReceberProcedimentoRN extends InfraRN |
617 | 617 | } |
618 | 618 | |
619 | 619 | //TODO: Usar dados do destinatário em outro método específico para envio |
620 | - // Dados do procedimento enviados pelos órgão externo integrado ao PEN | |
620 | + // Dados do procedimento enviados pelos órgão externo integrado ao PEN | |
621 | 621 | //$objProcesso = $objMetadadosProcedimento->metadados->processo; |
622 | 622 | $objRemetente = $objMetadadosProcedimento->metadados->remetente; |
623 | 623 | $objDestinatario = $objMetadadosProcedimento->metadados->destinatario; |
... | ... | @@ -632,16 +632,16 @@ class ReceberProcedimentoRN extends InfraRN |
632 | 632 | $objProtocoloDTO->setDblIdProtocolo(null); |
633 | 633 | $objProtocoloDTO->setStrDescricao(utf8_decode($objProcesso->descricao)); |
634 | 634 | $objProtocoloDTO->setStrStaNivelAcessoLocal($this->obterNivelSigiloSEI($objProcesso->nivelDeSigilo)); |
635 | - | |
635 | + | |
636 | 636 | if($this->obterNivelSigiloSEI($objProcesso->nivelDeSigilo) == ProtocoloRN::$NA_RESTRITO){ |
637 | 637 | $objHipoteseLegalRecebido = new PenRelHipoteseLegalRecebidoRN(); |
638 | 638 | $objPenParametroRN = new PenParametroRN(); |
639 | 639 | $numIdHipoteseLegalPadrao = $objPenParametroRN->getParametro('HIPOTESE_LEGAL_PADRAO'); |
640 | - | |
640 | + | |
641 | 641 | if (!isset($objProcesso->hipoteseLegal) || (isset($objProcesso->hipoteseLegal) && empty($objProcesso->hipoteseLegal->identificacao))) { |
642 | 642 | $objProtocoloDTO->setNumIdHipoteseLegal($numIdHipoteseLegalPadrao); |
643 | 643 | } else { |
644 | - | |
644 | + | |
645 | 645 | $numIdHipoteseLegal = $objHipoteseLegalRecebido->getIdHipoteseLegalSEI($objProcesso->hipoteseLegal->identificacao); |
646 | 646 | if (empty($numIdHipoteseLegal)) { |
647 | 647 | $objProtocoloDTO->setNumIdHipoteseLegal($numIdHipoteseLegalPadrao); |
... | ... | @@ -650,7 +650,7 @@ class ReceberProcedimentoRN extends InfraRN |
650 | 650 | } |
651 | 651 | } |
652 | 652 | } |
653 | - | |
653 | + | |
654 | 654 | $objProtocoloDTO->setStrProtocoloFormatado(utf8_decode($objProcesso->protocolo)); |
655 | 655 | $objProtocoloDTO->setDtaGeracao($this->objProcessoEletronicoRN->converterDataSEI($objProcesso->dataHoraDeProducao)); |
656 | 656 | $objProtocoloDTO->setArrObjAnexoDTO(array()); |
... | ... | @@ -659,18 +659,18 @@ class ReceberProcedimentoRN extends InfraRN |
659 | 659 | //$objProtocoloDTO->setStrStaEstado(ProtocoloRN::$TE_BLOQUEADO); |
660 | 660 | $this->atribuirRemetente($objProtocoloDTO, $objRemetente); |
661 | 661 | $this->atribuirParticipantes($objProtocoloDTO, $objProcesso->interessado); |
662 | - | |
663 | - | |
664 | - | |
662 | + | |
663 | + | |
664 | + | |
665 | 665 | $strDescricao = sprintf('Tipo de processo no órgão de origem: %s', utf8_decode($objProcesso->processoDeNegocio)).PHP_EOL; |
666 | 666 | $strDescricao .= $objProcesso->observacao; |
667 | - | |
667 | + | |
668 | 668 | $objObservacaoDTO = new ObservacaoDTO(); |
669 | - | |
669 | + | |
670 | 670 | //!Criação da observação de aviso para qual é a real unidade emitida (!2!) |
671 | 671 | if ($this->destinatarioReal) { |
672 | 672 | $objUnidadeDTO = new PenUnidadeDTO(); |
673 | - $objUnidadeDTO->setNumIdUnidadeRH($this->destinatarioReal->numeroDeIdentificacaoDaEstrutura); | |
673 | + $objUnidadeDTO->setNumIdUnidadeRH($this->destinatarioReal->numeroDeIdentificacaoDaEstrutura); | |
674 | 674 | $objUnidadeDTO->setStrSinAtivo('S'); |
675 | 675 | $objUnidadeDTO->retStrDescricao(); |
676 | 676 | |
... | ... | @@ -680,48 +680,48 @@ class ReceberProcedimentoRN extends InfraRN |
680 | 680 | } else { |
681 | 681 | $objObservacaoDTO->setStrDescricao($strDescricao); |
682 | 682 | } |
683 | - | |
683 | + | |
684 | 684 | //throw new InfraException(var_export($objObservacaoDTO, true)); |
685 | - | |
685 | + | |
686 | 686 | $objProtocoloDTO->setArrObjObservacaoDTO(array($objObservacaoDTO)); |
687 | - | |
687 | + | |
688 | 688 | //Atribuição de dados do procedimento |
689 | 689 | //TODO: Validar cada uma das informações de entrada do webservice |
690 | - $objProcedimentoDTO = new ProcedimentoDTO(); | |
690 | + $objProcedimentoDTO = new ProcedimentoDTO(); | |
691 | 691 | $objProcedimentoDTO->setDblIdProcedimento(null); |
692 | - $objProcedimentoDTO->setObjProtocoloDTO($objProtocoloDTO); | |
692 | + $objProcedimentoDTO->setObjProtocoloDTO($objProtocoloDTO); | |
693 | 693 | $objProcedimentoDTO->setStrNomeTipoProcedimento(utf8_decode($objProcesso->processoDeNegocio)); |
694 | 694 | $objProcedimentoDTO->setDtaGeracaoProtocolo($this->objProcessoEletronicoRN->converterDataSEI($objProcesso->dataHoraDeProducao)); |
695 | 695 | $objProcedimentoDTO->setStrProtocoloProcedimentoFormatado(utf8_decode($objProcesso->protocolo)); |
696 | 696 | $objProcedimentoDTO->setStrSinGerarPendencia('S'); |
697 | 697 | // $objProcedimentoDTO->setNumVersaoLock(0); //TODO: Avaliar o comportamento desse campo no cadastro do processo |
698 | 698 | $objProcedimentoDTO->setArrObjDocumentoDTO(array()); |
699 | - | |
699 | + | |
700 | 700 | //TODO: Identificar o tipo de procedimento correto para atribuição ao novo processo |
701 | 701 | $objPenParametroRN = new PenParametroRN(); |
702 | 702 | $numIdTipoProcedimento = $objPenParametroRN->getParametro('PEN_TIPO_PROCESSO_EXTERNO'); |
703 | - $this->atribuirTipoProcedimento($objProcedimentoDTO, $numIdTipoProcedimento, $objProcesso->processoDeNegocio); | |
703 | + $this->atribuirTipoProcedimento($objProcedimentoDTO, $numIdTipoProcedimento, $objProcesso->processoDeNegocio); | |
704 | 704 | |
705 | 705 | //TODO: Obter código da unidade através de mapeamento entre SEI e Barramento |
706 | 706 | $objUnidadeDTO = $this->atribuirDadosUnidade($objProcedimentoDTO, $objDestinatario); |
707 | 707 | |
708 | 708 | //TODO: Tratar processamento de atributos procedimento_cadastro:177 |
709 | 709 | //... |
710 | - | |
710 | + | |
711 | 711 | //TODO: Atribuir Dados do produtor do processo |
712 | - //$this->atribuirProdutorProcesso($objProcesso, | |
713 | - // $objProcedimentoDTO->getNumIdUsuarioGeradorProtocolo(), | |
714 | - // $objProcedimentoDTO->getNumIdUnidadeGeradoraProtocolo()); | |
712 | + //$this->atribuirProdutorProcesso($objProcesso, | |
713 | + // $objProcedimentoDTO->getNumIdUsuarioGeradorProtocolo(), | |
714 | + // $objProcedimentoDTO->getNumIdUnidadeGeradoraProtocolo()); | |
715 | + | |
715 | 716 | |
716 | 717 | |
717 | - | |
718 | 718 | |
719 | 719 | //TODO:Adicionar demais informações do processo |
720 | 720 | //<protocoloAnterior> |
721 | 721 | //<historico> |
722 | - | |
722 | + | |
723 | 723 | //$objProcesso->idProcedimentoSEI = $dblIdProcedimento; |
724 | - | |
724 | + | |
725 | 725 | //TODO: Avaliar necessidade de tal recurso |
726 | 726 | //FeedSEIProtocolos::getInstance()->setBolAcumularFeeds(true); |
727 | 727 | |
... | ... | @@ -735,9 +735,9 @@ class ReceberProcedimentoRN extends InfraRN |
735 | 735 | $objProcedimentoDTO->setDblIdProcedimento($objProcedimentoDTOGerado->getDblIdProcedimento()); |
736 | 736 | |
737 | 737 | $this->registrarAndamentoRecebimentoProcesso($objProcedimentoDTO, $objMetadadosProcedimento); |
738 | - $this->atribuirDocumentos($objProcedimentoDTO, $objProcesso, $objUnidadeDTO, $objMetadadosProcedimento); | |
738 | + $this->atribuirDocumentos($objProcedimentoDTO, $objProcesso, $objUnidadeDTO, $objMetadadosProcedimento); | |
739 | 739 | $this->registrarProcedimentoNaoVisualizado($objProcedimentoDTOGerado); |
740 | - | |
740 | + | |
741 | 741 | //TODO: Avaliar necessidade de restringir referência circular entre processos |
742 | 742 | //TODO: Registrar que o processo foi recebido com outros apensados. Necessário para posterior reenvio |
743 | 743 | $this->atribuirProcessosApensados($objProcedimentoDTO, $objProcesso->processoApensado); |
... | ... | @@ -758,37 +758,37 @@ class ReceberProcedimentoRN extends InfraRN |
758 | 758 | } |
759 | 759 | |
760 | 760 | private function alterarMetadadosProcedimento($parNumIdProcedimento, $parObjMetadadoProcedimento){ |
761 | - | |
761 | + | |
762 | 762 | //Realiza a alteração dos metadados do processo(Por hora, apenas do nível de sigilo e hipótese legal) |
763 | 763 | $objProtocoloDTO = new ProtocoloDTO(); |
764 | 764 | $objProtocoloDTO->setDblIdProtocolo($parNumIdProcedimento); |
765 | 765 | $objProtocoloDTO->setStrStaNivelAcessoLocal($this->obterNivelSigiloSEI($parObjMetadadoProcedimento->nivelDeSigilo)); |
766 | - | |
766 | + | |
767 | 767 | if($parObjMetadadoProcedimento->hipoteseLegal && $parObjMetadadoProcedimento->hipoteseLegal->identificacao){ |
768 | 768 | $objProtocoloDTO->setNumIdHipoteseLegal($this->obterHipoteseLegalSEI($parObjMetadadoProcedimento->hipoteseLegal->identificacao)); |
769 | 769 | } |
770 | - | |
770 | + | |
771 | 771 | $objProtocoloRN = new ProtocoloRN(); |
772 | 772 | $objProtocoloRN->alterarRN0203($objProtocoloDTO); |
773 | 773 | } |
774 | - | |
774 | + | |
775 | 775 | private function alterarMetadadosDocumento($parNumIdDocumento, $parObjMetadadoDocumento){ |
776 | 776 | //Realiza a alteração dos metadados do documento(Por hora, apenas do nível de sigilo e hipótese legal) |
777 | 777 | $objProtocoloDTO = new ProtocoloDTO(); |
778 | 778 | $objProtocoloDTO->setDblIdProtocolo($parNumIdDocumento); |
779 | 779 | $objProtocoloDTO->setStrStaNivelAcessoLocal($this->obterNivelSigiloSEI($parObjMetadadoDocumento->nivelDeSigilo)); |
780 | - | |
780 | + | |
781 | 781 | if($parObjMetadadoDocumento->hipoteseLegal && $parObjMetadadoDocumento->hipoteseLegal->identificacao){ |
782 | 782 | $objProtocoloDTO->setNumIdHipoteseLegal($this->obterHipoteseLegalSEI($parObjMetadadoDocumento->hipoteseLegal->identificacao)); |
783 | 783 | } |
784 | - | |
784 | + | |
785 | 785 | $objProtocoloRN = new ProtocoloRN(); |
786 | 786 | $objProtocoloRN->alterarRN0203($objProtocoloDTO); |
787 | - | |
787 | + | |
788 | 788 | } |
789 | - | |
790 | - | |
791 | - private function removerAndamentosProcedimento($parObjProtocoloDTO) | |
789 | + | |
790 | + | |
791 | + private function removerAndamentosProcedimento($parObjProtocoloDTO) | |
792 | 792 | { |
793 | 793 | //TODO: Remover apenas as atividades geradas pelo recebimento do processo, não as atividades geradas anteriormente |
794 | 794 | $objAtividadeDTO = new AtividadeDTO(); |
... | ... | @@ -797,16 +797,16 @@ class ReceberProcedimentoRN extends InfraRN |
797 | 797 | $objAtividadeDTO->setNumIdTarefa(TarefaRN::$TI_GERACAO_PROCEDIMENTO); |
798 | 798 | |
799 | 799 | $objAtividadeRN = new AtividadeRN(); |
800 | - $objAtividadeRN->excluirRN0034($objAtividadeRN->listarRN0036($objAtividadeDTO)); | |
800 | + $objAtividadeRN->excluirRN0034($objAtividadeRN->listarRN0036($objAtividadeDTO)); | |
801 | 801 | } |
802 | 802 | |
803 | 803 | private function registrarAndamentoRecebimentoProcesso(ProcedimentoDTO $objProcedimentoDTO, $parObjMetadadosProcedimento) |
804 | 804 | { |
805 | - //Processo recebido da entidade @ENTIDADE_ORIGEM@ - @REPOSITORIO_ORIGEM@ | |
805 | + //Processo recebido da entidade @ENTIDADE_ORIGEM@ - @REPOSITORIO_ORIGEM@ | |
806 | 806 | //TODO: Atribuir atributos necessários para formação da mensagem do andamento |
807 | - //TODO: Especificar quais andamentos serão registrados | |
807 | + //TODO: Especificar quais andamentos serão registrados | |
808 | 808 | $objRemetente = $parObjMetadadosProcedimento->metadados->remetente; |
809 | - $objProcesso = $objMetadadosProcedimento->metadados->processo; | |
809 | + $objProcesso = $objMetadadosProcedimento->metadados->processo; | |
810 | 810 | |
811 | 811 | $arrObjAtributoAndamentoDTO = array(); |
812 | 812 | |
... | ... | @@ -816,7 +816,7 @@ class ReceberProcedimentoRN extends InfraRN |
816 | 816 | |
817 | 817 | //TODO: Otimizar código. Apenas buscar no barramento os dados da estrutura 1 única vez (AtribuirRemetente também utiliza) |
818 | 818 | $objEstrutura = $this->objProcessoEletronicoRN->consultarEstrutura( |
819 | - $objRemetente->identificacaoDoRepositorioDeEstruturas, | |
819 | + $objRemetente->identificacaoDoRepositorioDeEstruturas, | |
820 | 820 | $objRemetente->numeroDeIdentificacaoDaEstrutura, |
821 | 821 | true |
822 | 822 | ); |
... | ... | @@ -832,19 +832,19 @@ class ReceberProcedimentoRN extends InfraRN |
832 | 832 | $objAtributoAndamentoDTO->setStrValor($objEstrutura->nome); |
833 | 833 | $objAtributoAndamentoDTO->setStrIdOrigem($objEstrutura->numeroDeIdentificacaoDaEstrutura); |
834 | 834 | $arrObjAtributoAndamentoDTO[] = $objAtributoAndamentoDTO; |
835 | - | |
835 | + | |
836 | 836 | if(isset($objEstrutura->hierarquia)) { |
837 | - | |
837 | + | |
838 | 838 | $arrObjNivel = $objEstrutura->hierarquia->nivel; |
839 | - | |
839 | + | |
840 | 840 | $nome = ""; |
841 | 841 | $siglasUnidades = array(); |
842 | 842 | $siglasUnidades[] = $objEstrutura->sigla; |
843 | - | |
843 | + | |
844 | 844 | foreach($arrObjNivel as $key => $objNivel){ |
845 | 845 | $siglasUnidades[] = $objNivel->sigla ; |
846 | 846 | } |
847 | - | |
847 | + | |
848 | 848 | for($i = 1; $i <= 3; $i++){ |
849 | 849 | if(isset($siglasUnidades[count($siglasUnidades) - 1])){ |
850 | 850 | unset($siglasUnidades[count($siglasUnidades) - 1]); |
... | ... | @@ -858,7 +858,7 @@ class ReceberProcedimentoRN extends InfraRN |
858 | 858 | $nome .= $nomeUnidade." / "; |
859 | 859 | } |
860 | 860 | } |
861 | - | |
861 | + | |
862 | 862 | $objNivel = current($arrObjNivel); |
863 | 863 | |
864 | 864 | $objAtributoAndamentoDTO = new AtributoAndamentoDTO(); |
... | ... | @@ -867,8 +867,8 @@ class ReceberProcedimentoRN extends InfraRN |
867 | 867 | $objAtributoAndamentoDTO->setStrIdOrigem($objNivel->numeroDeIdentificacaoDaEstrutura); |
868 | 868 | $arrObjAtributoAndamentoDTO[] = $objAtributoAndamentoDTO; |
869 | 869 | } |
870 | - | |
871 | - | |
870 | + | |
871 | + | |
872 | 872 | $objAtividadeDTO = new AtividadeDTO(); |
873 | 873 | $objAtividadeDTO->setDblIdProtocolo($objProcedimentoDTO->getDblIdProcedimento()); |
874 | 874 | $objAtividadeDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); |
... | ... | @@ -878,26 +878,26 @@ class ReceberProcedimentoRN extends InfraRN |
878 | 878 | $objAtividadeDTO->setDthConclusao(null); |
879 | 879 | $objAtividadeDTO->setNumIdUsuarioConclusao(null); |
880 | 880 | $objAtividadeDTO->setStrSinInicial('N'); |
881 | - | |
881 | + | |
882 | 882 | $objAtividadeRN = new AtividadeRN(); |
883 | 883 | $objAtividadeRN->gerarInternaRN0727($objAtividadeDTO); |
884 | - | |
885 | - | |
886 | - | |
884 | + | |
885 | + | |
886 | + | |
887 | 887 | } |
888 | 888 | |
889 | 889 | |
890 | 890 | //TODO: Avaliar a necessidade de registrar os dados do remetente como participante do processo |
891 | 891 | private function atribuirRemetente(ProtocoloDTO $objProtocoloDTO, $objRemetente) |
892 | - { | |
893 | - $arrObjParticipantesDTO = array(); | |
892 | + { | |
893 | + $arrObjParticipantesDTO = array(); | |
894 | 894 | if($objProtocoloDTO->isSetArrObjParticipanteDTO()) { |
895 | - $arrObjParticipantesDTO = $objProtocoloDTO->getArrObjParticipanteDTO(); | |
895 | + $arrObjParticipantesDTO = $objProtocoloDTO->getArrObjParticipanteDTO(); | |
896 | 896 | } |
897 | - | |
897 | + | |
898 | 898 | //Obtenção de detalhes do remetente na infraestrutura do PEN |
899 | 899 | $objEstruturaDTO = $this->objProcessoEletronicoRN->consultarEstrutura( |
900 | - $objRemetente->identificacaoDoRepositorioDeEstruturas, | |
900 | + $objRemetente->identificacaoDoRepositorioDeEstruturas, | |
901 | 901 | $objRemetente->numeroDeIdentificacaoDaEstrutura); |
902 | 902 | |
903 | 903 | if(!empty($objEstruturaDTO)) { |
... | ... | @@ -915,10 +915,10 @@ class ReceberProcedimentoRN extends InfraRN |
915 | 915 | |
916 | 916 | |
917 | 917 | private function atribuirParticipantes(ProtocoloDTO $objProtocoloDTO, $arrObjInteressados) |
918 | - { | |
919 | - $arrObjParticipantesDTO = array(); | |
918 | + { | |
919 | + $arrObjParticipantesDTO = array(); | |
920 | 920 | if($objProtocoloDTO->isSetArrObjParticipanteDTO()) { |
921 | - $arrObjParticipantesDTO = $objProtocoloDTO->getArrObjParticipanteDTO(); | |
921 | + $arrObjParticipantesDTO = $objProtocoloDTO->getArrObjParticipanteDTO(); | |
922 | 922 | } |
923 | 923 | |
924 | 924 | if (!is_array($arrObjInteressados)) { |
... | ... | @@ -961,11 +961,11 @@ class ReceberProcedimentoRN extends InfraRN |
961 | 961 | $objProcedimentoDTO->setNumIdTipoProcedimento($objTipoProcedimentoDTO->getNumIdTipoProcedimento()); |
962 | 962 | $objProcedimentoDTO->setStrNomeTipoProcedimento($objTipoProcedimentoDTO->getStrNome()); |
963 | 963 | |
964 | - //Busca e adiciona os assuntos sugeridos para o tipo informado | |
964 | + //Busca e adiciona os assuntos sugeridos para o tipo informado | |
965 | 965 | $objRelTipoProcedimentoAssuntoDTO = new RelTipoProcedimentoAssuntoDTO(); |
966 | 966 | $objRelTipoProcedimentoAssuntoDTO->retNumIdAssunto(); |
967 | 967 | $objRelTipoProcedimentoAssuntoDTO->retNumSequencia(); |
968 | - $objRelTipoProcedimentoAssuntoDTO->setNumIdTipoProcedimento($objProcedimentoDTO->getNumIdTipoProcedimento()); | |
968 | + $objRelTipoProcedimentoAssuntoDTO->setNumIdTipoProcedimento($objProcedimentoDTO->getNumIdTipoProcedimento()); | |
969 | 969 | |
970 | 970 | $objRelTipoProcedimentoAssuntoRN = new RelTipoProcedimentoAssuntoRN(); |
971 | 971 | $arrObjRelTipoProcedimentoAssuntoDTO = $objRelTipoProcedimentoAssuntoRN->listarRN0192($objRelTipoProcedimentoAssuntoDTO); |
... | ... | @@ -982,7 +982,7 @@ class ReceberProcedimentoRN extends InfraRN |
982 | 982 | } |
983 | 983 | |
984 | 984 | protected function atribuirDadosUnidade(ProcedimentoDTO $objProcedimentoDTO, $objDestinatario){ |
985 | - | |
985 | + | |
986 | 986 | if(!isset($objDestinatario)){ |
987 | 987 | throw new InfraException('Parâmetro $objDestinatario não informado.'); |
988 | 988 | } |
... | ... | @@ -992,8 +992,8 @@ class ReceberProcedimentoRN extends InfraRN |
992 | 992 | if(!isset($objUnidadeDTOEnvio)) |
993 | 993 | throw new InfraException('Unidade de destino não pode ser encontrada. Repositório: '.$objDestinatario->identificacaoDoRepositorioDeEstruturas.', Número: ' . $objDestinatario->numeroDeIdentificacaoDaEstrutura); |
994 | 994 | |
995 | - $arrObjUnidadeDTO = array(); | |
996 | - $arrObjUnidadeDTO[] = $objUnidadeDTOEnvio; | |
995 | + $arrObjUnidadeDTO = array(); | |
996 | + $arrObjUnidadeDTO[] = $objUnidadeDTOEnvio; | |
997 | 997 | $objProcedimentoDTO->setArrObjUnidadeDTO($arrObjUnidadeDTO); |
998 | 998 | |
999 | 999 | return $objUnidadeDTOEnvio; |
... | ... | @@ -1003,8 +1003,8 @@ class ReceberProcedimentoRN extends InfraRN |
1003 | 1003 | //TODO: Grande parte da regra de negócio se baseou em SEIRN:199 - incluirDocumento. |
1004 | 1004 | //Avaliar a refatoração para impedir a duplicação de código |
1005 | 1005 | private function atribuirDocumentos($objProcedimentoDTO, $objProcesso, $objUnidadeDTO, $parObjMetadadosProcedimento) |
1006 | - { | |
1007 | - | |
1006 | + { | |
1007 | + | |
1008 | 1008 | if(!isset($objProcesso)) { |
1009 | 1009 | throw new InfraException('Parâmetro $objProcesso não informado.'); |
1010 | 1010 | } |
... | ... | @@ -1019,14 +1019,14 @@ class ReceberProcedimentoRN extends InfraRN |
1019 | 1019 | |
1020 | 1020 | $arrObjDocumentos = $objProcesso->documento; |
1021 | 1021 | if(!is_array($arrObjDocumentos)) { |
1022 | - $arrObjDocumentos = array($arrObjDocumentos); | |
1022 | + $arrObjDocumentos = array($arrObjDocumentos); | |
1023 | 1023 | } |
1024 | 1024 | |
1025 | 1025 | $strNumeroRegistro = $parObjMetadadosProcedimento->metadados->NRE; |
1026 | 1026 | //$numTramite = $parObjMetadadosProcedimento->metadados->IDT; |
1027 | 1027 | |
1028 | 1028 | //Ordenação dos documentos conforme informado pelo remetente. Campo documento->ordem |
1029 | - usort($arrObjDocumentos, array("ReceberProcedimentoRN", "comparacaoOrdemDocumentos")); | |
1029 | + usort($arrObjDocumentos, array("ReceberProcedimentoRN", "comparacaoOrdemDocumentos")); | |
1030 | 1030 | |
1031 | 1031 | //Obter dados dos documentos já registrados no sistema |
1032 | 1032 | $objComponenteDigitalDTO = new ComponenteDigitalDTO(); |
... | ... | @@ -1043,32 +1043,32 @@ class ReceberProcedimentoRN extends InfraRN |
1043 | 1043 | |
1044 | 1044 | $objProtocoloBD = new ProtocoloBD($this->getObjInfraIBanco()); |
1045 | 1045 | $objSeiRN = new SeiRN(); |
1046 | - | |
1046 | + | |
1047 | 1047 | $arrObjDocumentoDTO = array(); |
1048 | - | |
1048 | + | |
1049 | 1049 | foreach($arrObjDocumentos as $objDocumento){ |
1050 | - | |
1050 | + | |
1051 | 1051 | // @join_tec US027 (#3498) |
1052 | 1052 | if(isset($objDocumento->retirado) && $objDocumento->retirado === true) { |
1053 | 1053 | |
1054 | 1054 | //$strHashConteudo = ProcessoEletronicoRN::getHashFromMetaDados($objDocumento->componenteDigital->hash); |
1055 | - | |
1056 | - | |
1055 | + | |
1056 | + | |
1057 | 1057 | // Caso já esteja cadastrado, de um reenvio anterior, então move para bloqueado |
1058 | 1058 | if(array_key_exists($objDocumento->ordem, $arrObjComponenteDigitalDTOIndexado)) { |
1059 | - | |
1059 | + | |
1060 | 1060 | //Busca o ID do protocolo |
1061 | 1061 | //$dblIdProtocolo = $arrStrHashConteudo[$strHashConteudo]; |
1062 | 1062 | $objComponenteIndexado = $arrObjComponenteDigitalDTOIndexado[$objDocumento->ordem]; |
1063 | 1063 | $dblIdProtocolo = $objComponenteIndexado->getDblIdDocumento(); |
1064 | - | |
1064 | + | |
1065 | 1065 | //Instancia o DTO do protocolo |
1066 | 1066 | $objProtocoloDTO = new ProtocoloDTO(); |
1067 | 1067 | $objProtocoloDTO->setDblIdProtocolo($dblIdProtocolo); |
1068 | 1068 | $objProtocoloDTO->retStrStaEstado(); |
1069 | - | |
1069 | + | |
1070 | 1070 | $objProtocoloDTO = $objProtocoloBD->consultar($objProtocoloDTO); |
1071 | - | |
1071 | + | |
1072 | 1072 | if($objProtocoloDTO->getStrStaEstado() != ProtocoloRN::$TE_DOCUMENTO_CANCELADO){ |
1073 | 1073 | //Instancia o DTO do protocolo |
1074 | 1074 | $objEntradaCancelarDocumentoAPI = new EntradaCancelarDocumentoAPI(); |
... | ... | @@ -1076,12 +1076,12 @@ class ReceberProcedimentoRN extends InfraRN |
1076 | 1076 | $objEntradaCancelarDocumentoAPI->setMotivo('Cancelado pelo remetente'); |
1077 | 1077 | |
1078 | 1078 | $objSeiRN->cancelarDocumento($objEntradaCancelarDocumentoAPI); |
1079 | - | |
1079 | + | |
1080 | 1080 | } |
1081 | - | |
1082 | - | |
1081 | + | |
1082 | + | |
1083 | 1083 | continue; |
1084 | - | |
1084 | + | |
1085 | 1085 | } |
1086 | 1086 | //continue; |
1087 | 1087 | } |
... | ... | @@ -1096,8 +1096,8 @@ class ReceberProcedimentoRN extends InfraRN |
1096 | 1096 | if(!isset($objDocumento->especie)){ |
1097 | 1097 | throw new InfraException('Espécie do documento ['.$objDocumento->descricao.'] não informada.'); |
1098 | 1098 | } |
1099 | - | |
1100 | -//--------------------------------------------------------------------------------------------------- | |
1099 | + | |
1100 | +//--------------------------------------------------------------------------------------------------- | |
1101 | 1101 | |
1102 | 1102 | $objDocumentoDTO = new DocumentoDTO(); |
1103 | 1103 | $objDocumentoDTO->setDblIdDocumento(null); |
... | ... | @@ -1149,7 +1149,7 @@ class ReceberProcedimentoRN extends InfraRN |
1149 | 1149 | $objDocumentoDTO->setObjProtocoloDTO($objProtocoloDTO); |
1150 | 1150 | $objProtocoloDTO->setDblIdProtocolo(null); |
1151 | 1151 | $objProtocoloDTO->setStrStaProtocolo(ProtocoloRN::$TP_DOCUMENTO_RECEBIDO); |
1152 | - | |
1152 | + | |
1153 | 1153 | if($objDocumento->descricao != '***'){ |
1154 | 1154 | $objProtocoloDTO->setStrDescricao(utf8_decode($objDocumento->descricao)); |
1155 | 1155 | $objDocumentoDTO->setStrNumero(utf8_decode($objDocumento->descricao)); |
... | ... | @@ -1158,14 +1158,14 @@ class ReceberProcedimentoRN extends InfraRN |
1158 | 1158 | $objDocumentoDTO->setStrNumero(""); |
1159 | 1159 | } |
1160 | 1160 | //TODO: Avaliar regra de formação do número do documento |
1161 | - | |
1161 | + | |
1162 | 1162 | $objProtocoloDTO->setStrStaNivelAcessoLocal($this->obterNivelSigiloSEI($objDocumento->nivelDeSigilo)); |
1163 | 1163 | $objProtocoloDTO->setDtaGeracao($this->objProcessoEletronicoRN->converterDataSEI($objDocumento->dataHoraDeProducao)); |
1164 | 1164 | $objProtocoloDTO->setArrObjAnexoDTO(array()); |
1165 | 1165 | $objProtocoloDTO->setArrObjRelProtocoloAssuntoDTO(array()); |
1166 | 1166 | $objProtocoloDTO->setArrObjRelProtocoloProtocoloDTO(array()); |
1167 | 1167 | $objProtocoloDTO->setArrObjParticipanteDTO(array()); |
1168 | - | |
1168 | + | |
1169 | 1169 | //TODO: Analisar se o modelo de dados do PEN possui destinatários específicos para os documentos |
1170 | 1170 | //caso não possua, analisar o repasse de tais informações via parãmetros adicionais |
1171 | 1171 | |
... | ... | @@ -1200,9 +1200,9 @@ class ReceberProcedimentoRN extends InfraRN |
1200 | 1200 | $objReabrirProcessoDTO->setNumIdUsuario(SessaoSEI::getInstance()->getNumIdUsuario()); |
1201 | 1201 | $objProcedimentoRN->reabrirRN0966($objReabrirProcessoDTO); |
1202 | 1202 | $bolReabriuAutomaticamente = true; |
1203 | - } | |
1203 | + } | |
1204 | 1204 | } |
1205 | - | |
1205 | + | |
1206 | 1206 | //$objOperacaoServicoDTO = new OperacaoServicoDTO(); |
1207 | 1207 | //$this->adicionarCriteriosUnidadeProcessoDocumento ($objOperacaoServicoDTO,$objUnidadeDTO,$objProcedimentoDTO,$objDocumentoDTO); |
1208 | 1208 | //$objOperacaoServicoDTO->setNumStaOperacaoServico(OperacaoServicoRN::$TS_INCLUIR_DOCUMENTO); |
... | ... | @@ -1227,7 +1227,7 @@ class ReceberProcedimentoRN extends InfraRN |
1227 | 1227 | $objDocumentoDTO->getObjProtocoloDTO()->setStrStaGrauSigilo($objTipoProcedimentoDTO->getStrStaGrauSigiloSugestao()); |
1228 | 1228 | $objDocumentoDTO->getObjProtocoloDTO()->setNumIdHipoteseLegal($objTipoProcedimentoDTO->getNumIdHipoteseLegalSugestao()); |
1229 | 1229 | } |
1230 | - | |
1230 | + | |
1231 | 1231 | if ($this->obterNivelSigiloSEI($objDocumento->nivelDeSigilo) == ProtocoloRN::$NA_RESTRITO) { |
1232 | 1232 | $objHipoteseLegalRecebido = new PenRelHipoteseLegalRecebidoRN(); |
1233 | 1233 | $objPenParametroRN = new PenParametroRN(); |
... | ... | @@ -1236,7 +1236,7 @@ class ReceberProcedimentoRN extends InfraRN |
1236 | 1236 | if (!isset($objDocumento->hipoteseLegal) || (isset($objDocumento->hipoteseLegal) && empty($objDocumento->hipoteseLegal->identificacao))) { |
1237 | 1237 | $objDocumentoDTO->getObjProtocoloDTO()->setNumIdHipoteseLegal($numIdHipoteseLegalPadrao); |
1238 | 1238 | } else { |
1239 | - | |
1239 | + | |
1240 | 1240 | $numIdHipoteseLegal = $objHipoteseLegalRecebido->getIdHipoteseLegalSEI($objDocumento->hipoteseLegal->identificacao); |
1241 | 1241 | if (empty($numIdHipoteseLegal)) { |
1242 | 1242 | $objDocumentoDTO->getObjProtocoloDTO()->setNumIdHipoteseLegal($numIdHipoteseLegalPadrao); |
... | ... | @@ -1245,7 +1245,7 @@ class ReceberProcedimentoRN extends InfraRN |
1245 | 1245 | } |
1246 | 1246 | } |
1247 | 1247 | } |
1248 | - | |
1248 | + | |
1249 | 1249 | $objDocumentoDTO->getObjProtocoloDTO()->setArrObjParticipanteDTO($this->prepararParticipantes($objDocumentoDTO->getObjProtocoloDTO()->getArrObjParticipanteDTO())); |
1250 | 1250 | |
1251 | 1251 | $objDocumentoRN = new DocumentoRN(); |
... | ... | @@ -1253,13 +1253,13 @@ class ReceberProcedimentoRN extends InfraRN |
1253 | 1253 | $strConteudoCodificado = $objDocumentoDTO->getStrConteudo(); |
1254 | 1254 | $objDocumentoDTO->setStrConteudo(null); |
1255 | 1255 | //$objDocumentoDTO->setStrSinFormulario('N'); |
1256 | - | |
1256 | + | |
1257 | 1257 | $objDocumentoDTO->getObjProtocoloDTO()->setNumIdUnidadeGeradora(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); |
1258 | 1258 | $objDocumentoDTO->setStrSinBloqueado('S'); |
1259 | - | |
1259 | + | |
1260 | 1260 | //TODO: Fazer a atribuição dos componentes digitais do processo a partir desse ponto |
1261 | - $this->atribuirComponentesDigitais($objDocumentoDTO, $objDocumento->componenteDigital); | |
1262 | - $objDocumentoDTOGerado = $objDocumentoRN->cadastrarRN0003($objDocumentoDTO); | |
1261 | + $this->atribuirComponentesDigitais($objDocumentoDTO, $objDocumento->componenteDigital); | |
1262 | + $objDocumentoDTOGerado = $objDocumentoRN->cadastrarRN0003($objDocumentoDTO); | |
1263 | 1263 | |
1264 | 1264 | $objAtividadeDTOVisualizacao = new AtividadeDTO(); |
1265 | 1265 | $objAtividadeDTOVisualizacao->setDblIdProtocolo($objDocumentoDTO->getDblIdProcedimento()); |
... | ... | @@ -1276,11 +1276,11 @@ class ReceberProcedimentoRN extends InfraRN |
1276 | 1276 | |
1277 | 1277 | $objDocumento->idDocumentoSEI = $objDocumentoDTO->getDblIdDocumento(); |
1278 | 1278 | $arrObjDocumentoDTO[] = $objDocumentoDTO; |
1279 | - | |
1279 | + | |
1280 | 1280 | if(isset($objDocumento->retirado) && $objDocumento->retirado === true) { |
1281 | 1281 | $this->documentosRetirados[] = $objDocumento->idDocumentoSEI; |
1282 | 1282 | } |
1283 | - | |
1283 | + | |
1284 | 1284 | } |
1285 | 1285 | |
1286 | 1286 | foreach($this->documentosRetirados as $documentoCancelado){ |
... | ... | @@ -1293,23 +1293,23 @@ class ReceberProcedimentoRN extends InfraRN |
1293 | 1293 | } |
1294 | 1294 | |
1295 | 1295 | $objProcedimentoDTO->setArrObjDocumentoDTO($arrObjDocumentoDTO); |
1296 | - | |
1296 | + | |
1297 | 1297 | /* if($numIdUnidadeAtual != $numIdUnidadeGeradora){ |
1298 | - SessaoSEI::getInstance(false)->simularLogin('SEI', null, null, $numIdUnidadeAtual); | |
1298 | + SessaoSEI::getInstance(false)->simularLogin('SEI', null, null, $numIdUnidadeAtual); | |
1299 | 1299 | } */ |
1300 | 1300 | } |
1301 | 1301 | |
1302 | 1302 | //TODO: Método deverá poderá ser transferido para a classe responsável por fazer o recebimento dos componentes digitais |
1303 | - private function atribuirComponentesDigitais(DocumentoDTO $parObjDocumentoDTO, $parArrObjComponentesDigitais) | |
1303 | + private function atribuirComponentesDigitais(DocumentoDTO $parObjDocumentoDTO, $parArrObjComponentesDigitais) | |
1304 | 1304 | { |
1305 | 1305 | if(!isset($parArrObjComponentesDigitais)) { |
1306 | - throw new InfraException('Componentes digitais do documento não informado.'); | |
1306 | + throw new InfraException('Componentes digitais do documento não informado.'); | |
1307 | 1307 | } |
1308 | 1308 | |
1309 | 1309 | //TODO: Aplicar mesmas validações realizadas no momento do upload de um documento InfraPagina::processarUpload |
1310 | 1310 | //TODO: Avaliar a refatoração do código abaixo para impedir a duplicação de regras de negócios |
1311 | - | |
1312 | - | |
1311 | + | |
1312 | + | |
1313 | 1313 | $arrObjAnexoDTO = array(); |
1314 | 1314 | if($parObjDocumentoDTO->getObjProtocoloDTO()->isSetArrObjAnexoDTO()) { |
1315 | 1315 | $arrObjAnexoDTO = $parObjDocumentoDTO->getObjProtocoloDTO()->getArrObjAnexoDTO(); |
... | ... | @@ -1353,7 +1353,7 @@ class ReceberProcedimentoRN extends InfraRN |
1353 | 1353 | |
1354 | 1354 | private function atribuirDataHoraDeRegistro(){ |
1355 | 1355 | |
1356 | - } | |
1356 | + } | |
1357 | 1357 | |
1358 | 1358 | private function cadastrarTramiteDeProcesso($objTramite, $objProcesso){ |
1359 | 1359 | |
... | ... | @@ -1366,7 +1366,7 @@ class ReceberProcedimentoRN extends InfraRN |
1366 | 1366 | } |
1367 | 1367 | |
1368 | 1368 | $objDestinatario = $objMetadadosProcedimento->metadados->destinatario; |
1369 | - | |
1369 | + | |
1370 | 1370 | $objPenParametroRN = new PenParametroRN(); |
1371 | 1371 | $numIdRepositorioOrigem = $objPenParametroRN->getParametro('PEN_ID_REPOSITORIO_ORIGEM'); |
1372 | 1372 | $numIdRepositorioDestinoProcesso = $objDestinatario->identificacaoDoRepositorioDeEstruturas; |
... | ... | @@ -1379,7 +1379,7 @@ class ReceberProcedimentoRN extends InfraRN |
1379 | 1379 | |
1380 | 1380 | //Validação do unidade de destino do processo |
1381 | 1381 | $objUnidadeDTO = new PenUnidadeDTO(); |
1382 | - $objUnidadeDTO->setNumIdUnidadeRH($numeroDeIdentificacaoDaEstrutura); | |
1382 | + $objUnidadeDTO->setNumIdUnidadeRH($numeroDeIdentificacaoDaEstrutura); | |
1383 | 1383 | $objUnidadeDTO->setStrSinAtivo('S'); |
1384 | 1384 | $objUnidadeDTO->retNumIdUnidade(); |
1385 | 1385 | |
... | ... | @@ -1387,8 +1387,8 @@ class ReceberProcedimentoRN extends InfraRN |
1387 | 1387 | $objUnidadeDTO = $objUnidadeRN->consultarRN0125($objUnidadeDTO); |
1388 | 1388 | |
1389 | 1389 | if(!isset($objUnidadeDTO)){ |
1390 | - $objInfraException->adicionarValidacao("Unidade de destino [Estrutura: {$numeroDeIdentificacaoDaEstrutura}] não localizada."); | |
1391 | - } | |
1390 | + $objInfraException->adicionarValidacao("Unidade de destino [Estrutura: {$numeroDeIdentificacaoDaEstrutura}] não configurada para receber trâmites externos."); | |
1391 | + } | |
1392 | 1392 | } |
1393 | 1393 | |
1394 | 1394 | private function validarDadosRemetente(InfraException $objInfraException, $objMetadadosProcedimento){ |
... | ... | @@ -1397,7 +1397,7 @@ class ReceberProcedimentoRN extends InfraRN |
1397 | 1397 | |
1398 | 1398 | private function validarDadosProcesso(InfraException $objInfraException, $objMetadadosProcedimento){ |
1399 | 1399 | |
1400 | - } | |
1400 | + } | |
1401 | 1401 | |
1402 | 1402 | private function validarDadosDocumentos(InfraException $objInfraException, $objMetadadosProcedimento){ |
1403 | 1403 | |
... | ... | @@ -1416,7 +1416,7 @@ class ReceberProcedimentoRN extends InfraRN |
1416 | 1416 | break; |
1417 | 1417 | } |
1418 | 1418 | } |
1419 | - | |
1419 | + | |
1420 | 1420 | private function obterHipoteseLegalSEI($parNumIdHipoteseLegalPEN) { |
1421 | 1421 | //Atribuí a hipótese legal |
1422 | 1422 | $objHipoteseLegalRecebido = new PenRelHipoteseLegalRecebidoRN(); |
... | ... | @@ -1424,7 +1424,7 @@ class ReceberProcedimentoRN extends InfraRN |
1424 | 1424 | $numIdHipoteseLegalPadrao = $objPenParametroRN->getParametro('HIPOTESE_LEGAL_PADRAO'); |
1425 | 1425 | |
1426 | 1426 | $numIdHipoteseLegal = $objHipoteseLegalRecebido->getIdHipoteseLegalSEI($parNumIdHipoteseLegalPEN); |
1427 | - | |
1427 | + | |
1428 | 1428 | if (empty($numIdHipoteseLegal)) { |
1429 | 1429 | return $numIdHipoteseLegalPadrao; |
1430 | 1430 | } else { |
... | ... | @@ -1436,7 +1436,7 @@ class ReceberProcedimentoRN extends InfraRN |
1436 | 1436 | private function obterUnidadeMapeada($numIdentificacaoDaEstrutura) |
1437 | 1437 | { |
1438 | 1438 | $objUnidadeDTO = new PenUnidadeDTO(); |
1439 | - $objUnidadeDTO->setNumIdUnidadeRH($numIdentificacaoDaEstrutura); | |
1439 | + $objUnidadeDTO->setNumIdUnidadeRH($numIdentificacaoDaEstrutura); | |
1440 | 1440 | $objUnidadeDTO->setStrSinAtivo('S'); |
1441 | 1441 | $objUnidadeDTO->retNumIdUnidade(); |
1442 | 1442 | $objUnidadeDTO->retNumIdOrgao(); |
... | ... | @@ -1447,9 +1447,9 @@ class ReceberProcedimentoRN extends InfraRN |
1447 | 1447 | return $objUnidadeRN->consultarRN0125($objUnidadeDTO); |
1448 | 1448 | } |
1449 | 1449 | |
1450 | - | |
1450 | + | |
1451 | 1451 | /** |
1452 | - * | |
1452 | + * | |
1453 | 1453 | * @return SerieDTO |
1454 | 1454 | */ |
1455 | 1455 | private function obterSerieMapeada($numCodigoEspecie) |
... | ... | @@ -1462,7 +1462,7 @@ class ReceberProcedimentoRN extends InfraRN |
1462 | 1462 | |
1463 | 1463 | $objGenericoBD = new GenericoBD($this->getObjInfraIBanco()); |
1464 | 1464 | $objMapDTO = $objGenericoBD->consultar($objMapDTO); |
1465 | - | |
1465 | + | |
1466 | 1466 | if(empty($objMapDTO)) { |
1467 | 1467 | $objMapDTO = new PenRelTipoDocMapRecebidoDTO(); |
1468 | 1468 | $objMapDTO->retNumIdSerie(); |
... | ... | @@ -1484,7 +1484,7 @@ class ReceberProcedimentoRN extends InfraRN |
1484 | 1484 | return $objSerieDTO; |
1485 | 1485 | } |
1486 | 1486 | |
1487 | - private function relacionarProcedimentos($objProcedimentoDTO1, $objProcedimentoDTO2) | |
1487 | + private function relacionarProcedimentos($objProcedimentoDTO1, $objProcedimentoDTO2) | |
1488 | 1488 | { |
1489 | 1489 | if(!isset($objProcedimentoDTO1) || !isset($objProcedimentoDTO1)) { |
1490 | 1490 | throw new InfraException('Parâmetro $objProcedimentoDTO não informado.'); |
... | ... | @@ -1524,10 +1524,10 @@ class ReceberProcedimentoRN extends InfraRN |
1524 | 1524 | } else { |
1525 | 1525 | if ($objParticipanteDTO->getStrStaParticipacao()==ParticipanteRN::$TP_INTERESSADO) { |
1526 | 1526 | throw new InfraException('Interessado vazio ou nulo.'); |
1527 | - } | |
1527 | + } | |
1528 | 1528 | else if ($objParticipanteDTO->getStrStaParticipacao()==ParticipanteRN::$TP_REMETENTE) { |
1529 | 1529 | throw new InfraException('Remetente vazio ou nulo.'); |
1530 | - } | |
1530 | + } | |
1531 | 1531 | else if ($objParticipanteDTO->getStrStaParticipacao()==ParticipanteRN::$TP_DESTINATARIO) { |
1532 | 1532 | throw new InfraException('Destinatário vazio ou nulo.'); |
1533 | 1533 | } |
... | ... | @@ -1566,7 +1566,7 @@ class ReceberProcedimentoRN extends InfraRN |
1566 | 1566 | return $arrObjParticipanteDTO; |
1567 | 1567 | } |
1568 | 1568 | |
1569 | - private function registrarProcedimentoNaoVisualizado(ProcedimentoDTO $parObjProcedimentoDTO) | |
1569 | + private function registrarProcedimentoNaoVisualizado(ProcedimentoDTO $parObjProcedimentoDTO) | |
1570 | 1570 | { |
1571 | 1571 | $objAtividadeDTOVisualizacao = new AtividadeDTO(); |
1572 | 1572 | $objAtividadeDTOVisualizacao->setDblIdProtocolo($parObjProcedimentoDTO->getDblIdProcedimento()); |
... | ... | @@ -1576,13 +1576,13 @@ class ReceberProcedimentoRN extends InfraRN |
1576 | 1576 | $objAtividadeRN->atualizarVisualizacao($objAtividadeDTOVisualizacao); |
1577 | 1577 | } |
1578 | 1578 | |
1579 | - private function enviarProcedimentoUnidade(ProcedimentoDTO $parObjProcedimentoDTO, $retransmissao = false) | |
1579 | + private function enviarProcedimentoUnidade(ProcedimentoDTO $parObjProcedimentoDTO, $retransmissao = false) | |
1580 | 1580 | { |
1581 | 1581 | $objAtividadeRN = new PenAtividadeRN(); |
1582 | 1582 | $objInfraException = new InfraException(); |
1583 | 1583 | |
1584 | 1584 | if(!$parObjProcedimentoDTO->isSetArrObjUnidadeDTO() || count($parObjProcedimentoDTO->getArrObjUnidadeDTO()) == 0) { |
1585 | - $objInfraException->lancarValidacao('Unidade de destino do processo não informada.'); | |
1585 | + $objInfraException->lancarValidacao('Unidade de destino do processo não informada.'); | |
1586 | 1586 | } |
1587 | 1587 | |
1588 | 1588 | $arrObjUnidadeDTO = $parObjProcedimentoDTO->getArrObjUnidadeDTO(); |
... | ... | @@ -1626,18 +1626,18 @@ class ReceberProcedimentoRN extends InfraRN |
1626 | 1626 | $objPesquisaPendenciaDTO->setDblIdProtocolo(array($objProcedimentoDTO->getDblIdProcedimento())); |
1627 | 1627 | $objPesquisaPendenciaDTO->setNumIdUsuario(SessaoSEI::getInstance()->getNumIdUsuario()); |
1628 | 1628 | $objPesquisaPendenciaDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); |
1629 | - | |
1629 | + | |
1630 | 1630 | if($retransmissao){ |
1631 | 1631 | $objAtividadeRN->setStatusPesquisa(false); |
1632 | - | |
1632 | + | |
1633 | 1633 | } |
1634 | - | |
1634 | + | |
1635 | 1635 | $objAtividadeDTO2 = new AtividadeDTO(); |
1636 | 1636 | $objAtividadeDTO2->setDblIdProtocolo($objProcedimentoDTO->getDblIdProcedimento()); |
1637 | 1637 | $objAtividadeDTO2->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); |
1638 | 1638 | $objAtividadeDTO2->setDthConclusao(null); |
1639 | - | |
1640 | - | |
1639 | + | |
1640 | + | |
1641 | 1641 | if ($objAtividadeRN->contarRN0035($objAtividadeDTO2) == 0) { |
1642 | 1642 | |
1643 | 1643 | //reabertura automática |
... | ... | @@ -1646,15 +1646,15 @@ class ReceberProcedimentoRN extends InfraRN |
1646 | 1646 | $objReabrirProcessoDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); |
1647 | 1647 | $objReabrirProcessoDTO->setNumIdUsuario(SessaoSEI::getInstance()->getNumIdUsuario()); |
1648 | 1648 | $objProcedimentoRN->reabrirRN0966($objReabrirProcessoDTO); |
1649 | - | |
1650 | - } | |
1651 | - | |
1649 | + | |
1650 | + } | |
1651 | + | |
1652 | 1652 | //$objPenAtividadeRN = new PenAtividadeRN(); |
1653 | 1653 | $arrObjProcedimentoDTO = $objAtividadeRN->listarPendenciasRN0754($objPesquisaPendenciaDTO); |
1654 | - | |
1654 | + | |
1655 | 1655 | $objInfraException->lancarValidacoes(); |
1656 | - | |
1657 | - | |
1656 | + | |
1657 | + | |
1658 | 1658 | $objEnviarProcessoDTO = new EnviarProcessoDTO(); |
1659 | 1659 | $objEnviarProcessoDTO->setArrAtividadesOrigem($arrObjProcedimentoDTO[0]->getArrObjAtividadeDTO()); |
1660 | 1660 | |
... | ... | @@ -1664,10 +1664,10 @@ class ReceberProcedimentoRN extends InfraRN |
1664 | 1664 | $objAtividadeDTO->setNumIdUsuarioOrigem(SessaoSEI::getInstance()->getNumIdUsuario()); |
1665 | 1665 | $objAtividadeDTO->setNumIdUnidade($objUnidadeDTO->getNumIdUnidade()); |
1666 | 1666 | $objAtividadeDTO->setNumIdUnidadeOrigem(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); |
1667 | - $objEnviarProcessoDTO->setArrAtividades(array($objAtividadeDTO)); | |
1668 | - | |
1667 | + $objEnviarProcessoDTO->setArrAtividades(array($objAtividadeDTO)); | |
1668 | + | |
1669 | 1669 | $objPenParametroRN = new PenParametroRN(); |
1670 | - | |
1670 | + | |
1671 | 1671 | $objEnviarProcessoDTO->setStrSinManterAberto('N'); |
1672 | 1672 | $strEnviaEmailNotificacao = $objPenParametroRN->getParametro('PEN_ENVIA_EMAIL_NOTIFICACAO_RECEBIMENTO'); |
1673 | 1673 | $objEnviarProcessoDTO->setStrSinEnviarEmailNotificacao($strEnviaEmailNotificacao); |
... | ... | @@ -1675,44 +1675,44 @@ class ReceberProcedimentoRN extends InfraRN |
1675 | 1675 | $objEnviarProcessoDTO->setDtaPrazo(null); |
1676 | 1676 | $objEnviarProcessoDTO->setNumDias(null); |
1677 | 1677 | $objEnviarProcessoDTO->setStrSinDiasUteis('N'); |
1678 | - | |
1678 | + | |
1679 | 1679 | $objAtividadeRN->enviarRN0023($objEnviarProcessoDTO); |
1680 | - | |
1680 | + | |
1681 | 1681 | } |
1682 | 1682 | |
1683 | 1683 | /* Essa é a função estática de comparação */ |
1684 | 1684 | static function comparacaoOrdemDocumentos($parDocumento1, $parDocumento2) |
1685 | 1685 | { |
1686 | 1686 | $numOrdemDocumento1 = strtolower($parDocumento1->ordem); |
1687 | - $numOrdemDocumento2 = strtolower($parDocumento2->ordem); | |
1688 | - return $numOrdemDocumento1 - $numOrdemDocumento2; | |
1689 | - } | |
1690 | - | |
1691 | - | |
1687 | + $numOrdemDocumento2 = strtolower($parDocumento2->ordem); | |
1688 | + return $numOrdemDocumento1 - $numOrdemDocumento2; | |
1689 | + } | |
1690 | + | |
1691 | + | |
1692 | 1692 | public function receberTramitesRecusados($parNumIdentificacaoTramite) { |
1693 | 1693 | |
1694 | 1694 | if (empty($parNumIdentificacaoTramite)) { |
1695 | 1695 | throw new InfraException('Parâmetro $parNumIdentificacaoTramite não informado.'); |
1696 | 1696 | } |
1697 | - | |
1697 | + | |
1698 | 1698 | //Busca os dados do trâmite no barramento |
1699 | 1699 | $tramite = $this->objProcessoEletronicoRN->consultarTramites($parNumIdentificacaoTramite); |
1700 | - | |
1700 | + | |
1701 | 1701 | if(!isset($tramite[0])){ |
1702 | 1702 | throw new InfraException("Não foi encontrado o trâmite de número {$parNumIdentificacaoTramite} para realizar a ciência da recusa"); |
1703 | 1703 | } |
1704 | - | |
1704 | + | |
1705 | 1705 | $tramite = $tramite[0]; |
1706 | - | |
1706 | + | |
1707 | 1707 | $objTramiteDTO = new TramiteDTO(); |
1708 | 1708 | $objTramiteDTO->setNumIdTramite($parNumIdentificacaoTramite); |
1709 | 1709 | $objTramiteDTO->retNumIdUnidade(); |
1710 | - | |
1710 | + | |
1711 | 1711 | $objTramiteBD = new TramiteBD(BancoSEI::getInstance()); |
1712 | 1712 | $objTramiteDTO = $objTramiteBD->consultar($objTramiteDTO); |
1713 | - | |
1713 | + | |
1714 | 1714 | SessaoSEI::getInstance(false)->simularLogin('SEI', null, null, $objTramiteDTO->getNumIdUnidade()); |
1715 | - | |
1715 | + | |
1716 | 1716 | //Busca os dados do procedimento |
1717 | 1717 | $objProcessoEletronicoDTO = new ProcessoEletronicoDTO(); |
1718 | 1718 | $objProcessoEletronicoDTO->setStrNumeroRegistro($tramite->NRE); |
... | ... | @@ -1720,7 +1720,7 @@ class ReceberProcedimentoRN extends InfraRN |
1720 | 1720 | |
1721 | 1721 | $objProcessoEletronicoBD = new ProcessoEletronicoBD($this->getObjInfraIBanco()); |
1722 | 1722 | $objProcessoEletronicoDTO = $objProcessoEletronicoBD->consultar($objProcessoEletronicoDTO); |
1723 | - | |
1723 | + | |
1724 | 1724 | //Busca a última atividade de trâmite externo |
1725 | 1725 | $objAtividadeDTO = new AtividadeDTO(); |
1726 | 1726 | $objAtividadeDTO->setDblIdProtocolo($objProcessoEletronicoDTO->getDblIdProcedimento()); |
... | ... | @@ -1731,7 +1731,7 @@ class ReceberProcedimentoRN extends InfraRN |
1731 | 1731 | |
1732 | 1732 | $objAtividadeBD = new AtividadeBD($this->getObjInfraIBanco()); |
1733 | 1733 | $objAtividadeDTO = $objAtividadeBD->consultar($objAtividadeDTO); |
1734 | - | |
1734 | + | |
1735 | 1735 | //Busca a unidade de destino |
1736 | 1736 | $objAtributoAndamentoDTO = new AtributoAndamentoDTO(); |
1737 | 1737 | $objAtributoAndamentoDTO->setNumIdAtividade($objAtividadeDTO->getNumIdAtividade()); |
... | ... | @@ -1740,7 +1740,7 @@ class ReceberProcedimentoRN extends InfraRN |
1740 | 1740 | |
1741 | 1741 | $objAtributoAndamentoBD = new AtributoAndamentoBD($this->getObjInfraIBanco()); |
1742 | 1742 | $objAtributoAndamentoDTO = $objAtributoAndamentoBD->consultar($objAtributoAndamentoDTO); |
1743 | - | |
1743 | + | |
1744 | 1744 | //Monta o DTO de receber tramite recusado |
1745 | 1745 | $objReceberTramiteRecusadoDTO = new ReceberTramiteRecusadoDTO(); |
1746 | 1746 | $objReceberTramiteRecusadoDTO->setNumIdTramite($parNumIdentificacaoTramite); |
... | ... | @@ -1749,23 +1749,23 @@ class ReceberProcedimentoRN extends InfraRN |
1749 | 1749 | $objReceberTramiteRecusadoDTO->setNumIdTarefa(ProcessoEletronicoRN::obterIdTarefaModulo(ProcessoEletronicoRN::$TI_PROCESSO_ELETRONICO_PROCESSO_TRAMITE_RECUSADO)); |
1750 | 1750 | $objReceberTramiteRecusadoDTO->setStrMotivoRecusa(utf8_decode($tramite->justificativaDaRecusa)); |
1751 | 1751 | $objReceberTramiteRecusadoDTO->setStrNomeUnidadeDestino($objAtributoAndamentoDTO->getStrValor()); |
1752 | - | |
1752 | + | |
1753 | 1753 | //Faz o tratamento do processo e do trâmite recusado |
1754 | 1754 | $this->receberTramiteRecusadoInterno($objReceberTramiteRecusadoDTO); |
1755 | - | |
1756 | - | |
1755 | + | |
1756 | + | |
1757 | 1757 | } |
1758 | 1758 | |
1759 | 1759 | protected function receberTramiteRecusadoInternoControlado(ReceberTramiteRecusadoDTO $objReceberTramiteRecusadoDTO){ |
1760 | - | |
1761 | - | |
1760 | + | |
1761 | + | |
1762 | 1762 | //Realiza o desbloqueio do processo |
1763 | 1763 | $objEntradaDesbloquearProcessoAPI = new EntradaDesbloquearProcessoAPI(); |
1764 | 1764 | $objEntradaDesbloquearProcessoAPI->setIdProcedimento($objReceberTramiteRecusadoDTO->getNumIdProtocolo()); |
1765 | - | |
1765 | + | |
1766 | 1766 | $objSeiRN = new SeiRN(); |
1767 | 1767 | $objSeiRN->desbloquearProcesso($objEntradaDesbloquearProcessoAPI); |
1768 | - | |
1768 | + | |
1769 | 1769 | //Adiciona um andamento para o trâmite recusado |
1770 | 1770 | $arrObjAtributoAndamentoDTO = array(); |
1771 | 1771 | |
... | ... | @@ -1774,104 +1774,104 @@ class ReceberProcedimentoRN extends InfraRN |
1774 | 1774 | $objAtributoAndamentoDTO->setStrValor($objReceberTramiteRecusadoDTO->getStrMotivoRecusa()); |
1775 | 1775 | $objAtributoAndamentoDTO->setStrIdOrigem($objReceberTramiteRecusadoDTO->getNumIdUnidadeOrigem()); |
1776 | 1776 | $arrObjAtributoAndamentoDTO[] = $objAtributoAndamentoDTO; |
1777 | - | |
1778 | - | |
1777 | + | |
1778 | + | |
1779 | 1779 | $objAtributoAndamentoDTO = new AtributoAndamentoDTO(); |
1780 | 1780 | $objAtributoAndamentoDTO->setStrNome('UNIDADE_DESTINO'); |
1781 | 1781 | $objAtributoAndamentoDTO->setStrValor($objReceberTramiteRecusadoDTO->getStrNomeUnidadeDestino()); |
1782 | 1782 | $objAtributoAndamentoDTO->setStrIdOrigem($objReceberTramiteRecusadoDTO->getNumIdUnidadeOrigem()); |
1783 | 1783 | $arrObjAtributoAndamentoDTO[] = $objAtributoAndamentoDTO; |
1784 | 1784 | |
1785 | - | |
1785 | + | |
1786 | 1786 | $objAtividadeDTO = new AtividadeDTO(); |
1787 | 1787 | $objAtividadeDTO->setDblIdProtocolo($objReceberTramiteRecusadoDTO->getNumIdProtocolo()); |
1788 | 1788 | $objAtividadeDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); |
1789 | 1789 | $objAtividadeDTO->setNumIdTarefa($objReceberTramiteRecusadoDTO->getNumIdTarefa()); |
1790 | 1790 | $objAtividadeDTO->setArrObjAtributoAndamentoDTO($arrObjAtributoAndamentoDTO); |
1791 | - | |
1791 | + | |
1792 | 1792 | $objAtividadeRN = new AtividadeRN(); |
1793 | 1793 | $objAtividadeRN->gerarInternaRN0727($objAtividadeDTO); |
1794 | - | |
1794 | + | |
1795 | 1795 | //Sinaliza na PenProtocolo que o processo obteve recusa |
1796 | 1796 | $objProtocolo = new PenProtocoloDTO(); |
1797 | 1797 | $objProtocolo->setDblIdProtocolo($objReceberTramiteRecusadoDTO->getNumIdProtocolo()); |
1798 | 1798 | $objProtocolo->setStrSinObteveRecusa('S'); |
1799 | - | |
1799 | + | |
1800 | 1800 | $objProtocoloBD = new ProtocoloBD($this->getObjInfraIBanco()); |
1801 | 1801 | $objProtocoloBD->alterar($objProtocolo); |
1802 | - | |
1803 | - | |
1802 | + | |
1803 | + | |
1804 | 1804 | $this->objProcessoEletronicoRN->cienciaRecusa($objReceberTramiteRecusadoDTO->getNumIdTramite()); |
1805 | - | |
1805 | + | |
1806 | 1806 | |
1807 | 1807 | } |
1808 | - | |
1809 | - | |
1810 | - | |
1808 | + | |
1809 | + | |
1810 | + | |
1811 | 1811 | /** |
1812 | - * Método que realiza a validação da extensão dos componentes digitais a serem recebidos | |
1813 | - * | |
1812 | + * Método que realiza a validação da extensão dos componentes digitais a serem recebidos | |
1813 | + * | |
1814 | 1814 | * @param integer $parIdTramite |
1815 | 1815 | * @param object $parObjProcesso |
1816 | 1816 | * @throws InfraException |
1817 | 1817 | */ |
1818 | 1818 | public function validarExtensaoComponentesDigitais($parIdTramite, $parObjProcesso){ |
1819 | - | |
1819 | + | |
1820 | 1820 | //Armazena o array de documentos |
1821 | 1821 | $arrDocumentos = is_array($parObjProcesso->documento) ? $parObjProcesso->documento : array($parObjProcesso->documento) ; |
1822 | - | |
1823 | - //Instancia o bd do arquivoExtensão | |
1822 | + | |
1823 | + //Instancia o bd do arquivoExtensão | |
1824 | 1824 | $arquivoExtensaoBD = new ArquivoExtensaoBD($this->getObjInfraIBanco()); |
1825 | - | |
1825 | + | |
1826 | 1826 | //Percorre os documentos |
1827 | 1827 | foreach($arrDocumentos as $documento){ |
1828 | - | |
1829 | - //Busca o nome do documento | |
1828 | + | |
1829 | + //Busca o nome do documento | |
1830 | 1830 | $nomeDocumento = $documento->componenteDigital->nome; |
1831 | - | |
1831 | + | |
1832 | 1832 | //Busca pela extensão do documento |
1833 | 1833 | $arrNomeDocumento = explode('.', $nomeDocumento); |
1834 | 1834 | $extDocumento = $arrNomeDocumento[count($arrNomeDocumento) - 1]; |
1835 | - | |
1836 | - //Verifica se a extensão do arquivo está cadastrada e ativa | |
1835 | + | |
1836 | + //Verifica se a extensão do arquivo está cadastrada e ativa | |
1837 | 1837 | $arquivoExtensaoDTO = new ArquivoExtensaoDTO(); |
1838 | 1838 | $arquivoExtensaoDTO->setStrSinAtivo('S'); |
1839 | 1839 | $arquivoExtensaoDTO->setStrExtensao($extDocumento); |
1840 | 1840 | $arquivoExtensaoDTO->retStrExtensao(); |
1841 | - | |
1841 | + | |
1842 | 1842 | if($arquivoExtensaoBD->contar($arquivoExtensaoDTO) == 0){ |
1843 | 1843 | $this->objProcessoEletronicoRN->recusarTramite($parIdTramite, 'Componentes digitais com formato inválido no destinatário. ', ProcessoEletronicoRN::MTV_RCSR_TRAM_CD_FORMATO); |
1844 | 1844 | throw new InfraException("Processo recusado devido a existência de documento em formato {$extDocumento} não permitido pelo sistema. "); |
1845 | 1845 | } |
1846 | - | |
1847 | - | |
1846 | + | |
1847 | + | |
1848 | 1848 | } |
1849 | 1849 | } |
1850 | - | |
1850 | + | |
1851 | 1851 | /** |
1852 | 1852 | * Método que verifica as permissões de escrita nos diretórios utilizados no recebimento de processos e documentos |
1853 | - * | |
1853 | + * | |
1854 | 1854 | * @param integer $parIdTramite |
1855 | 1855 | * @throws InfraException |
1856 | 1856 | */ |
1857 | 1857 | public function verificarPermissoesDiretorios($parIdTramite){ |
1858 | - | |
1858 | + | |
1859 | 1859 | //Verifica se o usuário possui permissões de escrita no repositório de arquivos externos |
1860 | 1860 | if(!is_writable(ConfiguracaoSEI::getInstance()->getValor('SEI', 'RepositorioArquivos'))){ |
1861 | - | |
1861 | + | |
1862 | 1862 | $this->objProcessoEletronicoRN->recusarTramite($parIdTramite, 'O sistema não possui permissão de escrita no diretório de armazenamento de documentos externos', ProcessoEletronicoRN::MTV_RCSR_TRAM_CD_OUTROU); |
1863 | 1863 | throw new InfraException('O sistema não possui permissão de escrita no diretório de armazenamento de documentos externos'); |
1864 | - | |
1864 | + | |
1865 | 1865 | } |
1866 | - | |
1866 | + | |
1867 | 1867 | //Verifica se o usuário possui permissões de escrita no diretório temporário de arquivos |
1868 | 1868 | if(!is_writable(DIR_SEI_TEMP)){ |
1869 | - | |
1869 | + | |
1870 | 1870 | $this->objProcessoEletronicoRN->recusarTramite($parIdTramite, 'O sistema não possui permissão de escrita no diretório de armazenamento de arquivos temporários do sistema.', ProcessoEletronicoRN::MTV_RCSR_TRAM_CD_OUTROU); |
1871 | 1871 | throw new InfraException('O sistema não possui permissão de escrita no diretório de armazenamento de arquivos temporários do sistema.'); |
1872 | - | |
1872 | + | |
1873 | 1873 | } |
1874 | - | |
1875 | - | |
1874 | + | |
1875 | + | |
1876 | 1876 | } |
1877 | 1877 | } | ... | ... |
rn/ReceberReciboTramiteRN.php
... | ... | @@ -19,16 +19,16 @@ class ReceberReciboTramiteRN extends InfraRN |
19 | 19 | { |
20 | 20 | return BancoSEI::getInstance(); |
21 | 21 | } |
22 | - | |
22 | + | |
23 | 23 | protected function registrarRecebimentoRecibo($numIdProcedimento, $strProtocoloFormatado, $numIdTramite) { |
24 | - | |
24 | + | |
25 | 25 | //REALIZA A CONCLUSÃO DO PROCESSO |
26 | 26 | $objEntradaConcluirProcessoAPI = new EntradaConcluirProcessoAPI(); |
27 | 27 | $objEntradaConcluirProcessoAPI->setIdProcedimento($numIdProcedimento); |
28 | - | |
28 | + | |
29 | 29 | $objSeiRN = new SeiRN(); |
30 | 30 | $objSeiRN->concluirProcesso($objEntradaConcluirProcessoAPI); |
31 | - | |
31 | + | |
32 | 32 | $arrObjAtributoAndamentoDTO = array(); |
33 | 33 | |
34 | 34 | $objAtributoAndamentoDTO = new AtributoAndamentoDTO(); |
... | ... | @@ -38,33 +38,33 @@ class ReceberReciboTramiteRN extends InfraRN |
38 | 38 | $arrObjAtributoAndamentoDTO[] = $objAtributoAndamentoDTO; |
39 | 39 | |
40 | 40 | $arrObjTramite = $this->objProcessoEletronicoRN->consultarTramites($numIdTramite); |
41 | - | |
41 | + | |
42 | 42 | $objTramite = array_pop($arrObjTramite); |
43 | - | |
43 | + | |
44 | 44 | $objEstrutura = $this->objProcessoEletronicoRN->consultarEstrutura( |
45 | - $objTramite->destinatario->identificacaoDoRepositorioDeEstruturas, | |
46 | - $objTramite->destinatario->numeroDeIdentificacaoDaEstrutura, | |
45 | + $objTramite->destinatario->identificacaoDoRepositorioDeEstruturas, | |
46 | + $objTramite->destinatario->numeroDeIdentificacaoDaEstrutura, | |
47 | 47 | true |
48 | 48 | ); |
49 | - | |
49 | + | |
50 | 50 | $objAtributoAndamentoDTO = new AtributoAndamentoDTO(); |
51 | 51 | $objAtributoAndamentoDTO->setStrNome('UNIDADE_DESTINO'); |
52 | 52 | $objAtributoAndamentoDTO->setStrValor($objEstrutura->nome); |
53 | 53 | $objAtributoAndamentoDTO->setStrIdOrigem($objEstrutura->numeroDeIdentificacaoDaEstrutura); |
54 | 54 | $arrObjAtributoAndamentoDTO[] = $objAtributoAndamentoDTO; |
55 | - | |
55 | + | |
56 | 56 | if(isset($objEstrutura->hierarquia)) { |
57 | - | |
57 | + | |
58 | 58 | $arrObjNivel = $objEstrutura->hierarquia->nivel; |
59 | - | |
59 | + | |
60 | 60 | $nome = ""; |
61 | 61 | $siglasUnidades = array(); |
62 | 62 | $siglasUnidades[] = $objEstrutura->sigla; |
63 | - | |
63 | + | |
64 | 64 | foreach($arrObjNivel as $key => $objNivel){ |
65 | 65 | $siglasUnidades[] = $objNivel->sigla ; |
66 | 66 | } |
67 | - | |
67 | + | |
68 | 68 | for($i = 1; $i <= 3; $i++){ |
69 | 69 | if(isset($siglasUnidades[count($siglasUnidades) - 1])){ |
70 | 70 | unset($siglasUnidades[count($siglasUnidades) - 1]); |
... | ... | @@ -78,7 +78,7 @@ class ReceberReciboTramiteRN extends InfraRN |
78 | 78 | $nome .= $nomeUnidade." / "; |
79 | 79 | } |
80 | 80 | } |
81 | - | |
81 | + | |
82 | 82 | $objNivel = current($arrObjNivel); |
83 | 83 | |
84 | 84 | $objAtributoAndamentoDTO = new AtributoAndamentoDTO(); |
... | ... | @@ -86,19 +86,19 @@ class ReceberReciboTramiteRN extends InfraRN |
86 | 86 | $objAtributoAndamentoDTO->setStrValor($nome); |
87 | 87 | $objAtributoAndamentoDTO->setStrIdOrigem($objNivel->numeroDeIdentificacaoDaEstrutura); |
88 | 88 | $arrObjAtributoAndamentoDTO[] = $objAtributoAndamentoDTO; |
89 | - | |
89 | + | |
90 | 90 | } |
91 | - | |
91 | + | |
92 | 92 | $objRepositorioDTO = $this->objProcessoEletronicoRN->consultarRepositoriosDeEstruturas($objTramite->destinatario->identificacaoDoRepositorioDeEstruturas); |
93 | 93 | if(!empty($objRepositorioDTO)) { |
94 | - | |
94 | + | |
95 | 95 | $objAtributoAndamentoDTO = new AtributoAndamentoDTO(); |
96 | 96 | $objAtributoAndamentoDTO->setStrNome('REPOSITORIO_DESTINO'); |
97 | 97 | $objAtributoAndamentoDTO->setStrValor($objRepositorioDTO->getStrNome()); |
98 | 98 | $objAtributoAndamentoDTO->setStrIdOrigem($objRepositorioDTO->getNumId()); |
99 | 99 | $arrObjAtributoAndamentoDTO[] = $objAtributoAndamentoDTO; |
100 | 100 | } |
101 | - | |
101 | + | |
102 | 102 | $objAtividadeDTO = new AtividadeDTO(); |
103 | 103 | $objAtividadeDTO->setDblIdProtocolo($numIdProcedimento); |
104 | 104 | $objAtividadeDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); |
... | ... | @@ -111,20 +111,20 @@ class ReceberReciboTramiteRN extends InfraRN |
111 | 111 | } |
112 | 112 | |
113 | 113 | protected function receberReciboDeTramiteConectado($parNumIdTramite) { |
114 | - | |
115 | - | |
114 | + | |
115 | + | |
116 | 116 | if (!isset($parNumIdTramite)) { |
117 | 117 | throw new InfraException('Parâmetro $parNumIdTramite não informado.'); |
118 | 118 | } |
119 | 119 | |
120 | 120 | $objReciboTramite = $this->objProcessoEletronicoRN->receberReciboDeTramite($parNumIdTramite); |
121 | - | |
121 | + | |
122 | 122 | if (!$objReciboTramite) { |
123 | 123 | throw new InfraException("Não foi possível obter recibo de conclusão do trâmite '$parNumIdTramite'"); |
124 | 124 | } |
125 | - | |
125 | + | |
126 | 126 | $objReciboTramite = $objReciboTramite->conteudoDoReciboDeTramite; |
127 | - $objDateTime = new DateTime($objReciboTramite->recibo->dataDeRecebimento); | |
127 | + $objDateTime = new DateTime($objReciboTramite->recibo->dataDeRecebimento); | |
128 | 128 | |
129 | 129 | $objReciboTramiteDTO = new ReciboTramiteDTO(); |
130 | 130 | $objReciboTramiteDTO->setStrNumeroRegistro($objReciboTramite->recibo->NRE); |
... | ... | @@ -137,11 +137,11 @@ class ReceberReciboTramiteRN extends InfraRN |
137 | 137 | $objTramiteDTO = new TramiteDTO(); |
138 | 138 | $objTramiteDTO->setNumIdTramite($parNumIdTramite); |
139 | 139 | $objTramiteDTO->retNumIdUnidade(); |
140 | - | |
140 | + | |
141 | 141 | $objTramiteBD = new TramiteBD(BancoSEI::getInstance()); |
142 | 142 | |
143 | 143 | if ($objTramiteBD->contar($objTramiteDTO) > 0) { |
144 | - | |
144 | + | |
145 | 145 | $objTramiteDTO = $objTramiteBD->consultar($objTramiteDTO); |
146 | 146 | SessaoSEI::getInstance(false)->simularLogin('SEI', null, null, $objTramiteDTO->getNumIdUnidade()); |
147 | 147 | |
... | ... | @@ -151,10 +151,10 @@ class ReceberReciboTramiteRN extends InfraRN |
151 | 151 | |
152 | 152 | $objReciboTramiteBD = new ReciboTramiteBD(BancoSEI::getInstance()); |
153 | 153 | if ($objReciboTramiteBD->contar($objReciboTramiteDTOExistente) == 0) { |
154 | - | |
155 | - //Armazenar dados do recibo de conclusão do trãmite | |
154 | + | |
155 | + //Armazenar dados do recibo de conclusão do trãmite | |
156 | 156 | $objReciboTramiteBD->cadastrar($objReciboTramiteDTO); |
157 | - | |
157 | + | |
158 | 158 | if ($objReciboTramite->recibo->hashDoComponenteDigital && is_array($objReciboTramite->recibo->hashDoComponenteDigital)) { |
159 | 159 | foreach ($objReciboTramite->recibo->hashDoComponenteDigital as $strHashComponenteDigital) { |
160 | 160 | |
... | ... | @@ -198,23 +198,21 @@ class ReceberReciboTramiteRN extends InfraRN |
198 | 198 | |
199 | 199 | $this->objProcedimentoAndamentoRN->setOpts($objProcessoEletronicoDTO->getDblIdProcedimento(), $parNumIdTramite, ProcessoEletronicoRN::obterIdTarefaModulo(ProcessoEletronicoRN::$TI_PROCESSO_ELETRONICO_PROCESSO_EXPEDIDO)); |
200 | 200 | $this->objProcedimentoAndamentoRN->cadastrar(sprintf('Trâmite do processo %s foi concluído', $objProtocoloDTO->getStrProtocoloFormatado()), 'S'); |
201 | - | |
201 | + | |
202 | 202 | //Registra o recbimento do recibo no histórico e realiza a conclusão do processo |
203 | 203 | $this->registrarRecebimentoRecibo($objProtocoloDTO->getDblIdProtocolo(), $objProtocoloDTO->getStrProtocoloFormatado(), $parNumIdTramite); |
204 | - | |
204 | + | |
205 | 205 | $objPenTramiteProcessadoRN = new PenTramiteProcessadoRN(PenTramiteProcessadoRN::STR_TIPO_RECIBO); |
206 | 206 | $objPenTramiteProcessadoRN->setRecebido($parNumIdTramite); |
207 | - | |
208 | - } catch (Exception $e) { | |
209 | - | |
210 | - $strMessage = 'Falha o modificar o estado do procedimento para bloqueado.'; | |
211 | 207 | |
208 | + } catch (Exception $e) { | |
209 | + $strMessage = 'Falha ao modificar o estado do procedimento para bloqueado.'; | |
212 | 210 | LogSEI::getInstance()->gravar($strMessage . PHP_EOL . $e->getMessage() . PHP_EOL . $e->getTraceAsString()); |
213 | 211 | throw new InfraException($strMessage, $e); |
214 | 212 | } |
215 | 213 | } |
216 | 214 | } |
217 | - | |
215 | + | |
218 | 216 | |
219 | 217 | } |
220 | -} | |
221 | 218 | \ No newline at end of file |
219 | +} | ... | ... |