Skip to content

Commit 91eb287

Browse files
Merge pull request #597 from leandroramos/issue_594
Issue 594
2 parents a9bda40 + 11e9cf3 commit 91eb287

3 files changed

Lines changed: 67 additions & 29 deletions

File tree

.gitignore

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,35 @@
1-
/vendor/
2-
*~
3-
*.swp
4-
src/replicado_queries
5-
composer.lock
6-
.phpunit.result.cache
7-
8-
.idea
9-
10-
# index.php used for test
11-
index.php
1+
/node_modules
2+
/public/hot
3+
/public/storage
4+
/storage/*.key
5+
/vendor
6+
/.idea
7+
/.vscode
8+
/.vagrant
9+
Homestead.json
10+
Homestead.yaml
11+
npm-debug.log
12+
yarn-error.log
1213
.env
14+
/public/vendor/
1315

14-
# test
15-
test.php
16-
log.log
17-
credentials.php
16+
# pasta onde guardo coisas que ando testando
17+
/teste/
1818

19-
# netbeans
20-
nbproject/
19+
# init lando
20+
.lando.yml
21+
# lando dockerfile php extensions
22+
Dockerfile.custom
23+
# lando php.ini
24+
php.ini
2125

22-
# phpdoc
23-
docs/phpdoc-cache*
24-
25-
sandbox/
26+
# vim bkp
27+
*~
28+
*.swp
2629

27-
test*.php
30+
# Curso graduação x Habilitação x Setor
31+
/storage/curhabset.json
2832

29-
/docs/
33+
# DDEV
34+
/.ddev
35+
core.*

src/Graduacao.php

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ public static function verifica($codpes, $codundclgi)
2121
) {
2222
return true;
2323
}
24-
2524
}
2625
}
2726
return false;
@@ -176,15 +175,15 @@ public static function nomeHabilitacao($codhab, $codcur)
176175
return $result;
177176
}
178177

179-
public static function obterCursosHabilitacoes($codundclgi)
178+
public static function obterCursosHabilitacoes($codundclg)
180179
{
181180
$query = " SELECT CURSOGR.*, HABILITACAOGR.* FROM CURSOGR, HABILITACAOGR";
182-
$query .= " WHERE (CURSOGR.codclg = convert(int, :codundclgi)) AND (CURSOGR.codcur = HABILITACAOGR.codcur)";
181+
$query .= " WHERE (CURSOGR.codclg IN (:codundclgi)) AND (CURSOGR.codcur = HABILITACAOGR.codcur)";
183182
$query .= " AND ( (CURSOGR.dtaatvcur IS NOT NULL) AND (CURSOGR.dtadtvcur IS NULL) )";
184183
$query .= " AND ( (HABILITACAOGR.dtaatvhab IS NOT NULL) AND (HABILITACAOGR.dtadtvhab IS NULL) )";
185184
$query .= " ORDER BY CURSOGR.nomcur, HABILITACAOGR.nomhab ASC";
186185
$param = [
187-
'codundclgi' => $codundclgi,
186+
'codundclg' => $codundclg,
188187
];
189188
return DB::fetchAll($query, $param);
190189
}
@@ -373,6 +372,39 @@ public static function disciplinasEquivalentesCurriculo($codcur, $codhab)
373372
return DB::fetchAll($query, $param);
374373
}
375374

375+
/**
376+
* Retorna o setor de um aluno
377+
* É igual ao método setorAluno, mas chama o método obterCursoAtivo, que permite mais de um codundclg
378+
*
379+
* @param Int $codpes
380+
* @param $codundclg
381+
* @return Array(nomabvset)
382+
*/
383+
public static function obterSetorAluno($codpes, $codundclg)
384+
{
385+
386+
$codundclg = $codundclg ?: getenv('REPLICADO_CODUNDCLGS');
387+
$codundclg = $codundclg ?: getenv('REPLICADO_CODUNDCLG');
388+
389+
$codcur = self::obterCursoAtivo($codpes)['codcur'];
390+
$codhab = self::obterCursoAtivo($codpes)['codhab'];
391+
$query = " SELECT TOP 1 L.nomabvset FROM CURSOGRCOORDENADOR AS C
392+
INNER JOIN LOCALIZAPESSOA AS L ON C.codpesdct = L.codpes
393+
WHERE C.codcur = CONVERT(INT, :codcur) AND C.codhab = CONVERT(INT, :codhab)";
394+
$param = [
395+
'codcur' => $codcur,
396+
'codhab' => $codhab,
397+
];
398+
$result = DB::fetch($query, $param);
399+
// Nota: Situação a se tratar com log de ocorrências
400+
// Se o departamento de ensino do alguno de graduação não foi encontrado
401+
if ($result == false) {
402+
// Será retornado 'DEPARTAMENTO NÃO ENCONTRADO' a fim de se detectar as situações ATÍPICAS em que isso ocorre
403+
$result = ['nomabvset' => 'DEPARTAMENTO NÃO ENCONTRADO'];
404+
}
405+
return $result;
406+
}
407+
376408
/**
377409
* Departamento de Ensino do Aluno de Graduação
378410
*
@@ -772,7 +804,8 @@ public static function listarDisciplinasAlunoAnoSemestre(int $codpes, int $anoSe
772804
* @return Array
773805
* @author Kawan Santana, em 19/03/2024
774806
*/
775-
public static function listarDepartamentosDeEnsino(){
807+
public static function listarDepartamentosDeEnsino()
808+
{
776809
$query = DB::getQuery('Graduacao.listarDepartamentosDeEnsino.sql');
777810
return DB::fetchAll($query);
778811
}

src/Pessoa.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ public static function email($codpes)
104104
if (trim($row['stamtr']) == 'S') {
105105
return $row['codema'];
106106
}
107-
108107
}
109108
return false;
110109
}

0 commit comments

Comments
 (0)