Commit 05bf2e6b09880fc6558e4bba8010443de01d3d2f
1 parent
8360f8f0
Exists in
master
Corrigido problema na busca numérica de pessoas;
portabilis/ieducar#167
Showing
1 changed file
with
8 additions
and
8 deletions
Show diff stats
ieducar/modules/Api/Views/PessoaController.php
| ... | ... | @@ -134,7 +134,7 @@ class PessoaController extends ApiCoreController |
| 134 | 134 | (SELECT zona_localizacao FROM cadastro.endereco_externo WHERE idpes = $2))) as zona_localizacao, |
| 135 | 135 | |
| 136 | 136 | (SELECT COALESCE((SELECT l.idmun FROM public.logradouro l, cadastro.endereco_pessoa ep WHERE l.idlog = ep.idlog and ep.idpes = $2), |
| 137 | - (SELECT idmun FROM public.logradouro l, urbano.cep_logradouro cl, cadastro.endereco_externo ee | |
| 137 | + (SELECT idmun FROM public.logradouro l, urbano.cep_logradouro cl, cadastro.endereco_externo ee | |
| 138 | 138 | WHERE cl.idlog = l.idlog AND cl.cep = ee.cep and ee.idpes = $2 order by 1 desc limit 1))) as idmun, |
| 139 | 139 | |
| 140 | 140 | idmun_nascimento, |
| ... | ... | @@ -166,7 +166,7 @@ class PessoaController extends ApiCoreController |
| 166 | 166 | $details = $this->fetchPreparedQuery($sql, array($alunoId, $pessoaId), false, 'first-row'); |
| 167 | 167 | |
| 168 | 168 | $attrs = array('cpf', 'rg', 'data_nascimento', 'pai_id', 'mae_id', 'responsavel_id', 'nome_pai', 'nome_mae', |
| 169 | - 'nome_responsavel','sexo','estadocivil', 'cep', 'logradouro', 'idtlog', 'bairro', | |
| 169 | + 'nome_responsavel','sexo','estadocivil', 'cep', 'logradouro', 'idtlog', 'bairro', | |
| 170 | 170 | 'zona_localizacao', 'idbai', 'idlog', 'idmun', 'idmun_nascimento', 'complemento', |
| 171 | 171 | 'apartamento', 'andar', 'bloco', 'numero' , 'letra'); |
| 172 | 172 | $details = Portabilis_Array_Utils::filter($details, $attrs); |
| ... | ... | @@ -244,7 +244,7 @@ class PessoaController extends ApiCoreController |
| 244 | 244 | |
| 245 | 245 | $_sql = " SELECT (select nome from cadastro.pessoa where pessoa.idpes = fisica.idpes) as nome ,ideciv as estadocivil, sexo FROM cadastro.fisica WHERE idpes = $1; "; |
| 246 | 246 | |
| 247 | - $details = $this->fetchPreparedQuery($_sql, $this->getRequest()->id, false, 'first-row'); | |
| 247 | + $details = $this->fetchPreparedQuery($_sql, $this->getRequest()->id, false, 'first-row'); | |
| 248 | 248 | |
| 249 | 249 | $details['nome'] = Portabilis_String_Utils::toUtf8($details['nome']); |
| 250 | 250 | |
| ... | ... | @@ -304,14 +304,14 @@ class PessoaController extends ApiCoreController |
| 304 | 304 | |
| 305 | 305 | // search by idpes or cpf |
| 306 | 306 | $sqls[] = "select distinct pessoa.idpes as id, pessoa.nome as name from cadastro.pessoa, |
| 307 | - cadastro.fisica where fisica.idpes = pessoa.idpes and (pessoa.idpes like $1||'%' or | |
| 308 | - trim(leading '0' from fisica.cpf) like trim(leading '0' from $1)||'%' or | |
| 309 | - fisica.cpf like $1||'%') order by id limit 15"; | |
| 307 | + cadastro.fisica where fisica.idpes = pessoa.idpes and (pessoa.idpes::varchar like $1||'%' or | |
| 308 | + trim(leading '0' from fisica.cpf::varchar) like trim(leading '0' from $1::varchar)||'%' or | |
| 309 | + fisica.cpf::varchar like $1||'%') order by id limit 15"; | |
| 310 | 310 | |
| 311 | 311 | // search by rg |
| 312 | 312 | $sqls[] = "select distinct pessoa.idpes as id, pessoa.nome as name from cadastro.pessoa, cadastro.documento |
| 313 | - where pessoa.idpes = documento.idpes and ((documento.rg like $1||'%') or | |
| 314 | - trim(leading '0' from documento.rg) like trim(leading '0' from $1)||'%') order by id limit 15"; | |
| 313 | + where pessoa.idpes = documento.idpes and ((documento.rg::varchar like $1||'%') or | |
| 314 | + trim(leading '0' from documento.rg::varchar) like trim(leading '0' from $1::varchar)||'%') order by id limit 15"; | |
| 315 | 315 | |
| 316 | 316 | return $sqls; |
| 317 | 317 | } | ... | ... |