-
Notifications
You must be signed in to change notification settings - Fork 458
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #663 from portabilis/portabilis-patch-2019-09-27
[2.2] Portabilis patch 27/09/2019
- Loading branch information
Showing
178 changed files
with
1,415 additions
and
3,762 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
app/Exceptions/Enrollment/PreviousEnrollCancellationDateException.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace App\Exceptions\Enrollment; | ||
|
||
use App\Models\LegacyRegistration; | ||
use DateTime; | ||
use RuntimeException; | ||
|
||
class PreviousEnrollCancellationDateException extends RuntimeException | ||
{ | ||
/** | ||
* A data de cancelamento da enturmação é anterior a data de | ||
* matrícula. | ||
* | ||
* @param LegacyRegistration $registration | ||
* @param DateTime $cancellationDate | ||
*/ | ||
public function __construct(LegacyRegistration $registration, DateTime $cancellationDate) | ||
{ | ||
$message = 'A data de saída %s deve ser maior que a data de matrícula %s.'; | ||
|
||
$message = sprintf( | ||
$message, $cancellationDate->format('d/m/Y'), (new DateTime($registration->data_matricula))->format('d/m/Y') | ||
); | ||
|
||
parent::__construct($message); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
app/Exceptions/Enrollment/PreviousEnrollRegistrationDateException.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
namespace App\Exceptions\Enrollment; | ||
|
||
use App\Models\LegacyRegistration; | ||
use DateTime; | ||
use RuntimeException; | ||
|
||
class PreviousEnrollRegistrationDateException extends RuntimeException | ||
{ | ||
/** | ||
* A data de enturmação é anterior a data de matrícula. | ||
* | ||
* @param DateTime $date | ||
* @param LegacyRegistration $registration | ||
*/ | ||
public function __construct(DateTime $date, LegacyRegistration $registration) | ||
{ | ||
$message = 'A data de enturmação %s é anterior a data da matrícula %s.'; | ||
|
||
$message = sprintf( | ||
$message, $date->format('d/m/Y'), (new DateTime($registration->data_matricula))->format('d/m/Y') | ||
); | ||
|
||
parent::__construct($message); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
namespace App\Models; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
use Illuminate\Database\Eloquent\Relations\BelongsTo; | ||
|
||
/** | ||
* Class LegacyDisciplineExemption | ||
* @property LegacyRegistration $registration | ||
*/ | ||
class LegacyExemptionStage extends Model | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected $table = 'pmieducar.dispensa_etapa'; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
protected $primaryKey = 'ref_cod_dispensa'; | ||
|
||
/** | ||
* @var array | ||
*/ | ||
protected $fillable = [ | ||
'ref_cod_dispensa', | ||
'etapa', | ||
'ref_cod_disciplina', | ||
]; | ||
|
||
/** | ||
* @var bool | ||
*/ | ||
public $timestamps = false; | ||
|
||
/** | ||
* @return BelongsTo | ||
*/ | ||
public function exemption() | ||
{ | ||
return $this->belongsTo(LegacyDisciplineExemption::class, 'ref_cod_dispensa', 'cod_dispensa'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
namespace App\Support\Database; | ||
|
||
use Illuminate\Support\Facades\DB; | ||
|
||
trait IncrementSequence | ||
{ | ||
/** | ||
* @param string $table | ||
* @param string $column | ||
* | ||
* @return void | ||
*/ | ||
public function incrementSequence($table, $column = 'id') | ||
{ | ||
if (class_exists($table)) { | ||
$class = new $table; | ||
|
||
$table = $class->getTable(); | ||
$column = $class->getKeyName(); | ||
} | ||
|
||
DB::unprepared( | ||
" | ||
SELECT setval(pg_get_serial_sequence('{$table}', '{$column}'), coalesce(max({$column}), 1)) FROM {$table}; | ||
" | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.