Commit 2c5732a39104d0b72a20729fdd98dd8a6d491407
Committed by
GitHub
Exists in
2.8
and in
6 other branches
Merge pull request #6511 from portabilis/issue-6498
Passa parametro de ano para validar lançamentos
Showing
3 changed files
with
16 additions
and
6 deletions
Show diff stats
app/Services/iDiarioService.php
... | ... | @@ -55,10 +55,14 @@ class iDiarioService |
55 | 55 | * |
56 | 56 | * @return bool |
57 | 57 | */ |
58 | - public function getStepActivityByUnit(int $unitId, int $step): bool | |
58 | + public function getStepActivityByUnit(int $unitId, int $year, int $step): bool | |
59 | 59 | { |
60 | 60 | try { |
61 | - $response = $this->get('/api/v2/step_activity', ['unity_id' => $unitId, 'step_number' => $step]); | |
61 | + $response = $this->get('/api/v2/step_activity', [ | |
62 | + 'unity_id' => $unitId, | |
63 | + 'year' => $year, | |
64 | + 'step_number' => $step | |
65 | + ]); | |
62 | 66 | $body = trim((string)$response->getBody()); |
63 | 67 | |
64 | 68 | if ($body === 'true') { |
... | ... | @@ -77,10 +81,14 @@ class iDiarioService |
77 | 81 | * |
78 | 82 | * @return bool |
79 | 83 | */ |
80 | - public function getStepActivityByClassroom(int $classroomId, int $step): bool | |
84 | + public function getStepActivityByClassroom(int $classroomId, int $year, int $step): bool | |
81 | 85 | { |
82 | 86 | try { |
83 | - $response = $this->get('/api/v2/step_activity', ['classroom_id' => $classroomId, 'step_number' => $step]); | |
87 | + $response = $this->get('/api/v2/step_activity', [ | |
88 | + 'classroom_id' => $classroomId, | |
89 | + 'year' => $year, | |
90 | + 'step_number' => $step | |
91 | + ]); | |
84 | 92 | $body = trim((string)$response->getBody()); |
85 | 93 | |
86 | 94 | if ($body === 'true') { | ... | ... |
ieducar/intranet/educar_ano_letivo_modulo_cad.php
... | ... | @@ -697,7 +697,7 @@ class indice extends clsCadastro |
697 | 697 | $iDiarioService = app(iDiarioService::class); |
698 | 698 | |
699 | 699 | foreach ($etapas as $etapa) { |
700 | - if ($iDiarioService->getStepActivityByUnit($escolaId, $etapa)) { | |
700 | + if ($iDiarioService->getStepActivityByUnit($escolaId, $ano, $etapa)) { | |
701 | 701 | throw new RuntimeException('Não foi possível remover uma das etapas pois existem notas ou faltas lançadas no diário online.'); |
702 | 702 | } |
703 | 703 | } | ... | ... |
ieducar/intranet/educar_turma_cad.php
... | ... | @@ -228,6 +228,7 @@ class indice extends clsCadastro |
228 | 228 | |
229 | 229 | $this->campoOculto('obrigar_campos_censo', (int)$obrigarCamposCenso); |
230 | 230 | $this->campoOculto('cod_turma', $this->cod_turma); |
231 | + $this->campoOculto('ano_letivo_', $this->ano); | |
231 | 232 | $this->campoOculto('dependencia_administrativa', $this->dependencia_administrativa); |
232 | 233 | $this->campoOculto('modalidade_curso', $this->modalidade_curso); |
233 | 234 | $this->campoOculto('retorno', $this->retorno); |
... | ... | @@ -1304,6 +1305,7 @@ class indice extends clsCadastro |
1304 | 1305 | protected function validaModulos() |
1305 | 1306 | { |
1306 | 1307 | $turmaId = $this->cod_turma; |
1308 | + $anoTurma = $this->ano_letivo_; | |
1307 | 1309 | $etapasCount = count($this->data_inicio); |
1308 | 1310 | $etapasCountAntigo = (int) Portabilis_Utils_Database::selectField( |
1309 | 1311 | 'SELECT COUNT(*) AS count FROM pmieducar.turma_modulo WHERE ref_cod_turma = $1', |
... | ... | @@ -1360,7 +1362,7 @@ class indice extends clsCadastro |
1360 | 1362 | $iDiarioService = app(iDiarioService::class); |
1361 | 1363 | |
1362 | 1364 | foreach ($etapas as $etapa) { |
1363 | - if ($iDiarioService->getStepActivityByClassroom($turmaId, $etapa)) { | |
1365 | + if ($iDiarioService->getStepActivityByClassroom($turmaId, $anoTurma, $etapa)) { | |
1364 | 1366 | throw new RuntimeException('Não foi possível remover uma das etapas pois existem notas ou faltas lançadas no diário online.'); |
1365 | 1367 | } |
1366 | 1368 | } | ... | ... |