Commit 4573cabb27c117ffbc64a897dc04d5e6160a159b
1 parent
738ccd8b
Exists in
master
Alterado tipo de dados do campo aluno_estado_id em aluno, de integer para varcha…
…r, compatibilizando diferentes formatos de códigos, tanto numericos como alfanumericos.
Showing
3 changed files
with
23 additions
and
5 deletions
Show diff stats
ieducar/intranet/include/pmieducar/clsPmieducarAluno.inc.php
... | ... | @@ -319,7 +319,7 @@ class clsPmieducarAluno |
319 | 319 | $gruda = ', '; |
320 | 320 | } |
321 | 321 | |
322 | - if (is_numeric($this->aluno_estado_id)) { | |
322 | + if ($this->aluno_estado_id) { | |
323 | 323 | $campos .= "{$gruda}aluno_estado_id"; |
324 | 324 | $valores .= "{$gruda}'{$this->aluno_estado_id}'"; |
325 | 325 | $gruda = ', '; |
... | ... | @@ -421,11 +421,11 @@ class clsPmieducarAluno |
421 | 421 | $gruda = ', '; |
422 | 422 | } |
423 | 423 | |
424 | - if (is_numeric($this->aluno_estado_id)) { | |
424 | + if ($this->aluno_estado_id) { | |
425 | 425 | $set .= "{$gruda}aluno_estado_id = '{$this->aluno_estado_id}'"; |
426 | 426 | $gruda = ', '; |
427 | 427 | } |
428 | - elseif ($this->aluno_estado_id == '') { | |
428 | + else { | |
429 | 429 | $set .= "{$gruda}aluno_estado_id = NULL"; |
430 | 430 | $gruda = ', '; |
431 | 431 | } | ... | ... |
ieducar/misc/database/deltas/portabilis/50_altera_tipo_aluno_estado_id_para_varchar_em_aluno.sql
0 → 100644
... | ... | @@ -0,0 +1,18 @@ |
1 | + -- // | |
2 | + | |
3 | + -- | |
4 | + -- Altera tipo de dados da coluna aluno_estado_id, da tabela pmieducar.aluno, | |
5 | + -- de modo que o campo seja compativel com diferentes formatos de código. | |
6 | + -- | |
7 | + -- @author Lucas D'Avila <lucasdavila@portabilis.com.br> | |
8 | + -- @license @@license@@ | |
9 | + -- @version $Id$ | |
10 | + | |
11 | + ALTER TABLE pmieducar.aluno ALTER COLUMN aluno_estado_id type varchar(25); | |
12 | + | |
13 | + -- //@UNDO | |
14 | + | |
15 | +-- Não é possível converter uma coluna character varying para integer. Caso | |
16 | +-- necessário, um script de rotação de dados deverá ser criado. | |
17 | + | |
18 | + -- // | ... | ... |
ieducar/modules/Cadastro/Views/AlunoController.php
... | ... | @@ -136,8 +136,8 @@ class AlunoController extends Portabilis_Controller_Page_EditController |
136 | 136 | $this->inputsHelper()->integer('aluno_inep_id', $options); |
137 | 137 | |
138 | 138 | // código aluno rede estadual |
139 | - $options = array('label' => $this->_getLabel('aluno_estado_id'), 'required' => false, 'size' => 25, 'max_length' => 9); | |
140 | - $this->inputsHelper()->integer('aluno_estado_id', $options); | |
139 | + $options = array('label' => $this->_getLabel('aluno_estado_id'), 'required' => false, 'size' => 25, 'max_length' => 25); | |
140 | + $this->inputsHelper()->text('aluno_estado_id', $options); | |
141 | 141 | |
142 | 142 | // nome |
143 | 143 | $options = array('label' => $this->_getLabel('pessoa'), 'size' => 68); | ... | ... |