Commit 204244a74daa15e628a0239cada09bf85f0e758d
1 parent
ad212b4d
Exists in
master
Alterado ordenação de alunos
Ordenação de nome de alunos não funcionava corretamente em caso de acentuações; portabilis/ieducar#51
Showing
3 changed files
with
8 additions
and
12 deletions
Show diff stats
ieducar/intranet/include/pmieducar/clsPmieducarMatriculaTurma.inc.php
... | ... | @@ -361,14 +361,10 @@ class clsPmieducarMatriculaTurma |
361 | 361 | $pegar_ano_em_andamento = FALSE, $parar=NULL) |
362 | 362 | { |
363 | 363 | if ($bool_get_nome_aluno === true) { |
364 | - $nome = " ,(SELECT (nome) | |
365 | - FROM cadastro.pessoa | |
366 | - WHERE idpes = a.ref_idpes | |
367 | - ) as nome_aluno"; | |
368 | - $tab_aluno = ", {$this->_schema}aluno a"; | |
369 | - | |
370 | - $where_nm_aluno = " AND a.cod_aluno = m.ref_cod_aluno AND a.ativo=1"; | |
364 | + $nome = " ,pessoa.nome as nome_aluno"; | |
371 | 365 | } |
366 | + $tab_aluno = ", {$this->_schema}aluno a"; | |
367 | + $where_nm_aluno = " AND a.cod_aluno = m.ref_cod_aluno AND a.ativo=1"; | |
372 | 368 | |
373 | 369 | if ( $bool_escola_andamento) { |
374 | 370 | if ($pegar_ano_em_andamento) { |
... | ... | @@ -392,10 +388,10 @@ class clsPmieducarMatriculaTurma |
392 | 388 | } |
393 | 389 | } |
394 | 390 | |
395 | - $sql = "SELECT {$this->_campos_lista}, c.nm_curso, t.nm_turma, i.nm_instituicao, m.ref_ref_cod_serie, m.ref_cod_curso, m.ref_ref_cod_escola, c.ref_cod_instituicao, m.ref_cod_aluno,t.hora_inicial $nome FROM {$this->_tabela} mt, {$this->_schema}matricula m, {$this->_schema}curso c, {$this->_schema}turma t, {$this->_schema}instituicao i{$tab_aluno} {$from}"; | |
391 | + $sql = "SELECT {$this->_campos_lista}, c.nm_curso, t.nm_turma, i.nm_instituicao, m.ref_ref_cod_serie, m.ref_cod_curso, m.ref_ref_cod_escola, c.ref_cod_instituicao, m.ref_cod_aluno,t.hora_inicial $nome FROM {$this->_tabela} mt, {$this->_schema}matricula m, {$this->_schema}curso c, {$this->_schema}turma t, {$this->_schema}instituicao i{$tab_aluno} {$from}, cadastro.pessoa "; | |
396 | 392 | |
397 | 393 | $whereAnd = " AND "; |
398 | - $filtros = " WHERE mt.ref_cod_matricula = m.cod_matricula AND m.ref_cod_curso = c.cod_curso AND t.cod_turma = mt.ref_cod_turma AND i.cod_instituicao = c.ref_cod_instituicao {$where_nm_aluno} {$where}"; | |
394 | + $filtros = " WHERE mt.ref_cod_matricula = m.cod_matricula AND idpes = a.ref_idpes AND m.ref_cod_curso = c.cod_curso AND t.cod_turma = mt.ref_cod_turma AND i.cod_instituicao = c.ref_cod_instituicao {$where_nm_aluno} {$where}"; | |
399 | 395 | |
400 | 396 | if (is_numeric($int_ref_cod_matricula)) { |
401 | 397 | $filtros .= "{$whereAnd} mt.ref_cod_matricula = '{$int_ref_cod_matricula}'"; |
... | ... | @@ -578,7 +574,7 @@ class clsPmieducarMatriculaTurma |
578 | 574 | die($sql); |
579 | 575 | } |
580 | 576 | |
581 | - $this->_total = $db->CampoUnico("SELECT COUNT(0) FROM {$this->_tabela} mt, {$this->_schema}matricula m, {$this->_schema}curso c, {$this->_schema}turma t, {$this->_schema}instituicao i{$tab_aluno} {$from} {$filtros} {$where}"); | |
577 | + $this->_total = $db->CampoUnico("SELECT COUNT(0) FROM {$this->_tabela} mt, cadastro.pessoa, {$this->_schema}matricula m, {$this->_schema}curso c, {$this->_schema}turma t, {$this->_schema}instituicao i{$tab_aluno} {$from} {$filtros} {$where}"); | |
582 | 578 | $db->Consulta($sql); |
583 | 579 | |
584 | 580 | if ($countCampos > 1) { | ... | ... |
ieducar/modules/Avaliacao/Views/DiarioApiController.php
... | ... | @@ -534,7 +534,7 @@ class DiarioApiController extends ApiCoreController |
534 | 534 | |
535 | 535 | if ($this->canGetMatriculas()) { |
536 | 536 | $alunos = new clsPmieducarMatriculaTurma(); |
537 | - $alunos->setOrderby('nome'); | |
537 | + $alunos->setOrderby("translate(pessoa.nome,'".Portabilis_String_Utils::toLatin1(åáàãâäéèêëíìîïóòõôöúùüûçÿýñÅÁÀÃÂÄÉÈÊËÍÌÎÏÓÒÕÔÖÚÙÛÜÇÝÑ)."', '".Portabilis_String_Utils::toLatin1(aaaaaaeeeeiiiiooooouuuucyynAAAAAAEEEEIIIIOOOOOUUUUCYN)."')"); | |
538 | 538 | |
539 | 539 | $alunos = $alunos->lista( |
540 | 540 | $this->getRequest()->matricula_id, | ... | ... |
ieducar/modules/DynamicInput/Views/MatriculaController.php
... | ... | @@ -57,7 +57,7 @@ class MatriculaController extends ApiCoreController |
57 | 57 | protected function getMatriculas() { |
58 | 58 | if ($this->canGetMatriculas()) { |
59 | 59 | $matriculas = new clsPmieducarMatricula(); |
60 | - $matriculas->setOrderby('nome ASC, cod_matricula'); | |
60 | + $matriculas->setOrderby(" translate(nome,'".Portabilis_String_Utils::toLatin1(åáàãâäéèêëíìîïóòõôöúùüûçÿýñÅÁÀÃÂÄÉÈÊËÍÌÎÏÓÒÕÔÖÚÙÛÜÇÝÑ)."', '".Portabilis_String_Utils::toLatin1(aaaaaaeeeeiiiiooooouuuucyynAAAAAAEEEEIIIIOOOOOUUUUCYN)."') "); | |
61 | 61 | $matriculas = $matriculas->lista(NULL, |
62 | 62 | NULL, |
63 | 63 | $this->getRequest()->escola_id, | ... | ... |