Commit b715f8b52673b10eef35f0ec83d33e20b2964f1a

Authored by Éber Freitas Dias
2 parents 3fc7e9cf 0ef31378
Exists in 2.8 and in 7 other branches 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7

Merge branch 'master' into issue-2975

Showing 74 changed files with 2437 additions and 563 deletions   Show diff stats
.travis.yml
1 1 matrix:
  2 +
2 3 include:
  4 +
3 5 - language: php
  6 +
  7 + sudo: required
  8 +
  9 + dist: xenial
  10 +
4 11 php:
5 12 - 7.1
6 13 - 7.2
  14 +
7 15 addons:
8 16 postgresql: 9.5
  17 + chrome: stable
  18 +
9 19 env:
  20 + - APP_URL=http://localhost:8000
10 21 - APP_ENV=testing
11 22 - DB_CONNECTION=pgsql
12 23 - DB_HOST=localhost
... ... @@ -20,5 +31,12 @@ matrix:
20 31 cache:
21 32 directories:
22 33 - $HOME/.composer/cache
  34 +
23 35 before_script:
24 36 - composer new-install
  37 + - vendor/laravel/dusk/bin/chromedriver-linux > /dev/null 2>&1 &
  38 + - php artisan serve > /dev/null 2>&1 &
  39 +
  40 + script:
  41 + - vendor/bin/phpunit
  42 + - php artisan dusk
... ...
app/City.php 0 → 100644
... ... @@ -0,0 +1,19 @@
  1 +<?php
  2 +
  3 +namespace App;
  4 +
  5 +use Illuminate\Database\Eloquent\Model;
  6 +
  7 +class City extends Model
  8 +{
  9 + /**
  10 + * The attributes that are mass assignable.
  11 + *
  12 + * @var array
  13 + */
  14 + protected $fillable = [
  15 + 'state_id',
  16 + 'name',
  17 + 'ibge'
  18 + ];
  19 +}
... ...
app/Country.php 0 → 100644
... ... @@ -0,0 +1,17 @@
  1 +<?php
  2 +
  3 +namespace App;
  4 +
  5 +use Illuminate\Database\Eloquent\Model;
  6 +
  7 +class Country extends Model
  8 +{
  9 + /**
  10 + * The attributes that are mass assignable.
  11 + *
  12 + * @var array
  13 + */
  14 + protected $fillable = [
  15 + 'name', 'ibge'
  16 + ];
  17 +}
... ...
app/District.php 0 → 100644
... ... @@ -0,0 +1,17 @@
  1 +<?php
  2 +
  3 +namespace App;
  4 +
  5 +use Illuminate\Database\Eloquent\Model;
  6 +
  7 +class District extends Model
  8 +{
  9 + /**
  10 + * The attributes that are mass assignable.
  11 + *
  12 + * @var array
  13 + */
  14 + protected $fillable = [
  15 + 'city_id', 'name', 'ibge'
  16 + ];
  17 +}
... ...
app/Http/Controllers/LegacyController.php
... ... @@ -178,7 +178,7 @@ class LegacyController extends Controller
178 178 */
179 179 private function getHttpStatusCode()
180 180 {
181   - return http_response_code();
  181 + return http_response_code() ?: Response::HTTP_OK;
182 182 }
183 183  
184 184 /**
... ...
app/Http/Controllers/LegacyFakeAuthController.php
... ... @@ -2,6 +2,8 @@
2 2  
3 3 namespace App\Http\Controllers;
4 4  
  5 +use Throwable;
  6 +
5 7 class LegacyFakeAuthController
6 8 {
7 9 /**
... ... @@ -11,8 +13,10 @@ class LegacyFakeAuthController
11 13 */
12 14 public function doFakeLogin()
13 15 {
14   - if (empty($_SESSION)) {
  16 + try {
15 17 session_start();
  18 + } catch (Throwable $throwable) {
  19 +
16 20 }
17 21  
18 22 $_SESSION['itj_controle'] = 'logado';
... ... @@ -32,8 +36,10 @@ class LegacyFakeAuthController
32 36 */
33 37 public function doFakeLogout()
34 38 {
35   - if (empty($_SESSION)) {
  39 + try {
36 40 session_start();
  41 + } catch (Throwable $throwable) {
  42 +
37 43 }
38 44  
39 45 $_SESSION = [];
... ...
app/Neighborhood.php 0 → 100644
... ... @@ -0,0 +1,19 @@
  1 +<?php
  2 +
  3 +namespace App;
  4 +
  5 +use Illuminate\Database\Eloquent\Model;
  6 +
  7 +class Neighborhood extends Model
  8 +{
  9 + /**
  10 + * The attributes that are mass assignable.
  11 + *
  12 + * @var array
  13 + */
  14 + protected $fillable = [
  15 + 'district_id',
  16 + 'name',
  17 + 'zone',
  18 + ];
  19 +}
... ...
app/Providers/AppServiceProvider.php
... ... @@ -16,6 +16,7 @@ use Illuminate\Support\ServiceProvider;
16 16 use Illuminate\Support\Str;
17 17 use Laravel\Dusk\Browser;
18 18 use Laravel\Dusk\DuskServiceProvider;
  19 +use Laravel\Dusk\ElementResolver;
19 20 use Laravel\Telescope\TelescopeServiceProvider;
20 21  
21 22 class AppServiceProvider extends ServiceProvider
... ... @@ -55,6 +56,22 @@ class AppServiceProvider extends ServiceProvider
55 56 }
56 57  
57 58 /**
  59 + * Add custom methods in ElementResolver class used by Laravel Dusk.
  60 + *
  61 + * @return void
  62 + */
  63 + private function customElementResolver()
  64 + {
  65 + ElementResolver::macro('findByText', function ($text, $tag) {
  66 + foreach ($this->all($tag) as $element) {
  67 + if (Str::contains($element->getText(), $text)) {
  68 + return $element;
  69 + }
  70 + }
  71 + });
  72 + }
  73 +
  74 + /**
58 75 * Load migrations from other repositories or packages.
59 76 *
60 77 * @return void
... ... @@ -78,6 +95,7 @@ class AppServiceProvider extends ServiceProvider
78 95 if ($this->app->environment('development', 'dusk', 'local', 'testing')) {
79 96 $this->registerRoutesForFakeAuth();
80 97 $this->customBrowserForFakeAuth();
  98 + $this->customElementResolver();
81 99 }
82 100  
83 101 if ($this->app->runningInConsole()) {
... ...
app/Repositories/ConfigurationRepositoryEloquent.php
... ... @@ -4,14 +4,9 @@ namespace App\Repositories;
4 4  
5 5 use App\Models\LegacyConfiguration;
6 6 use iEducar\Support\Repositories\ConfigurationRepository;
7   -use Prettus\Repository\Eloquent\BaseRepository;
8 7 use Prettus\Repository\Criteria\RequestCriteria;
  8 +use Prettus\Repository\Eloquent\BaseRepository;
9 9  
10   -/**
11   - * Class MenuRepositoryEloquent.
12   - *
13   - * @package namespace App\Repositories;
14   - */
15 10 class ConfigurationRepositoryEloquent extends BaseRepository implements ConfigurationRepository
16 11 {
17 12 /**
... ... @@ -26,6 +21,10 @@ class ConfigurationRepositoryEloquent extends BaseRepository implements Configur
26 21  
27 22 /**
28 23 * Boot up the repository, pushing criteria
  24 + *
  25 + * @return void
  26 + *
  27 + * @throws \Prettus\Repository\Exceptions\RepositoryException
29 28 */
30 29 public function boot()
31 30 {
... ...
app/Repositories/MenuRepositoryEloquent.php
... ... @@ -3,15 +3,10 @@
3 3 namespace App\Repositories;
4 4  
5 5 use iEducar\Support\Repositories\MenuRepository;
6   -use Prettus\Repository\Eloquent\BaseRepository;
7 6 use Prettus\Repository\Criteria\RequestCriteria;
8 7 use App\Models\LegacyMenu;
  8 +use Prettus\Repository\Eloquent\BaseRepository;
9 9  
10   -/**
11   - * Class MenuRepositoryEloquent.
12   - *
13   - * @package namespace App\Repositories;
14   - */
15 10 class MenuRepositoryEloquent extends BaseRepository implements MenuRepository
16 11 {
17 12 /**
... ... @@ -26,6 +21,10 @@ class MenuRepositoryEloquent extends BaseRepository implements MenuRepository
26 21  
27 22 /**
28 23 * Boot up the repository, pushing criteria
  24 + *
  25 + * @return void
  26 + *
  27 + * @throws \Prettus\Repository\Exceptions\RepositoryException
29 28 */
30 29 public function boot()
31 30 {
... ...
app/Repositories/SubmenuRepositoryEloquent.php
... ... @@ -3,15 +3,10 @@
3 3 namespace App\Repositories;
4 4  
5 5 use iEducar\Support\Repositories\SubmenuRepository;
6   -use Prettus\Repository\Eloquent\BaseRepository;
7 6 use Prettus\Repository\Criteria\RequestCriteria;
8 7 use App\Models\LegacySubmenu;
  8 +use Prettus\Repository\Eloquent\BaseRepository;
9 9  
10   -/**
11   - * Class SubmenuRepositoryEloquent.
12   - *
13   - * @package namespace App\Repositories;
14   - */
15 10 class SubmenuRepositoryEloquent extends BaseRepository implements SubmenuRepository
16 11 {
17 12 /**
... ... @@ -24,14 +19,15 @@ class SubmenuRepositoryEloquent extends BaseRepository implements SubmenuReposit
24 19 return LegacySubmenu::class;
25 20 }
26 21  
27   -
28   -
29 22 /**
30 23 * Boot up the repository, pushing criteria
  24 + *
  25 + * @return void
  26 + *
  27 + * @throws \Prettus\Repository\Exceptions\RepositoryException
31 28 */
32 29 public function boot()
33 30 {
34 31 $this->pushCriteria(app(RequestCriteria::class));
35 32 }
36   -
37 33 }
... ...
app/Repositories/SystemMenuRepositoryEloquent.php
... ... @@ -5,14 +5,9 @@ namespace App\Repositories;
5 5 use App\Models\LegacySystemMenu;
6 6 use iEducar\Support\Repositories\SystemMenuRepository;
7 7 use Illuminate\Support\Facades\DB;
8   -use Prettus\Repository\Eloquent\BaseRepository;
9 8 use Prettus\Repository\Criteria\RequestCriteria;
  9 +use Prettus\Repository\Eloquent\BaseRepository;
10 10  
11   -/**
12   - * Class MenuRepositoryEloquent.
13   - *
14   - * @package namespace App\Repositories;
15   - */
16 11 class SystemMenuRepositoryEloquent extends BaseRepository implements SystemMenuRepository
17 12 {
18 13 /**
... ... @@ -27,6 +22,10 @@ class SystemMenuRepositoryEloquent extends BaseRepository implements SystemMenuR
27 22  
28 23 /**
29 24 * Boot up the repository, pushing criteria
  25 + *
  26 + * @return void
  27 + *
  28 + * @throws \Prettus\Repository\Exceptions\RepositoryException
30 29 */
31 30 public function boot()
32 31 {
... ... @@ -35,9 +34,11 @@ class SystemMenuRepositoryEloquent extends BaseRepository implements SystemMenuR
35 34  
36 35 /**
37 36 * @param array $submenuIdArray
38   - * @param $tutorMenuId
39   - * @param $level
  37 + * @param int $tutorMenuId
  38 + * @param int $level
  39 + *
40 40 * @return \Illuminate\Database\Eloquent\Collection
  41 + *
41 42 * @throws \Prettus\Repository\Exceptions\RepositoryException
42 43 */
43 44 public function getNoParentBySubMenusAndTutorMenu(array $submenuIdArray, $tutorMenuId, $level)
... ... @@ -62,9 +63,11 @@ class SystemMenuRepositoryEloquent extends BaseRepository implements SystemMenuR
62 63 /**
63 64 * @param array $parents
64 65 * @param array $submenuIdArray
65   - * @param int $tutorMenuId
66   - * @param int $level
  66 + * @param int $tutorMenuId
  67 + * @param int $level
  68 + *
67 69 * @return \Illuminate\Database\Eloquent\Collection
  70 + *
68 71 * @throws \Prettus\Repository\Exceptions\RepositoryException
69 72 */
70 73 public function getByParentsAndSubMenusAndTutorMenu($parents, array $submenuIdArray, $tutorMenuId, $level)
... ...
app/Repositories/UserRepositoryEloquent.php
... ... @@ -3,15 +3,10 @@
3 3 namespace App\Repositories;
4 4  
5 5 use iEducar\Support\Repositories\UserRepository;
6   -use Prettus\Repository\Eloquent\BaseRepository;
7 6 use Prettus\Repository\Criteria\RequestCriteria;
8 7 use App\Models\LegacyUser;
  8 +use Prettus\Repository\Eloquent\BaseRepository;
9 9  
10   -/**
11   - * Class UserRepositoryEloquent.
12   - *
13   - * @package namespace App\Repositories;
14   - */
15 10 class UserRepositoryEloquent extends BaseRepository implements UserRepository
16 11 {
17 12 /**
... ... @@ -26,6 +21,10 @@ class UserRepositoryEloquent extends BaseRepository implements UserRepository
26 21  
27 22 /**
28 23 * Boot up the repository, pushing criteria
  24 + *
  25 + * @return void
  26 + *
  27 + * @throws \Prettus\Repository\Exceptions\RepositoryException
29 28 */
30 29 public function boot()
31 30 {
... ...
app/Repositories/UserTypeRepositoryEloquent.php
... ... @@ -3,15 +3,10 @@
3 3 namespace App\Repositories;
4 4  
5 5 use iEducar\Support\Repositories\UserTypeRepository;
6   -use Prettus\Repository\Eloquent\BaseRepository;
7 6 use Prettus\Repository\Criteria\RequestCriteria;
8 7 use App\Models\LegacyUserType;
  8 +use Prettus\Repository\Eloquent\BaseRepository;
9 9  
10   -/**
11   - * Class UserTypeRepositoryEloquent.
12   - *
13   - * @package namespace App\Repositories;
14   - */
15 10 class UserTypeRepositoryEloquent extends BaseRepository implements UserTypeRepository
16 11 {
17 12 /**
... ... @@ -26,10 +21,13 @@ class UserTypeRepositoryEloquent extends BaseRepository implements UserTypeRepos
26 21  
27 22 /**
28 23 * Boot up the repository, pushing criteria
  24 + *
  25 + * @return void
  26 + *
  27 + * @throws \Prettus\Repository\Exceptions\RepositoryException
29 28 */
30 29 public function boot()
31 30 {
32 31 $this->pushCriteria(app(RequestCriteria::class));
33 32 }
34   -
35 33 }
... ...
app/State.php 0 → 100644
... ... @@ -0,0 +1,17 @@
  1 +<?php
  2 +
  3 +namespace App;
  4 +
  5 +use Illuminate\Database\Eloquent\Model;
  6 +
  7 +class State extends Model
  8 +{
  9 + /**
  10 + * The attributes that are mass assignable.
  11 + *
  12 + * @var array
  13 + */
  14 + protected $fillable = [
  15 + 'country_id', 'name', 'abbreviation', 'ibge'
  16 + ];
  17 +}
... ...
composer.json
... ... @@ -3,7 +3,7 @@
3 3 "description": "Software livre de gestão escolar",
4 4 "type": "project",
5 5 "license": "GPL-2.0-or-later",
6   - "version": "2.1.3",
  6 + "version": "2.1.4",
7 7 "keywords": [
8 8 "Portabilis",
9 9 "i-Educar"
... ...
composer.lock
... ... @@ -4,7 +4,7 @@
4 4 "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
5 5 "This file is @generated automatically"
6 6 ],
7   - "content-hash": "46c3820f890d3f55bd050f9969fa7de9",
  7 + "content-hash": "3501ebab100580d508b30d6d94badd3c",
8 8 "packages": [
9 9 {
10 10 "name": "cocur/slugify",
... ... @@ -1673,16 +1673,16 @@
1673 1673 },
1674 1674 {
1675 1675 "name": "maatwebsite/excel",
1676   - "version": "3.1.8",
  1676 + "version": "3.1.9",
1677 1677 "source": {
1678 1678 "type": "git",
1679 1679 "url": "https://github.com/Maatwebsite/Laravel-Excel.git",
1680   - "reference": "a0ff818c141c34c05a27578de8c00953efc2005e"
  1680 + "reference": "e115760c879a7b647adf38006be015badd2ffbdd"
1681 1681 },
1682 1682 "dist": {
1683 1683 "type": "zip",
1684   - "url": "https://api.github.com/repos/Maatwebsite/Laravel-Excel/zipball/a0ff818c141c34c05a27578de8c00953efc2005e",
1685   - "reference": "a0ff818c141c34c05a27578de8c00953efc2005e",
  1684 + "url": "https://api.github.com/repos/Maatwebsite/Laravel-Excel/zipball/e115760c879a7b647adf38006be015badd2ffbdd",
  1685 + "reference": "e115760c879a7b647adf38006be015badd2ffbdd",
1686 1686 "shasum": ""
1687 1687 },
1688 1688 "require": {
... ... @@ -1737,7 +1737,7 @@
1737 1737 "php",
1738 1738 "phpspreadsheet"
1739 1739 ],
1740   - "time": "2019-02-26T16:00:52+00:00"
  1740 + "time": "2019-02-28T14:43:36+00:00"
1741 1741 },
1742 1742 {
1743 1743 "name": "markbaker/complex",
... ... @@ -3159,16 +3159,16 @@
3159 3159 },
3160 3160 {
3161 3161 "name": "symfony/console",
3162   - "version": "v4.2.3",
  3162 + "version": "v4.2.4",
3163 3163 "source": {
3164 3164 "type": "git",
3165 3165 "url": "https://github.com/symfony/console.git",
3166   - "reference": "1f0ad51dfde4da8a6070f06adc58b4e37cbb37a4"
  3166 + "reference": "9dc2299a016497f9ee620be94524e6c0af0280a9"
3167 3167 },
3168 3168 "dist": {
3169 3169 "type": "zip",
3170   - "url": "https://api.github.com/repos/symfony/console/zipball/1f0ad51dfde4da8a6070f06adc58b4e37cbb37a4",
3171   - "reference": "1f0ad51dfde4da8a6070f06adc58b4e37cbb37a4",
  3170 + "url": "https://api.github.com/repos/symfony/console/zipball/9dc2299a016497f9ee620be94524e6c0af0280a9",
  3171 + "reference": "9dc2299a016497f9ee620be94524e6c0af0280a9",
3172 3172 "shasum": ""
3173 3173 },
3174 3174 "require": {
... ... @@ -3227,7 +3227,7 @@
3227 3227 ],
3228 3228 "description": "Symfony Console Component",
3229 3229 "homepage": "https://symfony.com",
3230   - "time": "2019-01-25T14:35:16+00:00"
  3230 + "time": "2019-02-23T15:17:42+00:00"
3231 3231 },
3232 3232 {
3233 3233 "name": "symfony/contracts",
... ... @@ -3299,7 +3299,7 @@
3299 3299 },
3300 3300 {
3301 3301 "name": "symfony/css-selector",
3302   - "version": "v4.2.3",
  3302 + "version": "v4.2.4",
3303 3303 "source": {
3304 3304 "type": "git",
3305 3305 "url": "https://github.com/symfony/css-selector.git",
... ... @@ -3352,16 +3352,16 @@
3352 3352 },
3353 3353 {
3354 3354 "name": "symfony/debug",
3355   - "version": "v4.2.3",
  3355 + "version": "v4.2.4",
3356 3356 "source": {
3357 3357 "type": "git",
3358 3358 "url": "https://github.com/symfony/debug.git",
3359   - "reference": "cf9b2e33f757deb884ce474e06d2647c1c769b65"
  3359 + "reference": "de73f48977b8eaf7ce22814d66e43a1662cc864f"
3360 3360 },
3361 3361 "dist": {
3362 3362 "type": "zip",
3363   - "url": "https://api.github.com/repos/symfony/debug/zipball/cf9b2e33f757deb884ce474e06d2647c1c769b65",
3364   - "reference": "cf9b2e33f757deb884ce474e06d2647c1c769b65",
  3363 + "url": "https://api.github.com/repos/symfony/debug/zipball/de73f48977b8eaf7ce22814d66e43a1662cc864f",
  3364 + "reference": "de73f48977b8eaf7ce22814d66e43a1662cc864f",
3365 3365 "shasum": ""
3366 3366 },
3367 3367 "require": {
... ... @@ -3404,20 +3404,20 @@
3404 3404 ],
3405 3405 "description": "Symfony Debug Component",
3406 3406 "homepage": "https://symfony.com",
3407   - "time": "2019-01-25T14:35:16+00:00"
  3407 + "time": "2019-03-03T18:11:24+00:00"
3408 3408 },
3409 3409 {
3410 3410 "name": "symfony/event-dispatcher",
3411   - "version": "v4.2.3",
  3411 + "version": "v4.2.4",
3412 3412 "source": {
3413 3413 "type": "git",
3414 3414 "url": "https://github.com/symfony/event-dispatcher.git",
3415   - "reference": "bd09ad265cd50b2b9d09d65ce6aba2d29bc81fe1"
  3415 + "reference": "3354d2e6af986dd71f68b4e5cf4a933ab58697fb"
3416 3416 },
3417 3417 "dist": {
3418 3418 "type": "zip",
3419   - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/bd09ad265cd50b2b9d09d65ce6aba2d29bc81fe1",
3420   - "reference": "bd09ad265cd50b2b9d09d65ce6aba2d29bc81fe1",
  3419 + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/3354d2e6af986dd71f68b4e5cf4a933ab58697fb",
  3420 + "reference": "3354d2e6af986dd71f68b4e5cf4a933ab58697fb",
3421 3421 "shasum": ""
3422 3422 },
3423 3423 "require": {
... ... @@ -3468,20 +3468,20 @@
3468 3468 ],
3469 3469 "description": "Symfony EventDispatcher Component",
3470 3470 "homepage": "https://symfony.com",
3471   - "time": "2019-01-16T20:35:37+00:00"
  3471 + "time": "2019-02-23T15:17:42+00:00"
3472 3472 },
3473 3473 {
3474 3474 "name": "symfony/finder",
3475   - "version": "v4.2.3",
  3475 + "version": "v4.2.4",
3476 3476 "source": {
3477 3477 "type": "git",
3478 3478 "url": "https://github.com/symfony/finder.git",
3479   - "reference": "ef71816cbb264988bb57fe6a73f610888b9aa70c"
  3479 + "reference": "267b7002c1b70ea80db0833c3afe05f0fbde580a"
3480 3480 },
3481 3481 "dist": {
3482 3482 "type": "zip",
3483   - "url": "https://api.github.com/repos/symfony/finder/zipball/ef71816cbb264988bb57fe6a73f610888b9aa70c",
3484   - "reference": "ef71816cbb264988bb57fe6a73f610888b9aa70c",
  3483 + "url": "https://api.github.com/repos/symfony/finder/zipball/267b7002c1b70ea80db0833c3afe05f0fbde580a",
  3484 + "reference": "267b7002c1b70ea80db0833c3afe05f0fbde580a",
3485 3485 "shasum": ""
3486 3486 },
3487 3487 "require": {
... ... @@ -3517,20 +3517,20 @@
3517 3517 ],
3518 3518 "description": "Symfony Finder Component",
3519 3519 "homepage": "https://symfony.com",
3520   - "time": "2019-01-16T20:35:37+00:00"
  3520 + "time": "2019-02-23T15:42:05+00:00"
3521 3521 },
3522 3522 {
3523 3523 "name": "symfony/http-foundation",
3524   - "version": "v4.2.3",
  3524 + "version": "v4.2.4",
3525 3525 "source": {
3526 3526 "type": "git",
3527 3527 "url": "https://github.com/symfony/http-foundation.git",
3528   - "reference": "8d2318b73e0a1bc75baa699d00ebe2ae8b595a39"
  3528 + "reference": "850a667d6254ccf6c61d853407b16f21c4579c77"
3529 3529 },
3530 3530 "dist": {
3531 3531 "type": "zip",
3532   - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/8d2318b73e0a1bc75baa699d00ebe2ae8b595a39",
3533   - "reference": "8d2318b73e0a1bc75baa699d00ebe2ae8b595a39",
  3532 + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/850a667d6254ccf6c61d853407b16f21c4579c77",
  3533 + "reference": "850a667d6254ccf6c61d853407b16f21c4579c77",
3534 3534 "shasum": ""
3535 3535 },
3536 3536 "require": {
... ... @@ -3571,20 +3571,20 @@
3571 3571 ],
3572 3572 "description": "Symfony HttpFoundation Component",
3573 3573 "homepage": "https://symfony.com",
3574   - "time": "2019-01-29T09:49:29+00:00"
  3574 + "time": "2019-02-26T08:03:39+00:00"
3575 3575 },
3576 3576 {
3577 3577 "name": "symfony/http-kernel",
3578   - "version": "v4.2.3",
  3578 + "version": "v4.2.4",
3579 3579 "source": {
3580 3580 "type": "git",
3581 3581 "url": "https://github.com/symfony/http-kernel.git",
3582   - "reference": "d56b1706abaa771eb6acd894c6787cb88f1dc97d"
  3582 + "reference": "895ceccaa8149f9343e6134e607c21da42d73b7a"
3583 3583 },
3584 3584 "dist": {
3585 3585 "type": "zip",
3586   - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/d56b1706abaa771eb6acd894c6787cb88f1dc97d",
3587   - "reference": "d56b1706abaa771eb6acd894c6787cb88f1dc97d",
  3586 + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/895ceccaa8149f9343e6134e607c21da42d73b7a",
  3587 + "reference": "895ceccaa8149f9343e6134e607c21da42d73b7a",
3588 3588 "shasum": ""
3589 3589 },
3590 3590 "require": {
... ... @@ -3660,7 +3660,7 @@
3660 3660 ],
3661 3661 "description": "Symfony HttpKernel Component",
3662 3662 "homepage": "https://symfony.com",
3663   - "time": "2019-02-03T12:47:33+00:00"
  3663 + "time": "2019-03-03T19:38:09+00:00"
3664 3664 },
3665 3665 {
3666 3666 "name": "symfony/polyfill-ctype",
... ... @@ -3836,7 +3836,7 @@
3836 3836 },
3837 3837 {
3838 3838 "name": "symfony/process",
3839   - "version": "v4.2.3",
  3839 + "version": "v4.2.4",
3840 3840 "source": {
3841 3841 "type": "git",
3842 3842 "url": "https://github.com/symfony/process.git",
... ... @@ -3885,16 +3885,16 @@
3885 3885 },
3886 3886 {
3887 3887 "name": "symfony/routing",
3888   - "version": "v4.2.3",
  3888 + "version": "v4.2.4",
3889 3889 "source": {
3890 3890 "type": "git",
3891 3891 "url": "https://github.com/symfony/routing.git",
3892   - "reference": "7f8e44fc498972466f0841c3e48dc555f23bdf53"
  3892 + "reference": "ff03eae644e6b1e26d4a04b2385fe3a1a7f04e42"
3893 3893 },
3894 3894 "dist": {
3895 3895 "type": "zip",
3896   - "url": "https://api.github.com/repos/symfony/routing/zipball/7f8e44fc498972466f0841c3e48dc555f23bdf53",
3897   - "reference": "7f8e44fc498972466f0841c3e48dc555f23bdf53",
  3896 + "url": "https://api.github.com/repos/symfony/routing/zipball/ff03eae644e6b1e26d4a04b2385fe3a1a7f04e42",
  3897 + "reference": "ff03eae644e6b1e26d4a04b2385fe3a1a7f04e42",
3898 3898 "shasum": ""
3899 3899 },
3900 3900 "require": {
... ... @@ -3958,20 +3958,20 @@
3958 3958 "uri",
3959 3959 "url"
3960 3960 ],
3961   - "time": "2019-01-29T09:49:29+00:00"
  3961 + "time": "2019-02-23T15:17:42+00:00"
3962 3962 },
3963 3963 {
3964 3964 "name": "symfony/translation",
3965   - "version": "v4.2.3",
  3965 + "version": "v4.2.4",
3966 3966 "source": {
3967 3967 "type": "git",
3968 3968 "url": "https://github.com/symfony/translation.git",
3969   - "reference": "23fd7aac70d99a17a8e6473a41fec8fab3331050"
  3969 + "reference": "748464177a77011f8f4cdd076773862ce4915f8f"
3970 3970 },
3971 3971 "dist": {
3972 3972 "type": "zip",
3973   - "url": "https://api.github.com/repos/symfony/translation/zipball/23fd7aac70d99a17a8e6473a41fec8fab3331050",
3974   - "reference": "23fd7aac70d99a17a8e6473a41fec8fab3331050",
  3973 + "url": "https://api.github.com/repos/symfony/translation/zipball/748464177a77011f8f4cdd076773862ce4915f8f",
  3974 + "reference": "748464177a77011f8f4cdd076773862ce4915f8f",
3975 3975 "shasum": ""
3976 3976 },
3977 3977 "require": {
... ... @@ -4031,20 +4031,20 @@
4031 4031 ],
4032 4032 "description": "Symfony Translation Component",
4033 4033 "homepage": "https://symfony.com",
4034   - "time": "2019-01-27T23:11:39+00:00"
  4034 + "time": "2019-02-27T03:31:50+00:00"
4035 4035 },
4036 4036 {
4037 4037 "name": "symfony/var-dumper",
4038   - "version": "v4.2.3",
  4038 + "version": "v4.2.4",
4039 4039 "source": {
4040 4040 "type": "git",
4041 4041 "url": "https://github.com/symfony/var-dumper.git",
4042   - "reference": "223bda89f9be41cf7033eeaf11bc61a280489c17"
  4042 + "reference": "9f87189ac10b42edf7fb8edc846f1937c6d157cf"
4043 4043 },
4044 4044 "dist": {
4045 4045 "type": "zip",
4046   - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/223bda89f9be41cf7033eeaf11bc61a280489c17",
4047   - "reference": "223bda89f9be41cf7033eeaf11bc61a280489c17",
  4046 + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/9f87189ac10b42edf7fb8edc846f1937c6d157cf",
  4047 + "reference": "9f87189ac10b42edf7fb8edc846f1937c6d157cf",
4048 4048 "shasum": ""
4049 4049 },
4050 4050 "require": {
... ... @@ -4107,7 +4107,7 @@
4107 4107 "debug",
4108 4108 "dump"
4109 4109 ],
4110   - "time": "2019-01-30T11:44:30+00:00"
  4110 + "time": "2019-02-23T15:17:42+00:00"
4111 4111 },
4112 4112 {
4113 4113 "name": "tijsverkoyen/css-to-inline-styles",
... ... @@ -6609,16 +6609,16 @@
6609 6609 },
6610 6610 {
6611 6611 "name": "symfony/filesystem",
6612   - "version": "v4.2.3",
  6612 + "version": "v4.2.4",
6613 6613 "source": {
6614 6614 "type": "git",
6615 6615 "url": "https://github.com/symfony/filesystem.git",
6616   - "reference": "7c16ebc2629827d4ec915a52ac809768d060a4ee"
  6616 + "reference": "e16b9e471703b2c60b95f14d31c1239f68f11601"
6617 6617 },
6618 6618 "dist": {
6619 6619 "type": "zip",
6620   - "url": "https://api.github.com/repos/symfony/filesystem/zipball/7c16ebc2629827d4ec915a52ac809768d060a4ee",
6621   - "reference": "7c16ebc2629827d4ec915a52ac809768d060a4ee",
  6620 + "url": "https://api.github.com/repos/symfony/filesystem/zipball/e16b9e471703b2c60b95f14d31c1239f68f11601",
  6621 + "reference": "e16b9e471703b2c60b95f14d31c1239f68f11601",
6622 6622 "shasum": ""
6623 6623 },
6624 6624 "require": {
... ... @@ -6655,20 +6655,20 @@
6655 6655 ],
6656 6656 "description": "Symfony Filesystem Component",
6657 6657 "homepage": "https://symfony.com",
6658   - "time": "2019-01-16T20:35:37+00:00"
  6658 + "time": "2019-02-07T11:40:08+00:00"
6659 6659 },
6660 6660 {
6661 6661 "name": "symfony/options-resolver",
6662   - "version": "v4.2.3",
  6662 + "version": "v4.2.4",
6663 6663 "source": {
6664 6664 "type": "git",
6665 6665 "url": "https://github.com/symfony/options-resolver.git",
6666   - "reference": "831b272963a8aa5a0613a1a7f013322d8161bbbb"
  6666 + "reference": "3896e5a7d06fd15fa4947694c8dcdd371ff147d1"
6667 6667 },
6668 6668 "dist": {
6669 6669 "type": "zip",
6670   - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/831b272963a8aa5a0613a1a7f013322d8161bbbb",
6671   - "reference": "831b272963a8aa5a0613a1a7f013322d8161bbbb",
  6670 + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/3896e5a7d06fd15fa4947694c8dcdd371ff147d1",
  6671 + "reference": "3896e5a7d06fd15fa4947694c8dcdd371ff147d1",
6672 6672 "shasum": ""
6673 6673 },
6674 6674 "require": {
... ... @@ -6709,7 +6709,7 @@
6709 6709 "configuration",
6710 6710 "options"
6711 6711 ],
6712   - "time": "2019-01-16T21:31:25+00:00"
  6712 + "time": "2019-02-23T15:17:42+00:00"
6713 6713 },
6714 6714 {
6715 6715 "name": "symfony/polyfill-php70",
... ... @@ -6772,7 +6772,7 @@
6772 6772 },
6773 6773 {
6774 6774 "name": "symfony/stopwatch",
6775   - "version": "v4.2.3",
  6775 + "version": "v4.2.4",
6776 6776 "source": {
6777 6777 "type": "git",
6778 6778 "url": "https://github.com/symfony/stopwatch.git",
... ...
database/factories/CityFactory.php 0 → 100644
... ... @@ -0,0 +1,21 @@
  1 +<?php
  2 +
  3 +use App\State;
  4 +use Faker\Generator as Faker;
  5 +
  6 +$factory->define(App\City::class, function (Faker $faker) {
  7 + return [
  8 + 'state_id' => function () {
  9 +
  10 + $state = State::query()->inRandomOrder()->first();
  11 +
  12 + if (empty($state)) {
  13 + $state = factory(State::class)->create();
  14 + }
  15 +
  16 + return $state->getKey();
  17 + },
  18 + 'name' => $faker->city,
  19 + 'ibge' => $faker->randomNumber(6),
  20 + ];
  21 +});
... ...
database/factories/CountryFactory.php 0 → 100644
... ... @@ -0,0 +1,10 @@
  1 +<?php
  2 +
  3 +use Faker\Generator as Faker;
  4 +
  5 +$factory->define(App\Country::class, function (Faker $faker) {
  6 + return [
  7 + 'name' => $faker->country,
  8 + 'ibge' => $faker->randomNumber(6),
  9 + ];
  10 +});
... ...
database/factories/DistrictFactory.php 0 → 100644
... ... @@ -0,0 +1,21 @@
  1 +<?php
  2 +
  3 +use App\City;
  4 +use Faker\Generator as Faker;
  5 +
  6 +$factory->define(App\District::class, function (Faker $faker) {
  7 + return [
  8 + 'city_id' => function () {
  9 +
  10 + $city = City::query()->inRandomOrder()->first();
  11 +
  12 + if (empty($city)) {
  13 + $city = factory(City::class)->create();
  14 + }
  15 +
  16 + return $city->getKey();
  17 + },
  18 + 'name' => $faker->name,
  19 + 'ibge' => $faker->randomNumber(6),
  20 + ];
  21 +});
... ...
database/factories/NeighborhoodFactory.php 0 → 100644
... ... @@ -0,0 +1,21 @@
  1 +<?php
  2 +
  3 +use App\District;
  4 +use Faker\Generator as Faker;
  5 +
  6 +$factory->define(App\Neighborhood::class, function (Faker $faker) {
  7 + return [
  8 + 'district_id' => function () {
  9 +
  10 + $district = District::query()->inRandomOrder()->first();
  11 +
  12 + if (empty($district)) {
  13 + $district = factory(District::class)->create();
  14 + }
  15 +
  16 + return $district->getKey();
  17 + },
  18 + 'name' => $faker->name,
  19 + 'zone' => $faker->randomElement([1, 2]),
  20 + ];
  21 +});
... ...
database/factories/StateFactory.php 0 → 100644
... ... @@ -0,0 +1,28 @@
  1 +<?php
  2 +
  3 +use App\Country;
  4 +use Faker\Generator as Faker;
  5 +
  6 +$factory->define(App\State::class, function (Faker $faker) {
  7 + return [
  8 + 'country_id' => function () use ($faker) {
  9 +
  10 + $country = Country::query()->inRandomOrder()->first();
  11 +
  12 + if (empty($country) || $faker->boolean()) {
  13 + $country = factory(Country::class)->create();
  14 + }
  15 +
  16 + return $country->getKey();
  17 + },
  18 + 'name' => $faker->colorName . ' State',
  19 + 'abbreviation' => function () use ($faker) {
  20 + return $faker->unique()->randomElement([
  21 + 'AA', 'BB', 'CC', 'DD', 'EE', 'FF', 'GG', 'HH', 'II', 'JJ', 'KK',
  22 + 'LL', 'MM', 'NN', 'OO', 'PP', 'QQ', 'RR', 'SS', 'TT', 'UU', 'VV',
  23 + 'WW', 'XX', 'YY', 'ZZ'
  24 + ]);
  25 + },
  26 + 'ibge' => $faker->randomNumber(6),
  27 + ];
  28 +});
... ...
database/migrations/2019_02_06_174231_adiciona_coluna_turno_matricula_turma.php 0 → 100644
... ... @@ -0,0 +1,32 @@
  1 +<?php
  2 +
  3 +use Illuminate\Support\Facades\Schema;
  4 +use Illuminate\Database\Schema\Blueprint;
  5 +use Illuminate\Database\Migrations\Migration;
  6 +
  7 +class AdicionaColunaTurnoMatriculaTurma extends Migration
  8 +{
  9 + /**
  10 + * Run the migrations.
  11 + *
  12 + * @return void
  13 + */
  14 + public function up()
  15 + {
  16 + Schema::table('pmieducar.matricula_turma', function (Blueprint $table) {
  17 + $table->integer('turno_id')->nullable();
  18 + });
  19 + }
  20 +
  21 + /**
  22 + * Reverse the migrations.
  23 + *
  24 + * @return void
  25 + */
  26 + public function down()
  27 + {
  28 + Schema::table('pmieducar.matricula_turma', function (Blueprint $table) {
  29 + $table->dropColumn('turno_id');
  30 + });
  31 + }
  32 +}
... ...
database/migrations/2019_02_06_174759_migra_turno_de_matricula_para_matricula_turma.php 0 → 100644
... ... @@ -0,0 +1,36 @@
  1 +<?php
  2 +
  3 +use Illuminate\Support\Facades\DB;
  4 +use Illuminate\Database\Migrations\Migration;
  5 +
  6 +class MigraTurnoDeMatriculaParaMatriculaTurma extends Migration
  7 +{
  8 + /**
  9 + * Run the migrations.
  10 + *
  11 + * @return void
  12 + */
  13 + public function up()
  14 + {
  15 + $sql = <<<'SQL'
  16 + UPDATE
  17 + pmieducar.matricula_turma
  18 + SET
  19 + turno_id = tmp.turno_id
  20 + FROM
  21 + (
  22 + SELECT
  23 + turno_id,
  24 + cod_matricula
  25 + FROM
  26 + pmieducar.matricula
  27 + WHERE TRUE
  28 + AND turno_id IS NOT NULL
  29 + ) AS tmp
  30 + WHERE TRUE
  31 + AND pmieducar.matricula_turma.ref_cod_matricula = tmp.cod_matricula
  32 + AND pmieducar.matricula_turma.ativo = 1
  33 +SQL;
  34 + DB::statement($sql);
  35 + }
  36 +}
... ...
database/migrations/2019_02_13_172203_adiciona_coluna_bloqueio_media.php 0 → 100644
... ... @@ -0,0 +1,32 @@
  1 +<?php
  2 +
  3 +use Illuminate\Support\Facades\Schema;
  4 +use Illuminate\Database\Schema\Blueprint;
  5 +use Illuminate\Database\Migrations\Migration;
  6 +
  7 +class AdicionaColunaBloqueioMedia extends Migration
  8 +{
  9 + /**
  10 + * Run the migrations.
  11 + *
  12 + * @return void
  13 + */
  14 + public function up()
  15 + {
  16 + Schema::table('modules.nota_componente_curricular_media', function (Blueprint $table) {
  17 + $table->boolean('bloqueada')->default(false);
  18 + });
  19 + }
  20 +
  21 + /**
  22 + * Reverse the migrations.
  23 + *
  24 + * @return void
  25 + */
  26 + public function down()
  27 + {
  28 + Schema::table('modules.nota_componente_curricular_media', function (Blueprint $table) {
  29 + $table->dropColumn('bloqueada');
  30 + });
  31 + }
  32 +}
... ...
database/migrations/2019_02_14_172200_remove_coluna_turno_matricula.php 0 → 100644
... ... @@ -0,0 +1,32 @@
  1 +<?php
  2 +
  3 +use Illuminate\Support\Facades\Schema;
  4 +use Illuminate\Database\Schema\Blueprint;
  5 +use Illuminate\Database\Migrations\Migration;
  6 +
  7 +class RemoveColunaTurnoMatricula extends Migration
  8 +{
  9 + /**
  10 + * Run the migrations.
  11 + *
  12 + * @return void
  13 + */
  14 + public function up()
  15 + {
  16 + Schema::table('pmieducar.matricula', function (Blueprint $table) {
  17 + $table->dropColumn('turno_id');
  18 + });
  19 + }
  20 +
  21 + /**
  22 + * Reverse the migrations.
  23 + *
  24 + * @return void
  25 + */
  26 + public function down()
  27 + {
  28 + Schema::table('pmieducar.matricula', function (Blueprint $table) {
  29 + $table->integer('turno_id')->nullable();
  30 + });
  31 + }
  32 +}
... ...
docker-compose.yml
... ... @@ -24,7 +24,8 @@ services:
24 24 XDEBUG_IDEKEY: xdebug
25 25 XDEBUG_REMOTE_HOST: 127.0.0.1
26 26 XDEBUG_REMOTE_PORT: 9000
27   - XDEBUG_REMOTE_ENABLE: 1
  27 + XDEBUG_REMOTE_ENABLE: 0
  28 + XDEBUG_AUTOSTART: 0
28 29 working_dir: /application
29 30 volumes:
30 31 - ./:/application
... ...
docker/php/Dockerfile
... ... @@ -22,6 +22,7 @@ ENV XDEBUG_IDEKEY xdebug
22 22 ENV XDEBUG_REMOTE_HOST 127.0.0.1
23 23 ENV XDEBUG_REMOTE_PORT 9000
24 24 ENV XDEBUG_REMOTE_ENABLE 0
  25 +ENV XDEBUG_AUTOSTART 0
25 26  
26 27 COPY xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
27 28  
... ... @@ -34,7 +35,7 @@ RUN apt-get install -y openjdk-8-jre
34 35 RUN docker-php-ext-install bcmath
35 36  
36 37 RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
37   -RUN php -r "if (hash_file('sha384', 'composer-setup.php') === '93b54496392c062774670ac18b134c3b3a95e5a5e5c8f1a9f115f203b75bf9a129d5daa8ba6a13e2cc8a1da0806388a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
  38 +RUN php -r "if (hash_file('sha384', 'composer-setup.php') === '48e3236262b34d30969dca3c37281b3b4bbe3221bda826ac6a9a62d6444cdb0dcd0615698a5cbe587c3f0fe57a54d8f5') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
38 39 RUN php composer-setup.php --install-dir=/usr/local/bin --filename=composer
39 40 RUN php -r "unlink('composer-setup.php');"
40 41  
... ... @@ -45,11 +46,12 @@ RUN apt-get install -y unzip
45 46  
46 47 RUN ln -s /application/artisan /usr/local/bin/artisan
47 48  
48   -ENV COMPOSER_ALLOW_SUPERUSER 1
49   -ENV COMPOSER_PROCESS_TIMEOUT 900
50   -
51 49 RUN mkdir -p /usr/share/man/man7
52 50 RUN apt-get install -y postgresql-client
53 51  
54 52 RUN apt-get install -y libpng-dev
55 53 RUN docker-php-ext-install gd
  54 +
  55 +ENV COMPOSER_ALLOW_SUPERUSER 1
  56 +ENV COMPOSER_PROCESS_TIMEOUT 900
  57 +ENV COMPOSER_DISABLE_XDEBUG_WARN=1
... ...
docker/php/xdebug.ini
... ... @@ -3,6 +3,6 @@ xdebug.idekey=${XDEBUG_IDEKEY}
3 3 xdebug.remote_host=${XDEBUG_REMOTE_HOST}
4 4 xdebug.remote_port=${XDEBUG_REMOTE_PORT}
5 5 xdebug.remote_enable=${XDEBUG_REMOTE_ENABLE}
6   -xdebug.remote_autostart=1
  6 +xdebug.remote_autostart=${XDEBUG_AUTOSTART}
7 7 xdebug.remote_connect_back=0
8 8 xdebug.remote_handler=dbgp
... ...
ieducar/includes/bootstrap.php
... ... @@ -37,7 +37,7 @@ setlocale(LC_ALL, &#39;en_US.UTF-8&#39;);
37 37 date_default_timezone_set($coreExt['Config']->app->locale->timezone);
38 38  
39 39 $tenantEnv = $_SERVER['HTTP_HOST'] ?? null;
40   -$devEnv = ['development', 'local'];
  40 +$devEnv = ['development', 'local', 'testing', 'dusk'];
41 41  
42 42 if ($coreExt['Config']->hasEnviromentSection($tenantEnv)) {
43 43 $coreExt['Config']->changeEnviroment($tenantEnv);
... ...
ieducar/intranet/educar_matricula_det.php
... ... @@ -187,8 +187,10 @@ class indice extends clsDetalhe
187 187 $existeTurma = false;
188 188 $existeTurmaMulti = false;
189 189 $existeTurmaUnificada = false;
  190 + $existeTurmaTurnoIntegral = false;
190 191 $nomesTurmas = array();
191 192 $datasEnturmacoes = array();
  193 +
192 194 foreach ($enturmacoes as $enturmacao) {
193 195 $turma = new clsPmieducarTurma($enturmacao['ref_cod_turma']);
194 196 $turma = $turma->detalhe();
... ... @@ -201,6 +203,9 @@ class indice extends clsDetalhe
201 203 if (in_array($turma['etapa_educacenso'], App_Model_Educacenso::etapasEnsinoUnificadas())) {
202 204 $existeTurmaUnificada = true;
203 205 }
  206 + if ($turma['turma_turno_id'] == clsPmieducarTurma::TURNO_INTEGRAL) {
  207 + $existeTurmaTurnoIntegral = true;
  208 + }
204 209 }
205 210 $nomesTurmas = implode('<br />', $nomesTurmas);
206 211 $datasEnturmacoes = implode('<br />', $datasEnturmacoes);
... ... @@ -214,22 +219,6 @@ class indice extends clsDetalhe
214 219 $this->addDetalhe(array('Data Enturmação', ''));
215 220 }
216 221  
217   - switch ($registro['turno_id']) {
218   - case 1:
219   - $nm_turno = 'Matutino';
220   - break;
221   - case 2:
222   - $nm_turno = 'Vespertino';
223   - break;
224   - case 3:
225   - $nm_turno = 'Integral';
226   - break;
227   - }
228   -
229   - if ($registro['turno_id']) {
230   - $this->addDetalhe(array('Turno da matrícula', $nm_turno));
231   - }
232   -
233 222 if ($registro['ref_cod_reserva_vaga']) {
234 223 $this->addDetalhe(array('Número Reserva Vaga', $registro['ref_cod_reserva_vaga']));
235 224 }
... ... @@ -330,9 +319,6 @@ class indice extends clsDetalhe
330 319 $this->array_botao[] = _cl('matricula.detalhe.enturmar');
331 320 $this->array_botao_url_script[] = "go(\"educar_matricula_turma_lst.php?ref_cod_matricula={$registro['cod_matricula']}&ano_letivo={$registro['ano']}\")";
332 321  
333   - $this->array_botao[] = 'Turno';
334   - $this->array_botao_url_script[] = "go(\"educar_matricula_turno_cad.php?cod_matricula={$registro['cod_matricula']}&ref_cod_aluno={$registro['ref_cod_aluno']}\");";
335   -
336 322 $this->array_botao[] = 'Abandono';
337 323 $this->array_botao_url_script[] = "go(\"educar_abandono_cad.php?ref_cod_matricula={$registro['cod_matricula']}&ref_cod_aluno={$registro['ref_cod_aluno']}\");";
338 324  
... ... @@ -350,6 +336,11 @@ class indice extends clsDetalhe
350 336 $this->array_botao_url_script[] = "go(\"educar_matricula_etapa_turma_cad.php?ref_cod_matricula={$registro['cod_matricula']}&ref_cod_aluno={$registro['ref_cod_aluno']}\")";
351 337 }
352 338  
  339 + if ($existeTurmaTurnoIntegral) {
  340 + $this->array_botao[] = 'Turno';
  341 + $this->array_botao_url_script[] = "go(\"educar_matricula_turma_turno_cad.php?ref_cod_matricula={$registro['cod_matricula']}&ref_cod_aluno={$registro['ref_cod_aluno']}\")";
  342 + }
  343 +
353 344 if ($existeTurmaUnificada) {
354 345 $this->array_botao[] = 'Etapa da turma unificada';
355 346 $this->array_botao_url_script[] = "go(\"educar_matricula_turma_unificada_cad.php?ref_cod_matricula={$registro['cod_matricula']}&ref_cod_aluno={$registro['ref_cod_aluno']}\")";
... ...
ieducar/intranet/educar_matricula_historico_lst.php
... ... @@ -100,6 +100,7 @@ class indice extends clsListagem
100 100 $this->addCabecalhos(array(
101 101 'Sequencial',
102 102 'Turma',
  103 + 'Turno do aluno',
103 104 'Ativo',
104 105 'Data de enturmação',
105 106 'Data de saída',
... ... @@ -166,10 +167,16 @@ class indice extends clsListagem
166 167 $usuarioEditou = new clsPessoa_($registro['ref_usuario_exc']);
167 168 $usuarioEditou = $usuarioEditou->detalhe();
168 169  
  170 + $turno = '';
  171 + if ($registro['turno_id']) {
  172 + $turno = Portabilis_Utils_Database::selectField('SELECT nome FROM pmieducar.turma_turno WHERE id = $1', [$registro['turno_id']]);
  173 + }
  174 +
169 175 $this->addLinhas(
170 176 array(
171 177 "<a href=\"educar_matricula_historico_cad.php?ref_cod_matricula={$registro["ref_cod_matricula"]}&ref_cod_turma={$registro["ref_cod_turma"]}&sequencial={$registro["sequencial"]} \">{$registro["sequencial"]}</a>",
172 178 "<a href=\"educar_matricula_historico_cad.php?ref_cod_matricula={$registro["ref_cod_matricula"]}&ref_cod_turma={$registro["ref_cod_turma"]}&sequencial={$registro["sequencial"]} \">{$registro["nm_turma"]}</a>",
  179 + "<a href=\"educar_matricula_historico_cad.php?ref_cod_matricula={$registro["ref_cod_matricula"]}&ref_cod_turma={$registro["ref_cod_turma"]}&sequencial={$registro["sequencial"]} \">{$turno}</a>",
173 180 "<a href=\"educar_matricula_historico_cad.php?ref_cod_matricula={$registro["ref_cod_matricula"]}&ref_cod_turma={$registro["ref_cod_turma"]}&sequencial={$registro["sequencial"]} \">{$ativo}</a>",
174 181 "<a href=\"educar_matricula_historico_cad.php?ref_cod_matricula={$registro["ref_cod_matricula"]}&ref_cod_turma={$registro["ref_cod_turma"]}&sequencial={$registro["sequencial"]} \">{$dataEnturmacao}</a>",
175 182 "<a href=\"educar_matricula_historico_cad.php?ref_cod_matricula={$registro["ref_cod_matricula"]}&ref_cod_turma={$registro["ref_cod_turma"]}&sequencial={$registro["sequencial"]} \">{$dataSaida}</a>",
... ... @@ -183,6 +190,9 @@ class indice extends clsListagem
183 190 ));
184 191 }
185 192 }
  193 +
  194 + $this->addLinhas('<small>A coluna "Turno do aluno" permanecerá em branco quando o turno do aluno for o mesmo da turma.</small>');
  195 +
186 196 $this->addPaginador2( "educar_matricula_historico_lst.php", $total, $_GET, $this->nome, $this->limite );
187 197  
188 198 $this->acao = "go(\"educar_matricula_det.php?cod_matricula={$this->ref_cod_matricula}\")";
... ...
ieducar/intranet/educar_matricula_reclassificar_cad.php
... ... @@ -226,11 +226,14 @@ class indice extends clsCadastro
226 226 echo "<script>alert('Erro ao desativar enturmações da matrícula: {$this->cod_matricula}\nContate o administrador do sistema informando a matrícula!');</script>";
227 227 }
228 228  
229   - $notaAlunoId = (new Avaliacao_Model_NotaAlunoDataMapper())
230   - ->findAll(['id'], ['matricula_id' => $this->cod_matricula])[0]->get('id');
  229 + $notaAluno = (new Avaliacao_Model_NotaAlunoDataMapper())
  230 + ->findAll(['id'], ['matricula_id' => $this->cod_matricula])[0];
231 231  
232   - (new Avaliacao_Model_NotaComponenteMediaDataMapper())
233   - ->updateSituation($notaAlunoId, App_Model_MatriculaSituacao::RECLASSIFICADO);
  232 + if (!is_null($notaAluno)) {
  233 + $notaAlunoId = $notaAluno->get('id');
  234 + (new Avaliacao_Model_NotaComponenteMediaDataMapper())
  235 + ->updateSituation($notaAlunoId, App_Model_MatriculaSituacao::RECLASSIFICADO);
  236 + }
234 237  
235 238 //window.location='educar_matricula_det.php?cod_matricula={$this->cod_matricula}&ref_cod_aluno={$this->ref_cod_aluno}';
236 239 echo "<script>alert('Reclassificação realizada com sucesso!\\nO Código da nova matrícula é: $cadastrou.');
... ...
ieducar/intranet/educar_matricula_turma_cad.php
... ... @@ -97,7 +97,7 @@ class indice extends clsCadastro
97 97 }
98 98 }
99 99  
100   - function novaEnturmacao($matriculaId, $turmaDestinoId) {
  100 + function novaEnturmacao($matriculaId, $turmaDestinoId, $turnoId = null) {
101 101 if (!$this->validaDataEnturmacao($matriculaId, $turmaDestinoId)) {
102 102 return false;
103 103 }
... ... @@ -115,20 +115,23 @@ class indice extends clsCadastro
115 115  
116 116 $enturmacaoExists = is_array($enturmacaoExists) && count($enturmacaoExists) > 0;
117 117  
118   - if (!$enturmacaoExists) {
119   - $enturmacao = new clsPmieducarMatriculaTurma($matriculaId,
120   - $turmaDestinoId,
121   - $this->pessoa_logada,
122   - $this->pessoa_logada,
123   - NULL,
124   - NULL,
125   - 1);
126   -
127   - $enturmacao->data_enturmacao = $this->data_enturmacao;
128   - $this->atualizaUltimaEnturmacao($matriculaId);
129   - return $enturmacao->cadastra();
  118 + if ($enturmacaoExists) {
  119 + return false;
130 120 }
131   - return false;
  121 +
  122 + $enturmacao = new clsPmieducarMatriculaTurma($matriculaId,
  123 + $turmaDestinoId,
  124 + $this->pessoa_logada,
  125 + $this->pessoa_logada,
  126 + NULL,
  127 + NULL,
  128 + 1);
  129 +
  130 + $enturmacao->data_enturmacao = $this->data_enturmacao;
  131 +
  132 + $enturmacao->turno_id = $turnoId;
  133 + $this->atualizaUltimaEnturmacao($matriculaId);
  134 + return $enturmacao->cadastra();
132 135 }
133 136  
134 137 public function validaDataEnturmacao($matriculaId, $turmaDestinoId, $transferir = false)
... ... @@ -172,8 +175,20 @@ class indice extends clsCadastro
172 175 return false;
173 176 }
174 177  
  178 + $turnoId = null;
  179 +
  180 + if ($this->isTurmaIntegral($turmaDestinoId)) {
  181 + $sequencialEnturmacaoAnterior = $this->getSequencialEnturmacaoByTurmaId($matriculaId, $turmaOrigemId);
  182 + $enturmacao = new clsPmieducarMatriculaTurma;
  183 + $enturmacao->ref_cod_matricula = $matriculaId;
  184 + $enturmacao->ref_cod_turma = $turmaOrigemId;
  185 + $enturmacao->sequencial = $sequencialEnturmacaoAnterior;
  186 + $dadosEnturmacaoAnterior = $enturmacao->detalhe();
  187 + $turnoId = $dadosEnturmacaoAnterior['turno_id'];
  188 + }
  189 +
175 190 if($this->removerEnturmacao($matriculaId, $turmaOrigemId, TRUE)) {
176   - return $this->novaEnturmacao($matriculaId, $turmaDestinoId);
  191 + return $this->novaEnturmacao($matriculaId, $turmaDestinoId, $turnoId);
177 192 }
178 193  
179 194 return false;
... ... @@ -212,6 +227,7 @@ class indice extends clsCadastro
212 227 NULL,
213 228 $sequencialEnturmacao);
214 229 $detEnturmacao = $enturmacao->detalhe();
  230 +
215 231 $detEnturmacao = $detEnturmacao['data_enturmacao'];
216 232 $enturmacao->data_enturmacao = $detEnturmacao;
217 233  
... ... @@ -300,6 +316,13 @@ class indice extends clsCadastro
300 316 function Excluir()
301 317 {
302 318 }
  319 +
  320 + public function isTurmaIntegral($turmaId)
  321 + {
  322 + $turma = new clsPmieducarTurma($turmaId);
  323 + $turma = $turma->detalhe();
  324 + return $turma['turma_turno_id'] == clsPmieducarTurma::TURNO_INTEGRAL;
  325 + }
303 326 }
304 327  
305 328 // Instancia objeto de página
... ...
ieducar/intranet/educar_matricula_turma_det.php
... ... @@ -264,8 +264,9 @@ class indice extends clsDetalhe
264 264 $this->addDetalhe(array('<b>Enturmação atual</b>', $selectEnturmacoes));
265 265 }
266 266  
267   - if(!$this->possuiEnturmacaoTurmaDestino)
268   - $this->addDetalhe(array('Data da enturmação', '<input onkeypress="formataData(this,event);" value="" class="geral" type="text" name="data_enturmacao" id="data_enturmacao" size="9" maxlength="10"/>'));
  267 + if(!$this->possuiEnturmacaoTurmaDestino) {
  268 + $this->addDetalhe(array('Data da enturmação', '<input onkeypress="formataData(this,event);" value="" class="geral" type="text" name="data_enturmacao" id="data_enturmacao" size="9" maxlength="10"/>'));
  269 + }
269 270  
270 271 $this->addDetalhe(array(
271 272 '-',
... ... @@ -329,7 +330,7 @@ class indice extends clsDetalhe
329 330 }
330 331  
331 332 %s
332   -
  333 +
333 334 document.formcadastro.ref_cod_matricula.value = ref_cod_matricula;
334 335 document.formcadastro.ref_cod_turma_destino.value = ref_cod_turma_destino;
335 336 document.formcadastro.data_enturmacao.value = document.getElementById("data_enturmacao").value;
... ...
ieducar/intranet/educar_matricula_turma_turno_cad.php 0 → 100644
... ... @@ -0,0 +1,130 @@
  1 +<?php
  2 +
  3 +require_once "include/clsBase.inc.php";
  4 +require_once "include/clsCadastro.inc.php";
  5 +require_once "include/clsBanco.inc.php";
  6 +require_once "include/pmieducar/geral.inc.php";
  7 +require_once 'lib/Portabilis/Date/Utils.php';
  8 +require_once 'lib/App/Model/Educacenso.php';
  9 +
  10 +class clsIndexBase extends clsBase
  11 +{
  12 + public function Formular()
  13 + {
  14 + $this->SetTitulo("{$this->_instituicao} i-Educar - Turno do aluno");
  15 + $this->processoAp = "578";
  16 + $this->addEstilo("localizacaoSistema");
  17 + }
  18 +}
  19 +
  20 +class indice extends clsCadastro
  21 +{
  22 + public $cod_matricula;
  23 + public $ref_cod_aluno;
  24 + public $turno;
  25 +
  26 + public function Formular()
  27 + {
  28 + $this->nome_url_cancelar = "Voltar";
  29 + $this->url_cancelar = "educar_matricula_det.php?cod_matricula={$this->cod_matricula}";
  30 +
  31 + $this->breadcrumb('Turno do aluno', [
  32 + $_SERVER['SERVER_NAME'] . "/intranet" => "Início",
  33 + "educar_index.php" => "Escola",
  34 + ]);
  35 + }
  36 +
  37 + public function Inicializar()
  38 + {
  39 + $this->cod_matricula = $_GET["ref_cod_matricula"];
  40 + $this->ref_cod_aluno = $_GET["ref_cod_aluno"];
  41 +
  42 + $this->validaPermissao();
  43 + $this->validaParametros();
  44 + return 'Editar';
  45 + }
  46 +
  47 + public function Gerar()
  48 + {
  49 + $this->campoOculto("cod_matricula", $this->cod_matricula);
  50 + $this->campoOculto("ref_cod_aluno", $this->ref_cod_aluno);
  51 +
  52 + $obj_aluno = new clsPmieducarAluno();
  53 + $lst_aluno = $obj_aluno->lista($this->ref_cod_aluno, null, null, null, null, null, null, null, null, null, 1);
  54 + if (is_array($lst_aluno)) {
  55 + $det_aluno = array_shift($lst_aluno);
  56 + $this->nm_aluno = $det_aluno["nome_aluno"];
  57 + $this->campoRotulo("nm_aluno", "Aluno", $this->nm_aluno);
  58 + }
  59 + $enturmacoes = new clsPmieducarMatriculaTurma();
  60 + $enturmacoes = $enturmacoes->lista(
  61 + $this->cod_matricula, null, null,
  62 + null, null, null, null, null, 1, null, null, null,
  63 + null, null, null, null, null, null, null, null, false,
  64 + null, null, null, false, false, false, null, null,
  65 + false, null, false, false, false
  66 + );
  67 +
  68 + $turnos = [
  69 + 0 => 'Selecione',
  70 + clsPmieducarTurma::TURNO_MATUTINO => 'Matutino',
  71 + clsPmieducarTurma::TURNO_VESPERTINO => 'Vespertino'
  72 + ];
  73 +
  74 + foreach ($enturmacoes as $enturmacao) {
  75 + $turma = new clsPmieducarTurma($enturmacao['ref_cod_turma']);
  76 + $turma = $turma->detalhe();
  77 + if ($turma['turma_turno_id'] != clsPmieducarTurma::TURNO_INTEGRAL) {
  78 + continue;
  79 + }
  80 +
  81 + $this->campoLista("turno[{$enturmacao['ref_cod_turma']}-{$enturmacao['sequencial']}]", "Turno do aluno na turma: {$enturmacao['nm_turma']}", $turnos, $enturmacao['turno_id'], '', false, '', '', false, false);
  82 + }
  83 + }
  84 +
  85 + public function Editar()
  86 + {
  87 + $this->validaPermissao();
  88 + $this->validaParametros();
  89 +
  90 + foreach ($this->turno as $codTurmaESequencial => $turno) {
  91 + // Necessário pois chave é Turma + Matrícula + Sequencial
  92 + $codTurmaESequencial = explode('-', $codTurmaESequencial);
  93 + $codTurma = $codTurmaESequencial[0];
  94 + $sequencial = $codTurmaESequencial[1];
  95 + $obj = new clsPmieducarMatriculaTurma($this->cod_matricula, $codTurma, $this->pessoa_logada);
  96 + $obj->sequencial = $sequencial;
  97 + $obj->turno_id = $turno;
  98 + $obj->edita();
  99 + }
  100 +
  101 + $this->mensagem .= "Turno atualizado com sucesso.<br>";
  102 + return true;
  103 + }
  104 +
  105 + private function validaPermissao()
  106 + {
  107 + $obj_permissoes = new clsPermissoes();
  108 + $obj_permissoes->permissao_cadastra(578, $this->pessoa_logada, 7, "educar_matricula_lst.php?ref_cod_aluno={$this->ref_cod_aluno}");
  109 + }
  110 +
  111 + private function validaParametros()
  112 + {
  113 + $obj_matricula = new clsPmieducarMatricula($this->cod_matricula);
  114 + $det_matricula = $obj_matricula->detalhe();
  115 +
  116 + if (!$det_matricula) {
  117 + header("location: educar_matricula_lst.php?ref_cod_aluno={$this->ref_cod_aluno}");
  118 + }
  119 +
  120 + }
  121 +}
  122 +
  123 +// cria uma extensao da classe base
  124 +$pagina = new clsIndexBase();
  125 +// cria o conteudo
  126 +$miolo = new indice();
  127 +// adiciona o conteudo na clsBase
  128 +$pagina->addForm($miolo);
  129 +// gera o html
  130 +$pagina->MakeAll();
... ...
ieducar/intranet/educar_matricula_turno_cad.php
... ... @@ -1,159 +0,0 @@
1   -<?php
2   -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
3   - * *
4   - * @author Prefeitura Municipal de Itajaí *
5   - * @updated 29/03/2007 *
6   - * Pacote: i-PLB Software Público Livre e Brasileiro *
7   - * *
8   - * Copyright (C) 2006 PMI - Prefeitura Municipal de Itajaí *
9   - * ctima@itajai.sc.gov.br *
10   - * *
11   - * Este programa é software livre, você pode redistribuí-lo e/ou *
12   - * modificá-lo sob os termos da Licença Pública Geral GNU, conforme *
13   - * publicada pela Free Software Foundation, tanto a versão 2 da *
14   - * Licença como (a seu critério) qualquer versão mais nova. *
15   - * *
16   - * Este programa é distribuído na expectativa de ser útil, mas SEM *
17   - * QUALQUER GARANTIA. Sem mesmo a garantia implícita de COMERCIALI- *
18   - * ZAÇÃO ou de ADEQUAÇÃO A QUALQUER PROPÓSITO EM PARTICULAR. Con- *
19   - * sulte a Licença Pública Geral GNU para obter mais detalhes. *
20   - * *
21   - * Você deve ter recebido uma cópia da Licença Pública Geral GNU *
22   - * junto com este programa. Se não, escreva para a Free Software *
23   - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA *
24   - * 02111-1307, USA. *
25   - * *
26   - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
27   -require_once ("include/clsBase.inc.php");
28   -require_once ("include/clsCadastro.inc.php");
29   -require_once ("include/clsBanco.inc.php");
30   -require_once( "include/pmieducar/geral.inc.php");
31   -require_once 'lib/Portabilis/Date/Utils.php';
32   -
33   -class clsIndexBase extends clsBase
34   -{
35   - function Formular()
36   - {
37   - $this->SetTitulo( "{$this->_instituicao} i-Educar - Turno da matrícula" );
38   - $this->processoAp = "578";
39   - $this->addEstilo("localizacaoSistema");
40   - }
41   -}
42   -
43   -class indice extends clsCadastro
44   -{
45   - /**
46   - * Referencia pega da session para o idpes do usuario atual
47   - *
48   - * @var int
49   - */
50   - var $pessoa_logada;
51   -
52   - var $cod_matricula;
53   - var $turno_id;
54   - var $ref_cod_aluno;
55   - var $nm_aluno;
56   -
57   - function Inicializar()
58   - {
59   - $retorno = "Novo";
60   - @session_start();
61   - $this->pessoa_logada = $_SESSION['id_pessoa'];
62   - @session_write_close();
63   -
64   - $this->cod_matricula = $_GET["cod_matricula"];
65   - $this->ref_cod_aluno = $_GET["ref_cod_aluno"];
66   - $cancela = $_GET["cancela"];
67   -
68   - $obj_permissoes = new clsPermissoes();
69   - $obj_permissoes->permissao_cadastra( 578, $this->pessoa_logada, 7, "educar_matricula_det.php?ref_cod_aluno={$this->cod_matricula}" );
70   -
71   - $obj_matricula = new clsPmieducarMatricula($this->cod_matricula);
72   -
73   - $det_matricula = $obj_matricula->detalhe();
74   -
75   - if ($det_matricula) {
76   - $retorno = 'Editar';
77   - }
78   -
79   - $this->turno_id = $det_matricula['turno_id'];
80   -
81   - $this->url_cancelar = "educar_matricula_det.php?cod_matricula={$this->cod_matricula}";
82   -
83   - $localizacao = new LocalizacaoSistema();
84   - $localizacao->entradaCaminhos( array(
85   - $_SERVER['SERVER_NAME']."/intranet" => "Início",
86   - "educar_index.php" => "Escola",
87   - "" => "Turno da matrícula"
88   - ));
89   -
90   - $this->enviaLocalizacao($localizacao->montar());
91   -
92   - $this->nome_url_cancelar = "Cancelar";
93   -
94   - return $retorno;
95   - }
96   -
97   - function Gerar()
98   - {
99   - $this->campoOculto( "ref_cod_aluno", $this->ref_cod_aluno );
100   - $this->campoOculto( "cod_matricula", $this->cod_matricula );
101   -
102   - $obj_aluno = new clsPmieducarAluno();
103   - $lst_aluno = $obj_aluno->lista( $this->ref_cod_aluno,null,null,null,null,null,null,null,null,null,1 );
104   - if ( is_array($lst_aluno) )
105   - {
106   - $det_aluno = array_shift($lst_aluno);
107   - $this->nm_aluno = $det_aluno["nome_aluno"];
108   - $this->campoTexto( "nm_aluno", "Aluno", $this->nm_aluno, 30, 255, false,false,false,"","","","",true );
109   - }
110   -
111   - $this->inputsHelper()->turmaTurno(array('value' => $this->turno_id, 'required' => false), array('attrName' => 'turno_id'));
112   - }
113   -
114   - function Editar()
115   - {
116   - @session_start();
117   - $this->pessoa_logada = $_SESSION['id_pessoa'];
118   - @session_write_close();
119   -
120   - $obj_permissoes = new clsPermissoes();
121   - $obj_permissoes->permissao_cadastra( 578, $this->pessoa_logada, 7, "educar_matricula_det.php?cod_matricula={$this->cod_matricula}" );
122   -
123   - $obj_matricula = new clsPmieducarMatricula($this->cod_matricula);
124   -
125   - $atualizaTurno = $obj_matricula->atualizaTurno($this->cod_matricula, $this->turno_id);
126   -
127   - if ($atualizaTurno) {
128   - $this->mensagem .= "Turno atualizado com sucesso.<br>";
129   - header( "Location: educar_matricula_det.php?cod_matricula={$this->cod_matricula}" );
130   - return true;
131   - }
132   -
133   - $this->mensagem = "Turno não atualizado.<br>";
134   - return false;
135   -
136   - }
137   -
138   - function Excluir()
139   - {
140   - @session_start();
141   - $this->pessoa_logada = $_SESSION['id_pessoa'];
142   - @session_write_close();
143   -
144   - $obj_permissoes = new clsPermissoes();
145   - $obj_permissoes->permissao_excluir( 578, $this->pessoa_logada, 7, "educar_matricula_det.php?cod_matricula={$this->cod_matricula}" );
146   - }
147   -
148   -
149   -}
150   -
151   -// cria uma extensao da classe base
152   -$pagina = new clsIndexBase();
153   -// cria o conteudo
154   -$miolo = new indice();
155   -// adiciona o conteudo na clsBase
156   -$pagina->addForm( $miolo );
157   -// gera o html
158   -$pagina->MakeAll();
159   -?>
ieducar/intranet/educar_servidor_cad.php
... ... @@ -102,6 +102,7 @@ class indice extends clsCadastro
102 102 var $curso_formacao_continuada;
103 103 var $multi_seriado;
104 104 var $matricula = array();
  105 + var $cod_servidor_funcao = [];
105 106  
106 107 var $total_horas_alocadas;
107 108  
... ... @@ -192,7 +193,7 @@ class indice extends clsCadastro
192 193 $obj_funcao = new clsPmieducarFuncao($funcao['ref_cod_funcao']);
193 194 $det_funcao = $obj_funcao->detalhe();
194 195  
195   - $this->ref_cod_funcao[] = array($funcao['ref_cod_funcao'] . '-' . $det_funcao['professor'], null, null, $funcao['matricula']);
  196 + $this->ref_cod_funcao[] = array($funcao['ref_cod_funcao'] . '-' . $det_funcao['professor'], null, null, $funcao['matricula'], $funcao['cod_servidor_funcao']);
196 197  
197 198 if (false == $this->docente && (bool) $det_funcao['professor']) {
198 199 $this->docente = true;
... ... @@ -382,6 +383,8 @@ class indice extends clsCadastro
382 383  
383 384 $this->campoTexto('matricula', 'Matricula', $this->matricula);
384 385  
  386 + $this->campoOculto('cod_servidor_funcao', null);
  387 +
385 388 $this->campoTabelaFim();
386 389  
387 390 if (strtoupper($this->tipoacao) == 'EDITAR') {
... ... @@ -690,6 +693,20 @@ class indice extends clsCadastro
690 693  
691 694 Portabilis_View_Helper_Application::loadStylesheet($this, $styles);
692 695  
  696 + $script = <<<'JS'
  697 +(function () {
  698 + $j('.ref_cod_funcao select').each(function () {
  699 + const $this = $j(this);
  700 + const value = $this.val();
  701 +
  702 + if (value != '') {
  703 + $this.data('valor-original', value);
  704 + }
  705 + });
  706 +})();
  707 +JS;
  708 +
  709 + Portabilis_View_Helper_Application::embedJavascript($this, $script);
693 710 }
694 711  
695 712 function Novo()
... ... @@ -705,7 +722,7 @@ class indice extends clsCadastro
705 722 $this->carga_horaria = $hour + $min;
706 723  
707 724 $this->pos_graduacao = '{' . implode(',', $this->pos_graduacao) . '}';
708   -
  725 +
709 726 $this->curso_formacao_continuada = '{' . implode(',', $this->curso_formacao_continuada) . '}';
710 727  
711 728 @session_start();
... ... @@ -971,29 +988,23 @@ class indice extends clsCadastro
971 988 {
972 989 @session_start();
973 990 $cursos_disciplina = $_SESSION['cursos_disciplina'];
974   - $cursos_servidor = $_SESSION['cursos_servidor'];
  991 + $cursos_servidor = $_SESSION['cursos_servidor'];
975 992 @session_write_close();
976 993  
977   - $existe_funcao_professor = FALSE;
978 994 $listFuncoesCadastradas = array();
979   - if ($this->ref_cod_funcao) {
980   - $cont = -1;
981 995  
982   - foreach ($this->ref_cod_funcao as $funcao) {
983   - $cont++;
984   - $funcao_professor = explode('-', $funcao);
985   - $funcao = array_shift($funcao_professor);
986   - $professor = array_shift($funcao_professor);
  996 + if ($this->ref_cod_funcao) {
  997 + foreach ($this->ref_cod_funcao as $k => $funcao) {
  998 + list($funcao, $professor) = explode('-', $funcao);
987 999  
988   - if ($professor) {
989   - $existe_funcao_professor = true;
990   - }
  1000 + $existe_funcao_professor = (bool) $professor;
  1001 + $cod_servidor_funcao = $this->cod_servidor_funcao[$k];
  1002 + $obj_servidor_funcao = new clsPmieducarServidorFuncao(null, null, null, null, $cod_servidor_funcao);
991 1003  
992   - $obj_servidor_funcao = new clsPmieducarServidorFuncao($this->ref_cod_instituicao, $this->cod_servidor, $funcao);
993 1004 if ($obj_servidor_funcao->existe()) {
994   - $this->atualizaFuncao($funcao,$this->matricula[$cont]);
  1005 + $this->atualizaFuncao($obj_servidor_funcao, $funcao, $this->matricula[$k]);
995 1006 } else {
996   - $this->cadastraFuncao($funcao,$this->matricula[$cont]);
  1007 + $this->cadastraFuncao($funcao, $this->matricula[$k]);
997 1008 }
998 1009 array_push($listFuncoesCadastradas,$funcao);
999 1010 }
... ... @@ -1044,9 +1055,11 @@ class indice extends clsCadastro
1044 1055 $obj_servidor_funcao->excluirFuncoesRemovidas($funcoes);
1045 1056 }
1046 1057  
1047   - function atualizaFuncao($funcao,$matricula)
  1058 + function atualizaFuncao($obj_servidor_funcao, $funcao, $matricula)
1048 1059 {
1049   - $obj_servidor_funcao = new clsPmieducarServidorFuncao($this->ref_cod_instituicao, $this->cod_servidor, $funcao, $matricula);
  1060 + $obj_servidor_funcao->ref_cod_funcao = $funcao;
  1061 + $obj_servidor_funcao->matricula = $matricula;
  1062 +
1050 1063 $obj_servidor_funcao->edita();
1051 1064 }
1052 1065  
... ...
ieducar/intranet/include/pmieducar/clsPmieducarConfiguracoesGerais.inc.php
... ... @@ -134,11 +134,11 @@ class clsPmieducarConfiguracoesGerais
134 134 ieducar_external_footer, ieducar_internal_footer, facebook_url, twitter_url, linkedin_url,
135 135 ieducar_suspension_message, bloquear_cadastro_aluno';
136 136  
137   - if (!empty($campos['ref_cod_instituicao']) && is_numeric($campos['ref_cod_instituicao'])) {
  137 + if (is_numeric($campos['ref_cod_instituicao'])) {
138 138 $this->ref_cod_instituicao = $campos['ref_cod_instituicao'];
139 139 }
140 140  
141   - if (!empty($campos['permite_relacionamento_posvendas']) && is_numeric($campos['permite_relacionamento_posvendas'])) {
  141 + if (is_numeric($campos['permite_relacionamento_posvendas'])) {
142 142 $this->permite_relacionamento_posvendas = $campos['permite_relacionamento_posvendas'];
143 143 }
144 144  
... ... @@ -146,11 +146,11 @@ class clsPmieducarConfiguracoesGerais
146 146 $this->url_novo_educacao = $campos['url_novo_educacao'];
147 147 }
148 148  
149   - if (!empty($campos['mostrar_codigo_inep_aluno']) && is_numeric($campos['mostrar_codigo_inep_aluno'])) {
  149 + if (is_numeric($campos['mostrar_codigo_inep_aluno'])) {
150 150 $this->mostrar_codigo_inep_aluno = $campos['mostrar_codigo_inep_aluno'];
151 151 }
152 152  
153   - if (!empty($campos['justificativa_falta_documentacao_obrigatorio']) && is_numeric($campos['justificativa_falta_documentacao_obrigatorio'])) {
  153 + if (is_numeric($campos['justificativa_falta_documentacao_obrigatorio'])) {
154 154 $this->justificativa_falta_documentacao_obrigatorio = $campos['justificativa_falta_documentacao_obrigatorio'];
155 155 }
156 156  
... ... @@ -170,7 +170,7 @@ class clsPmieducarConfiguracoesGerais
170 170 $this->url_cadastro_usuario = $campos['url_cadastro_usuario'];
171 171 }
172 172  
173   - if (isset($campos['active_on_ieducar']) && is_numeric($campos['active_on_ieducar'])) {
  173 + if (is_numeric($campos['active_on_ieducar'])) {
174 174 $this->active_on_ieducar = $campos['active_on_ieducar'];
175 175 }
176 176  
... ...
ieducar/intranet/include/pmieducar/clsPmieducarMatricula.inc.php
... ... @@ -29,7 +29,6 @@ class clsPmieducarMatricula
29 29 public $data_cancel;
30 30 public $turno_pre_matricula;
31 31 public $dependencia;
32   - public $turno_id;
33 32 public $pessoa_logada;
34 33  
35 34 /**
... ... @@ -133,8 +132,7 @@ class clsPmieducarMatricula
133 132 $semestre = null,
134 133 $data_matricula = null,
135 134 $data_cancel = null,
136   - $ref_cod_abandono = null,
137   - $turno_id = null
  135 + $ref_cod_abandono = null
138 136 ) {
139 137 $db = new clsBanco();
140 138 $this->db = $db;
... ... @@ -145,7 +143,7 @@ class clsPmieducarMatricula
145 143 $this->pessoa_logada = $_SESSION['id_pessoa'];
146 144 session_write_close();
147 145  
148   - $this->_campos_lista = $this->_todos_campos = 'm.cod_matricula, m.ref_cod_reserva_vaga, m.ref_ref_cod_escola, m.ref_ref_cod_serie, m.ref_usuario_exc, m.ref_usuario_cad, m.ref_cod_aluno, m.aprovado, m.data_cadastro, m.data_exclusao, m.ativo, m.ano, m.ultima_matricula, m.modulo,formando,descricao_reclassificacao,matricula_reclassificacao, m.ref_cod_curso,m.matricula_transferencia,m.semestre, m.data_matricula, m.data_cancel, m.ref_cod_abandono_tipo, m.turno_pre_matricula, m.dependencia, data_saida_escola, turno_id';
  146 + $this->_campos_lista = $this->_todos_campos = 'm.cod_matricula, m.ref_cod_reserva_vaga, m.ref_ref_cod_escola, m.ref_ref_cod_serie, m.ref_usuario_exc, m.ref_usuario_cad, m.ref_cod_aluno, m.aprovado, m.data_cadastro, m.data_exclusao, m.ativo, m.ano, m.ultima_matricula, m.modulo,formando,descricao_reclassificacao,matricula_reclassificacao, m.ref_cod_curso,m.matricula_transferencia,m.semestre, m.data_matricula, m.data_cancel, m.ref_cod_abandono_tipo, m.turno_pre_matricula, m.dependencia, data_saida_escola';
149 147  
150 148 if (is_numeric($ref_usuario_exc)) {
151 149 if (class_exists('clsPmieducarUsuario')) {
... ... @@ -314,10 +312,6 @@ class clsPmieducarMatricula
314 312 if (is_string($data_cancel)) {
315 313 $this->data_cancel = $data_cancel;
316 314 }
317   -
318   - if (is_numeric($turno_id)) {
319   - $this->turno_id = $turno_id;
320   - }
321 315 }
322 316  
323 317 /**
... ... @@ -1270,27 +1264,6 @@ class clsPmieducarMatricula
1270 1264 return false;
1271 1265 }
1272 1266  
1273   - public function atualizaTurno($cod_matricula, $turno_id)
1274   - {
1275   - if ($turno_id == '') {
1276   - $turno_id = 'NULL';
1277   - }
1278   -
1279   - if (is_numeric($cod_matricula)) {
1280   - $db = new clsBanco();
1281   -
1282   - $sql = "UPDATE pmieducar.matricula
1283   - SET turno_id = $turno_id
1284   - WHERE cod_matricula = $cod_matricula;";
1285   -
1286   - $db->Consulta($sql);
1287   -
1288   - return true;
1289   - }
1290   -
1291   - return false;
1292   - }
1293   -
1294 1267 public function getDadosUltimaMatricula($codAluno)
1295 1268 {
1296 1269 $db = new clsBanco();
... ...
ieducar/intranet/include/pmieducar/clsPmieducarMatriculaTurma.inc.php
... ... @@ -62,6 +62,7 @@ class clsPmieducarMatriculaTurma
62 62 var $etapa_educacenso;
63 63 var $turma_unificada;
64 64 var $remanejado;
  65 + var $turno_id;
65 66  
66 67 /**
67 68 * Armazena o total de resultados obtidos na última chamada ao método lista().
... ... @@ -130,7 +131,7 @@ class clsPmieducarMatriculaTurma
130 131 $this->pessoa_logada = $_SESSION['id_pessoa'];
131 132 session_write_close();
132 133  
133   - $this->_campos_lista = $this->_todos_campos = "mt.ref_cod_matricula, mt.abandono, mt.reclassificado, mt.remanejado, mt.transferido, mt.falecido, mt.ref_cod_turma, mt.etapa_educacenso, mt.turma_unificada, mt.ref_usuario_exc, mt.ref_usuario_cad, mt.data_cadastro, mt.data_exclusao, mt.ativo, mt.sequencial, mt.data_enturmacao, (SELECT pes.nome FROM cadastro.pessoa pes, pmieducar.aluno alu, pmieducar.matricula mat WHERE pes.idpes = alu.ref_idpes AND mat.ref_cod_aluno = alu.cod_aluno AND mat.cod_matricula = mt.ref_cod_matricula ) AS nome, (SELECT (pes.nome) FROM cadastro.pessoa pes, pmieducar.aluno alu, pmieducar.matricula mat WHERE pes.idpes = alu.ref_idpes AND mat.ref_cod_aluno = alu.cod_aluno AND mat.cod_matricula = mt.ref_cod_matricula ) AS nome_ascii";
  134 + $this->_campos_lista = $this->_todos_campos = "mt.ref_cod_matricula, mt.abandono, mt.reclassificado, mt.remanejado, mt.transferido, mt.falecido, mt.ref_cod_turma, mt.etapa_educacenso, mt.turma_unificada, mt.ref_usuario_exc, mt.ref_usuario_cad, mt.data_cadastro, mt.data_exclusao, mt.ativo, mt.sequencial, mt.data_enturmacao, mt.turno_id, (SELECT pes.nome FROM cadastro.pessoa pes, pmieducar.aluno alu, pmieducar.matricula mat WHERE pes.idpes = alu.ref_idpes AND mat.ref_cod_aluno = alu.cod_aluno AND mat.cod_matricula = mt.ref_cod_matricula ) AS nome, (SELECT (pes.nome) FROM cadastro.pessoa pes, pmieducar.aluno alu, pmieducar.matricula mat WHERE pes.idpes = alu.ref_idpes AND mat.ref_cod_aluno = alu.cod_aluno AND mat.cod_matricula = mt.ref_cod_matricula ) AS nome_ascii";
134 135  
135 136 if (is_numeric($ref_usuario_exc)) {
136 137 if (class_exists("clsPmieducarUsuario")) {
... ... @@ -337,6 +338,12 @@ class clsPmieducarMatriculaTurma
337 338 $gruda = ", ";
338 339 }
339 340  
  341 + if(is_numeric($this->turno_id)){
  342 + $campos .= "{$gruda}turno_id";
  343 + $valores .= "{$gruda}'{$this->turno_id}'";
  344 + $gruda = ", ";
  345 + }
  346 +
340 347 $db->Consulta("INSERT INTO {$this->_tabela} ($campos) VALUES ($valores)");
341 348  
342 349 $detalhe = $this->detalhe();
... ... @@ -438,6 +445,14 @@ class clsPmieducarMatriculaTurma
438 445 $gruda = ", ";
439 446 }
440 447  
  448 + if (is_string($this->turno_id) && $this->turno_id == 0) {
  449 + $set .= "{$gruda}turno_id = NULL";
  450 + $gruda = ", ";
  451 + } elseif (is_string($this->turno_id) && !empty($this->turno_id)) {
  452 + $set .= "{$gruda}turno_id = '{$this->turno_id}'";
  453 + $gruda = ", ";
  454 + }
  455 +
441 456 if ($set) {
442 457 $detalheAntigo = $this->detalhe();
443 458 $db->Consulta("UPDATE {$this->_tabela} SET $set WHERE ref_cod_matricula = '{$this->ref_cod_matricula}' AND ref_cod_turma = '{$this->ref_cod_turma}' and sequencial = '$this->sequencial' ");
... ...
ieducar/intranet/include/pmieducar/clsPmieducarServidorFuncao.inc.php
... ... @@ -216,27 +216,43 @@ class clsPmieducarServidorFuncao
216 216 */
217 217 function edita()
218 218 {
219   - if( is_numeric( $this->ref_ref_cod_instituicao ) && is_numeric( $this->ref_cod_servidor ) && is_numeric( $this->ref_cod_funcao ) )
220   - {
  219 + $set = [];
221 220  
222   - $db = new clsBanco();
223   - $set = "";
224   -
225   - if (is_string($this->matricula)) {
226   - $set .= "{$gruda}matricula = '{$this->matricula}'";
227   - $gruda = ', ';
228   - }elseif(is_null($this->matricula)){
229   - $set .= "{$gruda}matricula = 'NULL'";
230   - $gruda = ', ';
231   - }
  221 + if (empty($this->matricula)) {
  222 + $set[] = 'matricula = NULL';
  223 + } elseif (is_string($this->matricula)) {
  224 + $set[] = 'matricula = ' . $this->matricula;
  225 + }
232 226  
233   - if( $set )
234   - {
235   - $db->Consulta( "UPDATE {$this->_tabela} SET $set WHERE ref_ref_cod_instituicao = '{$this->ref_ref_cod_instituicao}' AND ref_cod_servidor = '{$this->ref_cod_servidor}' AND ref_cod_funcao = '{$this->ref_cod_funcao}'" );
236   - return true;
237   - }
  227 + if (is_numeric($this->ref_cod_funcao)) {
  228 + $set[] = 'ref_cod_funcao = ' . $this->ref_cod_funcao;
238 229 }
239   - return false;
  230 +
  231 + $where = [];
  232 +
  233 + if (is_numeric($this->cod_servidor_funcao)) {
  234 + $where[] = 'cod_servidor_funcao = ' . $this->cod_servidor_funcao;
  235 + } elseif (is_numeric($this->ref_ref_cod_instituicao) && is_numeric($this->ref_cod_servidor) && is_numeric($this->ref_cod_funcao)) {
  236 + $where[] = 'ref_ref_cod_instituicao = ' . $this->ref_ref_cod_instituicao;
  237 + $where[] = 'ref_cod_servidor = ' . $this->ref_cod_servidor;
  238 + $where[] = 'ref_cod_funcao = ' . $this->ref_cod_funcao;
  239 + }
  240 +
  241 + if (empty($set) || empty($where)) {
  242 + return false;
  243 + }
  244 +
  245 + $db = new clsBanco();
  246 + $sql = sprintf(
  247 + 'UPDATE %s SET %s WHERE %s;',
  248 + $this->_tabela,
  249 + join(', ', $set),
  250 + join(' AND ', $where)
  251 + );
  252 +
  253 + $db->Consulta($sql);
  254 +
  255 + return true;
240 256 }
241 257  
242 258 /**
... ... @@ -354,21 +370,36 @@ class clsPmieducarServidorFuncao
354 370 */
355 371 function existe()
356 372 {
357   - if(is_numeric($this->cod_servidor_funcao)){
  373 + $sql = '';
  374 +
  375 + if (is_numeric($this->cod_servidor_funcao)) {
358 376 $sql = sprintf(
359   - "SELECT 1 FROM %s WHERE cod_servidor_funcao = '%d'",
360   - $this->_tabela, $this->cod_servidor_funcao
361   - );
362   - } elseif( is_numeric( $this->ref_ref_cod_instituicao ) && is_numeric( $this->ref_cod_servidor ) && is_numeric( $this->ref_cod_funcao ) )
363   - {
  377 + "SELECT 1 FROM %s WHERE cod_servidor_funcao = '%d'",
  378 + $this->_tabela,
  379 + $this->cod_servidor_funcao
  380 + );
  381 + } elseif (is_numeric($this->ref_ref_cod_instituicao) && is_numeric($this->ref_cod_servidor) && is_numeric($this->ref_cod_funcao)) {
  382 + $sql = sprintf(
  383 + "SELECT 1 FROM %s WHERE ref_ref_cod_instituicao = '%d' AND ref_cod_servidor = '%d' AND ref_cod_funcao = '%d'",
  384 + $this->_tabela,
  385 + $this->ref_ref_cod_instituicao,
  386 + $this->ref_cod_servidor,
  387 + $this->ref_cod_funcao
  388 + );
  389 + }
364 390  
365   - $db = new clsBanco();
366   - $db->Consulta( "SELECT 1 FROM {$this->_tabela} WHERE ref_ref_cod_instituicao = '{$this->ref_ref_cod_instituicao}' AND ref_cod_servidor = '{$this->ref_cod_servidor}' AND ref_cod_funcao = '{$this->ref_cod_funcao}'" );
367   - if( $db->ProximoRegistro() )
368   - {
369   - return true;
370   - }
  391 + if ($sql === '') {
  392 + return false;
  393 + }
  394 +
  395 + $db = new clsBanco();
  396 +
  397 + $db->Consulta($sql);
  398 +
  399 + if ($db->ProximoRegistro()) {
  400 + return true;
371 401 }
  402 +
372 403 return false;
373 404 }
374 405  
... ...
ieducar/intranet/include/pmieducar/clsPmieducarTurma.inc.php
... ... @@ -5,6 +5,11 @@ require_once &#39;Portabilis/Utils/Database.php&#39;;
5 5  
6 6 class clsPmieducarTurma
7 7 {
  8 + const TURNO_MATUTINO = 1;
  9 + const TURNO_VESPERTINO = 2;
  10 + const TURNO_NOTURNO = 3;
  11 + const TURNO_INTEGRAL = 4;
  12 +
8 13 public $cod_turma;
9 14 public $ref_usuario_exc;
10 15 public $ref_usuario_cad;
... ... @@ -70,6 +75,7 @@ class clsPmieducarTurma
70 75  
71 76 public $listarNaoInformarEducacenso = true;
72 77 public $codUsuario;
  78 + public $tipo_boletim_diferenciado = false;
73 79 // propriedades padrao
74 80  
75 81 /**
... ... @@ -832,6 +838,9 @@ class clsPmieducarTurma
832 838 if (is_numeric($this->tipo_boletim_diferenciado)) {
833 839 $set .= "{$gruda}tipo_boletim_diferenciado = '{$this->tipo_boletim_diferenciado}'";
834 840 $gruda = ', ';
  841 + } elseif ($this->tipo_boletim_diferenciado !== false) {
  842 + $set .= "{$gruda}tipo_boletim_diferenciado = NULL";
  843 + $gruda = ', ';
835 844 }
836 845  
837 846 if (is_numeric($this->ano)) {
... ...
ieducar/lib/Portabilis/View/Helper/DynamicInput/SituacaoMatricula.php
1 1 <?php
2 2  
  3 +use iEducar\Modules\Enrollments\Model\EnrollmentStatusFilter;
  4 +
3 5 require_once 'lib/Portabilis/View/Helper/DynamicInput/CoreSelect.php';
4 6  
5 7 class Portabilis_View_Helper_DynamicInput_SituacaoMatricula extends Portabilis_View_Helper_DynamicInput_CoreSelect
6 8 {
7 9 protected function inputOptions($options)
8 10 {
9   - $resources = $options['resources'];
10   -
11   - $resources = [
12   - 1 => 'Aprovado',
13   - 2 => 'Reprovado',
14   - 3 => 'Cursando',
15   - 4 => 'Transferido',
16   - 5 => 'Reclassificado',
17   - 6 => 'Abandono',
18   - 9 => 'Exceto Transferidos/Abandono',
19   - 10 => 'Todas',
20   - 12 => 'Aprovado com dependência',
21   - 13 => 'Aprovado pelo conselho',
22   - 14 => 'Reprovado por faltas',
23   - 15 => 'Falecido'
24   - ];
  11 + $resources = EnrollmentStatusFilter::getDescriptiveValues();
25 12  
26 13 return $this->insertOption(10, 'Todas', $resources);
27 14 }
... ...
ieducar/modules/Api/Views/MatriculaController.php
... ... @@ -240,8 +240,7 @@ class MatriculaController extends ApiCoreController
240 240 cod_matricula AS matricula_id,
241 241 aprovado AS situacao,
242 242 ativo AS ativo,
243   - coalesce(updated_at::varchar, \'\') AS data_atualizacao,
244   - turno_id
  243 + coalesce(updated_at::varchar, \'\') AS data_atualizacao
245 244 FROM pmieducar.matricula
246 245 WHERE ano = $1
247 246 AND CASE WHEN $2 = 0 THEN TRUE ELSE ref_ref_cod_escola = $2 END';
... ... @@ -250,7 +249,7 @@ class MatriculaController extends ApiCoreController
250 249 $matriculas = $this->fetchPreparedQuery($sql, $params, false);
251 250  
252 251 if (is_array($matriculas) && count($matriculas) > 0) {
253   - $attrs = ['aluno_id', 'matricula_id', 'situacao', 'data_atualizacao', 'ativo', 'turno_id'];
  252 + $attrs = ['aluno_id', 'matricula_id', 'situacao', 'data_atualizacao', 'ativo'];
254 253 $matriculas = Portabilis_Array_Utils::filterSet($matriculas, $attrs);
255 254  
256 255 foreach ($matriculas as $key => $matricula) {
... ... @@ -269,7 +268,8 @@ class MatriculaController extends ApiCoreController
269 268 matricula_turma.remanejado AND
270 269 matricula_turma.data_exclusao > ($2 || to_char(instituicao.data_base_remanejamento, \'-mm-dd\'))::DATE THEN TRUE
271 270 ELSE FALSE
272   - END AS apresentar_fora_da_data
  271 + END AS apresentar_fora_da_data,
  272 + matricula_turma.turno_id
273 273 FROM matricula
274 274 INNER JOIN pmieducar.escola
275 275 ON escola.cod_escola = matricula.ref_ref_cod_escola
... ... @@ -290,7 +290,8 @@ class MatriculaController extends ApiCoreController
290 290 'data_entrada',
291 291 'data_saida',
292 292 'data_atualizacao',
293   - 'apresentar_fora_da_data'
  293 + 'apresentar_fora_da_data',
  294 + 'turno_id'
294 295 ];
295 296 $enturmacoes = Portabilis_Array_Utils::filterSet($enturmacoes, $attrs);
296 297 $matriculas[$key]['enturmacoes'] = $enturmacoes;
... ...
ieducar/modules/Avaliacao/Assets/Javascripts/Diario.js
... ... @@ -114,30 +114,107 @@ function setDefaultFaltaIfEmpty(matricula_id, componente_curricular_id) {
114 114 }
115 115 }
116 116  
  117 +var lockedAverage = function ($element, callback) {
  118 + var matriculaId = $element.data('matricula_id');
  119 + var ccId = $element.data('componente_curricular_id');
  120 + var campoSituacao = $j('#situacao-matricula-' + matriculaId + '-cc-' + ccId);
  121 + var bloqueado = campoSituacao.data('media_bloqueada');
  122 +
  123 + if (bloqueado) {
  124 + var additionalVars = {
  125 + matricula_id: matriculaId,
  126 + componente_curricular_id: ccId
  127 + };
  128 +
  129 + var dialogElmId = 'media-bloqueada';
  130 + var dialogElm = $j('#' + dialogElmId);
  131 +
  132 + if (dialogElm.length < 1) {
  133 + $j('body')
  134 + .append('<div id="' + dialogElmId + '" style="display: none;">A média final deste aluno/etapa/componente está bloqueada pois foi alterada manualmente. Você gostaria de desbloqueá-la e permitir sua atualização automática?</div>')
  135 +
  136 + dialogElm = $j('#' + dialogElmId);
  137 + }
  138 +
  139 + if (dialogElm.is(':ui-dialog')) {
  140 + dialogElm.dialog('destroy');
  141 + }
  142 +
  143 + dialogElm.dialog({
  144 + width: 600,
  145 + title: 'Atenção!',
  146 + modal: true,
  147 + open: function(event, ui) {
  148 + $j('.ui-dialog-titlebar-close', ui.dialog | ui).hide();
  149 + },
  150 + buttons: [
  151 + {
  152 + text: 'Sim',
  153 + click: function () {
  154 + var options = {
  155 + url: postResourceUrlBuilder.buildUrl(API_URL_BASE, 'media_desbloqueia', additionalVars),
  156 + dataType: 'json',
  157 + success: function (dataResponse) {
  158 + if (dataResponse.any_error_msg === false) {
  159 + campoSituacao.data('media_bloqueada', false);
  160 + callback();
  161 + } else {
  162 + alert(dataResponse.msgs[0].msg);
  163 + }
  164 + },
  165 + error: function () {
  166 + alert('Não foi possível desbloquear a média. Tente novamente!');
  167 + }
  168 + };
  169 +
  170 + $j.ajax(options);
  171 + dialogElm.dialog('close');
  172 + }
  173 + }, {
  174 + text: 'Não',
  175 + click: function () {
  176 + callback();
  177 + dialogElm.dialog('close');
  178 + }
  179 + }
  180 + ]
  181 + })
  182 + } else {
  183 + callback();
  184 + }
  185 +};
117 186  
118 187 var changeNota = function(event) {
119 188 var $element = $j(this);
120 189 setDefaultFaltaIfEmpty($element.data('matricula_id'), $element.data('componente_curricular_id'));
121   - changeResource($element, postNota, deleteNota);
  190 + lockedAverage($element, function () {
  191 + changeResource($element, postNota, deleteNota);
  192 + });
122 193 };
123 194  
124 195  
125 196 var changeNotaExame = function(event) {
126 197 var $element = $j(this);
127 198 setDefaultFaltaIfEmpty($element.data('matricula_id'), $element.data('componente_curricular_id'));
128   - changeResource($element, postNotaExame, deleteNotaExame);
  199 + lockedAverage($element, function () {
  200 + changeResource($element, postNotaExame, deleteNotaExame);
  201 + });
129 202 };
130 203  
131 204 var changeNotaRecuperacaoParalela = function(event){
132 205 var $element = $j(this);
133 206 setDefaultFaltaIfEmpty($element.data('matricula_id'), $element.data('componente_curricular_id'));
134   - changeResource($element, postNotaRecuperacaoParalela, deleteNotaRecuperacaoParalela);
  207 + lockedAverage($element, function () {
  208 + changeResource($element, postNotaRecuperacaoParalela, deleteNotaRecuperacaoParalela);
  209 + });
135 210 }
136 211  
137 212 var changeNotaRecuperacaoEspecifica = function(event){
138 213 var $element = $j(this);
139 214 setDefaultFaltaIfEmpty($element.data('matricula_id'), $element.data('componente_curricular_id'));
140   - changeResource($element, postNotaRecuperacaoEspecifica, deleteNotaRecuperacaoEspecifica);
  215 + lockedAverage($element, function () {
  216 + changeResource($element, postNotaRecuperacaoEspecifica, deleteNotaRecuperacaoEspecifica);
  217 + });
141 218 }
142 219  
143 220 var changeFalta = function(event) {
... ... @@ -179,24 +256,31 @@ var changeParecer = function(event) {
179 256  
180 257 var changeNotaGeralEtapa = function(event) {
181 258 var $element = $j(this);
182   - // setDefaultFaltaIfEmpty($element.data('matricula_id'), $element.data('componente_curricular_id'));
183   - changeResource($element, postNotaGeral, deleteNotaGeral);
184 259  
185   - var $fieldsNotaGeral = $j('.nota-geral-etapa');
  260 + lockedAverage($element, function () {
  261 + changeResource($element, postNotaGeral, deleteNotaGeral);
186 262  
187   - $fieldsNotaGeral.val($element.val());
188   - $fieldsNotaGeral.data('old_value', $element.val());
  263 + var $fieldsNotaGeral = $j('.nota-geral-etapa');
189 264  
  265 + $fieldsNotaGeral.val($element.val());
  266 + $fieldsNotaGeral.data('old_value', $element.val());
  267 + });
190 268 };
191   -var changeMedia = function(event){
  269 +
  270 +var changeMedia = function(event) {
192 271 var $element = $j(this);
  272 + var matriculaId = $element.data('matricula_id');
  273 + var ccId = $element.data('componente_curricular_id');
  274 + var $situacaoField = $j('#situacao-matricula-' + matriculaId + '-cc-' + ccId);
193 275  
194 276 changeResource($element, postMedia, deleteMedia);
195 277  
196 278 $element.data('old_value', $element.val());
  279 +
  280 + $situacaoField.data('media_bloqueada', true);
197 281 };
198 282  
199   -var changeSituacao = function(event){
  283 +var changeSituacao = function(event) {
200 284 var $element = $j(this);
201 285  
202 286 if($element.val() != 0){
... ... @@ -419,7 +503,6 @@ function getEtapaParecer(regra) {
419 503 return etapaParecer;
420 504 }
421 505  
422   -
423 506 function postParecer($parecerFieldElement) {
424 507 var regra = $parecerFieldElement.closest('tr').data('regra');
425 508 var data = {
... ... @@ -1199,6 +1282,7 @@ function updateComponenteCurricular($targetElement, matriculaId, cc, regra) {
1199 1282 var ultimaEtapa = regra.quantidade_etapas == $j('#etapa').val();
1200 1283 var definirComponentesEtapa = regra.definir_componente_por_etapa;
1201 1284 var ultimaEtapaComponente = cc.ultima_etapa == $j('#etapa').val();
  1285 + var mediaBloqueada = cc.media_bloqueada;
1202 1286  
1203 1287 var $emptyTd = $j('<td/>').addClass('center');
1204 1288  
... ... @@ -1206,6 +1290,7 @@ function updateComponenteCurricular($targetElement, matriculaId, cc, regra) {
1206 1290 .attr('id', 'situacao-matricula-' + matriculaId + '-cc-' + cc.id)
1207 1291 .data('matricula_id', matriculaId)
1208 1292 .data('componente_curricular_id', cc.id)
  1293 + .data('media_bloqueada', mediaBloqueada)
1209 1294 .addClass('center')
1210 1295 .html(cc.situacao)
1211 1296 .appendTo($targetElement);
... ...
ieducar/modules/Avaliacao/Model/NotaComponenteMedia.php
1 1 <?php
2 2  
3   -/**
4   - * i-Educar - Sistema de gestão escolar
5   - *
6   - * Copyright (C) 2006 Prefeitura Municipal de Itajaí
7   - * <ctima@itajai.sc.gov.br>
8   - *
9   - * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo
10   - * sob os termos da Licença Pública Geral GNU conforme publicada pela Free
11   - * Software Foundation; tanto a versão 2 da Licença, como (a seu critério)
12   - * qualquer versão posterior.
13   - *
14   - * Este programa é distribuí­do na expectativa de que seja útil, porém, SEM
15   - * NENHUMA GARANTIA; nem mesmo a garantia implí­cita de COMERCIABILIDADE OU
16   - * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral
17   - * do GNU para mais detalhes.
18   - *
19   - * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto
20   - * com este programa; se não, escreva para a Free Software Foundation, Inc., no
21   - * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
22   - *
23   - * @author Eriksen Costa Paixão <eriksen.paixao_bs@cobra.com.br>
24   - * @category i-Educar
25   - * @license @@license@@
26   - * @package Avaliacao
27   - * @subpackage Modules
28   - * @since Arquivo disponível desde a versão 1.1.0
29   - * @version $Id$
30   - */
31   -
32   -require_once 'CoreExt/Entity.php';
33   -
34   -/**
35   - * Avaliacao_Model_NotaComponenteMedia class.
36   - *
37   - * @author Eriksen Costa Paixão <eriksen.paixao_bs@cobra.com.br>
38   - * @category i-Educar
39   - * @license @@license@@
40   - * @package Avaliacao
41   - * @subpackage Modules
42   - * @since Classe disponível desde a versão 1.1.0
43   - * @version @@package_version@@
44   - */
45 3 class Avaliacao_Model_NotaComponenteMedia extends CoreExt_Entity
46 4 {
47   - protected $_data = array(
48   - 'notaAluno' => NULL,
49   - 'componenteCurricular' => NULL,
50   - 'media' => NULL,
51   - 'mediaArredondada' => NULL,
52   - 'etapa' => NULL,
53   - 'situacao' => NULL
54   - );
  5 + protected $_data = [
  6 + 'notaAluno' => null,
  7 + 'componenteCurricular' => null,
  8 + 'media' => null,
  9 + 'mediaArredondada' => null,
  10 + 'etapa' => null,
  11 + 'situacao' => null,
  12 + 'bloqueada' => false,
  13 + ];
55 14  
56   - protected $_dataTypes = array(
57   - 'media' => 'numeric'
58   - );
  15 + protected $_dataTypes = [
  16 + 'media' => 'numeric',
  17 + 'bloqueada' => 'boolean',
  18 + ];
59 19  
60   - protected $_references = array(
61   - 'notaAluno' => array(
62   - 'value' => NULL,
63   - 'class' => 'Avaliacao_Model_NotaAlunoDataMapper',
64   - 'file' => 'Avaliacao/Model/NotaAlunoDataMapper.php'
65   - ),
66   - 'componenteCurricular' => array(
67   - 'value' => NULL,
68   - 'class' => 'ComponenteCurricular_Model_ComponenteDataMapper',
69   - 'file' => 'ComponenteCurricular/Model/ComponenteDataMapper.php'
70   - )
71   - );
  20 + protected $_references = [
  21 + 'notaAluno' => [
  22 + 'value' => null,
  23 + 'class' => 'Avaliacao_Model_NotaAlunoDataMapper',
  24 + 'file' => 'Avaliacao/Model/NotaAlunoDataMapper.php'
  25 + ],
  26 + 'componenteCurricular' => [
  27 + 'value' => null,
  28 + 'class' => 'ComponenteCurricular_Model_ComponenteDataMapper',
  29 + 'file' => 'ComponenteCurricular/Model/ComponenteDataMapper.php'
  30 + ]
  31 + ];
72 32  
73   - public function __construct($options = array())
74   - {
75   - parent::__construct($options);
76   - unset($this->_data['id']);
77   - }
  33 + public function __construct($options = [])
  34 + {
  35 + parent::__construct($options);
  36 + unset($this->_data['id']);
  37 + }
78 38  
79   - /**
80   - * @see CoreExt_Entity_Validatable#getDefaultValidatorCollection()
81   - */
82   - public function getDefaultValidatorCollection()
83   - {
84   - return array(
85   - 'media' => new CoreExt_Validate_Numeric(array('min' => 0, 'max' => 10)),
86   - 'mediaArredondada' => new CoreExt_Validate_String(array('max' => 5)),
87   - 'etapa' => new CoreExt_Validate_String(array('max' => 2))
88   - );
89   - }
90   -}
91 39 \ No newline at end of file
  40 + public function getDefaultValidatorCollection()
  41 + {
  42 + return [
  43 + 'media' => new CoreExt_Validate_Numeric(['min' => 0, 'max' => 10]),
  44 + 'mediaArredondada' => new CoreExt_Validate_String(['max' => 5]),
  45 + 'etapa' => new CoreExt_Validate_String(['max' => 2])
  46 + ];
  47 + }
  48 +}
... ...
ieducar/modules/Avaliacao/Service/Boletim.php
... ... @@ -1170,6 +1170,10 @@ class Avaliacao_Service_Boletim implements CoreExt_Configurable
1170 1170 $situacaoFalta = $situacaoFaltas->situacao;
1171 1171 }
1172 1172  
  1173 + if (is_null($situacaoNota)) {
  1174 + $situacaoNota = App_Model_MatriculaSituacao::EM_ANDAMENTO;
  1175 + }
  1176 +
1173 1177 $situacao->componentesCurriculares[$ccId] = $this->getSituacaoNotaFalta($situacaoNota, $situacaoFalta);
1174 1178 }
1175 1179  
... ... @@ -2263,34 +2267,62 @@ class Avaliacao_Service_Boletim implements CoreExt_Configurable
2263 2267 return $this->_updateMatricula($this->getOption('matricula'), $this->getOption('usuario'), $novaSituacaoMatricula);
2264 2268 }
2265 2269  
  2270 + public function unlockMediaComponente($componente)
  2271 + {
  2272 + try {
  2273 + $media = $this->getNotaComponenteMediaDataMapper()->find(array(
  2274 + 'notaAluno' => $this->_getNotaAluno()->id,
  2275 + 'componenteCurricular' => $componente
  2276 + ));
2266 2277  
2267   - public function updateMediaComponente($media, $componente, $etapa){
2268   - $notaComponenteCurricularMedia = new Avaliacao_Model_NotaComponenteMedia(array(
2269   - 'notaAluno' => $this->_getNotaAluno()->id,
2270   - 'componenteCurricular' => $componente,
2271   - 'media' => $media,
2272   - 'mediaArredondada' => $this->arredondaMedia($media),
2273   - 'etapa' => $etapa,
2274   - ));
  2278 + $media->bloqueada = 'f';
  2279 +
  2280 + $media->markOld();
  2281 +
  2282 + return $this->getNotaComponenteMediaDataMapper()->save($media);
  2283 + } catch (Exception $e) {
  2284 + return false;
  2285 + }
  2286 + }
  2287 +
  2288 + public function updateMediaComponente($media, $componente, $etapa, bool $lock = false) {
  2289 + $lock = $lock === false ? 'f' : 't';
2275 2290  
2276 2291 try {
2277   - // Se existir, marca como "old" para possibilitar a atualização
2278   - $this->getNotaComponenteMediaDataMapper()->find(array(
2279   - $notaComponenteCurricularMedia->get('notaAluno'),
2280   - $notaComponenteCurricularMedia->get('componenteCurricular'),
  2292 + $notaComponenteCurricularMedia = $this->getNotaComponenteMediaDataMapper()->find(array(
  2293 + 'notaAluno' => $this->_getNotaAluno()->id,
  2294 + 'componenteCurricular' => $componente
2281 2295 ));
2282 2296  
  2297 + $notaComponenteCurricularMedia->media = $media;
  2298 + $notaComponenteCurricularMedia->mediaArredondada = $this->arredondaMedia($media);
  2299 + $notaComponenteCurricularMedia->bloqueada = $lock;
  2300 + $notaComponenteCurricularMedia->situacao = null;
  2301 +
2283 2302 $notaComponenteCurricularMedia->markOld();
2284   - }
2285   - catch (Exception $e) {
2286   - // Prossegue, sem problemas.
  2303 + } catch (Exeption $e) {
  2304 + $notaComponenteCurricularMedia = new Avaliacao_Model_NotaComponenteMedia(array(
  2305 + 'notaAluno' => $this->_getNotaAluno()->id,
  2306 + 'componenteCurricular' => $componente,
  2307 + 'media' => $media,
  2308 + 'mediaArredondada' => $this->arredondaMedia($media),
  2309 + 'etapa' => $etapa,
  2310 + 'bloqueada' => $lock
  2311 + ));
2287 2312 }
2288 2313  
2289 2314 // Salva a média
2290 2315 $this->getNotaComponenteMediaDataMapper()->save($notaComponenteCurricularMedia);
2291 2316 $notaComponenteCurricularMedia->situacao = $this->getSituacaoComponentesCurriculares()->componentesCurriculares[$componente]->situacao;
2292   - // Atualiza situação matricula
2293   - $this->promover();
  2317 +
  2318 + try {
  2319 + // Atualiza situação matricula
  2320 + $this->promover();
  2321 + } catch (Exception $e) {
  2322 + // Evita que uma mensagem de erro apareça caso a situação na matrícula
  2323 + // não seja alterada.
  2324 + }
  2325 +
2294 2326 //Atualiza a situação de acordo com o que foi inserido na média anteriormente
2295 2327 $notaComponenteCurricularMedia->markOld();
2296 2328 $this->getNotaComponenteMediaDataMapper()->save($notaComponenteCurricularMedia);
... ... @@ -2432,31 +2464,42 @@ public function alterarSituacao($novaSituacao, $matriculaId){
2432 2464  
2433 2465 // Calcula a média por componente curricular
2434 2466 $media = $this->_calculaMedia($notas);
2435   -
2436   - // Cria uma nova instância de média, já com a nota arredondada e a etapa
2437   - $notaComponenteCurricularMedia = new Avaliacao_Model_NotaComponenteMedia(array(
2438   - 'notaAluno' => $notaAlunoId,
2439   - 'componenteCurricular' => $id,
2440   - 'media' => $media,
2441   - 'mediaArredondada' => $this->arredondaMedia($media),
2442   - 'etapa' => $etapa
2443   - ));
  2467 + $locked = false;
2444 2468  
2445 2469 try {
2446   - // Se existir, marca como "old" para possibilitar a atualização
2447   - $this->getNotaComponenteMediaDataMapper()->find(array(
2448   - $notaComponenteCurricularMedia->get('notaAluno'),
2449   - $notaComponenteCurricularMedia->get('componenteCurricular'),
  2470 + $notaComponenteCurricularMedia = $this->getNotaComponenteMediaDataMapper()->find(array(
  2471 + 'notaAluno' => $this->_getNotaAluno()->id,
  2472 + 'componenteCurricular' => $id,
2450 2473 ));
2451 2474  
  2475 + $locked = (bool) $notaComponenteCurricularMedia->bloqueada;
  2476 +
  2477 + // A média pode estar bloqueada caso tenha sido alterada manualmente.
  2478 + // Neste caso não acontece a atualização da mesma por aqui e é necessário
  2479 + // desbloqueá-la antes.
  2480 + if (!$locked) {
  2481 + $notaComponenteCurricularMedia->media = $media;
  2482 + $notaComponenteCurricularMedia->mediaArredondada = $this->arredondaMedia($media);
  2483 + }
  2484 +
  2485 + $notaComponenteCurricularMedia->etapa = $etapa;
  2486 + $notaComponenteCurricularMedia->situacao = null;
  2487 +
2452 2488 $notaComponenteCurricularMedia->markOld();
2453   - }
2454   - catch (Exception $e) {
2455   - // Prossegue, sem problemas.
  2489 + } catch (Exception $e) {
  2490 + $notaComponenteCurricularMedia = new Avaliacao_Model_NotaComponenteMedia(array(
  2491 + 'notaAluno' => $this->_getNotaAluno()->id,
  2492 + 'componenteCurricular' => $id,
  2493 + 'media' => $media,
  2494 + 'mediaArredondada' => $this->arredondaMedia($media),
  2495 + 'etapa' => $etapa,
  2496 + 'bloqueada' => 'f',
  2497 + ));
2456 2498 }
2457 2499  
2458   - // Salva a média
  2500 + // Salva a média
2459 2501 $this->getNotaComponenteMediaDataMapper()->save($notaComponenteCurricularMedia);
  2502 +
2460 2503 //Atualiza a situação de acordo com o que foi inserido na média anteriormente
2461 2504 $notaComponenteCurricularMedia->markOld();
2462 2505 $notaComponenteCurricularMedia->situacao = $this->getSituacaoComponentesCurriculares()->componentesCurriculares[$id]->situacao;
... ...
ieducar/modules/Avaliacao/Views/DiarioApiController.php
... ... @@ -342,10 +342,6 @@ class DiarioApiController extends ApiCoreController
342 342 {
343 343 return $this->canPost() &&
344 344 $this->validatesIsNumeric('att_value');
345   - // $this->validatesRegraAvaliacaoHasNota() &&
346   - // $this->validatesRegraAvaliacaoHasFormulaRecuperacao() &&
347   - // $this->validatesRegraAvaliacaoHasFormulaRecuperacaoWithTypeRecuperacao() &&
348   - // $this->validatesPreviousNotasHasBeenSet();
349 345 }
350 346  
351 347 protected function canPostFalta()
... ... @@ -445,6 +441,7 @@ class DiarioApiController extends ApiCoreController
445 441 $this->trySaveServiceBoletim();
446 442 $this->messenger->append('Nota geral da matrícula ' . $this->getRequest()->matricula_id . ' alterada com sucesso.', 'success');
447 443 }
  444 +
448 445 $this->appendResponse('matricula_id', $this->getRequest()->matricula_id);
449 446 $this->appendResponse('situacao', $this->getSituacaoComponente($this->getRequest()->componente_curricular_id));
450 447 $this->appendResponse('componente_curricular_id', $this->getRequest()->componente_curricular_id);
... ... @@ -459,7 +456,7 @@ class DiarioApiController extends ApiCoreController
459 456 $componenteCurricular = $this->getRequest()->componente_curricular_id;
460 457 $etapa = $this->getRequest()->etapa;
461 458  
462   - $this->serviceBoletim()->updateMediaComponente($mediaLancada, $componenteCurricular, $etapa);
  459 + $this->serviceBoletim()->updateMediaComponente($mediaLancada, $componenteCurricular, $etapa, true);
463 460 $this->messenger->append('Média da matrícula ' . $this->getRequest()->matricula_id . ' alterada com sucesso.', 'success');
464 461 $this->appendResponse('matricula_id', $this->getRequest()->matricula_id);
465 462 $this->appendResponse('situacao', $this->getSituacaoComponente($this->getRequest()->componente_curricular_id));
... ... @@ -471,6 +468,18 @@ class DiarioApiController extends ApiCoreController
471 468 }
472 469 }
473 470  
  471 + protected function postMediaDesbloqueia() {
  472 + if ($this->canPostMedia()) {
  473 + $componenteCurricular = $this->getRequest()->componente_curricular_id;
  474 +
  475 + if ($this->serviceBoletim()->unlockMediaComponente($componenteCurricular)) {
  476 + $this->messenger->append('Média desbloqueada com sucesso.', 'success');
  477 + } else {
  478 + $this->messenger->append('Ocorreu um erro ao desbloquear a média. Tente novamente.', 'error');
  479 + }
  480 + }
  481 + }
  482 +
474 483 protected function deleteMedia()
475 484 {
476 485 if ($this->canDeleteMedia()) {
... ... @@ -1076,6 +1085,7 @@ class DiarioApiController extends ApiCoreController
1076 1085 $componente['nota_geral_etapa'] = $this->getNotaGeral($etapa);
1077 1086 $componente['media'] = $this->getMediaAtual($componente['id']);
1078 1087 $componente['media_arredondada'] = $this->getMediaArredondadaAtual($componente['id']);
  1088 + $componente['media_bloqueada'] = $this->getMediaBloqueada($componente['id']);
1079 1089  
1080 1090 if (!empty($componente['nota_necessaria_exame'])) {
1081 1091 $this->createOrUpdateNotaExame($matriculaId, $componente['id'], $componente['nota_necessaria_exame']);
... ... @@ -1237,6 +1247,23 @@ class DiarioApiController extends ApiCoreController
1237 1247 return str_replace(',', '.', $media);
1238 1248 }
1239 1249  
  1250 + protected function getMediaBloqueada($componenteCurricularId = null)
  1251 + {
  1252 + // defaults
  1253 + if (is_null($componenteCurricularId)) {
  1254 + $componenteCurricularId = $this->getRequest()->componente_curricular_id;
  1255 + }
  1256 +
  1257 + // validacao
  1258 + if (!is_numeric($componenteCurricularId)) {
  1259 + throw new Exception('Não foi possivel obter a média atual, pois não foi recebido o id do componente curricular.');
  1260 + }
  1261 +
  1262 + $bloqueada = (bool) $this->serviceBoletim()->getMediaComponente($componenteCurricularId)->bloqueada;
  1263 +
  1264 + return $bloqueada;
  1265 + }
  1266 +
1240 1267 protected function getNotaRecuperacaoParalelaAtual($etapa = null, $componenteCurricularId = null)
1241 1268 {
1242 1269 // defaults
... ... @@ -1718,6 +1745,8 @@ class DiarioApiController extends ApiCoreController
1718 1745 $this->postNotaGeral();
1719 1746 } elseif ($this->isRequestFor('post', 'media')) {
1720 1747 $this->postMedia();
  1748 + } elseif ($this->isRequestFor('post', 'media_desbloqueia')) {
  1749 + $this->postMediaDesbloqueia();
1721 1750 } elseif ($this->isRequestFor('delete', 'media')) {
1722 1751 $this->deleteMedia();
1723 1752 } elseif ($this->isRequestFor('post', 'situacao')) {
... ...
ieducar/modules/Cadastro/Assets/Javascripts/Servidor.js
... ... @@ -4,9 +4,59 @@ $j(&#39;#btn_enviar&#39;).on(&#39;click&#39;, () =&gt; {
4 4 return false;
5 5 }
6 6  
7   - acao();
  7 + let block = false;
  8 +
  9 + $j('.ref_cod_funcao select').each(function () {
  10 + const $this = $j(this);
  11 + const original = $this.data('valor-original');
  12 + const value = $this.val();
  13 +
  14 + if (original != '' && original != value) {
  15 + block = true;
  16 + }
  17 + });
  18 +
  19 + if (block) {
  20 + confirmaEnvio();
  21 + } else {
  22 + acao();
  23 + }
8 24 });
9 25  
  26 +function confirmaEnvio() {
  27 + const dialogId = 'dialog-confirma';
  28 + let dialogElm = $j('#' + dialogId);
  29 +
  30 + if (dialogElm.length < 1) {
  31 + $j('body')
  32 + .append('<div id="' + dialogId + '">Se deseja alterar a função de alguma alocação, adicione uma nova função ao cadastro do servidor; caso contrário, estará atualizando também todas as alocações marcadas com esta função. Deseja prosseguir mesmo assim?</div>');
  33 +
  34 + dialogElm = $j('#' + dialogId);
  35 + }
  36 +
  37 + if (dialogElm.is(':ui-dialog')) {
  38 + dialogElm.dialog('destroy');
  39 + }
  40 +
  41 + dialogElm.dialog({
  42 + width: 600,
  43 + title: 'Atenção!',
  44 + buttons: [
  45 + {
  46 + text: 'Sim',
  47 + click: () => {
  48 + acao();
  49 + }
  50 + }, {
  51 + text: 'Não',
  52 + click: () => {
  53 + dialogElm.dialog('close');
  54 + }
  55 + }
  56 + ]
  57 + });
  58 +}
  59 +
10 60 let obrigarCamposCenso = $j('#obrigar_campos_censo').val() == '1';
11 61  
12 62 function validaServidor() {
... ... @@ -217,4 +267,4 @@ $j(document).ready(function() {
217 267 $j('#'+row.id).find('input:checked').val('on');
218 268 }
219 269 });
220   -});
221 270 \ No newline at end of file
  271 +});
... ...
ieducar/modules/Cadastro/Assets/Javascripts/Usuario.js
... ... @@ -45,10 +45,12 @@ $j(document).ready(function(){
45 45 $escolas.trigger('chosen:updated');
46 46  
47 47 var handleGetEscolas = function(dataResponse) {
48   - $j.each(dataResponse['escolas'], function(id, value) {
49   - $escolas.children("[value=" + value + "]").attr('selected', '');
50   - });
51   - $escolas.trigger('chosen:updated');
  48 + setTimeout(function() {
  49 + $j.each(dataResponse['escolas'], function(id, value) {
  50 + $escolas.children("[value=" + value + "]").attr('selected', '');
  51 + });
  52 + $escolas.trigger('chosen:updated');
  53 + }, 100);
52 54 }
53 55  
54 56 var getEscolas = function() {
... ...
src/Modules/Enrollments/Model/EnrollmentStatusFilter.php 0 → 100644
... ... @@ -0,0 +1,25 @@
  1 +<?php
  2 +
  3 +namespace iEducar\Modules\Enrollments\Model;
  4 +
  5 +class EnrollmentStatusFilter
  6 +{
  7 + public static function getDescriptiveValues()
  8 + {
  9 + return [
  10 + 1 => 'Aprovado',
  11 + 2 => 'Reprovado',
  12 + 3 => 'Cursando',
  13 + 4 => 'Transferido',
  14 + 5 => 'Reclassificado',
  15 + 6 => 'Abandono',
  16 + 9 => 'Exceto Transferidos/Abandono',
  17 + 10 => 'Todas',
  18 + 12 => 'Aprovado com dependência',
  19 + 13 => 'Aprovado pelo conselho',
  20 + 14 => 'Reprovado por faltas',
  21 + 15 => 'Falecido'
  22 + ];
  23 + }
  24 +
  25 +}
... ...
tests/Browser/CityTest.php 0 → 100644
... ... @@ -0,0 +1,86 @@
  1 +<?php
  2 +
  3 +namespace Tests\Browser;
  4 +
  5 +use Illuminate\Foundation\Testing\WithFaker;
  6 +use Tests\Browser\Pages\City\CreatePage;
  7 +use Tests\Browser\Pages\City\DetailPage;
  8 +use Tests\Browser\Pages\City\ListingPage;
  9 +use Tests\Browser\Pages\City\UpdatePage;
  10 +use Tests\DuskTestCase;
  11 +use Laravel\Dusk\Browser;
  12 +
  13 +class CityTest extends DuskTestCase
  14 +{
  15 + use WithFaker;
  16 +
  17 + /**
  18 + * Test city flow.
  19 + *
  20 + * @return void
  21 + *
  22 + * @throws \Throwable
  23 + */
  24 + public function testFlowForCityPages()
  25 + {
  26 + $this->browse(function (Browser $browser) {
  27 + $country = 45; // Brasil
  28 + $state = 'SC'; // Santa Catarina
  29 + $cityName = $this->faker->city;
  30 + $cityNameAfterUpdate = $this->faker->city;
  31 +
  32 + $browser->loginLegacy();
  33 +
  34 + $browser->visit(new ListingPage())
  35 + ->press(' Novo ');
  36 +
  37 + $browser->on(new CreatePage())
  38 + ->select('@select-country', $country)
  39 + ->waitUsing(10, 1000, function () use ($browser) {
  40 + return $browser->resolver->findOrFail('[name=sigla_uf]')->isEnabled();
  41 + })
  42 + ->select('@select-state', $state)
  43 + ->type('@input-name', $cityName)
  44 + ->press('@button-save');
  45 +
  46 + $browser->on(new ListingPage())
  47 + ->type('@input-name', $cityName)
  48 + ->press('Buscar');
  49 +
  50 + $browser->on(new ListingPage());
  51 +
  52 + $cityId = $browser->resolver->findByText($cityName, 'a')->getAttribute('data-id');
  53 +
  54 + $browser->clickLink($cityName);
  55 +
  56 + $browser->on(new DetailPage($cityId))
  57 + ->press(' Editar ');
  58 +
  59 + $browser->on(new UpdatePage($cityId))
  60 + ->type('@input-name', $cityNameAfterUpdate)
  61 + ->press('@button-save');
  62 +
  63 + $browser->on(new ListingPage())
  64 + ->type('@input-name', $cityNameAfterUpdate)
  65 + ->press('Buscar')
  66 + ->clickLink($cityNameAfterUpdate);
  67 +
  68 + $browser->on(new DetailPage($cityId));
  69 + });
  70 + }
  71 +
  72 + /**
  73 + * Test city listing.
  74 + *
  75 + * @return void
  76 + *
  77 + * @throws \Throwable
  78 + */
  79 + public function testCityListing()
  80 + {
  81 + $this->browse(function (Browser $browser) {
  82 + $browser->loginLegacy();
  83 + $browser->visit(new ListingPage());
  84 + });
  85 + }
  86 +}
... ...
tests/Browser/CountryTest.php 0 → 100644
... ... @@ -0,0 +1,121 @@
  1 +<?php
  2 +
  3 +namespace Tests\Browser;
  4 +
  5 +use App\Country;
  6 +use Tests\Browser\Pages\Country\CreatePage;
  7 +use Tests\Browser\Pages\Country\DetailPage;
  8 +use Tests\Browser\Pages\Country\ListingPage;
  9 +use Tests\Browser\Pages\Country\UpdatePage;
  10 +use Tests\DuskTestCase;
  11 +use Laravel\Dusk\Browser;
  12 +
  13 +class CountryTest extends DuskTestCase
  14 +{
  15 + /**
  16 + * Test country listing.
  17 + *
  18 + * @return void
  19 + *
  20 + * @throws \Throwable
  21 + */
  22 + public function testCountryListing()
  23 + {
  24 + $this->browse(function (Browser $browser) {
  25 + $browser->loginLegacy()
  26 + ->visit(new ListingPage());
  27 + });
  28 + }
  29 +
  30 + /**
  31 + * Test create a country.
  32 + *
  33 + * @return void
  34 + *
  35 + * @throws \Throwable
  36 + */
  37 + public function testCreateCountry()
  38 + {
  39 + $country = factory(Country::class)->make();
  40 +
  41 + $this->browse(function (Browser $browser) use ($country) {
  42 + $browser->loginLegacy()
  43 + ->visit(new CreatePage())
  44 + ->type('@input-name', $country->name)
  45 + ->type('@input-ibge', $country->ibge)
  46 + ->press('@button-save')
  47 + ->on(new ListingPage());
  48 + });
  49 + }
  50 +
  51 + /**
  52 + * Test update a country.
  53 + *
  54 + * @return void
  55 + *
  56 + * @throws \Throwable
  57 + */
  58 + public function testUpdateCountry()
  59 + {
  60 + $country = factory(Country::class)->make();
  61 +
  62 + $this->browse(function (Browser $browser) use ($country) {
  63 + $browser->loginLegacy()
  64 + ->visit(new UpdatePage(1)) // FIXME ID should be dynamic in the future
  65 + ->type('@input-name', $country->name)
  66 + ->type('@input-ibge', $country->ibge)
  67 + ->press('@button-save')
  68 + ->on(new ListingPage());
  69 + });
  70 + }
  71 +
  72 + /**
  73 + * Test country flow.
  74 + *
  75 + * @return void
  76 + *
  77 + * @throws \Throwable
  78 + */
  79 + public function testFlowForCountryPages()
  80 + {
  81 + $this->browse(function (Browser $browser) {
  82 + $country = factory(Country::class)->make();
  83 + $countryAfterUpdate = factory(Country::class)->make();
  84 +
  85 + $browser->loginLegacy();
  86 +
  87 + $browser->visit(new ListingPage())
  88 + ->press(' Novo ');
  89 +
  90 + $browser->on(new CreatePage())
  91 + ->type('@input-name', $country->name)
  92 + ->type('@input-ibge', $country->ibge)
  93 + ->press('@button-save');
  94 +
  95 + $browser->on(new ListingPage())
  96 + ->type('@input-name', $country->name)
  97 + ->press('Buscar');
  98 +
  99 + $browser->on(new ListingPage());
  100 +
  101 + $countryId = $browser->resolver->findByText($country->name, 'a')->getAttribute('data-id');
  102 +
  103 + $browser->clickLink($country->name);
  104 +
  105 + $browser->on(new DetailPage($countryId))
  106 + ->press(' Editar ');
  107 +
  108 + $browser->on(new UpdatePage($countryId))
  109 + ->type('@input-name', $countryAfterUpdate->name)
  110 + ->type('@input-ibge', $countryAfterUpdate->ibge)
  111 + ->press('@button-save');
  112 +
  113 + $browser->on(new ListingPage())
  114 + ->type('@input-name', $countryAfterUpdate->name)
  115 + ->press('Buscar')
  116 + ->clickLink($countryAfterUpdate->name);
  117 +
  118 + $browser->on(new DetailPage($countryId));
  119 + });
  120 + }
  121 +}
... ...
tests/Browser/DistrictTest.php 0 → 100644
... ... @@ -0,0 +1,91 @@
  1 +<?php
  2 +
  3 +namespace Tests\Browser;
  4 +
  5 +use Illuminate\Foundation\Testing\WithFaker;
  6 +use Tests\Browser\Pages\District\CreatePage;
  7 +use Tests\Browser\Pages\District\DetailPage;
  8 +use Tests\Browser\Pages\District\ListingPage;
  9 +use Tests\Browser\Pages\District\UpdatePage;
  10 +use Tests\DuskTestCase;
  11 +use Laravel\Dusk\Browser;
  12 +
  13 +class DistrictTest extends DuskTestCase
  14 +{
  15 + use WithFaker;
  16 +
  17 + /**
  18 + * Test district flow.
  19 + *
  20 + * @return void
  21 + *
  22 + * @throws \Throwable
  23 + */
  24 + public function testFlowForCityPages()
  25 + {
  26 + $this->browse(function (Browser $browser) {
  27 + $country = 45; // Brasil
  28 + $state = 'SC'; // Santa Catarina
  29 + $city = 4418; // Içara
  30 + $districtName = $this->faker->name;
  31 + $districtNameAfterUpdate = $this->faker->name;
  32 +
  33 + $browser->loginLegacy();
  34 +
  35 + $browser->visit(new ListingPage())
  36 + ->press(' Novo ');
  37 +
  38 + $browser->on(new CreatePage())
  39 + ->select('@select-country', $country)
  40 + ->waitUsing(10, 1000, function () use ($browser) {
  41 + return $browser->resolver->findOrFail('[name=sigla_uf]')->isEnabled();
  42 + })
  43 + ->select('@select-state', $state)
  44 + ->waitUsing(10, 1000, function () use ($browser) {
  45 + return $browser->resolver->findOrFail('[name=idmun]')->isEnabled();
  46 + })
  47 + ->select('@select-city', $city)
  48 + ->type('@input-name', $districtName)
  49 + ->press('@button-save');
  50 +
  51 + $browser->on(new ListingPage())
  52 + ->type('@input-name', $districtName)
  53 + ->press('Buscar');
  54 +
  55 + $browser->on(new ListingPage());
  56 +
  57 + $districtId = $browser->resolver->findByText($districtName, 'a')->getAttribute('data-id');
  58 +
  59 + $browser->clickLink($districtName);
  60 +
  61 + $browser->on(new DetailPage($districtId))
  62 + ->press(' Editar ');
  63 +
  64 + $browser->on(new UpdatePage($districtId))
  65 + ->type('@input-name', $districtNameAfterUpdate)
  66 + ->press('@button-save');
  67 +
  68 + $browser->on(new ListingPage())
  69 + ->type('@input-name', $districtNameAfterUpdate)
  70 + ->press('Buscar')
  71 + ->clickLink($districtNameAfterUpdate);
  72 +
  73 + $browser->on(new DetailPage($districtId));
  74 + });
  75 + }
  76 +
  77 + /**
  78 + * Test district listing.
  79 + *
  80 + * @return void
  81 + *
  82 + * @throws \Throwable
  83 + */
  84 + public function testDistrictListing()
  85 + {
  86 + $this->browse(function (Browser $browser) {
  87 + $browser->loginLegacy();
  88 + $browser->visit(new ListingPage());
  89 + });
  90 + }
  91 +}
... ...
tests/Browser/NeighborhoodTest.php 0 → 100644
... ... @@ -0,0 +1,26 @@
  1 +<?php
  2 +
  3 +namespace Tests\Browser;
  4 +
  5 +use Tests\Browser\Pages\Neighborhood\ListingPage;
  6 +use Tests\DuskTestCase;
  7 +use Laravel\Dusk\Browser;
  8 +
  9 +class NeighborhoodTest extends DuskTestCase
  10 +{
  11 + /**
  12 + * Test neighborhood listing.
  13 + *
  14 + * @return void
  15 + *
  16 + * @throws \Throwable
  17 + */
  18 + public function testNeighborhoodListing()
  19 + {
  20 + $this->browse(function (Browser $browser) {
  21 + $browser->loginLegacy();
  22 +
  23 + $browser->visit(new ListingPage());
  24 + });
  25 + }
  26 +}
... ...
tests/Browser/Pages/City/CreatePage.php 0 → 100644
... ... @@ -0,0 +1,47 @@
  1 +<?php
  2 +
  3 +namespace Tests\Browser\Pages\City;
  4 +
  5 +use Laravel\Dusk\Browser;
  6 +use Laravel\Dusk\Page;
  7 +
  8 +class CreatePage extends Page
  9 +{
  10 + /**
  11 + * Get the URL for the page.
  12 + *
  13 + * @return string
  14 + */
  15 + public function url()
  16 + {
  17 + return '/intranet/public_municipio_cad.php';
  18 + }
  19 +
  20 + /**
  21 + * Assert that the browser is on the page.
  22 + *
  23 + * @param Browser $browser
  24 + * @return void
  25 + */
  26 + public function assert(Browser $browser)
  27 + {
  28 + $browser->assertPathIs($this->url())
  29 + ->assertSee('Cadastrar município');
  30 + }
  31 +
  32 + /**
  33 + * Get the element shortcuts for the page.
  34 + *
  35 + * @return array
  36 + */
  37 + public function elements()
  38 + {
  39 + return [
  40 + '@select-country' => '[name=idpais]',
  41 + '@select-state' => '[name=sigla_uf]',
  42 + '@input-name' => '[name=nome]',
  43 + '@input-ibge' => '[name=cod_ibge]',
  44 + '@button-save' => '#btn_enviar',
  45 + ];
  46 + }
  47 +}
... ...
tests/Browser/Pages/City/DetailPage.php 0 → 100644
... ... @@ -0,0 +1,53 @@
  1 +<?php
  2 +
  3 +namespace Tests\Browser\Pages\City;
  4 +
  5 +use Laravel\Dusk\Browser;
  6 +use Tests\Browser\Pages\Page;
  7 +
  8 +class DetailPage extends Page
  9 +{
  10 + /**
  11 + * @var int
  12 + */
  13 + private $cityId;
  14 +
  15 + /**
  16 + * DetailPage constructor.
  17 + *
  18 + * @param int $cityId
  19 + */
  20 + public function __construct($cityId)
  21 + {
  22 + $this->cityId = $cityId;
  23 + }
  24 +
  25 + /**
  26 + * Get the URL for the page.
  27 + *
  28 + * @param bool $onlyPath
  29 + *
  30 + * @return string
  31 + */
  32 + public function url($onlyPath = false)
  33 + {
  34 + if ($onlyPath) {
  35 + return '/intranet/public_municipio_det.php';
  36 + }
  37 +
  38 + return '/intranet/public_municipio_det.php?idmun=' . $this->cityId;
  39 + }
  40 +
  41 + /**
  42 + * Assert that the browser is on the page.
  43 + *
  44 + * @param Browser $browser
  45 + * @return void
  46 + */
  47 + public function assert(Browser $browser)
  48 + {
  49 + $browser->assertPathIs($this->url(true))
  50 + ->assertSee('Detalhe do município')
  51 + ->assertSee('Município - Detalhe');
  52 + }
  53 +}
... ...
tests/Browser/Pages/City/ListingPage.php 0 → 100644
... ... @@ -0,0 +1,50 @@
  1 +<?php
  2 +
  3 +namespace Tests\Browser\Pages\City;
  4 +
  5 +use Laravel\Dusk\Browser;
  6 +use Tests\Browser\Pages\Page;
  7 +
  8 +class ListingPage extends Page
  9 +{
  10 + /**
  11 + * Get the URL for the page.
  12 + *
  13 + * @return string
  14 + */
  15 + public function url()
  16 + {
  17 + return '/intranet/public_municipio_lst.php';
  18 + }
  19 +
  20 + /**
  21 + * Assert that the browser is on the page.
  22 + *
  23 + * @param Browser $browser
  24 + * @return void
  25 + */
  26 + public function assert(Browser $browser)
  27 + {
  28 + $browser->assertPathIs($this->url())
  29 + ->assertSee('Listagem de municípios')
  30 + ->assertSee('Pais')
  31 + ->assertSee('Estado')
  32 + ->assertSee('Nome')
  33 + ->assertSee('Município - Listagem');
  34 + }
  35 +
  36 + /**
  37 + * Get the element shortcuts for the page.
  38 + *
  39 + * @return array
  40 + */
  41 + public function elements()
  42 + {
  43 + return [
  44 + '@select-country' => '[name=idpais]',
  45 + '@select-state' => '[name=sigla_uf]',
  46 + '@input-name' => '[name=nome]',
  47 + '@button-search' => '#botao_busca',
  48 + ];
  49 + }
  50 +}
... ...
tests/Browser/Pages/City/UpdatePage.php 0 → 100644
... ... @@ -0,0 +1,65 @@
  1 +<?php
  2 +
  3 +namespace Tests\Browser\Pages\City;
  4 +
  5 +use Laravel\Dusk\Browser;
  6 +use Tests\Browser\Pages\Page;
  7 +
  8 +class UpdatePage extends Page
  9 +{
  10 + /**
  11 + * @var int
  12 + */
  13 + private $cityId;
  14 +
  15 + /**
  16 + * UpdatePage constructor.
  17 + *
  18 + * @param int $cityId
  19 + */
  20 + public function __construct($cityId)
  21 + {
  22 + $this->cityId = $cityId;
  23 + }
  24 +
  25 + /**
  26 + * Get the URL for the page.
  27 + *
  28 + * @param bool $onlyPath
  29 + *
  30 + * @return string
  31 + */
  32 + public function url($onlyPath = false)
  33 + {
  34 + if ($onlyPath) {
  35 + return '/intranet/public_municipio_cad.php';
  36 + }
  37 +
  38 + return '/intranet/public_municipio_cad.php?idmun=' . $this->cityId;
  39 + }
  40 +
  41 + /**
  42 + * Assert that the browser is on the page.
  43 + *
  44 + * @param Browser $browser
  45 + * @return void
  46 + */
  47 + public function assert(Browser $browser)
  48 + {
  49 + $browser->assertPathIs($this->url(true))
  50 + ->assertSee('Editar município');
  51 + }
  52 +
  53 + /**
  54 + * Get the element shortcuts for the page.
  55 + *
  56 + * @return array
  57 + */
  58 + public function elements()
  59 + {
  60 + return [
  61 + '@input-name' => '[name=nome]',
  62 + '@button-save' => '#btn_enviar',
  63 + ];
  64 + }
  65 +}
... ...
tests/Browser/Pages/Country/CreatePage.php 0 → 100644
... ... @@ -0,0 +1,47 @@
  1 +<?php
  2 +
  3 +namespace Tests\Browser\Pages\Country;
  4 +
  5 +use Laravel\Dusk\Browser;
  6 +use Tests\Browser\Pages\Page;
  7 +
  8 +class CreatePage extends Page
  9 +{
  10 + /**
  11 + * Get the URL for the page.
  12 + *
  13 + * @return string
  14 + */
  15 + public function url()
  16 + {
  17 + return '/intranet/public_pais_cad.php';
  18 + }
  19 +
  20 + /**
  21 + * Assert that the browser is on the page.
  22 + *
  23 + * @param Browser $browser
  24 + * @return void
  25 + */
  26 + public function assert(Browser $browser)
  27 + {
  28 + $browser->assertPathIs($this->url())
  29 + ->assertSee('Cadastrar país')
  30 + ->assertSee('Nome')
  31 + ->assertSee('Código INEP');
  32 + }
  33 +
  34 + /**
  35 + * Get the element shortcuts for the page.
  36 + *
  37 + * @return array
  38 + */
  39 + public function elements()
  40 + {
  41 + return [
  42 + '@input-name' => '[name=nome]',
  43 + '@input-ibge' => '[name=cod_ibge]',
  44 + '@button-save' => '#btn_enviar',
  45 + ];
  46 + }
  47 +}
... ...
tests/Browser/Pages/Country/DetailPage.php 0 → 100644
... ... @@ -0,0 +1,53 @@
  1 +<?php
  2 +
  3 +namespace Tests\Browser\Pages\Country;
  4 +
  5 +use Laravel\Dusk\Browser;
  6 +use Tests\Browser\Pages\Page;
  7 +
  8 +class DetailPage extends Page
  9 +{
  10 + /**
  11 + * @var int
  12 + */
  13 + private $countryId;
  14 +
  15 + /**
  16 + * DetailPage constructor.
  17 + *
  18 + * @param int $countryId
  19 + */
  20 + public function __construct($countryId)
  21 + {
  22 + $this->countryId = $countryId;
  23 + }
  24 +
  25 + /**
  26 + * Get the URL for the page.
  27 + *
  28 + * @param bool $onlyPath
  29 + *
  30 + * @return string
  31 + */
  32 + public function url($onlyPath = false)
  33 + {
  34 + if ($onlyPath) {
  35 + return '/intranet/public_pais_det.php';
  36 + }
  37 +
  38 + return '/intranet/public_pais_det.php?idpais=' . $this->countryId;
  39 + }
  40 +
  41 + /**
  42 + * Assert that the browser is on the page.
  43 + *
  44 + * @param Browser $browser
  45 + * @return void
  46 + */
  47 + public function assert(Browser $browser)
  48 + {
  49 + $browser->assertPathIs($this->url(true))
  50 + ->assertSee('Detalhe do país')
  51 + ->assertSee('Pais - Detalhe');
  52 + }
  53 +}
... ...
tests/Browser/Pages/Country/ListingPage.php 0 → 100644
... ... @@ -0,0 +1,45 @@
  1 +<?php
  2 +
  3 +namespace Tests\Browser\Pages\Country;
  4 +
  5 +use Laravel\Dusk\Browser;
  6 +use Tests\Browser\Pages\Page;
  7 +
  8 +class ListingPage extends Page
  9 +{
  10 + /**
  11 + * Get the URL for the page.
  12 + *
  13 + * @return string
  14 + */
  15 + public function url()
  16 + {
  17 + return '/intranet/public_pais_lst.php';
  18 + }
  19 +
  20 + /**
  21 + * Assert that the browser is on the page.
  22 + *
  23 + * @param Browser $browser
  24 + * @return void
  25 + */
  26 + public function assert(Browser $browser)
  27 + {
  28 + $browser->assertPathIs($this->url())
  29 + ->assertSee('Listagem de países')
  30 + ->assertSee('Pais - Listagem');
  31 + }
  32 +
  33 + /**
  34 + * Get the element shortcuts for the page.
  35 + *
  36 + * @return array
  37 + */
  38 + public function elements()
  39 + {
  40 + return [
  41 + '@input-name' => '[name=nome]',
  42 + '@button-new' => '#btn_enviar',
  43 + ];
  44 + }
  45 +}
... ...
tests/Browser/Pages/Country/UpdatePage.php 0 → 100644
... ... @@ -0,0 +1,68 @@
  1 +<?php
  2 +
  3 +namespace Tests\Browser\Pages\Country;
  4 +
  5 +use Laravel\Dusk\Browser;
  6 +use Tests\Browser\Pages\Page;
  7 +
  8 +class UpdatePage extends Page
  9 +{
  10 + /**
  11 + * @var int
  12 + */
  13 + private $countryId;
  14 +
  15 + /**
  16 + * UpdatePage constructor.
  17 + *
  18 + * @param int $countryId
  19 + */
  20 + public function __construct($countryId)
  21 + {
  22 + $this->countryId = $countryId;
  23 + }
  24 +
  25 + /**
  26 + * Get the URL for the page.
  27 + *
  28 + * @param bool $onlyPath
  29 + *
  30 + * @return string
  31 + */
  32 + public function url($onlyPath = false)
  33 + {
  34 + if ($onlyPath) {
  35 + return '/intranet/public_pais_cad.php';
  36 + }
  37 +
  38 + return '/intranet/public_pais_cad.php?idpais=' . $this->countryId;
  39 + }
  40 +
  41 + /**
  42 + * Assert that the browser is on the page.
  43 + *
  44 + * @param Browser $browser
  45 + * @return void
  46 + */
  47 + public function assert(Browser $browser)
  48 + {
  49 + $browser->assertPathIs($this->url(true))
  50 + ->assertSee('Editar país')
  51 + ->assertSee('Nome')
  52 + ->assertSee('Código INEP');
  53 + }
  54 +
  55 + /**
  56 + * Get the element shortcuts for the page.
  57 + *
  58 + * @return array
  59 + */
  60 + public function elements()
  61 + {
  62 + return [
  63 + '@input-name' => '[name=nome]',
  64 + '@input-ibge' => '[name=cod_ibge]',
  65 + '@button-save' => '#btn_enviar',
  66 + ];
  67 + }
  68 +}
... ...
tests/Browser/Pages/District/CreatePage.php 0 → 100644
... ... @@ -0,0 +1,48 @@
  1 +<?php
  2 +
  3 +namespace Tests\Browser\Pages\District;
  4 +
  5 +use Laravel\Dusk\Browser;
  6 +use Tests\Browser\Pages\Page;
  7 +
  8 +class CreatePage extends Page
  9 +{
  10 + /**
  11 + * Get the URL for the page.
  12 + *
  13 + * @return string
  14 + */
  15 + public function url()
  16 + {
  17 + return '/intranet/public_distrito_cad.php';
  18 + }
  19 +
  20 + /**
  21 + * Assert that the browser is on the page.
  22 + *
  23 + * @param Browser $browser
  24 + * @return void
  25 + */
  26 + public function assert(Browser $browser)
  27 + {
  28 + $browser->assertPathIs($this->url())
  29 + ->assertSee('Cadastrar distrito');
  30 + }
  31 +
  32 + /**
  33 + * Get the element shortcuts for the page.
  34 + *
  35 + * @return array
  36 + */
  37 + public function elements()
  38 + {
  39 + return [
  40 + '@select-country' => '[name=idpais]',
  41 + '@select-state' => '[name=sigla_uf]',
  42 + '@select-city' => '[name=idmun]',
  43 + '@input-name' => '[name=nome]',
  44 + '@input-ibge' => '[name=cod_ibge]',
  45 + '@button-save' => '#btn_enviar',
  46 + ];
  47 + }
  48 +}
... ...
tests/Browser/Pages/District/DetailPage.php 0 → 100644
... ... @@ -0,0 +1,65 @@
  1 +<?php
  2 +
  3 +namespace Tests\Browser\Pages\District;
  4 +
  5 +use Laravel\Dusk\Browser;
  6 +use Tests\Browser\Pages\Page;
  7 +
  8 +class DetailPage extends Page
  9 +{
  10 + /**
  11 + * @var int
  12 + */
  13 + private $districtId;
  14 +
  15 + /**
  16 + * DetailPage constructor.
  17 + *
  18 + * @param int $districtId
  19 + */
  20 + public function __construct($districtId)
  21 + {
  22 + $this->districtId = $districtId;
  23 + }
  24 +
  25 + /**
  26 + * Get the URL for the page.
  27 + *
  28 + * @param bool $onlyPath
  29 + *
  30 + * @return string
  31 + */
  32 + public function url($onlyPath = false)
  33 + {
  34 + if ($onlyPath) {
  35 + return '/intranet/public_distrito_det.php';
  36 + }
  37 +
  38 + return '/intranet/public_distrito_det.php?iddis=' . $this->districtId;
  39 + }
  40 +
  41 + /**
  42 + * Assert that the browser is on the page.
  43 + *
  44 + * @param Browser $browser
  45 + * @return void
  46 + */
  47 + public function assert(Browser $browser)
  48 + {
  49 + $browser->assertPathIs($this->url(true))
  50 + ->assertSee('Detalhe do distrito')
  51 + ->assertSee('Distrito - Detalhe');
  52 + }
  53 +
  54 + /**
  55 + * Get the element shortcuts for the page.
  56 + *
  57 + * @return array
  58 + */
  59 + public function elements()
  60 + {
  61 + return [
  62 + '@element' => '#selector',
  63 + ];
  64 + }
  65 +}
... ...
tests/Browser/Pages/District/ListingPage.php 0 → 100644
... ... @@ -0,0 +1,52 @@
  1 +<?php
  2 +
  3 +namespace Tests\Browser\Pages\District;
  4 +
  5 +use Laravel\Dusk\Browser;
  6 +use Tests\Browser\Pages\Page;
  7 +
  8 +class ListingPage extends Page
  9 +{
  10 + /**
  11 + * Get the URL for the page.
  12 + *
  13 + * @return string
  14 + */
  15 + public function url()
  16 + {
  17 + return '/intranet/public_distrito_lst.php';
  18 + }
  19 +
  20 + /**
  21 + * Assert that the browser is on the page.
  22 + *
  23 + * @param Browser $browser
  24 + * @return void
  25 + */
  26 + public function assert(Browser $browser)
  27 + {
  28 + $browser->assertPathIs($this->url())
  29 + ->assertSee('Listagem de distritos')
  30 + ->assertSee('Pais')
  31 + ->assertSee('Estado')
  32 + ->assertSee('Município')
  33 + ->assertSee('Nome')
  34 + ->assertSee('Distrito - Listagem');
  35 + }
  36 +
  37 + /**
  38 + * Get the element shortcuts for the page.
  39 + *
  40 + * @return array
  41 + */
  42 + public function elements()
  43 + {
  44 + return [
  45 + '@select-country' => '[name=idpais]',
  46 + '@select-state' => '[name=sigla_uf]',
  47 + '@select-city' => '[name=idmun]',
  48 + '@input-name' => '[name=nome]',
  49 + '@button-search' => '#botao_busca',
  50 + ];
  51 + }
  52 +}
... ...
tests/Browser/Pages/District/UpdatePage.php 0 → 100644
... ... @@ -0,0 +1,65 @@
  1 +<?php
  2 +
  3 +namespace Tests\Browser\Pages\District;
  4 +
  5 +use Laravel\Dusk\Browser;
  6 +use Tests\Browser\Pages\Page;
  7 +
  8 +class UpdatePage extends Page
  9 +{
  10 + /**
  11 + * @var int
  12 + */
  13 + private $districtId;
  14 +
  15 + /**
  16 + * DetailPage constructor.
  17 + *
  18 + * @param int $districtId
  19 + */
  20 + public function __construct($districtId)
  21 + {
  22 + $this->districtId = $districtId;
  23 + }
  24 +
  25 + /**
  26 + * Get the URL for the page.
  27 + *
  28 + * @param bool $onlyPath
  29 + *
  30 + * @return string
  31 + */
  32 + public function url($onlyPath = false)
  33 + {
  34 + if ($onlyPath) {
  35 + return '/intranet/public_distrito_cad.php';
  36 + }
  37 +
  38 + return '/intranet/public_distrito_cad.php?iddis=' . $this->districtId;
  39 + }
  40 +
  41 + /**
  42 + * Assert that the browser is on the page.
  43 + *
  44 + * @param Browser $browser
  45 + * @return void
  46 + */
  47 + public function assert(Browser $browser)
  48 + {
  49 + $browser->assertPathIs($this->url(true))
  50 + ->assertSee('Editar distrito');
  51 + }
  52 +
  53 + /**
  54 + * Get the element shortcuts for the page.
  55 + *
  56 + * @return array
  57 + */
  58 + public function elements()
  59 + {
  60 + return [
  61 + '@input-name' => '[name=nome]',
  62 + '@button-save' => '#btn_enviar',
  63 + ];
  64 + }
  65 +}
... ...
tests/Browser/Pages/Neighborhood/ListingPage.php 0 → 100644
... ... @@ -0,0 +1,37 @@
  1 +<?php
  2 +
  3 +namespace Tests\Browser\Pages\Neighborhood;
  4 +
  5 +use Laravel\Dusk\Browser;
  6 +use Tests\Browser\Pages\Page;
  7 +
  8 +class ListingPage extends Page
  9 +{
  10 + /**
  11 + * Get the URL for the page.
  12 + *
  13 + * @return string
  14 + */
  15 + public function url()
  16 + {
  17 + return '/intranet/public_bairro_lst.php';
  18 + }
  19 +
  20 + /**
  21 + * Assert that the browser is on the page.
  22 + *
  23 + * @param Browser $browser
  24 + * @return void
  25 + */
  26 + public function assert(Browser $browser)
  27 + {
  28 + $browser->assertPathIs($this->url())
  29 + ->assertSee('Listagem de bairros')
  30 + ->assertSee('Pais')
  31 + ->assertSee('Estado')
  32 + ->assertSee('Município')
  33 + ->assertSee('Distrito')
  34 + ->assertSee('Nome')
  35 + ->assertSee('Bairro - Listagem');
  36 + }
  37 +}
... ...
tests/Browser/Pages/State/CreatePage.php 0 → 100644
... ... @@ -0,0 +1,47 @@
  1 +<?php
  2 +
  3 +namespace Tests\Browser\Pages\State;
  4 +
  5 +use Laravel\Dusk\Browser;
  6 +use Tests\Browser\Pages\Page;
  7 +
  8 +class CreatePage extends Page
  9 +{
  10 + /**
  11 + * Get the URL for the page.
  12 + *
  13 + * @return string
  14 + */
  15 + public function url()
  16 + {
  17 + return '/intranet/public_uf_cad.php';
  18 + }
  19 +
  20 + /**
  21 + * Assert that the browser is on the page.
  22 + *
  23 + * @param Browser $browser
  24 + * @return void
  25 + */
  26 + public function assert(Browser $browser)
  27 + {
  28 + $browser->assertPathIs($this->url())
  29 + ->assertSee('Cadastrar UF');
  30 + }
  31 +
  32 + /**
  33 + * Get the element shortcuts for the page.
  34 + *
  35 + * @return array
  36 + */
  37 + public function elements()
  38 + {
  39 + return [
  40 + '@select-country' => '[name=idpais]',
  41 + '@input-abbreviation' => '[name=sigla_uf]',
  42 + '@input-name' => '[name=nome]',
  43 + '@input-ibge' => '[name=cod_ibge]',
  44 + '@button-save' => '#btn_enviar',
  45 + ];
  46 + }
  47 +}
... ...
tests/Browser/Pages/State/DetailPage.php 0 → 100644
... ... @@ -0,0 +1,53 @@
  1 +<?php
  2 +
  3 +namespace Tests\Browser\Pages\State;
  4 +
  5 +use Laravel\Dusk\Browser;
  6 +use Tests\Browser\Pages\Page;
  7 +
  8 +class DetailPage extends Page
  9 +{
  10 + /**
  11 + * @var int
  12 + */
  13 + private $stateAbbreviation;
  14 +
  15 + /**
  16 + * DetailPage constructor.
  17 + *
  18 + * @param string $stateAbbreviation
  19 + */
  20 + public function __construct($stateAbbreviation)
  21 + {
  22 + $this->stateAbbreviation = $stateAbbreviation;
  23 + }
  24 +
  25 + /**
  26 + * Get the URL for the page.
  27 + *
  28 + * @param bool $onlyPath
  29 + *
  30 + * @return string
  31 + */
  32 + public function url($onlyPath = false)
  33 + {
  34 + if ($onlyPath) {
  35 + return '/intranet/public_uf_det.php';
  36 + }
  37 +
  38 + return '/intranet/public_uf_det.php?sigla_uf=' . $this->stateAbbreviation;
  39 + }
  40 +
  41 + /**
  42 + * Assert that the browser is on the page.
  43 + *
  44 + * @param Browser $browser
  45 + * @return void
  46 + */
  47 + public function assert(Browser $browser)
  48 + {
  49 + $browser->assertPathIs($this->url(true))
  50 + ->assertSee('Detalhe da UF')
  51 + ->assertSee('Uf - Detalhe');
  52 + }
  53 +}
... ...
tests/Browser/Pages/State/ListingPage.php 0 → 100644
... ... @@ -0,0 +1,47 @@
  1 +<?php
  2 +
  3 +namespace Tests\Browser\Pages\State;
  4 +
  5 +use Laravel\Dusk\Browser;
  6 +use Tests\Browser\Pages\Page;
  7 +
  8 +class ListingPage extends Page
  9 +{
  10 + /**
  11 + * Get the URL for the page.
  12 + *
  13 + * @return string
  14 + */
  15 + public function url()
  16 + {
  17 + return '/intranet/public_uf_lst.php';
  18 + }
  19 +
  20 + /**
  21 + * Assert that the browser is on the page.
  22 + *
  23 + * @param Browser $browser
  24 + * @return void
  25 + */
  26 + public function assert(Browser $browser)
  27 + {
  28 + $browser->assertPathIs($this->url())
  29 + ->assertSee('Listagem de UFs')
  30 + ->assertSee('Pais')
  31 + ->assertSee('Sigla Uf')
  32 + ->assertSee('Nome')
  33 + ->assertSee('Uf - Listagem');
  34 + }
  35 +
  36 + /**
  37 + * Get the element shortcuts for the page.
  38 + *
  39 + * @return array
  40 + */
  41 + public function elements()
  42 + {
  43 + return [
  44 + '@input-name' => '[name=nome]',
  45 + ];
  46 + }
  47 +}
... ...
tests/Browser/Pages/State/UpdatePage.php 0 → 100644
... ... @@ -0,0 +1,68 @@
  1 +<?php
  2 +
  3 +namespace Tests\Browser\Pages\State;
  4 +
  5 +use Laravel\Dusk\Browser;
  6 +use Tests\Browser\Pages\Page;
  7 +
  8 +class UpdatePage extends Page
  9 +{
  10 + /**
  11 + * @var int
  12 + */
  13 + private $stateAbbreviation;
  14 +
  15 + /**
  16 + * DetailPage constructor.
  17 + *
  18 + * @param string $stateAbbreviation
  19 + */
  20 + public function __construct($stateAbbreviation)
  21 + {
  22 + $this->stateAbbreviation = $stateAbbreviation;
  23 + }
  24 +
  25 + /**
  26 + * Get the URL for the page.
  27 + *
  28 + * @param bool $onlyPath
  29 + *
  30 + * @return string
  31 + */
  32 + public function url($onlyPath = false)
  33 + {
  34 + if ($onlyPath) {
  35 + return '/intranet/public_uf_cad.php';
  36 + }
  37 +
  38 + return '/intranet/public_uf_cad.php?sigla_uf=' . $this->stateAbbreviation;
  39 + }
  40 +
  41 + /**
  42 + * Assert that the browser is on the page.
  43 + *
  44 + * @param Browser $browser
  45 + * @return void
  46 + */
  47 + public function assert(Browser $browser)
  48 + {
  49 + $browser->assertPathIs($this->url(true))
  50 + ->assertSee('Editar UF');
  51 + }
  52 +
  53 + /**
  54 + * Get the element shortcuts for the page.
  55 + *
  56 + * @return array
  57 + */
  58 + public function elements()
  59 + {
  60 + return [
  61 + '@select-country' => '[name=idpais]',
  62 + '@input-abbreviation' => '[name=sigla_uf]',
  63 + '@input-name' => '[name=nome]',
  64 + '@input-ibge' => '[name=cod_ibge]',
  65 + '@button-save' => '#btn_enviar',
  66 + ];
  67 + }
  68 +}
... ...
tests/Browser/StateTest.php 0 → 100644
... ... @@ -0,0 +1,60 @@
  1 +<?php
  2 +
  3 +namespace Tests\Browser;
  4 +
  5 +use App\State;
  6 +use Tests\Browser\Pages\State\CreatePage;
  7 +use Tests\Browser\Pages\State\DetailPage;
  8 +use Tests\Browser\Pages\State\ListingPage;
  9 +use Tests\Browser\Pages\State\UpdatePage;
  10 +use Tests\DuskTestCase;
  11 +use Laravel\Dusk\Browser;
  12 +
  13 +class StateTest extends DuskTestCase
  14 +{
  15 + /**
  16 + * Test state listing.
  17 + *
  18 + * @return void
  19 + *
  20 + * @throws \Throwable
  21 + */
  22 + public function testFlowForStatePages()
  23 + {
  24 + $this->browse(function (Browser $browser) {
  25 + $state = factory(State::class)->make([
  26 + 'country_id' => 1, // FIXME makes dynamic in the future, now is Tonga (1)
  27 + ]);
  28 + $stateAfterUpdate = factory(State::class)->make([
  29 + 'country_id' => 1, // FIXME makes dynamic in the future, now is Tonga (1)
  30 + ]);
  31 +
  32 + $browser->loginLegacy();
  33 +
  34 + $browser->visit(new ListingPage())
  35 + ->press(' Novo ');
  36 +
  37 + $browser->on(new CreatePage())
  38 + ->select('@select-country', $state->country_id)
  39 + ->type('@input-abbreviation', $state->abbreviation)
  40 + ->type('@input-name', $state->name)
  41 + ->type('@input-ibge', $state->ibge)
  42 + ->press('@button-save');
  43 +
  44 + $browser->on(new ListingPage())
  45 + ->type('@input-name', $state->name)
  46 + ->press('Buscar');
  47 +
  48 + $browser->on(new ListingPage());
  49 +
  50 + $stateAbbreviation = $browser->resolver->findByText($state->name, 'a')->getAttribute('data-id');
  51 +
  52 + $browser->clickLink($state->name);
  53 +
  54 + $browser->on(new DetailPage($stateAbbreviation))
  55 + ->press(' Editar ');
  56 +
  57 + $browser->on(new UpdatePage($stateAbbreviation));
  58 + });
  59 + }
  60 +}
... ...