Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2.7] Correções apontadas pelo SonarCloud #856

Merged
merged 6 commits into from
Jun 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions ieducar/intranet/atendidos_cad.php
Original file line number Diff line number Diff line change
Expand Up @@ -1089,8 +1089,6 @@ protected function validatePhoto()

return false;
}

return false;
} else {
$this->objPhoto = null;

Expand Down
2 changes: 2 additions & 0 deletions ieducar/intranet/educar_acervo_det.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ public function Gerar()
$obj = new clsPmieducarAcervoAssunto();
$obj = $obj->listaAssuntosPorObra($this->cod_acervo);
if (is_array($obj) && count($obj)) {
$assuntos = '';
foreach ($obj as $reg) {
$assuntos.= '<span style="background-color: #ccdce6; padding: 4px 20px;"><b>'.$reg['nome'].'</b></span>&nbsp; ';
}
Expand All @@ -192,6 +193,7 @@ public function Gerar()
$obj_categoria = new clsPmieducarCategoriaAcervo();
$obj_categoria = $obj_categoria->listaCategoriasPorObra($this->cod_acervo);
if (is_array($obj_categoria) && count($obj_categoria)) {
$categorias = '';
foreach ($obj_categoria as $obj_cat) {
$categorias.= '<span style="background-color: #ccdce6; padding: 4px 20px;"><b>'.$obj_cat['descricao'].'</b></span>&nbsp; ';
}
Expand Down
7 changes: 1 addition & 6 deletions ieducar/intranet/educar_acervo_lst.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public function Gerar()
$obj_colecao->setOrderby('nm_colecao ASC');
$obj_colecao->setCamposLista('cod_acervo_colecao, nm_colecao');
$lst_colecao = $obj_colecao->lista(null, null, null, null, null, null, null, null, null, 1, $this->ref_cod_biblioteca);
if (is_array($opcoes)) {
if (is_array($opcoes_colecao)) {
foreach ($lst_colecao as $colecao) {
$opcoes_colecao[$colecao['cod_acervo_colecao']] = $colecao['nm_colecao'];
}
Expand Down Expand Up @@ -212,11 +212,6 @@ public function Gerar()
"<a href=\"educar_acervo_det.php?cod_acervo={$registro['cod_acervo']}\">{$registro['isbn']}</a>"
];

if ($qtd_bibliotecas > 1 && ($nivel_usuario == 4 || $nivel_usuario == 8)) {
$lista_busca[] = "<a href=\"educar_acervo_det.php?cod_acervo={$registro['cod_acervo']}\">{$registro['ref_cod_biblioteca']}</a>";
} elseif ($nivel_usuario == 1 || $nivel_usuario == 2 || $nivel_usuario == 4) {
$lista_busca[] = "<a href=\"educar_acervo_det.php?cod_acervo={$registro['cod_acervo']}\">{$registro['ref_cod_biblioteca']}</a>";
}
$this->addLinhas($lista_busca);
}
}
Expand Down
2 changes: 0 additions & 2 deletions ieducar/intranet/educar_avancar_mod_cad.php
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,6 @@ protected function rematricularAlunoAprovado($escolaId, $serieId, $ano, $alunoId
} else {
throw new Exception('Não foi possível obter a próxima série da sequência de enturmação');
}

return false;
}

protected function rematricularAlunoReprovado($escolaId, $cursoId, $serieId, $ano, $alunoId)
Expand Down
1 change: 1 addition & 0 deletions ieducar/intranet/educar_dispensa_disciplina_cad.php
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ public function montaEtapas()
$objModulo = new clsPmieducarModulo();
$dadosModulo = $objModulo->lista($dadosEtapa[0]['ref_cod_modulo']);
$nomeModulo = $dadosModulo[0]['nm_tipo'];
$conteudoHtml = '';

foreach ($dadosEtapa as $modulo) {
$checked = '';
Expand Down
2 changes: 1 addition & 1 deletion ieducar/intranet/educar_escola_serie_cad.php
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ public function Editar()

$this->mensagem = $msgs;

return $this->simpleRedirect(\Request::getRequestUri());
$this->simpleRedirect(\Request::getRequestUri());
}

$editou = $obj->edita();
Expand Down
1 change: 1 addition & 0 deletions ieducar/intranet/educar_falta_atraso_det.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public function Gerar()

$cont = 0;
$total = 0;
$corpo = '';

foreach ($registro as $falta) {
if (($cont % 2) == 0) {
Expand Down
2 changes: 0 additions & 2 deletions ieducar/intranet/educar_matricula_reclassificar_cad.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,11 @@ public function Novo()
$this->mensagem = 'Data de abandono não pode ser inferior a data da matrícula.<br>';

return false;
die();
}
} elseif (substr($det_matricula['data_matricula'], 0, 10) > $this->data_cancel) {
$this->mensagem = 'Data de abandono não pode ser inferior a data da matrícula.<br>';

return false;
die();
}

if (!$det_matricula || $det_matricula['aprovado'] != 3) {
Expand Down
2 changes: 1 addition & 1 deletion ieducar/intranet/educar_matricula_turma_turno_cad.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public function Editar()

session()->flash('success', $is_change ? 'Turno alterado com sucesso!' : 'Não houve alteração no valor do campo Turno.');

return $this->simpleRedirect(url('intranet/educar_matricula_det.php?cod_matricula='.$this->cod_matricula));
$this->simpleRedirect(url('intranet/educar_matricula_det.php?cod_matricula='.$this->cod_matricula));
}

public function makeExtra()
Expand Down
1 change: 1 addition & 0 deletions ieducar/intranet/educar_pagamento_multa_det.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public function Gerar()
</TR>';
$cont = 0;
$total = 0;
$corpo = '';
foreach ($lst_divida as $divida) {
$total += $divida['valor_multa'];
if (($cont % 2) == 0) {
Expand Down
12 changes: 6 additions & 6 deletions ieducar/intranet/educar_pesquisa_servidor_lst.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,20 +227,20 @@ public function Gerar()
if (Session::get('tipo')) {
if (is_string($campo1) && is_string($campo2)) {
if (is_string(Session::get('horario'))) {
$script = " onclick=\"addVal1('{$campo1}','{$registro['nome']}','{$registro['cod_servidor']}'); addVal1('{$campo2}','{$registro['cod_servidor']}','{$registro['nome']}'); $setAll fecha();\"";
$script = " onclick=\"addVal1('{$campo1}','{$registro['nome']}','{$registro['cod_servidor']}'); addVal1('{$campo2}','{$registro['cod_servidor']}','{$registro['nome']}'); fecha();\"";
} else {
$script = " onclick=\"addVal1('{$campo1}','{$registro['cod_servidor']}', '{$registro['nome']}'); addVal1('{$campo2}','{$registro['nome']}', '{$registro['cod_servidor']}'); $setAll fecha();\"";
$script = " onclick=\"addVal1('{$campo1}','{$registro['cod_servidor']}', '{$registro['nome']}'); addVal1('{$campo2}','{$registro['nome']}', '{$registro['cod_servidor']}'); fecha();\"";
}
} elseif (is_string($campo1)) {
$script = " onclick=\"addVal1('{$campo1}','{$registro['cod_servidor']}','{$registro['nome']}'); $setAll fecha();\"";
$script = " onclick=\"addVal1('{$campo1}','{$registro['cod_servidor']}','{$registro['nome']}'); fecha();\"";
}
} else {
if (is_string($campo1) && is_string($campo2)) {
$script = " onclick=\"addVal1('{$campo1}','{$registro['cod_servidor']}','{$registro['nome']}'); addVal1('{$campo2}','{$registro['cod_servidor']}','{$registro['nome']}'); $setAll fecha();\"";
$script = " onclick=\"addVal1('{$campo1}','{$registro['cod_servidor']}','{$registro['nome']}'); addVal1('{$campo2}','{$registro['cod_servidor']}','{$registro['nome']}'); fecha();\"";
} elseif (is_string($campo2)) {
$script = " onclick=\"addVal1('{$campo2}','{$registro['cod_servidor']}','{$registro['nome']}'); $setAll fecha();\"";
$script = " onclick=\"addVal1('{$campo2}','{$registro['cod_servidor']}','{$registro['nome']}'); fecha();\"";
} elseif (is_string($campo1)) {
$script = " onclick=\"addVal1('{$campo1}','{$registro['cod_servidor']}','{$registro['nome']}'); $setAll fecha();\"";
$script = " onclick=\"addVal1('{$campo1}','{$registro['cod_servidor']}','{$registro['nome']}'); fecha();\"";
}
}
$this->addLinhas([
Expand Down
4 changes: 1 addition & 3 deletions ieducar/intranet/educar_quadro_horario_cad.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ public function Inicializar()
"educar_quadro_horario_lst.php?ref_cod_turma={$this->ref_cod_turma}&ref_cod_serie={$this->ref_cod_serie}&ref_cod_curso={$this->ref_cod_curso}&ref_cod_escola={$this->ref_cod_escola}&ref_cod_instituicao={$this->ref_cod_instituicao}&ano={$this->ano}"
);

$this->url_cancelar = $retorno == 'Editar' ?
"educar_quadro_horario_lst.php?ref_cod_turma={$this->ref_cod_turma}&ref_cod_serie={$this->ref_cod_serie}&ref_cod_curso={$this->ref_cod_curso}&ref_cod_escola={$this->ref_cod_escola}&ref_cod_instituicao={$this->ref_cod_instituicao}&ano={$this->ano}" :
"educar_quadro_horario_lst.php?ref_cod_turma={$this->ref_cod_turma}&ref_cod_serie={$this->ref_cod_serie}&ref_cod_curso={$this->ref_cod_curso}&ref_cod_escola={$this->ref_cod_escola}&ref_cod_instituicao={$this->ref_cod_instituicao}&ano={$this->ano}";
$this->url_cancelar = "educar_quadro_horario_lst.php?ref_cod_turma={$this->ref_cod_turma}&ref_cod_serie={$this->ref_cod_serie}&ref_cod_curso={$this->ref_cod_curso}&ref_cod_escola={$this->ref_cod_escola}&ref_cod_instituicao={$this->ref_cod_instituicao}&ano={$this->ano}";

$this->nome_url_cancelar = 'Cancelar';

Expand Down
2 changes: 1 addition & 1 deletion ieducar/intranet/educar_servidor_afastamento_cad.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ public function Gerar()
}

if ($this->alocacao_array) {
$tamanho = sizeof($alocacao);
$tamanho = count($this->alocacao_array);
$script = "<script>\nvar num_alocacao = {$tamanho};\n";
$script .= "var array_servidores = Array();\n";

Expand Down
2 changes: 1 addition & 1 deletion ieducar/intranet/educar_servidor_cad.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function Inicializar()
$registro = $obj->detalhe();

if (empty($registro)) {
return $this->simpleRedirect(url('intranet/educar_servidor_lst.php'));
$this->simpleRedirect(url('intranet/educar_servidor_lst.php'));
}

if ($registro) {
Expand Down
2 changes: 1 addition & 1 deletion ieducar/intranet/educar_servidor_curso_lst.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public function Novo()

public function Editar()
{
return $this->Novo();
$this->Novo();
}

public function Excluir()
Expand Down
2 changes: 1 addition & 1 deletion ieducar/intranet/educar_servidor_disciplina_lst.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ public function Novo()

public function Editar()
{
return $this->Novo();
$this->Novo();
}

public function Excluir()
Expand Down
2 changes: 0 additions & 2 deletions ieducar/intranet/educar_servidor_vinculo_turma_det.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,6 @@ public function Gerar()
$registro['instituicao_id'],
$registro['servidor_id']
);

"go(\"educar_servidor_vinculo_turma_copia_cad.php?{$get_padrao}\");";
}

$this->url_cancelar = sprintf(
Expand Down
15 changes: 4 additions & 11 deletions ieducar/intranet/educar_turma_cad.php
Original file line number Diff line number Diff line change
Expand Up @@ -378,17 +378,10 @@ public function Gerar()

$script = 'javascript:showExpansivelIframe(520, 170, \'educar_turma_tipo_cad_pop.php\');';

if ($this->ref_cod_instituicao && $this->ref_cod_escola && $this->ref_cod_curso) {
$script = sprintf(
'<div id=\'img_turma\' border=\'0\' onclick=\'%s\'>',
$script
);
} else {
$script = sprintf(
'<div id=\'img_turma\' border=\'0\' onclick=\'%s\'>',
$script
);
}
$script = sprintf(
'<div id=\'img_turma\' border=\'0\' onclick=\'%s\'>',
$script
);

$this->campoLista(
'ref_cod_turma_tipo',
Expand Down
5 changes: 3 additions & 2 deletions ieducar/intranet/educar_turma_det.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,8 @@ public function Gerar()

if (is_string($registro['dias_semana']) && !empty($registro['dias_semana'])) {
$registro['dias_semana'] = explode(',', str_replace(['{', '}'], '', $registro['dias_semana']));
foreach ($registro['dias_semana'] as $key => $dia) {
$diasSemana = '';
foreach ($registro['dias_semana'] as $dia) {
$diasSemana .= $dias_da_semana[$dia] . '<br>';
}
$this->addDetalhe(
Expand Down Expand Up @@ -322,7 +323,7 @@ public function Gerar()

if (is_string($registro['dias_semana']) && !empty($registro['dias_semana'])) {
$registro['dias_semana'] = explode(',', str_replace(['{', '}'], '', $registro['dias_semana']));
foreach ($registro['dias_semana'] as $key => $dia) {
foreach ($registro['dias_semana'] as $dia) {
$diasSemana .= $dias_da_semana[$dia] . '<br>';
}
$this->addDetalhe(
Expand Down
4 changes: 2 additions & 2 deletions ieducar/intranet/include/clsAgenda.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ public function add_compromisso_externo_1()
if ($encaminha['ref_cod_juris_processo'] && $encaminha['ref_versao_processo']) {
$objProcesso = new clsProcesso($encaminha['ref_cod_juris_processo'], $encaminha['ref_versao_processo']);
$detalheProcesso = $objProcesso->detalhe();
if ($detalheProcesso['ativo'] == 1 && !$detalheProcesso['ref_pessoa_finalizadora'] && $qtd<3) {
if ($detalheProcesso['ativo'] == 1 && !$detalheProcesso['ref_pessoa_finalizadora']) {
$temp_arr_compromisso2['data_inicio'] = $detalheProcesso['data_envio'];
$temp_arr_compromisso2['versao'] = '1';
$temp_arr_compromisso2['data_fim'] =$detalheProcesso['data_envio'];
Expand All @@ -431,7 +431,7 @@ public function add_compromisso_externo_1()
$detalheTramite = $objTramite->detalhe();
$objProcesso = new clsProcesso($detalheTramite['ref_cod_juris_processo'], $detalheTramite['ref_versao_processo']);
$detalheProcesso = $objProcesso->detalhe();
if ($detalheTramite['ativo'] == 1 && !$detalheProcesso['ref_pessoa_finalizadora'] && $qtd<3) {
if ($detalheTramite['ativo'] == 1 && !$detalheProcesso['ref_pessoa_finalizadora']) {
$temp_arr_compromisso2['data_inicio'] = $detalheProcesso['data_envio'];
$temp_arr_compromisso2['versao'] = '1';
$temp_arr_compromisso2['data_fim'] =$detalheProcesso['data_envio'];
Expand Down
7 changes: 1 addition & 6 deletions ieducar/intranet/include/clsCadastro.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,7 @@ public function Processar()
}

$this->setFlashMessage();

if (empty($script) && $this->sucesso && !empty($this->url_sucesso)) {
redirecionar($this->url_sucesso);
} else {
$this->Formular();
}
$this->Formular();
}
}

Expand Down
2 changes: 2 additions & 0 deletions ieducar/intranet/include/clsCalendario.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,8 @@ public function getCalendario(
}
}

$mensagens = '';

while ($diaCorrente <= $NumeroDiasMes) {
// Seventh column (Saturday) reached. Start a new row.
if ($DiaSemana == 7) {
Expand Down
4 changes: 0 additions & 4 deletions ieducar/intranet/include/clsCampos.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -1637,10 +1637,6 @@ classe = (classe == \'formmdtd\')? \'formlttd tr_\' + This.nome : \'formmdtd tr_

break;

case 'email':
$retorno .= '<a href=\'www.google.com.br\' class=\'linkBory\'>Enviar Por Email</a>';
break;

case 'emailDuplo':
$retorno .= "<input class='{$class}' type='text' name=\"{$nome}\" id=\"{$nome}\" value=\"{$componente[3]}\" size=\"{$componente[4]}\" maxlength=\"{$componente[5]}\" onKeyUp=\"{$componente[8]}\">";
$foiDuplo = true;
Expand Down
2 changes: 1 addition & 1 deletion ieducar/intranet/include/clsListagem.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function SalvaFiltros()

$path = $uri . '?' . $path;

return $this->simpleRedirect($path);
$this->simpleRedirect($path);
}
} else {
$params = http_build_query($_GET) . '|' . now();
Expand Down
17 changes: 3 additions & 14 deletions ieducar/intranet/include/clsPDF.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ public function CloseFile()
PDF_close($this->pdf);
PDF_delete($this->pdf);

$len = null; // Fix SonarCloud

if ($this->depurar) {
echo "<b>PDF:</b> Finalizando o arquivo com tamanho de -> {$len}<br>";
}
Expand Down Expand Up @@ -552,24 +554,11 @@ public function Curve(
$px1,
$py1,
$px2,
$py2,
$linha = 2.001,
$color1 = '#000000',
$color2 = '#000000'
$py2
) {
if ($teck2) {
$this->SetLine($linha);
$this->SetBoth($color1);
$this->SetFill($color2);
}

PDF_moveto($this->pdf, $xo, $yo);
PDF_curveto($this->pdf, $px1, $py1, $px2, $py2, $x, $y);

if ($teck) {
PDF_stroke($this->pdf);
}

if ($this->depurar) {
echo '<b>PDF:</b> Adicionado uma curva.<br>';
}
Expand Down
3 changes: 0 additions & 3 deletions ieducar/intranet/include/file_check.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,6 @@ public function validateFile()

return false;
}
$this->errorMessage = 'Arquivo inválido.';

return false;
}

public function getErrorMessage()
Expand Down
3 changes: 0 additions & 3 deletions ieducar/intranet/include/file_check_just_pdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,6 @@ public function validateFile()

return false;
}
$this->errorMessage = 'Arquivo inválido.';

return false;
}

public function getErrorMessage()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public function cadastra()
$this->_tabela = "{$this->_schema}auditoria";
$separador = '';
$valores = '';
$campos = '';

if (!is_null($this->stringNotaAntiga) && !is_null($this->stringNotaNova)) {
$this->operacao = self::OPERACAO_ALTERACAO;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,10 +312,9 @@ public function cadastra()
$gruda = ', ';
}

if (is_numeric($this->tipo_nota) && (int) $tipo_nota !== 0) {
if (is_numeric($this->tipo_nota)) {
$campos .= "{$gruda}tipo_nota";
$valores .= "{$gruda}'{$this->tipo_nota}'";
$gruda = ', ';
}

$sql = "INSERT INTO {$this->_tabela} ( $campos ) VALUES( $valores )";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public function edita()
$gruda = ', ';
}
if ($set) {
$detalheAntigo = $this->detalhe();
$this->detalhe();
$db->Consulta("UPDATE {$this->_tabela} SET $set WHERE cod_empresa_transporte_escolar = '{$this->cod_empresa_transporte_escolar}'");

return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ public function edita()
if (is_numeric($this->ref_cod_aluno)) {
$db = new clsBanco();
$set = '';
$gruda = '';

if (is_numeric($this->ref_cod_aluno)) {
$set .= "{$gruda}ref_cod_aluno = '{$this->ref_cod_aluno}'";
Expand Down Expand Up @@ -564,7 +565,7 @@ public function lista()
$countCampos = count(explode(',', $this->_campos_lista)) + 2;
$resultado = [];

$sql .= $filtros . $whereNomes . $this->getOrderby() . $this->getLimite();
$sql .= $filtros . $this->getOrderby() . $this->getLimite();

$this->_total = $db->CampoUnico("SELECT COUNT(0) FROM {$this->_tabela} {$filtros}");

Expand Down
Loading