From 9189a442ac5da98b8db8882c6fe6d95d26a2894c Mon Sep 17 00:00:00 2001 From: Lucas Schmoeller da Silva Date: Wed, 18 Mar 2015 11:41:01 -0300 Subject: [PATCH] Alterado simpleSearchMatricula --- ieducar/modules/Api/Views/MatriculaController.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ieducar/modules/Api/Views/MatriculaController.php b/ieducar/modules/Api/Views/MatriculaController.php index 3f86696..69e906d 100644 --- a/ieducar/modules/Api/Views/MatriculaController.php +++ b/ieducar/modules/Api/Views/MatriculaController.php @@ -61,26 +61,26 @@ class MatriculaController extends ApiCoreController // seleciona por (codigo matricula ou codigo aluno), opcionalmente por codigo escola e // opcionalmente por ano. return "select distinct ON (aluno.cod_aluno) aluno.cod_aluno as aluno_id, - matricula.cod_matricula as id, pessoa.nome as name from pmieducar.matricula, + max(matricula.cod_matricula) as id, pessoa.nome as name from pmieducar.matricula, pmieducar.aluno, cadastro.pessoa where aluno.cod_aluno = matricula.ref_cod_aluno and pessoa.idpes = aluno.ref_idpes and aluno.ativo = matricula.ativo and matricula.ativo = 1 and matricula.aprovado in (1, 2, 3, 4, 7, 8, 9) and (matricula.cod_matricula like $1||'%' or matricula.ref_cod_aluno like $1||'%') and (select case when $2 != 0 then matricula.ref_ref_cod_escola = $2 else 1=1 end) and - (select case when $3 != 0 then matricula.ano = $3 else 1=1 end) limit 15"; + (select case when $3 != 0 then matricula.ano = $3 else 1=1 end) group by aluno.cod_aluno, pessoa.nome limit 15"; } protected function sqlsForStringSearch() { // seleciona por nome aluno, opcionalmente por codigo escola e opcionalmente por ano. return "select distinct ON (aluno.cod_aluno) aluno.cod_aluno as aluno_id, - matricula.cod_matricula as id, pessoa.nome as name from pmieducar.matricula, + max(matricula.cod_matricula) as id, pessoa.nome as name from pmieducar.matricula, pmieducar.aluno, cadastro.pessoa where aluno.cod_aluno = matricula.ref_cod_aluno and pessoa.idpes = aluno.ref_idpes and aluno.ativo = matricula.ativo and matricula.ativo = 1 and matricula.aprovado in (1, 2, 3, 4, 7, 8, 9) and lower(to_ascii(pessoa.nome)) like lower(to_ascii($1))||'%' and (select case when $2 != 0 then matricula.ref_ref_cod_escola = $2 else 1=1 end) and - (select case when $3 != 0 then matricula.ano = $3 else 1=1 end) limit 15"; + (select case when $3 != 0 then matricula.ano = $3 else 1=1 end) group by aluno.cod_aluno, pessoa.nome limit 15"; } -- libgit2 0.21.2