Commit 22361c95205c078bf3db68327ab88e8c6b2ba114
1 parent
3136c273
Exists in
master
and in
19 other branches
[Fixed #54] Correção de problema no envio da ordenação dos documentos modificados na árvore
Showing
2 changed files
with
82 additions
and
52 deletions
Show diff stats
pen_procedimento_expedir_validar.php
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | require_once dirname(__FILE__) . '/../../SEI.php'; | 3 | require_once dirname(__FILE__) . '/../../SEI.php'; |
4 | 4 | ||
5 | session_start(); | 5 | session_start(); |
6 | - | 6 | + |
7 | //print_r($_POST); exit; | 7 | //print_r($_POST); exit; |
8 | 8 | ||
9 | 9 | ||
@@ -17,43 +17,43 @@ $objInfraException = new InfraException(); | @@ -17,43 +17,43 @@ $objInfraException = new InfraException(); | ||
17 | 17 | ||
18 | 18 | ||
19 | try { | 19 | try { |
20 | - | 20 | + |
21 | if(!array_key_exists('id_procedimento', $_GET) || empty($_GET['id_procedimento'])) { | 21 | if(!array_key_exists('id_procedimento', $_GET) || empty($_GET['id_procedimento'])) { |
22 | throw new InfraException('Nenhum procedimento foi informado', 'Desconhecido'); | 22 | throw new InfraException('Nenhum procedimento foi informado', 'Desconhecido'); |
23 | } | 23 | } |
24 | - | 24 | + |
25 | $dblIdProcedimento = $_GET['id_procedimento']; | 25 | $dblIdProcedimento = $_GET['id_procedimento']; |
26 | 26 | ||
27 | $objExpedirProcedimentosRN = new ExpedirProcedimentoRN(); | 27 | $objExpedirProcedimentosRN = new ExpedirProcedimentoRN(); |
28 | $objProcedimentoDTO = $objExpedirProcedimentosRN->consultarProcedimento($dblIdProcedimento); | 28 | $objProcedimentoDTO = $objExpedirProcedimentosRN->consultarProcedimento($dblIdProcedimento); |
29 | - | 29 | + |
30 | if(empty($objProcedimentoDTO)) { | 30 | if(empty($objProcedimentoDTO)) { |
31 | - throw new InfraException('Procedimento não foi localizado', 'Desconhecido'); | 31 | + throw new InfraException('Procedimento não foi localizado', 'Desconhecido'); |
32 | } | 32 | } |
33 | - | 33 | + |
34 | // Utilizamos o protocolo para criar um indice para separar os erros entre o | 34 | // Utilizamos o protocolo para criar um indice para separar os erros entre o |
35 | // processo e os seus processos apensados | 35 | // processo e os seus processos apensados |
36 | $strProtocoloFormatado = $objProcedimentoDTO->getStrProtocoloProcedimentoFormatado(); | 36 | $strProtocoloFormatado = $objProcedimentoDTO->getStrProtocoloProcedimentoFormatado(); |
37 | - | 37 | + |
38 | $objRelProtocoloProtocoloRN = new RelProtocoloProtocoloRN(); | 38 | $objRelProtocoloProtocoloRN = new RelProtocoloProtocoloRN(); |
39 | - | 39 | + |
40 | //Consulta do ID Pai | 40 | //Consulta do ID Pai |
41 | $objRelProtocoloProtocoloDTO1 = new RelProtocoloProtocoloDTO(); | 41 | $objRelProtocoloProtocoloDTO1 = new RelProtocoloProtocoloDTO(); |
42 | $objRelProtocoloProtocoloDTO1->setDblIdProtocolo1($dblIdProcedimento); | 42 | $objRelProtocoloProtocoloDTO1->setDblIdProtocolo1($dblIdProcedimento); |
43 | $objRelProtocoloProtocoloDTO1->setStrStaAssociacao(RelProtocoloProtocoloRN ::$TA_PROCEDIMENTO_ANEXADO); | 43 | $objRelProtocoloProtocoloDTO1->setStrStaAssociacao(RelProtocoloProtocoloRN ::$TA_PROCEDIMENTO_ANEXADO); |
44 | $objRelProtocoloProtocoloDTO1->retDblIdProtocolo1(); | 44 | $objRelProtocoloProtocoloDTO1->retDblIdProtocolo1(); |
45 | - | 45 | + |
46 | //Consulta do ID Filhos | 46 | //Consulta do ID Filhos |
47 | $objRelProtocoloProtocoloDTO2 = new RelProtocoloProtocoloDTO(); | 47 | $objRelProtocoloProtocoloDTO2 = new RelProtocoloProtocoloDTO(); |
48 | $objRelProtocoloProtocoloDTO2->setDblIdProtocolo2($dblIdProcedimento); | 48 | $objRelProtocoloProtocoloDTO2->setDblIdProtocolo2($dblIdProcedimento); |
49 | $objRelProtocoloProtocoloDTO2->setStrStaAssociacao(RelProtocoloProtocoloRN ::$TA_PROCEDIMENTO_ANEXADO); | 49 | $objRelProtocoloProtocoloDTO2->setStrStaAssociacao(RelProtocoloProtocoloRN ::$TA_PROCEDIMENTO_ANEXADO); |
50 | $objRelProtocoloProtocoloDTO2->retDblIdProtocolo2(); | 50 | $objRelProtocoloProtocoloDTO2->retDblIdProtocolo2(); |
51 | - | 51 | + |
52 | $numCount1 = $objRelProtocoloProtocoloRN->contarRN0843($objRelProtocoloProtocoloDTO1); | 52 | $numCount1 = $objRelProtocoloProtocoloRN->contarRN0843($objRelProtocoloProtocoloDTO1); |
53 | $numCount2 = $objRelProtocoloProtocoloRN->contarRN0843($objRelProtocoloProtocoloDTO2); | 53 | $numCount2 = $objRelProtocoloProtocoloRN->contarRN0843($objRelProtocoloProtocoloDTO2); |
54 | - | 54 | + |
55 | if ($numCount1 > 0 && $numCount2 > 0) { | 55 | if ($numCount1 > 0 && $numCount2 > 0) { |
56 | - $objInfraException->adicionarValidacao('Esse processo está anexado a outro processo e possui outros em anexo, portanto não pode ser tramitado.', $strProtocoloFormatado); | 56 | + $objInfraException->adicionarValidacao('Esse processo está anexado a outro processo e possui outros em anexo, portanto não pode ser tramitado.', $strProtocoloFormatado); |
57 | } else { | 57 | } else { |
58 | if ($numCount1 > 0) { | 58 | if ($numCount1 > 0) { |
59 | $objInfraException->adicionarValidacao('Esse processo possuí outros em anexo, portanto não pode ser tramitado externamente.', $strProtocoloFormatado); | 59 | $objInfraException->adicionarValidacao('Esse processo possuí outros em anexo, portanto não pode ser tramitado externamente.', $strProtocoloFormatado); |
@@ -63,7 +63,7 @@ try { | @@ -63,7 +63,7 @@ try { | ||
63 | $objInfraException->adicionarValidacao('Esse processo está anexado a outro processo, portanto não pode ser tramitado.', $strProtocoloFormatado); | 63 | $objInfraException->adicionarValidacao('Esse processo está anexado a outro processo, portanto não pode ser tramitado.', $strProtocoloFormatado); |
64 | } | 64 | } |
65 | } | 65 | } |
66 | - | 66 | + |
67 | if(!array_key_exists('txtProtocoloExibir', $_POST) || empty($_POST['txtProtocoloExibir'])) { | 67 | if(!array_key_exists('txtProtocoloExibir', $_POST) || empty($_POST['txtProtocoloExibir'])) { |
68 | $objInfraException->adicionarValidacao('Informe o Protocolo', $strProtocoloFormatado); | 68 | $objInfraException->adicionarValidacao('Informe o Protocolo', $strProtocoloFormatado); |
69 | } | 69 | } |
@@ -71,7 +71,7 @@ try { | @@ -71,7 +71,7 @@ try { | ||
71 | if(!array_key_exists('selRepositorioEstruturas', $_POST) || empty($_POST['selRepositorioEstruturas'])) { | 71 | if(!array_key_exists('selRepositorioEstruturas', $_POST) || empty($_POST['selRepositorioEstruturas'])) { |
72 | $objInfraException->adicionarValidacao('Informe o Repositório de Estruturas Organizacionais', $strProtocoloFormatado); | 72 | $objInfraException->adicionarValidacao('Informe o Repositório de Estruturas Organizacionais', $strProtocoloFormatado); |
73 | } | 73 | } |
74 | - | 74 | + |
75 | if(!array_key_exists('hdnIdUnidade', $_POST) || empty($_POST['hdnIdUnidade'])) { | 75 | if(!array_key_exists('hdnIdUnidade', $_POST) || empty($_POST['hdnIdUnidade'])) { |
76 | $objInfraException->adicionarValidacao('Informe Unidade de destino', $strProtocoloFormatado); | 76 | $objInfraException->adicionarValidacao('Informe Unidade de destino', $strProtocoloFormatado); |
77 | } | 77 | } |
@@ -96,34 +96,31 @@ try { | @@ -96,34 +96,31 @@ try { | ||
96 | $objExpedirProcedimentosRN->validarPreCondicoesExpedirProcedimento($objInfraException, $objProcedimentoDTO, $strProtocoloFormatado); | 96 | $objExpedirProcedimentosRN->validarPreCondicoesExpedirProcedimento($objInfraException, $objProcedimentoDTO, $strProtocoloFormatado); |
97 | } | 97 | } |
98 | } | 98 | } |
99 | - } | ||
100 | -} | ||
101 | -catch(\InfraException $e) { | ||
102 | - | ||
103 | - $objInfraException->adicionarValidacao($e->getTraceAsString()); | 99 | + } |
100 | +} | ||
101 | +catch(\InfraException $e) { | ||
102 | + $strmensagemErro = InfraException::inspecionar($e); | ||
103 | + $objInfraException->adicionarValidacao($strmensagemErro); | ||
104 | + LogSEI::getInstance()->gravar($strmensagemErro); | ||
104 | } | 105 | } |
105 | 106 | ||
106 | 107 | ||
107 | if($objInfraException->contemValidacoes()) { | 108 | if($objInfraException->contemValidacoes()) { |
108 | 109 | ||
109 | $arrErros = array(); | 110 | $arrErros = array(); |
110 | - | ||
111 | foreach($objInfraException->getArrObjInfraValidacao() as $objInfraValidacao) { | 111 | foreach($objInfraException->getArrObjInfraValidacao() as $objInfraValidacao) { |
112 | - | ||
113 | $strAtributo = $objInfraValidacao->getStrAtributo(); | 112 | $strAtributo = $objInfraValidacao->getStrAtributo(); |
114 | - | ||
115 | if(!array_key_exists($strAtributo, $arrErros)){ | 113 | if(!array_key_exists($strAtributo, $arrErros)){ |
116 | $arrErros[$strAtributo] = array(); | 114 | $arrErros[$strAtributo] = array(); |
117 | } | 115 | } |
118 | $arrErros[$strAtributo][] = utf8_encode($objInfraValidacao->getStrDescricao()); | 116 | $arrErros[$strAtributo][] = utf8_encode($objInfraValidacao->getStrDescricao()); |
119 | - } | ||
120 | - | ||
121 | - $arrResponse['erros'] = $arrErros; | 117 | + } |
118 | + | ||
119 | + $arrResponse['erros'] = $arrErros; | ||
122 | } | 120 | } |
123 | else { | 121 | else { |
124 | - | ||
125 | $arrResponse['sucesso'] = true; | 122 | $arrResponse['sucesso'] = true; |
126 | -} | 123 | +} |
127 | 124 | ||
128 | print json_encode($arrResponse); | 125 | print json_encode($arrResponse); |
129 | -exit(0); | ||
130 | \ No newline at end of file | 126 | \ No newline at end of file |
127 | +exit(0); |
rn/ExpedirProcedimentoRN.php
@@ -1409,31 +1409,64 @@ class ExpedirProcedimentoRN extends InfraRN { | @@ -1409,31 +1409,64 @@ class ExpedirProcedimentoRN extends InfraRN { | ||
1409 | throw new InfraException('Parâmetro $idProcedimento não informado.'); | 1409 | throw new InfraException('Parâmetro $idProcedimento não informado.'); |
1410 | } | 1410 | } |
1411 | 1411 | ||
1412 | - $documentoDTO = new DocumentoDTO(); | ||
1413 | - $documentoDTO->setDblIdProcedimento($idProcedimento); | ||
1414 | - $documentoDTO->retStrDescricaoUnidadeGeradoraProtocolo(); | ||
1415 | - $documentoDTO->retNumIdOrgaoUnidadeGeradoraProtocolo(); | ||
1416 | - $documentoDTO->retStrSiglaUnidadeGeradoraProtocolo(); | ||
1417 | - $documentoDTO->retStrStaNivelAcessoLocalProtocolo(); | ||
1418 | - $documentoDTO->retStrProtocoloDocumentoFormatado(); | ||
1419 | - $documentoDTO->retStrStaEstadoProtocolo(); | ||
1420 | - $documentoDTO->retNumIdUsuarioGeradorProtocolo(); | ||
1421 | - $documentoDTO->retStrStaProtocoloProtocolo(); | ||
1422 | - $documentoDTO->retNumIdUnidadeResponsavel(); | ||
1423 | - $documentoDTO->retStrDescricaoProtocolo(); | ||
1424 | - $documentoDTO->retDtaGeracaoProtocolo(); | ||
1425 | - $documentoDTO->retDblIdProcedimento(); | ||
1426 | - $documentoDTO->retDblIdDocumento(); | ||
1427 | - $documentoDTO->retStrNomeSerie(); | ||
1428 | - $documentoDTO->retNumIdSerie(); | ||
1429 | - $documentoDTO->retStrConteudoAssinatura(); | ||
1430 | - $documentoDTO->retStrNumero(); | ||
1431 | - $documentoDTO->retNumIdTipoConferencia(); | ||
1432 | - $documentoDTO->retStrStaDocumento(); | ||
1433 | - $documentoDTO->retNumIdHipoteseLegalProtocolo(); | ||
1434 | - $documentoDTO->setOrdStrProtocoloDocumentoFormatado(InfraDTO::$TIPO_ORDENACAO_ASC); | 1412 | + //Recupera toda a lista de documentos vinculados ao processo, considerando a ordenação definida pelo usuário |
1413 | + $arrTipoAssociacao = array(RelProtocoloProtocoloRN::$TA_DOCUMENTO_ASSOCIADO, RelProtocoloProtocoloRN::$TA_DOCUMENTO_MOVIDO); | ||
1414 | + $objRelProtocoloProtocoloDTO = new RelProtocoloProtocoloDTO(); | ||
1415 | + $objRelProtocoloProtocoloDTO->retDblIdRelProtocoloProtocolo(); | ||
1416 | + $objRelProtocoloProtocoloDTO->retDblIdProtocolo1(); | ||
1417 | + $objRelProtocoloProtocoloDTO->retDblIdProtocolo2(); | ||
1418 | + $objRelProtocoloProtocoloDTO->retStrStaAssociacao(); | ||
1419 | + $objRelProtocoloProtocoloDTO->setStrStaAssociacao($arrTipoAssociacao, InfraDTO::$OPER_IN); | ||
1420 | + $objRelProtocoloProtocoloDTO->setDblIdProtocolo1($idProcedimento); | ||
1421 | + $objRelProtocoloProtocoloDTO->setOrdNumSequencia(InfraDTO::$TIPO_ORDENACAO_ASC); | ||
1422 | + | ||
1423 | + $objRelProtocoloProtocoloRN = new RelProtocoloProtocoloRN(); | ||
1424 | + $arrObjRelProtocoloProtocoloDTO = $objRelProtocoloProtocoloRN->listarRN0187($objRelProtocoloProtocoloDTO); | ||
1425 | + | ||
1426 | + $arrIdDocumentos = array(); | ||
1427 | + foreach($arrObjRelProtocoloProtocoloDTO as $objRelProtocoloProtocoloDTO) { | ||
1428 | + if ($objRelProtocoloProtocoloDTO->getStrStaAssociacao()==RelProtocoloProtocoloRN::$TA_DOCUMENTO_ASSOCIADO || | ||
1429 | + $objRelProtocoloProtocoloDTO->getStrStaAssociacao()==RelProtocoloProtocoloRN::$TA_DOCUMENTO_MOVIDO) { | ||
1430 | + | ||
1431 | + $arrIdDocumentos[] = $objRelProtocoloProtocoloDTO->getDblIdProtocolo2(); | ||
1432 | + } | ||
1433 | + } | ||
1434 | + | ||
1435 | + $objDocumentoDTO = new DocumentoDTO(); | ||
1436 | + $objDocumentoDTO->retStrDescricaoUnidadeGeradoraProtocolo(); | ||
1437 | + $objDocumentoDTO->retNumIdOrgaoUnidadeGeradoraProtocolo(); | ||
1438 | + $objDocumentoDTO->retStrSiglaUnidadeGeradoraProtocolo(); | ||
1439 | + $objDocumentoDTO->retStrStaNivelAcessoLocalProtocolo(); | ||
1440 | + $objDocumentoDTO->retStrProtocoloDocumentoFormatado(); | ||
1441 | + $objDocumentoDTO->retStrStaEstadoProtocolo(); | ||
1442 | + $objDocumentoDTO->retNumIdUsuarioGeradorProtocolo(); | ||
1443 | + $objDocumentoDTO->retStrStaProtocoloProtocolo(); | ||
1444 | + $objDocumentoDTO->retNumIdUnidadeResponsavel(); | ||
1445 | + $objDocumentoDTO->retStrDescricaoProtocolo(); | ||
1446 | + $objDocumentoDTO->retDtaGeracaoProtocolo(); | ||
1447 | + $objDocumentoDTO->retDblIdProcedimento(); | ||
1448 | + $objDocumentoDTO->retDblIdDocumento(); | ||
1449 | + $objDocumentoDTO->retStrNomeSerie(); | ||
1450 | + $objDocumentoDTO->retNumIdSerie(); | ||
1451 | + $objDocumentoDTO->retStrConteudoAssinatura(); | ||
1452 | + $objDocumentoDTO->retStrNumero(); | ||
1453 | + $objDocumentoDTO->retNumIdTipoConferencia(); | ||
1454 | + $objDocumentoDTO->retStrStaDocumento(); | ||
1455 | + $objDocumentoDTO->retNumIdHipoteseLegalProtocolo(); | ||
1456 | + $objDocumentoDTO->setDblIdDocumento($arrIdDocumentos, InfraDTO::$OPER_IN); | ||
1457 | + | ||
1458 | + $arrObjDocumentoDTOBanco = $this->objDocumentoRN->listarRN0008($objDocumentoDTO); | ||
1459 | + $arrObjDocumentoDTOIndexado = InfraArray::indexarArrInfraDTO($arrObjDocumentoDTOBanco, 'IdDocumento'); | ||
1460 | + | ||
1461 | + //Mantem ordenação definida pelo usuário | ||
1462 | + $arrObjDocumentoDTO = array(); | ||
1463 | + foreach($arrIdDocumentos as $dblIdDocumento){ | ||
1464 | + if (isset($arrObjDocumentoDTOIndexado[$dblIdDocumento])){ | ||
1465 | + $arrObjDocumentoDTO[$dblIdDocumento] = $arrObjDocumentoDTOIndexado[$dblIdDocumento]; | ||
1466 | + } | ||
1467 | + } | ||
1435 | 1468 | ||
1436 | - return $this->objDocumentoRN->listarRN0008($documentoDTO); | 1469 | + return $arrObjDocumentoDTO; |
1437 | } | 1470 | } |
1438 | 1471 | ||
1439 | /** | 1472 | /** |