Commit 7e0959d56ba6d8ecc6de817573890838b3313464

Authored by Eder Soares
Committed by GitHub
2 parents 55ecae2d 9cd1e1c5
Exists in 2.9 and in 1 other branch 2.8

Merge pull request #9644 from portabilis/revert-9621-ano-letivo

Revert "Permite fazer rematrícula automática para alunos em situação cursando"
ieducar/intranet/educar_avancar_mod_cad.php
@@ -35,20 +35,14 @@ return new class extends clsCadastro @@ -35,20 +35,14 @@ return new class extends clsCadastro
35 $this->inputsHelper()->date(attrName: 'data_matricula', inputOptions: ['label' => 'Data da matricula', 'placeholder' => 'dd/mm/yyyy']); 35 $this->inputsHelper()->date(attrName: 'data_matricula', inputOptions: ['label' => 'Data da matricula', 'placeholder' => 'dd/mm/yyyy']);
36 36
37 Portabilis_View_Helper_Application::loadJavascript(viewInstance: $this, files: [ 37 Portabilis_View_Helper_Application::loadJavascript(viewInstance: $this, files: [
  38 + '/vendor/legacy/Cadastro/Assets/Javascripts/RematriculaAutomatica.js',
38 '/vendor/legacy/Cadastro/Assets/Javascripts/RematriculaAutomaticaModal.js', 39 '/vendor/legacy/Cadastro/Assets/Javascripts/RematriculaAutomaticaModal.js',
39 ]); 40 ]);
40 } 41 }
41 42
42 public function Novo() 43 public function Novo()
43 { 44 {
44 - $anoLetivo = request('ano_letivo');  
45 -  
46 - $anoLetivos = LegacySchoolAcademicYear::query()  
47 - ->whereSchool($this->ref_cod_escola)  
48 - ->whereYearEq($anoLetivo)  
49 - ->inProgress()  
50 - ->active()  
51 - ->get(['id']); 45 + $anoLetivos = LegacySchoolAcademicYear::query()->whereSchool($this->ref_cod_escola)->inProgress()->active()->get(['id']);
52 46
53 $this->data_matricula = Portabilis_Date_Utils::brToPgSQL(date: $this->data_matricula); 47 $this->data_matricula = Portabilis_Date_Utils::brToPgSQL(date: $this->data_matricula);
54 48
@@ -91,7 +85,7 @@ return new class extends clsCadastro @@ -91,7 +85,7 @@ return new class extends clsCadastro
91 cursoId: $this->ref_cod_curso, 85 cursoId: $this->ref_cod_curso,
92 serieId: $this->ref_cod_serie, 86 serieId: $this->ref_cod_serie,
93 turmaId: $this->ref_cod_turma, 87 turmaId: $this->ref_cod_turma,
94 - ano: request('ano') 88 + ano: $_POST['ano']
95 ); 89 );
96 } 90 }
97 91
@@ -121,7 +115,7 @@ return new class extends clsCadastro @@ -121,7 +115,7 @@ return new class extends clsCadastro
121 " 115 "
122 ); 116 );
123 117
124 - if ($result && $situacao == 1 || $situacao == 12 || $situacao == 13 || $situacao == 3) { 118 + if ($result && $situacao == 1 || $situacao == 12 || $situacao == 13) {
125 $result = $this->rematricularAlunoAprovado(escolaId: $escolaId, serieId: $serieId, ano: $this->ano_letivo, alunoId: $alunoId); 119 $result = $this->rematricularAlunoAprovado(escolaId: $escolaId, serieId: $serieId, ano: $this->ano_letivo, alunoId: $alunoId);
126 } elseif ($result && $situacao == 2 || $situacao == 14) { 120 } elseif ($result && $situacao == 2 || $situacao == 14) {
127 $result = $this->rematricularAlunoReprovado(escolaId: $escolaId, cursoId: $cursoId, serieId: $serieId, ano: $this->ano_letivo, alunoId: $alunoId); 121 $result = $this->rematricularAlunoReprovado(escolaId: $escolaId, cursoId: $cursoId, serieId: $serieId, ano: $this->ano_letivo, alunoId: $alunoId);
@@ -226,7 +220,7 @@ return new class extends clsCadastro @@ -226,7 +220,7 @@ return new class extends clsCadastro
226 AND aluno.cod_aluno = ref_cod_aluno 220 AND aluno.cod_aluno = ref_cod_aluno
227 ) as nome 221 ) as nome
228 FROM pmieducar.matricula m, pmieducar.matricula_turma 222 FROM pmieducar.matricula m, pmieducar.matricula_turma
229 - WHERE aprovado in (1, 2, 3, 12, 13, 14) 223 + WHERE aprovado in (1, 2, 12, 13, 14)
230 AND m.ativo = 1 224 AND m.ativo = 1
231 AND ref_ref_cod_escola = $escolaId 225 AND ref_ref_cod_escola = $escolaId
232 AND ref_ref_cod_serie = $serieId 226 AND ref_ref_cod_serie = $serieId
public/vendor/legacy/Cadastro/Assets/Javascripts/RematriculaAutomatica.js 0 → 100644
@@ -0,0 +1,32 @@ @@ -0,0 +1,32 @@
  1 +
  2 +$j(document).ready(function(){
  3 +
  4 + $j('#ano').closest('tr').hide();
  5 +
  6 + var $escolaField = getElementFor('escola');
  7 +
  8 + var handleGetEscolaAnoLetivo = function(response) {
  9 + $j('#ano').val(response[0]-1);
  10 + }
  11 +
  12 + var updateEscolaAnoLetivo = function(){
  13 +
  14 + var urlForGetEscolaAnoLetivo = getResourceUrlBuilder.buildUrl('/module/Api/escola', 'escola-ano-letivo', {
  15 + escola_id : $escolaField.val()
  16 + });
  17 +
  18 + var options = {
  19 + url : urlForGetEscolaAnoLetivo,
  20 + dataType : 'json',
  21 + success : handleGetEscolaAnoLetivo
  22 + };
  23 +
  24 + getResources(options);
  25 + };
  26 +
  27 + $escolaField.change(updateEscolaAnoLetivo);
  28 +
  29 + //Atualiza o ano letivo para usuários cuja escola já venha selecionada
  30 + updateEscolaAnoLetivo();
  31 +
  32 +}); // ready
0 \ No newline at end of file 33 \ No newline at end of file