Commit 41bed8827ad8adbaec8ba569f65674c518c11f5e
1 parent
7d74c34c
Exists in
master
Criado campo para data efetiva de enturmação
portabilis/ieducar#113
Showing
6 changed files
with
78 additions
and
3 deletions
Show diff stats
ieducar/intranet/educar_matricula_cad.php
| ... | ... | @@ -608,7 +608,7 @@ class indice extends clsCadastro |
| 608 | 608 | // Coloca as matrículas anteriores em andamento |
| 609 | 609 | $obj_transferencia_antiga = new clsPmieducarTransferenciaSolicitacao(); |
| 610 | 610 | $lista_transferencia = $obj_transferencia_antiga->lista(null,null,null,null,null,$this->cod_matricula); |
| 611 | - if (is_array($lista_transferencia))){ | |
| 611 | + if (is_array($lista_transferencia)){ | |
| 612 | 612 | foreach ($lista_transferencia as $transf) { |
| 613 | 613 | |
| 614 | 614 | $obj_mat = new clsPmieducarMatricula($transf['ref_cod_matricula_saida']); |
| ... | ... | @@ -710,6 +710,7 @@ class indice extends clsCadastro |
| 710 | 710 | NULL, |
| 711 | 711 | NULL, |
| 712 | 712 | 1); |
| 713 | + $enturmacao->data_enturmacao = $this->data_matricula; | |
| 713 | 714 | return $enturmacao->cadastra(); |
| 714 | 715 | } |
| 715 | 716 | return false; | ... | ... |
ieducar/intranet/educar_matricula_turma_cad.php
| ... | ... | @@ -33,6 +33,7 @@ require_once 'include/clsCadastro.inc.php'; |
| 33 | 33 | require_once 'include/clsBanco.inc.php'; |
| 34 | 34 | require_once 'include/pmieducar/geral.inc.php'; |
| 35 | 35 | require_once 'include/pmieducar/clsPmieducarMatricula.inc.php'; |
| 36 | +require_once 'lib/Portabilis/Date/Utils.php'; | |
| 36 | 37 | |
| 37 | 38 | /** |
| 38 | 39 | * clsIndexBase class. |
| ... | ... | @@ -78,6 +79,7 @@ class indice extends clsCadastro |
| 78 | 79 | var $ref_cod_turma_origem; |
| 79 | 80 | var $ref_cod_turma_destino; |
| 80 | 81 | var $ref_cod_curso; |
| 82 | + var $data_enturmacao; | |
| 81 | 83 | |
| 82 | 84 | var $sequencial; |
| 83 | 85 | |
| ... | ... | @@ -97,6 +99,8 @@ class indice extends clsCadastro |
| 97 | 99 | $this->$key = $value; |
| 98 | 100 | } |
| 99 | 101 | |
| 102 | + $this->data_enturmacao = Portabilis_Date_Utils::brToPgSQL($this->data_enturmacao); | |
| 103 | + | |
| 100 | 104 | $obj_permissoes = new clsPermissoes(); |
| 101 | 105 | $obj_permissoes->permissao_cadastra(578, $this->pessoa_logada, 7, 'educar_matricula_lst.php'); |
| 102 | 106 | |
| ... | ... | @@ -144,6 +148,7 @@ class indice extends clsCadastro |
| 144 | 148 | NULL, |
| 145 | 149 | NULL, |
| 146 | 150 | 1); |
| 151 | + $enturmacao->data_enturmacao = $this->data_enturmacao; | |
| 147 | 152 | return $enturmacao->cadastra(); |
| 148 | 153 | } |
| 149 | 154 | return false; | ... | ... |
ieducar/intranet/educar_matricula_turma_det.php
| ... | ... | @@ -78,6 +78,7 @@ class indice extends clsDetalhe |
| 78 | 78 | var $ref_cod_escola; |
| 79 | 79 | var $ref_cod_turma_origem; |
| 80 | 80 | var $ref_cod_curso; |
| 81 | + var $data_enturmacao; | |
| 81 | 82 | |
| 82 | 83 | var $sequencial; |
| 83 | 84 | |
| ... | ... | @@ -239,6 +240,9 @@ class indice extends clsDetalhe |
| 239 | 240 | $this->addDetalhe(array('<b>Enturmação</b>', $selectEnturmacoes)); |
| 240 | 241 | } |
| 241 | 242 | |
| 243 | + if(!$this->possuiEnturmacaoTurmaDestino) | |
| 244 | + $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"/>')); | |
| 245 | + | |
| 242 | 246 | $this->addDetalhe(array( |
| 243 | 247 | '-', |
| 244 | 248 | sprintf(' |
| ... | ... | @@ -248,6 +252,7 @@ class indice extends clsDetalhe |
| 248 | 252 | <input type="hidden" name="ref_cod_escola" value=""> |
| 249 | 253 | <input type="hidden" name="ref_cod_turma_origem" value="%d"> |
| 250 | 254 | <input type="hidden" name="ref_cod_turma_destino" value=""> |
| 255 | + <input type="hidden" name="data_enturmacao" value=""> | |
| 251 | 256 | <input type="hidden" name="sequencial" value="%d"> |
| 252 | 257 | </form> |
| 253 | 258 | ', $this->ref_cod_turma_origem, $this->sequencial) |
| ... | ... | @@ -289,6 +294,7 @@ class indice extends clsDetalhe |
| 289 | 294 | |
| 290 | 295 | document.formcadastro.ref_cod_matricula.value = ref_cod_matricula; |
| 291 | 296 | document.formcadastro.ref_cod_turma_destino.value = ref_cod_turma_destino; |
| 297 | + document.formcadastro.data_enturmacao.value = document.getElementById("data_enturmacao").value; | |
| 292 | 298 | document.formcadastro.submit(); |
| 293 | 299 | } |
| 294 | 300 | ... | ... |
ieducar/intranet/educar_matriculas_turma_cad.php
| ... | ... | @@ -32,6 +32,7 @@ require_once 'include/clsBase.inc.php'; |
| 32 | 32 | require_once 'include/clsCadastro.inc.php'; |
| 33 | 33 | require_once 'include/clsBanco.inc.php'; |
| 34 | 34 | require_once 'include/pmieducar/geral.inc.php'; |
| 35 | +require_once 'lib/Portabilis/Date/Utils.php'; | |
| 35 | 36 | |
| 36 | 37 | /** |
| 37 | 38 | * clsIndexBase class. |
| ... | ... | @@ -83,6 +84,7 @@ class indice extends clsCadastro |
| 83 | 84 | |
| 84 | 85 | var $matriculas_turma; |
| 85 | 86 | var $incluir_matricula; |
| 87 | + var $data_enturmacao; | |
| 86 | 88 | |
| 87 | 89 | function Inicializar() |
| 88 | 90 | { |
| ... | ... | @@ -263,6 +265,7 @@ class indice extends clsCadastro |
| 263 | 265 | } |
| 264 | 266 | |
| 265 | 267 | if (count($opcoes)) { |
| 268 | + $this->inputsHelper()->date('data_enturmacao', array('label' => 'Data da enturmação', 'value' => date('Y-m-d'))); | |
| 266 | 269 | asort($opcoes); |
| 267 | 270 | foreach ($opcoes as $key => $aluno) { |
| 268 | 271 | $this->campoCheck('ref_cod_matricula[' . $key . ']', 'Aluno', $key, |
| ... | ... | @@ -286,6 +289,7 @@ class indice extends clsCadastro |
| 286 | 289 | { |
| 287 | 290 | @session_start(); |
| 288 | 291 | $this->pessoa_logada = $_SESSION['id_pessoa']; |
| 292 | + $this->data_enturmacao = Portabilis_Date_Utils::brToPgSQL($this->data_enturmacao); | |
| 289 | 293 | @session_write_close(); |
| 290 | 294 | |
| 291 | 295 | if ($this->matriculas_turma) { |
| ... | ... | @@ -296,6 +300,7 @@ class indice extends clsCadastro |
| 296 | 300 | $existe = $obj->existe(); |
| 297 | 301 | |
| 298 | 302 | if (!$existe) { |
| 303 | + $obj->data_enturmacao = $this->data_enturmacao; | |
| 299 | 304 | $cadastrou = $obj->cadastra(); |
| 300 | 305 | |
| 301 | 306 | if (!$cadastrou) { | ... | ... |
ieducar/intranet/include/pmieducar/clsPmieducarMatriculaTurma.inc.php
| ... | ... | @@ -108,13 +108,13 @@ class clsPmieducarMatriculaTurma |
| 108 | 108 | function clsPmieducarMatriculaTurma($ref_cod_matricula = NULL, |
| 109 | 109 | $ref_cod_turma = NULL, $ref_usuario_exc = NULL, $ref_usuario_cad = NULL, |
| 110 | 110 | $data_cadastro = NULL, $data_exclusao = NULL, $ativo = NULL, |
| 111 | - $ref_cod_turma_transf = NULL,$sequencial = NULL | |
| 111 | + $ref_cod_turma_transf = NULL,$sequencial = NULL, $data_enturmacao = NULL | |
| 112 | 112 | ) { |
| 113 | 113 | $db = new clsBanco(); |
| 114 | 114 | $this->_schema = "pmieducar."; |
| 115 | 115 | $this->_tabela = "{$this->_schema}matricula_turma"; |
| 116 | 116 | |
| 117 | - $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, (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"; | |
| 117 | + $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 | 118 | |
| 119 | 119 | if (is_numeric($ref_usuario_exc)) { |
| 120 | 120 | if (class_exists("clsPmieducarUsuario")) { |
| ... | ... | @@ -237,6 +237,10 @@ class clsPmieducarMatriculaTurma |
| 237 | 237 | if (is_numeric($sequencial)) { |
| 238 | 238 | $this->sequencial = $sequencial; |
| 239 | 239 | } |
| 240 | + | |
| 241 | + if (is_string($data_enturmacao)) { | |
| 242 | + $this->data_enturmacao = $data_enturmacao; | |
| 243 | + } | |
| 240 | 244 | } |
| 241 | 245 | |
| 242 | 246 | /** |
| ... | ... | @@ -286,6 +290,12 @@ class clsPmieducarMatriculaTurma |
| 286 | 290 | $valores .= "{$gruda}'1'"; |
| 287 | 291 | $gruda = ", "; |
| 288 | 292 | |
| 293 | + if (is_string($this->data_enturmacao)) { | |
| 294 | + $campos .= "{$gruda}data_enturmacao"; | |
| 295 | + $valores .= "{$gruda}'{$this->data_enturmacao}'"; | |
| 296 | + $gruda = ", "; | |
| 297 | + } | |
| 298 | + | |
| 289 | 299 | $db->Consulta("INSERT INTO {$this->_tabela} ($campos) VALUES ($valores)"); |
| 290 | 300 | |
| 291 | 301 | return TRUE; |
| ... | ... | @@ -333,6 +343,11 @@ class clsPmieducarMatriculaTurma |
| 333 | 343 | $gruda = ", "; |
| 334 | 344 | } |
| 335 | 345 | |
| 346 | + if (is_string($this->data_enturmacao)) { | |
| 347 | + $set .= "{$gruda}data_enturmacao = '{$this->data_enturmacao}'"; | |
| 348 | + $gruda = ", "; | |
| 349 | + } | |
| 350 | + | |
| 336 | 351 | if ($set) { |
| 337 | 352 | $db->Consulta("UPDATE {$this->_tabela} SET $set WHERE ref_cod_matricula = '{$this->ref_cod_matricula}' AND ref_cod_turma = '{$this->ref_cod_turma}' and sequencial = '$this->sequencial' "); |
| 338 | 353 | return TRUE; | ... | ... |
ieducar/misc/database/deltas/portabilis/67_cria_coluna_data_enturmacao.sql
0 → 100644
| ... | ... | @@ -0,0 +1,43 @@ |
| 1 | + -- // | |
| 2 | + | |
| 3 | + -- | |
| 4 | + -- Cria colunas para armazenar data dos processos da matrícula | |
| 5 | + -- | |
| 6 | + -- @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 7 | + -- @license @@license@@ | |
| 8 | + -- @version $Id$ | |
| 9 | + | |
| 10 | + ALTER TABLE pmieducar.matricula ADD COLUMN data_matricula timestamp without time zone; | |
| 11 | + ALTER TABLE pmieducar.matricula ADD COLUMN data_cancel timestamp without time zone; | |
| 12 | + | |
| 13 | + CREATE OR REPLACE FUNCTION retira_data_cancel_matricula_fun() | |
| 14 | + RETURNS trigger AS | |
| 15 | + $func$ | |
| 16 | + BEGIN | |
| 17 | + | |
| 18 | + UPDATE pmieducar.matricula | |
| 19 | + SET data_cancel = NULL | |
| 20 | + WHERE cod_matricula = new.cod_matricula | |
| 21 | + AND data_cancel IS DISTINCT FROM NULL | |
| 22 | + AND aprovado = 3 | |
| 23 | + AND (SELECT 1 FROM pmieducar.transferencia_solicitacao WHERE ativo = 1 AND ref_cod_matricula_saida = new.cod_matricula limit 1) is null; | |
| 24 | + | |
| 25 | + RETURN NULL; | |
| 26 | + END | |
| 27 | + $func$ LANGUAGE plpgsql; | |
| 28 | + | |
| 29 | + CREATE TRIGGER retira_data_cancel_matricula_trg | |
| 30 | + AFTER UPDATE ON pmieducar.matricula | |
| 31 | + FOR EACH ROW | |
| 32 | + EXECUTE PROCEDURE retira_data_cancel_matricula_fun(); | |
| 33 | + | |
| 34 | + -- //@UNDO | |
| 35 | + | |
| 36 | + ALTER TABLE pmieducar.matricula DROP COLUMN data_matricula; | |
| 37 | + ALTER TABLE pmieducar.matricula DROP COLUMN data_cancel; | |
| 38 | + | |
| 39 | + DROP TRIGGER retira_data_cancel_matricula_trg ON pmieducar.matricula; | |
| 40 | + | |
| 41 | + DROP FUNCTION public.retira_data_cancel_matricula_fun(); | |
| 42 | + | |
| 43 | + -- // | |
| 0 | 44 | \ No newline at end of file | ... | ... |