Commit ccb6c43569b6a5014675cc43dec99b7142c9d1c3
1 parent
1fb9390d
Exists in
master
Ajustado busca de aluno;
portabilis/ieducar#167
Showing
1 changed file
with
17 additions
and
17 deletions
Show diff stats
ieducar/modules/Api/Views/AlunoController.php
@@ -278,7 +278,7 @@ class AlunoController extends ApiCoreController | @@ -278,7 +278,7 @@ class AlunoController extends ApiCoreController | ||
278 | } | 278 | } |
279 | 279 | ||
280 | protected function createOrUpdateFichaMedica($id) { | 280 | protected function createOrUpdateFichaMedica($id) { |
281 | - | 281 | + |
282 | $obj = new clsModulesFichaMedicaAluno(); | 282 | $obj = new clsModulesFichaMedicaAluno(); |
283 | 283 | ||
284 | $obj->ref_cod_aluno = $id; | 284 | $obj->ref_cod_aluno = $id; |
@@ -289,7 +289,7 @@ class AlunoController extends ApiCoreController | @@ -289,7 +289,7 @@ class AlunoController extends ApiCoreController | ||
289 | $obj->alergia_medicamento = ($this->getRequest()->alergia_medicamento == 'on' ? 'S' : 'N'); | 289 | $obj->alergia_medicamento = ($this->getRequest()->alergia_medicamento == 'on' ? 'S' : 'N'); |
290 | $obj->desc_alergia_medicamento = Portabilis_String_Utils::toLatin1($this->getRequest()->desc_alergia_medicamento); | 290 | $obj->desc_alergia_medicamento = Portabilis_String_Utils::toLatin1($this->getRequest()->desc_alergia_medicamento); |
291 | $obj->alergia_alimento = ($this->getRequest()->alergia_alimento == 'on' ? 'S' : 'N'); | 291 | $obj->alergia_alimento = ($this->getRequest()->alergia_alimento == 'on' ? 'S' : 'N'); |
292 | - $obj->desc_alergia_alimento = Portabilis_String_Utils::toLatin1($this->getRequest()->desc_alergia_alimento); | 292 | + $obj->desc_alergia_alimento = Portabilis_String_Utils::toLatin1($this->getRequest()->desc_alergia_alimento); |
293 | $obj->doenca_congenita = ($this->getRequest()->doenca_congenita == 'on' ? 'S' : 'N'); | 293 | $obj->doenca_congenita = ($this->getRequest()->doenca_congenita == 'on' ? 'S' : 'N'); |
294 | $obj->desc_doenca_congenita = Portabilis_String_Utils::toLatin1($this->getRequest()->desc_doenca_congenita); | 294 | $obj->desc_doenca_congenita = Portabilis_String_Utils::toLatin1($this->getRequest()->desc_doenca_congenita); |
295 | $obj->fumante = ($this->getRequest()->fumante == 'on' ? 'S' : 'N'); | 295 | $obj->fumante = ($this->getRequest()->fumante == 'on' ? 'S' : 'N'); |
@@ -330,15 +330,15 @@ class AlunoController extends ApiCoreController | @@ -330,15 +330,15 @@ class AlunoController extends ApiCoreController | ||
330 | $obj->responsavel_parentesco_celular = Portabilis_String_Utils::toLatin1($this->getRequest()->responsavel_parentesco_celular); | 330 | $obj->responsavel_parentesco_celular = Portabilis_String_Utils::toLatin1($this->getRequest()->responsavel_parentesco_celular); |
331 | 331 | ||
332 | return ($obj->existe() ? $obj->edita() : $obj->cadastra()); | 332 | return ($obj->existe() ? $obj->edita() : $obj->cadastra()); |
333 | - } | 333 | + } |
334 | 334 | ||
335 | protected function createOrUpdateUniforme($id) { | 335 | protected function createOrUpdateUniforme($id) { |
336 | - | 336 | + |
337 | $obj = new clsModulesUniformeAluno(); | 337 | $obj = new clsModulesUniformeAluno(); |
338 | 338 | ||
339 | $obj->ref_cod_aluno = $id; | 339 | $obj->ref_cod_aluno = $id; |
340 | $obj->recebeu_uniforme = ($this->getRequest()->recebeu_uniforme == 'on' ? 'S' : 'N'); | 340 | $obj->recebeu_uniforme = ($this->getRequest()->recebeu_uniforme == 'on' ? 'S' : 'N'); |
341 | - | 341 | + |
342 | $obj->quantidade_camiseta = $this->getRequest()->quantidade_camiseta; | 342 | $obj->quantidade_camiseta = $this->getRequest()->quantidade_camiseta; |
343 | $obj->tamanho_camiseta = Portabilis_String_Utils::toLatin1($this->getRequest()->tamanho_camiseta); | 343 | $obj->tamanho_camiseta = Portabilis_String_Utils::toLatin1($this->getRequest()->tamanho_camiseta); |
344 | 344 | ||
@@ -358,17 +358,17 @@ protected function createOrUpdateUniforme($id) { | @@ -358,17 +358,17 @@ protected function createOrUpdateUniforme($id) { | ||
358 | $obj->tamanho_calcado = Portabilis_String_Utils::toLatin1($this->getRequest()->tamanho_calcado); | 358 | $obj->tamanho_calcado = Portabilis_String_Utils::toLatin1($this->getRequest()->tamanho_calcado); |
359 | 359 | ||
360 | $obj->quantidade_blusa_jaqueta = $this->getRequest()->quantidade_blusa_jaqueta; | 360 | $obj->quantidade_blusa_jaqueta = $this->getRequest()->quantidade_blusa_jaqueta; |
361 | - $obj->tamanho_blusa_jaqueta = Portabilis_String_Utils::toLatin1($this->getRequest()->tamanho_blusa_jaqueta); | 361 | + $obj->tamanho_blusa_jaqueta = Portabilis_String_Utils::toLatin1($this->getRequest()->tamanho_blusa_jaqueta); |
362 | 362 | ||
363 | return ($obj->existe() ? $obj->edita() : $obj->cadastra()); | 363 | return ($obj->existe() ? $obj->edita() : $obj->cadastra()); |
364 | - } | 364 | + } |
365 | 365 | ||
366 | protected function createOrUpdateMoradia($id) { | 366 | protected function createOrUpdateMoradia($id) { |
367 | - | 367 | + |
368 | $obj = new clsModulesMoradiaAluno(); | 368 | $obj = new clsModulesMoradiaAluno(); |
369 | 369 | ||
370 | $obj->ref_cod_aluno = $id; | 370 | $obj->ref_cod_aluno = $id; |
371 | - | 371 | + |
372 | $obj->moradia = $this->getRequest()->moradia; | 372 | $obj->moradia = $this->getRequest()->moradia; |
373 | $obj->material = $this->getRequest()->material; | 373 | $obj->material = $this->getRequest()->material; |
374 | $obj->casa_outra = Portabilis_String_Utils::toLatin1($this->getRequest()->casa_outra); | 374 | $obj->casa_outra = Portabilis_String_Utils::toLatin1($this->getRequest()->casa_outra); |
@@ -400,7 +400,7 @@ protected function createOrUpdateUniforme($id) { | @@ -400,7 +400,7 @@ protected function createOrUpdateUniforme($id) { | ||
400 | $obj->lixo = ($this->getRequest()->lixo == 'on' ? 'S' : 'N'); | 400 | $obj->lixo = ($this->getRequest()->lixo == 'on' ? 'S' : 'N'); |
401 | 401 | ||
402 | return ($obj->existe() ? $obj->edita() : $obj->cadastra()); | 402 | return ($obj->existe() ? $obj->edita() : $obj->cadastra()); |
403 | - } | 403 | + } |
404 | 404 | ||
405 | protected function loadAlunoInepId($alunoId) { | 405 | protected function loadAlunoInepId($alunoId) { |
406 | $dataMapper = $this->getDataMapperFor('educacenso', 'aluno'); | 406 | $dataMapper = $this->getDataMapperFor('educacenso', 'aluno'); |
@@ -542,8 +542,8 @@ protected function createOrUpdateUniforme($id) { | @@ -542,8 +542,8 @@ protected function createOrUpdateUniforme($id) { | ||
542 | } | 542 | } |
543 | 543 | ||
544 | protected function loadNomeTurmaOrigem($matriculaId) { | 544 | protected function loadNomeTurmaOrigem($matriculaId) { |
545 | - $sql = "select nm_turma from pmieducar.matricula_turma mt | ||
546 | - left join pmieducar.turma t on (t.cod_turma = mt.ref_cod_turma) | 545 | + $sql = "select nm_turma from pmieducar.matricula_turma mt |
546 | + left join pmieducar.turma t on (t.cod_turma = mt.ref_cod_turma) | ||
547 | where ref_cod_matricula = $1 and mt.ativo = 0 and mt.ref_cod_turma <> COALESCE((select ref_cod_turma from pmieducar.matricula_turma | 547 | where ref_cod_matricula = $1 and mt.ativo = 0 and mt.ref_cod_turma <> COALESCE((select ref_cod_turma from pmieducar.matricula_turma |
548 | where ref_cod_matricula = $1 and ativo = 1 limit 1),0) order by mt.data_exclusao desc limit 1"; | 548 | where ref_cod_matricula = $1 and ativo = 1 limit 1),0) order by mt.data_exclusao desc limit 1"; |
549 | 549 | ||
@@ -649,7 +649,7 @@ protected function createOrUpdateUniforme($id) { | @@ -649,7 +649,7 @@ protected function createOrUpdateUniforme($id) { | ||
649 | if (! $this->getRequest()->escola_id) { | 649 | if (! $this->getRequest()->escola_id) { |
650 | $sqls[] = "select distinct aluno.cod_aluno as id, pessoa.nome as name from | 650 | $sqls[] = "select distinct aluno.cod_aluno as id, pessoa.nome as name from |
651 | pmieducar.aluno, cadastro.pessoa where pessoa.idpes = aluno.ref_idpes | 651 | pmieducar.aluno, cadastro.pessoa where pessoa.idpes = aluno.ref_idpes |
652 | - and aluno.ativo = 1 and aluno.cod_aluno like $1||'%' and $2 = $2 | 652 | + and aluno.ativo = 1 and aluno.cod_aluno::varchar like $1||'%' and $2 = $2 |
653 | order by cod_aluno limit 15"; | 653 | order by cod_aluno limit 15"; |
654 | } | 654 | } |
655 | 655 | ||
@@ -661,7 +661,7 @@ protected function createOrUpdateUniforme($id) { | @@ -661,7 +661,7 @@ protected function createOrUpdateUniforme($id) { | ||
661 | pessoa.idpes = aluno.ref_idpes and aluno.ativo = matricula.ativo and | 661 | pessoa.idpes = aluno.ref_idpes and aluno.ativo = matricula.ativo and |
662 | matricula.ativo = 1 and | 662 | matricula.ativo = 1 and |
663 | (select case when $2 != 0 then matricula.ref_ref_cod_escola = $2 else 1=1 end) and | 663 | (select case when $2 != 0 then matricula.ref_ref_cod_escola = $2 else 1=1 end) and |
664 | - (matricula.cod_matricula like $1||'%' or matricula.ref_cod_aluno like $1||'%') and | 664 | + (matricula.cod_matricula::varchar like $1||'%' or matricula.ref_cod_aluno::varchar like $1||'%') and |
665 | matricula.aprovado in (1, 2, 3, 4, 7, 8, 9) limit 15) as alunos order by id"; | 665 | matricula.aprovado in (1, 2, 3, 4, 7, 8, 9) limit 15) as alunos order by id"; |
666 | 666 | ||
667 | return $sqls; | 667 | return $sqls; |
@@ -677,7 +677,7 @@ protected function createOrUpdateUniforme($id) { | @@ -677,7 +677,7 @@ protected function createOrUpdateUniforme($id) { | ||
677 | $sqls[] = "select distinct aluno.cod_aluno as id, | 677 | $sqls[] = "select distinct aluno.cod_aluno as id, |
678 | pessoa.nome as name from pmieducar.aluno, cadastro.pessoa where | 678 | pessoa.nome as name from pmieducar.aluno, cadastro.pessoa where |
679 | pessoa.idpes = aluno.ref_idpes and aluno.ativo = 1 and | 679 | pessoa.idpes = aluno.ref_idpes and aluno.ativo = 1 and |
680 | - lower(to_ascii(pessoa.nome)) like lower(to_ascii($1))||'%' and $2 = $2 | 680 | + lower(pessoa.nome) like lower($1)||'%' and $2 = $2 |
681 | order by nome limit 15"; | 681 | order by nome limit 15"; |
682 | } | 682 | } |
683 | 683 | ||
@@ -689,7 +689,7 @@ protected function createOrUpdateUniforme($id) { | @@ -689,7 +689,7 @@ protected function createOrUpdateUniforme($id) { | ||
689 | pessoa.idpes = aluno.ref_idpes and aluno.ativo = matricula.ativo and | 689 | pessoa.idpes = aluno.ref_idpes and aluno.ativo = matricula.ativo and |
690 | matricula.ativo = 1 and (select case when $2 != 0 then matricula.ref_ref_cod_escola = $2 | 690 | matricula.ativo = 1 and (select case when $2 != 0 then matricula.ref_ref_cod_escola = $2 |
691 | else 1=1 end) and | 691 | else 1=1 end) and |
692 | - lower(to_ascii(pessoa.nome)) like lower(to_ascii($1))||'%' and matricula.aprovado in | 692 | + lower(pessoa.nome) like lower($1)||'%' and matricula.aprovado in |
693 | (1, 2, 3, 4, 7, 8, 9) limit 15) as alunos order by name"; | 693 | (1, 2, 3, 4, 7, 8, 9) limit 15) as alunos order by name"; |
694 | 694 | ||
695 | return $sqls; | 695 | return $sqls; |
@@ -1009,4 +1009,4 @@ protected function createOrUpdateUniforme($id) { | @@ -1009,4 +1009,4 @@ protected function createOrUpdateUniforme($id) { | ||
1009 | else | 1009 | else |
1010 | $this->notImplementedOperationError(); | 1010 | $this->notImplementedOperationError(); |
1011 | } | 1011 | } |
1012 | -} | ||
1013 | \ No newline at end of file | 1012 | \ No newline at end of file |
1013 | +} |