Commit 6b88aed5e280c068967f0809257593c61a8954c9
1 parent
fcd8ca9d
Exists in
master
Alterado processo de rematrícula automática:
Alterado para que sejam listados alunos rematrículados; Alterado campo de turma para facilitar identificação do ano da turma; portabilis/ieducar#126
Showing
2 changed files
with
26 additions
and
10 deletions
Show diff stats
ieducar/intranet/educar_avancar_mod_cad.php
@@ -66,7 +66,8 @@ class indice extends clsCadastro | @@ -66,7 +66,8 @@ class indice extends clsCadastro | ||
66 | 66 | ||
67 | $anoLetivoHelperOptions = array('situacoes' => array('em_andamento', 'nao_iniciado')); | 67 | $anoLetivoHelperOptions = array('situacoes' => array('em_andamento', 'nao_iniciado')); |
68 | 68 | ||
69 | - $this->inputsHelper()->dynamic(array('instituicao', 'escola', 'curso', 'serie', 'turma')); | 69 | + $this->inputsHelper()->dynamic(array('instituicao', 'escola', 'curso', 'serie')); |
70 | + $this->inputsHelper()->dynamic('turma', array('label' => 'Selecione a turma do ano anterior')); | ||
70 | $this->inputsHelper()->dynamic('anoLetivo', array('label' => 'Ano destino'), $anoLetivoHelperOptions); | 71 | $this->inputsHelper()->dynamic('anoLetivo', array('label' => 'Ano destino'), $anoLetivoHelperOptions); |
71 | $this->inputsHelper()->date('data_matricula', array('label' => 'Data da matrícula', 'placeholder' => 'dd/mm/yyyy')); | 72 | $this->inputsHelper()->date('data_matricula', array('label' => 'Data da matrícula', 'placeholder' => 'dd/mm/yyyy')); |
72 | } | 73 | } |
@@ -100,9 +101,11 @@ class indice extends clsCadastro | @@ -100,9 +101,11 @@ class indice extends clsCadastro | ||
100 | protected function rematricularALunos($escolaId, $cursoId, $serieId, $turmaId, $ano) { | 101 | protected function rematricularALunos($escolaId, $cursoId, $serieId, $turmaId, $ano) { |
101 | $result = $this->selectMatriculas($escolaId, $cursoId, $serieId, $turmaId, $ano); | 102 | $result = $this->selectMatriculas($escolaId, $cursoId, $serieId, $turmaId, $ano); |
102 | $count = 0; | 103 | $count = 0; |
104 | + $nomesAlunos; | ||
103 | 105 | ||
104 | while ($result && $this->db->ProximoRegistro()) { | 106 | while ($result && $this->db->ProximoRegistro()) { |
105 | - list($matriculaId, $alunoId, $situacao) = $this->db->Tupla(); | 107 | + list($matriculaId, $alunoId, $situacao, $nomeAluno) = $this->db->Tupla(); |
108 | + $nomesAlunos[] = $nomeAluno; | ||
106 | 109 | ||
107 | $this->db2->Consulta("UPDATE pmieducar.matricula SET ultima_matricula = '0' WHERE cod_matricula = $matriculaId"); | 110 | $this->db2->Consulta("UPDATE pmieducar.matricula SET ultima_matricula = '0' WHERE cod_matricula = $matriculaId"); |
108 | 111 | ||
@@ -117,10 +120,18 @@ class indice extends clsCadastro | @@ -117,10 +120,18 @@ class indice extends clsCadastro | ||
117 | $count += 1; | 120 | $count += 1; |
118 | } | 121 | } |
119 | 122 | ||
120 | - if ($result && empty($this->mensagem)) | ||
121 | - $this->mensagem = $count > 0 ? "<span class='success'>Rematriculado $count alunos com sucesso em $ano!</span>" : "<span class='notice'>Nenhum aluno rematriculado. Certifique-se que a turma possui alunos aprovados ou reprovados não matriculados em $ano.</span>"; | ||
122 | - | ||
123 | - elseif(empty($this->mensagem)) | 123 | + if ($result && empty($this->mensagem)){ |
124 | + if ($count > 0){ | ||
125 | + $mensagem = "<span class='success'>Rematriculado os seguinte(s) $count aluno(s) com sucesso em $ano: </br></br>"; | ||
126 | + foreach ($nomesAlunos as $nome) { | ||
127 | + $mensagem .= "{$nome} </br>"; | ||
128 | + } | ||
129 | + $mensagem .= "</br> As enturmações podem ser realizadas em: Movimentação > Enturmação.</span>"; | ||
130 | + $this->mensagem = $mensagem; | ||
131 | + }else{ | ||
132 | + $this->mensagem = "<span class='notice'>Nenhum aluno rematriculado. Certifique-se que a turma possui alunos aprovados ou reprovados não matriculados em $ano.</span>"; | ||
133 | + } | ||
134 | + }elseif(empty($this->mensagem)) | ||
124 | $this->mensagem = "Ocorreu algum erro inesperado durante as rematrículas, por favor, tente novamente."; | 135 | $this->mensagem = "Ocorreu algum erro inesperado durante as rematrículas, por favor, tente novamente."; |
125 | 136 | ||
126 | return $result; | 137 | return $result; |
@@ -131,12 +142,17 @@ class indice extends clsCadastro | @@ -131,12 +142,17 @@ class indice extends clsCadastro | ||
131 | try { | 142 | try { |
132 | $anoAnterior = $ano - 1; | 143 | $anoAnterior = $ano - 1; |
133 | 144 | ||
134 | - $this->db->Consulta("SELECT cod_matricula, ref_cod_aluno, aprovado | 145 | + $this->db->Consulta("SELECT cod_matricula, ref_cod_aluno, aprovado, |
146 | + (SELECT upper(nome) | ||
147 | + FROM cadastro.pessoa, pmieducar.aluno | ||
148 | + WHERE pessoa.idpes = aluno.ref_idpes AND | ||
149 | + aluno.cod_aluno = ref_cod_aluno) as nome | ||
135 | FROM | 150 | FROM |
136 | pmieducar.matricula m, pmieducar.matricula_turma | 151 | pmieducar.matricula m, pmieducar.matricula_turma |
137 | WHERE aprovado in (1, 2) AND m.ativo = 1 AND ref_ref_cod_escola = $escolaId AND | 152 | WHERE aprovado in (1, 2) AND m.ativo = 1 AND ref_ref_cod_escola = $escolaId AND |
138 | ref_ref_cod_serie = $serieId AND ref_cod_curso = $cursoId AND | 153 | ref_ref_cod_serie = $serieId AND ref_cod_curso = $cursoId AND |
139 | cod_matricula = ref_cod_matricula AND ref_cod_turma = $turmaId AND | 154 | cod_matricula = ref_cod_matricula AND ref_cod_turma = $turmaId AND |
155 | + matricula_turma.ativo = 1 AND | ||
140 | ano = $anoAnterior AND | 156 | ano = $anoAnterior AND |
141 | NOT EXISTS(select 1 from pmieducar.matricula m2 where | 157 | NOT EXISTS(select 1 from pmieducar.matricula m2 where |
142 | m2.ref_cod_aluno = m.ref_cod_aluno AND | 158 | m2.ref_cod_aluno = m.ref_cod_aluno AND |
@@ -179,8 +195,8 @@ class indice extends clsCadastro | @@ -179,8 +195,8 @@ class indice extends clsCadastro | ||
179 | protected function matricularAluno($escolaId, $cursoId, $serieId, $ano, $alunoId) { | 195 | protected function matricularAluno($escolaId, $cursoId, $serieId, $ano, $alunoId) { |
180 | try { | 196 | try { |
181 | $this->db2->Consulta(sprintf("INSERT INTO pmieducar.matricula | 197 | $this->db2->Consulta(sprintf("INSERT INTO pmieducar.matricula |
182 | - (ref_ref_cod_escola, ref_ref_cod_serie, ref_usuario_cad, ref_cod_aluno, aprovado, data_cadastro, ano, ref_cod_curso, ultima_matricula) VALUES ('%d', '%d', '%d', '%d', '3', 'NOW()', '%d', '%d', '1')", | ||
183 | - $escolaId, $serieId, $this->pessoa_logada, $alunoId, $ano, $cursoId, $this->data_matricula)); | 198 | + (ref_ref_cod_escola, ref_ref_cod_serie, ref_usuario_cad, ref_cod_aluno, aprovado, data_cadastro, ano, ref_cod_curso, ultima_matricula, data_matricula) VALUES ('%d', '%d', '%d', '%d', '3', 'NOW()', '%d', '%d', '1','{$this->data_matricula}')", |
199 | + $escolaId, $serieId, $this->pessoa_logada, $alunoId, $ano, $cursoId)); | ||
184 | } | 200 | } |
185 | catch (Exception $e) { | 201 | catch (Exception $e) { |
186 | $this->mensagem = "Erro durante matrícula do aluno: $alunoId"; | 202 | $this->mensagem = "Erro durante matrícula do aluno: $alunoId"; |
ieducar/modules/DynamicInput/Views/TurmaController.php
@@ -78,7 +78,7 @@ class TurmaController extends ApiCoreController | @@ -78,7 +78,7 @@ class TurmaController extends ApiCoreController | ||
78 | $turmas = Portabilis_Business_Professor::turmasAlocado($escolaId, $serieId, $userId); | 78 | $turmas = Portabilis_Business_Professor::turmasAlocado($escolaId, $serieId, $userId); |
79 | 79 | ||
80 | else { | 80 | else { |
81 | - $sql = "select cod_turma as id, nm_turma as nome from pmieducar.turma where ref_ref_cod_escola = $1 | 81 | + $sql = "select cod_turma as id, nm_turma || ' - ' || COALESCE(ano::varchar,'SEM ANO') as nome from pmieducar.turma where ref_ref_cod_escola = $1 |
82 | and (ref_ref_cod_serie = $2 or ref_ref_cod_serie_mult = $2) and ativo = 1 and | 82 | and (ref_ref_cod_serie = $2 or ref_ref_cod_serie_mult = $2) and ativo = 1 and |
83 | visivel != 'f' order by nm_turma asc"; | 83 | visivel != 'f' order by nm_turma asc"; |
84 | 84 |