Commit 4185f9bdc57411a93f41c8f506fcf73c6ec3c896
1 parent
34843021
Exists in
master
Criados campos de data para processos
Criado data de entrada e saída para processos da matrícula, permitindo que o usuário informe essas datas na hora da matrícula, transferência, abandono, etc. portabilis/ieducar#104
Showing
10 changed files
with
165 additions
and
8 deletions
Show diff stats
ieducar/intranet/educar_abandono_cad.php
@@ -37,6 +37,7 @@ require_once ("include/clsBase.inc.php"); | @@ -37,6 +37,7 @@ require_once ("include/clsBase.inc.php"); | ||
37 | require_once ("include/clsCadastro.inc.php"); | 37 | require_once ("include/clsCadastro.inc.php"); |
38 | require_once ("include/clsBanco.inc.php"); | 38 | require_once ("include/clsBanco.inc.php"); |
39 | require_once( "include/pmieducar/geral.inc.php" ); | 39 | require_once( "include/pmieducar/geral.inc.php" ); |
40 | +require_once 'lib/Portabilis/Date/Utils.php'; | ||
40 | 41 | ||
41 | class clsIndexBase extends clsBase | 42 | class clsIndexBase extends clsBase |
42 | { | 43 | { |
@@ -111,6 +112,8 @@ class indice extends clsCadastro | @@ -111,6 +112,8 @@ class indice extends clsCadastro | ||
111 | $this->campoTexto( "nm_aluno", "Aluno", $this->nm_aluno, 30, 255, true,false,false,"","","","",true ); | 112 | $this->campoTexto( "nm_aluno", "Aluno", $this->nm_aluno, 30, 255, true,false,false,"","","","",true ); |
112 | } | 113 | } |
113 | 114 | ||
115 | + $this->inputsHelper()->date('data_cancel', array('label' => 'Data do abandono', 'placeholder' => 'dd/mm/yyyy', 'value' => date('d/m/Y'))); | ||
116 | + | ||
114 | // text | 117 | // text |
115 | $this->campoMemo( "observacao", "Observação", $this->observacao, 60, 5, false ); | 118 | $this->campoMemo( "observacao", "Observação", $this->observacao, 60, 5, false ); |
116 | } | 119 | } |
@@ -125,9 +128,24 @@ class indice extends clsCadastro | @@ -125,9 +128,24 @@ class indice extends clsCadastro | ||
125 | $obj_permissoes->permissao_cadastra( 578, $this->pessoa_logada, 7, "educar_matricula_det.php?cod_matricula={$this->ref_cod_matricula}" ); | 128 | $obj_permissoes->permissao_cadastra( 578, $this->pessoa_logada, 7, "educar_matricula_det.php?cod_matricula={$this->ref_cod_matricula}" ); |
126 | 129 | ||
127 | $obj_matricula = new clsPmieducarMatricula( $this->ref_cod_matricula,null,null,null,$this->pessoa_logada,null,null,6 ); | 130 | $obj_matricula = new clsPmieducarMatricula( $this->ref_cod_matricula,null,null,null,$this->pessoa_logada,null,null,6 ); |
131 | + $obj_matricula->data_cancel = Portabilis_Date_Utils::brToPgSQL($this->data_cancel); | ||
128 | 132 | ||
129 | $det_matricula = $obj_matricula->detalhe(); | 133 | $det_matricula = $obj_matricula->detalhe(); |
130 | 134 | ||
135 | + if(is_null($det_matricula['data_matricula'])){ | ||
136 | + | ||
137 | + if(substr($det_matricula['data_cadastro'], 0, 10) > $obj_matricula->data_cancel){ | ||
138 | + | ||
139 | + $this->mensagem = "Data de abandono não pode ser inferior a data da matrícula.<br>"; | ||
140 | + return false; | ||
141 | + } | ||
142 | + }else{ | ||
143 | + if(substr($det_matricula['data_matricula'], 0, 10) > $obj_matricula->data_cancel){ | ||
144 | + $this->mensagem = "Data de abandono não pode ser inferior a data da matrícula.<br>"; | ||
145 | + return false; | ||
146 | + } | ||
147 | + } | ||
148 | + | ||
131 | if($obj_matricula->edita()) | 149 | if($obj_matricula->edita()) |
132 | { | 150 | { |
133 | 151 |
ieducar/intranet/educar_avancar_mod_cad.php
@@ -35,6 +35,7 @@ require_once 'include/clsBase.inc.php'; | @@ -35,6 +35,7 @@ require_once 'include/clsBase.inc.php'; | ||
35 | require_once 'include/clsCadastro.inc.php'; | 35 | require_once 'include/clsCadastro.inc.php'; |
36 | require_once 'include/clsBanco.inc.php'; | 36 | require_once 'include/clsBanco.inc.php'; |
37 | require_once 'include/pmieducar/geral.inc.php'; | 37 | require_once 'include/pmieducar/geral.inc.php'; |
38 | +require_once 'lib/Portabilis/Date/Utils.php'; | ||
38 | 39 | ||
39 | class clsIndexBase extends clsBase | 40 | class clsIndexBase extends clsBase |
40 | { | 41 | { |
@@ -48,6 +49,7 @@ class clsIndexBase extends clsBase | @@ -48,6 +49,7 @@ class clsIndexBase extends clsBase | ||
48 | class indice extends clsCadastro | 49 | class indice extends clsCadastro |
49 | { | 50 | { |
50 | var $pessoa_logada; | 51 | var $pessoa_logada; |
52 | + var $data_matricula; | ||
51 | 53 | ||
52 | function Inicializar() | 54 | function Inicializar() |
53 | { | 55 | { |
@@ -66,6 +68,7 @@ class indice extends clsCadastro | @@ -66,6 +68,7 @@ class indice extends clsCadastro | ||
66 | 68 | ||
67 | $this->inputsHelper()->dynamic(array('instituicao', 'escola', 'curso', 'serie', 'turma')); | 69 | $this->inputsHelper()->dynamic(array('instituicao', 'escola', 'curso', 'serie', 'turma')); |
68 | $this->inputsHelper()->dynamic('anoLetivo', array('label' => 'Ano destino'), $anoLetivoHelperOptions); | 70 | $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')); | ||
69 | } | 72 | } |
70 | 73 | ||
71 | /** | 74 | /** |
@@ -80,6 +83,8 @@ class indice extends clsCadastro | @@ -80,6 +83,8 @@ class indice extends clsCadastro | ||
80 | $this->db = new clsBanco(); | 83 | $this->db = new clsBanco(); |
81 | $this->db2 = new clsBanco(); | 84 | $this->db2 = new clsBanco(); |
82 | 85 | ||
86 | + $this->data_matricula = Portabilis_Date_Utils::brToPgSQL($this->data_matricula); | ||
87 | + | ||
83 | $result = $this->rematricularALunos($this->ref_cod_escola, $this->ref_cod_curso, | 88 | $result = $this->rematricularALunos($this->ref_cod_escola, $this->ref_cod_curso, |
84 | $this->ref_cod_serie, $this->ref_cod_turma, $_POST['ano']); | 89 | $this->ref_cod_serie, $this->ref_cod_turma, $_POST['ano']); |
85 | 90 | ||
@@ -175,7 +180,7 @@ class indice extends clsCadastro | @@ -175,7 +180,7 @@ class indice extends clsCadastro | ||
175 | try { | 180 | try { |
176 | $this->db2->Consulta(sprintf("INSERT INTO pmieducar.matricula | 181 | $this->db2->Consulta(sprintf("INSERT INTO pmieducar.matricula |
177 | (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')", | 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')", |
178 | - $escolaId, $serieId, $this->pessoa_logada, $alunoId, $ano, $cursoId)); | 183 | + $escolaId, $serieId, $this->pessoa_logada, $alunoId, $ano, $cursoId, $this->data_matricula)); |
179 | } | 184 | } |
180 | catch (Exception $e) { | 185 | catch (Exception $e) { |
181 | $this->mensagem = "Erro durante matrícula do aluno: $alunoId"; | 186 | $this->mensagem = "Erro durante matrícula do aluno: $alunoId"; |
ieducar/intranet/educar_matricula_cad.php
@@ -32,6 +32,7 @@ require_once 'include/clsBase.inc.php'; | @@ -32,6 +32,7 @@ require_once 'include/clsBase.inc.php'; | ||
32 | require_once 'include/clsCadastro.inc.php'; | 32 | require_once 'include/clsCadastro.inc.php'; |
33 | require_once 'include/clsBanco.inc.php'; | 33 | require_once 'include/clsBanco.inc.php'; |
34 | require_once 'include/pmieducar/geral.inc.php'; | 34 | require_once 'include/pmieducar/geral.inc.php'; |
35 | +require_once 'lib/Portabilis/Date/Utils.php'; | ||
35 | 36 | ||
36 | /** | 37 | /** |
37 | * clsIndexBase class. | 38 | * clsIndexBase class. |
@@ -78,6 +79,7 @@ class indice extends clsCadastro | @@ -78,6 +79,7 @@ class indice extends clsCadastro | ||
78 | var $data_exclusao; | 79 | var $data_exclusao; |
79 | var $ativo; | 80 | var $ativo; |
80 | var $ano; | 81 | var $ano; |
82 | + var $data_matricula; | ||
81 | 83 | ||
82 | var $ref_cod_instituicao; | 84 | var $ref_cod_instituicao; |
83 | var $ref_cod_curso; | 85 | var $ref_cod_curso; |
@@ -161,6 +163,7 @@ class indice extends clsCadastro | @@ -161,6 +163,7 @@ class indice extends clsCadastro | ||
161 | $this->inputsHelper()->dynamic(array('instituicao', 'escola', 'curso', 'serie')); | 163 | $this->inputsHelper()->dynamic(array('instituicao', 'escola', 'curso', 'serie')); |
162 | $this->inputsHelper()->dynamic('turma', array('required' => false, 'option value' => 'Selecione uma turma')); | 164 | $this->inputsHelper()->dynamic('turma', array('required' => false, 'option value' => 'Selecione uma turma')); |
163 | $this->inputsHelper()->dynamic('anoLetivo', array('label' => 'Ano destino'), $anoLetivoHelperOptions); | 165 | $this->inputsHelper()->dynamic('anoLetivo', array('label' => 'Ano destino'), $anoLetivoHelperOptions); |
166 | + $this->inputsHelper()->date('data_matricula', array('label' => 'Data da matrícula', 'placeholder' => 'dd/mm/yyyy', 'value' => date('d/m/Y') )); | ||
164 | 167 | ||
165 | 168 | ||
166 | if (is_numeric($this->ref_cod_curso)) { | 169 | if (is_numeric($this->ref_cod_curso)) { |
@@ -387,12 +390,14 @@ class indice extends clsCadastro | @@ -387,12 +390,14 @@ class indice extends clsCadastro | ||
387 | if (! $this->removerFlagUltimaMatricula($this->ref_cod_aluno)) { | 390 | if (! $this->removerFlagUltimaMatricula($this->ref_cod_aluno)) { |
388 | return false; | 391 | return false; |
389 | } | 392 | } |
393 | + | ||
394 | + $this->data_matricula = Portabilis_Date_Utils::brToPgSQL($this->data_matricula); | ||
390 | 395 | ||
391 | $obj = new clsPmieducarMatricula(NULL, $this->ref_cod_reserva_vaga, | 396 | $obj = new clsPmieducarMatricula(NULL, $this->ref_cod_reserva_vaga, |
392 | $this->ref_cod_escola, $this->ref_cod_serie, NULL, | 397 | $this->ref_cod_escola, $this->ref_cod_serie, NULL, |
393 | $this->pessoa_logada, $this->ref_cod_aluno, 3, NULL, NULL, 1, $this->ano, | 398 | $this->pessoa_logada, $this->ref_cod_aluno, 3, NULL, NULL, 1, $this->ano, |
394 | 1, NULL, NULL, NULL, NULL, $this->ref_cod_curso, | 399 | 1, NULL, NULL, NULL, NULL, $this->ref_cod_curso, |
395 | - $this->matricula_transferencia, $this->semestre); | 400 | + $this->matricula_transferencia, $this->semestre, $this->data_matricula); |
396 | 401 | ||
397 | $cadastrou = $obj->cadastra(); | 402 | $cadastrou = $obj->cadastra(); |
398 | 403 |
ieducar/intranet/educar_matricula_reclassificar_cad.php
@@ -28,6 +28,7 @@ require_once ("include/clsBase.inc.php"); | @@ -28,6 +28,7 @@ require_once ("include/clsBase.inc.php"); | ||
28 | require_once ("include/clsCadastro.inc.php"); | 28 | require_once ("include/clsCadastro.inc.php"); |
29 | require_once ("include/clsBanco.inc.php"); | 29 | require_once ("include/clsBanco.inc.php"); |
30 | require_once( "include/pmieducar/geral.inc.php" ); | 30 | require_once( "include/pmieducar/geral.inc.php" ); |
31 | +require_once 'lib/Portabilis/Date/Utils.php'; | ||
31 | 32 | ||
32 | class clsIndexBase extends clsBase | 33 | class clsIndexBase extends clsBase |
33 | { | 34 | { |
@@ -59,6 +60,7 @@ class indice extends clsCadastro | @@ -59,6 +60,7 @@ class indice extends clsCadastro | ||
59 | var $data_exclusao; | 60 | var $data_exclusao; |
60 | var $ativo; | 61 | var $ativo; |
61 | var $ano; | 62 | var $ano; |
63 | + var $data_cancel; | ||
62 | 64 | ||
63 | var $ref_cod_instituicao; | 65 | var $ref_cod_instituicao; |
64 | var $ref_cod_curso; | 66 | var $ref_cod_curso; |
@@ -219,6 +221,7 @@ class indice extends clsCadastro | @@ -219,6 +221,7 @@ class indice extends clsCadastro | ||
219 | $this->campoLista("ref_cod_curso","Curso",$cursos,$this->ref_cod_curso,"getSerie();"); | 221 | $this->campoLista("ref_cod_curso","Curso",$cursos,$this->ref_cod_curso,"getSerie();"); |
220 | $this->campoLista("ref_ref_cod_serie","Série",array('' => 'Selecione uma série'),''); | 222 | $this->campoLista("ref_ref_cod_serie","Série",array('' => 'Selecione uma série'),''); |
221 | //$this->campoOculto("ref_ref_cod_serie_antiga",$this->ref_ref_cod_serie); | 223 | //$this->campoOculto("ref_ref_cod_serie_antiga",$this->ref_ref_cod_serie); |
224 | + $this->inputsHelper()->date('data_cancel', array('label' => 'Data da reclassificação', 'placeholder' => 'dd/mm/yyyy', 'value' => date('d/m/Y'))); | ||
222 | $this->campoMemo("descricao_reclassificacao","Descrição",$this->descricao_reclassificacao,100,10,true); | 225 | $this->campoMemo("descricao_reclassificacao","Descrição",$this->descricao_reclassificacao,100,10,true); |
223 | 226 | ||
224 | $this->acao_enviar = 'if(confirm("Deseja reclassificar está matrícula?"))acao();'; | 227 | $this->acao_enviar = 'if(confirm("Deseja reclassificar está matrícula?"))acao();'; |
@@ -234,16 +237,36 @@ class indice extends clsCadastro | @@ -234,16 +237,36 @@ class indice extends clsCadastro | ||
234 | $obj_permissoes = new clsPermissoes(); | 237 | $obj_permissoes = new clsPermissoes(); |
235 | $obj_permissoes->permissao_cadastra( 578, $this->pessoa_logada, 7, "educar_matricula_lst.php?ref_cod_aluno={$this->ref_cod_aluno}" ); | 238 | $obj_permissoes->permissao_cadastra( 578, $this->pessoa_logada, 7, "educar_matricula_lst.php?ref_cod_aluno={$this->ref_cod_aluno}" ); |
236 | 239 | ||
240 | + $this->data_cancel = Portabilis_Date_Utils::brToPgSQL($this->data_cancel); | ||
241 | + | ||
237 | if($this->ref_ref_cod_serie == $this->ref_ref_cod_serie_antiga) | 242 | if($this->ref_ref_cod_serie == $this->ref_ref_cod_serie_antiga) |
238 | header("location: educar_matricula_det.php?cod_matricula={$this->cod_matricula}"); | 243 | header("location: educar_matricula_det.php?cod_matricula={$this->cod_matricula}"); |
239 | 244 | ||
240 | $obj_matricula = new clsPmieducarMatricula($this->cod_matricula); | 245 | $obj_matricula = new clsPmieducarMatricula($this->cod_matricula); |
241 | $det_matricula = $obj_matricula->detalhe(); | 246 | $det_matricula = $obj_matricula->detalhe(); |
242 | 247 | ||
248 | + if(is_null($det_matricula['data_matricula'])){ | ||
249 | + | ||
250 | + if(substr($det_matricula['data_cadastro'], 0, 10) > $this->data_cancel){ | ||
251 | + | ||
252 | + $this->mensagem = "Data de abandono não pode ser inferior a data da matrícula.<br>"; | ||
253 | + return false; | ||
254 | + die(); | ||
255 | + } | ||
256 | + }else{ | ||
257 | + if(substr($det_matricula['data_matricula'], 0, 10) > $this->data_cancel){ | ||
258 | + $this->mensagem = "Data de abandono não pode ser inferior a data da matrícula.<br>"; | ||
259 | + return false; | ||
260 | + die(); | ||
261 | + } | ||
262 | + } | ||
263 | + | ||
243 | if(!$det_matricula || $det_matricula['aprovado'] != 3) | 264 | if(!$det_matricula || $det_matricula['aprovado'] != 3) |
244 | header("location: educar_matricula_lst.php?ref_cod_aluno={$this->ref_cod_aluno}"); | 265 | header("location: educar_matricula_lst.php?ref_cod_aluno={$this->ref_cod_aluno}"); |
245 | 266 | ||
246 | $obj_matricula = new clsPmieducarMatricula($this->cod_matricula,null,null,null,$this->pessoa_logada,null,null,5,null,null,1,null,0,null,null,$this->descricao_reclassificacao); | 267 | $obj_matricula = new clsPmieducarMatricula($this->cod_matricula,null,null,null,$this->pessoa_logada,null,null,5,null,null,1,null,0,null,null,$this->descricao_reclassificacao); |
268 | + $obj_matricula->data_cancel = $this->data_cancel; | ||
269 | + | ||
247 | if(!$obj_matricula->edita()) | 270 | if(!$obj_matricula->edita()) |
248 | { | 271 | { |
249 | echo "<script>alert('Erro ao reclassificar matrícula'); window.location='educar_matricula_lst.php?ref_cod_aluno={$this->ref_cod_aluno}';</script>"; | 272 | echo "<script>alert('Erro ao reclassificar matrícula'); window.location='educar_matricula_lst.php?ref_cod_aluno={$this->ref_cod_aluno}';</script>"; |
ieducar/intranet/educar_transferencia_solicitacao_cad.php
@@ -28,6 +28,7 @@ require_once ("include/clsBase.inc.php"); | @@ -28,6 +28,7 @@ require_once ("include/clsBase.inc.php"); | ||
28 | require_once ("include/clsCadastro.inc.php"); | 28 | require_once ("include/clsCadastro.inc.php"); |
29 | require_once ("include/clsBanco.inc.php"); | 29 | require_once ("include/clsBanco.inc.php"); |
30 | require_once( "include/pmieducar/geral.inc.php" ); | 30 | require_once( "include/pmieducar/geral.inc.php" ); |
31 | +require_once 'lib/Portabilis/Date/Utils.php'; | ||
31 | 32 | ||
32 | class clsIndexBase extends clsBase | 33 | class clsIndexBase extends clsBase |
33 | { | 34 | { |
@@ -156,7 +157,7 @@ class indice extends clsCadastro | @@ -156,7 +157,7 @@ class indice extends clsCadastro | ||
156 | $opcoes = array( "" => "Erro na geracao" ); | 157 | $opcoes = array( "" => "Erro na geracao" ); |
157 | } | 158 | } |
158 | $this->campoLista( "ref_cod_transferencia_tipo", "Transferência Motivo", $opcoes, $this->ref_cod_transferencia_tipo ); | 159 | $this->campoLista( "ref_cod_transferencia_tipo", "Transferência Motivo", $opcoes, $this->ref_cod_transferencia_tipo ); |
159 | - | 160 | + $this->inputsHelper()->date('data_cancel', array('label' => 'Data da transferência', 'placeholder' => 'dd/mm/yyyy', 'value' => date('d/m/Y'))); |
160 | // text | 161 | // text |
161 | $this->campoMemo( "observacao", "Observação", $this->observacao, 60, 5, false ); | 162 | $this->campoMemo( "observacao", "Observação", $this->observacao, 60, 5, false ); |
162 | } | 163 | } |
@@ -179,6 +180,28 @@ class indice extends clsCadastro | @@ -179,6 +180,28 @@ class indice extends clsCadastro | ||
179 | 180 | ||
180 | 181 | ||
181 | // escola externa | 182 | // escola externa |
183 | + $this->data_cancel = Portabilis_Date_Utils::brToPgSQL($this->data_cancel); | ||
184 | + $obj = new clsPmieducarMatricula( $this->ref_cod_matricula, null,null,null,$this->pessoa_logada); | ||
185 | + $det_matricula = $obj->detalhe(); | ||
186 | + | ||
187 | + if(is_null($det_matricula['data_matricula'])){ | ||
188 | + | ||
189 | + if(substr($det_matricula['data_cadastro'], 0, 10) > $this->data_cancel){ | ||
190 | + | ||
191 | + $this->mensagem = "Data de abandono não pode ser inferior a data da matrícula.<br>"; | ||
192 | + return false; | ||
193 | + die(); | ||
194 | + } | ||
195 | + }else{ | ||
196 | + if(substr($det_matricula['data_matricula'], 0, 10) > $this->data_cancel){ | ||
197 | + $this->mensagem = "Data de abandono não pode ser inferior a data da matrícula.<br>"; | ||
198 | + return false; | ||
199 | + die(); | ||
200 | + } | ||
201 | + } | ||
202 | + $editou = $obj->edita(); | ||
203 | + | ||
204 | + $obj->data_cancel = $this->data_cancel; | ||
182 | if ($this->transferencia_tipo == 2) | 205 | if ($this->transferencia_tipo == 2) |
183 | { | 206 | { |
184 | $this->data_transferencia = date("Y-m-d"); | 207 | $this->data_transferencia = date("Y-m-d"); |
@@ -222,6 +245,11 @@ class indice extends clsCadastro | @@ -222,6 +245,11 @@ class indice extends clsCadastro | ||
222 | $cadastrou = $obj->cadastra(); | 245 | $cadastrou = $obj->cadastra(); |
223 | if( $cadastrou ) | 246 | if( $cadastrou ) |
224 | { | 247 | { |
248 | + | ||
249 | + $obj = new clsPmieducarMatricula( $this->ref_cod_matricula, null,null,null,$this->pessoa_logada); | ||
250 | + $det_matricula = $obj->detalhe(); | ||
251 | + $obj->data_cancel = $this->data_cancel; | ||
252 | + $obj->edita(); | ||
225 | $this->mensagem .= "Cadastro efetuado com sucesso.<br>"; | 253 | $this->mensagem .= "Cadastro efetuado com sucesso.<br>"; |
226 | header( "Location: educar_matricula_det.php?cod_matricula={$this->ref_cod_matricula}" ); | 254 | header( "Location: educar_matricula_det.php?cod_matricula={$this->ref_cod_matricula}" ); |
227 | die(); | 255 | die(); |
ieducar/intranet/include/pmieducar/clsPmieducarMatricula.inc.php
@@ -61,6 +61,8 @@ class clsPmieducarMatricula | @@ -61,6 +61,8 @@ class clsPmieducarMatricula | ||
61 | var $formando; | 61 | var $formando; |
62 | var $ref_cod_curso; | 62 | var $ref_cod_curso; |
63 | var $semestre; | 63 | var $semestre; |
64 | + var $data_matricula; | ||
65 | + var $data_cancel; | ||
64 | 66 | ||
65 | /** | 67 | /** |
66 | * caso seja a primeira matricula do aluno | 68 | * caso seja a primeira matricula do aluno |
@@ -132,13 +134,14 @@ class clsPmieducarMatricula | @@ -132,13 +134,14 @@ class clsPmieducarMatricula | ||
132 | $data_cadastro = NULL, $data_exclusao = NULL, $ativo = NULL, $ano = NULL, | 134 | $data_cadastro = NULL, $data_exclusao = NULL, $ativo = NULL, $ano = NULL, |
133 | $ultima_matricula = NULL, $modulo = NULL, $formando = NULL, | 135 | $ultima_matricula = NULL, $modulo = NULL, $formando = NULL, |
134 | $descricao_reclassificacao = NULL, $matricula_reclassificacao = NULL, | 136 | $descricao_reclassificacao = NULL, $matricula_reclassificacao = NULL, |
135 | - $ref_cod_curso = NULL, $matricula_transferencia = NULL, $semestre = NULL | 137 | + $ref_cod_curso = NULL, $matricula_transferencia = NULL, $semestre = NULL, |
138 | + $data_matricula = NULL, $data_cancel = NULL | ||
136 | ) { | 139 | ) { |
137 | $db = new clsBanco(); | 140 | $db = new clsBanco(); |
138 | $this->_schema = 'pmieducar.'; | 141 | $this->_schema = 'pmieducar.'; |
139 | $this->_tabela = $this->_schema . 'matricula'; | 142 | $this->_tabela = $this->_schema . 'matricula'; |
140 | 143 | ||
141 | - $this->_campos_lista = $this->_todos_campos = "m.cod_matricula, m.ref_cod_reserva_vaga, m.ref_ref_cod_escola, m.ref_ref_cod_serie, m.ref_usuario_exc, m.ref_usuario_cad, m.ref_cod_aluno, m.aprovado, m.data_cadastro, m.data_exclusao, m.ativo, m.ano, m.ultima_matricula, m.modulo,formando,descricao_reclassificacao,matricula_reclassificacao, m.ref_cod_curso,m.matricula_transferencia,m.semestre"; | 144 | + $this->_campos_lista = $this->_todos_campos = "m.cod_matricula, m.ref_cod_reserva_vaga, m.ref_ref_cod_escola, m.ref_ref_cod_serie, m.ref_usuario_exc, m.ref_usuario_cad, m.ref_cod_aluno, m.aprovado, m.data_cadastro, m.data_exclusao, m.ativo, m.ano, m.ultima_matricula, m.modulo,formando,descricao_reclassificacao,matricula_reclassificacao, m.ref_cod_curso,m.matricula_transferencia,m.semestre, m.data_matricula, m.data_cancel"; |
142 | 145 | ||
143 | if (is_numeric($ref_usuario_exc)) { | 146 | if (is_numeric($ref_usuario_exc)) { |
144 | if (class_exists("clsPmieducarUsuario")) { | 147 | if (class_exists("clsPmieducarUsuario")) { |
@@ -304,6 +307,13 @@ class clsPmieducarMatricula | @@ -304,6 +307,13 @@ class clsPmieducarMatricula | ||
304 | if (is_numeric($semestre)) { | 307 | if (is_numeric($semestre)) { |
305 | $this->semestre = $semestre; | 308 | $this->semestre = $semestre; |
306 | } | 309 | } |
310 | + if (is_string($data_matricula)) { | ||
311 | + $this->data_matricula = $data_matricula; | ||
312 | + } | ||
313 | + | ||
314 | + if (is_string($data_cancel)) { | ||
315 | + $this->data_cancel = $data_cancel; | ||
316 | + } | ||
307 | } | 317 | } |
308 | 318 | ||
309 | /** | 319 | /** |
@@ -420,6 +430,18 @@ class clsPmieducarMatricula | @@ -420,6 +430,18 @@ class clsPmieducarMatricula | ||
420 | $gruda = ", "; | 430 | $gruda = ", "; |
421 | } | 431 | } |
422 | 432 | ||
433 | + if (is_string($this->data_matricula)) { | ||
434 | + $campos .= "{$gruda}data_matricula"; | ||
435 | + $valores .= "{$gruda}'{$this->data_matricula}'"; | ||
436 | + $gruda = ", "; | ||
437 | + } | ||
438 | + | ||
439 | + if (is_string($this->data_cancel)) { | ||
440 | + $campos .= "{$gruda}data_cancel"; | ||
441 | + $valores .= "{$gruda}'{$this->data_cancel}'"; | ||
442 | + $gruda = ", "; | ||
443 | + } | ||
444 | + | ||
423 | $db->Consulta("INSERT INTO {$this->_tabela} ($campos) VALUES ($valores)"); | 445 | $db->Consulta("INSERT INTO {$this->_tabela} ($campos) VALUES ($valores)"); |
424 | return $db->InsertId("{$this->_tabela}_cod_matricula_seq"); | 446 | return $db->InsertId("{$this->_tabela}_cod_matricula_seq"); |
425 | } | 447 | } |
@@ -533,6 +555,16 @@ class clsPmieducarMatricula | @@ -533,6 +555,16 @@ class clsPmieducarMatricula | ||
533 | $gruda = ", "; | 555 | $gruda = ", "; |
534 | } | 556 | } |
535 | 557 | ||
558 | + if (is_string($this->data_matricula)) { | ||
559 | + $set .= "{$gruda}data_matricula = '{$this->data_matricula}'"; | ||
560 | + $gruda = ", "; | ||
561 | + } | ||
562 | + | ||
563 | + if (is_string($this->data_cancel)) { | ||
564 | + $set .= "{$gruda}data_cancel = '{$this->data_cancel}'"; | ||
565 | + $gruda = ", "; | ||
566 | + } | ||
567 | + | ||
536 | if ($set) { | 568 | if ($set) { |
537 | $db->Consulta("UPDATE {$this->_tabela} SET $set WHERE cod_matricula = '{$this->cod_matricula}'"); | 569 | $db->Consulta("UPDATE {$this->_tabela} SET $set WHERE cod_matricula = '{$this->cod_matricula}'"); |
538 | return TRUE; | 570 | return TRUE; |
ieducar/misc/database/deltas/portabilis/66_cria_colunas_data_processos_matricula.sql
0 → 100644
@@ -0,0 +1,43 @@ | @@ -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 | \ No newline at end of file | 44 | \ No newline at end of file |
ieducar/modules/Api/Views/AlunoController.php
@@ -528,7 +528,7 @@ protected function createOrUpdateUniforme($id) { | @@ -528,7 +528,7 @@ protected function createOrUpdateUniforme($id) { | ||
528 | /* | 528 | /* |
529 | $sql = "select to_char(data_transferencia, 'DD/MM/YYYY') from | 529 | $sql = "select to_char(data_transferencia, 'DD/MM/YYYY') from |
530 | pmieducar.transferencia_solicitacao where ref_cod_matricula_entrada = $1 and ativo = 1";*/ | 530 | pmieducar.transferencia_solicitacao where ref_cod_matricula_entrada = $1 and ativo = 1";*/ |
531 | - $sql = "select to_char(data_cadastro, 'DD/MM/YYYY') from pmieducar.matricula | 531 | + $sql = "select COALESCE(to_char(data_matricula,'DD/MM/YYYY'), to_char(data_cadastro, 'DD/MM/YYYY')) from pmieducar.matricula |
532 | where cod_matricula=$1 and ativo = 1"; | 532 | where cod_matricula=$1 and ativo = 1"; |
533 | 533 | ||
534 | return Portabilis_Utils_Database::selectField($sql, $matriculaId); | 534 | return Portabilis_Utils_Database::selectField($sql, $matriculaId); |
@@ -546,7 +546,7 @@ protected function createOrUpdateUniforme($id) { | @@ -546,7 +546,7 @@ protected function createOrUpdateUniforme($id) { | ||
546 | protected function loadTransferenciaDataSaida($matriculaId) { | 546 | protected function loadTransferenciaDataSaida($matriculaId) { |
547 | /*$sql = "select to_char(data_transferencia, 'DD/MM/YYYY') from | 547 | /*$sql = "select to_char(data_transferencia, 'DD/MM/YYYY') from |
548 | pmieducar.transferencia_solicitacao where ref_cod_matricula_saida = $1 and ativo = 1";*/ | 548 | pmieducar.transferencia_solicitacao where ref_cod_matricula_saida = $1 and ativo = 1";*/ |
549 | - $sql = "select to_char(data_exclusao, 'DD/MM/YYYY') from pmieducar.matricula | 549 | + $sql = "select COALESCE(to_char(data_cancel,'DD/MM/YYYY'), to_char(data_exclusao, 'DD/MM/YYYY')) from pmieducar.matricula |
550 | where cod_matricula=$1 and ativo = 1 and (aprovado=4 or aprovado=6)"; | 550 | where cod_matricula=$1 and ativo = 1 and (aprovado=4 or aprovado=6)"; |
551 | 551 | ||
552 | return Portabilis_Utils_Database::selectField($sql, $matriculaId); | 552 | return Portabilis_Utils_Database::selectField($sql, $matriculaId); |
ieducar/modules/Cadastro/Assets/Javascripts/AlunoShow.js
@@ -47,6 +47,9 @@ var handleGetMatriculas = function(dataResponse) { | @@ -47,6 +47,9 @@ var handleGetMatriculas = function(dataResponse) { | ||
47 | else | 47 | else |
48 | var linkToMatricula = ''; | 48 | var linkToMatricula = ''; |
49 | 49 | ||
50 | + if (!matricula.transferencia_em_aberto && matricula.situacao == 'Em andamento') | ||
51 | + matricula.data_saida = ''; | ||
52 | + | ||
50 | $j('<td>').html(linkToMatricula).appendTo($tr).addClass('center'); | 53 | $j('<td>').html(linkToMatricula).appendTo($tr).addClass('center'); |
51 | $j('<td>').html(matricula.ano).appendTo($tr); | 54 | $j('<td>').html(matricula.ano).appendTo($tr); |
52 | $j('<td>').html(matricula.situacao).appendTo($tr); | 55 | $j('<td>').html(matricula.situacao).appendTo($tr); |
ieducar/modules/Portabilis/Assets/Version.php
@@ -4,7 +4,7 @@ | @@ -4,7 +4,7 @@ | ||
4 | usado pelo metodos loadJavascript e loadStylesheet do helper Portabilis_View_Helper_Application */ | 4 | usado pelo metodos loadJavascript e loadStylesheet do helper Portabilis_View_Helper_Application */ |
5 | 5 | ||
6 | class Portabilis_Assets_Version { | 6 | class Portabilis_Assets_Version { |
7 | - const VERSION = '6'; | 7 | + const VERSION = '7'; |
8 | } | 8 | } |
9 | 9 | ||
10 | ?> | 10 | ?> |