Skip to content

Commit

Permalink
feat: Adicionar mensagem de recusa para parametros externos sem assun…
Browse files Browse the repository at this point in the history
…to cadastrado

Closes #67
  • Loading branch information
mrglaydson authored and guilhermeadc committed Apr 24, 2023
1 parent 2d89c9c commit a9c17d8
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 71 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

# Parâmetros de execução do comando MAKE
# Opções possíveis para spe (sistema de proc eletronico): sei3, sei4, super
<<<<<<< HEAD
sistema=super
=======
sistema=sei4
>>>>>>> 73a3cd0 (feat: Adicionar mensagem de recusa para parametros externos sem assunto cadastrado)
base=mysql
teste=

Expand Down
145 changes: 80 additions & 65 deletions src/pen_parametros_configuracao.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,24 +35,20 @@
$objNivelAcessoPermitidoRN = new NivelAcessoPermitidoRN();
$arrObjNivelAcessoPermitido=InfraArray::converterArrInfraDTO($objNivelAcessoPermitidoRN->listar($objNivelAcessoPermitidoDTO),"IdTipoProcedimento");

$objRelTipoProcedimentoAssuntoDTO = new RelTipoProcedimentoAssuntoDTO();
$objRelTipoProcedimentoAssuntoDTO->retNumIdTipoProcedimento();
$objRelTipoProcedimentoAssuntoDTO->setDistinct(true);
$objRelTipoProcedimentoAssuntoRN = new RelTipoProcedimentoAssuntoRN();
$arrObjTipoProcedimentoAssunto=InfraArray::converterArrInfraDTO($objRelTipoProcedimentoAssuntoRN->listarRN0192($objRelTipoProcedimentoAssuntoDTO),"IdTipoProcedimento");

$arrayFiltro=array_diff($arrObjTipoProcedimentoAssunto,$arrObjNivelAcessoPermitido);

if($arrayFiltro!=null){
$objTipoProcedimentoDTO = new TipoProcedimentoDTO();
$objTipoProcedimentoDTO->retNumIdTipoProcedimento();
$objTipoProcedimentoDTO->setNumIdTipoProcedimento($arrayFiltro,InfraDTO::$OPER_IN);
$objTipoProcedimentoDTO->retStrNome();
$objTipoProcedimentoDTO->setOrdStrNome(InfraDTO::$TIPO_ORDENACAO_ASC);
$objTipoProcedimentoRN = new TipoProcedimentoRN();
$arrObjTipoProcedimentoDTO = $objTipoProcedimentoRN->listarRN0244($objTipoProcedimentoDTO);
}else{
$arrObjTipoProcedimentoDTO=null;
$objRelTipoProcedimentoDTO = new TipoProcedimentoDTO();
$objRelTipoProcedimentoDTO->retNumIdTipoProcedimento();
$objRelTipoProcedimentoDTO->retStrNome();
$objRelTipoProcedimentoDTO->setOrdStrNome(InfraDTO::$TIPO_ORDENACAO_ASC);

$objRelTipoProcedimentoRN = new TipoProcedimentoRN();
$arrTipoProcedimento=InfraArray::converterArrInfraDTO($objRelTipoProcedimentoRN->listarRN0244($objRelTipoProcedimentoDTO),"IdTipoProcedimento");
$arrayFiltro = array_diff($arrTipoProcedimento,$arrObjNivelAcessoPermitido);

$objRelTipoProcedimentoDTO->setNumIdTipoProcedimento($arrayFiltro, InfraDTO::$OPER_IN);
$arrObjTipoProcedimentoDTO = $objRelTipoProcedimentoRN->listarRN0244($objRelTipoProcedimentoDTO);

if ($arrayFiltro == null) {
$arrObjTipoProcedimentoDTO = null;
}

/* Busca os dados para montar dropdown ( UNIDADE GERADORA DOCUMENTO RECEBIDO ) */
Expand All @@ -70,10 +66,27 @@
switch ($_GET['acao']) {
case 'pen_parametros_configuracao_salvar':
try {

$objPenParametroRN = new PenParametroRN();

if (!empty(count($_POST['parametro']))) {
foreach ($_POST['parametro'] as $nome => $valor) {

if ($nome == 'PEN_TIPO_PROCESSO_EXTERNO') {

$objRelTipoProcedimentoAssuntoDTO = new RelTipoProcedimentoAssuntoDTO();
$objRelTipoProcedimentoAssuntoDTO->retNumIdTipoProcedimento();
$objRelTipoProcedimentoAssuntoDTO->setNumIdTipoProcedimento($valor);
$objRelTipoProcedimentoAssuntoDTO->setDistinct(true);

$objRelTipoProcedimentoAssuntoRN = new RelTipoProcedimentoAssuntoRN();
$arrObjTipoProcedimentoAssunto=InfraArray::converterArrInfraDTO($objRelTipoProcedimentoAssuntoRN->listarRN0192($objRelTipoProcedimentoAssuntoDTO),"IdTipoProcedimento");

if (empty($arrObjTipoProcedimentoAssunto)) {
throw new InfraException("Tipo de processo externo selecionado não possui sugestão de assuntos atribuída.");
}
}

$objPenParametroDTO = new PenParametroDTO();
$objPenParametroDTO->setStrNome($nome);
$objPenParametroDTO->retStrNome();
Expand All @@ -84,6 +97,8 @@
}
}
}


} catch (Exception $e) {
$objPagina->processarExcecao($e);
}
Expand Down Expand Up @@ -191,14 +206,14 @@ function validarPreenchimentoCampo(campoValidacao){
foreach ($retParametros as $parametro) {

//echo '<div class="container">';
//Esse parâmetro não aparece, por já existencia de uma tela só para alteração do próprio.
//Esse parâmetro não aparece, por já existencia de uma tela só para alteração do próprio.
if ($parametro->getStrNome() != 'HIPOTESE_LEGAL_PADRAO') {
?> <label id="lbl<?= PaginaSEI::tratarHTML($parametro->getStrNome()); ?>" for="txt<?= PaginaSEI::tratarHTML($parametro->getStrNome()); ?>" accesskey="N" class="infraLabelObrigatorio"><?= PaginaSEI::tratarHTML($parametro->getStrDescricao()); ?>:</label> <?php
}
}

//Constrói o campo de valor
switch ($parametro->getStrNome()) {
case 'PEN_ID_REPOSITORIO_ORIGEM':
switch ($parametro->getStrNome()) {
case 'PEN_ID_REPOSITORIO_ORIGEM':
try {
$objExpedirProcedimentosRN = new ExpedirProcedimentoRN();
$repositorios = $objExpedirProcedimentosRN->listarRepositoriosDeEstruturas();
Expand All @@ -217,52 +232,52 @@ function validarPreenchimentoCampo(campoValidacao){
echo '<img class="erro_pen" src=" ' . ProcessoEletronicoINT::getCaminhoIcone("imagens/sei_erro.png") . '" title="Não foi possível carregar os Repositórios de Estruturas disponíveis no Tramita.GOV.BR devido à falha de acesso aos Serviços. O valor apresentação no campo é o código do repositório configurado anteriormente">';
echo '</div>';
}
break;


case 'PEN_TIPO_PROCESSO_EXTERNO':
$textoAjuda="Selecionar o tipo de processo que será utilizado no envio. Nesta listagem não estão presentes os tipos que permitem a classificação como sigilosos ou não possuam assunto associado";
echo '<div class="div_input">';
echo '<select id="PEN_TIPO_PROCESSO_EXTERNO" name="parametro[PEN_TIPO_PROCESSO_EXTERNO]" class="infraSelect input-field" >';
echo InfraINT::montarSelectArrInfraDTO('null', '&nbsp;', $parametro->getStrValor(), $arrObjTipoProcedimentoDTO, 'IdTipoProcedimento', 'Nome');
echo '<select>';
echo "<a class='pen_ajuda' id='ajuda_tipo_processo'" . PaginaSEI::montarTitleTooltip($textoAjuda) . "><img src=" . PaginaSEI::getInstance()->getDiretorioImagensGlobal() . "/ajuda.gif class='infraImg'/></a>";
echo '</div>';
break;

case 'PEN_UNIDADE_GERADORA_DOCUMENTO_RECEBIDO':
$textoAjuda="Selecionar a unidade que representa os órgãos externos";
echo '<div class="div_input">';
echo '<select id="PEN_UNIDADE_GERADORA_DOCUMENTO_RECEBIDO" name="parametro[PEN_UNIDADE_GERADORA_DOCUMENTO_RECEBIDO]" class="infraSelect input-field" >';
echo InfraINT::montarSelectArrInfraDTO('null', '&nbsp;', $parametro->getStrValor(), $arrObjUnidade, 'IdUnidade', 'Sigla');
echo '<select>';
echo "<a class='pen_ajuda' id='ajuda_unidade'" . PaginaSEI::montarTitleTooltip($textoAjuda) . "><img src=" . PaginaSEI::getInstance()->getDiretorioImagensGlobal() . "/ajuda.gif class='infraImg'/></a>";
echo '</div>';
break;

case 'PEN_ENVIA_EMAIL_NOTIFICACAO_RECEBIMENTO':
$textoAjuda="Selecionar caso queira receber notificações de recebimento";
echo '<div class="div_input">';
echo '<select id="PEN_ENVIA_EMAIL_NOTIFICACAO_RECEBIMENTO" name="parametro[PEN_ENVIA_EMAIL_NOTIFICACAO_RECEBIMENTO]" class="infraSelect input-field" >';
echo ' <option value="S" ' . ($parametro->getStrValor() == 'S' ? 'selected="selected"' : '') . '>Sim</option>';
echo ' <option value="N" ' . ($parametro->getStrValor() == 'N' ? 'selected="selected"' : '') . '>Não</option>';
echo '<select>';
echo "<a class='pen_ajuda' id='ajuda_notificacao' " . PaginaSEI::montarTitleTooltip($textoAjuda) . "><img src=" . PaginaSEI::getInstance()->getDiretorioImagensGlobal() . "/ajuda.gif class='infraImg'/></a>";
echo '</div>';
break;

default:
echo '<div class="div_input">';
echo '<input type="text" id="PARAMETRO_'.$parametro->getStrNome().'" name="parametro['.$parametro->getStrNome().']" class="infraText input-field" value="'.$objPagina->tratarHTML($parametro->getStrValor()).'" onkeypress="return infraMascaraTexto(this,event);" tabindex="'.$objPagina->getProxTabDados().'" maxlength="100" />';
echo '</div>';
break;
}
}
?>
break;


case 'PEN_TIPO_PROCESSO_EXTERNO':
$textoAjuda="Selecionar o tipo de processo que será utilizado no envio. Nesta listagem não estão presentes os tipos que permitem a classificação como sigilosos ou não possuam assunto associado";
echo '<div class="div_input">';
echo '<select id="PEN_TIPO_PROCESSO_EXTERNO" name="parametro[PEN_TIPO_PROCESSO_EXTERNO]" class="infraSelect input-field" >';
echo InfraINT::montarSelectArrInfraDTO('null', '&nbsp;', $parametro->getStrValor(), $arrObjTipoProcedimentoDTO, 'IdTipoProcedimento', 'Nome');
echo '<select>';
echo "<a class='pen_ajuda' id='ajuda_tipo_processo'" . PaginaSEI::montarTitleTooltip($textoAjuda) . "><img src=" . PaginaSEI::getInstance()->getDiretorioImagensGlobal() . "/ajuda.gif class='infraImg'/></a>";
echo '</div>';
break;

case 'PEN_UNIDADE_GERADORA_DOCUMENTO_RECEBIDO':
$textoAjuda="Selecionar a unidade que representa os órgãos externos";
echo '<div class="div_input">';
echo '<select id="PEN_UNIDADE_GERADORA_DOCUMENTO_RECEBIDO" name="parametro[PEN_UNIDADE_GERADORA_DOCUMENTO_RECEBIDO]" class="infraSelect input-field" >';
echo InfraINT::montarSelectArrInfraDTO('null', '&nbsp;', $parametro->getStrValor(), $arrObjUnidade, 'IdUnidade', 'Sigla');
echo '<select>';
echo "<a class='pen_ajuda' id='ajuda_unidade'" . PaginaSEI::montarTitleTooltip($textoAjuda) . "><img src=" . PaginaSEI::getInstance()->getDiretorioImagensGlobal() . "/ajuda.gif class='infraImg'/></a>";
echo '</div>';
break;

case 'PEN_ENVIA_EMAIL_NOTIFICACAO_RECEBIMENTO':
$textoAjuda="Selecionar caso queira receber notificações de recebimento";
echo '<div class="div_input">';
echo '<select id="PEN_ENVIA_EMAIL_NOTIFICACAO_RECEBIMENTO" name="parametro[PEN_ENVIA_EMAIL_NOTIFICACAO_RECEBIMENTO]" class="infraSelect input-field" >';
echo ' <option value="S" ' . ($parametro->getStrValor() == 'S' ? 'selected="selected"' : '') . '>Sim</option>';
echo ' <option value="N" ' . ($parametro->getStrValor() == 'N' ? 'selected="selected"' : '') . '>Não</option>';
echo '<select>';
echo "<a class='pen_ajuda' id='ajuda_notificacao' " . PaginaSEI::montarTitleTooltip($textoAjuda) . "><img src=" . PaginaSEI::getInstance()->getDiretorioImagensGlobal() . "/ajuda.gif class='infraImg'/></a>";
echo '</div>';
break;

default:
echo '<div class="div_input">';
echo '<input type="text" id="PARAMETRO_'.$parametro->getStrNome().'" name="parametro['.$parametro->getStrNome().']" class="infraText input-field" value="'.$objPagina->tratarHTML($parametro->getStrValor()).'" onkeypress="return infraMascaraTexto(this,event);" tabindex="'.$objPagina->getProxTabDados().'" maxlength="100" />';
echo '</div>';
break;
}
}
?>
</form>

<?
$objPagina->getInstance()->fecharAreaDados();
$objPagina->fecharBody();
$objPagina->fecharHtml();
?>
?>
10 changes: 4 additions & 6 deletions tests_super/funcional/phpunit.xml
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
colors="true"
verbose="true"
cacheResult="false"
executionOrder="no-depends"
>

<php>
<const name="PHPUNIT_HOST" value="selenium" />
<const name="PHPUNIT_PORT" value="4444" />
Expand All @@ -30,11 +28,11 @@
<const name="CONTEXTO_ORGAO_A" value="CONTEXTO_ORGAO_A" />
<const name="CONTEXTO_ORGAO_A_URL" value="http://org1-http:8000/sei" />
<const name="CONTEXTO_ORGAO_A_SIGLA_ORGAO" value="ABC" />
<const name="CONTEXTO_ORGAO_A_NUMERO_SEI" value="951" />
<const name="CONTEXTO_ORGAO_A_NUMERO_SEI" value="971" />
<const name="CONTEXTO_ORGAO_A_ID_REP_ESTRUTURAS" value="5" />
<const name="CONTEXTO_ORGAO_A_REP_ESTRUTURAS" value="RE CGPRO" />
<const name="CONTEXTO_ORGAO_A_SIGLA_UNIDADE" value="TESTE" />
<const name="CONTEXTO_ORGAO_A_ID_ESTRUTURA" value="125019" />
<const name="CONTEXTO_ORGAO_A_ID_ESTRUTURA" value="152006" />
<const name="CONTEXTO_ORGAO_A_SIGLA_UNIDADE_HIERARQUIA" value="" />
<const name="CONTEXTO_ORGAO_A_NOME_UNIDADE" value="Unidade de Teste ORG1" />
<const name="CONTEXTO_ORGAO_A_SIGLA_UNIDADE_SECUNDARIA" value="TESTE_1_1" />
Expand Down Expand Up @@ -70,7 +68,7 @@
<const name="CONTEXTO_ORGAO_B_ID_REP_ESTRUTURAS" value="5" />
<const name="CONTEXTO_ORGAO_B_REP_ESTRUTURAS" value="RE CGPRO" />
<const name="CONTEXTO_ORGAO_B_SIGLA_UNIDADE" value="TESTE" />
<const name="CONTEXTO_ORGAO_B_ID_ESTRUTURA" value="125020" />
<const name="CONTEXTO_ORGAO_B_ID_ESTRUTURA" value="152007" />
<const name="CONTEXTO_ORGAO_B_SIGLA_UNIDADE_HIERARQUIA" value="" />
<const name="CONTEXTO_ORGAO_B_NOME_UNIDADE" value="Unidade de Teste ORG2" />
<const name="CONTEXTO_ORGAO_B_USUARIO_LOGIN" value="teste" />
Expand Down Expand Up @@ -107,7 +105,7 @@
<const name="CONTEXTO_ORGAO_C_ID_REP_ESTRUTURAS" value="5" />
<const name="CONTEXTO_ORGAO_C_REP_ESTRUTURAS" value="RE CGPRO" />
<const name="CONTEXTO_ORGAO_C_SIGLA_UNIDADE" value="TESTE" />
<const name="CONTEXTO_ORGAO_C_ID_ESTRUTURA" value="121390" />
<const name="CONTEXTO_ORGAO_C_ID_ESTRUTURA" value="152007" />
<const name="CONTEXTO_ORGAO_C_SIGLA_UNIDADE_HIERARQUIA" value="" />
<const name="CONTEXTO_ORGAO_C_NOME_UNIDADE" value="SEGES TESTE SEM PAI" />
<const name="CONTEXTO_ORGAO_C_USUARIO_LOGIN" value="teste" />
Expand Down

0 comments on commit a9c17d8

Please sign in to comment.