Skip to content

Commit

Permalink
Merge pull request #460 from portabilis/portabilis-patch-2018-11-09
Browse files Browse the repository at this point in the history
Portabilis patch 09/11/2018
  • Loading branch information
edersoares authored Nov 12, 2018
2 parents 29b5e97 + 0ad927c commit 5923ddc
Show file tree
Hide file tree
Showing 41 changed files with 1,452 additions and 1,023 deletions.
50 changes: 30 additions & 20 deletions ieducar/intranet/educar_consulta_movimento_mensal_lst.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,35 +163,43 @@ public function Gerar()
table.push('<table class="tablelistagem" style="width: 100%; margin-bottom: 100px;" cellspacing="1" cellpadding="4" border="0">');
table.push('<tr>');
table.push('<td class="titulo-tabela-listagem" colspan="23">Resultados</td>');
table.push('<td class="titulo-tabela-listagem" colspan="25">Resultados</td>');
table.push('</tr>');
table.push('<tr>');
table.push('<td class="formdktd" style="font-weight: bold; text-align: center;" rowspan="3">Série</td>');
table.push('<td class="formdktd" style="font-weight: bold; text-align: center;" rowspan="3">Turma</td>');
table.push('<td class="formdktd" style="font-weight: bold; text-align: center;" rowspan="3">Turno</td>');
table.push('<td class="formdktd" style="font-weight: bold; text-align: center;" rowspan="4">Série</td>');
table.push('<td class="formdktd" style="font-weight: bold; text-align: center;" rowspan="4">Turma</td>');
table.push('<td class="formdktd" style="font-weight: bold; text-align: center;" rowspan="4">Turno</td>');
table.push('<td class="formdktd" style="font-weight: bold; text-align: center;" colspan="3">Matrícula inicial</td>');
table.push('<td class="formdktd" style="font-weight: bold; text-align: center;" colspan="14">Alunos</td>');
table.push('<td class="formdktd" style="font-weight: bold; text-align: center;" colspan="16">Alunos</td>');
table.push('<td class="formdktd" style="font-weight: bold; text-align: center;" colspan="3">Matrícula final</td>');
table.push('</tr>');
table.push('<tr>');
table.push('<td class="formdktd" style="font-weight: bold; text-align: center;" rowspan="2">M</td>');
table.push('<td class="formdktd" style="font-weight: bold; text-align: center;" rowspan="2">F</td>');
table.push('<td class="formdktd" style="font-weight: bold; text-align: center;" rowspan="2">T</td>');
table.push('<td class="formdktd" style="font-weight: bold; text-align: center;" colspan="2">Transf.</td>');
table.push('<td class="formdktd" style="font-weight: bold; text-align: center;" colspan="2">Aband.</td>');
table.push('<td class="formdktd" style="font-weight: bold; text-align: center;" colspan="2">Admitido</td>');
table.push('<td class="formdktd" style="font-weight: bold; text-align: center;" colspan="2">Óbito</td>');
table.push('<td class="formdktd" style="font-weight: bold; text-align: center;" colspan="2">Reclassif.</td>');
table.push('<td class="formdktd" style="font-weight: bold; text-align: center;" colspan="2">Troca (entrou)</td>');
table.push('<td class="formdktd" style="font-weight: bold; text-align: center;" colspan="2">Troca (saiu)</td>');
table.push('<td class="formdktd" style="font-weight: bold; text-align: center;" rowspan="2">M</td>');
table.push('<td class="formdktd" style="font-weight: bold; text-align: center;" rowspan="2">F</td>');
table.push('<td class="formdktd" style="font-weight: bold; text-align: center;" rowspan="2">T</td>');
table.push('<td class="formdktd" style="font-weight: bold; text-align: center;" rowspan="3">M</td>');
table.push('<td class="formdktd" style="font-weight: bold; text-align: center;" rowspan="3">F</td>');
table.push('<td class="formdktd" style="font-weight: bold; text-align: center;" rowspan="3">T</td>');
table.push('<td class="formdktd" style="font-weight: bold; text-align: center;" colspan="2" rowspan="2">Transf.</td>');
table.push('<td class="formdktd" style="font-weight: bold; text-align: center;" colspan="2" rowspan="2">Aband.</td>');
table.push('<td class="formdktd" style="font-weight: bold; text-align: center;" colspan="2" rowspan="2">Admitido</td>');
table.push('<td class="formdktd" style="font-weight: bold; text-align: center;" colspan="2" rowspan="2">Óbito</td>');
table.push('<td class="formdktd" style="font-weight: bold; text-align: center;" colspan="4">Reclassificado</td>');
table.push('<td class="formdktd" style="font-weight: bold; text-align: center;" colspan="4">Remanejado</td>');
table.push('<td class="formdktd" style="font-weight: bold; text-align: center;" rowspan="3">M</td>');
table.push('<td class="formdktd" style="font-weight: bold; text-align: center;" rowspan="3">F</td>');
table.push('<td class="formdktd" style="font-weight: bold; text-align: center;" rowspan="3">T</td>');
table.push('</tr>');
table.push('<tr>');
table.push('<td class="formdktd" style="font-weight: bold; text-align: center;" colspan="2">saiu</td>');
table.push('<td class="formdktd" style="font-weight: bold; text-align: center;" colspan="2">entrou</td>');
table.push('<td class="formdktd" style="font-weight: bold; text-align: center;" colspan="2">saiu</td>');
table.push('<td class="formdktd" style="font-weight: bold; text-align: center;" colspan="2">entrou</td>');
table.push('</tr>');
table.push('<tr>');
table.push('<td class="formdktd" style="font-weight: bold; text-align: center;">M</td>');
table.push('<td class="formdktd" style="font-weight: bold; text-align: center;">F</td>');
table.push('<td class="formdktd" style="font-weight: bold; text-align: center;">M</td>');
table.push('<td class="formdktd" style="font-weight: bold; text-align: center;">F</td>');
table.push('<td class="formdktd" style="font-weight: bold; text-align: center;">M</td>');
Expand Down Expand Up @@ -229,10 +237,12 @@ public function Gerar()
table.push('<td class="' + cellClass + '" valign="top" align="left">' + item.mat_falecido_f + '</td>');
table.push('<td class="' + cellClass + '" valign="top" align="left">' + item.mat_reclassificados_m + '</td>');
table.push('<td class="' + cellClass + '" valign="top" align="left">' + item.mat_reclassificados_f + '</td>');
table.push('<td class="' + cellClass + '" valign="top" align="left">' + item.mat_trocae_m + '</td>');
table.push('<td class="' + cellClass + '" valign="top" align="left">' + item.mat_trocae_f + '</td>');
table.push('<td class="' + cellClass + '" valign="top" align="left">' + item.mat_reclassificadose_m + '</td>');
table.push('<td class="' + cellClass + '" valign="top" align="left">' + item.mat_reclassificadose_f + '</td>');
table.push('<td class="' + cellClass + '" valign="top" align="left">' + item.mat_trocas_m + '</td>');
table.push('<td class="' + cellClass + '" valign="top" align="left">' + item.mat_trocas_f + '</td>');
table.push('<td class="' + cellClass + '" valign="top" align="left">' + item.mat_trocae_m + '</td>');
table.push('<td class="' + cellClass + '" valign="top" align="left">' + item.mat_trocae_f + '</td>');
table.push('<td class="' + cellClass + '" valign="top" align="left">' + item.mat_final_m + '</td>');
table.push('<td class="' + cellClass + '" valign="top" align="left">' + item.mat_final_f + '</td>');
table.push('<td class="' + cellClass + '" valign="top" align="left">' + item.mat_final_t + '</td>');
Expand Down
58 changes: 48 additions & 10 deletions ieducar/intranet/educar_matricula_turma_cad.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,22 +108,24 @@ function Inicializar()
$localizacao = new LocalizacaoSistema();
$localizacao->entradaCaminhos( array(
$_SERVER['SERVER_NAME']."/intranet" => "In&iacute;cio",
"educar_index.php" => "Escola",
"" => "Enturma&ccedil;&atilde;o da matr&iacute;cula"
"educar_index.php" => "Escola",
"" => "Enturma&ccedil;&atilde;o da matr&iacute;cula"
));
$this->enviaLocalizacao($localizacao->montar());

//nova lógica
if (is_numeric($this->ref_cod_matricula)) {

if ($this->ref_cod_turma_origem == 'remover-enturmacao-destino')
if ($this->ref_cod_turma_origem == 'remover-enturmacao-destino') {
$this->removerEnturmacao($this->ref_cod_matricula, $this->ref_cod_turma_destino);
elseif (! is_numeric($this->ref_cod_turma_origem))
} elseif (! is_numeric($this->ref_cod_turma_origem)) {
$this->novaEnturmacao($this->ref_cod_matricula, $this->ref_cod_turma_destino);
else {
$this->transferirEnturmacao($this->ref_cod_matricula,
$this->ref_cod_turma_origem,
$this->ref_cod_turma_destino);
} else {
$this->transferirEnturmacao(
$this->ref_cod_matricula,
$this->ref_cod_turma_origem,
$this->ref_cod_turma_destino
);
}

header('Location: educar_matricula_det.php?cod_matricula=' . $this->ref_cod_matricula);
Expand All @@ -136,6 +138,9 @@ function Inicializar()
}

function novaEnturmacao($matriculaId, $turmaDestinoId) {
if (!$this->validaDataEnturmacao($matriculaId, $turmaDestinoId)) {
return false;
}

$enturmacaoExists = new clsPmieducarMatriculaTurma();
$enturmacaoExists = $enturmacaoExists->lista($matriculaId,
Expand All @@ -149,24 +154,57 @@ function novaEnturmacao($matriculaId, $turmaDestinoId) {
1);

$enturmacaoExists = is_array($enturmacaoExists) && count($enturmacaoExists) > 0;
if (! $enturmacaoExists) {

if (!$enturmacaoExists) {
$enturmacao = new clsPmieducarMatriculaTurma($matriculaId,
$turmaDestinoId,
$this->pessoa_logada,
$this->pessoa_logada,
NULL,
NULL,
1);

$enturmacao->data_enturmacao = $this->data_enturmacao;

return $enturmacao->cadastra();
}
return false;
}

public function validaDataEnturmacao($matriculaId, $turmaDestinoId)
{
$dataObj = new \DateTime($this->data_enturmacao . ' 23:59:59');
$matriculaObj = new clsPmieducarMatricula();
$enturmacaoObj = new clsPmieducarMatriculaTurma();
$dataAnoLetivoInicio = $matriculaObj->pegaDataAnoLetivoInicio($turmaDestinoId);
$dataAnoLetivoFim = $matriculaObj->pegaDataAnoLetivoFim($turmaDestinoId);
$exclusaoEnturmacao = $enturmacaoObj->getDataExclusaoUltimaEnturmacao($matriculaId);
$dataSaidaDaTurma = !empty($exclusaoEnturmacao)
? new \DateTime($exclusaoEnturmacao)
: null;

if ($dataObj > $dataAnoLetivoFim) {
return false;
}

if ($dataSaidaDaTurma !== null && $dataObj < $dataSaidaDaTurma) {
return false;
} elseif ($dataObj < $dataAnoLetivoInicio) {
return false;
}

return true;
}

function transferirEnturmacao($matriculaId, $turmaOrigemId, $turmaDestinoId) {
if($this->removerEnturmacao($matriculaId, $turmaOrigemId, TRUE))
if (!$this->validaDataEnturmacao($matriculaId, $turmaDestinoId)) {
return false;
}

if($this->removerEnturmacao($matriculaId, $turmaOrigemId, TRUE)) {
return $this->novaEnturmacao($matriculaId, $turmaDestinoId);
}

return false;
}

Expand Down
4 changes: 2 additions & 2 deletions ieducar/intranet/educar_matricula_turma_det.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,10 @@ function Gerar()
}

$this->addDetalhe(array('<b>Enturmação atual</b>', $selectEnturmacoes));
}
}

if(!$this->possuiEnturmacaoTurmaDestino)
$this->addDetalhe(array('Data da enturmação', '<input onkeypress="formataData(this,event);" value="'.date('d/m/Y').'" class="geral" type="text" name="data_enturmacao" id="data_enturmacao" size="9" maxlength="10"/>'));
$this->addDetalhe(array('Data da enturmação', '<input onkeypress="formataData(this,event);" value="" class="geral" type="text" name="data_enturmacao" id="data_enturmacao" size="9" maxlength="10"/>'));

$this->addDetalhe(array(
'-',
Expand Down
4 changes: 3 additions & 1 deletion ieducar/intranet/educar_servidor_alocacao_cad.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
require_once 'include/clsCadastro.inc.php';
require_once 'include/clsBanco.inc.php';
require_once 'include/pmieducar/geral.inc.php';
require_once 'include/pmieducar/clsPmieducarFuncionarioVinculo.inc.php';
require_once 'lib/Portabilis/String/Utils.php';
require_once 'lib/Portabilis/Date/Utils.php';

Expand Down Expand Up @@ -193,7 +194,8 @@ public function Gerar()
$this->campoLista('cod_servidor_funcao', 'Função', $opcoes, $this->cod_servidor_funcao, '', false, '', '', false, false);

// Vínculos
$opcoes = ['' => 'Selecione', 5 => 'Comissionado', 4 => 'Contratado', 3 => 'Efetivo', 6 => 'Estagi&aacute;rio'];
$objFuncionarioVinculo = new clsPmieducarFuncionarioVinculo;
$opcoes = ['' => 'Selecione'] + $objFuncionarioVinculo->lista();

$this->campoLista('ref_cod_funcionario_vinculo', 'V&iacute;nculo', $opcoes, $this->ref_cod_funcionario_vinculo, null, false, '', '', false, false);

Expand Down
52 changes: 36 additions & 16 deletions ieducar/intranet/educar_servidor_cad.php
Original file line number Diff line number Diff line change
Expand Up @@ -975,25 +975,33 @@ function cadastraFuncoes()
@session_write_close();

$existe_funcao_professor = FALSE;
$listFuncoesCadastradas = array();
if ($this->ref_cod_funcao) {
$cont = -1;
$this->excluiFuncoes();
foreach ($this->ref_cod_funcao as $funcao) {
$cont++;
$funcao_professor = explode('-', $funcao);
$funcao = array_shift($funcao_professor);
$professor = array_shift($funcao_professor);

if ($professor) {
$existe_funcao_professor = true;
$cont = -1;

foreach ($this->ref_cod_funcao as $funcao) {
$cont++;
$funcao_professor = explode('-', $funcao);
$funcao = array_shift($funcao_professor);
$professor = array_shift($funcao_professor);

if ($professor) {
$existe_funcao_professor = true;
}

$obj_servidor_funcao = new clsPmieducarServidorFuncao($this->ref_cod_instituicao, $this->cod_servidor, $funcao);
if ($obj_servidor_funcao->existe()) {
$this->atualizaFuncao($funcao,$this->matricula[$cont]);
} else {
$this->cadastraFuncao($funcao,$this->matricula[$cont]);
}
array_push($listFuncoesCadastradas,$funcao);
}

$obj_servidor_funcao = new clsPmieducarServidorFuncao($this->ref_cod_instituicao, $this->cod_servidor, $funcao, $this->matricula[$cont]);
$obj_servidor_funcao->cadastra();
}
}
$this->excluiFuncoesRemovidas($listFuncoesCadastradas);

if ($existe_funcao_professor) {
if ($existe_funcao_professor) {
if ($cursos_disciplina) {
$this->excluiDisciplinas();
foreach ($cursos_disciplina as $curso => $disciplinas) {
Expand Down Expand Up @@ -1024,10 +1032,22 @@ function cadastraFuncoes()
}
}

function excluiFuncoes()
function excluiFuncoesRemovidas($funcoes)
{
$obj_servidor_funcao = new clsPmieducarServidorFuncao($this->ref_cod_instituicao, $this->cod_servidor);
$obj_servidor_funcao->excluirTodos();
$obj_servidor_funcao->excluirFuncoesRemovidas($funcoes);
}

function atualizaFuncao($funcao,$matricula)
{
$obj_servidor_funcao = new clsPmieducarServidorFuncao($this->ref_cod_instituicao, $this->cod_servidor, $funcao, $matricula);
$obj_servidor_funcao->edita();
}

function cadastraFuncao($funcao,$matricula)
{
$obj_servidor_funcao = new clsPmieducarServidorFuncao($this->ref_cod_instituicao, $this->cod_servidor, $funcao, $matricula);
$obj_servidor_funcao->cadastra();
}

function excluiDisciplinas()
Expand Down
Loading

0 comments on commit 5923ddc

Please sign in to comment.