Commit 8e18cc1d0bfb852d99458e2e25b145df4cd146bd
Exists in
master
Merge branch 'master' into 'master'
Alterado processo de matricula/transferência e enturmação/remanejamento Referente a issue #14 See merge request !13
Showing
11 changed files
with
151 additions
and
11 deletions
Show diff stats
ieducar/configuration/ieducar.ini
... | ... | @@ -156,6 +156,9 @@ app.obriga_endereco_normalizado_pf = true |
156 | 156 | ; Define que poderá ser feito matrícula para cursos diferentes (0 false, 1 true) |
157 | 157 | app.matricula.multiplas_matriculas = 0 |
158 | 158 | |
159 | +; Define se será utilizado datas bases de deslocamento (0 false, 1 true) | |
160 | +app.instituicao.data_base_deslocamento = 1 | |
161 | + | |
159 | 162 | [development : production] |
160 | 163 | ; Herda configurações de banco de dados |
161 | 164 | ... | ... |
ieducar/intranet/educar_instituicao_cad.php
... | ... | @@ -29,6 +29,8 @@ require_once ("include/clsCadastro.inc.php"); |
29 | 29 | require_once ("include/clsBanco.inc.php"); |
30 | 30 | require_once( "include/pmieducar/geral.inc.php" ); |
31 | 31 | require_once ("include/Geral.inc.php"); |
32 | +require_once 'includes/bootstrap.php'; | |
33 | +require_once 'Portabilis/Date/Utils.php'; | |
32 | 34 | |
33 | 35 | class clsIndexBase extends clsBase |
34 | 36 | { |
... | ... | @@ -67,6 +69,8 @@ class indice extends clsCadastro |
67 | 69 | var $data_exclusao; |
68 | 70 | var $ativo; |
69 | 71 | var $nm_instituicao; |
72 | + var $data_base_transferencia; | |
73 | + var $data_base_remanejamento; | |
70 | 74 | |
71 | 75 | function Inicializar() |
72 | 76 | { |
... | ... | @@ -172,6 +176,11 @@ class indice extends clsCadastro |
172 | 176 | $this->campoTexto( "nm_responsavel", "Nome do Responsável", $this->nm_responsavel, 30, 255, true ); |
173 | 177 | $this->campoNumero( "ddd_telefone", "DDD Telefone", $this->ddd_telefone, 2, 2 ); |
174 | 178 | $this->campoNumero( "telefone", "Telefone", $this->telefone, 11, 11 ); |
179 | + | |
180 | + if ($GLOBALS['coreExt']['Config']->app->instituicao->data_base_deslocamento) { | |
181 | + $this->campoData('data_base_transferencia', 'Data máxima para deslocamento', Portabilis_Date_Utils::pgSQLToBr($this->data_base_transferencia), null, null, false); | |
182 | + $this->campoData('data_base_remanejamento', 'Data máxima para troca de sala', Portabilis_Date_Utils::pgSQLToBr($this->data_base_remanejamento), null, null, false); | |
183 | + } | |
175 | 184 | } |
176 | 185 | |
177 | 186 | function Novo() |
... | ... | @@ -181,6 +190,10 @@ class indice extends clsCadastro |
181 | 190 | @session_write_close(); |
182 | 191 | |
183 | 192 | $obj = new clsPmieducarInstituicao( null, $this->ref_usuario_exc, $this->pessoa_logada, $this->ref_idtlog, $this->ref_sigla_uf, str_replace( "-", "", $this->cep ), $this->cidade, $this->bairro, $this->logradouro, $this->numero, $this->complemento, $this->nm_responsavel, $this->ddd_telefone, $this->telefone, $this->data_cadastro, $this->data_exclusao, 1, $this->nm_instituicao ); |
193 | + | |
194 | + $obj->data_base_remanejamento = Portabilis_Date_Utils::brToPgSQL($this->data_base_remanejamento); | |
195 | + $obj->data_base_transferencia = Portabilis_Date_Utils::brToPgSQL($this->data_base_transferencia); | |
196 | + | |
184 | 197 | $cadastrou = $obj->cadastra(); |
185 | 198 | if( $cadastrou ) |
186 | 199 | { |
... | ... | @@ -201,6 +214,10 @@ class indice extends clsCadastro |
201 | 214 | $this->pessoa_logada = $_SESSION['id_pessoa']; |
202 | 215 | @session_write_close(); |
203 | 216 | $obj = new clsPmieducarInstituicao( $this->cod_instituicao, $this->ref_usuario_exc, $this->pessoa_logada, $this->ref_idtlog, $this->ref_sigla_uf, str_replace( "-", "", $this->cep ), $this->cidade, $this->bairro, $this->logradouro, $this->numero, $this->complemento, $this->nm_responsavel, $this->ddd_telefone, $this->telefone, $this->data_cadastro, $this->data_exclusao, 1, $this->nm_instituicao ); |
217 | + | |
218 | + $obj->data_base_remanejamento = Portabilis_Date_Utils::brToPgSQL($this->data_base_remanejamento); | |
219 | + $obj->data_base_transferencia = Portabilis_Date_Utils::brToPgSQL($this->data_base_transferencia); | |
220 | + | |
204 | 221 | $editou = $obj->edita(); |
205 | 222 | if( $editou ) |
206 | 223 | { | ... | ... |
ieducar/intranet/educar_matricula_cad.php
... | ... | @@ -411,8 +411,7 @@ class indice extends clsCadastro |
411 | 411 | |
412 | 412 | // turma |
413 | 413 | $cod_matricula = $cadastrou; |
414 | - $this->enturmacaoMatricula($cod_matricula, $this->ref_cod_turma); | |
415 | - | |
414 | + | |
416 | 415 | if ($cadastrou) { |
417 | 416 | |
418 | 417 | $obj_transferencia = new clsPmieducarTransferenciaSolicitacao(); |
... | ... | @@ -546,6 +545,8 @@ class indice extends clsCadastro |
546 | 545 | } |
547 | 546 | //} |
548 | 547 | |
548 | + $this->enturmacaoMatricula($cod_matricula, $this->ref_cod_turma); | |
549 | + | |
549 | 550 | #TODO set in $_SESSION['flash'] 'Aluno matriculado com sucesso' |
550 | 551 | $this->mensagem .= 'Cadastro efetuado com sucesso.<br />'; |
551 | 552 | header('Location: educar_aluno_det.php?cod_aluno=' . $this->ref_cod_aluno); |
... | ... | @@ -579,6 +580,8 @@ class indice extends clsCadastro |
579 | 580 | $enturmacao['sequencial']); |
580 | 581 | if ($result && ! $enturmacao->edita()) |
581 | 582 | $result = false; |
583 | + else | |
584 | + $enturmacao->marcaAlunoTransferido($this->data_matricula); | |
582 | 585 | } |
583 | 586 | } |
584 | 587 | ... | ... |
ieducar/intranet/educar_matricula_turma_cad.php
... | ... | @@ -183,7 +183,12 @@ class indice extends clsCadastro |
183 | 183 | NULL, |
184 | 184 | $sequencialEnturmacao); |
185 | 185 | |
186 | - return $enturmacao->edita(); | |
186 | + if ($enturmacao->edita()){ | |
187 | + $enturmacao->marcaAlunoRemanejado($this->data_enturmacao); | |
188 | + return true; | |
189 | + }else | |
190 | + return false; | |
191 | + } | |
187 | 192 | } |
188 | 193 | |
189 | 194 | ... | ... |
ieducar/intranet/educar_matriculas_turma_cad.php
... | ... | @@ -355,7 +355,11 @@ class indice extends clsCadastro |
355 | 355 | NULL, |
356 | 356 | $sequencialEnturmacao); |
357 | 357 | |
358 | - return $enturmacao->edita(); | |
358 | + if ($enturmacao->edita()){ | |
359 | + $enturmacao->marcaAlunoRemanejado($this->data_enturmacao); | |
360 | + return true; | |
361 | + }else | |
362 | + return false; | |
359 | 363 | } |
360 | 364 | |
361 | 365 | ... | ... |
ieducar/intranet/educar_transferencia_solicitacao_cad.php
... | ... | @@ -246,6 +246,8 @@ class indice extends clsCadastro |
246 | 246 | { |
247 | 247 | $this->mensagem = "Não foi possível desativar as enturmações da matrícula."; |
248 | 248 | return false; |
249 | + }else{ | |
250 | + + $enturmacao->marcaAlunoTransferido($this->data_cancel); | |
249 | 251 | } |
250 | 252 | } |
251 | 253 | } | ... | ... |
ieducar/intranet/include/pmieducar/clsPmieducarInstituicao.inc.php
... | ... | @@ -60,6 +60,8 @@ class clsPmieducarInstituicao |
60 | 60 | var $data_exclusao; |
61 | 61 | var $ativo; |
62 | 62 | var $nm_instituicao; |
63 | + var $data_base_remanejamento; | |
64 | + var $data_base_transferencia; | |
63 | 65 | |
64 | 66 | /** |
65 | 67 | * Armazena o total de resultados obtidos na última chamada ao método lista(). |
... | ... | @@ -125,7 +127,7 @@ class clsPmieducarInstituicao |
125 | 127 | $this->_schema = "pmieducar."; |
126 | 128 | $this->_tabela = "{$this->_schema}instituicao"; |
127 | 129 | |
128 | - $this->_campos_lista = $this->_todos_campos = "cod_instituicao, ref_usuario_exc, ref_usuario_cad, ref_idtlog, ref_sigla_uf, cep, cidade, bairro, logradouro, numero, complemento, nm_responsavel, ddd_telefone, telefone, data_cadastro, data_exclusao, ativo, nm_instituicao"; | |
130 | + $this->_campos_lista = $this->_todos_campos = "cod_instituicao, ref_usuario_exc, ref_usuario_cad, ref_idtlog, ref_sigla_uf, cep, cidade, bairro, logradouro, numero, complemento, nm_responsavel, ddd_telefone, telefone, data_cadastro, data_exclusao, ativo, nm_instituicao, data_base_transferencia, data_base_remanejamento"; | |
129 | 131 | |
130 | 132 | if (is_numeric($ref_usuario_cad)) { |
131 | 133 | if (class_exists('clsPmieducarUsuario')) { |
... | ... | @@ -362,6 +364,18 @@ class clsPmieducarInstituicao |
362 | 364 | $gruda = ", "; |
363 | 365 | } |
364 | 366 | |
367 | + if (is_string($this->data_base_remanejamento)) { | |
368 | + $campos .= "{$gruda}data_base_remanejamento"; | |
369 | + $valores .= "{$gruda}'{$this->data_base_remanejamento}'"; | |
370 | + $gruda = ", "; | |
371 | + } | |
372 | + | |
373 | + if (is_string($this->data_base_transferencia)) { | |
374 | + $campos .= "{$gruda}data_base_transferencia"; | |
375 | + $valores .= "{$gruda}'{$this->data_base_transferencia}'"; | |
376 | + $gruda = ", "; | |
377 | + } | |
378 | + | |
365 | 379 | $db->Consulta("INSERT INTO {$this->_tabela} ( $campos ) VALUES( $valores )"); |
366 | 380 | return $db->InsertId("{$this->_tabela}_cod_instituicao_seq"); |
367 | 381 | } |
... | ... | @@ -462,6 +476,16 @@ class clsPmieducarInstituicao |
462 | 476 | $gruda = ", "; |
463 | 477 | } |
464 | 478 | |
479 | + if (is_string($this->data_base_transferencia)) { | |
480 | + $set .= "{$gruda}data_base_transferencia = '{$this->data_base_transferencia}'"; | |
481 | + $gruda = ", "; | |
482 | + } | |
483 | + | |
484 | + if (is_string($this->data_base_remanejamento)) { | |
485 | + $set .= "{$gruda}data_base_remanejamento = '{$this->data_base_remanejamento}'"; | |
486 | + $gruda = ", "; | |
487 | + } | |
488 | + | |
465 | 489 | if ($set) { |
466 | 490 | $db->Consulta("UPDATE {$this->_tabela} SET $set WHERE cod_instituicao = '{$this->cod_instituicao}'"); |
467 | 491 | return TRUE; | ... | ... |
ieducar/intranet/include/pmieducar/clsPmieducarMatriculaTurma.inc.php
... | ... | @@ -115,7 +115,7 @@ class clsPmieducarMatriculaTurma |
115 | 115 | $this->_schema = "pmieducar."; |
116 | 116 | $this->_tabela = "{$this->_schema}matricula_turma"; |
117 | 117 | |
118 | - $this->_campos_lista = $this->_todos_campos = "mt.ref_cod_matricula, mt.ref_cod_turma, mt.ref_usuario_exc, mt.ref_usuario_cad, mt.data_cadastro, mt.data_exclusao, mt.ativo, mt.sequencial, mt.data_enturmacao, (SELECT pes.nome FROM cadastro.pessoa pes, pmieducar.aluno alu, pmieducar.matricula mat WHERE pes.idpes = alu.ref_idpes AND mat.ref_cod_aluno = alu.cod_aluno AND mat.cod_matricula = mt.ref_cod_matricula ) AS nome, (SELECT to_ascii(pes.nome) FROM cadastro.pessoa pes, pmieducar.aluno alu, pmieducar.matricula mat WHERE pes.idpes = alu.ref_idpes AND mat.ref_cod_aluno = alu.cod_aluno AND mat.cod_matricula = mt.ref_cod_matricula ) AS nome_ascii"; | |
118 | + $this->_campos_lista = $this->_todos_campos = "mt.ref_cod_matricula, mt.remanejado, mt.transferido, mt.ref_cod_turma, mt.ref_usuario_exc, mt.ref_usuario_cad, mt.data_cadastro, mt.data_exclusao, mt.ativo, mt.sequencial, mt.data_enturmacao, (SELECT pes.nome FROM cadastro.pessoa pes, pmieducar.aluno alu, pmieducar.matricula mat WHERE pes.idpes = alu.ref_idpes AND mat.ref_cod_aluno = alu.cod_aluno AND mat.cod_matricula = mt.ref_cod_matricula ) AS nome, (SELECT to_ascii(pes.nome) FROM cadastro.pessoa pes, pmieducar.aluno alu, pmieducar.matricula mat WHERE pes.idpes = alu.ref_idpes AND mat.ref_cod_aluno = alu.cod_aluno AND mat.cod_matricula = mt.ref_cod_matricula ) AS nome_ascii"; | |
119 | 119 | |
120 | 120 | if (is_numeric($ref_usuario_exc)) { |
121 | 121 | if (class_exists("clsPmieducarUsuario")) { |
... | ... | @@ -345,6 +345,10 @@ class clsPmieducarMatriculaTurma |
345 | 345 | if (is_numeric($this->ativo)) { |
346 | 346 | $set .= "{$gruda}ativo = '{$this->ativo}'"; |
347 | 347 | $gruda = ", "; |
348 | + if ($this->ativo == 1){ | |
349 | + $set .= "{$gruda}remanejado = null, transferido = null"; | |
350 | + $gruda = ", "; | |
351 | + } | |
348 | 352 | } |
349 | 353 | |
350 | 354 | if (is_numeric($this->ref_cod_turma_transf)) { |
... | ... | @@ -461,6 +465,9 @@ class clsPmieducarMatriculaTurma |
461 | 465 | if ($int_ativo == 1) { |
462 | 466 | $filtros .= "{$whereAnd} mt.ativo = '1'"; |
463 | 467 | $whereAnd = " AND "; |
468 | + }elseif ($int_ativo == 2) { | |
469 | + $filtros .= "{$whereAnd} (mt.ativo = '1' OR mt.transferido OR mt.remanejado)"; | |
470 | + $whereAnd = " AND "; | |
464 | 471 | } |
465 | 472 | else { |
466 | 473 | $filtros .= "{$whereAnd} mt.ativo = '0'"; |
... | ... | @@ -1154,6 +1161,38 @@ class clsPmieducarMatriculaTurma |
1154 | 1161 | return FALSE; |
1155 | 1162 | } |
1156 | 1163 | |
1164 | + function marcaAlunoRemanejado($data = null){ | |
1165 | + | |
1166 | + if ($this->ref_cod_matricula && $this->sequencial){ | |
1167 | + $db = new clsBanco(); | |
1168 | + $cod_instituicao = $db->CampoUnico("SELECT ref_cod_instituicao from pmieducar.escola | |
1169 | + INNER JOIN pmieducar.matricula ON (ref_ref_cod_escola = cod_escola) | |
1170 | + WHERE cod_matricula = {$this->ref_cod_matricula}"); | |
1171 | + $dataBaseRemanejamento = $db->CampoUnico("SELECT data_base_remanejamento | |
1172 | + FROM pmieducar.instituicao WHERE cod_instituicao = {$cod_instituicao}"); | |
1173 | + $data = $data ? $data : date('Y-m-d'); | |
1174 | + if ($dataBaseRemanejamento && strtotime($dataBaseRemanejamento) < strtotime($data) ) { | |
1175 | + $db->CampoUnico("UPDATE pmieducar.matricula_turma SET remanejado = TRUE WHERE ref_cod_matricula = {$this->ref_cod_matricula} AND sequencial = {$this->sequencial}"); | |
1176 | + } | |
1177 | + } | |
1178 | + } | |
1179 | + | |
1180 | + function marcaAlunoTransferido($data = null){ | |
1181 | + | |
1182 | + if ($this->ref_cod_matricula && $this->sequencial){ | |
1183 | + $db = new clsBanco(); | |
1184 | + $cod_instituicao = $db->CampoUnico("SELECT ref_cod_instituicao from pmieducar.escola | |
1185 | + INNER JOIN pmieducar.matricula ON (ref_ref_cod_escola = cod_escola) | |
1186 | + WHERE cod_matricula = {$this->ref_cod_matricula}"); | |
1187 | + $dataBaseRemanejamento = $db->CampoUnico("SELECT data_base_transferencia | |
1188 | + FROM pmieducar.instituicao WHERE cod_instituicao = {$cod_instituicao}"); | |
1189 | + $data = $data ? $data : date('Y-m-d'); | |
1190 | + if ($dataBaseRemanejamento && strtotime($dataBaseRemanejamento) < strtotime($data) ) { | |
1191 | + $db->CampoUnico("UPDATE pmieducar.matricula_turma SET transferido = TRUE WHERE ref_cod_matricula = {$this->ref_cod_matricula} AND sequencial = {$this->sequencial}"); | |
1192 | + } | |
1193 | + } | |
1194 | + } | |
1195 | + | |
1157 | 1196 | function dadosAlunosNaoEnturmados($ref_cod_escola = NULL, $ref_cod_serie = NULL, |
1158 | 1197 | $ref_cod_curso = NULL, $int_ano = NULL, $verificar_multiseriado = FALSE, |
1159 | 1198 | $semestre = NULL) | ... | ... |
ieducar/misc/database/migrations/20161007002450_add_columns_transferido_remanejado.php
0 → 100644
... | ... | @@ -0,0 +1,23 @@ |
1 | +<?php | |
2 | + | |
3 | +use Phinx\Migration\AbstractMigration; | |
4 | + | |
5 | +class AddColumnsTransferidoRemanejado extends AbstractMigration | |
6 | +{ | |
7 | + | |
8 | + public function up() | |
9 | + { | |
10 | + $this->execute("ALTER TABLE pmieducar.matricula_turma ADD COLUMN transferido boolean;"); | |
11 | + $this->execute("ALTER TABLE pmieducar.matricula_turma ADD COLUMN remanejado boolean;"); | |
12 | + $this->execute("ALTER TABLE pmieducar.instituicao ADD COLUMN data_base_remanejamento boolean;"); | |
13 | + $this->execute("ALTER TABLE pmieducar.instituicao ADD COLUMN data_base_transferencia boolean;"); | |
14 | + } | |
15 | + | |
16 | + public function down() | |
17 | + { | |
18 | + $this->execute("ALTER TABLE pmieducar.matricula_turma DROP COLUMN transferido;"); | |
19 | + $this->execute("ALTER TABLE pmieducar.matricula_turma DROP COLUMN remanejado;"); | |
20 | + $this->execute("ALTER TABLE pmieducar.instituicao DROP COLUMN data_base_remanejamento;"); | |
21 | + $this->execute("ALTER TABLE pmieducar.instituicao DROP COLUMN data_base_transferencia;"); | |
22 | + } | |
23 | +} | ... | ... |
ieducar/modules/Avaliacao/Assets/Javascripts/Diario.js
... | ... | @@ -542,13 +542,30 @@ function handleSearch($resultTable, dataResponse) { |
542 | 542 | .attr('colspan', componenteCurricularSelected ? 0 : 4) |
543 | 543 | .appendTo($linha); |
544 | 544 | |
545 | - if (componenteCurricularSelected && value.componentes_curriculares.length > 0) | |
546 | - updateComponenteCurricular($linha, value.matricula_id, value.componentes_curriculares[0]); | |
545 | + if (value.componentes_curriculares){ | |
546 | + if (componenteCurricularSelected && value.componentes_curriculares.length > 0) | |
547 | + updateComponenteCurricular($linha, value.matricula_id, value.componentes_curriculares[0]); | |
548 | + }else{ | |
549 | + if(value.situacao_deslocamento){ | |
550 | + var $situacaoTdDeslocamento = $j('<td />').addClass('situacao-matricula-cc') | |
551 | + .attr('id', 'situacao-matricula-' + value.matricula_id) | |
552 | + .data('matricula_id', value.matricula_id) | |
553 | + .addClass('center') | |
554 | + .css('color', '#FF6600') | |
555 | + .html(value.situacao_deslocamento) | |
556 | + .appendTo($linha); | |
557 | + $j('<td />').html('-').addClass('center').appendTo($linha); | |
558 | + $j('<td />').html('-').addClass('center').appendTo($linha); | |
559 | + $j('<td />').html('-').addClass('center').appendTo($linha); | |
560 | + $j('<td />').html('-').addClass('center').appendTo($linha); | |
561 | + | |
562 | + } | |
563 | + } | |
547 | 564 | |
548 | 565 | $linha.fadeIn('slow').appendTo($resultTable); |
549 | 566 | $linha.appendTo($resultTable); |
550 | 567 | |
551 | - if (! componenteCurricularSelected) | |
568 | + if (! componenteCurricularSelected && value.componentes_curriculares) | |
552 | 569 | updateComponenteCurriculares($resultTable, value.matricula_id, value.componentes_curriculares); |
553 | 570 | }); |
554 | 571 | ... | ... |
ieducar/modules/Avaliacao/Views/DiarioApiController.php
... | ... | @@ -553,7 +553,7 @@ class DiarioApiController extends ApiCoreController |
553 | 553 | NULL, |
554 | 554 | NULL, |
555 | 555 | NULL, |
556 | - 1, | |
556 | + 2, | |
557 | 557 | $this->getRequest()->serie_id, |
558 | 558 | $this->getRequest()->curso_id, |
559 | 559 | $this->getRequest()->escola_id, |
... | ... | @@ -587,10 +587,13 @@ class DiarioApiController extends ApiCoreController |
587 | 587 | // seta id da matricula a ser usado pelo metodo serviceBoletim |
588 | 588 | $this->setCurrentMatriculaId($matriculaId); |
589 | 589 | |
590 | - $matricula['componentes_curriculares'] = $this->loadComponentesCurricularesForMatricula($matriculaId); | |
590 | + if(! ($aluno['remanejado'] || $aluno['transferido'])) | |
591 | + $matricula['componentes_curriculares'] = $this->loadComponentesCurricularesForMatricula($matriculaId); | |
592 | + | |
591 | 593 | $matricula['matricula_id'] = $aluno['ref_cod_matricula']; |
592 | 594 | $matricula['aluno_id'] = $aluno['ref_cod_aluno']; |
593 | 595 | $matricula['nome'] = $this->safeString($aluno['nome_aluno']); |
596 | + $matricula['situacao_deslocamento'] = ($aluno['remanejado'] ? 'Remanejado' : ($aluno['transferido'] ? 'Transferido' : null)); | |
594 | 597 | |
595 | 598 | $matriculas[] = $matricula; |
596 | 599 | } | ... | ... |