Skip to content

Commit

Permalink
Merge pull request #673 from portabilis/portabilis-patch-2019-10-25
Browse files Browse the repository at this point in the history
[2.2] Portabilis patch 25/10/2019
  • Loading branch information
edersoares authored Oct 29, 2019
2 parents aea6e60 + 6fc4e25 commit d01959b
Show file tree
Hide file tree
Showing 16 changed files with 364 additions and 126 deletions.
13 changes: 13 additions & 0 deletions app/Models/LegacyRegistration.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace App\Models;

use App_Model_MatriculaSituacao;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
Expand All @@ -11,6 +12,8 @@
* LegacyRegistration
*
* @property int $id
* @property boolean isTransferred
* @property boolean isAbandoned
*
*/
class LegacyRegistration extends Model
Expand Down Expand Up @@ -119,4 +122,14 @@ public function exemptions()
{
return $this->hasMany(LegacyDisciplineExemption::class, 'ref_cod_matricula', 'cod_matricula');
}

public function getIsTransferredAttribute()
{
return $this->aprovado == App_Model_MatriculaSituacao::TRANSFERIDO;
}

public function getIsAbandonedAttribute()
{
return $this->aprovado == App_Model_MatriculaSituacao::ABANDONO;
}
}
1 change: 1 addition & 0 deletions app/Process.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class Process

const ENROLLMENT_HISTORY = 1001;
const ATTENDED_CANDIDATE = 1002;
const BACK_TO_QUEUE = 1003;
const UNDO_STUDENT_UNIFICATION = 2001;
const EXEMPTION_LIST = 2002;
}
33 changes: 33 additions & 0 deletions app/Services/StudentService.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

namespace App\Services;

use App\Models\Student;

class StudentService
{
/**
* Verifica se o aluno tem alguma matricula em andamento
*
* @param int $studentId
* @param int|null $levelId
* @return boolean
*/
public function hasInProgressRegistration($studentId, $levelId = null)
{
$student = Student::find($studentId);

if (!$student) {
return false;
}

$query = $student->registrations()->where('status', 3);

if ($levelId) {
$query->where('level_id', $levelId);
}

return $query->orderBy('year', 'desc')
->exists();
}
}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "Software livre de gestão escolar",
"type": "project",
"license": "GPL-2.0-or-later",
"version": "2.2.10",
"version": "2.2.11",
"keywords": [
"Portabilis",
"i-Educar"
Expand Down
81 changes: 42 additions & 39 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CriaParametroOrdenaAlunosPorSequencialEnturmacao extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('pmieducar.instituicao', function (Blueprint $table) {
$table->boolean('ordenar_alunos_sequencial_enturmacao')->default(false);
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('pmieducar.instituicao', function (Blueprint $table) {
$table->dropColumn('ordenar_alunos_sequencial_enturmacao');
});
}
}
Loading

0 comments on commit d01959b

Please sign in to comment.