Commit e1a2a57b5aecb57f8f5faef2028ceb1eab325f41

Authored by bonot
1 parent 2f6a5238
Exists in 2.8 and in 6 other branches 2.2, 2.3, 2.4, 2.5, 2.6, 2.7

Passa parametro de ano para a turma também

app/Services/iDiarioService.php
... ... @@ -81,10 +81,14 @@ class iDiarioService
81 81 *
82 82 * @return bool
83 83 */
84   - public function getStepActivityByClassroom(int $classroomId, int $step): bool
  84 + public function getStepActivityByClassroom(int $classroomId, int $year, int $step): bool
85 85 {
86 86 try {
87   - $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 + ]);
88 92 $body = trim((string)$response->getBody());
89 93  
90 94 if ($body === 'true') {
... ...
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 }
... ...