diff --git a/composer.json b/composer.json index 06a451c766c2f71bdb358b41e432719dedf1abe1..d2767b9f9c9399110b3384b30acecd0cc3a45d6c 100755 --- a/composer.json +++ b/composer.json @@ -15,7 +15,8 @@ "zf-commons/zfc-user": "0.1.3", "zendframework/zend-file": ">=2.3", "mpdf/mpdf": "v5.7.2", - "unicaen/unicaen-code": "dev-trunk" + "unicaen/unicaen-code": "dev-trunk", + "unicaen/unicaen-import": "dev-trunk" }, "require-dev": { "zendframework/zend-test": ">=2.3", diff --git a/composer.lock b/composer.lock index 129e0aa303a6beb42342dff7ff2274a8e3cf02d6..a30ded360ee30ca1d9e5681837c4fb45ba7a2654 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "5f156bad9957174c0a65ed9272dc6092", - "content-hash": "3bb8f2fba1529d939e569e09276fa188", + "hash": "06d39b4dea269c39c0d9a0200a979a24", + "content-hash": "725848bb2bb100f615caa9e1e0ebed41", "packages": [ { "name": "bjyoungblood/bjy-authorize", @@ -1066,16 +1066,16 @@ }, { "name": "symfony/console", - "version": "v3.0.4", + "version": "v3.0.5", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "6b1175135bc2a74c08a28d89761272de8beed8cd" + "reference": "34a214710e0714b6efcf40ba3cd1e31373a97820" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/6b1175135bc2a74c08a28d89761272de8beed8cd", - "reference": "6b1175135bc2a74c08a28d89761272de8beed8cd", + "url": "https://api.github.com/repos/symfony/console/zipball/34a214710e0714b6efcf40ba3cd1e31373a97820", + "reference": "34a214710e0714b6efcf40ba3cd1e31373a97820", "shasum": "" }, "require": { @@ -1122,7 +1122,7 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2016-03-16 17:00:50" + "time": "2016-04-28 09:48:42" }, { "name": "symfony/polyfill-mbstring", @@ -1185,16 +1185,16 @@ }, { "name": "symfony/process", - "version": "v2.8.4", + "version": "v2.8.5", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "fb467471952ef5cf8497c029980e556b47545333" + "reference": "1276bd9be89be039748cf753a2137f4ef149cd74" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/fb467471952ef5cf8497c029980e556b47545333", - "reference": "fb467471952ef5cf8497c029980e556b47545333", + "url": "https://api.github.com/repos/symfony/process/zipball/1276bd9be89be039748cf753a2137f4ef149cd74", + "reference": "1276bd9be89be039748cf753a2137f4ef149cd74", "shasum": "" }, "require": { @@ -1230,7 +1230,7 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2016-03-23 13:11:46" + "time": "2016-04-14 15:22:22" }, { "name": "unicaen/unicaen-app", @@ -1238,7 +1238,7 @@ "source": { "type": "svn", "url": "https://svn.unicaen.fr/svn/UnicaenApp", - "reference": "/trunk/@690" + "reference": "/trunk/@704" }, "require": { "doctrine/doctrine-orm-module": ">=0.7", @@ -1288,12 +1288,12 @@ "source": { "type": "svn", "url": "https://svn.unicaen.fr/svn/UnicaenAuth", - "reference": "/trunk/@269" + "reference": "/trunk/@281" }, "require": { "bjyoungblood/bjy-authorize": ">=1.4", "jasig/phpcas": ">=1.3.3", - "unicaen/unicaen-app": "dev-trunk", + "unicaen/unicaen-app": ">=1.2.2", "zf-commons/zfc-user-doctrine-orm": ">=0.1" }, "require-dev": { @@ -1338,6 +1338,30 @@ }, "description": "Boite à outils pour la programmation avec la bibliothèque Unicaen" }, + { + "name": "unicaen/unicaen-import", + "version": "dev-trunk", + "source": { + "type": "svn", + "url": "https://svn.unicaen.fr/svn/UnicaenImport", + "reference": "/trunk/@3" + }, + "require-dev": { + "phpunit/phpunit": ">=3.7" + }, + "type": "library", + "autoload": { + "psr-0": { + "UnicaenImport": "src/", + "UnicaenImportTest": "tests/" + }, + "classmap": [ + "./Module.php" + ] + }, + "description": "Boite à outils pour la programmation avec la bibliothèque Unicaen", + "time": "2016-05-03 15:31:16" + }, { "name": "zendframework/zend-authentication", "version": "2.4.9", @@ -4465,7 +4489,7 @@ }, { "name": "symfony/yaml", - "version": "v3.0.4", + "version": "v3.0.5", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", @@ -4625,6 +4649,7 @@ "unicaen/unicaen-auth": 20, "bjyoungblood/bjy-authorize": 20, "unicaen/unicaen-code": 20, + "unicaen/unicaen-import": 20, "zendframework/zend-developer-tools": 20 }, "prefer-stable": false, diff --git a/config/application.config.php b/config/application.config.php index 5f4dd5ca4bb836d0de2eb382ad7b7a2b4e1bebf7..330d48632ca7550dda0ec9fa1d40b9edab1ac2d6 100755 --- a/config/application.config.php +++ b/config/application.config.php @@ -4,8 +4,8 @@ $env = getenv('APPLICATION_ENV') ?: 'production'; $modules = [ 'ZfcBase', 'DoctrineModule', 'DoctrineORMModule', 'ZfcUser', 'ZfcUserDoctrineORM', 'BjyAuthorize', - 'UnicaenApp', 'UnicaenAuth', - 'Application', 'Import', + 'UnicaenApp', 'UnicaenAuth', 'UnicaenImport', + 'Application' //, 'Import', ]; $moduleListenerOptions = [ diff --git a/config/autoload/unicaen-import.global.php b/config/autoload/unicaen-import.global.php new file mode 100644 index 0000000000000000000000000000000000000000..592e1158a139902c248af96a00a0aa1e5c04a391 --- /dev/null +++ b/config/autoload/unicaen-import.global.php @@ -0,0 +1,15 @@ +<?php + +namespace Application; + +return [ + 'unicaen-import' => [ + 'differentiel_view_helpers' => [ + 'CHEMIN_PEDAGOGIQUE' => View\Helper\Import\CheminPedagogiqueViewHelper::class, + 'ELEMENT_PEDAGOGIQUE' => View\Helper\Import\ElementPedagogiqueViewHelper::class, + 'INTERVENANT' => View\Helper\Import\IntervenantViewHelper::class, + 'PERSONNEL' => View\Helper\Import\PersonnelViewHelper::class, + 'ETAPE' => View\Helper\Import\EtapeViewHelper::class, + ], + ], +]; \ No newline at end of file diff --git a/data/Sql/Taux fi fa fc.sql b/data/Sql/Taux fi fa fc.sql index 78e8bcc0855f3212bca4b8cf7ae88057c721dfdc..5838127ef4fc8acb544d080e43d617ecad8fc54c 100644 --- a/data/Sql/Taux fi fa fc.sql +++ b/data/Sql/Taux fi fa fc.sql @@ -69,9 +69,9 @@ SELECT ep.fa,ep.taux_fa, ep.fc,ep.taux_fc, -- NOUVEAUX TAUX FI FA FC - 0 /100 n_taux_fi, + 100 /100 n_taux_fi, 0 /100 n_taux_fa, - 100 /100 n_taux_fc + 0 /100 n_taux_fc -- FIN DES NOUVEAUX TAUX FI FA FC FROM element_pedagogique ep @@ -83,15 +83,37 @@ WHERE -- FILTRES 1 = ose_divers.comprise_entre( ep.histo_creation,ep.histo_destruction ) --AND s.code <> 'OSE' - AND e.source_code = 'DUPLCI_211' + AND e.source_code IN ( + 'L1DROI_301', +'L2DROI_301', +'LCDR13_211', +'LCDR13_212', +'LCDR13_213', +'LCDRA0_400', +'LCDRD0_500', +'MSDCD0_500', +'MSDGD0_500', +'MSDR03_205', +'MSDR04_201', +'MSDR04_206', +'MSDR05_202', +'MSDR07_201', +'MSDT04_204', +'MSDT08_201', +'L1DROI_303', +'L2DROI_303' + ) AND ep.annee_id = 2015 -- FIN DES FILTRES ) t1 WHERE - taux_fi <> n_taux_fi - OR taux_fa <> n_taux_fa - OR taux_fc <> n_taux_fc; -- Que s'il y a des différences - + 1=1 + OR ( + taux_fi <> n_taux_fi + OR taux_fa <> n_taux_fa + OR taux_fc <> n_taux_fc -- Que s'il y a des différences + ) +; select * from element_taux_regimes where id = 44174; @@ -134,14 +156,29 @@ SELECT * FROM ELEMENT_PEDAGOGIQUE WHERE source_code like '%DUUE%'; select source_code from etape where source_code in ( -'ORTH01_201', -'ORTH02_201', -'ORTH03_201', -'DUPLCI_211' +'L1DROI_301', +'L2DROI_301', +'LCDR13_211', +'LCDR13_212', +'LCDR13_213', +'LCDRA0_400', +'LCDRD0_500', +'MSDCD0_500', +'MSDGD0_500', +'MSDR03_205', +'MSDR04_201', +'MSDR04_206', +'MSDR05_202', +'MSDR07_201', +'MSDT04_204', +'MSDT08_201', +'L1DROI_303', +'L2DROI_303' + ) order by source_code; select * from etape where source_code like -'%DUPLCI%' +'%L1DROI%' order by source_code; \ No newline at end of file diff --git a/module/Application/Module.php b/module/Application/Module.php index a29303cdb3b8baab97fe1bfe41c2578199683a82..67e4f2f9c12e26a2d7849f92f0bdbf1a34b0d4ac 100755 --- a/module/Application/Module.php +++ b/module/Application/Module.php @@ -93,10 +93,10 @@ class Module implements ConsoleUsageProviderInterface, ConsoleBannerProviderInte $role = $e->getApplication()->getServiceManager()->get('ApplicationContext')->getSelectedIdentityRole(); $routeMatch = $e->getRouteMatch(); if ($role && $intervenant = $role->getIntervenant()) { - if (($value = $routeMatch->getParam($name = 'intervenant')) && $value != $intervenant->getSourceCode()) { - $routeMatch->setParam($name, $intervenant->getSourceCode()); + if (($value = $routeMatch->getParam($name = 'intervenant')) && $value != $intervenant->getRouteParam()) { + $routeMatch->setParam($name, $intervenant->getRouteParam()); } - $routeMatch->setParam('intervenant', $intervenant->getSourceCode()); + $routeMatch->setParam('intervenant', $intervenant->getRouteParam()); } } diff --git a/module/Application/autoload_classmap.php b/module/Application/autoload_classmap.php index f7a043f2f05e779755d374dddcd1ba5e9fcb75aa..622cf230b41451816300d6b11368c9776f243b75 100644 --- a/module/Application/autoload_classmap.php +++ b/module/Application/autoload_classmap.php @@ -120,7 +120,6 @@ return array( 'Application\Entity\Db\VIndicDepassRef' => __DIR__ . '/src/Application/Entity/Db/VIndicDepassRef.php', 'Application\Entity\Db\VIndicAttenteValidEnsAutre' => __DIR__ . '/src/Application/Entity/Db/VIndicAttenteValidEnsAutre.php', 'Application\Entity\Db\Departement' => __DIR__ . '/src/Application/Entity/Db/Departement.php', - 'Application\Entity\Db\Repository\IntervenantRepository' => __DIR__ . '/src/Application/Entity/Db/Repository/IntervenantRepository.php', 'Application\Entity\Db\FormuleVolumeHoraireReferentiel' => __DIR__ . '/src/Application/Entity/Db/FormuleVolumeHoraireReferentiel.php', 'Application\Entity\Db\FormuleResultatVolumeHoraireReferentiel' => __DIR__ . '/src/Application/Entity/Db/FormuleResultatVolumeHoraireReferentiel.php', 'Application\Entity\Db\VIndicAttenteMep' => __DIR__ . '/src/Application/Entity/Db/VIndicAttenteMep.php', @@ -199,7 +198,6 @@ return array( 'Application\Entity\Db\Traits\PieceJointeAwareTrait' => __DIR__ . '/src/Application/Entity/Db/Traits/PieceJointeAwareTrait.php', 'Application\Entity\Db\Traits\NotificationIndicateurAwareTrait' => __DIR__ . '/src/Application/Entity/Db/Traits/NotificationIndicateurAwareTrait.php', 'Application\Entity\Db\Traits\TypeDotationAwareTrait' => __DIR__ . '/src/Application/Entity/Db/Traits/TypeDotationAwareTrait.php', - 'Application\Entity\Db\Traits\SourceAwareTrait' => __DIR__ . '/src/Application/Entity/Db/Traits/SourceAwareTrait.php', 'Application\Entity\Db\Traits\GroupeTypeFormationAwareTrait' => __DIR__ . '/src/Application/Entity/Db/Traits/GroupeTypeFormationAwareTrait.php', 'Application\Entity\Db\Traits\ServiceAwareTrait' => __DIR__ . '/src/Application/Entity/Db/Traits/ServiceAwareTrait.php', 'Application\Entity\Db\Traits\TypeModulateurAwareTrait' => __DIR__ . '/src/Application/Entity/Db/Traits/TypeModulateurAwareTrait.php', @@ -305,7 +303,6 @@ return array( 'Application\Entity\Db\Agrement' => __DIR__ . '/src/Application/Entity/Db/Agrement.php', 'Application\Entity\Db\Personnel' => __DIR__ . '/src/Application/Entity/Db/Personnel.php', 'Application\Entity\Db\ElementModulateur' => __DIR__ . '/src/Application/Entity/Db/ElementModulateur.php', - 'Application\Entity\Db\Source' => __DIR__ . '/src/Application/Entity/Db/Source.php', 'Application\Entity\Db\FormuleIntervenant' => __DIR__ . '/src/Application/Entity/Db/FormuleIntervenant.php', 'Application\Entity\Db\WfEtape' => __DIR__ . '/src/Application/Entity/Db/WfEtape.php', 'Application\Entity\Db\TypeDotation' => __DIR__ . '/src/Application/Entity/Db/TypeDotation.php', diff --git a/module/Application/config/gestion.config.php b/module/Application/config/gestion.config.php index c81b12fcea31a126aede489e067254a74092d7c6..f440ccf6343e45217a5047d00fe2a0c3c3ad7088 100755 --- a/module/Application/config/gestion.config.php +++ b/module/Application/config/gestion.config.php @@ -104,7 +104,6 @@ return [ [ 'controller' => 'Application\Controller\Gestion', 'action' => ['index'], - 'roles' => [R_COMPOSANTE, R_ADMINISTRATEUR], 'privileges' => [ Privileges::MISE_EN_PAIEMENT_EXPORT_PAIE, Privileges::MISE_EN_PAIEMENT_VISUALISATION, diff --git a/module/Application/config/intervenant.config.php b/module/Application/config/intervenant.config.php index 9b95e3c7c5e8254761b82e32c6b635a770a45b5e..8db3461e4ccad88b03359bf8f7a68611b7294808 100644 --- a/module/Application/config/intervenant.config.php +++ b/module/Application/config/intervenant.config.php @@ -22,7 +22,7 @@ return [ ], 'may_terminate' => true, 'child_routes' => [ - 'rechercher' => [ + 'rechercher' => [ 'type' => 'Literal', 'options' => [ 'route' => '/rechercher', @@ -31,7 +31,7 @@ return [ ], ], ], - 'recherche' => [ + 'recherche' => [ 'type' => 'Literal', 'options' => [ 'route' => '/recherche', @@ -40,7 +40,7 @@ return [ ], ], ], - 'voir' => [ + 'voir' => [ 'type' => 'Segment', 'options' => [ 'route' => '/:intervenant', @@ -52,7 +52,7 @@ return [ ], ], ], - 'fiche' => [ + 'fiche' => [ 'type' => 'Segment', 'options' => [ 'route' => '/:intervenant/fiche', @@ -64,7 +64,7 @@ return [ ], ], ], - 'saisir' => [ + 'saisir' => [ 'type' => 'Segment', 'options' => [ 'route' => '/:intervenant/saisir', @@ -76,7 +76,7 @@ return [ ], ], ], - 'voir-heures-comp' => [ + 'voir-heures-comp' => [ 'type' => 'Segment', 'options' => [ 'route' => '/voir-heures-comp/:intervenant', @@ -88,7 +88,7 @@ return [ ], ], ], - 'formule-totaux-hetd' => [ + 'formule-totaux-hetd' => [ 'type' => 'Segment', 'options' => [ 'route' => '/formule-totaux-hetd/:intervenant/:typeVolumeHoraire/:etatVolumeHoraire', @@ -102,7 +102,7 @@ return [ ], ], ], - 'feuille-de-route' => [ + 'feuille-de-route' => [ 'type' => 'Segment', 'options' => [ 'route' => '/:intervenant/feuille-de-route', @@ -114,7 +114,7 @@ return [ ], ], ], - 'modification-service-du' => [ + 'modification-service-du' => [ 'type' => 'Segment', 'options' => [ 'route' => '/:intervenant/modification-service-du', @@ -127,7 +127,7 @@ return [ ], ], ], - 'services' => [ + 'services' => [ 'type' => 'Segment', 'options' => [ 'route' => '/:intervenant/services', @@ -135,13 +135,13 @@ return [ 'intervenant' => '[0-9]*', ], 'defaults' => [ - 'controller' => 'Application\Controller\Service', - 'action' => 'index', + 'controller' => 'Application\Controller\Intervenant', + 'action' => 'services', 'type-volume-horaire-code' => Entity\Db\TypeVolumeHoraire::CODE_PREVU, ], ], ], - 'referentiel' => [ + 'referentiel' => [ 'type' => 'Segment', 'options' => [ 'route' => '/:intervenant/referentiel', @@ -155,7 +155,7 @@ return [ ], ], ], - 'services-realises' => [ + 'services-realises' => [ 'type' => 'Segment', 'options' => [ 'route' => '/:intervenant/services-realises', @@ -163,13 +163,13 @@ return [ 'intervenant' => '[0-9]*', ], 'defaults' => [ - 'controller' => 'Application\Controller\Service', - 'action' => 'index', + 'controller' => 'Application\Controller\Intervenant', + 'action' => 'services', 'type-volume-horaire-code' => Entity\Db\TypeVolumeHoraire::CODE_REALISE, ], ], ], - 'referentiel-realise' => [ + 'referentiel-realise' => [ 'type' => 'Segment', 'options' => [ 'route' => '/:intervenant/referentiel', @@ -183,7 +183,7 @@ return [ ], ], ], - 'cloturer-saisie' => [ + 'cloturer-saisie' => [ 'type' => 'Segment', 'options' => [ 'route' => '/:intervenant/services/:type-volume-horaire-code/cloturer', @@ -197,7 +197,7 @@ return [ ], ], ], - 'demande-mise-en-paiement' => [ + 'demande-mise-en-paiement' => [ 'type' => 'Segment', 'options' => [ 'route' => '/:intervenant/demande-mise-en-paiement', @@ -210,7 +210,7 @@ return [ ], ], ], - 'contrat' => [ + 'contrat' => [ 'type' => 'Segment', 'options' => [ 'route' => '/:intervenant/contrat', @@ -291,6 +291,7 @@ return [ ], 'workflow-etape-code' => WfEtape::CODE_SERVICE_SAISIE, 'withtarget' => true, + 'resource' => PrivilegeController::getResourceId('Application\Controller\Intervenant', 'services'), 'visible' => 'assertionService', ], 'pieces-jointes-saisie' => [ @@ -327,6 +328,7 @@ return [ ], 'workflow-etape-code' => WfEtape::CODE_SERVICE_SAISIE_REALISE, 'withtarget' => true, + 'resource' => PrivilegeController::getResourceId('Application\Controller\Intervenant', 'services'), 'visible' => 'assertionService', ], 'validation-service-realise' => [ @@ -336,15 +338,7 @@ return [ // coquille vide qui réserve l'emplacement du menu ], 'demande-mise-en-paiement' => [ - 'label' => "Demande de mise en paiement", - 'title' => "Demande de mise en paiement", - 'route' => 'intervenant/demande-mise-en-paiement', - 'paramsInject' => [ - 'intervenant', - ], - 'withtarget' => true, - 'resource' => PrivilegeController::getResourceId('Application\Controller\Paiement', 'demandeMiseEnPaiement'), - //'visible' => 'IntervenantNavigationPageVisibility', + // coquille vide qui réserve l'emplacement du menu ], ], ], @@ -364,11 +358,20 @@ return [ ], [ 'controller' => 'Application\Controller\Intervenant', - 'action' => ['index', 'voir', 'fiche'], + 'action' => ['index', 'voir', 'fiche', 'menu'], 'privileges' => [ Privileges::INTERVENANT_FICHE, ], ], + [ + 'controller' => 'Application\Controller\Intervenant', + 'action' => ['services'], + 'privileges' => [ + Privileges::ENSEIGNEMENT_VISUALISATION, + Privileges::REFERENTIEL_VISUALISATION, + ], + 'assertion' => 'assertionService', + ], [ 'controller' => 'Application\Controller\Intervenant', 'action' => ['saisir'], @@ -392,17 +395,20 @@ return [ ], ], [ - 'controller' => 'Application\Controller\Intervenant', + 'controller' => 'Application\Controller\Intervenant', /// @todo transférer l'action depuis le contrôleur de service 'action' => ['cloturer-saisie'], 'privileges' => [ Privileges::ENSEIGNEMENT_CLOTURE, ], 'assertion' => 'assertionIntervenant', ], - [ /// @todo à protéger d'avantage... - 'controller' => 'Application\Controller\Intervenant', - 'action' => ['formule-totaux-hetd'], - 'roles' => ['user'], + [ + 'controller' => 'Application\Controller\Intervenant', + 'action' => ['formule-totaux-hetd'], + 'privileges' => [ + Privileges::ENSEIGNEMENT_VISUALISATION, + Privileges::REFERENTIEL_VISUALISATION, + ], ], ], ], @@ -443,6 +449,7 @@ return [ 'ApplicationTypeIntervenant' => Service\TypeIntervenant::class, 'assertionIntervenant' => Assertion\IntervenantAssertion::class, 'ModificationServiceDuAssertion' => Assertion\ModificationServiceDuAssertion::class, + 'processusIntervenant' => Processus\IntervenantProcessus::class, ], ], 'view_helpers' => [ diff --git a/module/Application/config/module.config.php b/module/Application/config/module.config.php index ac9bd842e5b54b4e18d7c3887644b2d02b2e7a87..6a92c71e8fc14a83ce6218e438ef2de7a2c94586 100755 --- a/module/Application/config/module.config.php +++ b/module/Application/config/module.config.php @@ -2,6 +2,7 @@ namespace Application; +use UnicaenAuth\Provider\Rule\PrivilegeRuleProvider; const R_ADMINISTRATEUR = Acl\AdministrateurRole::ROLE_ID; const R_COMPOSANTE = Acl\ComposanteRole::ROLE_ID; const R_ETABLISSEMENT = Acl\EtablissementRole::ROLE_ID; @@ -32,10 +33,10 @@ $main = [ 'configuration' => [ 'orm_default' => [ 'string_functions' => [ - 'CONVERT' => ORM\Query\Functions\Convert::class, - 'REPLACE' => ORM\Query\Functions\Replace::class, - 'compriseEntre' => ORM\Query\Functions\OseDivers\CompriseEntre::class, - 'pasHistorise' => ORM\Query\Functions\OseDivers\PasHistorise::class, + 'CONVERT' => ORM\Query\Functions\Convert::class, + 'REPLACE' => ORM\Query\Functions\Replace::class, + 'compriseEntre' => ORM\Query\Functions\OseDivers\CompriseEntre::class, + 'pasHistorise' => ORM\Query\Functions\OseDivers\PasHistorise::class, ], 'filters' => [ 'historique' => ORM\Filter\HistoriqueFilter::class, @@ -122,7 +123,7 @@ $main = [ 'bjyauthorize' => [ 'identity_provider' => 'ApplicationIdentityProvider', - 'role_providers' => [ + 'role_providers' => [ 'ApplicationRoleProvider' => [ Acl\Role::class, @@ -136,7 +137,7 @@ $main = [ Acl\IntervenantPermanentRole::class, ], ], - 'guards' => [ + 'guards' => [ \BjyAuthorize\Guard\Controller::class => [ [ 'controller' => 'Application\Controller\Index', @@ -145,30 +146,45 @@ $main = [ ], ], ], + 'resource_providers' => [ + \BjyAuthorize\Provider\Resource\Config::class => [ + 'Information' => [], + ], + ], + 'rule_providers' => [ + PrivilegeRuleProvider::class => [ + 'allow' => [ + [ + 'roles' => ['user'], + 'resources' => 'Information', + 'assertion' => 'assertionInformation', + ], + ], + ], + ], ], 'service_manager' => [ - 'invokables' => [ - 'ApplicationAnnee' => Service\Annee::class, - 'ApplicationContext' => Service\Context::class, - 'ApplicationLocalContext' => Service\LocalContext::class, - 'ApplicationParametres' => Service\Parametres::class, - 'ApplicationUtilisateur' => Service\Utilisateur::class, - 'ApplicationTypeIntervention' => Service\TypeIntervention::class, - 'ApplicationSource' => Service\Source::class, - 'ApplicationAffectation' => Service\Affectation::class, - 'ApplicationRole' => Service\Role::class, - 'ApplicationPays' => Service\Pays::class, - 'ApplicationDepartement' => Service\Departement::class, - 'applicationFichier' => Service\FichierService::class, - 'UnicaenAuth\Service\Privilege' => Service\PrivilegeService::class + 'invokables' => [ + 'ApplicationAnnee' => Service\Annee::class, + 'ApplicationContext' => Service\Context::class, + 'ApplicationLocalContext' => Service\LocalContext::class, + 'ApplicationParametres' => Service\Parametres::class, + 'ApplicationUtilisateur' => Service\Utilisateur::class, + 'ApplicationTypeIntervention' => Service\TypeIntervention::class, + 'ApplicationSource' => Service\Source::class, + 'ApplicationAffectation' => Service\Affectation::class, + 'ApplicationRole' => Service\Role::class, + 'ApplicationPays' => Service\Pays::class, + 'ApplicationDepartement' => Service\Departement::class, + 'applicationFichier' => Service\FichierService::class, + 'UnicaenAuth\Service\Privilege' => Service\PrivilegeService::class, + 'assertionInformation' => Assertion\InformationAssertion::class, ], - 'factories' => [ + 'factories' => [ 'navigation' => Service\NavigationFactoryFactory::class, 'ApplicationRoleProvider' => Provider\Role\RoleProviderFactory::class, 'ApplicationIdentityProvider' => Provider\Identity\IdentityProviderFactory::class, ], - 'abstract_factories' => [ - ], ], 'view_helpers' => [ 'factories' => [ @@ -220,7 +236,7 @@ $main = [ 'layout' => 'layout/layout', // e.g., 'layout/layout' ], 'public_files' => [ - 'head_scripts' => [ + 'head_scripts' => [ '020_jqueryui' => 'https://gest.unicaen.fr/public/jquery-ui-1.11.4.minimal/jquery-ui.min.js', ], 'inline_scripts' => [ @@ -237,18 +253,18 @@ $main = [ '010_jquery-ui' => 'https://gest.unicaen.fr/public/jquery-ui-1.11.4.minimal/jquery-ui.min.css', '020_jquery-ui-structure' => 'https://gest.unicaen.fr/public/jquery-ui-1.11.4.minimal/jquery-ui.structure.min.css', '030_jquery-ui-theme' => 'https://gest.unicaen.fr/public/jquery-ui-1.11.4.minimal/jquery-ui.theme.min.css', - '110_' => 'https://gest.unicaen.fr/public/bootstrap-select-1.9.4/dist/css/bootstrap-select.min.css', - '111_' => 'css/cartridge.css', - '112_' => 'https://gest.unicaen.fr/public/font-awesome-4.5.0/css/font-awesome.min.css', - '113_' => 'https://gest.unicaen.fr/public/open-sans-gh-pages/open-sans.css', - '114_' => 'css/budget.css', - '115_' => 'css/paiement.css', - '116_' => 'css/agrement.css', - '117_' => 'css/service.css', - '118_' => 'css/acceuil.css', - '119_' => 'css/droits.css', - '120_' => 'css/callout.css', - '121_' => 'css/piece-jointe.css', + '110_' => 'https://gest.unicaen.fr/public/bootstrap-select-1.9.4/dist/css/bootstrap-select.min.css', + '111_' => 'css/cartridge.css', + '112_' => 'https://gest.unicaen.fr/public/font-awesome-4.5.0/css/font-awesome.min.css', + '113_' => 'https://gest.unicaen.fr/public/open-sans-gh-pages/open-sans.css', + '114_' => 'css/budget.css', + '115_' => 'css/paiement.css', + '116_' => 'css/agrement.css', + '117_' => 'css/service.css', + '118_' => 'css/acceuil.css', + '119_' => 'css/droits.css', + '120_' => 'css/callout.css', + '121_' => 'css/piece-jointe.css', ], ], ]; diff --git a/module/Application/config/offre-formation.config.php b/module/Application/config/offre-formation.config.php index f25b85c53c7678bb57339fadc02ac690e0180d80..e5e4087ca9d24c55e4583feb078b2e3b830d678f 100644 --- a/module/Application/config/offre-formation.config.php +++ b/module/Application/config/offre-formation.config.php @@ -208,9 +208,18 @@ return [ /* Éléments pédagogiques */ [ 'controller' => 'Application\Controller\OffreFormation\ElementPedagogique', - 'action' => ['voir', 'search', 'getPeriode'], // getPeriode est utilisé pour la saisie de service!!! + 'action' => ['voir'], // getPeriode est utilisé pour la saisie de service!!! 'privileges' => Privileges::ODF_ELEMENT_VISUALISATION, ], + [ + 'controller' => 'Application\Controller\OffreFormation\ElementPedagogique', + 'action' => ['search', 'getPeriode'], // getPeriode est utilisé pour la saisie de service!!! + 'privileges' => [ + Privileges::ODF_ELEMENT_VISUALISATION, + Privileges::ENSEIGNEMENT_EDITION, + ], + + ], [ 'controller' => 'Application\Controller\OffreFormation\ElementPedagogique', 'action' => ['saisir', 'supprimer'], diff --git a/module/Application/config/paiement.config.php b/module/Application/config/paiement.config.php index 5f761650040261b9fdbe625f86cf76e7d2813485..bb446c8f290a393f91603e0d2a8358e0d7829d16 100644 --- a/module/Application/config/paiement.config.php +++ b/module/Application/config/paiement.config.php @@ -2,6 +2,7 @@ namespace Application; +use Application\Entity\Db\WfEtape; use Application\Provider\Privilege\Privileges; use UnicaenAuth\Guard\PrivilegeController; use UnicaenAuth\Provider\Rule\PrivilegeRuleProvider; @@ -84,16 +85,32 @@ return [ 'default' => [ 'home' => [ 'pages' => [ + 'intervenant' => [ + 'pages' => [ + 'demande-mise-en-paiement' => [ + 'label' => "Demande de mise en paiement", + 'title' => "Demande de mise en paiement", + 'route' => 'intervenant/demande-mise-en-paiement', + 'paramsInject' => [ + 'intervenant', + ], + 'withtarget' => true, + 'workflow-etape-code' => WfEtape::CODE_DEMANDE_MEP, + 'resource' => PrivilegeController::getResourceId('Application\Controller\Paiement', 'demandeMiseEnPaiement'), + 'visible' => 'assertionPaiement', + ], + ], + ], 'gestion' => [ 'pages' => [ - 'paiement' => [ - 'label' => "Paiement", - 'title' => "Paiement", - 'route' => 'paiement', - 'icon' => 'fa fa-credit-card', + 'paiement' => [ + 'label' => "Paiement", + 'title' => "Paiement", + 'route' => 'paiement', + 'icon' => 'fa fa-credit-card', 'border-color' => '#9F491F', - 'resource' => Privileges::getResourceId(Privileges::MISE_EN_PAIEMENT_VISUALISATION), - 'pages' => [ + 'resource' => Privileges::getResourceId(Privileges::MISE_EN_PAIEMENT_VISUALISATION), + 'pages' => [ 'etat-demande-paiement' => [ 'label' => "Mises en paiement", 'title' => "Mises en paiement", @@ -142,7 +159,7 @@ return [ 'privileges' => [ Privileges::MISE_EN_PAIEMENT_DEMANDE, ], - 'assertion' => 'MiseEnPaiementAssertion', + 'assertion' => 'assertionPaiement', ], [ 'controller' => 'Application\Controller\Paiement', @@ -173,7 +190,7 @@ return [ 'resource_providers' => [ \BjyAuthorize\Provider\Resource\Config::class => [ 'MiseEnPaiement' => [], - 'TypeRessource' => [], + 'TypeRessource' => [], ], ], 'rule_providers' => [ @@ -182,7 +199,7 @@ return [ [ 'privileges' => Privileges::MISE_EN_PAIEMENT_DEMANDE, 'resources' => 'MiseEnPaiement', - 'assertion' => 'MiseEnPaiementAssertion', + 'assertion' => 'assertionPaiement', ], ], ], @@ -196,7 +213,7 @@ return [ 'ApplicationTypeHeures' => Service\TypeHeures::class, 'ApplicationCentreCout' => Service\CentreCout::class, 'ApplicationCentreCoutEp' => Service\CentreCoutEp::class, - 'MiseEnPaiementAssertion' => Assertion\MiseEnPaiementAssertion::class, + 'assertionPaiement' => Assertion\PaiementAssertion::class, ], ], 'view_helpers' => [ diff --git a/module/Application/config/recherche.config.php b/module/Application/config/recherche.config.php index 62c7bed6f4386bc75ddf049686415e69fc6a8fce..593bc3735fd215297bd87329c325e6404749f392 100644 --- a/module/Application/config/recherche.config.php +++ b/module/Application/config/recherche.config.php @@ -11,8 +11,6 @@ return [ 'route' => '/recherche/:action', 'constraints' => [ 'action' => '[a-zA-Z][a-zA-Z0-9_-]*', - 'typeIntervenant' => '[0-9]*', - 'structure' => '[0-9]*', ], 'defaults' => [ 'controller' => 'Application\Controller\Recherche', diff --git a/module/Application/config/service.config.php b/module/Application/config/service.config.php index a048f040e18b8af1a061de2c2c55d41fe291b4d0..16849389571c498523c8d7270355e8b7ed6ae27e 100644 --- a/module/Application/config/service.config.php +++ b/module/Application/config/service.config.php @@ -22,7 +22,7 @@ return [ 'may_terminate' => true, 'child_routes' => [ 'resume' => [ - 'type' => 'Segment', + 'type' => 'Literal', 'options' => [ 'route' => '/resume', 'defaults' => [ @@ -40,7 +40,7 @@ return [ ], ], 'resume-refresh' => [ - 'type' => 'Segment', + 'type' => 'Literal', 'options' => [ 'route' => '/resume-refresh', 'defaults' => [ @@ -74,25 +74,26 @@ return [ ], ], ], + 'supprimer' => [ + 'type' => 'Segment', + 'options' => [ + 'route' => '/supprimer/:service', + 'constraints' => [ + 'service' => '[0-9]*', + ], + 'defaults' => [ + 'action' => 'supprimer', + ], + ], + ], 'recherche' => [ - 'type' => 'Segment', - 'options' => [ + 'type' => 'Literal', + 'options' => [ 'route' => '/recherche', 'defaults' => [ 'action' => 'recherche', ], ], - 'child_routes' => [ - 'default' => [ - 'type' => 'Segment', - 'options' => [ - 'route' => '/', - 'defaults' => [ - 'action' => 'recherche', - ], - ], - ], - ], ], 'rafraichir-ligne' => [ 'type' => 'Segment', @@ -106,18 +107,6 @@ return [ ], ], ], - 'intervenant' => [ - 'type' => 'Segment', - 'options' => [ - 'route' => '/intervenant/:intervenant', - 'constraints' => [ - 'intervenant' => '[0-9]*', - ], - 'defaults' => [ - 'action' => 'index', - ], - ], - ], 'saisie' => [ 'type' => 'Segment', 'options' => [ @@ -139,7 +128,19 @@ return [ ], ], ], - 'default' => [ + 'volumes-horaires-refresh' => [ + 'type' => 'Segment', + 'options' => [ + 'route' => '/volumes-horaires-refresh[/:id]', + 'constraints' => [ + 'id' => '[0-9]*', + ], + 'defaults' => [ + 'action' => 'volumes-horaires-refresh', + ], + ], + ], + /*'default' => [ 'type' => 'Segment', 'options' => [ 'route' => '/:action[/:id]', @@ -151,7 +152,7 @@ return [ 'id' => '[0-9]*', ], ], - ], + ],*/ 'initialisation' => [ 'type' => 'Segment', 'options' => [ @@ -177,7 +178,7 @@ return [ ], 'may_terminate' => false, 'child_routes' => [ - 'saisie' => [ + 'saisie' => [ 'type' => 'Segment', 'options' => [ 'route' => '/saisie[/:id]', @@ -189,7 +190,7 @@ return [ ], ], ], - 'rafraichir-ligne' => [ + 'rafraichir-ligne' => [ 'type' => 'Segment', 'options' => [ 'route' => '/rafraichir-ligne/:serviceReferentiel', @@ -201,7 +202,7 @@ return [ ], ], ], - 'constatation' => [ + 'constatation' => [ 'type' => 'Segment', 'options' => [ 'route' => '/constatation', @@ -210,20 +211,7 @@ return [ ], ], ], - 'default' => [ - 'type' => 'Segment', - 'options' => [ - 'route' => '/:action[/:id]', - 'constraints' => [ - 'action' => '[a-zA-Z][a-zA-Z0-9_-]*', - 'id' => '[0-9]*', - ], - 'defaults' => [ - 'action' => 'index', - ], - ], - ], - 'initialisation' => [ + 'initialisation' => [ 'type' => 'Segment', 'options' => [ 'route' => '/initialisation/:intervenant', @@ -255,14 +243,31 @@ return [ ], 'bjyauthorize' => [ 'guards' => [ - PrivilegeController::class => [ + PrivilegeController::class => [ /* Enseignements */ + [ + 'controller' => 'Application\Controller\Service', + 'action' => ['index'], + 'privileges' => [ + Privileges::ENSEIGNEMENT_VISUALISATION, + ], + 'assertion' => 'assertionService', + ], + [ + 'controller' => 'Application\Controller\Service', + 'action' => ['saisie', 'suppression', 'rafraichir-ligne', 'volumes-horaires-refresh', 'initialisation', 'constatation', 'horodatage'], + 'privileges' => [ + Privileges::ENSEIGNEMENT_EDITION, + ], + 'assertion' => 'assertionService', + ], [ 'controller' => 'Application\Controller\Service', 'action' => ['validation'], 'privileges' => [ Privileges::ENSEIGNEMENT_VISUALISATION, ], + 'assertion' => 'assertionService', ], [ 'controller' => 'Application\Controller\Service', @@ -278,14 +283,38 @@ return [ Privileges::ENSEIGNEMENT_DEVALIDATION, ], ], + [ + 'controller' => 'Application\Controller\Service', + 'action' => ['export'], + 'privileges' => [ + Privileges::ENSEIGNEMENT_EXPORT_CSV, + ], + ], /* Référentiel */ + [ + 'controller' => 'Application\Controller\ServiceReferentiel', + 'action' => ['index'], + 'privileges' => [ + Privileges::REFERENTIEL_VISUALISATION, + ], + 'assertion' => 'assertionService', + ], + [ + 'controller' => 'Application\Controller\ServiceReferentiel', + 'action' => ['saisie', 'suppression', 'rafraichir-ligne', 'initialisation', 'constatation'], + 'privileges' => [ + Privileges::REFERENTIEL_EDITION, + ], + 'assertion' => 'assertionService', + ], [ 'controller' => 'Application\Controller\ServiceReferentiel', 'action' => ['validation'], 'privileges' => [ Privileges::REFERENTIEL_VISUALISATION, ], + 'assertion' => 'assertionService', ], [ 'controller' => 'Application\Controller\ServiceReferentiel', @@ -301,30 +330,39 @@ return [ Privileges::REFERENTIEL_DEVALIDATION, ], ], + + /* Commun */ + [ + 'controller' => 'Application\Controller\Service', + 'action' => ['resume-refresh'], + 'privileges' => [ + Privileges::ENSEIGNEMENT_EDITION, + Privileges::REFERENTIEL_EDITION, + ], + ], + [ + 'controller' => 'Application\Controller\Service', + 'action' => ['resume', 'recherche'], + 'privileges' => [ + Privileges::ENSEIGNEMENT_VISUALISATION, + Privileges::REFERENTIEL_VISUALISATION, + ], + 'assertion' => 'assertionService', + ], ], 'BjyAuthorize\Guard\Controller' => [ [ 'controller' => 'Application\Controller\Service', - 'action' => ['index', 'export', 'saisie', 'suppression', 'rafraichir-ligne', 'volumes-horaires-refresh', 'initialisation', 'constatation', 'cloturer-saisie', 'horodatage'], + 'action' => ['cloturer-saisie'], 'roles' => ['user'], 'assertion' => 'assertionService', - ], [ - 'controller' => 'Application\Controller\Service', - 'action' => ['resume', 'resume-refresh', 'recherche'], - 'roles' => [R_ADMINISTRATEUR, R_COMPOSANTE, R_ETABLISSEMENT], - ], [ - 'controller' => 'Application\Controller\ServiceReferentiel', - 'action' => ['index', 'saisie', 'suppression', 'rafraichir-ligne', 'initialisation', 'constatation'], - 'roles' => ['user'], ], ], ], 'resource_providers' => [ - 'BjyAuthorize\Provider\Resource\Config' => [ + \BjyAuthorize\Provider\Resource\Config::class => [ 'Service' => [], 'ServiceReferentiel' => [], - 'ServiceListView' => [], - 'ServiceController' => [], ], ], 'rule_providers' => [ @@ -332,8 +370,11 @@ return [ 'allow' => [ /* Enseignements */ [ - 'privileges' => Privileges::ENSEIGNEMENT_VISUALISATION, - 'resources' => 'Service', + 'privileges' => [ + Privileges::ENSEIGNEMENT_VISUALISATION, + Privileges::ENSEIGNEMENT_EDITION, + ], + 'resources' => ['Service', 'Intervenant'], 'assertion' => 'assertionService', ], [ @@ -346,45 +387,40 @@ return [ 'resources' => 'Validation', 'assertion' => 'assertionService', ], - - /* Référentiel */ [ - 'privileges' => Privileges::REFERENTIEL_VALIDATION, - 'resources' => 'Validation', + 'privileges' => [ + Privileges::ENSEIGNEMENT_EXTERIEUR, + ], + 'resources' => ['Intervenant', 'Service'], 'assertion' => 'assertionService', ], [ - 'privileges' => Privileges::REFERENTIEL_DEVALIDATION, - 'resources' => 'Validation', + 'privileges' => [ + Privileges::MOTIF_NON_PAIEMENT_VISUALISATION, + Privileges::MOTIF_NON_PAIEMENT_EDITION, + ], + 'resources' => 'Intervenant', 'assertion' => 'assertionService', ], - ], - ], - 'BjyAuthorize\Provider\Rule\Config' => [ - 'allow' => [ - [ - ['user'], - 'Service', - ['create', 'read', 'delete', 'update'], - 'ServiceAssertion', - ], + + /* Référentiel */ [ - [R_COMPOSANTE], - 'ServiceListView', - ['info-only-structure'], - 'ServiceAssertion', + 'privileges' => [ + Privileges::REFERENTIEL_VISUALISATION, + Privileges::REFERENTIEL_EDITION, + ], + 'resources' => 'ServiceReferentiel', + 'assertion' => 'assertionService', ], [ - [R_INTERVENANT], - 'ServiceListView', - ['aide-intervenant'], - 'ServiceAssertion', + 'privileges' => Privileges::REFERENTIEL_VALIDATION, + 'resources' => 'Validation', + 'assertion' => 'assertionService', ], [ - [R_INTERVENANT, R_COMPOSANTE, R_ADMINISTRATEUR], - 'ServiceReferentiel', - ['create', 'read', 'delete', 'update'], - 'ServiceReferentielAssertion', + 'privileges' => Privileges::REFERENTIEL_DEVALIDATION, + 'resources' => 'Validation', + 'assertion' => 'assertionService', ], ], ], @@ -410,6 +446,7 @@ return [ 'ServiceAssertion' => Assertion\ServiceAssertionOld::class, 'assertionService' => Assertion\ServiceAssertion::class, 'ServiceReferentielAssertion' => Assertion\ServiceReferentielAssertion::class, + 'processusService' => Processus\ServiceProcessus::class, ], ], 'hydrators' => [ diff --git a/module/Application/config/validation.config.php b/module/Application/config/validation.config.php index 2ee15d56530ca3b4769ccaa8fd80490584e7e3a5..68a2e1fc5dd3f36eb9cbd61a11a34af9b590270e 100644 --- a/module/Application/config/validation.config.php +++ b/module/Application/config/validation.config.php @@ -2,6 +2,7 @@ namespace Application; +use Application\Entity\Db\WfEtape; use UnicaenAuth\Guard\PrivilegeController; return [ @@ -147,44 +148,48 @@ return [ 'intervenant' => [ 'pages' => [ 'validation-service-prevu' => [ - 'label' => "Validation des enseignements prévisionnels", - 'title' => "Validation des enseignements prévisionnels de l'intervenant", - 'route' => 'intervenant/validation/service/prevu', - 'paramsInject' => [ + 'label' => "Validation des enseignements prévisionnels", + 'title' => "Validation des enseignements prévisionnels de l'intervenant", + 'route' => 'intervenant/validation/service/prevu', + 'paramsInject' => [ 'intervenant', ], - 'withtarget' => true, - 'resource' => PrivilegeController::getResourceId('Application\Controller\Service', 'validation'), + 'workflow-etape-code' => WfEtape::CODE_SERVICE_VALIDATION, + 'withtarget' => true, + 'visible' => 'assertionService', ], 'validation-referentiel-prevu' => [ - 'label' => "Validation du référentiel prévisionnel", - 'title' => "Validation du référentiel prévisionnel de l'intervenant", - 'route' => 'intervenant/validation/referentiel/prevu', - 'paramsInject' => [ + 'label' => "Validation du référentiel prévisionnel", + 'title' => "Validation du référentiel prévisionnel de l'intervenant", + 'route' => 'intervenant/validation/referentiel/prevu', + 'paramsInject' => [ 'intervenant', ], - 'withtarget' => true, - 'resource' => PrivilegeController::getResourceId('Application\Controller\ServiceReferentiel', 'validation'), + 'workflow-etape-code' => WfEtape::CODE_REFERENTIEL_VALIDATION, + 'withtarget' => true, + 'visible' => 'assertionService', ], 'validation-service-realise' => [ - 'label' => "Validation des enseignements réalisés", - 'title' => "Validation des enseignements réalisés de l'intervenant", - 'route' => 'intervenant/validation/service/realise', - 'paramsInject' => [ + 'label' => "Validation des enseignements réalisés", + 'title' => "Validation des enseignements réalisés de l'intervenant", + 'route' => 'intervenant/validation/service/realise', + 'paramsInject' => [ 'intervenant', ], - 'withtarget' => true, - 'resource' => PrivilegeController::getResourceId('Application\Controller\Service', 'validation'), + 'workflow-etape-code' => WfEtape::CODE_SERVICE_VALIDATION_REALISE, + 'withtarget' => true, + 'visible' => 'assertionService', ], 'validation-referentiel-realise' => [ - 'label' => "Validation du référentiel réalisé", - 'title' => "Validation du référentiel réalisé de l'intervenant", - 'route' => 'intervenant/validation/referentiel/realise', - 'paramsInject' => [ + 'label' => "Validation du référentiel réalisé", + 'title' => "Validation du référentiel réalisé de l'intervenant", + 'route' => 'intervenant/validation/referentiel/realise', + 'paramsInject' => [ 'intervenant', ], - 'withtarget' => true, - 'resource' => PrivilegeController::getResourceId('Application\Controller\ServiceReferentiel', 'validation'), + 'workflow-etape-code' => WfEtape::CODE_REFERENTIEL_VALIDATION_REALISE, + 'withtarget' => true, + 'visible' => 'assertionService', ], ], ], diff --git a/module/Application/config/volume-horaire.config.php b/module/Application/config/volume-horaire.config.php index 2184c9e6d32551eacfc8f995b9bd956b2f73a02d..4396619357cd3a7fd29ddd21f17a1b6240f1f7d0 100644 --- a/module/Application/config/volume-horaire.config.php +++ b/module/Application/config/volume-horaire.config.php @@ -2,81 +2,71 @@ namespace Application; +use Application\Provider\Privilege\Privileges; +use UnicaenAuth\Guard\PrivilegeController; + return [ - 'router' => [ + 'router' => [ 'routes' => [ - 'volume-horaire' => [ - 'type' => 'Literal', - 'options' => [ - 'route' => '/volume-horaire', + 'volume-horaire' => [ + 'type' => 'Literal', + 'options' => [ + 'route' => '/volume-horaire', 'defaults' => [ - '__NAMESPACE__' => 'Application\Controller', + '__NAMESPACE__' => 'Application\Controller', 'controller' => 'VolumeHoraire', 'action' => 'index', ], ], 'may_terminate' => true, - 'child_routes' => [ - 'default' => [ + 'child_routes' => [ + 'liste' => [ 'type' => 'Segment', 'options' => [ - 'route' => '/:action[/:id]', + 'route' => '/liste[/:service]', 'constraints' => [ - 'action' => '[a-zA-Z][a-zA-Z0-9_-]*', - 'id' => '[0-9]*', + 'service' => '[0-9]*', ], - 'defaults' => [ - 'action' => 'index', + 'defaults' => [ + 'action' => 'liste', ], ], ], 'saisie' => [ 'type' => 'Segment', 'options' => [ - 'route' => '/saisie/:service', + 'route' => '/saisie/:service', 'constraints' => [ 'service' => '[0-9]*', ], - 'defaults' => [ + 'defaults' => [ 'action' => 'saisie', ], ], ], - 'modifier' => [ - 'type' => 'Segment', - 'options' => [ - 'route' => '/modifier/:id', - 'constraints' => [ - 'id' => '[0-9]*', - ], - 'defaults' => [ - 'action' => 'modifier', - ], - ], - ], ], ], 'volume-horaire-referentiel' => [ - 'type' => 'Literal', - 'options' => [ - 'route' => '/volume-horaire-referentiel', + 'type' => 'Literal', + 'options' => [ + 'route' => '/volume-horaire-referentiel', 'defaults' => [ - '__NAMESPACE__' => 'Application\Controller', + '__NAMESPACE__' => 'Application\Controller', 'controller' => 'VolumeHoraireReferentiel', 'action' => 'index', ], ], 'may_terminate' => true, - 'child_routes' => [ - 'default' => [ + 'child_routes' => [ + 'liste' => [ 'type' => 'Segment', 'options' => [ - 'route' => '/:action[/:id]', + 'route' => '/liste[/:id]', 'constraints' => [ 'action' => '[a-zA-Z][a-zA-Z0-9_-]*', 'id' => '[0-9]*', ], - 'defaults' => [ + 'defaults' => [ 'action' => 'index', ], ], @@ -84,48 +74,51 @@ return [ 'saisie' => [ 'type' => 'Segment', 'options' => [ - 'route' => '/saisie/:serviceReferentiel', + 'route' => '/saisie/:serviceReferentiel', 'constraints' => [ 'serviceReferentiel' => '[0-9]*', ], - 'defaults' => [ + 'defaults' => [ 'action' => 'saisie', ], ], ], - 'modifier' => [ - 'type' => 'Segment', - 'options' => [ - 'route' => '/modifier/:id', - 'constraints' => [ - 'id' => '[0-9]*', - ], - 'defaults' => [ - 'action' => 'modifier', - ], - ], - ], ], ], ], ], - 'bjyauthorize' => [ + 'bjyauthorize' => [ 'guards' => [ - 'BjyAuthorize\Guard\Controller' => [ + PrivilegeController::class => [ + /* Enseignements */ [ 'controller' => 'Application\Controller\VolumeHoraire', - 'action' => ['liste', 'saisie'], - 'roles' => [R_INTERVENANT, R_COMPOSANTE, R_ADMINISTRATEUR] + 'action' => ['liste'], + 'privileges' => Privileges::ENSEIGNEMENT_VISUALISATION, + ], + [ + 'controller' => 'Application\Controller\VolumeHoraire', + 'action' => ['saisie'], + 'privileges' => Privileges::ENSEIGNEMENT_EDITION, + 'assertion' => 'assertionService', + ], + + /* Référentiel */ + [ + 'controller' => 'Application\Controller\VolumeHoraireReferentiel', + 'action' => ['liste'], + 'privileges' => Privileges::REFERENTIEL_VISUALISATION, ], [ 'controller' => 'Application\Controller\VolumeHoraireReferentiel', - 'action' => ['liste', 'saisie'], - 'roles' => [R_INTERVENANT, R_COMPOSANTE, R_ADMINISTRATEUR] + 'action' => ['saisie'], + 'privileges' => Privileges::REFERENTIEL_EDITION, + 'assertion' => 'assertionService', ], ], ], ], - 'controllers' => [ + 'controllers' => [ 'invokables' => [ 'Application\Controller\VolumeHoraire' => Controller\VolumeHoraireController::class, 'Application\Controller\VolumeHoraireReferentiel' => Controller\VolumeHoraireReferentielController::class, @@ -133,20 +126,20 @@ return [ ], 'service_manager' => [ 'invokables' => [ - 'ApplicationVolumeHoraire' => Service\VolumeHoraire::class, - 'ApplicationVolumeHoraireReferentiel' => Service\VolumeHoraireReferentiel::class, - 'ApplicationTypeVolumeHoraire' => Service\TypeVolumeHoraire::class, - 'ApplicationEtatVolumeHoraire' => Service\EtatVolumeHoraire::class, - 'FormVolumeHoraireSaisieMultipleHydrator' => Form\VolumeHoraire\SaisieMultipleHydrator::class, - ] + 'ApplicationVolumeHoraire' => Service\VolumeHoraire::class, + 'ApplicationVolumeHoraireReferentiel' => Service\VolumeHoraireReferentiel::class, + 'ApplicationTypeVolumeHoraire' => Service\TypeVolumeHoraire::class, + 'ApplicationEtatVolumeHoraire' => Service\EtatVolumeHoraire::class, + 'FormVolumeHoraireSaisieMultipleHydrator' => Form\VolumeHoraire\SaisieMultipleHydrator::class, + ], ], - 'view_helpers' => [ + 'view_helpers' => [ 'invokables' => [ - 'volumeHoraireListe' => View\Helper\VolumeHoraire\Liste::class, - 'volumeHoraireReferentielListe' => View\Helper\VolumeHoraireReferentiel\Liste::class, + 'volumeHoraireListe' => View\Helper\VolumeHoraire\Liste::class, + 'volumeHoraireReferentielListe' => View\Helper\VolumeHoraireReferentiel\Liste::class, ], ], - 'form_elements' => [ + 'form_elements' => [ 'invokables' => [ 'VolumeHoraireSaisie' => Form\VolumeHoraire\Saisie::class, 'VolumeHoraireSaisieMultipleFieldset' => Form\VolumeHoraire\SaisieMultipleFieldset::class, // Nécessite plusieurs instances diff --git a/module/Application/config/workflow.config.php b/module/Application/config/workflow.config.php index 3adff7af6edc5e96f990f45b0d4bd5a2548180ae..84c572a7a84d44c03ae64fbf5b3d8427b696a6b7 100644 --- a/module/Application/config/workflow.config.php +++ b/module/Application/config/workflow.config.php @@ -66,6 +66,19 @@ return [ ], ], ], + 'feuille-de-route-btn-next' => [ + 'type' => 'Segment', + 'options' => [ + 'route' => '/feuille-de-route-btn-next/:wfEtapeCode/:intervenant', + 'defaults' => [ + 'action' => 'feuilleDeRouteBtnNext', + ], + 'constraints' => [ + 'wfEtapeCode' => '[a-zA-Z0-9_-]*', + 'intervenant' => '[0-9]*', + ], + ], + ], ], ], ], @@ -101,6 +114,11 @@ return [ 'bjyauthorize' => [ 'guards' => [ PrivilegeController::class => [ + [ + 'controller' => 'Application\Controller\Workflow', + 'action' => ['feuilleDeRouteBtnNext'], + 'privileges' => [Privileges::ENSEIGNEMENT_EDITION, Privileges::REFERENTIEL_EDITION], + ], [ 'controller' => 'Application\Controller\Workflow', 'action' => ['index', 'dependances'], diff --git a/module/Application/src/Application/Assertion/InformationAssertion.php b/module/Application/src/Application/Assertion/InformationAssertion.php new file mode 100755 index 0000000000000000000000000000000000000000..ed98b51ff031614fea6f16597380b7437b61c2da --- /dev/null +++ b/module/Application/src/Application/Assertion/InformationAssertion.php @@ -0,0 +1,47 @@ +<?php + +namespace Application\Assertion; + +use Application\Acl\Role; +use Application\Provider\Privilege\Privileges; +use UnicaenAuth\Assertion\AbstractAssertion; +use Zend\Permissions\Acl\Resource\ResourceInterface; + + +/** + * Description of InformationAssertion + * + * @author LECLUSE Laurent <laurent.lecluse at unicaen.fr> + */ +class InformationAssertion extends AbstractAssertion +{ + const INFO_ONLY_STRUCTURE = 'info-only-structure'; + const AIDE_INTERVENANT = 'aide-intervenant'; + + /** + * @param ResourceInterface $resource + * @param string $privilege + * + * @return boolean + */ + protected function assertOther(ResourceInterface $resource = null, $privilege = null) + { + $role = $this->getRole(); + + // Si le rôle n'est pas renseigné alors on s'en va... + if (!$role instanceof Role) return false; + + + switch($privilege){ + case self::INFO_ONLY_STRUCTURE: + return (boolean)$role->getStructure(); + break; + case self::AIDE_INTERVENANT: + return (boolean)$role->getIntervenant(); + break; + } + + return true; + } + +} \ No newline at end of file diff --git a/module/Application/src/Application/Assertion/IntervenantAssertion.php b/module/Application/src/Application/Assertion/IntervenantAssertion.php index 9b006d5a8ddd25e1bef2de73a70276d60f322a4b..2ecc19fd7a19b55a12876c48d3737c6d8165001f 100644 --- a/module/Application/src/Application/Assertion/IntervenantAssertion.php +++ b/module/Application/src/Application/Assertion/IntervenantAssertion.php @@ -6,6 +6,7 @@ use Application\Entity\Db\Intervenant; use Application\Entity\Db\Role; use Application\Entity\Db\WfEtape; use Application\Provider\Privilege\Privileges; +use Application\Service\Traits\WorkflowServiceAwareTrait; use UnicaenAuth\Assertion\AbstractAssertion; use Zend\Permissions\Acl\Resource\ResourceInterface; @@ -17,6 +18,16 @@ use Zend\Permissions\Acl\Resource\ResourceInterface; */ class IntervenantAssertion extends AbstractAssertion { + use WorkflowServiceAwareTrait; + + /* ---- Routage général ---- */ + public function __invoke(array $page) // gestion des visibilités de menus + { + return $this->assertPage($page); + } + + + /** * @param ResourceInterface $entity * @param string $privilege @@ -53,7 +64,7 @@ class IntervenantAssertion extends AbstractAssertion // Si le rôle n'est pas renseigné alors on s'en va... if (!$role instanceof Role) return false; // pareil si le rôle ne possède pas le privilège adéquat - if ($privilege && !$role->hasPrivilege($privilege)) return false; + //if ($privilege && !$role->hasPrivilege($privilege)) return false; $intervenant = $this->getMvcEvent()->getParam('intervenant'); /* @var $intervenant Intervenant */ @@ -69,6 +80,22 @@ class IntervenantAssertion extends AbstractAssertion + protected function assertPage(array $page) + { + if (isset($page['workflow-etape-code'])) { + $etape = $page['workflow-etape-code']; + $intervenant = $this->getMvcEvent()->getParam('intervenant'); + + if (!$this->assertEtapeAtteignable($etape, $intervenant)) { + return false; + } + } + + return true; + } + + + protected function assertClotureSaisie( Intervenant $intervenant=null ) { if (!$intervenant) return false; diff --git a/module/Application/src/Application/Assertion/MiseEnPaiementAssertion.php b/module/Application/src/Application/Assertion/MiseEnPaiementAssertion.php deleted file mode 100644 index fcf47c95864d284c946c4ae011ad7a039214bbe8..0000000000000000000000000000000000000000 --- a/module/Application/src/Application/Assertion/MiseEnPaiementAssertion.php +++ /dev/null @@ -1,157 +0,0 @@ -<?php - -namespace Application\Assertion; - -use Application\Entity\Db\ServiceAPayerInterface; -use Application\Entity\Db\MiseEnPaiement; -use Application\Provider\Privilege\Privileges; -use Zend\Permissions\Acl\Acl; -use Application\Acl\Role; -use Zend\Permissions\Acl\Role\RoleInterface; -use Zend\Permissions\Acl\Resource\ResourceInterface; -use Doctrine\ORM\Query\Expr\Join; - -/** - * Description of MiseEnPaiementAssertion - * - * @author Laurent LÉCLUSE <laurent.lecluse at unicaen.fr> - */ -class MiseEnPaiementAssertion extends OldAbstractAssertion -{ - use \Application\Service\Traits\TypeValidationAwareTrait; - use \Application\Service\Traits\ValidationAwareTrait; - use \Application\Service\Traits\ServiceAwareTrait; - use \Application\Service\Traits\ServiceReferentielAwareTrait; - use \Application\Service\Traits\TypeVolumeHoraireAwareTrait; - - use \UnicaenApp\Service\MessageCollectorAwareTrait; - - protected function assertEntity(Acl $acl, RoleInterface $role = null, ResourceInterface $entity = null, $privilege = null) - { - if (! $role instanceof Role) return false; - - if ($entity instanceof MiseEnPaiement){ - switch ($privilege){ - case Privileges::MISE_EN_PAIEMENT_DEMANDE: - return $this->assertMiseEnPaiementDemande($role, $entity); - } - }else if ($entity instanceof ServiceAPayerInterface){ - switch ($privilege){ - case Privileges::MISE_EN_PAIEMENT_DEMANDE: - return $this->assertServiceAPayerDemande( $role, $entity ); - } - } - return true; - } - - protected function assertMiseEnPaiementDemande( Role $role, MiseEnPaiement $miseEnPaiement ) - { - if (! $this->checkClotureRealise($miseEnPaiement)) { - return false; - } - if (! $this->checkValidationRealise($miseEnPaiement)) { - return false; - } - - if ($miseEnPaiement->getValidation()){ - return false; // pas de nouvelle demande si la mise en paiement est déjà validée - } - - if ($serviceAPayer = $miseEnPaiement->getServiceAPayer()){ - return $this->assertServiceAPayerDemande( $role, $serviceAPayer ); - }else{ - return true; // pas assez d'éléments pour statuer - } - } - - protected function assertServiceAPayerDemande( Role $role, ServiceAPayerInterface $serviceAPayer ) - { - $oriStructure = $role->getStructure(); - $destStructure = $serviceAPayer->getStructure(); - - if (empty($oriStructure) || empty($destStructure)){ - return true; // pas essez d'éléments pour statuer - }else{ - return $oriStructure === $destStructure; - } - } - - /** - * Pour les permanents, pas de demande de MEP possible sans clôture du service réalisé. - * - * @param MiseEnPaiement $miseEnPaiement - * @return boolean - */ - private function checkClotureRealise(MiseEnPaiement $miseEnPaiement) - { - $intervenant = $miseEnPaiement->getServiceAPayer()->getIntervenant(); - - // la clôture de la saisie du réalisé n'a pas de sens pour un vacataire - if (! $intervenant->estPermanent()) { - return true; - } - - $cloture = $this->getServiceValidation()->findValidationClotureServices($intervenant, null); - - // la clôture de la saisie du réalisé doit être faite - if (! $cloture) { - $this->getServiceMessageCollector()->addMessage("La demande de mise en paiement est impossible tant que la saisie des enseignements et référentiel réalisés n'est pas clôturée.", 'danger'); - return false; - } - - return true; - } - - /** - * Pour les permanents, pas de demande de MEP possible si le moindre - * enseignement ou référentiel réalisé n'est pas validé. - * - * @param MiseEnPaiement $miseEnPaiement - * @return boolean - */ - private function checkValidationRealise(MiseEnPaiement $miseEnPaiement) - { - $intervenant = $miseEnPaiement->getServiceAPayer()->getIntervenant(); - - // on ne s'intéresse pas aux vacataires - if (! $intervenant->estPermanent()) { - return true; -} - - $tvhRealise = $this->getServiceTypeVolumeHoraire()->getRealise(); - - /** - * Recherche d'enseignement non validé. - */ - $alias = $this->getServiceService()->getAlias(); - $qb = $this->getServiceService()->finderByIntervenant($intervenant); - $this->getServiceService()->finderByTypeVolumeHoraire($tvhRealise, $qb); - $qb - ->select("COUNT($alias)") - ->leftJoin("vh.validation", "val", Join::WITH, "1 = compriseEntre(val.histoCreation, val.histoDestruction)") - ->andWhere("vh.validation IS EMPTY"); - $count = (int) $qb->getQuery()->getSingleScalarResult(); - if ($count) { - $this->getServiceMessageCollector()->addMessage("La demande de mise en paiement est impossible tant qu'il existe des enseignements réalisés non validés.", 'danger'); - return false; - } - - /** - * Recherche de référentiel non validé. - */ - $alias = $this->getServiceServiceReferentiel()->getAlias(); - $qb = $this->getServiceServiceReferentiel()->finderByIntervenant($intervenant); - $this->getServiceServiceReferentiel()->finderByTypeVolumeHoraire($tvhRealise, $qb); - $qb - ->select("COUNT($alias)") - ->leftJoin("vhr.validation", "val", Join::WITH, "1 = compriseEntre(val.histoCreation, val.histoDestruction)") - ->andWhere("vhr.validation IS EMPTY"); - $count = (int) $qb->getQuery()->getSingleScalarResult(); - if ($count) { - $this->getServiceMessageCollector()->addMessage("La demande de mise en paiement est impossible tant qu'il existe du référentiel réalisé non validé.", 'danger'); - return false; - } - - return true; - } -} \ No newline at end of file diff --git a/module/Application/src/Application/Assertion/ModificationServiceDuAssertion.php b/module/Application/src/Application/Assertion/ModificationServiceDuAssertion.php index fa8446edd7eb9809e60ee6ced11c62663f52a61b..7822803e68a919347d25596e1e545c4658adccab 100644 --- a/module/Application/src/Application/Assertion/ModificationServiceDuAssertion.php +++ b/module/Application/src/Application/Assertion/ModificationServiceDuAssertion.php @@ -39,7 +39,7 @@ class ModificationServiceDuAssertion extends OldAbstractAssertion $intervenant = $this->getMvcEvent()->getParam('intervenant'); if ($intervenant){ return $this->assertIntervenant($intervenant); - } + } } parent::assertController($acl, $role, $controller, $action, $privilege); } diff --git a/module/Application/src/Application/Assertion/OffreDeFormationAssertion.php b/module/Application/src/Application/Assertion/OffreDeFormationAssertion.php index 6a5d0450b932e592a26306c4af5f35eb34ff6568..80ffc072635a2afdea52e7c330d5f403806a7105 100644 --- a/module/Application/src/Application/Assertion/OffreDeFormationAssertion.php +++ b/module/Application/src/Application/Assertion/OffreDeFormationAssertion.php @@ -7,7 +7,7 @@ use Application\Entity\Db\CentreCoutEp; use Application\Entity\Db\ElementModulateur; use Application\Entity\Db\ElementPedagogique; use Application\Entity\Db\Etape; -use Application\Entity\Db\Source; +use UnicaenImport\Entity\Db\Source; use Application\Entity\Db\Structure; use UnicaenAuth\Assertion\AbstractAssertion; use Application\Acl\Role; @@ -156,6 +156,6 @@ class OffreDeFormationAssertion extends AbstractAssertion protected function assertSourceSaisie(Source $source) { - return $source->isOse(); + return ! $source->getImportable(); } } \ No newline at end of file diff --git a/module/Application/src/Application/Assertion/PaiementAssertion.php b/module/Application/src/Application/Assertion/PaiementAssertion.php new file mode 100644 index 0000000000000000000000000000000000000000..9e2d15233a026c0ba1b76b37e3d9cdf880c73621 --- /dev/null +++ b/module/Application/src/Application/Assertion/PaiementAssertion.php @@ -0,0 +1,226 @@ +<?php + +namespace Application\Assertion; + +use Application\Entity\Db\Intervenant; +use Application\Entity\Db\ServiceAPayerInterface; +use Application\Entity\Db\MiseEnPaiement; +use Application\Provider\Privilege\Privileges; +use Application\Service\Traits\WorkflowServiceAwareTrait; +use UnicaenAuth\Assertion\AbstractAssertion; +use Application\Acl\Role; +use Zend\Permissions\Acl\Resource\ResourceInterface; +use Doctrine\ORM\Query\Expr\Join; +use Application\Service\Traits\TypeValidationAwareTrait; +use Application\Service\Traits\ValidationAwareTrait; +use Application\Service\Traits\ServiceAwareTrait; +use Application\Service\Traits\ServiceReferentielAwareTrait; +use Application\Service\Traits\TypeVolumeHoraireAwareTrait; + +/** + * Description of PaiementAssertion + * + * @author Laurent LÉCLUSE <laurent.lecluse at unicaen.fr> + */ +class PaiementAssertion extends AbstractAssertion +{ + use TypeValidationAwareTrait; + use ValidationAwareTrait; + use ServiceAwareTrait; + use ServiceReferentielAwareTrait; + use TypeVolumeHoraireAwareTrait; + use WorkflowServiceAwareTrait; + + use \UnicaenApp\Service\MessageCollectorAwareTrait; + + + /* ---- Routage général ---- */ + public function __invoke(array $page) // gestion des visibilités de menus + { + return $this->assertPage($page); + } + + + /** + * @param ResourceInterface $entity + * @param string $privilege + * + * @return boolean + */ + protected function assertEntity(ResourceInterface $entity, $privilege = null) + { + $role = $this->getRole(); + + // Si le rôle n'est pas renseigné alors on s'en va... + if (!$role instanceof Role) return false; + // pareil si le rôle ne possède pas le privilège adéquat + if ($privilege && !$role->hasPrivilege($privilege)) return false; + + // Si c'est bon alors on affine... + switch (true) { + case $entity instanceof MiseEnPaiement: + switch ($privilege) { + case Privileges::MISE_EN_PAIEMENT_DEMANDE: + return $this->assertMiseEnPaiementDemande($role, $entity); + } + break; + case $entity instanceof ServiceAPayerInterface: + switch ($privilege) { + case Privileges::MISE_EN_PAIEMENT_DEMANDE: + return $this->assertServiceAPayerDemande($role, $entity); + } + break; + } + + return true; + } + + + + protected function assertPage(array $page) + { + if (isset($page['workflow-etape-code'])) { + $etape = $page['workflow-etape-code']; + $intervenant = $this->getMvcEvent()->getParam('intervenant'); + + if (!$this->assertEtapeAtteignable($etape, $intervenant)) { + return false; + } + } + + return true; + } + + + + protected function assertMiseEnPaiementDemande(Role $role, MiseEnPaiement $miseEnPaiement) + { + if (! $this->asserts([ + $this->checkClotureRealise($miseEnPaiement), + $this->checkValidationRealise($miseEnPaiement), + !$miseEnPaiement->getValidation(), + ])) return false; + + if ($serviceAPayer = $miseEnPaiement->getServiceAPayer()) { + return $this->assertServiceAPayerDemande($role, $serviceAPayer); + } else { + return true; // pas assez d'éléments pour statuer + } + } + + + + protected function assertServiceAPayerDemande(Role $role, ServiceAPayerInterface $serviceAPayer) + { + $oriStructure = $role->getStructure(); + $destStructure = $serviceAPayer->getStructure(); + + if (empty($oriStructure) || empty($destStructure)) { + return true; // pas essez d'éléments pour statuer + } else { + return $oriStructure === $destStructure; + } + } + + + + /** + * Pour les permanents, pas de demande de MEP possible sans clôture du service réalisé. + * + * @param MiseEnPaiement $miseEnPaiement + * + * @return boolean + */ + private function checkClotureRealise(MiseEnPaiement $miseEnPaiement) + { + $intervenant = $miseEnPaiement->getServiceAPayer()->getIntervenant(); + + // la clôture de la saisie du réalisé n'a pas de sens pour un vacataire + if (!$intervenant->estPermanent()) { + return true; + } + + $cloture = $this->getServiceValidation()->findValidationClotureServices($intervenant, null); + + // la clôture de la saisie du réalisé doit être faite + if (!$cloture) { + $this->getServiceMessageCollector()->addMessage("La demande de mise en paiement est impossible tant que la saisie des enseignements et référentiel réalisés n'est pas clôturée.", 'danger'); + + return false; + } + + return true; + } + + + + /** + * Pour les permanents, pas de demande de MEP possible si le moindre + * enseignement ou référentiel réalisé n'est pas validé. + * + * @param MiseEnPaiement $miseEnPaiement + * + * @return boolean + */ + private function checkValidationRealise(MiseEnPaiement $miseEnPaiement) + { + $intervenant = $miseEnPaiement->getServiceAPayer()->getIntervenant(); + + // on ne s'intéresse pas aux vacataires + if (!$intervenant->estPermanent()) { + return true; + } + + $tvhRealise = $this->getServiceTypeVolumeHoraire()->getRealise(); + + /** + * Recherche d'enseignement non validé. + */ + $alias = $this->getServiceService()->getAlias(); + $qb = $this->getServiceService()->finderByIntervenant($intervenant); + $this->getServiceService()->finderByTypeVolumeHoraire($tvhRealise, $qb); + $qb + ->select("COUNT($alias)") + ->leftJoin("vh.validation", "val", Join::WITH, "1 = compriseEntre(val.histoCreation, val.histoDestruction)") + ->andWhere("vh.validation IS EMPTY"); + $count = (int)$qb->getQuery()->getSingleScalarResult(); + if ($count) { + $this->getServiceMessageCollector()->addMessage("La demande de mise en paiement est impossible tant qu'il existe des enseignements réalisés non validés.", 'danger'); + + return false; + } + + /** + * Recherche de référentiel non validé. + */ + $alias = $this->getServiceServiceReferentiel()->getAlias(); + $qb = $this->getServiceServiceReferentiel()->finderByIntervenant($intervenant); + $this->getServiceServiceReferentiel()->finderByTypeVolumeHoraire($tvhRealise, $qb); + $qb + ->select("COUNT($alias)") + ->leftJoin("vhr.validation", "val", Join::WITH, "1 = compriseEntre(val.histoCreation, val.histoDestruction)") + ->andWhere("vhr.validation IS EMPTY"); + $count = (int)$qb->getQuery()->getSingleScalarResult(); + if ($count) { + $this->getServiceMessageCollector()->addMessage("La demande de mise en paiement est impossible tant qu'il existe du référentiel réalisé non validé.", 'danger'); + + return false; + } + + return true; + } + + + + protected function assertEtapeAtteignable($etape, Intervenant $intervenant = null) + { + if ($intervenant) { + $workflowEtape = $this->getServiceWorkflow()->getEtape($etape, $intervenant); + if (!$workflowEtape || !$workflowEtape->isAtteignable()) { // l'étape doit être atteignable + return false; + } + } + + return true; + } +} \ No newline at end of file diff --git a/module/Application/src/Application/Assertion/ServiceAssertion.php b/module/Application/src/Application/Assertion/ServiceAssertion.php index 38436ddf09375dc599ee18f5d7bb4f80851a06f2..981781e4150af1627d8f8456ec81290619e1934c 100755 --- a/module/Application/src/Application/Assertion/ServiceAssertion.php +++ b/module/Application/src/Application/Assertion/ServiceAssertion.php @@ -6,8 +6,11 @@ use Application\Acl\Role; use Application\Entity\Db\Intervenant; use Application\Entity\Db\Service; use Application\Entity\Db\Structure; +use Application\Entity\Db\TypeVolumeHoraire; use Application\Entity\Db\Validation; +use Application\Entity\Db\WfEtape; use Application\Provider\Privilege\Privileges; +use Application\Service\Traits\ContextAwareTrait; use Application\Service\Traits\WorkflowServiceAwareTrait; use UnicaenAuth\Assertion\AbstractAssertion; use Zend\Permissions\Acl\Resource\ResourceInterface; @@ -21,6 +24,7 @@ use Zend\Permissions\Acl\Resource\ResourceInterface; class ServiceAssertion extends AbstractAssertion { use WorkflowServiceAwareTrait; + use ContextAwareTrait; @@ -32,6 +36,31 @@ class ServiceAssertion extends AbstractAssertion + protected function assertPage(array $page) + { + $intervenant = null; + if (isset($page['workflow-etape-code'])) { + $etape = $page['workflow-etape-code']; + $intervenant = $this->getMvcEvent()->getParam('intervenant'); + + if (!$this->assertEtapeAtteignable($etape, $intervenant)) { + return false; + } + } + + if ($intervenant && isset($page['route'])) { + switch ($page['route']) { + case 'intervenant/validation/service/prevu': + return $this->assertEntity($intervenant, Privileges::ENSEIGNEMENT_VISUALISATION); + break; + } + } + + return true; + } + + + /** * @param ResourceInterface $entity * @param string $privilege @@ -53,6 +82,24 @@ class ServiceAssertion extends AbstractAssertion switch ($privilege) { case Privileges::ENSEIGNEMENT_VISUALISATION: return $this->assertServiceVisualisation($role, $entity); + case Privileges::ENSEIGNEMENT_EDITION: + return $this->assertServiceEdition($role, $entity); + case Privileges::ENSEIGNEMENT_EXTERIEUR: + return $this->assertServiceExterieur($role, $entity); + } + break; + case $entity instanceof Intervenant: + switch ($privilege) { + case Privileges::ENSEIGNEMENT_VISUALISATION: + case Privileges::ENSEIGNEMENT_EDITION: + return $this->assertIntervenant($role, $entity); + + case Privileges::MOTIF_NON_PAIEMENT_VISUALISATION: + case Privileges::MOTIF_NON_PAIEMENT_EDITION: + return $this->assertMotifNonPaiement($role, $entity); + + case Privileges::ENSEIGNEMENT_EXTERIEUR: + return $this->assertIntervenantServiceExterieur($role, $entity); } break; case $entity instanceof Validation: @@ -81,48 +128,86 @@ class ServiceAssertion extends AbstractAssertion */ protected function assertController($controller, $action = null, $privilege = null) { - //$intervenant = $this->getMvcEvent()->getParam('intervenant'); + $role = $this->getRole(); + $intervenant = $this->getMvcEvent()->getParam('intervenant'); + /* @var $intervenant Intervenant */ + + // Si le rôle n'est pas renseigné alors on s'en va... + if (!$role instanceof Role) return false; + + if (!$this->assertIntervenant($role, $intervenant)) return false; // si on n'est pas le bon intervenant!! + +// var_dump($intervenant->__toString()); + switch ($controller . '.' . $action) { + case 'Application\Controller\Service.validation': + if (!$role->hasPrivilege(Privileges::ENSEIGNEMENT_VISUALISATION)) return false; + + break; + } return true; } - protected function assertPage(array $page) + protected function assertServiceVisualisation(Role $role, Service $service) { - if (isset($page['workflow-etape-code'])) { - $etape = $page['workflow-etape-code']; - $intervenant = $this->getMvcEvent()->getParam('intervenant'); + $wfEtape = $this->getWorkflowEtape($service->getTypeVolumeHoraire(), 'saisie'); - if (!$this->assertEtapeAtteignable($etape, $intervenant)){ - return false; + return $this->asserts([ + $this->assertIntervenant($role, $service->getIntervenant()), + $this->assertEtapeAtteignable($wfEtape, $service->getIntervenant()), + ]); + } + + + + protected function assertServiceEdition(Role $role, Service $service) + { + $structure = $role->getStructure(); + + $asserts = []; + + if ($structure) { + $structureAffectation = $service->getIntervenant() ? $service->getIntervenant()->getStructure() : null; + $structureEnseignement = $service->getElementPedagogique() ? $service->getElementPedagogique()->getStructure() : null; + + if ($structureAffectation && $structureEnseignement) { + // cas d'un intervenant d'une autre structure prenant un enseignement dans une autre structure + $asserts[] = $structure == $structureAffectation || $structure == $structureEnseignement; // le service doit avoir un lien avec la structure + } elseif ($structureAffectation && !$structureEnseignement) { + // cas d'un intervenant prenant des enseignements à l'extérieur + $asserts[] = $structure == $structureAffectation; } } - return true; + $asserts[] = $this->assertIntervenant($role, $service->getIntervenant()); + + if ($service->getEtablissement() != $this->getServiceContext()->getEtablissement()) { + $asserts[] = $this->assertServiceExterieur($role, $service); + } + + return $this->asserts($asserts); } - protected function assertServiceVisualisation(Role $role, Service $service) + protected function assertServiceVisualisationValidation(Role $role, Service $service) { - if (!$this->assertIntervenant($role, $service->getIntervenant())) { - return false; - } + $wfEtape = $this->getWorkflowEtape($service->getTypeVolumeHoraire(), 'validation-enseignement'); - if (!$this->assertEtapeAtteignable($service->getTypeVolumeHoraire(), $service->getIntervenant())) - { - return false; - } - return true; + return $this->asserts([ + $this->assertIntervenant($role, $service->getIntervenant()), + $this->assertEtapeAtteignable($wfEtape, $service->getIntervenant()), + ]); } - protected function assertServiceValidation( Role $role, Validation $validation ) + protected function assertServiceValidation(Role $role, Validation $validation) { return $this->asserts([ - ! $validation->getId(), + !$validation->getId(), $this->assertIntervenant($role, $validation->getIntervenant()), $this->assertStructure($role, $validation->getStructure()), ]); @@ -130,7 +215,7 @@ class ServiceAssertion extends AbstractAssertion - protected function assertServiceDevalidation( Role $role, Validation $validation ) + protected function assertServiceDevalidation(Role $role, Validation $validation) { return $this->asserts([ $validation->getId(), @@ -141,7 +226,37 @@ class ServiceAssertion extends AbstractAssertion - protected function assertIntervenant(Role $role, Intervenant $intervenant=null) + protected function assertServiceExterieur(Role $role, Service $service) + { + return $this->asserts([ + $this->assertIntervenantServiceExterieur($role, $service->getIntervenant()), + ]); + } + + + + protected function assertIntervenantServiceExterieur(Role $role, Intervenant $intervenant) + { + return $this->asserts([ + $intervenant->estPermanent(), + $role->hasPrivilege(Privileges::ENSEIGNEMENT_EXTERIEUR), + ]); + } + + + + protected function assertMotifNonPaiement(Role $role, Intervenant $intervenant) + { + // filtrer pour la structure ? ? + return $this->asserts([ + $intervenant->getStatut()->getPeutSaisirMotifNonPaiement(), + $this->assertIntervenant($role, $intervenant), + ]); + } + + + + protected function assertIntervenant(Role $role, Intervenant $intervenant = null) { if ($intervenant) { if ($ri = $role->getIntervenant()) { @@ -150,12 +265,13 @@ class ServiceAssertion extends AbstractAssertion } } } + return true; } - protected function assertStructure(Role $role, Structure $structure=null) + protected function assertStructure(Role $role, Structure $structure = null) { if ($structure) { if ($ri = $role->getStructure()) { @@ -164,10 +280,12 @@ class ServiceAssertion extends AbstractAssertion } } } + return true; } + protected function assertEtapeAtteignable($etape, Intervenant $intervenant = null) { if ($intervenant) { @@ -179,4 +297,21 @@ class ServiceAssertion extends AbstractAssertion return true; } + + + + private function getWorkflowEtape(TypeVolumeHoraire $typeVolumeHoraire, $action) + { + $key = $action . '-' . strtolower($typeVolumeHoraire->getCode()); + $etapes = [ + 'saisie-prevu' => WfEtape::CODE_SERVICE_SAISIE, + 'saisie-realise' => WfEtape::CODE_SERVICE_SAISIE_REALISE, + 'validation-enseignement-prevu' => WfEtape::CODE_SERVICE_VALIDATION, + 'validation-enseignement-realise' => WfEtape::CODE_SERVICE_VALIDATION_REALISE, + 'validation-referentiel-prevu' => WfEtape::CODE_REFERENTIEL_VALIDATION, + 'validation-referentiel-realise' => WfEtape::CODE_REFERENTIEL_VALIDATION_REALISE, + ]; + + return $etapes[$key]; + } } \ No newline at end of file diff --git a/module/Application/src/Application/Assertion/ServiceReferentielAssertion.php b/module/Application/src/Application/Assertion/ServiceReferentielAssertion.php index 9663204bdb25bc0a86432b6efbefce52a4ed5b7c..6f5626bb5a29780b8832ca2989bde8d42f1e98eb 100644 --- a/module/Application/src/Application/Assertion/ServiceReferentielAssertion.php +++ b/module/Application/src/Application/Assertion/ServiceReferentielAssertion.php @@ -9,7 +9,6 @@ use Application\Acl\IntervenantPermanentRole; use Application\Entity\Db\ServiceReferentiel; use Application\Entity\Db\TypeVolumeHoraire; use Application\Entity\Db\Structure; -use Application\Rule\Paiement\MiseEnPaiementExisteRule; use Zend\Permissions\Acl\Acl; use Zend\Permissions\Acl\Resource\ResourceInterface; use Zend\Permissions\Acl\Role\RoleInterface; diff --git a/module/Application/src/Application/Controller/AgrementController.php b/module/Application/src/Application/Controller/AgrementController.php index e58230fbb715948d9f1d083e3f94d6aa477c8d64..35f334a13a62308102caab7690b508e4be6db20a 100644 --- a/module/Application/src/Application/Controller/AgrementController.php +++ b/module/Application/src/Application/Controller/AgrementController.php @@ -106,14 +106,14 @@ class AgrementController extends AbstractController $params = [ 'agrement' => $a->getId(), - 'intervenant' => $ta->getIntervenant()->getSourceCode(), + 'intervenant' => $ta->getIntervenant()->getRouteParam(), ]; $actionUrl = $this->url()->fromRoute('intervenant/agrement/supprimer', $params); $actionLabel = '<span class="glyphicon glyphicon-trash"></span> Retirer l\'agrément'; } elseif (!$ta->getAgrement() && $this->isAllowed($ta, $ta->getTypeAgrement()->getPrivilegeEdition())) { $params = [ 'typeAgrement' => $ta->getTypeAgrement()->getId(), - 'intervenant' => $ta->getIntervenant()->getSourceCode(), + 'intervenant' => $ta->getIntervenant()->getRouteParam(), ]; if ($ta->getStructure()) $params['structure'] = $ta->getStructure()->getId(); diff --git a/module/Application/src/Application/Controller/ContratController.php b/module/Application/src/Application/Controller/ContratController.php index 5c1396abafb31024ac2bde2320a344b9eaedbd2c..a1db22f4aa9f86319ff1a1fa6ee439c0e110f2e8 100644 --- a/module/Application/src/Application/Controller/ContratController.php +++ b/module/Application/src/Application/Controller/ContratController.php @@ -147,7 +147,7 @@ class ContratController extends AbstractController } } - return $this->redirect()->toRoute('intervenant/contrat', ['intervenant' => $intervenant->getSourceCode()]); + return $this->redirect()->toRoute('intervenant/contrat', ['intervenant' => $intervenant->getRouteParam()]); } diff --git a/module/Application/src/Application/Controller/DroitsController.php b/module/Application/src/Application/Controller/DroitsController.php index 4aa187cb6c22d33c72a9911b4d5ffd9f447a9eb0..86385861e3120f47bd72cb14e0682d00ea82ee7c 100644 --- a/module/Application/src/Application/Controller/DroitsController.php +++ b/module/Application/src/Application/Controller/DroitsController.php @@ -62,7 +62,7 @@ class DroitsController extends AbstractController public function roleEditionAction() { - $role = $this->context()->roleFromRoute(); + $role = $this->getEvent()->getParam('role'); $errors = []; $form = $this->getFormDroitsRole(); @@ -96,7 +96,7 @@ class DroitsController extends AbstractController public function roleSuppressionAction() { - $role = $this->context()->mandatory()->roleFromRoute(); + $role = $this->getEvent()->getParam('role'); $title = "Suppression du rôle"; $form = $this->makeFormSupprimer( function() use ($role){ @@ -281,7 +281,8 @@ class DroitsController extends AbstractController public function affectationEditionAction() { - $affectation = $this->context()->affectationFromRoute(); + $affectation = $this->getEvent()->getParam('affectation'); + /* @var $affectation Affectation */ $errors = []; diff --git a/module/Application/src/Application/Controller/IntervenantController.php b/module/Application/src/Application/Controller/IntervenantController.php index 3060f3365e365610b478de6358f6d9f6b1800db5..b50260665e4652655878ed831ae8bedbbb6814da 100644 --- a/module/Application/src/Application/Controller/IntervenantController.php +++ b/module/Application/src/Application/Controller/IntervenantController.php @@ -2,9 +2,16 @@ namespace Application\Controller; +use Application\Entity\Db\TypeVolumeHoraire; +use Application\Entity\Service\Recherche; use Application\Exception\DbException; use Application\Form\Intervenant\Traits\EditionFormAwareTrait; use Application\Form\Intervenant\Traits\HeuresCompFormAwareTrait; +use Application\Processus\Traits\IntervenantProcessusAwareTrait; +use Application\Processus\Traits\ServiceProcessusAwareTrait; +use Application\Service\Traits\EtatVolumeHoraireAwareTrait; +use Application\Service\Traits\LocalContextAwareTrait; +use Application\Service\Traits\TypeVolumeHoraireAwareTrait; use Application\Service\Traits\WorkflowServiceAwareTrait; use UnicaenApp\Traits\SessionContainerTrait; use LogicException; @@ -12,6 +19,7 @@ use Application\Entity\Db\Intervenant; use Application\Service\Traits\ContextAwareTrait; use Application\Service\Traits\IntervenantAwareTrait; use Application\Service\Traits\TypeHeuresAwareTrait; +use Zend\View\Model\ViewModel; /** * Description of IntervenantController @@ -26,8 +34,11 @@ class IntervenantController extends AbstractController use HeuresCompFormAwareTrait; use SessionContainerTrait; use EditionFormAwareTrait; - - + use TypeVolumeHoraireAwareTrait; + use EtatVolumeHoraireAwareTrait; + use IntervenantProcessusAwareTrait; + use ServiceProcessusAwareTrait; + use LocalContextAwareTrait; @@ -37,7 +48,7 @@ class IntervenantController extends AbstractController if ($intervenant = $role->getIntervenant()) { $etapeCourante = $this->getServiceWorkflow()->getEtapeCourante(); - if ($etapeCourante && $url = $etapeCourante->getUrl()){ + if ($etapeCourante && $url = $etapeCourante->getUrl()) { return $this->redirect()->toUrl($url); } } @@ -50,6 +61,7 @@ class IntervenantController extends AbstractController public function rechercherAction() { $recents = $this->getIntervenantsRecents(); + return compact('recents'); } @@ -62,7 +74,7 @@ class IntervenantController extends AbstractController ]); $critere = $this->params()->fromPost('critere'); - $intervenants = $this->getServiceIntervenant()->recherche($critere, 21); + $intervenants = $this->getProcessusIntervenant()->rechercher($critere, 21); return compact('intervenants'); } @@ -74,7 +86,7 @@ class IntervenantController extends AbstractController $role = $this->getServiceContext()->getSelectedIdentityRole(); $intervenant = $role->getIntervenant() ?: $this->getEvent()->getParam('intervenant'); - if (! $intervenant){ + if (!$intervenant) { throw new \LogicException('Intervenant introuvable'); } @@ -85,6 +97,72 @@ class IntervenantController extends AbstractController + public function servicesAction() + { + $this->em()->getFilters()->enable('historique')->init([ + \Application\Entity\Db\Service::class, + \Application\Entity\Db\VolumeHoraire::class, + \Application\Entity\Db\Validation::class, + ]); + $this->em()->getFilters()->enable('annee')->init([ + \Application\Entity\Db\ElementPedagogique::class, + ]); + + $intervenant = $this->getEvent()->getParam('intervenant'); + /* @var $intervenant Intervenant */ + + if ($this->params()->fromQuery('menu', false) !== false) { // pour gérer uniquement l'affichage du menu + $vh = new ViewModel(); + $vh->setTemplate('application/intervenant/menu'); + + return $vh; + } + + $typeVolumeHoraire = $this->params()->fromRoute('type-volume-horaire-code', TypeVolumeHoraire::CODE_PREVU); + $typeVolumeHoraire = $this->getServiceTypeVolumeHoraire()->getByCode($typeVolumeHoraire); + + $etatVolumeHoraire = $this->getServiceEtatVolumeHoraire()->getSaisi(); + + $vm = new ViewModel(); + + /* Liste des services */ + $this->getServiceLocalContext()->setIntervenant($intervenant); // passage au contexte pour le présaisir dans le formulaire de saisie + $recherche = new Recherche($typeVolumeHoraire, $etatVolumeHoraire); + $services = $this->getProcessusService()->getServices($intervenant, $recherche); + + /* Services référentiels (si nécessaire) */ + /*if ($intervenant->getStatut()->getPeutSaisirReferentiel()) { + $params = $this->getEvent()->getRouteMatch()->getParams(); + $params['action'] = 'index'; + $params['query'] = $this->params()->fromQuery(); + $params['renderIntervenants'] = !$intervenant; + $widget = $this->forward()->dispatch('Application\Controller\ServiceReferentiel', $params); + if ($widget) $vm->addChild($widget, 'referentiel'); + }*/ + + /* Totaux HETD */ + $params = $this->getEvent()->getRouteMatch()->getParams(); + $this->getEvent()->setParam('typeVolumeHoraire', $typeVolumeHoraire); + $this->getEvent()->setParam('etatVolumeHoraire', $etatVolumeHoraire); + $params['action'] = 'formuleTotauxHetd'; + $widget = $this->forward()->dispatch('Application\Controller\Intervenant', $params); + if ($widget) $vm->addChild($widget, 'formuleTotauxHetd'); + + /* Clôture de saisie (si nécessaire) */ + if ($typeVolumeHoraire->isRealise() && $intervenant->getStatut()->getPeutCloturerSaisie()) { + $params = $this->getEvent()->getRouteMatch()->getParams(); + $params['action'] = 'cloturer-saisie'; + $widget = $this->forward()->dispatch('Application\Controller\Service', $params); + if ($widget) $vm->addChild($widget, 'clotureSaisie'); + } + + $vm->setVariables(compact('intervenant', 'typeVolumeHoraire', 'services')); + + return $vm; + } + + + public function ficheAction() { $role = $this->getServiceContext()->getSelectedIdentityRole(); @@ -104,7 +182,7 @@ class IntervenantController extends AbstractController $intervenant = $role->getIntervenant() ?: $this->getEvent()->getParam('intervenant'); $title = "Saisie d'un intervenant"; $form = $this->getFormIntervenantEdition(); - $errors = []; + $errors = []; if ($intervenant) { $form->bind($intervenant); diff --git a/module/Application/src/Application/Controller/Plugin/Context.php b/module/Application/src/Application/Controller/Plugin/Context.php index da8f05f4c497aff972edc3f91b218f782581dffa..56fb52083e9897130a7549609fa343d00d394f3f 100644 --- a/module/Application/src/Application/Controller/Plugin/Context.php +++ b/module/Application/src/Application/Controller/Plugin/Context.php @@ -12,11 +12,11 @@ use RuntimeException; /** * Plugin facilitant l'accès au gestionnaire d'entités Doctrine. * - * @method mixed *FromRoute($name = null, $default = null) Description - * @method mixed *FromQuery($name = null, $default = null) Description - * @method mixed *FromPost($name = null, $default = null) Description - * @method mixed *FromSources($name = null, $default = null, array $sources = null) Description - * @method mixed *FromQueryPost($name = null, $default = null) Description + * @method *FromRoute($name = null, $default = null) Description + * @method *FromQuery($name = null, $default = null) Description + * @method *FromPost($name = null, $default = null) Description + * @method *FromSources($name = null, $default = null, array $sources = null) Description + * @method *FromQueryPost($name = null, $default = null) Description * * @author Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr> * @see Params diff --git a/module/Application/src/Application/Controller/Plugin/Em.php b/module/Application/src/Application/Controller/Plugin/Em.php index bb9f7af5ede14563bd2409bd32564ea0a7c781f2..c7071e3dfac25a408f071b5c6dd76a23a0746c7d 100644 --- a/module/Application/src/Application/Controller/Plugin/Em.php +++ b/module/Application/src/Application/Controller/Plugin/Em.php @@ -36,7 +36,7 @@ class Em extends AbstractPlugin implements ServiceLocatorAwareInterface * Retourne le gestionnaire d'entités. * * @param string $name - * @return \Application\Entity\Db\Repository\IntervenantRepository + * @return EntityManager */ protected function getEntityManager($name) { diff --git a/module/Application/src/Application/Controller/RechercheController.php b/module/Application/src/Application/Controller/RechercheController.php index 56f502bf32037b3c609a4f0f25d117f3dcf96e51..29e806aa6e9fd9cc62a39a7ce984c70dbbe2995c 100644 --- a/module/Application/src/Application/Controller/RechercheController.php +++ b/module/Application/src/Application/Controller/RechercheController.php @@ -2,111 +2,52 @@ namespace Application\Controller; -use Application\Service\Traits\ContextAwareTrait; -use Application\Service\Traits\IntervenantAwareTrait; +use Application\Constants; +use Application\Processus\Traits\IntervenantProcessusAwareTrait; use Application\Service\Traits\PersonnelAwareTrait; use Zend\View\Model\JsonModel; /** * Description of RechercheController * - * @method \Application\Controller\Plugin\Recherche intervenant() Description - * @author Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr> */ class RechercheController extends AbstractController { - use ContextAwareTrait; use PersonnelAwareTrait; - use IntervenantAwareTrait; + use IntervenantProcessusAwareTrait; - public function intervenantAction() - { - if (($data = $this->prg()) instanceof \Zend\Http\Response) { - return $data; - } - - $interv = new \UnicaenApp\Form\Element\SearchAndSelect('interv'); - $interv->setAutocompleteSource($this->url()->fromRoute('application/default', ['controller' => 'intervenant', 'action' => 'search'])) - ->setLabel("Recherche :") - ->setAttributes(['title' => "Saisissez le nom suivi éventuellement du prénom (2 lettres au moins)"]); - $form = new \Zend\Form\Form('search'); - $form->setAttributes(['class' => 'intervenant-rech']); - $form->add($interv); - - $view = new \Zend\View\Model\ViewModel(); - $view->setVariables(['form' => $form]); - $view->setTemplate('application/intervenant/rechercher'); - - return $view; - } public function intervenantFindAction() { - $this->em()->getFilters()->enable('historique')->init([ - \Application\Entity\Db\Intervenant::class, - ]); - if (!($term = $this->params()->fromQuery('term'))) { return new JsonModel([]); } - $typeIntervenant = $this->params()->fromQuery('typeIntervenant', false); - $sTypeIntervenant = $this->getServiceLocator()->get('applicationTypeIntervenant'); - /* @var $sTypeIntervenant \Application\Service\TypeIntervenant */ - $typeIntervenant = $sTypeIntervenant->get( $typeIntervenant ); - - $structure = $this->params()->fromQuery('structure', false); - $sStructure = $this->getServiceLocator()->get('applicationStructure'); - /* @var $sStructure \Application\Service\Structure */ - $structure = $sStructure->get( $structure ); - - $template = "{label} <small>{extra}</small>"; - $resultOSE = []; - $qb = $this->getServiceIntervenant()->finderByNomPrenomId($term); - if ($structure) $this->getServiceIntervenant()->finderByStructure( $structure, $qb ); - if ($typeIntervenant) $this->getServiceIntervenant()->finderByType( $typeIntervenant, $qb ); - $entities = $qb->getQuery()->execute(); - - $f = new \Application\Filter\IntervenantTrouveFormatter(); - foreach ($entities as $item) { /* @var $item \Application\Entity\Db\Intervenant */ - $data = $f->filter($item); - $data['template'] = $template; - $resultOSE[$item->getSourceCode()] = $data; - }; + $res = $this->getProcessusIntervenant()->rechercher($term); - // recherche dans la source de données externe (ex: Harpege) - $service = $this->getServiceLocator()->get('importServiceIntervenant'); /* @var $service \Import\Service\Intervenant */ - $resultHarp = $service->searchIntervenant($term, $structure, $typeIntervenant); - - // marquage des individus existant dans OSE mais inexistant dans la source - // + retrait des individus trouvés à la fois dans OSE et dans la source - foreach ($resultOSE as $key => $value) { - if (!array_key_exists($key, $resultHarp)) { - $resultOSE[$key]['extra'] .= - ' <i class="badge pull-right" title="Existe dans OSE mais pas dans la source de données externe">Créé dans OSE</i>'; - } - else { - unset($resultHarp[$key]); - } - } - // marquage des individus inexistant dans OSE mais existant dans la source - foreach ($resultHarp as $key => $value) { - if (!array_key_exists($key, $resultOSE)) { - $resultHarp[$key]['extra'] .= - ' <i class="badge pull-right" title="Existe dans la source de données externe mais pas dans OSE">Non importé</i>'; - } - $resultHarp[$key]['template'] = $template; + $result = []; + foreach ($res as $key => $r) { + $feminin = $r['civilite'] != 'Monsieur'; + + $civilite = $feminin ? 'M<sup>me</sup>' : 'M.'; + $nom = strtoupper($r['nom']); + $prenom = ucfirst($r['prenom']); + $naissance = 'né'.($feminin ? 'e' : '').' le '.$r['date-naissance']->format(Constants::DATE_FORMAT); + $numeroPersonnel = 'N°'.$r['numero-personnel']; + $structure = $r['structure']; + + $result[$key] = [ + 'id' => $r['numero-personnel'], + 'label' => "$nom $prenom", + 'extra' => "<small>($civilite, $naissance, $numeroPersonnel, $structure)</small>", + ]; } - // union - $result = $resultOSE + $resultHarp; - - uasort($result, function($v1, $v2) { return strcasecmp($v1['label'], $v2['label']); }); - -// var_dump($result); return new JsonModel($result); } + + public function personnelFindAction() { $this->em()->getFilters()->enable('historique')->init([ @@ -117,17 +58,17 @@ class RechercheController extends AbstractController return new JsonModel([]); } - $qb = $this->getServicePersonnel()->finderByTerm($term); + $qb = $this->getServicePersonnel()->finderByTerm($term); $this->getServicePersonnel()->join('applicationStructure', $qb, 'structure'); - $personnels = $this->getServicePersonnel()->getList($qb); + $personnels = $this->getServicePersonnel()->getList($qb); $result = []; foreach ($personnels as $personnel) { $result[$personnel->getId()] = [ - 'id' => $personnel->getId(), - 'label' => (string)$personnel, + 'id' => $personnel->getId(), + 'label' => (string)$personnel, 'structure' => $personnel->getStructure()->getId(), - 'template' => $personnel.' <small class="bg-info">n° '.$personnel->getSourceCode().', '.$personnel->getStructure().'</small>' + 'template' => $personnel . ' <small class="bg-info">n° ' . $personnel->getSourceCode() . ', ' . $personnel->getStructure() . '</small>', ]; }; diff --git a/module/Application/src/Application/Controller/ServiceController.php b/module/Application/src/Application/Controller/ServiceController.php index 8ef5c508f912f22cf6bbdf6e7dcb7d32e1c67df0..e6728fb64b3ef767ad1c58f1ba6bf338c9066bb3 100644 --- a/module/Application/src/Application/Controller/ServiceController.php +++ b/module/Application/src/Application/Controller/ServiceController.php @@ -5,13 +5,14 @@ namespace Application\Controller; use Application\Entity\Db\ElementPedagogique; use Application\Form\Service\Traits\RechercheFormAwareTrait; use Application\Form\Service\Traits\SaisieAwareTrait; +use Application\Processus\Traits\ServiceProcessusAwareTrait; use Application\Processus\Traits\ValidationEnseignementProcessusAwareTrait; use Application\Processus\Traits\ValidationProcessusAwareTrait; use Application\Provider\Privilege\Privileges; use Application\Service\Traits\LocalContextAwareTrait; -use BjyAuthorize\Exception\UnAuthorizedException; use UnicaenApp\View\Model\CsvModel; use UnicaenApp\View\Model\MessengerViewModel; +use Zend\Http\Request; use Zend\View\Model\ViewModel; use Application\Exception\DbException; use Application\Entity\Db\Intervenant; @@ -38,6 +39,7 @@ use Application\Service\Traits\PeriodeAwareTrait; */ class ServiceController extends AbstractController { + use ServiceProcessusAwareTrait; use ContextAwareTrait; use ServiceAwareTrait; use VolumeHoraireAwareTrait; @@ -66,7 +68,6 @@ class ServiceController extends AbstractController */ protected function initFilters() { - $this->em()->getFilters()->enable('historique')->init([ \Application\Entity\Db\Service::class, \Application\Entity\Db\VolumeHoraire::class, @@ -79,173 +80,45 @@ class ServiceController extends AbstractController - /** - * - * @param Intervenant|null $intervenant - * @param Recherche $recherche - * - * @return \Doctrine\ORM\QueryBuilder - */ - private function getFilteredServices($intervenant, $recherche) + public function indexAction() { - //\Test\Util::sqlLog($this->getServiceService()->getEntityManager()); - - $service = $this->getServiceService(); - $volumeHoraireService = $this->getServiceVolumeHoraire(); - $elementPedagogiqueService = $this->getServiceElementPedagogique(); - $structureService = $this->getServiceStructure(); - $etapeService = $this->getServiceEtape(); - $periodeService = $this->getServicePeriode(); - $this->initFilters(); - $qb = $service->initQuery()[0]; - /* @var $qb \Doctrine\ORM\QueryBuilder */ - - //@formatter:off - $service - ->join( 'applicationIntervenant', $qb, 'intervenant', ['id', 'nomUsuel', 'prenom','sourceCode'] ) - ->leftJoin( $elementPedagogiqueService, $qb, 'elementPedagogique', ['id', 'sourceCode', 'libelle', 'histoDestruction', 'fi', 'fc', 'fa', 'tauxFi', 'tauxFc', 'tauxFa', 'tauxFoad'] ) - ->leftjoin( $volumeHoraireService, $qb, 'volumeHoraire', ['id', 'heures'] ); - -// $intervenantService -// ->leftJoin( 'applicationUtilisateur', $qb, 'utilisateur', true ); - - $elementPedagogiqueService - ->leftJoin( $structureService, $qb, 'structure', ['id', 'libelleCourt'] ) - ->leftJoin( $etapeService, $qb, 'etape', ['id', 'libelle', 'niveau', 'histoDestruction', 'sourceCode'] ) - ->leftJoin( $periodeService, $qb, 'periode', ['id', 'code', 'libelleLong', 'libelleCourt', 'ordre'] ) - ->leftJoin( 'applicationTypeIntervention', $qb, 'typeIntervention', ['id', 'code', 'libelle', 'ordre'] ); - - $volumeHoraireService - ->leftJoin( 'applicationMotifNonPaiement', $qb, 'motifNonPaiement', ['id', 'libelleCourt', 'libelleLong'] ); - - $volumeHoraireService->leftJoin( 'applicationEtatVolumeHoraire', $qb, 'etatVolumeHoraire', ['id','code','libelle','ordre'] ); - $volumeHoraireService->leftJoin( 'ApplicationFormuleVolumeHoraire', $qb, 'formuleVolumeHoraire', ['id'] ); - //@formatter:on - - $service->finderByContext($qb); - $service->finderByFilterObject($recherche, new \Zend\Stdlib\Hydrator\ClassMethods(false), $qb, null, ['typeVolumeHoraire', 'etatVolumeHoraire']); - - if ($intervenant) { - $service->finderByIntervenant($intervenant, $qb); - } - - $qb - ->addOrderBy($structureService->getAlias() . '.libelleCourt') - ->addOrderBy($etapeService->getAlias() . '.libelle') - ->addOrderBy($periodeService->getAlias() . '.libelleCourt') - ->addOrderBy($elementPedagogiqueService->getAlias() . '.sourceCode'); - if (!$intervenant && $composante = $this->getServiceContext()->getSelectedIdentityRole()->getStructure()) { - $service->finderByComposante($composante, $qb); - } - - return $qb; - } - - - - public function indexAction() - { - $totaux = $this->params()->fromQuery('totaux', 0) == '1'; $viewHelperParams = $this->params()->fromPost('params', $this->params()->fromQuery('params')); - $role = $this->getServiceContext()->getSelectedIdentityRole(); - $intervenant = $this->context()->intervenantFromRoute(); $viewModel = new \Zend\View\Model\ViewModel(); - $serviceProto = $this->getServiceService()->newEntity() - ->setIntervenant($intervenant) - ->setTypeVolumeHoraire($this->getTypeVolumeHoraire()); - - $canAddService = $this->isAllowed($serviceProto, 'create'); + $canAddService = true; /* A REVOIR ! ! ! */ - - if (!$this->isAllowed($serviceProto, Privileges::ENSEIGNEMENT_VISUALISATION)) { + /*if (!$this->isAllowed($serviceProto, Privileges::ENSEIGNEMENT_VISUALISATION)) { $eStr = 'L\'accès au service ' . lcfirst($this->getTypeVolumeHoraire()->getLibelle()) . ' est interdit.'; throw new UnAuthorizedException($eStr); - } - - -// if (! $this->isAllowed($this->getServiceService()->newEntity()->setIntervenant($intervenant), 'read')){ -// throw new \BjyAuthorize\Exception\UnAuthorizedException(); -// } + }*/ - if (!$intervenant) { - $action = $this->getRequest()->getQuery('action', null); // ne pas afficher par défaut, sauf si demandé explicitement - $params = $this->getEvent()->getRouteMatch()->getParams(); - $params['action'] = 'recherche'; - $rechercheViewModel = $this->forward()->dispatch('Application\Controller\Service', $params); - $viewModel->addChild($rechercheViewModel, 'recherche'); - - $recherche = $this->getServiceService()->loadRecherche(); - } else { + $action = $this->getRequest()->getQuery('action', null); // ne pas afficher par défaut, sauf si demandé explicitement + $params = $this->getEvent()->getRouteMatch()->getParams(); + $params['action'] = 'recherche'; + $rechercheViewModel = $this->forward()->dispatch('Application\Controller\Service', $params); + $viewModel->addChild($rechercheViewModel, 'recherche'); - $this->getServiceLocalContext()->setIntervenant($intervenant); // passage au contexte pour le présaisir dans le formulaire de saisie - $action = 'afficher'; // Affichage par défaut - $recherche = new Recherche; - $recherche->setTypeVolumeHoraire($this->getTypeVolumeHoraire()); - $recherche->setEtatVolumeHoraire($this->getServiceEtatVolumeHoraire()->getSaisi()); - - $params = [ - 'intervenant' => $intervenant->getSourceCode(), - 'action' => 'formule-totaux-hetd', - ]; - $this->getEvent()->setParam('typeVolumeHoraire', $recherche->getTypeVolumeHoraire()); - $this->getEvent()->setParam('etatVolumeHoraire', $recherche->getEtatVolumeHoraire()); - $totalViewModel = $this->forward()->dispatch('Application\Controller\Intervenant', $params); - $viewModel->addChild($totalViewModel, 'formuleTotauxHetd'); - } + $recherche = $this->getServiceService()->loadRecherche(); /* Préparation et affichage */ - if ('afficher' === $action || $totaux) { - $qb = $this->getFilteredServices($intervenant, $recherche); - $services = $this->getServiceService()->getList($qb); - - // services référentiels : délégation au contrôleur - if (!$totaux) { - $controller = 'Application\Controller\ServiceReferentiel'; - $params = $this->getEvent()->getRouteMatch()->getParams(); - $params['action'] = 'index'; - $params['recherche'] = $recherche; - $params['query'] = $this->params()->fromQuery(); - $params['renderIntervenants'] = !$intervenant; - $listeViewModel = $this->forward()->dispatch($controller, $params); - $viewModel->addChild($listeViewModel, 'servicesRefListe'); - } + if ('afficher' === $action) { + $services = $this->getProcessusService()->getServices(null, $recherche); + /* Services référentiels */ } else { $services = []; } $typeVolumeHoraire = $recherche->getTypeVolumeHoraire(); $params = $viewHelperParams; - $viewModel->setVariables(compact('services', 'typeVolumeHoraire', 'action', 'role', 'intervenant', 'canAddService', 'params')); - if ($totaux) { - $viewModel->setTemplate('application/service/rafraichir-totaux'); - } else { - $viewModel->setTemplate('application/service/index'); - - // gestion du bouton permettant de clôturer la saisie du réalisé pour les permanents - $this->injectClotureSaisie($viewModel); - } + $viewModel->setVariables(compact('services', 'typeVolumeHoraire', 'action', 'canAddService', 'params')); + $viewModel->setTemplate('application/service/index'); return $viewModel; } - private function injectClotureSaisie(\Zend\View\Model\ModelInterface $viewModel) - { - $params = $this->getEvent()->getRouteMatch()->getParams(); - $params['action'] = 'cloturer-saisie'; - - $widget = $this->forward()->dispatch('Application\Controller\Service', $params); - - if ($widget instanceof \Zend\View\Model\ModelInterface) { - $viewModel->addChild($widget, 'clotureSaisie'); - } - } - - - /** * Clôture de la saisie du réalisé. * @@ -434,7 +307,7 @@ class ServiceController extends AbstractController $rechercheForm->bind($entity); $request = $this->getRequest(); - /* @var $request Http\Request */ + /* @var $request Request */ if ('afficher' === $request->getQuery('action', null)) { $rechercheForm->setData($request->getQuery()); if ($rechercheForm->isValid()) { @@ -460,7 +333,7 @@ class ServiceController extends AbstractController $params = $this->params()->fromPost('params', $this->params()->fromQuery('params')); $details = 1 == (int)$this->params()->fromQuery('details', (int)$this->params()->fromPost('details', 0)); $onlyContent = 1 == (int)$this->params()->fromQuery('only-content', 0); - $service = $this->context()->serviceFromRoute('id'); // remplacer id par service au besoin, à cause des routes définies en config. + $service = $this->getEvent()->getParam('service'); return compact('service', 'params', 'details', 'onlyContent'); } @@ -612,7 +485,6 @@ class ServiceController extends AbstractController } $service = $this->getServiceService(); $form = $this->getFormServiceSaisie(); - $errors = []; $intervenant = $this->getServiceLocalContext()->getIntervenant(); @@ -629,30 +501,36 @@ class ServiceController extends AbstractController $title = "Ajout d'enseignement"; } - $assertionEntity = $this->getServiceService()->newEntity()->setIntervenant($intervenant); - $assertionEntity->setTypeVolumeHoraire($typeVolumeHoraire); - if (!$this->isAllowed($assertionEntity, 'create') && !$this->isAllowed($assertionEntity, 'update')) { - throw new \LogicException("Cette opération n'est pas autorisée."); + if ($intervenant) { + $form->get('service')->setCanSaisieExterieur($this->isAllowed($intervenant, Privileges::ENSEIGNEMENT_EXTERIEUR)); + } else { + $form->get('service')->setCanSaisieExterieur($this->isAllowed(Privileges::getResourceId(Privileges::ENSEIGNEMENT_EXTERIEUR))); } + $request = $this->getRequest(); if ($request->isPost()) { - $form->setData($request->getPost()); - $form->saveToContext(); - if ($form->isValid()) { - try { - $entity = $service->save($entity->setIntervenant($intervenant)); - $form->get('service')->get('id')->setValue($entity->getId()); // transmet le nouvel ID - } catch (\Exception $e) { - $e = DbException::translate($e); - $errors[] = $e->getMessage(); - } + if (!$this->isAllowed($entity, Privileges::ENSEIGNEMENT_EDITION)) { + $this->flashMessenger()->addErrorMessage("Vous n'êtes pas autorisé à créer ou modifier ce service."); } else { - $errors[] = 'La validation du formulaire a échoué. L\'enregistrement des données n\'a donc pas été fait.'; + + $form->setData($request->getPost()); + $form->saveToContext(); + if ($form->isValid()) { + try { + $entity = $service->save($entity->setIntervenant($intervenant)); + $form->get('service')->get('id')->setValue($entity->getId()); // transmet le nouvel ID + } catch (\Exception $e) { + $e = DbException::translate($e); + $this->flashMessenger()->addErrorMessage($e->getMessage()); + } + } else { + $this->flashMessenger()->addErrorMessage('La validation du formulaire a échoué. L\'enregistrement des données n\'a donc pas été fait.'); + } } } - return compact('form', 'errors', 'title'); + return compact('form', 'title'); } diff --git a/module/Application/src/Application/Controller/ServiceReferentielController.php b/module/Application/src/Application/Controller/ServiceReferentielController.php index b49ffe17876b06a67c02979858d1e8a8cf862e0f..ccc803aab9401e056ee869077f0eb953a595c19e 100644 --- a/module/Application/src/Application/Controller/ServiceReferentielController.php +++ b/module/Application/src/Application/Controller/ServiceReferentielController.php @@ -122,7 +122,7 @@ class ServiceReferentielController extends AbstractController $recherche->setEtatVolumeHoraire($this->getServiceEtatVolumeHoraire()->getSaisi()); $params = [ - 'intervenant' => $intervenant->getSourceCode(), + 'intervenant' => $intervenant->getRouteParam(), 'action' => 'formule-totaux-hetd', ]; $this->getEvent()->setParam('typeVolumeHoraire', $recherche->getTypeVolumeHoraire()); diff --git a/module/Application/src/Application/Controller/VolumeHoraireController.php b/module/Application/src/Application/Controller/VolumeHoraireController.php index cb65376f88104a2b88a49778d96728e2faafab49..5c8aa2bcd8d59051e416e45d41abd32b23c2b33f 100644 --- a/module/Application/src/Application/Controller/VolumeHoraireController.php +++ b/module/Application/src/Application/Controller/VolumeHoraireController.php @@ -2,8 +2,10 @@ namespace Application\Controller; +use Application\Entity\Db\Service; use Application\Filter\StringFromFloat; use Application\Form\VolumeHoraire\Traits\SaisieAwareTrait; +use Application\Provider\Privilege\Privileges; use Application\Service\Traits\ContextAwareTrait; use Application\Service\Traits\VolumeHoraireAwareTrait; use Application\Service\Traits\ServiceAwareTrait; @@ -27,7 +29,8 @@ class VolumeHoraireController extends AbstractController $this->em()->getFilters()->enable('historique')->init([ \Application\Entity\Db\VolumeHoraire::class ]); - $service = $this->context()->serviceFromRoute('id'); + $service = $this->getEvent()->getParam('service'); + /* @var $service Service */ if (! $service) throw new RuntimeException("Service non spécifié ou introuvable."); $typeVolumeHoraire = $this->context()->typeVolumeHoraireFromQueryPost('type-volume-horaire'); @@ -49,7 +52,13 @@ class VolumeHoraireController extends AbstractController $periode = $this->context()->periodeFromQueryPost(); $typeIntervention = $this->context()->typeInterventionFromQueryPost('type-intervention'); $errors = []; - if ($this->getServiceService()->canHaveMotifNonPaiement($service)){ + + + $canViewMNP = $this->isAllowed($service->getIntervenant(), Privileges::MOTIF_NON_PAIEMENT_VISUALISATION); + $canEditMNP = $this->isAllowed($service->getIntervenant(), Privileges::MOTIF_NON_PAIEMENT_EDITION); + + + if ($canViewMNP){ $tousMotifsNonPaiement = $this->params()->fromQuery('tous-motifs-non-paiement'); if ($tousMotifsNonPaiement == '1'){ $motifNonPaiement = false; @@ -70,7 +79,8 @@ class VolumeHoraireController extends AbstractController $volumeHoraireList->setMotifNonPaiement($motifNonPaiement); $form = $this->getFormVolumeHoraireSaisie(); - $form->setAttribute('action', $this->url()->fromRoute(null, [], [], true)); + $form->setViewMNP( $canViewMNP ); + $form->setEditMNP( $canEditMNP ); $request = $this->getRequest(); if ($request->isPost()){ diff --git a/module/Application/src/Application/Controller/WorkflowController.php b/module/Application/src/Application/Controller/WorkflowController.php index bec20b2e7a7f695d7614577dcaccb4d861dab849..daa1cc1ac9a949c9410804b4ceb40bee4c0b041b 100644 --- a/module/Application/src/Application/Controller/WorkflowController.php +++ b/module/Application/src/Application/Controller/WorkflowController.php @@ -9,6 +9,7 @@ use Application\Service\Traits\ContextAwareTrait; use Application\Service\Traits\WfEtapeAwareTrait; use Application\Service\Traits\WfEtapeDepServiceAwareTrait; use Application\Service\Traits\WorkflowServiceAwareTrait; +use UnicaenApp\Exception\LogicException; /** @@ -138,4 +139,19 @@ class WorkflowController extends AbstractController return compact('action', 'title', 'error'); } + + + + public function feuilleDeRouteBtnNextAction() + { + $intervenant = $this->getEvent()->getParam('intervenant'); + /* @var $intervenant Intervenant */ + + $wfEtapeCode = $this->params()->fromRoute('wfEtapeCode'); + if (!$wfEtapeCode){ + throw new LogicException('L\'étape du workflow doit être précisée'); + } + + return compact('intervenant', 'wfEtapeCode'); + } } \ No newline at end of file diff --git a/module/Application/src/Application/Entity/Db/AdresseIntervenant.php b/module/Application/src/Application/Entity/Db/AdresseIntervenant.php index 6cf5f92c93a991946105914364e676de7cf87d54..09ae5b4c840e393a37d5c9e24d3f269f43f475af 100644 --- a/module/Application/src/Application/Entity/Db/AdresseIntervenant.php +++ b/module/Application/src/Application/Entity/Db/AdresseIntervenant.php @@ -4,13 +4,17 @@ namespace Application\Entity\Db; use Application\Constants; use UnicaenApp\Entity\HistoriqueAwareInterface; use UnicaenApp\Entity\HistoriqueAwareTrait; +use UnicaenImport\Entity\Db\Interfaces\ImportAwareInterface; +use UnicaenImport\Entity\Db\Traits\ImportAwareTrait; + /** * AdresseIntervenant */ -class AdresseIntervenant implements HistoriqueAwareInterface +class AdresseIntervenant implements HistoriqueAwareInterface, ImportAwareInterface { use HistoriqueAwareTrait; + use ImportAwareTrait; /** * @var string */ @@ -51,11 +55,6 @@ class AdresseIntervenant implements HistoriqueAwareInterface */ protected $paysLibelle; - /** - * @var string - */ - protected $sourceCode; - /** * @var string */ @@ -76,11 +75,6 @@ class AdresseIntervenant implements HistoriqueAwareInterface */ protected $intervenant; - /** - * @var \Application\Entity\Db\Source - */ - protected $source; - /** @@ -307,34 +301,6 @@ class AdresseIntervenant implements HistoriqueAwareInterface - /** - * Set sourceCode - * - * @param string $sourceCode - * - * @return AdresseIntervenant - */ - public function setSourceCode($sourceCode) - { - $this->sourceCode = $sourceCode; - - return $this; - } - - - - /** - * Get sourceCode - * - * @return string - */ - public function getSourceCode() - { - return $this->sourceCode; - } - - - /** * Set telDomicile * @@ -431,34 +397,6 @@ class AdresseIntervenant implements HistoriqueAwareInterface - /** - * Set source - * - * @param \Application\Entity\Db\Source $source - * - * @return AdresseIntervenant - */ - public function setSource(\Application\Entity\Db\Source $source = null) - { - $this->source = $source; - - return $this; - } - - - - /** - * Get source - * - * @return \Application\Entity\Db\Source - */ - public function getSource() - { - return $this->source; - } - - - /** * * @return string diff --git a/module/Application/src/Application/Entity/Db/AdresseStructure.php b/module/Application/src/Application/Entity/Db/AdresseStructure.php index b59d4871d0a76433dba73a055659561fff25e483..06f8711e471bdd43b2f621957f83b4da4b752da2 100644 --- a/module/Application/src/Application/Entity/Db/AdresseStructure.php +++ b/module/Application/src/Application/Entity/Db/AdresseStructure.php @@ -5,13 +5,17 @@ namespace Application\Entity\Db; use Doctrine\ORM\Mapping as ORM; use UnicaenApp\Entity\HistoriqueAwareInterface; use UnicaenApp\Entity\HistoriqueAwareTrait; +use UnicaenImport\Entity\Db\Interfaces\ImportAwareInterface; +use UnicaenImport\Entity\Db\Traits\ImportAwareTrait; + /** * AdresseStructure */ -class AdresseStructure implements HistoriqueAwareInterface +class AdresseStructure implements HistoriqueAwareInterface, ImportAwareInterface { use HistoriqueAwareTrait; + use ImportAwareTrait; /** * @var string @@ -48,11 +52,6 @@ class AdresseStructure implements HistoriqueAwareInterface */ protected $principale; - /** - * @var string - */ - protected $sourceCode; - /** * @var string */ @@ -73,10 +72,6 @@ class AdresseStructure implements HistoriqueAwareInterface */ protected $structure; - /** - * @var \Application\Entity\Db\Source - */ - protected $source; @@ -276,34 +271,6 @@ class AdresseStructure implements HistoriqueAwareInterface - /** - * Set sourceCode - * - * @param string $sourceCode - * - * @return AdresseStructure - */ - public function setSourceCode($sourceCode) - { - $this->sourceCode = $sourceCode; - - return $this; - } - - - - /** - * Get sourceCode - * - * @return string - */ - public function getSourceCode() - { - return $this->sourceCode; - } - - - /** * Set telephone * @@ -398,32 +365,4 @@ class AdresseStructure implements HistoriqueAwareInterface return $this->structure; } - - - /** - * Set source - * - * @param \Application\Entity\Db\Source $source - * - * @return AdresseStructure - */ - public function setSource(\Application\Entity\Db\Source $source = null) - { - $this->source = $source; - - return $this; - } - - - - /** - * Get source - * - * @return \Application\Entity\Db\Source - */ - public function getSource() - { - return $this->source; - } - } diff --git a/module/Application/src/Application/Entity/Db/Affectation.php b/module/Application/src/Application/Entity/Db/Affectation.php index 0e3dfe8427134a12b70f63a5aef1dd2fad3b23a3..32e1023fa180ccfa170a5fa6bc5d666d17f6ada2 100644 --- a/module/Application/src/Application/Entity/Db/Affectation.php +++ b/module/Application/src/Application/Entity/Db/Affectation.php @@ -1,20 +1,20 @@ <?php namespace Application\Entity\Db; + use UnicaenApp\Entity\HistoriqueAwareInterface; use UnicaenApp\Entity\HistoriqueAwareTrait; +use UnicaenImport\Entity\Db\Interfaces\ImportAwareInterface; +use UnicaenImport\Entity\Db\Traits\ImportAwareTrait; + /** * Affectation */ -class Affectation implements HistoriqueAwareInterface +class Affectation implements HistoriqueAwareInterface, ImportAwareInterface { use HistoriqueAwareTrait; - - /** - * @var string - */ - protected $sourceCode; + use ImportAwareTrait; /** * @var integer @@ -31,11 +31,6 @@ class Affectation implements HistoriqueAwareInterface */ protected $role; - /** - * @var \Application\Entity\Db\Source - */ - protected $source; - /** * @var \Application\Entity\Db\Personnel */ @@ -43,34 +38,6 @@ class Affectation implements HistoriqueAwareInterface - /** - * Set sourceCode - * - * @param string $sourceCode - * - * @return Affectation - */ - public function setSourceCode($sourceCode) - { - $this->sourceCode = $sourceCode; - - return $this; - } - - - - /** - * Get sourceCode - * - * @return string - */ - public function getSourceCode() - { - return $this->sourceCode; - } - - - /** * Get id * @@ -139,34 +106,6 @@ class Affectation implements HistoriqueAwareInterface - /** - * Set source - * - * @param \Application\Entity\Db\Source $source - * - * @return Affectation - */ - public function setSource(\Application\Entity\Db\Source $source = null) - { - $this->source = $source; - - return $this; - } - - - - /** - * Get source - * - * @return \Application\Entity\Db\Source - */ - public function getSource() - { - return $this->source; - } - - - /** * Set personnel * diff --git a/module/Application/src/Application/Entity/Db/AffectationRecherche.php b/module/Application/src/Application/Entity/Db/AffectationRecherche.php index fd1a1dafef9cf5ca739c2861087fdced44662118..68ca9840d7193b7e9688c7d47ec077bf39ec7792 100644 --- a/module/Application/src/Application/Entity/Db/AffectationRecherche.php +++ b/module/Application/src/Application/Entity/Db/AffectationRecherche.php @@ -5,29 +5,23 @@ namespace Application\Entity\Db; use Doctrine\ORM\Mapping as ORM; use UnicaenApp\Entity\HistoriqueAwareInterface; use UnicaenApp\Entity\HistoriqueAwareTrait; +use UnicaenImport\Entity\Db\Interfaces\ImportAwareInterface; +use UnicaenImport\Entity\Db\Traits\ImportAwareTrait; + /** * AffectationRecherche */ -class AffectationRecherche implements HistoriqueAwareInterface +class AffectationRecherche implements HistoriqueAwareInterface, ImportAwareInterface { use HistoriqueAwareTrait; - - /** - * @var string - */ - protected $sourceCode; + use ImportAwareTrait; /** * @var integer */ protected $id; - /** - * @var \Application\Entity\Db\Source - */ - protected $source; - /** * @var \Application\Entity\Db\Structure */ @@ -40,34 +34,6 @@ class AffectationRecherche implements HistoriqueAwareInterface - /** - * Set sourceCode - * - * @param string $sourceCode - * - * @return AffectationRecherche - */ - public function setSourceCode($sourceCode) - { - $this->sourceCode = $sourceCode; - - return $this; - } - - - - /** - * Get sourceCode - * - * @return string - */ - public function getSourceCode() - { - return $this->sourceCode; - } - - - /** * Get id * @@ -80,34 +46,6 @@ class AffectationRecherche implements HistoriqueAwareInterface - /** - * Set source - * - * @param \Application\Entity\Db\Source $source - * - * @return AffectationRecherche - */ - public function setSource(\Application\Entity\Db\Source $source = null) - { - $this->source = $source; - - return $this; - } - - - - /** - * Get source - * - * @return \Application\Entity\Db\Source - */ - public function getSource() - { - return $this->source; - } - - - /** * Set structure * diff --git a/module/Application/src/Application/Entity/Db/CentreCout.php b/module/Application/src/Application/Entity/Db/CentreCout.php index dcfba4277dcb4b19b2a4cb664f421329cd4d14d4..1cb8e1977a32c9e8a87956780a6963928963ad6c 100644 --- a/module/Application/src/Application/Entity/Db/CentreCout.php +++ b/module/Application/src/Application/Entity/Db/CentreCout.php @@ -5,13 +5,16 @@ namespace Application\Entity\Db; use Doctrine\ORM\Mapping as ORM; use UnicaenApp\Entity\HistoriqueAwareInterface; use UnicaenApp\Entity\HistoriqueAwareTrait; +use UnicaenImport\Entity\Db\Interfaces\ImportAwareInterface; +use UnicaenImport\Entity\Db\Traits\ImportAwareTrait; /** * CentreCout */ -class CentreCout implements HistoriqueAwareInterface +class CentreCout implements HistoriqueAwareInterface, ImportAwareInterface { use HistoriqueAwareTrait; + use ImportAwareTrait; /** * @var string @@ -23,11 +26,6 @@ class CentreCout implements HistoriqueAwareInterface */ private $parent; - /** - * @var string - */ - private $sourceCode; - /** * @var integer */ @@ -43,11 +41,6 @@ class CentreCout implements HistoriqueAwareInterface */ private $typeRessource; - /** - * @var \Application\Entity\Db\Source - */ - private $source; - /** * @var \Application\Entity\Db\CcActivite */ @@ -131,34 +124,6 @@ class CentreCout implements HistoriqueAwareInterface - /** - * Set sourceCode - * - * @param string $sourceCode - * - * @return CentreCout - */ - public function setSourceCode($sourceCode) - { - $this->sourceCode = $sourceCode; - - return $this; - } - - - - /** - * Get sourceCode - * - * @return string - */ - public function getSourceCode() - { - return $this->sourceCode; - } - - - /** * Get id * @@ -211,34 +176,6 @@ class CentreCout implements HistoriqueAwareInterface - /** - * Set source - * - * @param \Application\Entity\Db\Source $source - * - * @return CentreCout - */ - public function setSource(\Application\Entity\Db\Source $source = null) - { - $this->source = $source; - - return $this; - } - - - - /** - * Get source - * - * @return \Application\Entity\Db\Source - */ - public function getSource() - { - return $this->source; - } - - - /** * Set activite * diff --git a/module/Application/src/Application/Entity/Db/CentreCoutEp.php b/module/Application/src/Application/Entity/Db/CentreCoutEp.php index dcaac9fc04ea7624e48576ef81311293d403412f..6ffb69096961167e25979bc29204ac2e20c0e03f 100644 --- a/module/Application/src/Application/Entity/Db/CentreCoutEp.php +++ b/module/Application/src/Application/Entity/Db/CentreCoutEp.php @@ -1,32 +1,26 @@ <?php namespace Application\Entity\Db; + use UnicaenApp\Entity\HistoriqueAwareInterface; use UnicaenApp\Entity\HistoriqueAwareTrait; +use UnicaenImport\Entity\Db\Interfaces\ImportAwareInterface; +use UnicaenImport\Entity\Db\Traits\ImportAwareTrait; use Zend\Permissions\Acl\Resource\ResourceInterface; /** * CentreCoutEp */ -class CentreCoutEp implements HistoriqueAwareInterface, ResourceInterface +class CentreCoutEp implements HistoriqueAwareInterface, ResourceInterface, ImportAwareInterface { use HistoriqueAwareTrait; - - /** - * @var string - */ - private $sourceCode; + use ImportAwareTrait; /** * @var integer */ private $id; - /** - * @var \Application\Entity\Db\Source - */ - private $source; - /** * @var \Application\Entity\Db\ElementPedagogique */ @@ -44,34 +38,6 @@ class CentreCoutEp implements HistoriqueAwareInterface, ResourceInterface - /** - * Set sourceCode - * - * @param string $sourceCode - * - * @return CentreCoutEp - */ - public function setSourceCode($sourceCode) - { - $this->sourceCode = $sourceCode; - - return $this; - } - - - - /** - * Get sourceCode - * - * @return string - */ - public function getSourceCode() - { - return $this->sourceCode; - } - - - /** * Get id * @@ -84,34 +50,6 @@ class CentreCoutEp implements HistoriqueAwareInterface, ResourceInterface - /** - * Set source - * - * @param \Application\Entity\Db\Source $source - * - * @return CentreCoutEp - */ - public function setSource(\Application\Entity\Db\Source $source = null) - { - $this->source = $source; - - return $this; - } - - - - /** - * Get source - * - * @return \Application\Entity\Db\Source - */ - public function getSource() - { - return $this->source; - } - - - /** * Set elementPedagogique * diff --git a/module/Application/src/Application/Entity/Db/CheminPedagogique.php b/module/Application/src/Application/Entity/Db/CheminPedagogique.php index 61f31219436420cdc3c8fccb261f872b03b5275d..0aa72299c18c330c56ccf6e88f068fd0fa50070d 100644 --- a/module/Application/src/Application/Entity/Db/CheminPedagogique.php +++ b/module/Application/src/Application/Entity/Db/CheminPedagogique.php @@ -3,34 +3,27 @@ namespace Application\Entity\Db; use UnicaenApp\Entity\HistoriqueAwareInterface; use UnicaenApp\Entity\HistoriqueAwareTrait; +use UnicaenImport\Entity\Db\Interfaces\ImportAwareInterface; +use UnicaenImport\Entity\Db\Traits\ImportAwareTrait; /** * CheminPedagogique */ -class CheminPedagogique implements HistoriqueAwareInterface +class CheminPedagogique implements HistoriqueAwareInterface, ImportAwareInterface { use HistoriqueAwareTrait; + use ImportAwareTrait; /** * @var integer */ protected $ordre; - /** - * @var string - */ - protected $sourceCode; - /** * @var integer */ protected $id; - /** - * @var \Application\Entity\Db\Source - */ - protected $source; - /** * @var \Application\Entity\Db\ElementPedagogique */ @@ -71,34 +64,6 @@ class CheminPedagogique implements HistoriqueAwareInterface - /** - * Set sourceCode - * - * @param string $sourceCode - * - * @return CheminPedagogique - */ - public function setSourceCode($sourceCode) - { - $this->sourceCode = $sourceCode; - - return $this; - } - - - - /** - * Get sourceCode - * - * @return string - */ - public function getSourceCode() - { - return $this->sourceCode; - } - - - /** * Get id * @@ -111,34 +76,6 @@ class CheminPedagogique implements HistoriqueAwareInterface - /** - * Set source - * - * @param \Application\Entity\Db\Source $source - * - * @return CheminPedagogique - */ - public function setSource(\Application\Entity\Db\Source $source = null) - { - $this->source = $source; - - return $this; - } - - - - /** - * Get source - * - * @return \Application\Entity\Db\Source - */ - public function getSource() - { - return $this->source; - } - - - /** * Set elementPedagogique * diff --git a/module/Application/src/Application/Entity/Db/Corps.php b/module/Application/src/Application/Entity/Db/Corps.php index 1b1f15d974510a9d77c154f59b65bcac077b6a15..ea162d65885cdb4fe67a9877a1e691c75fe2bbdf 100644 --- a/module/Application/src/Application/Entity/Db/Corps.php +++ b/module/Application/src/Application/Entity/Db/Corps.php @@ -1,15 +1,19 @@ <?php namespace Application\Entity\Db; + use UnicaenApp\Entity\HistoriqueAwareInterface; use UnicaenApp\Entity\HistoriqueAwareTrait; +use UnicaenImport\Entity\Db\Interfaces\ImportAwareInterface; +use UnicaenImport\Entity\Db\Traits\ImportAwareTrait; /** * Corps */ -class Corps implements HistoriqueAwareInterface +class Corps implements HistoriqueAwareInterface, ImportAwareInterface { use HistoriqueAwareTrait; + use ImportAwareTrait; /** * @var string @@ -21,21 +25,11 @@ class Corps implements HistoriqueAwareInterface */ protected $libelleLong; - /** - * @var string - */ - protected $sourceCode; - /** * @var integer */ protected $id; - /** - * @var \Application\Entity\Db\Source - */ - protected $source; - /** @@ -94,34 +88,6 @@ class Corps implements HistoriqueAwareInterface - /** - * Set sourceCode - * - * @param string $sourceCode - * - * @return Corps - */ - public function setSourceCode($sourceCode) - { - $this->sourceCode = $sourceCode; - - return $this; - } - - - - /** - * Get sourceCode - * - * @return string - */ - public function getSourceCode() - { - return $this->sourceCode; - } - - - /** * Get id * @@ -134,32 +100,6 @@ class Corps implements HistoriqueAwareInterface - /** - * Set source - * - * @param \Application\Entity\Db\Source $source - * - * @return Corps - */ - public function setSource(\Application\Entity\Db\Source $source = null) - { - $this->source = $source; - - return $this; - } - - - - /** - * Get source - * - * @return \Application\Entity\Db\Source - */ - public function getSource() - { - return $this->source; - } - diff --git a/module/Application/src/Application/Entity/Db/Departement.php b/module/Application/src/Application/Entity/Db/Departement.php index a8beb59d29079c6e8ac850442d97c6fdd8f67af8..d416c6e5931245e44eb71885b9a335188528a391 100644 --- a/module/Application/src/Application/Entity/Db/Departement.php +++ b/module/Application/src/Application/Entity/Db/Departement.php @@ -3,13 +3,16 @@ namespace Application\Entity\Db; use UnicaenApp\Entity\HistoriqueAwareInterface; use UnicaenApp\Entity\HistoriqueAwareTrait; +use UnicaenImport\Entity\Db\Interfaces\ImportAwareInterface; +use UnicaenImport\Entity\Db\Traits\ImportAwareTrait; /** * Departement */ -class Departement implements HistoriqueAwareInterface +class Departement implements HistoriqueAwareInterface, ImportAwareInterface { use HistoriqueAwareTrait; + use ImportAwareTrait; /** * @var string @@ -21,20 +24,11 @@ class Departement implements HistoriqueAwareInterface */ protected $libelleLong; - /** - * @var string - */ - protected $sourceCode; - /** * @var integer */ protected $id; - /** - * @var \Application\Entity\Db\Source - */ - protected $source; /** * Retourne la représentation littérale de cet objet. @@ -92,28 +86,6 @@ class Departement implements HistoriqueAwareInterface return $this->libelleLong; } - /** - * Set sourceCode - * - * @param string $sourceCode - * @return Structure - */ - public function setSourceCode($sourceCode) - { - $this->sourceCode = $sourceCode; - - return $this; - } - - /** - * Get sourceCode - * - * @return string - */ - public function getSourceCode() - { - return $this->sourceCode; - } /** * Get id @@ -125,26 +97,4 @@ class Departement implements HistoriqueAwareInterface return $this->id; } - /** - * Set source - * - * @param \Application\Entity\Db\Source $source - * @return Structure - */ - public function setSource(\Application\Entity\Db\Source $source = null) - { - $this->source = $source; - - return $this; - } - - /** - * Get source - * - * @return \Application\Entity\Db\Source - */ - public function getSource() - { - return $this->source; - } } diff --git a/module/Application/src/Application/Entity/Db/Discipline.php b/module/Application/src/Application/Entity/Db/Discipline.php index db5a0e80e8d3ce9095b67307bde3a194b47a9101..77fc26947d70d410680c7d2f587c52cc572287a6 100644 --- a/module/Application/src/Application/Entity/Db/Discipline.php +++ b/module/Application/src/Application/Entity/Db/Discipline.php @@ -5,13 +5,16 @@ namespace Application\Entity\Db; use Doctrine\ORM\Mapping as ORM; use UnicaenApp\Entity\HistoriqueAwareInterface; use UnicaenApp\Entity\HistoriqueAwareTrait; +use UnicaenImport\Entity\Db\Interfaces\ImportAwareInterface; +use UnicaenImport\Entity\Db\Traits\ImportAwareTrait; /** * Discipline */ -class Discipline implements HistoriqueAwareInterface +class Discipline implements HistoriqueAwareInterface, ImportAwareInterface { use HistoriqueAwareTrait; + use ImportAwareTrait; /** * @var string @@ -23,11 +26,6 @@ class Discipline implements HistoriqueAwareInterface */ protected $libelleLong; - /** - * @var string - */ - protected $sourceCode; - /** * @var string */ @@ -53,11 +51,6 @@ class Discipline implements HistoriqueAwareInterface */ protected $id; - /** - * @var \Application\Entity\Db\Source - */ - protected $source; - /** @@ -116,34 +109,6 @@ class Discipline implements HistoriqueAwareInterface - /** - * Set sourceCode - * - * @param string $sourceCode - * - * @return Discipline - */ - public function setSourceCode($sourceCode) - { - $this->sourceCode = $sourceCode; - - return $this; - } - - - - /** - * Get sourceCode - * - * @return string - */ - public function getSourceCode() - { - return $this->sourceCode; - } - - - /** * @return string */ @@ -252,37 +217,9 @@ class Discipline implements HistoriqueAwareInterface - /** - * Set source - * - * @param \Application\Entity\Db\Source $source - * - * @return Discipline - */ - public function setSource(\Application\Entity\Db\Source $source = null) - { - $this->source = $source; - - return $this; - } - - - - /** - * Get source - * - * @return \Application\Entity\Db\Source - */ - public function getSource() - { - return $this->source; - } - - - public function __toString() { - return $this->getSourceCode().' '.$this->getLibelleLong(); + return $this->getSourceCode() . ' ' . $this->getLibelleLong(); } } diff --git a/module/Application/src/Application/Entity/Db/DomaineFonctionnel.php b/module/Application/src/Application/Entity/Db/DomaineFonctionnel.php index dff7311ce5535e3914d9f184fee463de2f826de0..3de281a77d430ec01e52ffe1a0113c404919a8cc 100644 --- a/module/Application/src/Application/Entity/Db/DomaineFonctionnel.php +++ b/module/Application/src/Application/Entity/Db/DomaineFonctionnel.php @@ -5,34 +5,27 @@ namespace Application\Entity\Db; use Doctrine\ORM\Mapping as ORM; use UnicaenApp\Entity\HistoriqueAwareInterface; use UnicaenApp\Entity\HistoriqueAwareTrait; +use UnicaenImport\Entity\Db\Interfaces\ImportAwareInterface; +use UnicaenImport\Entity\Db\Traits\ImportAwareTrait; /** * DomaineFonctionnel */ -class DomaineFonctionnel implements HistoriqueAwareInterface +class DomaineFonctionnel implements HistoriqueAwareInterface, ImportAwareInterface { use HistoriqueAwareTrait; + use ImportAwareTrait; /** * @var string */ private $libelle; - /** - * @var string - */ - private $sourceCode; - /** * @var integer */ private $id; - /** - * @var \Application\Entity\Db\Source - */ - private $source; - /** @@ -75,34 +68,6 @@ class DomaineFonctionnel implements HistoriqueAwareInterface - /** - * Set sourceCode - * - * @param string $sourceCode - * - * @return DomaineFonctionnel - */ - public function setSourceCode($sourceCode) - { - $this->sourceCode = $sourceCode; - - return $this; - } - - - - /** - * Get sourceCode - * - * @return string - */ - public function getSourceCode() - { - return $this->sourceCode; - } - - - /** * Get id * @@ -113,32 +78,4 @@ class DomaineFonctionnel implements HistoriqueAwareInterface return $this->id; } - - - /** - * Set source - * - * @param \Application\Entity\Db\Source $source - * - * @return DomaineFonctionnel - */ - public function setSource(\Application\Entity\Db\Source $source = null) - { - $this->source = $source; - - return $this; - } - - - - /** - * Get source - * - * @return \Application\Entity\Db\Source - */ - public function getSource() - { - return $this->source; - } - } diff --git a/module/Application/src/Application/Entity/Db/Effectifs.php b/module/Application/src/Application/Entity/Db/Effectifs.php index 4ee1614578b4b900b6b8bac5882e8622e2824eb5..a389df155b159b219d864154f99c53f990ee0ccf 100644 --- a/module/Application/src/Application/Entity/Db/Effectifs.php +++ b/module/Application/src/Application/Entity/Db/Effectifs.php @@ -1,15 +1,19 @@ <?php namespace Application\Entity\Db; + use UnicaenApp\Entity\HistoriqueAwareInterface; use UnicaenApp\Entity\HistoriqueAwareTrait; +use UnicaenImport\Entity\Db\Interfaces\ImportAwareInterface; +use UnicaenImport\Entity\Db\Traits\ImportAwareTrait; /** * Effectifs */ -class Effectifs implements HistoriqueAwareInterface +class Effectifs implements HistoriqueAwareInterface, ImportAwareInterface { use HistoriqueAwareTrait; + use ImportAwareTrait; /** * @var integer @@ -26,11 +30,6 @@ class Effectifs implements HistoriqueAwareInterface */ private $fi = '0'; - /** - * @var string - */ - private $sourceCode; - /** * @var integer */ @@ -41,11 +40,6 @@ class Effectifs implements HistoriqueAwareInterface */ private $elementPedagogique; - /** - * @var \Application\Entity\Db\Source - */ - private $source; - /** @@ -132,34 +126,6 @@ class Effectifs implements HistoriqueAwareInterface - /** - * Set sourceCode - * - * @param string $sourceCode - * - * @return Effectifs - */ - public function setSourceCode($sourceCode) - { - $this->sourceCode = $sourceCode; - - return $this; - } - - - - /** - * Get sourceCode - * - * @return string - */ - public function getSourceCode() - { - return $this->sourceCode; - } - - - /** * Get id * @@ -198,33 +164,5 @@ class Effectifs implements HistoriqueAwareInterface return $this->elementPedagogique; } - - - /** - * Set source - * - * @param \Application\Entity\Db\Source $source - * - * @return Effectifs - */ - public function setSource(\Application\Entity\Db\Source $source = null) - { - $this->source = $source; - - return $this; - } - - - - /** - * Get source - * - * @return \Application\Entity\Db\Source - */ - public function getSource() - { - return $this->source; - } - } diff --git a/module/Application/src/Application/Entity/Db/ElementPedagogique.php b/module/Application/src/Application/Entity/Db/ElementPedagogique.php index b1a239f1c5a86ee16b5bb3fa05969852f76c5a81..0af76c770d9823fff1584f9528069b3c324e9f60 100644 --- a/module/Application/src/Application/Entity/Db/ElementPedagogique.php +++ b/module/Application/src/Application/Entity/Db/ElementPedagogique.php @@ -11,31 +11,28 @@ use Application\Entity\Db\Traits\SourceAwareTrait; use Application\Entity\Db\Traits\StructureAwareTrait; use UnicaenApp\Entity\HistoriqueAwareInterface; use UnicaenApp\Entity\HistoriqueAwareTrait; +use UnicaenImport\Entity\Db\Interfaces\ImportAwareInterface; +use UnicaenImport\Entity\Db\Traits\ImportAwareTrait; use Zend\Permissions\Acl\Resource\ResourceInterface; /** * ElementPedagogique */ -class ElementPedagogique implements HistoriqueAwareInterface, AnneeAwareInterface, ResourceInterface +class ElementPedagogique implements HistoriqueAwareInterface, AnneeAwareInterface, ResourceInterface, ImportAwareInterface { use HistoriqueAwareTrait; use DisciplineAwareTrait; use AnneeAwareTrait; use StructureAwareTrait; use PeriodeAwareTrait; - use SourceAwareTrait; use EtapeAwareTrait; + use ImportAwareTrait; /** * @var string */ protected $libelle; - /** - * @var string - */ - protected $sourceCode; - /** * @var integer */ @@ -226,34 +223,6 @@ class ElementPedagogique implements HistoriqueAwareInterface, AnneeAwareInterfac - /** - * Set sourceCode - * - * @param string $sourceCode - * - * @return ElementPedagogique - */ - public function setSourceCode($sourceCode) - { - $this->sourceCode = $sourceCode; - - return $this; - } - - - - /** - * Get sourceCode - * - * @return string - */ - public function getSourceCode() - { - return $this->sourceCode; - } - - - /** * Set tauxFoad * diff --git a/module/Application/src/Application/Entity/Db/Etablissement.php b/module/Application/src/Application/Entity/Db/Etablissement.php index d742b7cf0969a5ee47077722c3530baf79523525..9db0d55baefd4ca4f7d7a68610dcfde2832e459c 100644 --- a/module/Application/src/Application/Entity/Db/Etablissement.php +++ b/module/Application/src/Application/Entity/Db/Etablissement.php @@ -3,13 +3,16 @@ namespace Application\Entity\Db; use UnicaenApp\Entity\HistoriqueAwareInterface; use UnicaenApp\Entity\HistoriqueAwareTrait; +use UnicaenImport\Entity\Db\Interfaces\ImportAwareInterface; +use UnicaenImport\Entity\Db\Traits\ImportAwareTrait; /** * Etablissement */ -class Etablissement implements HistoriqueAwareInterface +class Etablissement implements HistoriqueAwareInterface, ImportAwareInterface { use HistoriqueAwareTrait; + use ImportAwareTrait; /** * @var string @@ -26,20 +29,11 @@ class Etablissement implements HistoriqueAwareInterface */ protected $localisation; - /** - * @var string - */ - protected $sourceCode; - /** * @var integer */ protected $id; - /** - * @var \Application\Entity\Db\Source - */ - protected $source; @@ -127,34 +121,6 @@ class Etablissement implements HistoriqueAwareInterface - /** - * Set sourceCode - * - * @param string $sourceCode - * - * @return Etablissement - */ - public function setSourceCode($sourceCode) - { - $this->sourceCode = $sourceCode; - - return $this; - } - - - - /** - * Get sourceCode - * - * @return string - */ - public function getSourceCode() - { - return $this->sourceCode; - } - - - /** * Get id * @@ -167,33 +133,6 @@ class Etablissement implements HistoriqueAwareInterface - /** - * Set source - * - * @param \Application\Entity\Db\Source $source - * - * @return Etablissement - */ - public function setSource(\Application\Entity\Db\Source $source = null) - { - $this->source = $source; - - return $this; - } - - - - /** - * Get source - * - * @return \Application\Entity\Db\Source - */ - public function getSource() - { - return $this->source; - } - - /************************************************************************************************** * Début ajout **************************************************************************************************/ diff --git a/module/Application/src/Application/Entity/Db/Etape.php b/module/Application/src/Application/Entity/Db/Etape.php index c0f62291c8ebdb39529e15f0f125e549a154d036..2cc2c754b8eadd02957c9daa58bee1c3fcb2a3ff 100644 --- a/module/Application/src/Application/Entity/Db/Etape.php +++ b/module/Application/src/Application/Entity/Db/Etape.php @@ -4,14 +4,17 @@ namespace Application\Entity\Db; use UnicaenApp\Entity\HistoriqueAwareInterface; use UnicaenApp\Entity\HistoriqueAwareTrait; +use UnicaenImport\Entity\Db\Interfaces\ImportAwareInterface; +use UnicaenImport\Entity\Db\Traits\ImportAwareTrait; use Zend\Permissions\Acl\Resource\ResourceInterface; /** * Etape */ -class Etape implements HistoriqueAwareInterface, ResourceInterface +class Etape implements HistoriqueAwareInterface, ResourceInterface, ImportAwareInterface { use HistoriqueAwareTrait; + use ImportAwareTrait; @@ -54,11 +57,6 @@ class Etape implements HistoriqueAwareInterface, ResourceInterface */ private $niveauFormation; - /** - * @var string - */ - protected $sourceCode; - /** * @var boolean */ @@ -89,11 +87,6 @@ class Etape implements HistoriqueAwareInterface, ResourceInterface */ protected $typeFormation; - /** - * @var \Application\Entity\Db\Source - */ - protected $source; - /** * @var \Application\Entity\Db\DomaineFonctionnel */ @@ -172,34 +165,6 @@ class Etape implements HistoriqueAwareInterface, ResourceInterface - /** - * Set sourceCode - * - * @param string $sourceCode - * - * @return Etape - */ - public function setSourceCode($sourceCode) - { - $this->sourceCode = $sourceCode; - - return $this; - } - - - - /** - * Get sourceCode - * - * @return string - */ - public function getSourceCode() - { - return $this->sourceCode; - } - - - /** * Set specifiqueEchanges * @@ -404,34 +369,6 @@ class Etape implements HistoriqueAwareInterface, ResourceInterface - /** - * Set source - * - * @param \Application\Entity\Db\Source $source - * - * @return Etape - */ - public function setSource(\Application\Entity\Db\Source $source = null) - { - $this->source = $source; - - return $this; - } - - - - /** - * Get source - * - * @return \Application\Entity\Db\Source - */ - public function getSource() - { - return $this->source; - } - - - /** * Returns the string identifier of the Resource * diff --git a/module/Application/src/Application/Entity/Db/Grade.php b/module/Application/src/Application/Entity/Db/Grade.php index e093a89dd4281ed8e7f6d211dfceadbc58ca5112..08370dd06c900d9d1c330e55c6e36c12de02faa4 100644 --- a/module/Application/src/Application/Entity/Db/Grade.php +++ b/module/Application/src/Application/Entity/Db/Grade.php @@ -6,15 +6,17 @@ use Application\Entity\Db\Traits\CorpsAwareTrait; use Application\Entity\Db\Traits\SourceAwareTrait; use UnicaenApp\Entity\HistoriqueAwareInterface; use UnicaenApp\Entity\HistoriqueAwareTrait; +use UnicaenImport\Entity\Db\Interfaces\ImportAwareInterface; +use UnicaenImport\Entity\Db\Traits\ImportAwareTrait; /** * Grade */ -class Grade implements HistoriqueAwareInterface +class Grade implements HistoriqueAwareInterface, ImportAwareInterface { use HistoriqueAwareTrait; use CorpsAwareTrait; - use SourceAwareTrait; + use ImportAwareTrait; /** * @var integer @@ -36,11 +38,6 @@ class Grade implements HistoriqueAwareInterface */ protected $echelle; - /** - * @var string - */ - protected $sourceCode; - /** @@ -135,34 +132,6 @@ class Grade implements HistoriqueAwareInterface - /** - * Set sourceCode - * - * @param string $sourceCode - * - * @return Corps - */ - public function setSourceCode($sourceCode) - { - $this->sourceCode = $sourceCode; - - return $this; - } - - - - /** - * Get sourceCode - * - * @return string - */ - public function getSourceCode() - { - return $this->sourceCode; - } - - - /** * Retourne la représentation littérale de cet objet. * diff --git a/module/Application/src/Application/Entity/Db/GroupeTypeFormation.php b/module/Application/src/Application/Entity/Db/GroupeTypeFormation.php index a4abc60364e395e0fc055cf47db829bad1451359..eb97937ca56c383b48dbca89ad59ea3412ea52a2 100644 --- a/module/Application/src/Application/Entity/Db/GroupeTypeFormation.php +++ b/module/Application/src/Application/Entity/Db/GroupeTypeFormation.php @@ -5,13 +5,16 @@ namespace Application\Entity\Db; use Doctrine\ORM\Mapping as ORM; use UnicaenApp\Entity\HistoriqueAwareInterface; use UnicaenApp\Entity\HistoriqueAwareTrait; +use UnicaenImport\Entity\Db\Interfaces\ImportAwareInterface; +use UnicaenImport\Entity\Db\Traits\ImportAwareTrait; /** * GroupeTypeFormation */ -class GroupeTypeFormation implements HistoriqueAwareInterface +class GroupeTypeFormation implements HistoriqueAwareInterface, ImportAwareInterface { use HistoriqueAwareTrait; + use ImportAwareTrait; /** * @var string @@ -33,21 +36,11 @@ class GroupeTypeFormation implements HistoriqueAwareInterface */ protected $pertinenceNiveau; - /** - * @var string - */ - protected $sourceCode; - /** * @var integer */ protected $id; - /** - * @var \Application\Entity\Db\Source - */ - protected $source; - /** @@ -162,34 +155,6 @@ class GroupeTypeFormation implements HistoriqueAwareInterface - /** - * Set sourceCode - * - * @param string $sourceCode - * - * @return GroupeTypeFormation - */ - public function setSourceCode($sourceCode) - { - $this->sourceCode = $sourceCode; - - return $this; - } - - - - /** - * Get sourceCode - * - * @return string - */ - public function getSourceCode() - { - return $this->sourceCode; - } - - - /** * Get id * @@ -202,34 +167,6 @@ class GroupeTypeFormation implements HistoriqueAwareInterface - /** - * Set source - * - * @param \Application\Entity\Db\Source $source - * - * @return GroupeTypeFormation - */ - public function setSource(\Application\Entity\Db\Source $source = null) - { - $this->source = $source; - - return $this; - } - - - - /** - * Get source - * - * @return \Application\Entity\Db\Source - */ - public function getSource() - { - return $this->source; - } - - - public function __toString() { return $this->getLibelleLong(); diff --git a/module/Application/src/Application/Entity/Db/Indicateur/AbstractIndicateur.php b/module/Application/src/Application/Entity/Db/Indicateur/AbstractIndicateur.php index 5389b76a81ab3b47cb7273b627c31373bf3e67c5..9df8709ea322dae7f5fd51bafa3f391f43dc6187 100644 --- a/module/Application/src/Application/Entity/Db/Indicateur/AbstractIndicateur.php +++ b/module/Application/src/Application/Entity/Db/Indicateur/AbstractIndicateur.php @@ -66,7 +66,7 @@ abstract class AbstractIndicateur public function getUrlParams() { return [ - 'intervenant' => $this->getIntervenant()->getSourceCode(), + 'intervenant' => $this->getIntervenant()->getRouteParam(), ]; } diff --git a/module/Application/src/Application/Entity/Db/Interfaces/SourceAwareInterface.php b/module/Application/src/Application/Entity/Db/Interfaces/SourceAwareInterface.php deleted file mode 100755 index 5a08155560e0c49b3562728112cde5ad621cd3de..0000000000000000000000000000000000000000 --- a/module/Application/src/Application/Entity/Db/Interfaces/SourceAwareInterface.php +++ /dev/null @@ -1,26 +0,0 @@ -<?php - -namespace Application\Entity\Db\Interfaces; - -use Application\Entity\Db\Source; - -/** - * Description of SourceAwareInterface - * - * @author UnicaenCode - */ -interface SourceAwareInterface -{ - /** - * @param Source $source - * @return self - */ - public function setSource( Source $source = null ); - - - - /** - * @return Source - */ - public function getSource(); -} \ No newline at end of file diff --git a/module/Application/src/Application/Entity/Db/Intervenant.php b/module/Application/src/Application/Entity/Db/Intervenant.php index 6d922325ccba44b03a294b394b1ad2c83a1d1699..19bd701e75631ef578aec8aba719dd55a12caa3b 100644 --- a/module/Application/src/Application/Entity/Db/Intervenant.php +++ b/module/Application/src/Application/Entity/Db/Intervenant.php @@ -7,6 +7,8 @@ use Application\Entity\Db\Traits\DossierAwareTrait; use Application\Entity\Db\Traits\GradeAwareTrait; use UnicaenApp\Entity\HistoriqueAwareInterface; use UnicaenApp\Entity\HistoriqueAwareTrait; +use UnicaenImport\Entity\Db\Interfaces\ImportAwareInterface; +use UnicaenImport\Entity\Db\Traits\ImportAwareTrait; use Zend\Form\Annotation; use Application\Constants; use Zend\Permissions\Acl\Resource\ResourceInterface; @@ -19,12 +21,13 @@ use Application\Entity\Db\Interfaces\AnneeAwareInterface; * @Annotation\Type("Application\Form\Intervenant\AjouterModifier") * @Annotation\Hydrator("Application\Entity\Db\Hydrator\Intervenant") */ -class Intervenant implements IntervenantInterface, HistoriqueAwareInterface, ResourceInterface, AnneeAwareInterface +class Intervenant implements IntervenantInterface, HistoriqueAwareInterface, ResourceInterface, AnneeAwareInterface, ImportAwareInterface { use HistoriqueAwareTrait; use GradeAwareTrait; use DisciplineAwareTrait; use DossierAwareTrait; + use ImportAwareTrait; /** * @var \DateTime @@ -123,11 +126,6 @@ class Intervenant implements IntervenantInterface, HistoriqueAwareInterface, Res */ protected $prenom; - /** - * @var string - */ - protected $sourceCode; - /** * @var string */ @@ -176,11 +174,6 @@ class Intervenant implements IntervenantInterface, HistoriqueAwareInterface, Res */ protected $adressePrinc; - /** - * @var \Application\Entity\Db\Source - */ - protected $source; - /** * @var \Application\Entity\Db\StatutIntervenant */ @@ -730,34 +723,6 @@ class Intervenant implements IntervenantInterface, HistoriqueAwareInterface, Res - /** - * Set sourceCode - * - * @param string $sourceCode - * - * @return Intervenant - */ - public function setSourceCode($sourceCode) - { - $this->sourceCode = $sourceCode; - - return $this; - } - - - - /** - * Get sourceCode - * - * @return string - */ - public function getSourceCode() - { - return $this->sourceCode; - } - - - /** * Set telMobile * @@ -990,34 +955,6 @@ class Intervenant implements IntervenantInterface, HistoriqueAwareInterface, Res - /** - * Set source - * - * @param \Application\Entity\Db\Source $source - * - * @return Intervenant - */ - public function setSource(\Application\Entity\Db\Source $source = null) - { - $this->source = $source; - - return $this; - } - - - - /** - * Get source - * - * @return \Application\Entity\Db\Source - */ - public function getSource() - { - return $this->source; - } - - - /** * Set statut * @@ -2009,4 +1946,16 @@ class Intervenant implements IntervenantInterface, HistoriqueAwareInterface, Res { return 'Intervenant'; } + + + + /** + * retourne le paramètre de route + * + * @return string + */ + public function getRouteParam() + { + return $this->getSourceCode(); + } } diff --git a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.AdresseIntervenant.dcm.xml b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.AdresseIntervenant.dcm.xml index 148488f2303768110eb5cb877c03357e195be7fa..71e372f957e2387baed0f387cc55dc1fa3c0b995 100644 --- a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.AdresseIntervenant.dcm.xml +++ b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.AdresseIntervenant.dcm.xml @@ -34,7 +34,7 @@ <join-column name="INTERVENANT_ID" referenced-column-name="ID"/> </join-columns> </many-to-one> - <many-to-one field="source" target-entity="Application\Entity\Db\Source"> + <many-to-one field="source" target-entity="UnicaenImport\Entity\Db\Source"> <join-columns> <join-column name="SOURCE_ID" referenced-column-name="ID"/> </join-columns> diff --git a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.AdresseStructure.dcm.xml b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.AdresseStructure.dcm.xml index aaf7f6a2a443a4b72d8c0ab89b07fd1b537361db..afcf833926de013af568d4dc025d8c17d983a4e6 100644 --- a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.AdresseStructure.dcm.xml +++ b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.AdresseStructure.dcm.xml @@ -32,7 +32,7 @@ <join-column name="STRUCTURE_ID" referenced-column-name="ID"/> </join-columns> </many-to-one> - <many-to-one field="source" target-entity="Application\Entity\Db\Source"> + <many-to-one field="source" target-entity="UnicaenImport\Entity\Db\Source"> <join-columns> <join-column name="SOURCE_ID" referenced-column-name="ID"/> </join-columns> diff --git a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Affectation.dcm.xml b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Affectation.dcm.xml index 5138bf30df1ee35fc382577c5bb8778ab7a9137e..908fa59998cd9b2bcc83fda4b2327afc61c59cdc 100644 --- a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Affectation.dcm.xml +++ b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Affectation.dcm.xml @@ -31,7 +31,7 @@ <join-column name="ROLE_ID" referenced-column-name="ID"/> </join-columns> </many-to-one> - <many-to-one field="source" target-entity="Application\Entity\Db\Source"> + <many-to-one field="source" target-entity="UnicaenImport\Entity\Db\Source"> <join-columns> <join-column name="SOURCE_ID" referenced-column-name="ID"/> </join-columns> diff --git a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.AffectationRecherche.dcm.xml b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.AffectationRecherche.dcm.xml index 7215fc65bb26b5c3ac3233e26a7156921baed75d..b95700f1c6b3666e09134a0162d4e50e41deb5dc 100644 --- a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.AffectationRecherche.dcm.xml +++ b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.AffectationRecherche.dcm.xml @@ -20,7 +20,7 @@ <field name="histoDestruction" type="datetime" column="HISTO_DESTRUCTION" nullable="true"/> <field name="histoModification" type="datetime" column="HISTO_MODIFICATION" nullable="false"/> <field name="sourceCode" type="string" column="SOURCE_CODE" length="100" nullable="true"/> - <many-to-one field="source" target-entity="Application\Entity\Db\Source"> + <many-to-one field="source" target-entity="UnicaenImport\Entity\Db\Source"> <join-columns> <join-column name="SOURCE_ID" referenced-column-name="ID"/> </join-columns> diff --git a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.CentreCout.dcm.xml b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.CentreCout.dcm.xml index 1e8a71dcbce29c8eafabcd3f310c05251f6504f9..c0b72a9820fc9dd3eccea1dfc7077cc8d76a74fc 100644 --- a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.CentreCout.dcm.xml +++ b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.CentreCout.dcm.xml @@ -38,7 +38,7 @@ <join-column name="TYPE_RESSOURCE_ID" referenced-column-name="ID"/> </join-columns> </many-to-one> - <many-to-one field="source" target-entity="Application\Entity\Db\Source"> + <many-to-one field="source" target-entity="UnicaenImport\Entity\Db\Source"> <join-columns> <join-column name="SOURCE_ID" referenced-column-name="ID"/> </join-columns> diff --git a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.CentreCoutEp.dcm.xml b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.CentreCoutEp.dcm.xml index 20427db1013f2d73c1216b003ce33240461ee87e..046e4c1690784f36d26c6f490a67fc9af9e67f4c 100644 --- a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.CentreCoutEp.dcm.xml +++ b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.CentreCoutEp.dcm.xml @@ -31,7 +31,7 @@ <join-column name="HISTO_CREATEUR_ID" referenced-column-name="ID"/> </join-columns> </many-to-one> - <many-to-one field="source" target-entity="Application\Entity\Db\Source"> + <many-to-one field="source" target-entity="UnicaenImport\Entity\Db\Source"> <join-columns> <join-column name="SOURCE_ID" referenced-column-name="ID"/> </join-columns> diff --git a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.CheminPedagogique.dcm.xml b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.CheminPedagogique.dcm.xml index 0fdd3433738223e60df7f1d9d6518e634fdab7ad..953532a0e9ab5c172cd188c3165bd98e83796abb 100644 --- a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.CheminPedagogique.dcm.xml +++ b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.CheminPedagogique.dcm.xml @@ -21,7 +21,7 @@ <field name="histoModification" type="datetime" column="HISTO_MODIFICATION" nullable="false"/> <field name="ordre" type="integer" column="ORDRE" nullable="false"/> <field name="sourceCode" type="string" column="SOURCE_CODE" length="100" nullable="true"/> - <many-to-one field="source" target-entity="Application\Entity\Db\Source"> + <many-to-one field="source" target-entity="UnicaenImport\Entity\Db\Source"> <join-columns> <join-column name="SOURCE_ID" referenced-column-name="ID"/> </join-columns> diff --git a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Corps.dcm.xml b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Corps.dcm.xml index 17137ff4cf61529745adada116c643c24c822073..e0c6ae569b2336c714db107cd63173e0daf03b38 100644 --- a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Corps.dcm.xml +++ b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Corps.dcm.xml @@ -19,7 +19,7 @@ <field name="libelleCourt" type="string" column="LIBELLE_COURT" length="20" nullable="false"/> <field name="libelleLong" type="string" column="LIBELLE_LONG" length="40" nullable="false"/> <field name="sourceCode" type="string" column="SOURCE_CODE" length="100" nullable="true"/> - <many-to-one field="source" target-entity="Application\Entity\Db\Source"> + <many-to-one field="source" target-entity="UnicaenImport\Entity\Db\Source"> <join-columns> <join-column name="SOURCE_ID" referenced-column-name="ID"/> </join-columns> diff --git a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Departement.dcm.xml b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Departement.dcm.xml index 66ae48076cdb3acb92886ea28d1671e6158cd49a..2ff4fc50998cdd95aea385897a2f7e8e943b395e 100644 --- a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Departement.dcm.xml +++ b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Departement.dcm.xml @@ -10,7 +10,7 @@ <field name="histoCreation" type="datetime" column="HISTO_CREATION" nullable="false"/> <field name="histoDestruction" type="datetime" column="HISTO_DESTRUCTION" nullable="true"/> <field name="histoModification" type="datetime" column="HISTO_MODIFICATION" nullable="false"/> - <many-to-one field="source" target-entity="Application\Entity\Db\Source"> + <many-to-one field="source" target-entity="UnicaenImport\Entity\Db\Source"> <join-columns> <join-column name="SOURCE_ID" referenced-column-name="ID"/> </join-columns> diff --git a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Discipline.dcm.xml b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Discipline.dcm.xml index ff67a97652208774c2cedafbd2aa6acc39eaab48..c0dabfe0b65828ac24f6481536d4e1b008e21de8 100644 --- a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Discipline.dcm.xml +++ b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Discipline.dcm.xml @@ -23,7 +23,7 @@ <field name="codesCorresp2" type="string" column="CODES_CORRESP_2" length="255" nullable="true"/> <field name="codesCorresp3" type="string" column="CODES_CORRESP_3" length="255" nullable="true"/> <field name="codesCorresp4" type="string" column="CODES_CORRESP_4" length="255" nullable="true"/> - <many-to-one field="source" target-entity="Application\Entity\Db\Source"> + <many-to-one field="source" target-entity="UnicaenImport\Entity\Db\Source"> <join-columns> <join-column name="SOURCE_ID" referenced-column-name="ID"/> </join-columns> diff --git a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.DomaineFonctionnel.dcm.xml b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.DomaineFonctionnel.dcm.xml index 16640f9408b16f6197e53071e6fc183763723108..5b9162d19180df245d18139da5794fa62b666ef5 100644 --- a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.DomaineFonctionnel.dcm.xml +++ b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.DomaineFonctionnel.dcm.xml @@ -15,7 +15,7 @@ <field name="histoModification" type="datetime" column="HISTO_MODIFICATION" nullable="false"/> <field name="libelle" type="string" column="LIBELLE" length="200" nullable="false"/> <field name="sourceCode" type="string" column="SOURCE_CODE" length="100" nullable="false"/> - <many-to-one field="source" target-entity="Application\Entity\Db\Source"> + <many-to-one field="source" target-entity="UnicaenImport\Entity\Db\Source"> <join-columns> <join-column name="SOURCE_ID" referenced-column-name="ID"/> </join-columns> diff --git a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Effectifs.dcm.xml b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Effectifs.dcm.xml index 45dc60556d23cddf3c98fa2ee70ebc189a6043a0..fa7c55868b4716f3e18f78b2f4f0dd7f74127eb2 100644 --- a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Effectifs.dcm.xml +++ b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Effectifs.dcm.xml @@ -49,7 +49,7 @@ <join-column name="HISTO_MODIFICATEUR_ID" referenced-column-name="ID"/> </join-columns> </many-to-one> - <many-to-one field="source" target-entity="Application\Entity\Db\Source" fetch="LAZY"> + <many-to-one field="source" target-entity="UnicaenImport\Entity\Db\Source" fetch="LAZY"> <join-columns> <join-column name="SOURCE_ID" referenced-column-name="ID"/> </join-columns> diff --git a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.ElementPedagogique.dcm.xml b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.ElementPedagogique.dcm.xml index 070c8333ce6df90976c277eb967b78cac3fc8133..88739c02faee015553b4a960158091d057d8abbb 100644 --- a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.ElementPedagogique.dcm.xml +++ b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.ElementPedagogique.dcm.xml @@ -36,7 +36,7 @@ <join-column name="DISCIPLINE_ID" referenced-column-name="ID"/> </join-columns> </many-to-one> - <many-to-one field="source" target-entity="Application\Entity\Db\Source"> + <many-to-one field="source" target-entity="UnicaenImport\Entity\Db\Source"> <join-columns> <join-column name="SOURCE_ID" referenced-column-name="ID"/> </join-columns> diff --git a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Etablissement.dcm.xml b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Etablissement.dcm.xml index 76ab0ac21c3dc941135d2bd0263b9a20d0863ed1..a1ce3d7e912a6126955457aa46767de5df0f2dc3 100644 --- a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Etablissement.dcm.xml +++ b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Etablissement.dcm.xml @@ -20,7 +20,7 @@ <field name="libelle" type="string" column="LIBELLE" length="100" nullable="false"/> <field name="localisation" type="string" column="LOCALISATION" length="60" nullable="true"/> <field name="sourceCode" type="string" column="SOURCE_CODE" length="100" nullable="true"/> - <many-to-one field="source" target-entity="Application\Entity\Db\Source"> + <many-to-one field="source" target-entity="UnicaenImport\Entity\Db\Source"> <join-columns> <join-column name="SOURCE_ID" referenced-column-name="ID"/> </join-columns> diff --git a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Etape.dcm.xml b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Etape.dcm.xml index ce5467109497aafab14978d2df25b2f9c43e08f0..0a4d7c0e3bff6e562b8cd9d6d38004f500fecd30 100644 --- a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Etape.dcm.xml +++ b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Etape.dcm.xml @@ -32,7 +32,7 @@ <join-column name="TYPE_FORMATION_ID" referenced-column-name="ID"/> </join-columns> </many-to-one> - <many-to-one field="source" target-entity="Application\Entity\Db\Source"> + <many-to-one field="source" target-entity="UnicaenImport\Entity\Db\Source"> <join-columns> <join-column name="SOURCE_ID" referenced-column-name="ID"/> </join-columns> diff --git a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Grade.dcm.xml b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Grade.dcm.xml index ff0eb207e9db557b9fd54e649a26af7b04e8cd5f..38daff85182bce90589d3630a3a3335021597110 100644 --- a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Grade.dcm.xml +++ b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Grade.dcm.xml @@ -25,7 +25,7 @@ <join-column name="CORPS_ID" referenced-column-name="ID"/> </join-columns> </many-to-one> - <many-to-one field="source" target-entity="Application\Entity\Db\Source"> + <many-to-one field="source" target-entity="UnicaenImport\Entity\Db\Source"> <join-columns> <join-column name="SOURCE_ID" referenced-column-name="ID"/> </join-columns> diff --git a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.GroupeTypeFormation.dcm.xml b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.GroupeTypeFormation.dcm.xml index 8a219b3e2bc413949b2c17f1456fc07e944502ff..a37179e7677166cbebcf9a7a37d91401161ca048 100644 --- a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.GroupeTypeFormation.dcm.xml +++ b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.GroupeTypeFormation.dcm.xml @@ -21,7 +21,7 @@ <field name="ordre" type="integer" column="ORDRE" nullable="false"/> <field name="pertinenceNiveau" type="boolean" column="PERTINENCE_NIVEAU" nullable="false"/> <field name="sourceCode" type="string" column="SOURCE_CODE" length="100" nullable="true"/> - <many-to-one field="source" target-entity="Application\Entity\Db\Source"> + <many-to-one field="source" target-entity="UnicaenImport\Entity\Db\Source"> <join-columns> <join-column name="SOURCE_ID" referenced-column-name="ID"/> </join-columns> diff --git a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Intervenant.dcm.xml b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Intervenant.dcm.xml index abcfd5ac60995f0017049d68217dcb42bb6c4914..bac6a379065aebbb48097239fa4ec90777c48e21 100644 --- a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Intervenant.dcm.xml +++ b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Intervenant.dcm.xml @@ -2,7 +2,7 @@ <doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> - <entity name="Application\Entity\Db\Intervenant" table="INTERVENANT" repository-class="Application\Entity\Db\Repository\IntervenantRepository"> + <entity name="Application\Entity\Db\Intervenant" table="INTERVENANT"> <indexes> <index name="IDX_FED386B4C2443469" columns="TYPE_ID"/> <index name="IDX_FED386B48C579EB7" columns="CIVILITE_ID"/> @@ -51,7 +51,7 @@ <join-column name="GRADE_ID" referenced-column-name="ID"/> </join-columns> </many-to-one> - <many-to-one field="source" target-entity="Application\Entity\Db\Source"> + <many-to-one field="source" target-entity="UnicaenImport\Entity\Db\Source"> <join-columns> <join-column name="SOURCE_ID" referenced-column-name="ID"/> </join-columns> diff --git a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Pays.dcm.xml b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Pays.dcm.xml index 345af15300b027d0f677f57e620d372eb1040ee2..68ec221627903ca91cb3cebac56226ea11bd5203 100644 --- a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Pays.dcm.xml +++ b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Pays.dcm.xml @@ -13,7 +13,7 @@ <field name="histoCreation" type="datetime" column="HISTO_CREATION" nullable="false"/> <field name="histoDestruction" type="datetime" column="HISTO_DESTRUCTION" nullable="true"/> <field name="histoModification" type="datetime" column="HISTO_MODIFICATION" nullable="false"/> - <many-to-one field="source" target-entity="Application\Entity\Db\Source"> + <many-to-one field="source" target-entity="UnicaenImport\Entity\Db\Source"> <join-columns> <join-column name="SOURCE_ID" referenced-column-name="ID"/> </join-columns> diff --git a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Personnel.dcm.xml b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Personnel.dcm.xml index 8e08fea70c33d21665b589f2f79cf6e0b05d7cd2..9f589d3d5385331c2775c748107e20f34cd32712 100644 --- a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Personnel.dcm.xml +++ b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Personnel.dcm.xml @@ -23,7 +23,7 @@ <field name="nomUsuel" type="string" column="NOM_USUEL" length="100" nullable="false"/> <field name="prenom" type="string" column="PRENOM" length="60" nullable="false"/> <field name="sourceCode" type="string" column="SOURCE_CODE" length="100" nullable="true"/> - <many-to-one field="source" target-entity="Application\Entity\Db\Source"> + <many-to-one field="source" target-entity="UnicaenImport\Entity\Db\Source"> <join-columns> <join-column name="SOURCE_ID" referenced-column-name="ID"/> </join-columns> diff --git a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Source.dcm.xml b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Source.dcm.xml deleted file mode 100644 index 7d5cb7377ee06eba4e811d7f4e6fd1cbb7a934cc..0000000000000000000000000000000000000000 --- a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Source.dcm.xml +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> - <entity name="Application\Entity\Db\Source" table="SOURCE"> - <unique-constraints> - <unique-constraint name="source_code_un" columns="CODE"/> - </unique-constraints> - <id name="id" type="integer" column="ID"> - <generator strategy="SEQUENCE"/> - </id> - <field name="code" type="string" column="CODE" length="15" nullable="false"/> - <field name="importable" type="boolean" column="IMPORTABLE" nullable="false"/> - <field name="libelle" type="string" column="LIBELLE" length="30" nullable="false"/> - </entity> -</doctrine-mapping> diff --git a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.StatutIntervenant.dcm.xml b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.StatutIntervenant.dcm.xml index 64cd772931b2fd9cf19c37371955d8e661d3c7fb..80548521bc35136522bbeaafdca68e5ca674d461 100644 --- a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.StatutIntervenant.dcm.xml +++ b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.StatutIntervenant.dcm.xml @@ -36,13 +36,14 @@ <field name="peutSaisirDossier" type="boolean" column="PEUT_SAISIR_DOSSIER" nullable="false"/> <field name="peutAvoirContrat" type="boolean" column="PEUT_AVOIR_CONTRAT" nullable="false"/> <field name="peutCloturerSaisie" type="boolean" column="PEUT_CLOTURER_SAISIE" nullable="false"/> + <field name="peutSaisirMotifNonPaiement" type="boolean" column="PEUT_SAISIR_MOTIF_NON_PAIEMENT" nullable="false"/> <field name="temAtv" type="boolean" column="TEM_ATV" nullable="false"/> <many-to-one field="typeIntervenant" target-entity="Application\Entity\Db\TypeIntervenant"> <join-columns> <join-column name="TYPE_INTERVENANT_ID" referenced-column-name="ID"/> </join-columns> </many-to-one> - <many-to-one field="source" target-entity="Application\Entity\Db\Source"> + <many-to-one field="source" target-entity="UnicaenImport\Entity\Db\Source"> <join-columns> <join-column name="SOURCE_ID" referenced-column-name="ID"/> </join-columns> diff --git a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Structure.dcm.xml b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Structure.dcm.xml index c8a87e65f77806c9f6f70fe8b9634e878a7f684a..a83efafd0918433d0214efc61ab83c9ab4e690da 100644 --- a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Structure.dcm.xml +++ b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Structure.dcm.xml @@ -24,7 +24,7 @@ <field name="niveau" type="integer" column="NIVEAU" nullable="false"/> <field name="contactPj" type="string" column="CONTACT_PJ" length="255" nullable="true"/> <field name="sourceCode" type="string" column="SOURCE_CODE" length="100" nullable="true"/> - <many-to-one field="source" target-entity="Application\Entity\Db\Source"> + <many-to-one field="source" target-entity="UnicaenImport\Entity\Db\Source"> <join-columns> <join-column name="SOURCE_ID" referenced-column-name="ID"/> </join-columns> diff --git a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.TypeDotation.dcm.xml b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.TypeDotation.dcm.xml index 77ca5317a2ff7142ebff80c35c01534f1791f7c9..e98824d882f57b8af0b30a515ae740771a0672ea 100644 --- a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.TypeDotation.dcm.xml +++ b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.TypeDotation.dcm.xml @@ -16,7 +16,7 @@ <field name="histoModification" type="datetime" column="HISTO_MODIFICATION" nullable="false"/> <field name="libelle" type="string" column="LIBELLE" length="200" nullable="false"/> <field name="sourceCode" type="string" column="SOURCE_CODE" length="100" nullable="true"/> - <many-to-one field="source" target-entity="Application\Entity\Db\Source"> + <many-to-one field="source" target-entity="UnicaenImport\Entity\Db\Source"> <join-columns> <join-column name="SOURCE_ID" referenced-column-name="ID"/> </join-columns> diff --git a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.TypeFormation.dcm.xml b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.TypeFormation.dcm.xml index 906ee6d7cb494c534d5df49225773861631648c0..b954c95eb0385257aa9a959e67e73f8593996cfb 100644 --- a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.TypeFormation.dcm.xml +++ b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.TypeFormation.dcm.xml @@ -20,7 +20,7 @@ <field name="libelleCourt" type="string" column="LIBELLE_COURT" length="15" nullable="false"/> <field name="libelleLong" type="string" column="LIBELLE_LONG" length="80" nullable="false"/> <field name="sourceCode" type="string" column="SOURCE_CODE" length="100" nullable="true"/> - <many-to-one field="source" target-entity="Application\Entity\Db\Source"> + <many-to-one field="source" target-entity="UnicaenImport\Entity\Db\Source"> <join-columns> <join-column name="SOURCE_ID" referenced-column-name="ID"/> </join-columns> diff --git a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.VolumeHoraireEns.dcm.xml b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.VolumeHoraireEns.dcm.xml index 1c2f22a12cb55ccf8ebdd31101b320caeb3f4ef5..998b7557be0de50a30dbfcd2444201fbf6fdfa85 100644 --- a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.VolumeHoraireEns.dcm.xml +++ b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.VolumeHoraireEns.dcm.xml @@ -26,7 +26,7 @@ <join-column name="HISTO_MODIFICATEUR_ID" referenced-column-name="ID"/> </join-columns> </many-to-one> - <many-to-one field="source" target-entity="Application\Entity\Db\Source"> + <many-to-one field="source" target-entity="UnicaenImport\Entity\Db\Source"> <join-columns> <join-column name="SOURCE_ID" referenced-column-name="ID"/> </join-columns> diff --git a/module/Application/src/Application/Entity/Db/Pays.php b/module/Application/src/Application/Entity/Db/Pays.php index e3044b2bae8849a3b6940b6bb31e0f1a6f6cc9d8..71388658f8150d9cf13630db47c8c8f5400190bc 100644 --- a/module/Application/src/Application/Entity/Db/Pays.php +++ b/module/Application/src/Application/Entity/Db/Pays.php @@ -1,18 +1,22 @@ <?php namespace Application\Entity\Db; + use UnicaenApp\Entity\HistoriqueAwareInterface; use UnicaenApp\Entity\HistoriqueAwareTrait; +use UnicaenImport\Entity\Db\Interfaces\ImportAwareInterface; +use UnicaenImport\Entity\Db\Traits\ImportAwareTrait; /** * Pays */ -class Pays implements HistoriqueAwareInterface +class Pays implements HistoriqueAwareInterface, ImportAwareInterface { use HistoriqueAwareTrait; + use ImportAwareTrait; const CODE_FRANCE = "100"; - + /** * @var string */ @@ -28,21 +32,11 @@ class Pays implements HistoriqueAwareInterface */ protected $temoinUe; - /** - * @var string - */ - protected $sourceCode; - /** * @var integer */ protected $id; - /** - * @var \Application\Entity\Db\Source - */ - protected $source; - /** * @var \DateTime */ @@ -53,9 +47,11 @@ class Pays implements HistoriqueAwareInterface */ protected $validiteFin; + + /** * Retourne la représentation littérale de cet objet. - * + * * @return string */ public function __toString() @@ -63,10 +59,13 @@ class Pays implements HistoriqueAwareInterface return $this->getLibelleLong(); } + + /** * Set libelleCourt * * @param string $libelleCourt + * * @return Structure */ public function setLibelleCourt($libelleCourt) @@ -76,20 +75,25 @@ class Pays implements HistoriqueAwareInterface return $this; } + + /** * Get libelleCourt * - * @return string + * @return string */ public function getLibelleCourt() { return $this->libelleCourt; } + + /** * Set libelleLong * * @param string $libelleLong + * * @return Structure */ public function setLibelleLong($libelleLong) @@ -99,20 +103,25 @@ class Pays implements HistoriqueAwareInterface return $this; } + + /** * Get libelleLong * - * @return string + * @return string */ public function getLibelleLong() { return $this->libelleLong; } + + /** * Set temoinUe * * @param boolean $temoinUe + * * @return Structure */ public function setTemoinUe($temoinUe) @@ -122,76 +131,37 @@ class Pays implements HistoriqueAwareInterface return $this; } + + /** * Get temoinUe * - * @return boolean + * @return boolean */ public function getTemoinUe() { return $this->temoinUe; } - /** - * Set sourceCode - * - * @param string $sourceCode - * @return Structure - */ - public function setSourceCode($sourceCode) - { - $this->sourceCode = $sourceCode; - - return $this; - } - /** - * Get sourceCode - * - * @return string - */ - public function getSourceCode() - { - return $this->sourceCode; - } /** * Get id * - * @return integer + * @return integer */ public function getId() { return $this->id; } - /** - * Set source - * - * @param \Application\Entity\Db\Source $source - * @return Structure - */ - public function setSource(\Application\Entity\Db\Source $source = null) - { - $this->source = $source; - return $this; - } - - /** - * Get source - * - * @return \Application\Entity\Db\Source - */ - public function getSource() - { - return $this->source; - } /** * Set validiteDebut * * @param \DateTime $validiteDebut + * * @return self */ public function setValiditeDebut($validiteDebut) @@ -201,20 +171,25 @@ class Pays implements HistoriqueAwareInterface return $this; } + + /** * Get validiteDebut * - * @return \DateTime + * @return \DateTime */ public function getValiditeDebut() { return $this->validiteDebut; } + + /** * Set validiteFin * * @param \DateTime $validiteFin + * * @return self */ public function setValiditeFin($validiteFin) @@ -224,10 +199,12 @@ class Pays implements HistoriqueAwareInterface return $this; } + + /** * Get validiteFin * - * @return \DateTime + * @return \DateTime */ public function getValiditeFin() { diff --git a/module/Application/src/Application/Entity/Db/Personnel.php b/module/Application/src/Application/Entity/Db/Personnel.php index a64e4f66f35e3e324a201833feb0f7df6d8d949c..213736a9441ed95c9d259dfe447137b099f84041 100644 --- a/module/Application/src/Application/Entity/Db/Personnel.php +++ b/module/Application/src/Application/Entity/Db/Personnel.php @@ -1,15 +1,20 @@ <?php namespace Application\Entity\Db; + use UnicaenApp\Entity\HistoriqueAwareInterface; use UnicaenApp\Entity\HistoriqueAwareTrait; +use UnicaenImport\Entity\Db\Interfaces\ImportAwareInterface; +use UnicaenImport\Entity\Db\Traits\ImportAwareTrait; /** * Personnel */ -class Personnel implements HistoriqueAwareInterface +class Personnel implements HistoriqueAwareInterface, ImportAwareInterface { use HistoriqueAwareTrait; + use ImportAwareTrait; + /** * @var string */ @@ -30,21 +35,11 @@ class Personnel implements HistoriqueAwareInterface */ protected $prenom; - /** - * @var string - */ - protected $sourceCode; - /** * @var integer */ protected $id; - /** - * @var \Application\Entity\Db\Source - */ - protected $source; - /** * @var \Application\Entity\Db\Structure */ @@ -60,18 +55,23 @@ class Personnel implements HistoriqueAwareInterface */ protected $affectation; + + /** - * + * */ public function __construct() { $this->affectation = new \Doctrine\Common\Collections\ArrayCollection(); } + + /** * Set email * * @param string $email + * * @return Personnel */ public function setEmail($email) @@ -81,20 +81,25 @@ class Personnel implements HistoriqueAwareInterface return $this; } + + /** * Get email * - * @return string + * @return string */ public function getEmail() { return $this->email; } + + /** * Set nomPatronymique * * @param string $nomPatronymique + * * @return Personnel */ public function setNomPatronymique($nomPatronymique) @@ -104,20 +109,25 @@ class Personnel implements HistoriqueAwareInterface return $this; } + + /** * Get nomPatronymique * - * @return string + * @return string */ public function getNomPatronymique() { return $this->nomPatronymique; } + + /** * Set nomUsuel * * @param string $nomUsuel + * * @return Personnel */ public function setNomUsuel($nomUsuel) @@ -127,20 +137,25 @@ class Personnel implements HistoriqueAwareInterface return $this; } + + /** * Get nomUsuel * - * @return string + * @return string */ public function getNomUsuel() { return $this->nomUsuel; } + + /** * Set prenom * * @param string $prenom + * * @return Personnel */ public function setPrenom($prenom) @@ -150,76 +165,37 @@ class Personnel implements HistoriqueAwareInterface return $this; } + + /** * Get prenom * - * @return string + * @return string */ public function getPrenom() { return $this->prenom; } - /** - * Set sourceCode - * - * @param string $sourceCode - * @return Personnel - */ - public function setSourceCode($sourceCode) - { - $this->sourceCode = $sourceCode; - - return $this; - } - /** - * Get sourceCode - * - * @return string - */ - public function getSourceCode() - { - return $this->sourceCode; - } /** * Get id * - * @return integer + * @return integer */ public function getId() { return $this->id; } - /** - * Set source - * - * @param \Application\Entity\Db\Source $source - * @return Personnel - */ - public function setSource(\Application\Entity\Db\Source $source = null) - { - $this->source = $source; - - return $this; - } - /** - * Get source - * - * @return \Application\Entity\Db\Source - */ - public function getSource() - { - return $this->source; - } /** * Set structure * * @param \Application\Entity\Db\Structure $structure + * * @return Personnel */ public function setStructure(\Application\Entity\Db\Structure $structure = null) @@ -229,20 +205,25 @@ class Personnel implements HistoriqueAwareInterface return $this; } + + /** * Get structure * - * @return \Application\Entity\Db\Structure + * @return \Application\Entity\Db\Structure */ public function getStructure() { return $this->structure; } + + /** * Set civilite * * @param \Application\Entity\Db\Civilite $civilite + * * @return Personnel */ public function setCivilite(\Application\Entity\Db\Civilite $civilite = null) @@ -252,20 +233,25 @@ class Personnel implements HistoriqueAwareInterface return $this; } + + /** * Get civilite * - * @return \Application\Entity\Db\Civilite + * @return \Application\Entity\Db\Civilite */ public function getCivilite() { return $this->civilite; } + + /** * Add affectation * * @param \Application\Entity\Db\Affectation $affectation + * * @return Personnel */ public function addAffectation(\Application\Entity\Db\Affectation $affectation) @@ -275,6 +261,8 @@ class Personnel implements HistoriqueAwareInterface return $this; } + + /** * Remove affectation * @@ -285,34 +273,40 @@ class Personnel implements HistoriqueAwareInterface $this->affectation->removeElement($affectation); } + + /** * Get affectation * - * @return \Doctrine\Common\Collections\Collection + * @return \Doctrine\Common\Collections\Collection */ public function getAffectation() { return $this->affectation; } - + + + /** * Get civilite * - * @return string + * @return string */ public function getCiviliteToString() { return $this->getCivilite()->getLibelleCourt(); } - + + + /** - * + * * @return string */ public function __toString() { $f = new \Application\Filter\NomCompletFormatter(); - + return $f->filter($this); } } diff --git a/module/Application/src/Application/Entity/Db/Repository/IntervenantRepository.php b/module/Application/src/Application/Entity/Db/Repository/IntervenantRepository.php deleted file mode 100644 index e5dceb5c96b10de6b66b73022f5393333ebf491f..0000000000000000000000000000000000000000 --- a/module/Application/src/Application/Entity/Db/Repository/IntervenantRepository.php +++ /dev/null @@ -1,58 +0,0 @@ -<?php - -namespace Application\Entity\Db\Repository; - -use Doctrine\ORM\EntityRepository; - -/** - * IntervenantRepository - * - * This class was generated by the Doctrine ORM. Add your own custom - * repository methods below. - */ -class IntervenantRepository extends EntityRepository -{ - /** - * Recherche par : - * - id source exact (numéro Harpege ou autre), - * - ou nom usuel (et prénom), - * - ou nom patronymique (et prénom). - * - * @param string $term - * @return \Application\Entity\Db\Intervenant[] - */ - public function findByNomPrenomId($term) - { - $term = str_replace(' ', '', $term); - - $qb = $this->createQueryBuilder('i'); - - $concatNomUsuelPrenom = new \Doctrine\ORM\Query\Expr\Func('CONVERT', - [$qb->expr()->concat('i.nomUsuel', 'i.prenom'), - '?3']); - $concatNomPatroPrenom = new \Doctrine\ORM\Query\Expr\Func('CONVERT', - [$qb->expr()->concat('i.nomPatronymique', 'i.prenom'), - '?3']); - $concatPrenomNomUsuel = new \Doctrine\ORM\Query\Expr\Func('CONVERT', - [$qb->expr()->concat('i.prenom', 'i.nomUsuel'), - '?3']); - $concatPrenomNomPatro = new \Doctrine\ORM\Query\Expr\Func('CONVERT', - [$qb->expr()->concat('i.prenom', 'i.nomPatronymique'), - '?3']); - - $qb -// ->select('i.') - ->where('i.sourceCode = ?1') - ->orWhere($qb->expr()->like($qb->expr()->upper($concatNomUsuelPrenom), $qb->expr()->upper('CONVERT(?2, ?3)'))) - ->orWhere($qb->expr()->like($qb->expr()->upper($concatNomPatroPrenom), $qb->expr()->upper('CONVERT(?2, ?3)'))) - ->orWhere($qb->expr()->like($qb->expr()->upper($concatPrenomNomUsuel), $qb->expr()->upper('CONVERT(?2, ?3)'))) - ->orWhere($qb->expr()->like($qb->expr()->upper($concatPrenomNomPatro), $qb->expr()->upper('CONVERT(?2, ?3)'))) - ->orderBy('i.nomUsuel, i.prenom'); - - $qb->setParameters([1 => $term, 2 => "%$term%", 3 => 'US7ASCII']); - -// print_r($qb->getQuery()->getSQL()); var_dump($qb->getQuery()->getParameters());die; - - return $qb->getQuery()->execute(); - } -} diff --git a/module/Application/src/Application/Entity/Db/Source.php b/module/Application/src/Application/Entity/Db/Source.php deleted file mode 100644 index 5255f9a747f0027e1ccc9e18592e342195f3add7..0000000000000000000000000000000000000000 --- a/module/Application/src/Application/Entity/Db/Source.php +++ /dev/null @@ -1,166 +0,0 @@ -<?php - -namespace Application\Entity\Db; - -/** - * Source - */ -class Source -{ - const CODE_SOURCE_HARPEGE = 'Harpege'; - const CODE_SOURCE_OSE = 'OSE'; - const CODE_SOURCE_TEST = 'Test'; - const CODE_SOURCE_APOGEE = 'Apogee'; - - /** - * @var string - */ - protected $code; - - /** - * @var boolean - */ - protected $importable; - - /** - * @var string - */ - protected $libelle; - - /** - * @var integer - */ - protected $id; - - - - /** - * Set code - * - * @param string $code - * - * @return Source - */ - public function setCode($code) - { - $this->code = $code; - - return $this; - } - - - - /** - * Get code - * - * @return string - */ - public function getCode() - { - return $this->code; - } - - - - /** - * Set importable - * - * @param boolean $importable - * - * @return Source - */ - public function setImportable($importable) - { - $this->importable = $importable; - - return $this; - } - - - - /** - * Get importable - * - * @return boolean - */ - public function getImportable() - { - return $this->importable; - } - - - - /** - * Set libelle - * - * @param string $libelle - * - * @return Source - */ - public function setLibelle($libelle) - { - $this->libelle = $libelle; - - return $this; - } - - - - /** - * Get libelle - * - * @return string - */ - public function getLibelle() - { - return $this->libelle; - } - - - - /** - * Get id - * - * @return integer - */ - public function getId() - { - return $this->id; - } - - - - /** - * Retourne la représentation littérale de cet objet. - * - * @return string - */ - public function __toString() - { - return $this->getLibelle(); - } - - - - public function isOse() - { - return $this->code === self::CODE_SOURCE_OSE; - } - - - - /** - * @since PHP 5.6.0 - * This method is called by var_dump() when dumping an object to get the properties that should be shown. - * If the method isn't defined on an object, then all public, protected and private properties will be shown. - * - * @return array - * @link http://php.net/manual/en/language.oop5.magic.php#language.oop5.magic.debuginfo - */ - function __debugInfo() - { - return [ - 'libelle' => $this->libelle, - ]; - } -} diff --git a/module/Application/src/Application/Entity/Db/StatutIntervenant.php b/module/Application/src/Application/Entity/Db/StatutIntervenant.php index 8e5f956bed4c657f0e66472c73c257fe09dd9e2c..3fe74c7408873e4a3e215473e51bda080b1f7ab7 100644 --- a/module/Application/src/Application/Entity/Db/StatutIntervenant.php +++ b/module/Application/src/Application/Entity/Db/StatutIntervenant.php @@ -5,14 +5,17 @@ namespace Application\Entity\Db; use UnicaenApp\Entity\HistoriqueAwareInterface; use UnicaenApp\Entity\HistoriqueAwareTrait; use UnicaenAuth\Entity\Db\Privilege; +use UnicaenImport\Entity\Db\Interfaces\ImportAwareInterface; +use UnicaenImport\Entity\Db\Traits\ImportAwareTrait; use Zend\Permissions\Acl\Role\RoleInterface; /** * StatutIntervenant */ -class StatutIntervenant implements HistoriqueAwareInterface, RoleInterface +class StatutIntervenant implements HistoriqueAwareInterface, RoleInterface, ImportAwareInterface { use HistoriqueAwareTrait; + use ImportAwareTrait; const SS_EMPLOI_NON_ETUD = 'SS_EMPLOI_NON_ETUD'; const NON_AUTORISE = 'NON_AUTORISE'; @@ -53,15 +56,6 @@ class StatutIntervenant implements HistoriqueAwareInterface, RoleInterface } - /** - * @var \Application\Entity\Db\Source - */ - protected $source; - - /** - * @var string - */ - protected $sourceCode; /** * @var boolean @@ -143,6 +137,11 @@ class StatutIntervenant implements HistoriqueAwareInterface, RoleInterface */ protected $peutCloturerSaisie; + /** + * @var boolean + */ + protected $peutSaisirMotifNonPaiement; + /** * @var integer */ @@ -383,6 +382,29 @@ class StatutIntervenant implements HistoriqueAwareInterface, RoleInterface + /** + * @return boolean + */ + public function getPeutSaisirMotifNonPaiement() + { + return $this->peutSaisirMotifNonPaiement; + } + + + + /** + * @param boolean $peutSaisirMotifNonPaiement + * + * @return StatutIntervenant + */ + public function setPeutSaisirMotifNonPaiement($peutSaisirMotifNonPaiement) + { + $this->peutSaisirMotifNonPaiement = $peutSaisirMotifNonPaiement; + + return $this; + } + + /** * Set depassement @@ -580,34 +602,6 @@ class StatutIntervenant implements HistoriqueAwareInterface, RoleInterface - /** - * Set sourceCode - * - * @param string $sourceCode - * - * @return StatutIntervenant - */ - public function setSourceCode($sourceCode) - { - $this->sourceCode = $sourceCode; - - return $this; - } - - - - /** - * Get sourceCode - * - * @return string - */ - public function getSourceCode() - { - return $this->sourceCode; - } - - - /** * Get id * @@ -648,34 +642,6 @@ class StatutIntervenant implements HistoriqueAwareInterface, RoleInterface - /** - * Set source - * - * @param \Application\Entity\Db\Source $source - * - * @return StatutIntervenant - */ - public function setSource(\Application\Entity\Db\Source $source = null) - { - $this->source = $source; - - return $this; - } - - - - /** - * Get source - * - * @return \Application\Entity\Db\Source - */ - public function getSource() - { - return $this->source; - } - - - /** * Add typeAgrementStatut * @@ -852,7 +818,7 @@ class StatutIntervenant implements HistoriqueAwareInterface, RoleInterface } - + public function getRoleId() { return 'statut/' . $this->getSourceCode(); diff --git a/module/Application/src/Application/Entity/Db/Structure.php b/module/Application/src/Application/Entity/Db/Structure.php index f2000c308c3398207a455cc81050414b8ae5b8a7..06f7f14ac161de541b82668d8cd8106ed460628d 100644 --- a/module/Application/src/Application/Entity/Db/Structure.php +++ b/module/Application/src/Application/Entity/Db/Structure.php @@ -2,6 +2,8 @@ namespace Application\Entity\Db; +use UnicaenImport\Entity\Db\Interfaces\ImportAwareInterface; +use UnicaenImport\Entity\Db\Traits\ImportAwareTrait; use Zend\Permissions\Acl\Resource\ResourceInterface; use Doctrine\Common\Collections\ArrayCollection; use UnicaenApp\Entity\HistoriqueAwareInterface; @@ -10,9 +12,10 @@ use UnicaenApp\Entity\HistoriqueAwareTrait; /** * Structure */ -class Structure implements HistoriqueAwareInterface, ResourceInterface +class Structure implements HistoriqueAwareInterface, ResourceInterface, ImportAwareInterface { use HistoriqueAwareTrait; + use ImportAwareTrait; /** * @var string @@ -29,11 +32,6 @@ class Structure implements HistoriqueAwareInterface, ResourceInterface */ protected $niveau; - /** - * @var string - */ - protected $sourceCode; - /** * @var string */ @@ -44,11 +42,6 @@ class Structure implements HistoriqueAwareInterface, ResourceInterface */ protected $id; - /** - * @var \Application\Entity\Db\Source - */ - protected $source; - /** * @var \Application\Entity\Db\TypeStructure */ @@ -176,34 +169,6 @@ class Structure implements HistoriqueAwareInterface, ResourceInterface - /** - * Set sourceCode - * - * @param string $sourceCode - * - * @return Structure - */ - public function setSourceCode($sourceCode) - { - $this->sourceCode = $sourceCode; - - return $this; - } - - - - /** - * Get sourceCode - * - * @return string - */ - public function getSourceCode() - { - return $this->sourceCode; - } - - - /** * Set contactPj * @@ -244,34 +209,6 @@ class Structure implements HistoriqueAwareInterface, ResourceInterface - /** - * Set source - * - * @param \Application\Entity\Db\Source $source - * - * @return Structure - */ - public function setSource(\Application\Entity\Db\Source $source = null) - { - $this->source = $source; - - return $this; - } - - - - /** - * Get source - * - * @return \Application\Entity\Db\Source - */ - public function getSource() - { - return $this->source; - } - - - /** * Set type * diff --git a/module/Application/src/Application/Entity/Db/Traits/SourceAwareTrait.php b/module/Application/src/Application/Entity/Db/Traits/SourceAwareTrait.php deleted file mode 100755 index 20682aa678c472d0aced38560cd9f07c2e4d913c..0000000000000000000000000000000000000000 --- a/module/Application/src/Application/Entity/Db/Traits/SourceAwareTrait.php +++ /dev/null @@ -1,42 +0,0 @@ -<?php - -namespace Application\Entity\Db\Traits; - -use Application\Entity\Db\Source; - -/** - * Description of SourceAwareTrait - * - * @author UnicaenCode - */ -trait SourceAwareTrait -{ - /** - * @var Source - */ - private $source; - - - - - - /** - * @param Source $source - * @return self - */ - public function setSource( Source $source = null ) - { - $this->source = $source; - return $this; - } - - - - /** - * @return Source - */ - public function getSource() - { - return $this->source; - } -} \ No newline at end of file diff --git a/module/Application/src/Application/Entity/Db/TypeDotation.php b/module/Application/src/Application/Entity/Db/TypeDotation.php index 9e8b92f94abf0c4d902ae20c277a99d4408fac8c..c773a1dcd41c26b3549396ad48feda6f238e8425 100644 --- a/module/Application/src/Application/Entity/Db/TypeDotation.php +++ b/module/Application/src/Application/Entity/Db/TypeDotation.php @@ -6,14 +6,16 @@ use Application\Entity\Db\Traits\SourceAwareTrait; use Application\Entity\Db\Traits\TypeRessourceAwareTrait; use UnicaenApp\Entity\HistoriqueAwareInterface; use UnicaenApp\Entity\HistoriqueAwareTrait; +use UnicaenImport\Entity\Db\Interfaces\ImportAwareInterface; +use UnicaenImport\Entity\Db\Traits\ImportAwareTrait; /** * TypeDotation */ -class TypeDotation implements HistoriqueAwareInterface +class TypeDotation implements HistoriqueAwareInterface, ImportAwareInterface { use HistoriqueAwareTrait; - use SourceAwareTrait; + use ImportAwareTrait; use TypeRessourceAwareTrait; @@ -25,11 +27,6 @@ class TypeDotation implements HistoriqueAwareInterface */ private $libelle; - /** - * @var string - */ - private $sourceCode; - /** * @var integer */ @@ -77,34 +74,6 @@ class TypeDotation implements HistoriqueAwareInterface - /** - * Set sourceCode - * - * @param string $sourceCode - * - * @return TypeDotation - */ - public function setSourceCode($sourceCode) - { - $this->sourceCode = $sourceCode; - - return $this; - } - - - - /** - * Get sourceCode - * - * @return string - */ - public function getSourceCode() - { - return $this->sourceCode; - } - - - public function isDotationInitiale() { return $this->getSourceCode() == self::CODE_DOTATION_INITIALE; diff --git a/module/Application/src/Application/Entity/Db/TypeFormation.php b/module/Application/src/Application/Entity/Db/TypeFormation.php index 48305aac2fc07d40b1578a97c6979812f6a69a57..4770656414b8bf5ee628c0e18807d6bda0da52f3 100644 --- a/module/Application/src/Application/Entity/Db/TypeFormation.php +++ b/module/Application/src/Application/Entity/Db/TypeFormation.php @@ -1,15 +1,19 @@ <?php namespace Application\Entity\Db; + use UnicaenApp\Entity\HistoriqueAwareInterface; use UnicaenApp\Entity\HistoriqueAwareTrait; +use UnicaenImport\Entity\Db\Interfaces\ImportAwareInterface; +use UnicaenImport\Entity\Db\Traits\ImportAwareTrait; /** * TypeFormation */ -class TypeFormation implements HistoriqueAwareInterface +class TypeFormation implements HistoriqueAwareInterface, ImportAwareInterface { use HistoriqueAwareTrait; + use ImportAwareTrait; @@ -35,21 +39,11 @@ class TypeFormation implements HistoriqueAwareInterface */ protected $libelleLong; - /** - * @var string - */ - protected $sourceCode; - /** * @var integer */ protected $id; - /** - * @var \Application\Entity\Db\Source - */ - protected $source; - /** * @var \Application\Entity\Db\GroupeTypeFormation */ @@ -113,34 +107,6 @@ class TypeFormation implements HistoriqueAwareInterface - /** - * Set sourceCode - * - * @param string $sourceCode - * - * @return TypeFormation - */ - public function setSourceCode($sourceCode) - { - $this->sourceCode = $sourceCode; - - return $this; - } - - - - /** - * Get sourceCode - * - * @return string - */ - public function getSourceCode() - { - return $this->sourceCode; - } - - - /** * Get id * @@ -153,34 +119,6 @@ class TypeFormation implements HistoriqueAwareInterface - /** - * Set source - * - * @param \Application\Entity\Db\Source $source - * - * @return TypeFormation - */ - public function setSource(\Application\Entity\Db\Source $source = null) - { - $this->source = $source; - - return $this; - } - - - - /** - * Get source - * - * @return \Application\Entity\Db\Source - */ - public function getSource() - { - return $this->source; - } - - - /** * Set groupe * diff --git a/module/Application/src/Application/Entity/Db/VolumeHoraireEns.php b/module/Application/src/Application/Entity/Db/VolumeHoraireEns.php index ec23314094c0daa6a143c14d71838058c26dee22..731b65c1313c61d8bf225d6ed518983762aa8a36 100644 --- a/module/Application/src/Application/Entity/Db/VolumeHoraireEns.php +++ b/module/Application/src/Application/Entity/Db/VolumeHoraireEns.php @@ -8,15 +8,17 @@ use Application\Entity\Db\Traits\TypeInterventionAwareTrait; use Doctrine\ORM\Mapping as ORM; use UnicaenApp\Entity\HistoriqueAwareInterface; use UnicaenApp\Entity\HistoriqueAwareTrait; +use UnicaenImport\Entity\Db\Interfaces\ImportAwareInterface; +use UnicaenImport\Entity\Db\Traits\ImportAwareTrait; /** * VolumeHoraireEns */ -class VolumeHoraireEns implements HistoriqueAwareInterface +class VolumeHoraireEns implements HistoriqueAwareInterface, ImportAwareInterface { use HistoriqueAwareTrait; + use ImportAwareTrait; use ElementPedagogiqueAwareTrait; - use SourceAwareTrait; use TypeInterventionAwareTrait; /** @@ -29,11 +31,6 @@ class VolumeHoraireEns implements HistoriqueAwareInterface */ protected $heures; - /** - * @var string - */ - protected $sourceCode; - /** @@ -74,31 +71,4 @@ class VolumeHoraireEns implements HistoriqueAwareInterface return $this->heures; } - - - /** - * Set sourceCode - * - * @param string $sourceCode - * - * @return VolumeHoraireEns - */ - public function setSourceCode($sourceCode) - { - $this->sourceCode = $sourceCode; - - return $this; - } - - - - /** - * Get sourceCode - * - * @return string - */ - public function getSourceCode() - { - return $this->sourceCode; - } } diff --git a/module/Application/src/Application/Entity/Db/WfEtape.php b/module/Application/src/Application/Entity/Db/WfEtape.php index 0648305f5f3e1a8d03f405e192c6dfb85e80f0a5..6a2ebbd542edc942cfa99e8412a8f9afce0b18f2 100644 --- a/module/Application/src/Application/Entity/Db/WfEtape.php +++ b/module/Application/src/Application/Entity/Db/WfEtape.php @@ -21,8 +21,8 @@ class WfEtape const CODE_CLOTURE_REALISE = 'CLOTURE_REALISE'; const CODE_SERVICE_VALIDATION_REALISE = 'SERVICE_VALIDATION_REALISE'; const CODE_REFERENTIEL_VALIDATION_REALISE = 'REFERENTIEL_VALIDATION_REALISE'; - const DEMANDE_MEP = 'DEMANDE_MEP'; - const SAISIE_MEP = 'SAISIE_MEP'; + const CODE_DEMANDE_MEP = 'DEMANDE_MEP'; + const CODE_SAISIE_MEP = 'SAISIE_MEP'; const CURRENT = 'current-etape'; const NEXT = 'next-etape'; diff --git a/module/Application/src/Application/Entity/Service/Recherche.php b/module/Application/src/Application/Entity/Service/Recherche.php index 5775f7c0a47faaf669666c59520a78303b2cb9f1..19d4170035e0b81c254811e456bce95ad600e6f9 100644 --- a/module/Application/src/Application/Entity/Service/Recherche.php +++ b/module/Application/src/Application/Entity/Service/Recherche.php @@ -2,8 +2,10 @@ namespace Application\Entity\Service; +use Application\Entity\Db\EtatVolumeHoraire; use Application\Entity\Db\Interfaces\TypeIntervenantAwareInterface; use Application\Entity\Db\Traits\TypeIntervenantAwareTrait; use Application\Entity\Db\Interfaces\IntervenantAwareInterface; use Application\Entity\Db\Traits\IntervenantAwareTrait; +use Application\Entity\Db\TypeVolumeHoraire; use Application\Interfaces\NiveauEtapeAwareInterface; use Application\Traits\NiveauEtapeAwareTrait; use Application\Entity\Db\Interfaces\EtapeAwareInterface; use Application\Entity\Db\Traits\EtapeAwareTrait; use Application\Entity\Db\Interfaces\ElementPedagogiqueAwareInterface; use Application\Entity\Db\Traits\ElementPedagogiqueAwareTrait; @@ -94,4 +96,26 @@ implements $this->structureEns = $structureEns; return $this; } + + + + /** + * PHP 5 allows developers to declare constructor methods for classes. + * Classes which have a constructor method call this method on each newly-created object, + * so it is suitable for any initialization that the object may need before it is used. + * + * Note: Parent constructors are not called implicitly if the child class defines a constructor. + * In order to run a parent constructor, a call to parent::__construct() within the child constructor is required. + * + * param [ mixed $args [, $... ]] + * + * @return void + * @link http://php.net/manual/en/language.oop5.decon.php + */ + public function __construct( TypeVolumeHoraire $typeVolumeHoraire=null, EtatVolumeHoraire $etatVolumeHoraire=null ) + { + if ($typeVolumeHoraire) $this->setTypeVolumeHoraire($typeVolumeHoraire); + if ($etatVolumeHoraire) $this->setEtatVolumeHoraire($etatVolumeHoraire); + } + } \ No newline at end of file diff --git a/module/Application/src/Application/Filter/IntervenantTrouveFormatter.php b/module/Application/src/Application/Filter/IntervenantTrouveFormatter.php deleted file mode 100644 index 74631aa035dc1b336896c1297c59534bcba352ef..0000000000000000000000000000000000000000 --- a/module/Application/src/Application/Filter/IntervenantTrouveFormatter.php +++ /dev/null @@ -1,100 +0,0 @@ -<?php - -namespace Application\Filter; - -use Zend\Filter\AbstractFilter; -use Application\Entity\Db\IntervenantInterface; -use stdClass; -use Application\Constants; - -/** - * Formatte un intervenant pour le transmettre à l'élément de formulaire SearchAndSelect. - * - * @author Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr> - * @see \UnicaenApp\Form\Element\SearchAndSelect - */ -class IntervenantTrouveFormatter extends AbstractFilter -{ - /** - * @var NomCompletFormatter - */ - protected $nomCompletFormatter; - - /** - * Constructeur. - * - * @param IntervenantInterface|stdClass|array $intervenant - */ - public function __construct() - { - $this->nomCompletFormatter = new NomCompletFormatter(true, false, true); - } - - /** - * Returns the result of filtering $value - * - * @param IntervenantInterface|stdClass|array $value - * @return string - */ - public function filter($value) - { - // normalisation - if ($value instanceof IntervenantInterface) { - /* @var $value IntervenantInterface */ - $id = $value->getSourceCode(); - $label = $this->nomCompletFormatter->filter($value); - $civilite = $value->getCiviliteToString(); - $dateNaiss = $value->getDateNaissance(); - $feminin = $value->estUneFemme(); - $affectat = $value->getAffectationsToString(); - } - else if ($value instanceof \stdClass) { - foreach (['civilite', 'sourceCode', 'dateNaissance', 'estUneFemme', 'affectation'] as $prop) { - if (!isset($value->$prop)) { - throw new \LogicException("L'objet à formatter doit posséder l'attribut public '$prop'."); - } - } - $id = $value->sourceCode; - $label = $this->nomCompletFormatter->filter($value); - $civilite = $value->civilite; - $dateNaiss = $value->dateNaissance; - $feminin = $value->estUneFemme(); - $affectat = $value->affectation; - } - else if (is_array($value)) { - foreach (['CIVILITE', 'SOURCE_CODE', 'DATE_NAISSANCE', 'EST_UNE_FEMME', 'AFFECTATION'] as $prop) { - if (!array_key_exists($prop, $value)) { - throw new \LogicException("Le tableau à formatter doit posséder la clé '$prop'."); - } - } - $id = $value['SOURCE_CODE']; - $label = $this->nomCompletFormatter->filter($value); - $civilite = $value['CIVILITE']; - $dateNaiss = $value['DATE_NAISSANCE']; - $feminin = $value['EST_UNE_FEMME']; - $affectat = $value['AFFECTATION']; - } - else { - throw new \LogicException("L'objet à formatter n'est pas d'un type supporté."); - } - - if (!$dateNaiss instanceof \DateTime) { - $dateNaiss = new \DateTime($dateNaiss); - } - - $extra = sprintf("(%s, né%s le %s, n°%s, %s)", - $civilite, - (boolean) $feminin ? 'e' : '', - $dateNaiss->format(Constants::DATE_FORMAT), - $id ?: "Inconnu", - $affectat ?: "Affectation inconnue"); - - $result = [ - 'id' => $id, - 'label' => $label, - 'extra' => $extra, - ]; - - return $result; - } -} \ No newline at end of file diff --git a/module/Application/src/Application/Form/Service/RechercheForm.php b/module/Application/src/Application/Form/Service/RechercheForm.php index 506be55b045c1cca41e37b08493f46ec3597d9cc..52472d74a5119fc597ed009749a2194d220472f1 100644 --- a/module/Application/src/Application/Form/Service/RechercheForm.php +++ b/module/Application/src/Application/Form/Service/RechercheForm.php @@ -178,7 +178,7 @@ class RechercheForm extends AbstractForm $this->addActionButton('submit-resume' , 'Afficher (résumé)' , $this->getUrl('service/resume'), true ); - $this->addActionButton('submit-details', 'Afficher (détails)', $this->getUrl('service/default', ['action' => 'index'])); + $this->addActionButton('submit-details', 'Afficher (détails)', $this->getUrl('service')); $this->addActionButton('submit-export' , 'Exporter (CSV)' , $this->getUrl('service/export')); } diff --git a/module/Application/src/Application/Form/Service/RechercheFormHydrator.php b/module/Application/src/Application/Form/Service/RechercheFormHydrator.php index c579df9286443090e8860370369d2384bd51d64e..4ddeb3443dca0a263c947df97006d76d7264fb70 100644 --- a/module/Application/src/Application/Form/Service/RechercheFormHydrator.php +++ b/module/Application/src/Application/Form/Service/RechercheFormHydrator.php @@ -93,7 +93,7 @@ class RechercheFormHydrator implements HydratorInterface, ServiceLocatorAwareInt 'type-intervenant' => $object->getTypeIntervenant() ? $object->getTypeIntervenant()->getId() : null, 'structure-aff' => $object->getStructureAff() ? $object->getStructureAff()->getId() : null, 'intervenant' => [ - 'id' => $object->getIntervenant() ? $object->getIntervenant()->getSourceCode(): null, + 'id' => $object->getIntervenant() ? $object->getIntervenant()->getRouteParam(): null, 'label' => $object->getIntervenant() ? (string)$object->getIntervenant() : null, ], 'element-pedagogique' => [ diff --git a/module/Application/src/Application/Form/Service/SaisieFieldset.php b/module/Application/src/Application/Form/Service/SaisieFieldset.php index 8cc5f3c7536ad99e9e0de6a5b6acc599c94fb29c..c2bae2062fb6d4359285658f4cbf376c36c5bb1a 100644 --- a/module/Application/src/Application/Form/Service/SaisieFieldset.php +++ b/module/Application/src/Application/Form/Service/SaisieFieldset.php @@ -13,6 +13,7 @@ use Application\Service\Traits\NiveauEtapeAwareTrait; use Application\Service\Traits\StructureAwareTrait; use UnicaenApp\Form\Element\SearchAndSelect; use Application\Entity\Db\Etablissement; +use UnicaenAuth\Service\Traits\AuthorizeServiceAwareTrait; use Zend\Stdlib\Hydrator\HydratorInterface; use Zend\ServiceManager\ServiceLocatorAwareInterface; use Zend\ServiceManager\ServiceLocatorAwareTrait; @@ -34,6 +35,7 @@ class SaisieFieldset extends AbstractFieldset use NiveauEtapeAwareTrait; use StructureAwareTrait; use ElementPedagogiqueRechercheFieldsetAwareTrait; + use AuthorizeServiceAwareTrait; /** * etablissement par défaut @@ -42,6 +44,11 @@ class SaisieFieldset extends AbstractFieldset */ protected $etablissement; + /** + * @var boolean + */ + protected $canSaisieExterieur; + public function init() @@ -75,22 +82,20 @@ class SaisieFieldset extends AbstractFieldset $this->add($intervenant); } - if (!($role->getIntervenant() && !$role->getIntervenant()->estPermanent())) { - $this->add([ - 'type' => 'Radio', - 'name' => 'interne-externe', - 'options' => [ - 'label' => "Enseignement effectué :", - 'value_options' => [ - 'service-interne' => 'en interne', - 'service-externe' => 'hors ' . $this->etablissement, - ], - ], - 'attributes' => [ - 'value' => 'service-interne', + $this->add([ + 'type' => 'Radio', + 'name' => 'interne-externe', + 'options' => [ + 'label' => "Enseignement effectué :", + 'value_options' => [ + 'service-interne' => 'en interne', + 'service-externe' => 'hors ' . $this->etablissement, ], - ]); - } + ], + 'attributes' => [ + 'value' => 'service-interne', + ], + ]); $fs = $this->getFieldsetOffreFormationElementPedagogiqueRecherche(); $fs->setName('element-pedagogique'); @@ -128,7 +133,7 @@ class SaisieFieldset extends AbstractFieldset /* Peuple le formulaire avec les valeurs issues du contexte local */ if ($this->has('intervenant') && $this->getServiceLocalContext()->getIntervenant()) { $this->get('intervenant')->setValue([ - 'id' => $this->getServiceLocalContext()->getIntervenant()->getSourceCode(), + 'id' => $this->getServiceLocalContext()->getIntervenant()->getRouteParam(), 'label' => (string)$this->getServiceLocalContext()->getIntervenant(), ]); } @@ -208,6 +213,36 @@ class SaisieFieldset extends AbstractFieldset ], ]; } + + + + /** + * @return boolean + */ + public function getCanSaisieExterieur() + { + return $this->canSaisieExterieur; + } + + + + /** + * @param boolean $canSaisieExterieur + * + * @return SaisieFieldset + */ + public function setCanSaisieExterieur($canSaisieExterieur) + { + $this->canSaisieExterieur = $canSaisieExterieur; + + if (!$canSaisieExterieur) { + $this->remove('interne-externe'); + $this->remove('etablissement'); + } + + return $this; + } + } @@ -277,7 +312,7 @@ class SaisieFieldsetHydrator implements HydratorInterface, ServiceLocatorAwareIn if ($object->getIntervenant()) { $data['intervenant'] = [ - 'id' => $object->getIntervenant()->getSourceCode(), + 'id' => $object->getIntervenant()->getRouteParam(), 'label' => (string)$object->getIntervenant(), ]; } else { diff --git a/module/Application/src/Application/Form/ServiceReferentiel/SaisieFieldset.php b/module/Application/src/Application/Form/ServiceReferentiel/SaisieFieldset.php index 50ad47455f7772287a9ba8cc9c168c34e0695727..f6f745240a22bdc5b10ac1ec1c0ce13a10281e5b 100644 --- a/module/Application/src/Application/Form/ServiceReferentiel/SaisieFieldset.php +++ b/module/Application/src/Application/Form/ServiceReferentiel/SaisieFieldset.php @@ -169,7 +169,7 @@ class SaisieFieldset extends AbstractFieldset $cl = $this->getServiceLocalContext(); if ($this->has('intervenant') && $cl->getIntervenant()) { $this->get('intervenant')->setValue([ - 'id' => $cl->getIntervenant()->getSourceCode(), + 'id' => $cl->getIntervenant()->getRouteParam(), 'label' => (string)$cl->getIntervenant(), ]); } diff --git a/module/Application/src/Application/Form/ServiceReferentiel/SaisieFieldsetHydrator.php b/module/Application/src/Application/Form/ServiceReferentiel/SaisieFieldsetHydrator.php index 34916af17066b6c4863ff028934d55ff51ed526c..bef63b33b72fb0592f9a281d389ec1b16db64efb 100644 --- a/module/Application/src/Application/Form/ServiceReferentiel/SaisieFieldsetHydrator.php +++ b/module/Application/src/Application/Form/ServiceReferentiel/SaisieFieldsetHydrator.php @@ -60,7 +60,7 @@ class SaisieFieldsetHydrator implements HydratorInterface, EntityManagerAwareInt if ($object->getIntervenant()) { $data['intervenant'] = [ - 'id' => $object->getIntervenant()->getSourceCode(), + 'id' => $object->getIntervenant()->getRouteParam(), 'label' => (string) $object->getIntervenant() ]; } diff --git a/module/Application/src/Application/Form/VolumeHoraire/Saisie.php b/module/Application/src/Application/Form/VolumeHoraire/Saisie.php index 7275097cf93caa7809e9d7b675fb33da86d223df..8f54ceadc4717ea9392d7d6d3a9e8bba957ab750 100644 --- a/module/Application/src/Application/Form/VolumeHoraire/Saisie.php +++ b/module/Application/src/Application/Form/VolumeHoraire/Saisie.php @@ -6,9 +6,7 @@ use Application\Filter\FloatFromString; use Application\Filter\StringFromFloat; use Application\Form\AbstractForm; use Application\Service\Traits\MotifNonPaiementAwareTrait; -use Application\Service\Traits\ServiceAwareTrait; use Zend\Form\Element\Hidden; -use Application\Service\Traits\ContextAwareTrait; /** * Description of Saisie @@ -16,21 +14,32 @@ use Application\Service\Traits\ContextAwareTrait; */ class Saisie extends AbstractForm { - use ContextAwareTrait; use MotifNonPaiementAwareTrait; - use ServiceAwareTrait; + + /** + * @var boolean + */ + protected $viewMNP; + + /** + * @var boolean + */ + protected $editMNP; + + /** * */ public function init() { - $this ->setAttribute('method', 'post') - ->setAttribute('class', 'volume-horaire') + $this->setAttribute('action', $this->getCurrentUrl()); + $this->setAttribute('method', 'post') + ->setAttribute('class', 'volume-horaire') // ->setHydrator(new ClassMethods(false)) // ->setInputFilter(new InputFilter()) // ->setPreferFormInputFilter(false) - ; + ; $this->add([ 'name' => 'heures', @@ -45,75 +54,75 @@ class Saisie extends AbstractForm ], ]); - $role = $this->getServiceContext()->getSelectedIdentityRole(); - if ($role instanceof \Application\Acl\Role) { + $this->add([ + 'name' => 'motif-non-paiement', + 'options' => [ + 'label' => "Motif de non paiement :", + ], + 'attributes' => [ + 'value' => "", + 'title' => "Motif de non paiement", + 'class' => 'volume-horaire volume-horaire-motif-non-paiement input-sm', + ], + 'type' => 'Select', + ]); - $this->add([ - 'name' => 'motif-non-paiement', - 'options' => [ - 'label' => "Motif de non paiement :", - ], - 'attributes' => [ - 'value' => "", - 'title' => "Motif de non paiement", - 'class' => 'volume-horaire volume-horaire-motif-non-paiement input-sm' - ], - 'type' => 'Select' - ]); - - $motifsNonPaiement = $this->getServiceMotifNonPaiement()->getList(); - foreach( $motifsNonPaiement as $id => $motifNonPaiement ){ - $motifsNonPaiement[$id] = (string)$motifNonPaiement; - } - $motifsNonPaiement[0] = 'Aucun motif : paiement prévu'; - $this->get('motif-non-paiement')->setValueOptions( $motifsNonPaiement ); + $motifsNonPaiement = $this->getServiceMotifNonPaiement()->getList(); + foreach ($motifsNonPaiement as $id => $motifNonPaiement) { + $motifsNonPaiement[$id] = (string)$motifNonPaiement; } + $motifsNonPaiement[0] = 'Aucun motif : paiement prévu'; + $this->get('motif-non-paiement')->setValueOptions($motifsNonPaiement); - $this->add( new Hidden('service') ); - $this->add( new Hidden('periode') ); - $this->add( new Hidden('type-volume-horaire') ); - $this->add( new Hidden('type-intervention') ); + $this->add(new Hidden('service')); + $this->add(new Hidden('periode')); + $this->add(new Hidden('type-volume-horaire')); + $this->add(new Hidden('type-intervention')); $this->add([ - 'name' => 'submit', - 'type' => 'Submit', + 'name' => 'submit', + 'type' => 'Submit', 'attributes' => [ 'value' => 'Enregistrer', 'title' => "Enregistrer", - 'class' => 'volume-horaire volume-horaire-enregistrer btn btn-primary' + 'class' => 'volume-horaire volume-horaire-enregistrer btn btn-primary', ], ]); $this->add([ - 'name' => 'annuler', - 'type' => 'Button', - 'options' => [ + 'name' => 'annuler', + 'type' => 'Button', + 'options' => [ 'label' => 'Fermer', ], 'attributes' => [ 'title' => "Abandonner cette saisie", - 'class' => 'volume-horaire volume-horaire-annuler btn btn-default fermer' + 'class' => 'volume-horaire volume-horaire-annuler btn btn-default fermer', ], ]); } + + /* Associe une entity VolumeHoraireList au formulaire */ - public function bind( $object, $flags=17) + public function bind($object, $flags = 17) { /* @var $object \Application\Entity\VolumeHoraireListe */ - $data = $object->filtersToArray(); + $data = $object->filtersToArray(); $data['service'] = $object->getService()->getId(); - $data['heures'] = StringFromFloat::run($object->getHeures(), false); + $data['heures'] = StringFromFloat::run($object->getHeures(), false); - if (! $this->getServiceService()->canHaveMotifNonPaiement($object->getService())){ + if (!$this->getViewMNP()) { $this->remove('motif-non-paiement'); - }else{ + } else { $data['motif-non-paiement'] = $object->getMotifNonPaiement() ? $object->getMotifNonPaiement()->getId() : 0; } $this->setData($data); } + + /** * Should return an array specification compatible with * {@link Zend\InputFilter\Factory::createInputFilter()}. @@ -124,12 +133,12 @@ class Saisie extends AbstractForm { return [ 'motif-non-paiement' => [ - 'required' => false + 'required' => false, ], - 'periode' => [ - 'required' => false + 'periode' => [ + 'required' => false, ], - 'heures' => [ + 'heures' => [ 'required' => true, 'filters' => [ ['name' => FloatFromString::class], @@ -138,4 +147,55 @@ class Saisie extends AbstractForm ]; } + + + /** + * @return boolean + */ + public function getViewMNP() + { + return $this->viewMNP; + } + + + + /** + * @param boolean $viewMNP + * + * @return Saisie + */ + public function setViewMNP($viewMNP) + { + $this->viewMNP = $viewMNP; + + return $this; + } + + + + /** + * @return boolean + */ + public function getEditMNP() + { + return $this->editMNP; + } + + + + /** + * @param boolean $editMNP + * + * @return Saisie + */ + public function setEditMNP($editMNP) + { + $this->editMNP = $editMNP; + + if (!$editMNP && $this->has('motif-non-paiement')) { + $this->remove('motif-non-paiement'); + } + + return $this; + } } \ No newline at end of file diff --git a/module/Application/src/Application/Processus/IntervenantProcessus.php b/module/Application/src/Application/Processus/IntervenantProcessus.php new file mode 100755 index 0000000000000000000000000000000000000000..356c80d3f86010304e090b6749fe5b56678f62f1 --- /dev/null +++ b/module/Application/src/Application/Processus/IntervenantProcessus.php @@ -0,0 +1,72 @@ +<?php + +namespace Application\Processus; +use Application\Service\Traits\ContextAwareTrait; +use UnicaenApp\Util; + + +/** + * Description of IntervenantProcessus + * + * @author LECLUSE Laurent <laurent.lecluse at unicaen.fr> + */ +class IntervenantProcessus extends AbstractProcessus{ + use ContextAwareTrait; + + + + /** + * @param string $critere + * @param integer $limit + * + * @return array + */ + public function rechercher($critere, $limit = 50) + { + if (strlen($critere) < 2) return []; + + $anneeId = (int)$this->getServiceContext()->getAnnee()->getId(); + + $critere = Util::reduce($critere); + $criteres = explode('_', $critere); + + $sql = 'SELECT * FROM V_INTERVENANT_RECHERCHE WHERE rownum <= ' . (int)$limit . ' AND annee_id = ' . $anneeId; + $sqlCri = ''; + $criCode = 0; + + foreach ($criteres as $c) { + $cc = (int)$c; + if (0 === $cc) { + if ($sqlCri != '') $sqlCri .= ' AND '; + $sqlCri .= 'critere LIKE q\'[%' . $c . '%]\''; + } else { + $criCode = $cc; + } + } + $orc = ''; + if ($sqlCri != '') { + $orc[] = '(' . $sqlCri . ')'; + } + if ($criCode) { + $orc[] = 'source_code LIKE \'%' . $criCode . '%\''; + } + $orc = implode(' OR ', $orc); + $sql .= ' AND (' . $orc . ') ORDER BY nom_usuel, prenom'; + + $stmt = $this->getEntityManager()->getConnection()->executeQuery($sql); + + $intervenants = []; + while ($r = $stmt->fetch()) { + $intervenants[$r['SOURCE_CODE']] = [ + 'civilite' => $r['CIVILITE'], + 'nom' => $r['NOM_USUEL'], + 'prenom' => $r['PRENOM'], + 'date-naissance' => new \DateTime($r['DATE_NAISSANCE']), + 'structure' => $r['STRUCTURE'], + 'numero-personnel' => $r['SOURCE_CODE'], + ]; + } + + return $intervenants; + } +} \ No newline at end of file diff --git a/module/Application/src/Application/Processus/ServiceProcessus.php b/module/Application/src/Application/Processus/ServiceProcessus.php new file mode 100755 index 0000000000000000000000000000000000000000..28c11952689c82efdff5dda98e29676aedb669fe --- /dev/null +++ b/module/Application/src/Application/Processus/ServiceProcessus.php @@ -0,0 +1,103 @@ +<?php + +namespace Application\Processus; + +use Application\Entity\Db\Intervenant; +use Application\Entity\Service\Recherche; +use Application\Service\Traits\ContextAwareTrait; +use Application\Service\Traits\ElementPedagogiqueAwareTrait; +use Application\Service\Traits\EtapeAwareTrait; +use Application\Service\Traits\PeriodeAwareTrait; +use Application\Service\Traits\ServiceServiceAwareTrait; +use Application\Service\Traits\StructureAwareTrait; +use Application\Service\Traits\VolumeHoraireAwareTrait; + + +/** + * Description of ServiceProcessus + * + * @author LECLUSE Laurent <laurent.lecluse at unicaen.fr> + */ +class ServiceProcessus extends AbstractProcessus +{ + use ContextAwareTrait; + use ServiceServiceAwareTrait; + use VolumeHoraireAwareTrait; + use ElementPedagogiqueAwareTrait; + use StructureAwareTrait; + use EtapeAwareTrait; + use PeriodeAwareTrait; + + + + /** + * + * @param Intervenant|null $intervenant + * @param Recherche $recherche + * + * @return \Doctrine\ORM\QueryBuilder + */ + public function getServices($intervenant, $recherche) + { + //\Test\Util::sqlLog($this->getServiceService()->getEntityManager()); + + $role = $this->getServiceContext()->getSelectedIdentityRole(); + if ($role->getIntervenant()) { + $intervenant = $role->getIntervenant(); + } + + $service = $this->getServiceService(); + $volumeHoraireService = $this->getServiceVolumeHoraire(); + $elementPedagogiqueService = $this->getServiceElementPedagogique(); + $structureService = $this->getServiceStructure(); + $etapeService = $this->getServiceEtape(); + $periodeService = $this->getServicePeriode(); + + $qb = $service->initQuery()[0]; + /* @var $qb \Doctrine\ORM\QueryBuilder */ + + //@formatter:off + $service + ->join( 'applicationIntervenant', $qb, 'intervenant', ['id', 'nomUsuel', 'prenom','sourceCode'] ) + ->leftJoin( $elementPedagogiqueService, $qb, 'elementPedagogique', ['id', 'sourceCode', 'libelle', 'histoDestruction', 'fi', 'fc', 'fa', 'tauxFi', 'tauxFc', 'tauxFa', 'tauxFoad'] ) + ->leftjoin( $volumeHoraireService, $qb, 'volumeHoraire', ['id', 'heures'] ); + +// $intervenantService +// ->leftJoin( 'applicationUtilisateur', $qb, 'utilisateur', true ); + + $elementPedagogiqueService + ->leftJoin( $structureService, $qb, 'structure', ['id', 'libelleCourt'] ) + ->leftJoin( $etapeService, $qb, 'etape', ['id', 'libelle', 'niveau', 'histoDestruction', 'sourceCode'] ) + ->leftJoin( $periodeService, $qb, 'periode', ['id', 'code', 'libelleLong', 'libelleCourt', 'ordre'] ) + ->leftJoin( 'applicationTypeIntervention', $qb, 'typeIntervention', ['id', 'code', 'libelle', 'ordre'] ); + + $volumeHoraireService + ->leftJoin( 'applicationMotifNonPaiement', $qb, 'motifNonPaiement', ['id', 'libelleCourt', 'libelleLong'] ); + + $volumeHoraireService->leftJoin( 'applicationEtatVolumeHoraire', $qb, 'etatVolumeHoraire', ['id','code','libelle','ordre'] ); + $volumeHoraireService->leftJoin( 'ApplicationFormuleVolumeHoraire', $qb, 'formuleVolumeHoraire', ['id'] ); + //@formatter:on + + $service->finderByContext($qb); + $service->finderByFilterObject($recherche, new \Zend\Stdlib\Hydrator\ClassMethods(false), $qb, null, ['typeVolumeHoraire', 'etatVolumeHoraire']); + + if ($intervenant) { + $service->finderByIntervenant($intervenant, $qb); + } + + $qb + ->addOrderBy($structureService->getAlias() . '.libelleCourt') + ->addOrderBy($etapeService->getAlias() . '.libelle') + ->addOrderBy($periodeService->getAlias() . '.libelleCourt') + ->addOrderBy($elementPedagogiqueService->getAlias() . '.sourceCode'); + + if (!$intervenant && $role->getStructure()) { + $service->finderByComposante($role->getStructure(), $qb); + } + + $services = $service->getList($qb); + + return $services; + } + +} \ No newline at end of file diff --git a/module/Application/src/Application/Processus/Traits/IntervenantProcessusAwareTrait.php b/module/Application/src/Application/Processus/Traits/IntervenantProcessusAwareTrait.php new file mode 100755 index 0000000000000000000000000000000000000000..78a878100ee300066386dd479e9848436823d7f1 --- /dev/null +++ b/module/Application/src/Application/Processus/Traits/IntervenantProcessusAwareTrait.php @@ -0,0 +1,59 @@ +<?php + +namespace Application\Processus\Traits; + +use Application\Processus\IntervenantProcessus; +use Application\Module; +use RuntimeException; + +/** + * Description of IntervenantProcessusAwareTrait + * + * @author UnicaenCode + */ +trait IntervenantProcessusAwareTrait +{ + /** + * @var IntervenantProcessus + */ + private $processusIntervenant; + + + + + + /** + * @param IntervenantProcessus $processusIntervenant + * @return self + */ + public function setProcessusIntervenant( IntervenantProcessus $processusIntervenant ) + { + $this->processusIntervenant = $processusIntervenant; + return $this; + } + + + + /** + * @return IntervenantProcessus + * @throws RuntimeException + */ + public function getProcessusIntervenant() + { + if (empty($this->processusIntervenant)){ + $serviceLocator = Module::$serviceLocator; + if (! $serviceLocator) { + if (!method_exists($this, 'getServiceLocator')) { + throw new RuntimeException('La classe ' . get_class($this) . ' n\'a pas accès au ServiceLocator.'); + } + + $serviceLocator = $this->getServiceLocator(); + if (method_exists($serviceLocator, 'getServiceLocator')) { + $serviceLocator = $serviceLocator->getServiceLocator(); + } + } + $this->processusIntervenant = $serviceLocator->get('processusIntervenant'); + } + return $this->processusIntervenant; + } +} \ No newline at end of file diff --git a/module/Application/src/Application/Processus/Traits/ServiceProcessusAwareTrait.php b/module/Application/src/Application/Processus/Traits/ServiceProcessusAwareTrait.php new file mode 100755 index 0000000000000000000000000000000000000000..320ce4ab842d1169517ec162a8954fb3091b0c3a --- /dev/null +++ b/module/Application/src/Application/Processus/Traits/ServiceProcessusAwareTrait.php @@ -0,0 +1,59 @@ +<?php + +namespace Application\Processus\Traits; + +use Application\Processus\ServiceProcessus; +use Application\Module; +use RuntimeException; + +/** + * Description of ServiceProcessusAwareTrait + * + * @author UnicaenCode + */ +trait ServiceProcessusAwareTrait +{ + /** + * @var ServiceProcessus + */ + private $processusService; + + + + + + /** + * @param ServiceProcessus $processusService + * @return self + */ + public function setProcessusService( ServiceProcessus $processusService ) + { + $this->processusService = $processusService; + return $this; + } + + + + /** + * @return ServiceProcessus + * @throws RuntimeException + */ + public function getProcessusService() + { + if (empty($this->processusService)){ + $serviceLocator = Module::$serviceLocator; + if (! $serviceLocator) { + if (!method_exists($this, 'getServiceLocator')) { + throw new RuntimeException('La classe ' . get_class($this) . ' n\'a pas accès au ServiceLocator.'); + } + + $serviceLocator = $this->getServiceLocator(); + if (method_exists($serviceLocator, 'getServiceLocator')) { + $serviceLocator = $serviceLocator->getServiceLocator(); + } + } + $this->processusService = $serviceLocator->get('processusService'); + } + return $this->processusService; + } +} \ No newline at end of file diff --git a/module/Application/src/Application/Service/Etape.php b/module/Application/src/Application/Service/Etape.php index 3e9da5087d357d7e9a3d368df0601f45396a0b62..9213703414b0dc4aa4f97250cce3abb69a73e748 100644 --- a/module/Application/src/Application/Service/Etape.php +++ b/module/Application/src/Application/Service/Etape.php @@ -77,28 +77,6 @@ class Etape extends AbstractEntityService - /** - * Retourne le chercheur d'étapes orphelines (i.e. sans EP). - * - * @param \Doctrine\ORM\QueryBuilder $qb - * - * @return \Doctrine\ORM\QueryBuilder - */ - public function finderByOrphelines(QueryBuilder $qb = null, $alias = null) - { - list($qb, $alias) = $this->initQuery($qb, $alias); - - $qb - ->join("$alias.source", "src") - ->andWhere("NOT EXISTS (SELECT eptmp FROM Application\Entity\Db\ElementPedagogique eptmp WHERE eptmp.etape = $alias)") - ->andWhere("NOT EXISTS (SELECT cptmp FROM Application\Entity\Db\CheminPedagogique cptmp WHERE cptmp.etape = $alias)") - ->andWhere("$alias.specifiqueEchanges = 0 OR src.code = :sourceOse") - ->setParameter('sourceOse', \Application\Entity\Db\Source::CODE_SOURCE_OSE); - - return $qb; - } - - /** * Retourne le chercheur d'étapes orphelines (i.e. sans EP). diff --git a/module/Application/src/Application/Service/Indicateur/Agrement/AttenteAgrementAbstractIndicateurImpl.php b/module/Application/src/Application/Service/Indicateur/Agrement/AttenteAgrementAbstractIndicateurImpl.php index 563347c12e2a55ffe8bd508b9a8e2de1c03e5a82..010dfd0668778b6a3250ea0ee675b049210148fa 100644 --- a/module/Application/src/Application/Service/Indicateur/Agrement/AttenteAgrementAbstractIndicateurImpl.php +++ b/module/Application/src/Application/Service/Indicateur/Agrement/AttenteAgrementAbstractIndicateurImpl.php @@ -45,7 +45,7 @@ abstract class AttenteAgrementAbstractIndicateurImpl extends AbstractIntervenant { return $this->getHelperUrl()->fromRoute( 'intervenant/agrement/liste', - ['intervenant' => $result->getSourceCode(), 'typeAgrement' => $this->getTypeAgrement()->getId()], + ['intervenant' => $result->getRouteParam(), 'typeAgrement' => $this->getTypeAgrement()->getId()], ['force_canonical' => true]); } diff --git a/module/Application/src/Application/Service/Indicateur/Contrat/AgrementCAMaisPasContratIndicateurImpl.php b/module/Application/src/Application/Service/Indicateur/Contrat/AgrementCAMaisPasContratIndicateurImpl.php index c431d302e742a984b7e853a48c229d746bab429a..49bf99bc24e6f0d329558b052f413f97a68110c7 100644 --- a/module/Application/src/Application/Service/Indicateur/Contrat/AgrementCAMaisPasContratIndicateurImpl.php +++ b/module/Application/src/Application/Service/Indicateur/Contrat/AgrementCAMaisPasContratIndicateurImpl.php @@ -33,7 +33,7 @@ class AgrementCAMaisPasContratIndicateurImpl extends AbstractIntervenantResultIn { return $this->getHelperUrl()->fromRoute( 'intervenant/contrat', - ['intervenant' => $result->getSourceCode()], + ['intervenant' => $result->getRouteParam()], ['force_canonical' => true]); } diff --git a/module/Application/src/Application/Service/Indicateur/Contrat/AttenteAvenantIndicateurImpl.php b/module/Application/src/Application/Service/Indicateur/Contrat/AttenteAvenantIndicateurImpl.php index 4f27fcb19ce4b04ad24b6e966e499f431871dc63..f1a1f405bb3d2827b278e5a9c04c38b0fca708d8 100644 --- a/module/Application/src/Application/Service/Indicateur/Contrat/AttenteAvenantIndicateurImpl.php +++ b/module/Application/src/Application/Service/Indicateur/Contrat/AttenteAvenantIndicateurImpl.php @@ -29,7 +29,7 @@ class AttenteAvenantIndicateurImpl extends AbstractIntervenantResultIndicateurIm { return $this->getHelperUrl()->fromRoute( 'intervenant/contrat', - ['intervenant' => $result->getSourceCode()], + ['intervenant' => $result->getRouteParam()], ['force_canonical' => true]); } diff --git a/module/Application/src/Application/Service/Indicateur/Contrat/AttenteContratIndicateurImpl.php b/module/Application/src/Application/Service/Indicateur/Contrat/AttenteContratIndicateurImpl.php index 44837d1fa469ef0278db8343fa0b45728083633e..b58f2b0f08704c7c62922bae12904c148658b7c6 100644 --- a/module/Application/src/Application/Service/Indicateur/Contrat/AttenteContratIndicateurImpl.php +++ b/module/Application/src/Application/Service/Indicateur/Contrat/AttenteContratIndicateurImpl.php @@ -29,7 +29,7 @@ class AttenteContratIndicateurImpl extends AbstractIntervenantResultIndicateurIm { return $this->getHelperUrl()->fromRoute( 'intervenant/contrat', - ['intervenant' => $result->getSourceCode()], + ['intervenant' => $result->getRouteParam()], ['force_canonical' => true]); } diff --git a/module/Application/src/Application/Service/Indicateur/Contrat/AttenteRetourContratIndicateurImpl.php b/module/Application/src/Application/Service/Indicateur/Contrat/AttenteRetourContratIndicateurImpl.php index 3ddffb33d11ba54865e59fbe4719f92674438898..80077323d5b6f3f1aab5845a13dab69ca47e2014 100644 --- a/module/Application/src/Application/Service/Indicateur/Contrat/AttenteRetourContratIndicateurImpl.php +++ b/module/Application/src/Application/Service/Indicateur/Contrat/AttenteRetourContratIndicateurImpl.php @@ -29,7 +29,7 @@ class AttenteRetourContratIndicateurImpl extends AbstractIntervenantResultIndica { return $this->getHelperUrl()->fromRoute( 'intervenant/contrat', - ['intervenant' => $result->getSourceCode()], + ['intervenant' => $result->getRouteParam()], ['force_canonical' => true]); } diff --git a/module/Application/src/Application/Service/Indicateur/Contrat/ContratAvenantDeposesIndicateurImpl.php b/module/Application/src/Application/Service/Indicateur/Contrat/ContratAvenantDeposesIndicateurImpl.php index c5f7766bbd7ed40d04a2c50fb3043995da8ef6e7..56ea2f11116c96f011f754f95a358f7a90b33bca 100644 --- a/module/Application/src/Application/Service/Indicateur/Contrat/ContratAvenantDeposesIndicateurImpl.php +++ b/module/Application/src/Application/Service/Indicateur/Contrat/ContratAvenantDeposesIndicateurImpl.php @@ -80,7 +80,7 @@ class ContratAvenantDeposesIndicateurImpl extends AbstractIntervenantResultIndic { return $this->getHelperUrl()->fromRoute( 'intervenant/contrat', - ['intervenant' => $result->getSourceCode()], + ['intervenant' => $result->getRouteParam()], ['force_canonical' => true]); } diff --git a/module/Application/src/Application/Service/Indicateur/Contrat/SaisieServiceApresContratAvenantIndicateurImpl.php b/module/Application/src/Application/Service/Indicateur/Contrat/SaisieServiceApresContratAvenantIndicateurImpl.php index 08808bf263d8c73f6aafc28cc90c56a75bb844ef..f850df1da0f203b97957ad4eef66c621b799cb1b 100644 --- a/module/Application/src/Application/Service/Indicateur/Contrat/SaisieServiceApresContratAvenantIndicateurImpl.php +++ b/module/Application/src/Application/Service/Indicateur/Contrat/SaisieServiceApresContratAvenantIndicateurImpl.php @@ -27,7 +27,7 @@ class SaisieServiceApresContratAvenantIndicateurImpl extends AbstractIntervenant { return $this->getHelperUrl()->fromRoute( 'intervenant/validation-service', - ['intervenant' => $result->getSourceCode()], + ['intervenant' => $result->getRouteParam()], ['force_canonical' => true]); } diff --git a/module/Application/src/Application/Service/Indicateur/Dossier/AttenteValidationDonneesPersoIndicateurImpl.php b/module/Application/src/Application/Service/Indicateur/Dossier/AttenteValidationDonneesPersoIndicateurImpl.php index f822f0c50a5e8904cbd84cc72f44e14c768768be..db5b392f90e868c0eb2557c09e55032f3a220e26 100644 --- a/module/Application/src/Application/Service/Indicateur/Dossier/AttenteValidationDonneesPersoIndicateurImpl.php +++ b/module/Application/src/Application/Service/Indicateur/Dossier/AttenteValidationDonneesPersoIndicateurImpl.php @@ -28,7 +28,7 @@ class AttenteValidationDonneesPersoIndicateurImpl extends AbstractIntervenantRes { return $this->getHelperUrl()->fromRoute( 'intervenant/validation-dossier', - ['intervenant' => $result->getSourceCode()], + ['intervenant' => $result->getRouteParam()], ['force_canonical' => true]); } diff --git a/module/Application/src/Application/Service/Indicateur/Dossier/DonneesPersoDiffImportIndicateurImpl.php b/module/Application/src/Application/Service/Indicateur/Dossier/DonneesPersoDiffImportIndicateurImpl.php index b67e163f8ace4a63d0708979b58efea05c90f72d..56402066bcaabc87ee819880ea05525626032aab 100644 --- a/module/Application/src/Application/Service/Indicateur/Dossier/DonneesPersoDiffImportIndicateurImpl.php +++ b/module/Application/src/Application/Service/Indicateur/Dossier/DonneesPersoDiffImportIndicateurImpl.php @@ -26,7 +26,7 @@ class DonneesPersoDiffImportIndicateurImpl extends AbstractIntervenantResultIndi { return $this->getHelperUrl()->fromRoute( 'indicateur/result-item', - ['action' => 'result-item-donnees-perso-diff-import', 'intervenant' => $result->getSourceCode()], + ['action' => 'result-item-donnees-perso-diff-import', 'intervenant' => $result->getRouteParam()], ['force_canonical' => true]); } diff --git a/module/Application/src/Application/Service/Indicateur/Dossier/DonneesPersoModifIndicateurImpl.php b/module/Application/src/Application/Service/Indicateur/Dossier/DonneesPersoModifIndicateurImpl.php index 8b19022d414488577d7018a76aadf260df28d010..2f7830e4f2bd7344de9904b2ff823810b2e02869 100644 --- a/module/Application/src/Application/Service/Indicateur/Dossier/DonneesPersoModifIndicateurImpl.php +++ b/module/Application/src/Application/Service/Indicateur/Dossier/DonneesPersoModifIndicateurImpl.php @@ -26,7 +26,7 @@ class DonneesPersoModifIndicateurImpl extends AbstractIntervenantResultIndicateu { return $this->getHelperUrl()->fromRoute( 'indicateur/result-item', - ['action' => 'result-item-donnees-perso-modif', 'intervenant' => $result->getSourceCode()], + ['action' => 'result-item-donnees-perso-modif', 'intervenant' => $result->getRouteParam()], ['force_canonical' => true]); } diff --git a/module/Application/src/Application/Service/Indicateur/Paiement/AttenteDemandeMepAbstractIndicateurImpl.php b/module/Application/src/Application/Service/Indicateur/Paiement/AttenteDemandeMepAbstractIndicateurImpl.php index 81990422192de83d2d1b7e2625480097e98ccfe7..ab1264c08e6eeda08938c1c05e1c328221c1313d 100644 --- a/module/Application/src/Application/Service/Indicateur/Paiement/AttenteDemandeMepAbstractIndicateurImpl.php +++ b/module/Application/src/Application/Service/Indicateur/Paiement/AttenteDemandeMepAbstractIndicateurImpl.php @@ -52,7 +52,7 @@ abstract class AttenteDemandeMepAbstractIndicateurImpl extends AbstractIntervena { return $this->getHelperUrl()->fromRoute( 'intervenant/demande-mise-en-paiement', - ['intervenant' => $result->getIntervenant()->getSourceCode()], + ['intervenant' => $result->getIntervenant()->getRouteParam()], ['force_canonical' => true]); } diff --git a/module/Application/src/Application/Service/Indicateur/PieceJointe/AttentePieceJustifIndicateurImpl.php b/module/Application/src/Application/Service/Indicateur/PieceJointe/AttentePieceJustifIndicateurImpl.php index 99c199ebb1753f00e5cae49f7a86e7410913fc14..1f28c9c4dd6d4106e9821450b160252a4095f22a 100644 --- a/module/Application/src/Application/Service/Indicateur/PieceJointe/AttentePieceJustifIndicateurImpl.php +++ b/module/Application/src/Application/Service/Indicateur/PieceJointe/AttentePieceJustifIndicateurImpl.php @@ -32,7 +32,7 @@ class AttentePieceJustifIndicateurImpl extends AbstractIntervenantResultIndicate { return $this->getHelperUrl()->fromRoute( 'piece-jointe/intervenant', - ['intervenant' => $result->getSourceCode()], + ['intervenant' => $result->getRouteParam()], ['force_canonical' => true]); } diff --git a/module/Application/src/Application/Service/Indicateur/PieceJointe/AttenteValidationPieceJustifIndicateurImpl.php b/module/Application/src/Application/Service/Indicateur/PieceJointe/AttenteValidationPieceJustifIndicateurImpl.php index 34a476fda922a4b2645c0e519db9db903d9526c6..3d2cdb0654a9809933cd9e2cffb71228979e0e4e 100644 --- a/module/Application/src/Application/Service/Indicateur/PieceJointe/AttenteValidationPieceJustifIndicateurImpl.php +++ b/module/Application/src/Application/Service/Indicateur/PieceJointe/AttenteValidationPieceJustifIndicateurImpl.php @@ -31,7 +31,7 @@ class AttenteValidationPieceJustifIndicateurImpl extends AbstractIntervenantResu { return $this->getHelperUrl()->fromRoute( 'piece-jointe/intervenant', - ['intervenant' => $result->getSourceCode()], + ['intervenant' => $result->getRouteParam()], ['force_canonical' => true]); } diff --git a/module/Application/src/Application/Service/Indicateur/Service/Affectation/IntervAffectAutreIntervMemeAbstractIndicateurImpl.php b/module/Application/src/Application/Service/Indicateur/Service/Affectation/IntervAffectAutreIntervMemeAbstractIndicateurImpl.php index b49b45ca6819c0f5e4c6eee407b9913b8825cab3..e6b93755f8dff9a71bfb6a6ee7208cff6b03d60e 100644 --- a/module/Application/src/Application/Service/Indicateur/Service/Affectation/IntervAffectAutreIntervMemeAbstractIndicateurImpl.php +++ b/module/Application/src/Application/Service/Indicateur/Service/Affectation/IntervAffectAutreIntervMemeAbstractIndicateurImpl.php @@ -51,7 +51,7 @@ abstract class IntervAffectAutreIntervMemeAbstractIndicateurImpl extends Abstrac { return $this->getHelperUrl()->fromRoute( 'intervenant/services', - ['intervenant' => $result->getSourceCode()], + ['intervenant' => $result->getRouteParam()], ['force_canonical' => true]); } diff --git a/module/Application/src/Application/Service/Indicateur/Service/Affectation/IntervAffectMemeIntervAutreAbstractIndicateurImpl.php b/module/Application/src/Application/Service/Indicateur/Service/Affectation/IntervAffectMemeIntervAutreAbstractIndicateurImpl.php index 7712ce4222d1a1d11dbe9a4ec2a7e0c74c3451b1..a958920265c3301b8351a133e7debbeb3775af4e 100644 --- a/module/Application/src/Application/Service/Indicateur/Service/Affectation/IntervAffectMemeIntervAutreAbstractIndicateurImpl.php +++ b/module/Application/src/Application/Service/Indicateur/Service/Affectation/IntervAffectMemeIntervAutreAbstractIndicateurImpl.php @@ -51,7 +51,7 @@ abstract class IntervAffectMemeIntervAutreAbstractIndicateurImpl extends Abstrac { return $this->getHelperUrl()->fromRoute( 'intervenant/services', - ['intervenant' => $result->getSourceCode()], + ['intervenant' => $result->getRouteParam()], ['force_canonical' => true]); } diff --git a/module/Application/src/Application/Service/Indicateur/Service/EnsHistoIndicateurImpl.php b/module/Application/src/Application/Service/Indicateur/Service/EnsHistoIndicateurImpl.php index 81dbeb7290fdce144e6fb1234e372e911726c648..c661831f739d22edc080f9ad9ee4bfe24c996baf 100644 --- a/module/Application/src/Application/Service/Indicateur/Service/EnsHistoIndicateurImpl.php +++ b/module/Application/src/Application/Service/Indicateur/Service/EnsHistoIndicateurImpl.php @@ -44,7 +44,7 @@ class EnsHistoIndicateurImpl extends AbstractIntervenantResultIndicateurImpl { return $this->getHelperUrl()->fromRoute( 'intervenant/services', - ['intervenant' => $result->getSourceCode()], + ['intervenant' => $result->getRouteParam()], ['force_canonical' => true]); } diff --git a/module/Application/src/Application/Service/Indicateur/Service/EnsRealisePermSaisieNonClotureeIndicateurImpl.php b/module/Application/src/Application/Service/Indicateur/Service/EnsRealisePermSaisieNonClotureeIndicateurImpl.php index 4b4ba357c9cb4baf72465fbd70f553b6000cac49..ad78119988ea6714d41c3d5aebb1d2eafb57cc98 100644 --- a/module/Application/src/Application/Service/Indicateur/Service/EnsRealisePermSaisieNonClotureeIndicateurImpl.php +++ b/module/Application/src/Application/Service/Indicateur/Service/EnsRealisePermSaisieNonClotureeIndicateurImpl.php @@ -32,7 +32,7 @@ class EnsRealisePermSaisieNonClotureeIndicateurImpl extends AbstractIntervenantR { return $this->getHelperUrl()->fromRoute( 'intervenant/services-realises', - ['intervenant' => $result->getSourceCode()], + ['intervenant' => $result->getRouteParam()], ['force_canonical' => true]); } diff --git a/module/Application/src/Application/Service/Indicateur/Service/Plafond/PlafondHcPrevuHorsRemuFcDepasseIndicateurImpl.php b/module/Application/src/Application/Service/Indicateur/Service/Plafond/PlafondHcPrevuHorsRemuFcDepasseIndicateurImpl.php index 9c1ae613c975712358c1f51fa7d6b1d21ffed1c1..c0c91f0f814a800fea3836d7efbecf894f16cabb 100644 --- a/module/Application/src/Application/Service/Indicateur/Service/Plafond/PlafondHcPrevuHorsRemuFcDepasseIndicateurImpl.php +++ b/module/Application/src/Application/Service/Indicateur/Service/Plafond/PlafondHcPrevuHorsRemuFcDepasseIndicateurImpl.php @@ -31,7 +31,7 @@ class PlafondHcPrevuHorsRemuFcDepasseIndicateurImpl extends PlafondHcHorsRemuFcD { return $this->getHelperUrl()->fromRoute( 'intervenant/services', - ['intervenant' => $result->getIntervenant()->getSourceCode()], + ['intervenant' => $result->getIntervenant()->getRouteParam()], ['force_canonical' => true]); } } \ No newline at end of file diff --git a/module/Application/src/Application/Service/Indicateur/Service/Plafond/PlafondHcRealiseHorsRemuFcDepasseIndicateurImpl.php b/module/Application/src/Application/Service/Indicateur/Service/Plafond/PlafondHcRealiseHorsRemuFcDepasseIndicateurImpl.php index 1989fc1a8935f5633da725d202c46f16305cdc4a..220e4f67eb7c9c08329a9851cf3cd0ae70b1da1a 100644 --- a/module/Application/src/Application/Service/Indicateur/Service/Plafond/PlafondHcRealiseHorsRemuFcDepasseIndicateurImpl.php +++ b/module/Application/src/Application/Service/Indicateur/Service/Plafond/PlafondHcRealiseHorsRemuFcDepasseIndicateurImpl.php @@ -31,7 +31,7 @@ class PlafondHcRealiseHorsRemuFcDepasseIndicateurImpl extends PlafondHcHorsRemuF { return $this->getHelperUrl()->fromRoute( 'intervenant/services-realises', - ['intervenant' => $result->getIntervenant()->getSourceCode()], + ['intervenant' => $result->getIntervenant()->getRouteParam()], ['force_canonical' => true]); } } \ No newline at end of file diff --git a/module/Application/src/Application/Service/Indicateur/Service/Plafond/PlafondRefDepasseAbstractIndicateurImpl.php b/module/Application/src/Application/Service/Indicateur/Service/Plafond/PlafondRefDepasseAbstractIndicateurImpl.php index f0a621abc11a26af24d8b3a40d64275616cbc625..b973ee033e33e905498070e6fb2e4a6b4d76cb0f 100644 --- a/module/Application/src/Application/Service/Indicateur/Service/Plafond/PlafondRefDepasseAbstractIndicateurImpl.php +++ b/module/Application/src/Application/Service/Indicateur/Service/Plafond/PlafondRefDepasseAbstractIndicateurImpl.php @@ -69,7 +69,7 @@ abstract class PlafondRefDepasseAbstractIndicateurImpl extends AbstractIntervena $out = sprintf("<strong>%s</strong> : %s <small>(n°%s, %s%s)</small>, total Référentiel = %s (plafond = %s)", $resultItem->getStructure(), $intervenant, - $intervenant->getSourceCode(), + $intervenant->getRouteParam(), $intervenant->getStatut(), $intervenant->getStatut()->estPermanent() ? ", " . $intervenant->getStructure() : null, Util::formattedNumber($resultItem->getTotal()), diff --git a/module/Application/src/Application/Service/Indicateur/Service/Plafond/PlafondRefPrevuDepasseIndicateurImpl.php b/module/Application/src/Application/Service/Indicateur/Service/Plafond/PlafondRefPrevuDepasseIndicateurImpl.php index 1e563d4f42049dd3d1acaed068af93cf5868fb6c..6d75265cacc7960899b2298bc9f3edab7fd9e8c8 100644 --- a/module/Application/src/Application/Service/Indicateur/Service/Plafond/PlafondRefPrevuDepasseIndicateurImpl.php +++ b/module/Application/src/Application/Service/Indicateur/Service/Plafond/PlafondRefPrevuDepasseIndicateurImpl.php @@ -31,7 +31,7 @@ class PlafondRefPrevuDepasseIndicateurImpl extends PlafondRefDepasseAbstractIndi { return $this->getHelperUrl()->fromRoute( 'intervenant/services', - ['intervenant' => $result->getIntervenant()->getSourceCode()], + ['intervenant' => $result->getIntervenant()->getRouteParam()], ['force_canonical' => true]); } } \ No newline at end of file diff --git a/module/Application/src/Application/Service/Indicateur/Service/Plafond/PlafondRefRealiseDepasseIndicateurImpl.php b/module/Application/src/Application/Service/Indicateur/Service/Plafond/PlafondRefRealiseDepasseIndicateurImpl.php index 9c42adfa8ed161640f9a2f0177c33efde60dfa68..f79ace86a0807fbfc945aa9acf7e2e9f90142285 100644 --- a/module/Application/src/Application/Service/Indicateur/Service/Plafond/PlafondRefRealiseDepasseIndicateurImpl.php +++ b/module/Application/src/Application/Service/Indicateur/Service/Plafond/PlafondRefRealiseDepasseIndicateurImpl.php @@ -30,7 +30,7 @@ class PlafondRefRealiseDepasseIndicateurImpl extends PlafondRefDepasseAbstractIn { return $this->getHelperUrl()->fromRoute( 'intervenant/services-realises', - ['intervenant' => $result->getIntervenant()->getSourceCode()], + ['intervenant' => $result->getIntervenant()->getRouteParam()], ['force_canonical' => true]); } } \ No newline at end of file diff --git a/module/Application/src/Application/Service/Indicateur/Service/Validation/Enseignement/Prevu/AttenteValidationAbstractIndicateurImpl.php b/module/Application/src/Application/Service/Indicateur/Service/Validation/Enseignement/Prevu/AttenteValidationAbstractIndicateurImpl.php index 2cdc3b5b081d678597cd31f1dcd4dadd26935207..6973dd0f4f4325bd45edc572d6e8ca714d836340 100644 --- a/module/Application/src/Application/Service/Indicateur/Service/Validation/Enseignement/Prevu/AttenteValidationAbstractIndicateurImpl.php +++ b/module/Application/src/Application/Service/Indicateur/Service/Validation/Enseignement/Prevu/AttenteValidationAbstractIndicateurImpl.php @@ -41,7 +41,7 @@ abstract class AttenteValidationAbstractIndicateurImpl extends BaseAttenteValida { return $this->getHelperUrl()->fromRoute( 'intervenant/validation-service', - ['intervenant' => $result->getSourceCode()], + ['intervenant' => $result->getRouteParam()], ['force_canonical' => true]); } diff --git a/module/Application/src/Application/Service/Indicateur/Service/Validation/Enseignement/Realise/AttenteValidationAbstractIndicateurImpl.php b/module/Application/src/Application/Service/Indicateur/Service/Validation/Enseignement/Realise/AttenteValidationAbstractIndicateurImpl.php index ae1bd45b6c00e0d27d055c986d7eae4666910c75..d9059213749e8de01039d275975409ec1040d3da 100644 --- a/module/Application/src/Application/Service/Indicateur/Service/Validation/Enseignement/Realise/AttenteValidationAbstractIndicateurImpl.php +++ b/module/Application/src/Application/Service/Indicateur/Service/Validation/Enseignement/Realise/AttenteValidationAbstractIndicateurImpl.php @@ -43,7 +43,7 @@ abstract class AttenteValidationAbstractIndicateurImpl extends BaseAttenteValida { return $this->getHelperUrl()->fromRoute( 'intervenant/validation-service-realise', - ['intervenant' => $result->getSourceCode()], + ['intervenant' => $result->getRouteParam()], ['force_canonical' => true]); } diff --git a/module/Application/src/Application/Service/Indicateur/Service/Validation/Enseignement/Realise/AttenteValidationPermAutreCompIndicateurImpl.php b/module/Application/src/Application/Service/Indicateur/Service/Validation/Enseignement/Realise/AttenteValidationPermAutreCompIndicateurImpl.php index cb5d37bce1a2af550f45452db7a0655c9bc5fa9b..1afc1701cf4f164b90086c6d8738d0208a2e5161 100644 --- a/module/Application/src/Application/Service/Indicateur/Service/Validation/Enseignement/Realise/AttenteValidationPermAutreCompIndicateurImpl.php +++ b/module/Application/src/Application/Service/Indicateur/Service/Validation/Enseignement/Realise/AttenteValidationPermAutreCompIndicateurImpl.php @@ -57,7 +57,7 @@ class AttenteValidationPermAutreCompIndicateurImpl extends AbstractIntervenantRe { return $this->getHelperUrl()->fromRoute( 'intervenant/validation-service-realise', - ['intervenant' => $result->getIntervenant()->getSourceCode()], + ['intervenant' => $result->getIntervenant()->getRouteParam()], ['force_canonical' => true]); } diff --git a/module/Application/src/Application/Service/Indicateur/Service/Validation/Referentiel/Prevu/AttenteValidationAbstractIndicateurImpl.php b/module/Application/src/Application/Service/Indicateur/Service/Validation/Referentiel/Prevu/AttenteValidationAbstractIndicateurImpl.php index fe6ca34bfaa9fc864b0ebd7130feb26a12595310..82ef0ceaf959e296177d33a9d786f69df88bbc29 100644 --- a/module/Application/src/Application/Service/Indicateur/Service/Validation/Referentiel/Prevu/AttenteValidationAbstractIndicateurImpl.php +++ b/module/Application/src/Application/Service/Indicateur/Service/Validation/Referentiel/Prevu/AttenteValidationAbstractIndicateurImpl.php @@ -41,7 +41,7 @@ abstract class AttenteValidationAbstractIndicateurImpl extends BaseAttenteValida { return $this->getHelperUrl()->fromRoute( 'intervenant/validation-referentiel', - ['intervenant' => $result->getSourceCode()], + ['intervenant' => $result->getRouteParam()], ['force_canonical' => true]); } diff --git a/module/Application/src/Application/Service/Indicateur/Service/Validation/Referentiel/Realise/AttenteValidationAbstractIndicateurImpl.php b/module/Application/src/Application/Service/Indicateur/Service/Validation/Referentiel/Realise/AttenteValidationAbstractIndicateurImpl.php index 33314c7e83243073b648489a96d0a3be59fd3eae..e292c4eb31c588868df45a8b447e92f5be3a19d5 100644 --- a/module/Application/src/Application/Service/Indicateur/Service/Validation/Referentiel/Realise/AttenteValidationAbstractIndicateurImpl.php +++ b/module/Application/src/Application/Service/Indicateur/Service/Validation/Referentiel/Realise/AttenteValidationAbstractIndicateurImpl.php @@ -43,7 +43,7 @@ abstract class AttenteValidationAbstractIndicateurImpl extends BaseAttenteValida { return $this->getHelperUrl()->fromRoute( 'intervenant/validation-referentiel-realise', - ['intervenant' => $result->getSourceCode()], + ['intervenant' => $result->getRouteParam()], ['force_canonical' => true]); } diff --git a/module/Application/src/Application/Service/Indicateur/Service/Validation/Referentiel/Realise/AttenteValidationPermAutreCompIndicateurImpl.php b/module/Application/src/Application/Service/Indicateur/Service/Validation/Referentiel/Realise/AttenteValidationPermAutreCompIndicateurImpl.php index 972addc79c58290ee0fd81f29b9dd6dece83f640..9a3e79c1533d6d5dc367b24d0800fc96ee734233 100644 --- a/module/Application/src/Application/Service/Indicateur/Service/Validation/Referentiel/Realise/AttenteValidationPermAutreCompIndicateurImpl.php +++ b/module/Application/src/Application/Service/Indicateur/Service/Validation/Referentiel/Realise/AttenteValidationPermAutreCompIndicateurImpl.php @@ -57,7 +57,7 @@ class AttenteValidationPermAutreCompIndicateurImpl extends AbstractIntervenantRe { return $this->getHelperUrl()->fromRoute( 'intervenant/validation-referentiel-realise', - ['intervenant' => $result->getIntervenant()->getSourceCode()], + ['intervenant' => $result->getIntervenant()->getRouteParam()], ['force_canonical' => true]); } diff --git a/module/Application/src/Application/Service/Intervenant.php b/module/Application/src/Application/Service/Intervenant.php index 6b27e3066b0b10263097038ab267fe9e75d51c8c..c468c982ecc1061953695c286c72d0af9c1e948d 100644 --- a/module/Application/src/Application/Service/Intervenant.php +++ b/module/Application/src/Application/Service/Intervenant.php @@ -12,7 +12,8 @@ use Application\Service\Traits\StatutIntervenantAwareTrait; use RuntimeException; use Doctrine\ORM\QueryBuilder; use Import\Processus\Import; -use UnicaenApp\Util; +use UnicaenImport\Processus\Traits\ImportProcessusAwareTrait; + /** * Description of Intervenant @@ -22,112 +23,10 @@ use UnicaenApp\Util; class Intervenant extends AbstractEntityService { use StatutIntervenantAwareTrait; + use ImportProcessusAwareTrait; - /** - * @param string $critere - * @param integer $limit - * - * @return array - */ - public function recherche($critere, $limit = 50) - { - if (strlen($critere) < 2) return []; - - $anneeId = (int)$this->getServiceContext()->getAnnee()->getId(); - - $critere = Util::reduce($critere); - $criteres = explode('_', $critere); - - $sql = 'SELECT * FROM V_INTERVENANT_RECHERCHE WHERE rownum <= ' . (int)$limit . ' AND annee_id = ' . $anneeId; - $sqlCri = ''; - $criCode = 0; - - foreach ($criteres as $c) { - $cc = (int)$c; - if (0 === $cc) { - if ($sqlCri != '') $sqlCri .= ' AND '; - $sqlCri .= 'critere LIKE q\'[%' . $c . '%]\''; - } else { - $criCode = $cc; - } - } - $orc = ''; - if ($sqlCri != '') { - $orc[] = '(' . $sqlCri . ')'; - } - if ($criCode) { - $orc[] = 'source_code LIKE \'%' . $criCode . '%\''; - } - $orc = implode(' OR ', $orc); - $sql .= ' AND (' . $orc . ') ORDER BY nom_usuel, prenom'; - - $stmt = $this->getEntityManager()->getConnection()->executeQuery($sql); - - $intervenants = []; - while ($r = $stmt->fetch()) { - $intervenants[$r['SOURCE_CODE']] = [ - 'civilite' => $r['CIVILITE'], - 'nom' => $r['NOM_USUEL'], - 'prenom' => $r['PRENOM'], - 'date-naissance' => new \DateTime($r['DATE_NAISSANCE']), - 'structure' => $r['STRUCTURE'], - 'numero-personnel' => $r['SOURCE_CODE'], - ]; - } - - return $intervenants; - } - - - - /** - * Recherche par : - * - id source exact (numéro Harpege ou autre), - * - ou nom usuel (et prénom), - * - ou nom patronymique (et prénom). - * - * @param string $term - * - * @return QueryBuilder - */ - public function finderByNomPrenomId($term, QueryBuilder $qb = null, $alias = null) - { - list($qb, $alias) = $this->initQuery($qb, $alias); - - $term = str_replace(' ', '', $term); - - $concatNomUsuelPrenom = new \Doctrine\ORM\Query\Expr\Func('CONVERT', - [$qb->expr()->concat($alias . '.nomUsuel', $alias . '.prenom'), '?3'] - ); - $concatNomPatroPrenom = new \Doctrine\ORM\Query\Expr\Func('CONVERT', - [$qb->expr()->concat($alias . '.nomPatronymique', $alias . '.prenom'), '?3'] - ); - $concatPrenomNomUsuel = new \Doctrine\ORM\Query\Expr\Func('CONVERT', - [$qb->expr()->concat($alias . '.prenom', $alias . '.nomUsuel'), '?3'] - ); - $concatPrenomNomPatro = new \Doctrine\ORM\Query\Expr\Func('CONVERT', - [$qb->expr()->concat($alias . '.prenom', $alias . '.nomPatronymique'), '?3'] - ); - - $qb -// ->select('i.') - ->where($alias . '.sourceCode = ?1') - ->orWhere($qb->expr()->like($qb->expr()->upper($concatNomUsuelPrenom), $qb->expr()->upper('CONVERT(?2, ?3)'))) - ->orWhere($qb->expr()->like($qb->expr()->upper($concatNomPatroPrenom), $qb->expr()->upper('CONVERT(?2, ?3)'))) - ->orWhere($qb->expr()->like($qb->expr()->upper($concatPrenomNomUsuel), $qb->expr()->upper('CONVERT(?2, ?3)'))) - ->orWhere($qb->expr()->like($qb->expr()->upper($concatPrenomNomPatro), $qb->expr()->upper('CONVERT(?2, ?3)'))) - ->orderBy($alias . '.nomUsuel, ' . $alias . '.prenom'); - - $qb->setParameters([1 => $term, 2 => "%$term%", 3 => 'US7ASCII']); - -// print_r($qb->getQuery()->getSQL()); var_dump($qb->getQuery()->getParameters());die; - - return $qb; - } - - /** * retourne la classe des entités @@ -149,7 +48,7 @@ class Intervenant extends AbstractEntityService * * @return IntervenantEntity */ - public function getBySourceCode($sourceCode, AnneeEntity $annee = null) + public function getBySourceCode($sourceCode, AnneeEntity $annee = null, $autoImport=true) { if (null == $sourceCode) return null; @@ -161,10 +60,16 @@ class Intervenant extends AbstractEntityService $repo = $this->getRepo(); $result = $repo->findOneBy($findParams); - if (!$result) { - $import = $this->getServiceLocator()->get('importProcessusImport'); - /* @var $import Import */ - $import->intervenant($sourceCode); + if (!$result && $autoImport) { + $ip = $this->getProcessusImport(); + + $ip->execMaj( 'INTERVENANT', 'SOURCE_CODE', $sourceCode, $ip::A_INSERT ); + $id = $this->getServiceQueryGenerator()->getIdFromSourceCode( 'INTERVENANT', $sourceCode, $annee->getId() ); + if (! empty($id)){ + $ip->execMaj( 'ADRESSE_INTERVENANT', 'INTERVENANT_ID', $id, $ip::A_ALL ); + $ip->execMaj( 'AFFECTATION_RECHERCHE', 'INTERVENANT_ID', $id, $ip::A_ALL ); + } + $result = $repo->findOneBy($findParams); // on retente } @@ -185,71 +90,6 @@ class Intervenant extends AbstractEntityService - /** - * Finder par étape franchie dans le workflow de l'intervenant. - * - * @param string $codeEtape Ex: WfEtape::CODE_PJ_SAISIE - * @param QueryBuilder $qb - * - * @return QueryBuilder - * @see \Application\Entity\Db\WfEtape - */ - public function finderByWfEtapeFranchie($codeEtape, QueryBuilder $qb = null, $alias = null) - { - list($qb, $alias) = $this->initQuery($qb, $alias); - $qb - ->join("$alias.wfIntervenantEtape", "p", \Doctrine\ORM\Query\Expr\Join::WITH, "p.franchie = 1") - ->join("p.etape", "e", \Doctrine\ORM\Query\Expr\Join::WITH, "e.code = :codeEtape") - ->setParameter('codeEtape', $codeEtape); - - return $qb; - } - - - - /** - * Finder par étape courante dans le workflow de l'intervenant. - * - * @param string $codeEtape Ex: \Application\Entity\Db\WfEtape::CODE_PIECES_JOINTES - * @param QueryBuilder $qb - * - * @return QueryBuilder - */ - public function finderByWfEtapeCourante($codeEtape, QueryBuilder $qb = null, $alias = null) - { - list($qb, $alias) = $this->initQuery($qb, $alias); - $qb - ->join("$alias.wfIntervenantEtape", "p", \Doctrine\ORM\Query\Expr\Join::WITH, "p.courante = 1") - ->join("p.etape", "e", \Doctrine\ORM\Query\Expr\Join::WITH, "e.code = :codeEtape") - ->setParameter('codeEtape', $codeEtape); - - return $qb; - } - - - - /** - * Ajoutant les critères permettant de ne retenir que les intervenants ayant fourni - * une pièce justificative qui n'a pas encore été validée. - * - * @param QueryBuilder $qb - * - * @return QueryBuilder - */ - public function finderByPieceJointeFournieNonValidee(QueryBuilder $qb = null, $alias = null) - { - list($qb, $alias) = $this->initQuery($qb, $alias); - $qb - ->join("$alias.dossier", "d") - ->join("d.pieceJointe", "pj") - ->leftJoin("pj.validation", "vpj") - ->andWhere("vpj IS NULL"); - - return $qb; - } - - - public function finderByMiseEnPaiement(StructureEntity $structure = null, PeriodeEntity $periode = null, QueryBuilder $qb = null, $alias = null) { $serviceMIS = $this->getServiceLocator()->get('applicationMiseEnPaiementIntervenantStructure'); @@ -258,9 +98,6 @@ class Intervenant extends AbstractEntityService $serviceMiseEnPaiement = $this->getServiceLocator()->get('applicationMiseEnPaiement'); /* @var $serviceMiseEnPaiement MiseEnPaiement */ - $serviceStructure = $this->getServiceLocator()->get('applicationStructure'); - /* @var $serviceStructure Structure */ - list($qb, $alias) = $this->initQuery($qb, $alias); $this->join($serviceMIS, $qb, 'miseEnPaiementIntervenantStructure', false, $alias); @@ -278,33 +115,6 @@ class Intervenant extends AbstractEntityService - /** - * Importe un intervenant si besoin. - * - * @param string $sourceCode Code source - * - * @return IntervenantEntity - * @throws RuntimeException Intervenant déjà importé ou introuvable après import - */ - public function importer($sourceCode) - { - if ($intervenant = $this->getBySourceCode($sourceCode)) { - return $intervenant; - } - - $import = $this->getServiceLocator()->get('importProcessusImport'); - /* @var $import Import */ - $import->intervenant($sourceCode); - - if (!($intervenant = $this->getRepo()->findOneBySourceCode($sourceCode))) { - // throw new RuntimeException("Vous n'êtes pas autorisé à vous connecter à OSE avec ce compte. Vous vous prions de vous rapprocher de votre composante pour en obtenir un valide."); - } - - return $intervenant; - } - - - /** * Retourne la liste des intervenants * @@ -345,29 +155,6 @@ class Intervenant extends AbstractEntityService - /** - * Recherche d'intervenant par le "source code" et l'année. - * - * @param string $sourceCode Code de l'intervenant dans la source de données (ex: numéro Harpege) - * @param AnneeEntity $annee Année concernée - * @param QueryBuilder|null $queryBuilder - * @param string|null $alias - * - * @return QueryBuilder - */ - public function finderBySourceCodeAndAnnee($sourceCode, AnneeEntity $annee, QueryBuilder $qb = null, $alias = null) - { - list($qb, $alias) = $this->initQuery($qb, $alias); - $qb - ->andWhere("$alias.sourceCode = :code AND $alias.annee = :annee") - ->setParameter('code', $sourceCode) - ->setParameter('annee', $annee); - - return $qb; - } - - - /** * Filtre par le type d'intervenant * diff --git a/module/Application/src/Application/Service/ServiceReferentiel.php b/module/Application/src/Application/Service/ServiceReferentiel.php index 08788c1b055d4bb8abbe98e9f61db8371301d0b2..fa9b60d3872a03c223c9dd999b7631f4c599f8e4 100644 --- a/module/Application/src/Application/Service/ServiceReferentiel.php +++ b/module/Application/src/Application/Service/ServiceReferentiel.php @@ -10,13 +10,11 @@ use Application\Service\Traits\StructureAwareTrait; use Application\Service\Traits\TypeVolumeHoraireAwareTrait; use Application\Service\Traits\VolumeHoraireReferentielAwareTrait; use Doctrine\ORM\QueryBuilder; -use Doctrine\ORM\Query\Expr\Join; use Application\Entity\Db\Intervenant as IntervenantEntity; use Application\Entity\Db\ServiceReferentiel as ServiceReferentielEntity; use Application\Entity\Db\Structure as StructureEntity; -use Application\Entity\Db\TypeIntervenant as TypeIntervenantEntity; use Application\Entity\Db\TypeVolumeHoraire as TypeVolumeHoraireEntity; -use Application\Entity\Db\Validation as ValidationEntity; + /** * Description of ServiceReferentiel @@ -83,87 +81,6 @@ class ServiceReferentiel extends AbstractEntityService - /** - * - * @param TypeIntervenantEntity $typeIntervenant - * @param QueryBuilder|null $queryBuilder - * - * @return QueryBuilder - */ - public function finderByTypeIntervenant(TypeIntervenantEntity $typeIntervenant = null, QueryBuilder $qb = null, $alias = null) - { - list($qb, $alias) = $this->initQuery($qb, $alias); - if ($typeIntervenant) { - $this->join($this->getServiceIntervenant(), $qb, 'intervenant', $alias); - $this->getServiceIntervenant()->finderByType($typeIntervenant, $qb); - } - - return $qb; - } - - - - /** - * - * @param StructureEntity $structure - * @param QueryBuilder|null $queryBuilder - * - * @return QueryBuilder - */ - public function finderByStructureAff(StructureEntity $structure = null, QueryBuilder $qb = null, $alias = null) - { - list($qb, $alias) = $this->initQuery($qb, $alias); - if ($structure) { - $this->join($this->getServiceIntervenant(), $qb, 'intervenant', $alias); - $this->getServiceIntervenant()->finderByStructure($structure, $qb); - } - - return $qb; - } - - - - /** - * - * @param StructureEntity $structure - * @param QueryBuilder|null $queryBuilder - * - * @return QueryBuilder - */ - public function finderByStructureEns(StructureEntity $structure = null, QueryBuilder $qb = null, $alias = null) - { - list($qb, $alias) = $this->initQuery($qb, $alias); - if ($structure) { - $this->finderByStructure($structure, $qb, $alias); - } - - return $qb; - } - - - - /** - * Retourne le query builder permettant de rechercher les services référentiels - * selon la composante spécifiée. - * - * @param StructureEntity $structure - * @param QueryBuilder|null $queryBuilder - * - * @return QueryBuilder - */ - public function finderByComposante(StructureEntity $structure, QueryBuilder $qb = null, $alias = null) - { - list($qb, $alias) = $this->initQuery($qb, $alias); - - $iAlias = $this->getServiceIntervenant()->getAlias(); - $filter = "($iAlias.structure = :composante OR $alias.structure = :composante)"; - $qb->andWhere($filter)->setParameter('composante', $structure); - - return $qb; - } - - - /** * Retourne la liste des services selon le contexte donné * @@ -356,96 +273,6 @@ class ServiceReferentiel extends AbstractEntityService - /** - * - * @param TypeVolumeHoraireEntity $typeVolumeHoraire - * @param IntervenantEntity $intervenant - * @param StructureEntity $structureRef - * - * @return QueryBuilder - */ - public function finderReferentielsNonValides( - TypeVolumeHoraireEntity $typeVolumeHoraire, - IntervenantEntity $intervenant = null, - StructureEntity $structureRef = null) - { - $dqlNotExists = <<<EOS -SELECT vhv FROM Application\Entity\Db\VolumeHoraireReferentiel vhv -JOIN vhv.validation v -WHERE vhv = vh -EOS; - - $qb = $this->getEntityManager()->createQueryBuilder() - ->select("s2, i, vh, f, strref") - ->from("Application\Entity\Db\ServiceReferentiel", 's2') - ->join("s2.intervenant", "i") - ->join("s2.volumeHoraireReferentiel", 'vh') - ->join("vh.typeVolumeHoraire", "tvh", Join::WITH, "tvh.code = :ctvh")->setParameter('ctvh', $typeVolumeHoraire->getCode()) - ->join("s2.structure", 'strref') - ->join("s2.fonction", 'f') - ->andWhere("NOT EXISTS ($dqlNotExists)") - ->addOrderBy("strref.libelleCourt", 'asc') - ->addOrderBy("s2.histoModification", 'asc'); - - if ($intervenant) { - $qb->andWhere("i = :intervenant")->setParameter('intervenant', $intervenant); - } - if ($structureRef) { - $qb->andWhere("strref = :structureRef")->setParameter('structureRef', $structureRef); - } - -// print_r($qb->getQuery()->getSQL()); - - return $qb; - } - - - - /** - * - * @param TypeVolumeHoraireEntity $typeVolumeHoraire - * @param TypeValidationEntity $validation - * @param IntervenantEntity $intervenant - * @param StructureEntity $structureRef - * @param StructureEntity $structureValidation - * - * @return QueryBuilder - */ - public function finderReferentielsValides( - TypeVolumeHoraireEntity $typeVolumeHoraire, - ValidationEntity $validation = null, - IntervenantEntity $intervenant = null, - StructureEntity $structureRef = null) - { - $qb = $this->getEntityManager()->createQueryBuilder() - ->select("s, i, vh, f, strref") - ->from("Application\Entity\Db\ServiceReferentiel", 's') - ->join("s.intervenant", "i") - ->join("s.volumeHoraireReferentiel", 'vh') - ->join("s.structure", 'strref') - ->join("s.fonction", 'f') - ->join("vh.validation", "v") - ->join("vh.typeVolumeHoraire", "tvh", Join::WITH, "tvh.code = :ctvh")->setParameter('ctvh', $typeVolumeHoraire->getCode()) - ->join("v.typeValidation", 'tv') - ->join("v.structure", 'str')// validés par la structure spécifiée - ->orderBy("v.histoModification", 'desc') - ->addOrderBy("strref.libelleCourt", 'asc'); - - if ($validation) { - $qb->andWhere("v = :validation")->setParameter('validation', $validation); - } - if ($intervenant) { - $qb->andWhere("i = :intervenant")->setParameter('intervenant', $intervenant); - } - if ($structureRef) { - $qb->andWhere("strref = :structureRef")->setParameter('structureRef', $structureRef); - } - - return $qb; - } - - - /** * Prend les services d'un intervenant, année n-1, et reporte ces services (et les volumes horaires associés) * sur l'année n @@ -490,7 +317,8 @@ EOS; $intervenantPrec = $this->getServiceIntervenant()->getBySourceCode( $intervenant->getSourceCode(), - $this->getServiceContext()->getAnneePrecedente() + $this->getServiceContext()->getAnneePrecedente(), + false ); $sVolumeHoraireReferentiel = $this->getServiceVolumeHoraireReferentiel(); diff --git a/module/Application/src/Application/Service/ServiceService.php b/module/Application/src/Application/Service/ServiceService.php index 91098a821dff8874c7d492f9e41bc3f2cfe070ed..2838a6247d0eb8089f16288abe22ed9ad2d4ab86 100644 --- a/module/Application/src/Application/Service/ServiceService.php +++ b/module/Application/src/Application/Service/ServiceService.php @@ -15,6 +15,7 @@ use Application\Entity\NiveauEtape as NiveauEtapeEntity; use Application\Entity\Service\Recherche; use Application\Form\Service\RechercheHydrator; use Application\Hydrator\Service\Traits\RechercheHydratorAwareTrait; +use Application\Provider\Privilege\Privileges; use Application\Service\Traits\ElementPedagogiqueAwareTrait; use Application\Service\Traits\EtapeAwareTrait; use Application\Service\Traits\IntervenantAwareTrait; @@ -250,7 +251,7 @@ class ServiceService extends AbstractEntityService if (!$entity->getIntervenant() && $intervenant = $role->getIntervenant()) { $entity->setIntervenant($intervenant); } - if (!$this->getAuthorize()->isAllowed($entity, $entity->getId() ? 'update' : 'create')) { + if (!$this->getAuthorize()->isAllowed($entity, Privileges::ENSEIGNEMENT_EDITION)) { throw new \BjyAuthorize\Exception\UnAuthorizedException('Saisie interdite'); } @@ -434,8 +435,9 @@ class ServiceService extends AbstractEntityService /** + * Utile pour la recherche de services * - * @param StructureEntity $structure +*@param StructureEntity $structure * @param QueryBuilder|null $queryBuilder * * @return QueryBuilder @@ -455,6 +457,27 @@ class ServiceService extends AbstractEntityService + /** + * Utile pour la recherche de services + * +*@param StructureEntity $structure + * @param QueryBuilder|null $queryBuilder + * + * @return QueryBuilder + */ + public function finderByStructureEns(StructureEntity $structure, QueryBuilder $qb = null, $alias = null) + { + list($qb, $alias) = $this->initQuery($qb, $alias); + + $serviceElementPedagogique = $this->getServiceElementPedagogique(); + $this->join($serviceElementPedagogique, $qb, 'elementPedagogique', false, $alias); + $serviceElementPedagogique->finderByStructure($structure, $qb); + + return $qb; + } + + + /** * Filtre la liste des services selon lecontexte courant * @@ -480,6 +503,25 @@ class ServiceService extends AbstractEntityService } + /** + * Retourne la liste des services selon l'étape donnée + * + * @param TypeIntervenantEntity $typeIntervenant + * @param QueryBuilder|null $queryBuilder + * + * @return QueryBuilder + */ + public function finderByTypeIntervenant(TypeIntervenantEntity $typeIntervenant = null, QueryBuilder $qb = null, $alias = null) + { + list($qb, $alias) = $this->initQuery($qb, $alias); + if ($typeIntervenant) { + $this->join($this->getServiceIntervenant(), $qb, 'intervenant', false, $alias); + $this->getServiceIntervenant()->finderByType($typeIntervenant, $qb); + } + + return $qb; + } + /** * Prend les services d'un intervenant, année n-1, et reporte ces services (et les volumes horaires associés) @@ -531,7 +573,8 @@ class ServiceService extends AbstractEntityService $intervenantPrec = $this->getServiceIntervenant()->getBySourceCode( $intervenant->getSourceCode(), - $this->getServiceContext()->getAnneePrecedente() + $this->getServiceContext()->getAnneePrecedente(), + false ); $sVolumeHoraire = $this->getServiceVolumeHoraire(); diff --git a/module/Application/src/Application/Service/Source.php b/module/Application/src/Application/Service/Source.php index 3f23d6214e15a6f0427316da860fd4e2db7b2f7b..3b82a8e95f97bfa82de3588c706d342a78c2d37f 100644 --- a/module/Application/src/Application/Service/Source.php +++ b/module/Application/src/Application/Service/Source.php @@ -12,6 +12,9 @@ use Application\Entity\Db\Source as SourceEntity; */ class Source extends AbstractEntityService { + const CODE_SOURCE_OSE = 'OSE'; + const CODE_SOURCE_TEST = 'Test'; + /** * retourne la classe des entités * @@ -20,7 +23,7 @@ class Source extends AbstractEntityService */ public function getEntityClass() { - return SourceEntity::class; + return \UnicaenImport\Entity\Db\Source::class; } /** @@ -40,7 +43,7 @@ class Source extends AbstractEntityService */ public function getOse() { - return $this->getRepo()->findOneBy(['code' => SourceEntity::CODE_SOURCE_OSE]); + return $this->getRepo()->findOneBy(['code' => self::CODE_SOURCE_OSE]); } /** @@ -50,7 +53,7 @@ class Source extends AbstractEntityService */ public function getTest() { - return $this->getRepo()->findOneBy(['code' => SourceEntity::CODE_SOURCE_TEST]); + return $this->getRepo()->findOneBy(['code' => self::CODE_SOURCE_TEST]); } /** diff --git a/module/Application/src/Application/Service/WorkflowService.php b/module/Application/src/Application/Service/WorkflowService.php index 47b9e24805998fca2f0a110579e840ea6e292ac0..57d784a57565a5b459fa12393494384360628e1d 100755 --- a/module/Application/src/Application/Service/WorkflowService.php +++ b/module/Application/src/Application/Service/WorkflowService.php @@ -206,7 +206,7 @@ class WorkflowService extends AbstractService $we->setStructure($structure); $we->setEtape($e->getEtape()); - $url = $this->getUrl($e->getEtape()->getRoute(), ['intervenant' => $intervenant->getSourceCode()]); + $url = $this->getUrl($e->getEtape()->getRoute(), ['intervenant' => $intervenant->getRouteParam()]); $we->setUrl($url); $this->feuillesDeRoute[$iid][$sid][$eid] = $we; diff --git a/module/Import/src/Import/View/Helper/DifferentielLigne/CheminPedagogique.php b/module/Application/src/Application/View/Helper/Import/CheminPedagogiqueViewHelper.php similarity index 78% rename from module/Import/src/Import/View/Helper/DifferentielLigne/CheminPedagogique.php rename to module/Application/src/Application/View/Helper/Import/CheminPedagogiqueViewHelper.php index 5a46b1e6663c3f1941378049ed792fcb48705c05..f57870e38b4355399ab1fcf56e9aea525b10a70a 100644 --- a/module/Import/src/Import/View/Helper/DifferentielLigne/CheminPedagogique.php +++ b/module/Application/src/Application/View/Helper/Import/CheminPedagogiqueViewHelper.php @@ -1,12 +1,13 @@ <?php -namespace Import\View\Helper\DifferentielLigne; +namespace Application\View\Helper\Import; +use UnicaenImport\View\Helper\DifferentielLigne\DifferentielLigne; /** * Aide de vue permettant d'afficher une ligne de différentiel d'import * * @author Laurent LÉCLUSE <laurent.lecluse at unicaen.fr> */ -class CheminPedagogique extends DifferentielLigne +class CheminPedagogiqueViewHelper extends DifferentielLigne { public function getColumnDetails($column, $value) diff --git a/module/Import/src/Import/View/Helper/DifferentielLigne/ElementPedagogique.php b/module/Application/src/Application/View/Helper/Import/ElementPedagogiqueViewHelper.php similarity index 81% rename from module/Import/src/Import/View/Helper/DifferentielLigne/ElementPedagogique.php rename to module/Application/src/Application/View/Helper/Import/ElementPedagogiqueViewHelper.php index 5b7d66e06d99b4d1f352ea1d47936b8528a1605c..d95c256b81b6e008ab127f9bcf3d6f94da304439 100644 --- a/module/Import/src/Import/View/Helper/DifferentielLigne/ElementPedagogique.php +++ b/module/Application/src/Application/View/Helper/Import/ElementPedagogiqueViewHelper.php @@ -1,12 +1,14 @@ <?php -namespace Import\View\Helper\DifferentielLigne; +namespace Application\View\Helper\Import; +use Application\Entity\Db\ElementPedagogique; +use UnicaenImport\View\Helper\DifferentielLigne\DifferentielLigne; /** * Aide de vue permettant d'afficher une ligne de différentiel d'import * * @author Laurent LÉCLUSE <laurent.lecluse at unicaen.fr> */ -class ElementPedagogique extends DifferentielLigne +class ElementPedagogiqueViewHelper extends DifferentielLigne { public function getSujet() { @@ -15,7 +17,7 @@ class ElementPedagogique extends DifferentielLigne return sprintf( $format, $this->ligne->get('LIBELLE'), $this->ligne->getSourceCode(), $this->ligne->get('ANNEE_ID').'-'.($this->ligne->get('ANNEE_ID')+1) ); }else{ $entity = $this->ligne->getEntity(); - /* @var $entity \Application\Entity\Db\ElementPedagogique */ + /* @var $entity ElementPedagogique */ return sprintf( $format, $entity->getLibelle(), $this->ligne->getSourceCode(), (string)$entity->getAnnee() ); } } diff --git a/module/Import/src/Import/View/Helper/DifferentielLigne/Etape.php b/module/Application/src/Application/View/Helper/Import/EtapeViewHelper.php similarity index 77% rename from module/Import/src/Import/View/Helper/DifferentielLigne/Etape.php rename to module/Application/src/Application/View/Helper/Import/EtapeViewHelper.php index 9cec00dcfd8a980010355554e37959f64fa76c68..3557c1bbbe028c07ebaafe25672d07f7d02a769d 100644 --- a/module/Import/src/Import/View/Helper/DifferentielLigne/Etape.php +++ b/module/Application/src/Application/View/Helper/Import/EtapeViewHelper.php @@ -1,15 +1,15 @@ <?php -namespace Import\View\Helper\DifferentielLigne; +namespace Application\View\Helper\Import; +use UnicaenImport\View\Helper\DifferentielLigne\DifferentielLigne; /** * Aide de vue permettant d'afficher une ligne de différentiel d'import * * @author Laurent LÉCLUSE <laurent.lecluse at unicaen.fr> */ -class Etape extends DifferentielLigne +class EtapeViewHelper extends DifferentielLigne { - use \Application\Service\Traits\StructureAwareTrait - ; + use \Application\Service\Traits\StructureAwareTrait; public function getColumnDetails($column, $value) { diff --git a/module/Import/src/Import/View/Helper/DifferentielLigne/Intervenant.php b/module/Application/src/Application/View/Helper/Import/IntervenantViewHelper.php similarity index 81% rename from module/Import/src/Import/View/Helper/DifferentielLigne/Intervenant.php rename to module/Application/src/Application/View/Helper/Import/IntervenantViewHelper.php index b3997563cbc2c2119760248d0bfcd7fbff1d346b..28ee7078a49a8ef5ff03463b32208d3d31ed9894 100644 --- a/module/Import/src/Import/View/Helper/DifferentielLigne/Intervenant.php +++ b/module/Application/src/Application/View/Helper/Import/IntervenantViewHelper.php @@ -1,12 +1,17 @@ <?php -namespace Import\View\Helper\DifferentielLigne; +namespace Application\View\Helper\Import; +use Application\Entity\Db\Intervenant; +use Application\Entity\Db\StatutIntervenant; +use Application\Entity\Db\Structure; +use Application\Entity\Db\TypeIntervenant; +use UnicaenImport\View\Helper\DifferentielLigne\DifferentielLigne; /** * Aide de vue permettant d'afficher une ligne de différentiel d'import * * @author Laurent LÉCLUSE <laurent.lecluse at unicaen.fr> */ -class Intervenant extends DifferentielLigne +class IntervenantViewHelper extends DifferentielLigne { public function getSujet() { @@ -21,7 +26,7 @@ class Intervenant extends DifferentielLigne ); }else{ $entity = $this->ligne->getEntity(); - /* @var $entity \Application\Entity\Db\Intervenant */ + /* @var $entity Intervenant */ return sprintf( $format, $entity->getNomUsuel(), @@ -37,7 +42,7 @@ class Intervenant extends DifferentielLigne switch( $column ){ case 'STRUCTURE_ID': if (! empty($value)){ - $structure = $this->ligne->getEntityManager()->find(\Application\Entity\Db\Structure::class, $value); + $structure = $this->ligne->getEntityManager()->find(Structure::class, $value); }else{ $structure = null; } @@ -51,7 +56,7 @@ class Intervenant extends DifferentielLigne }else{ $oldStatut = 'Aucun'; } - $statut = $this->ligne->getEntityManager()->find(\Application\Entity\Db\StatutIntervenant::class, $value); + $statut = $this->ligne->getEntityManager()->find(StatutIntervenant::class, $value); return 'changement de statut ('.$oldStatut.' vers '.$statut.')'; case 'TYPE_ID': $intervenant = $this->ligne->getEntity(); @@ -60,7 +65,7 @@ class Intervenant extends DifferentielLigne }else{ $oldType = 'Aucun'; } - $type = $this->ligne->getEntityManager()->find(\Application\Entity\Db\TypeIntervenant::class, $value); + $type = $this->ligne->getEntityManager()->find(TypeIntervenant::class, $value); return $oldType.' devient '.lcfirst( $type ); default: return parent::getColumnDetails($column, $value); diff --git a/module/Import/src/Import/View/Helper/DifferentielLigne/Personnel.php b/module/Application/src/Application/View/Helper/Import/PersonnelViewHelper.php similarity index 80% rename from module/Import/src/Import/View/Helper/DifferentielLigne/Personnel.php rename to module/Application/src/Application/View/Helper/Import/PersonnelViewHelper.php index 1b4b3b8c16e42e83395e76d084316a864156b84b..62360982c4efc3d42c8e8988644fea47d0215677 100644 --- a/module/Import/src/Import/View/Helper/DifferentielLigne/Personnel.php +++ b/module/Application/src/Application/View/Helper/Import/PersonnelViewHelper.php @@ -1,12 +1,15 @@ <?php -namespace Import\View\Helper\DifferentielLigne; +namespace Application\View\Helper\Import; +use Application\Entity\Db\Personnel; +use Application\Entity\Db\Structure; +use UnicaenImport\View\Helper\DifferentielLigne\DifferentielLigne; /** * Aide de vue permettant d'afficher une ligne de différentiel d'import * * @author Laurent LÉCLUSE <laurent.lecluse at unicaen.fr> */ -class Personnel extends DifferentielLigne +class PersonnelViewHelper extends DifferentielLigne { public function getSujet() { @@ -15,7 +18,7 @@ class Personnel extends DifferentielLigne return sprintf( $format, $this->ligne->get('NOM_USUEL'), $this->ligne->get('PRENOM'), $this->ligne->getSourceCode() ); }else{ $entity = $this->ligne->getEntity(); - /* @var $entity \Application\Entity\Db\Personnel */ + /* @var $entity Personnel */ return sprintf( $format, $entity->getNomUsuel(), $entity->getPrenom(), $this->ligne->getSourceCode() ); } } @@ -25,7 +28,7 @@ class Personnel extends DifferentielLigne switch( $column ){ case 'STRUCTURE_ID': if (! empty($value)){ - $structure = $this->ligne->getEntityManager()->find(\Application\Entity\Db\Structure::class, $value); + $structure = $this->ligne->getEntityManager()->find(Structure::class, $value); }else{ $structure = null; } diff --git a/module/Application/src/Application/View/Helper/Intervenant/IntervenantViewHelper.php b/module/Application/src/Application/View/Helper/Intervenant/IntervenantViewHelper.php index 345e382f541f533cdeb9308c5dbb8fa5da6c2de3..c6fe820f12ce32e9f4b4d00c42cce6a0e83f90a2 100644 --- a/module/Application/src/Application/View/Helper/Intervenant/IntervenantViewHelper.php +++ b/module/Application/src/Application/View/Helper/Intervenant/IntervenantViewHelper.php @@ -111,7 +111,7 @@ class IntervenantViewHelper extends AbstractHtmlElement return '<span class="bg-danger"><abbr title="Cet intervenant a été supprimé de OSE">' . $intervenant . '</abbr></span>'; } - $pourl = $this->getView()->url('intervenant/voir', ['intervenant' => $intervenant->getSourceCode()]); + $pourl = $this->getView()->url('intervenant/voir', ['intervenant' => $intervenant->getRouteParam()]); $out = '<a href="' . $pourl . '" data-po-href="' . $pourl . '" class="ajax-modal">' . $intervenant . '</a>'; return $out; diff --git a/module/Application/src/Application/View/Helper/Intervenant/TotauxHetdViewHelper.php b/module/Application/src/Application/View/Helper/Intervenant/TotauxHetdViewHelper.php index 261bfcb565a86ac72435bbe9fdc6a9c5bd9f5b0a..54eafb876a45325cf5d7f71b09845de5d197cca1 100644 --- a/module/Application/src/Application/View/Helper/Intervenant/TotauxHetdViewHelper.php +++ b/module/Application/src/Application/View/Helper/Intervenant/TotauxHetdViewHelper.php @@ -43,7 +43,7 @@ class TotauxHetdViewHelper extends AbstractHtmlElement implements FormuleResulta $fr = $this->getFormuleResultat(); return $this->getView()->url( 'intervenant/formule-totaux-hetd', [ - 'intervenant' => $fr->getIntervenant()->getSourceCode(), + 'intervenant' => $fr->getIntervenant()->getRouteParam(), 'typeVolumeHoraire' => $fr->getTypeVolumeHoraire()->getId(), 'etatVolumeHoraire' => $fr->getEtatVolumeHoraire()->getId() ] ); diff --git a/module/Application/src/Application/View/Helper/Service/Ligne.php b/module/Application/src/Application/View/Helper/Service/Ligne.php index 4f86cba63641627218aea7d8bfea09c77e17b11d..92e37f0d0666c85328c6b0740fe62e483aa3521b 100644 --- a/module/Application/src/Application/View/Helper/Service/Ligne.php +++ b/module/Application/src/Application/View/Helper/Service/Ligne.php @@ -2,6 +2,7 @@ namespace Application\View\Helper\Service; +use Application\Provider\Privilege\Privileges; use Zend\View\Helper\AbstractHtmlElement; use Application\Entity\Db\Service; use Zend\ServiceManager\ServiceLocatorAwareInterface; @@ -240,7 +241,7 @@ class Ligne extends AbstractHtmlElement implements ServiceLocatorAwareInterface, 'class' => 'heures type-intervention '.$liste->getTypeIntervention()->getCode(), 'style' => 'text-align:right'.$display, 'id' => 'service-'.$liste->getService()->getId().'-ti-'.$liste->getTypeIntervention()->getId(), - 'data-visibility' => $heures != 0 ? '1' : '0', + 'data-value' => $heures, 'data-type-intervention-code' => $liste->getTypeIntervention()->getCode(), ]; $out = '<td '.$this->htmlAttribs($attribs).'>'; @@ -263,7 +264,7 @@ class Ligne extends AbstractHtmlElement implements ServiceLocatorAwareInterface, protected function renderSupprimer() { - $url = $this->getView()->url('service/default', ['action' => 'suppression', 'id' => $this->getService()->getId()], ['query' => ['type-volume-horaire' => $this->getListe()->getTypeVolumeHoraire()->getId()]]); + $url = $this->getView()->url('service/supprimer', ['service' => $this->getService()->getId()], ['query' => ['type-volume-horaire' => $this->getListe()->getTypeVolumeHoraire()->getId()]]); return '<a class="ajax-modal service-delete" data-event="service-delete-message" data-id="'.$this->getService()->getId().'" href="'.$url.'" title="Supprimer l\'enseignement"><span class="glyphicon glyphicon-trash"></span></a>'; } @@ -318,7 +319,7 @@ class Ligne extends AbstractHtmlElement implements ServiceLocatorAwareInterface, public function setService(Service $service = null) { $service->setTypeVolumeHoraire($this->getListe()->getTypeVolumeHoraire()); - $this->forcedReadOnly = ! $this->getView()->isAllowed($service, 'update'); + $this->forcedReadOnly = ! $this->getView()->isAllowed($service, Privileges::ENSEIGNEMENT_EDITION); $this->service = $service; return $this; } diff --git a/module/Application/src/Application/View/Helper/Service/Liste.php b/module/Application/src/Application/View/Helper/Service/Liste.php index 68e63ba77d0063b7fe29247d8120d045f9287502..e9acd6cc3426fcdf220a642492059b182009b26c 100644 --- a/module/Application/src/Application/View/Helper/Service/Liste.php +++ b/module/Application/src/Application/View/Helper/Service/Liste.php @@ -148,13 +148,6 @@ class Liste extends AbstractHtmlElement implements ServiceLocatorAwareInterface, - public function getTotalRefreshUrl() - { - return $this->getView()->url(null, [], ['query' => ['totaux' => 1]], true); - } - - - public function getAddUrl() { return $this->getView()->url('service/saisie', [], ['query' => ['type-volume-horaire' => $this->getTypeVolumeHoraire()->getId()]]); @@ -210,7 +203,7 @@ class Liste extends AbstractHtmlElement implements ServiceLocatorAwareInterface, } $style = $this->getTotaux()['total_general'] == 0 ? ' style="display:none"' : ''; - $out .= '<tfoot data-url="' . $this->getTotalRefreshUrl() . '"' . $style . '>' . "\n"; + $out .= '<tfoot ' . $style . '>' . "\n"; $out .= $this->renderTotaux(); $out .= '</tfoot>' . "\n"; $out .= '</table>' . "\n"; @@ -276,7 +269,7 @@ class Liste extends AbstractHtmlElement implements ServiceLocatorAwareInterface, $out .= '</div>'; $out .= '<div class="modal-footer">'; $out .= '<button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>'; - $out .= '<button type="button" class="btn btn-primary prevu-to-prevu" data-intervenant="' . $this->prevuToPrevu->getSourceCode() . '">OK</button>'; + $out .= '<button type="button" class="btn btn-primary prevu-to-prevu" data-intervenant="' . $this->prevuToPrevu->getRouteParam() . '">OK</button>'; $out .= '</div>'; $out .= '</div>'; $out .= '</div>'; @@ -378,7 +371,7 @@ class Liste extends AbstractHtmlElement implements ServiceLocatorAwareInterface, $out .= "</tr>\n"; $out .= '<tr>'; $out .= "<th colspan=\"$colspan\" style=\"text-align:right\">Total des heures de service :</th>\n"; - $out .= "<td id=\"total-general\" style=\"text-align:right\" colspan=\"" . $typesInterventionDisplayed . "\">" . \UnicaenApp\Util::formattedNumber($data['total_general']) . "</td>\n"; + $out .= "<td id=\"total-general\" style=\"text-align:right\" data-total=\"".$data['total_general']."\" colspan=\"" . $typesInterventionDisplayed . "\">" . \UnicaenApp\Util::formattedNumber($data['total_general']) . "</td>\n"; $out .= "<td> </td>\n"; $out .= "</tr>\n"; @@ -461,15 +454,11 @@ class Liste extends AbstractHtmlElement implements ServiceLocatorAwareInterface, 'read-only' => $this->getReadOnly(), 'type-volume-horaire' => $this->getTypeVolumeHoraire()->getId(), 'columns-visibility' => [], - 'types-intervention-visibility' => [], 'in-realise' => $this->isInRealise(), ]; foreach ($this->getColumnsList() as $columnName) { $params['columns-visibility'][$columnName] = $this->getColumnVisibility($columnName); } - foreach ($this->getTypesIntervention() as $typeIntervention) { - $params['types-intervention-visibility'][$typeIntervention->getCode()] = $this->getTypeInterventionVisibility($typeIntervention); - } return $params; } @@ -496,11 +485,6 @@ class Liste extends AbstractHtmlElement implements ServiceLocatorAwareInterface, $this->setColumnVisibility($columnName, filter_var($visibility, FILTER_VALIDATE_BOOLEAN)); } } - if (isset($params['types-intervention-visibility']) && is_array($params['types-intervention-visibility'])) { - foreach ($params['types-intervention-visibility'] as $typeInterventionCode => $visibility) { - $this->setTypeInterventionVisibility($typeInterventionCode, filter_var($visibility, FILTER_VALIDATE_BOOLEAN)); - } - } return $this; } @@ -523,7 +507,7 @@ class Liste extends AbstractHtmlElement implements ServiceLocatorAwareInterface, $multiAnnees = false; $intervenant = null; $multiIntervenants = false; - foreach ($services as $service) { + foreach ($services as $service) if ($service){ if (empty($annee)) { $annee = $service->getIntervenant()->getAnnee(); } elseif ($annee !== $service->getIntervenant()->getAnnee()) { @@ -587,24 +571,6 @@ class Liste extends AbstractHtmlElement implements ServiceLocatorAwareInterface, - /** - * - * @param TypeIntervention|string $typeIntervention - * - * @return self - */ - public function setTypeInterventionVisibility($typeIntervention, $visibility) - { - if ($typeIntervention instanceof TypeIntervention) { - $typeIntervention = $typeIntervention->getCode(); - } - $this->typesInterventionVisibility[$typeIntervention] = (boolean)$visibility; - - return $this; - } - - - /** * @return @string[] */ diff --git a/module/Application/src/Application/View/Helper/Service/Resume.php b/module/Application/src/Application/View/Helper/Service/Resume.php index 17cd018237a53ac22cfb9d958960d3c2c9045c1d..7389be30b2a162e0aab6adbb9899d6240b9b9781 100644 --- a/module/Application/src/Application/View/Helper/Service/Resume.php +++ b/module/Application/src/Application/View/Helper/Service/Resume.php @@ -2,6 +2,7 @@ namespace Application\View\Helper\Service; +use Application\Service\Traits\TypeIntervenantAwareTrait; use Zend\View\Helper\AbstractHelper; use Zend\ServiceManager\ServiceLocatorAwareInterface; use Zend\ServiceManager\ServiceLocatorAwareTrait; @@ -14,6 +15,7 @@ use Zend\ServiceManager\ServiceLocatorAwareTrait; class Resume extends AbstractHelper implements ServiceLocatorAwareInterface { use ServiceLocatorAwareTrait; + use TypeIntervenantAwareTrait; /** * Filtre de données @@ -181,12 +183,4 @@ class Resume extends AbstractHelper implements ServiceLocatorAwareInterface $res = '<td style="text-align:right;white-space:nowrap"'.$class.'>'.$solde.'</td>'."\n"; return $res; } - - /** - * @return \Application\Service\TypeIntervention - */ - protected function getServiceTypeIntervention() - { - return $this->getServiceLocator()->getServiceLocator()->get('applicationTypeIntervention'); - } } \ No newline at end of file diff --git a/module/Application/src/Application/View/Helper/Service/SaisieForm.php b/module/Application/src/Application/View/Helper/Service/SaisieForm.php index 486ee046b8348469f1100e5f1efe2799e160abc0..18318aedb43bca9f393e8c383d2f807f2377b480 100644 --- a/module/Application/src/Application/View/Helper/Service/SaisieForm.php +++ b/module/Application/src/Application/View/Helper/Service/SaisieForm.php @@ -70,9 +70,8 @@ class SaisieForm extends AbstractHtmlElement implements ServiceLocatorAwareInter public function getVolumesHorairesRefreshUrl() { $url = $this->getView()->url( - 'service/default', + 'service/volumes-horaires-refresh', [ - 'action' => 'volumes-horaires-refresh', 'id' => $this->form->get('service')->get('id')->getValue() ]); return $url; diff --git a/module/Application/src/Application/View/Helper/ServiceReferentiel/Liste.php b/module/Application/src/Application/View/Helper/ServiceReferentiel/Liste.php index d919c7c6a1fa636fbc70777fb3d8c6c8b01925a0..c5e0121ca9f8e2b077e3e1586bee41651fa95fdb 100644 --- a/module/Application/src/Application/View/Helper/ServiceReferentiel/Liste.php +++ b/module/Application/src/Application/View/Helper/ServiceReferentiel/Liste.php @@ -134,7 +134,7 @@ class Liste extends AbstractHtmlElement implements ServiceLocatorAwareInterface, return $this->getView()->url($route, [ - 'intervenant' => $intervenant->getSourceCode(), + 'intervenant' => $intervenant->getRouteParam(), ], [ 'query' => ['totaux' => 1], @@ -262,7 +262,7 @@ class Liste extends AbstractHtmlElement implements ServiceLocatorAwareInterface, $out .= '</div>'; $out .= '<div class="modal-footer">'; $out .= '<button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>'; - $out .= '<button type="button" class="btn btn-primary referentiel-prevu-to-prevu" data-intervenant="' . $this->prevuToPrevu->getSourceCode() . '">OK</button>'; + $out .= '<button type="button" class="btn btn-primary referentiel-prevu-to-prevu" data-intervenant="' . $this->prevuToPrevu->getRouteParam() . '">OK</button>'; $out .= '</div>'; $out .= '</div>'; $out .= '</div>'; diff --git a/module/Application/src/Application/View/Helper/VolumeHoraire/Liste.php b/module/Application/src/Application/View/Helper/VolumeHoraire/Liste.php index cf208f921ef0ca917ca7b5e8daf0c013d7144d8d..02c11ba6b4ce2e0581eca65c7166f48d9d17ab62 100644 --- a/module/Application/src/Application/View/Helper/VolumeHoraire/Liste.php +++ b/module/Application/src/Application/View/Helper/VolumeHoraire/Liste.php @@ -2,6 +2,8 @@ namespace Application\View\Helper\VolumeHoraire; +use Application\Entity\Db\MotifNonPaiement; +use Application\Provider\Privilege\Privileges; use Zend\View\Helper\AbstractHelper; use Application\Entity\VolumeHoraireListe; use Zend\ServiceManager\ServiceLocatorAwareInterface; @@ -105,9 +107,9 @@ class Liste extends AbstractHelper implements ServiceLocatorAwareInterface public function getRefreshUrl() { $url = $this->getView()->url( - 'volume-horaire/default', + 'volume-horaire/liste', [ - 'action' => 'liste', 'id' => $this->getVolumeHoraireListe()->getService()->getId() + 'service' => $this->getVolumeHoraireListe()->getService()->getId() ], ['query' => [ 'read-only' => $this->getReadOnly() ? '1' : '0', 'type-volume-horaire' => $this->getVolumeHoraireListe()->getTypeVolumehoraire()->getId(), @@ -122,7 +124,8 @@ class Liste extends AbstractHelper implements ServiceLocatorAwareInterface */ public function render(){ $this->hasForbiddenPeriodes = false; - $hasMotifNonPaiement = $this->getServiceService()->canHaveMotifNonPaiement($this->getVolumeHoraireListe()->getService()); + $canViewMNP = $this->getView()->isAllowed($this->getVolumeHoraireListe()->getService()->getIntervenant(), Privileges::MOTIF_NON_PAIEMENT_VISUALISATION); + $canEditMNP = $this->getView()->isAllowed($this->getVolumeHoraireListe()->getService()->getIntervenant(), Privileges::MOTIF_NON_PAIEMENT_EDITION); $out = '<table class="table table-condensed table-bordered volume-horaire">'; $out .= '<tr>'; @@ -130,7 +133,7 @@ class Liste extends AbstractHelper implements ServiceLocatorAwareInterface foreach( $this->getTypesInterventions() as $ti ){ $out .= "<th style=\"width:1%\"><abbr title=\"".$ti->getLibelle()."\">".$ti->getCode()."</abbr></th>\n"; } - if ($hasMotifNonPaiement){ + if ($canViewMNP){ $out .= "<th style=\"width:25%\">Motif de non paiement</th>\n"; } $out .= "</tr>\n"; @@ -138,13 +141,17 @@ class Liste extends AbstractHelper implements ServiceLocatorAwareInterface foreach( $periodes as $periode ){ $vhl = $this->getVolumeHoraireListe()->setPeriode($periode)->setTypeIntervention(false); $motifsNonPaiement = []; - if ($hasMotifNonPaiement){ // découpage par motif de non paiement + if ($canViewMNP){ // découpage par motif de non paiement $motifsNonPaiement = $vhl->getMotifsNonPaiement(); + if (!isset($motifsNonPaiement[0]) && !$canEditMNP){ + $motifsNonPaiement = [0 => null] + $motifsNonPaiement; + } } if(empty($motifsNonPaiement)){ $motifsNonPaiement = [0 => false]; } foreach( $motifsNonPaiement as $motifNonPaiement ){ + $readOnly = $motifNonPaiement instanceof MotifNonPaiement && !$canEditMNP; $forbiddenPeriode = false; if ( $this->getVolumeHoraireListe()->getService() @@ -171,9 +178,9 @@ class Liste extends AbstractHelper implements ServiceLocatorAwareInterface }else{ $class="heures-not-empty"; } - $out .= '<td style="text-align:right" class="'.$class.'">'.$this->renderHeures( $vhl ).'</td>'; + $out .= '<td style="text-align:right" class="'.$class.'">'.$this->renderHeures( $vhl, $readOnly ).'</td>'; } - if ($hasMotifNonPaiement){ + if ($canViewMNP){ $out .= "<td>".$this->renderMotifNonPaiement($motifNonPaiement)."</td>\n"; } $out .= "</tr>\n"; @@ -190,7 +197,7 @@ class Liste extends AbstractHelper implements ServiceLocatorAwareInterface return $out; } - public function renderHeures(VolumeHoraireListe $volumeHoraireListe) + public function renderHeures(VolumeHoraireListe $volumeHoraireListe, $readOnly=false) { $heures = $volumeHoraireListe->getHeures(); $heures = \UnicaenApp\Util::formattedNumber($heures); @@ -199,7 +206,7 @@ class Liste extends AbstractHelper implements ServiceLocatorAwareInterface if (false === $volumeHoraireListe->getMotifNonPaiement()){ $query['tous-motifs-non-paiement'] = '1'; } - if ($this->getReadOnly()){ + if ($readOnly || $this->getReadOnly()){ return $heures; }else{ $url = $this->getView()->url( @@ -234,7 +241,7 @@ class Liste extends AbstractHelper implements ServiceLocatorAwareInterface public function setVolumeHoraireListe(VolumeHoraireListe $volumeHoraireListe) { $this->volumeHoraireListe = $volumeHoraireListe; - $this->forcedReadOnly = ! $this->getView()->isAllowed($volumeHoraireListe->getService(), 'update'); + $this->forcedReadOnly = ! $this->getView()->isAllowed($volumeHoraireListe->getService(), Privileges::ENSEIGNEMENT_EDITION); $this->typesIntervention = null; return $this; } diff --git a/module/Application/view/application/agrement/index.phtml b/module/Application/view/application/agrement/index.phtml index dde191b45ed266b2962a06db88fcc61699ab21dc..12163a2e18c79788bd4cb19c5e0edf131ce657b3 100644 --- a/module/Application/view/application/agrement/index.phtml +++ b/module/Application/view/application/agrement/index.phtml @@ -12,4 +12,4 @@ <h1 class="page-header"><?php echo $title ?></h1> <?php -echo $this->navigation('navigation')->menuContextuel()->setPartial('application/menu-dl.phtml'); \ No newline at end of file +echo $this->navigation('navigation')->menuContextuel()->setPartial('unicaen-app/menu-dl.phtml'); \ No newline at end of file diff --git a/module/Application/view/application/budget/index.phtml b/module/Application/view/application/budget/index.phtml index 76f7e74ab95d32a2874c7f63b8fefa2db972bf2b..e0b7b0d4de181df18acbb8f43a316ac3e816eb39 100644 --- a/module/Application/view/application/budget/index.phtml +++ b/module/Application/view/application/budget/index.phtml @@ -10,4 +10,4 @@ $this->headTitle()->append("Budget"); <h1 class="page-header">Budget</h1> <?php -echo $this->navigation('navigation')->menuContextuel()->setPartial('application/menu-dl.phtml'); \ No newline at end of file +echo $this->navigation('navigation')->menuContextuel()->setPartial('unicaen-app/menu-dl.phtml'); \ No newline at end of file diff --git a/module/Application/view/application/contrat/index.phtml b/module/Application/view/application/contrat/index.phtml index 16bbc8dd4fa04b7bc8a8cb61d48e9116e75b659f..5bba16fc84e3746d7003b21ddb1b5b94178f944a 100644 --- a/module/Application/view/application/contrat/index.phtml +++ b/module/Application/view/application/contrat/index.phtml @@ -63,7 +63,7 @@ if ($services['non-contractualises']) { <td> <?php if ($canCreer): ?> <a class="btn btn-primary" - href="<?php echo $this->url('contrat/creer', ['intervenant' => $intervenant->getSourceCode(), 'structure' => $structure->getId()]); ?>"> + href="<?php echo $this->url('contrat/creer', ['intervenant' => $intervenant->getRouteParam(), 'structure' => $structure->getId()]); ?>"> <span class="glyphicon glyphicon-file"></span> Créer un projet <?php echo $hasContrat ? 'd\'avenant' : 'de contrat' ?> </a> diff --git a/module/Application/view/application/discipline/index.phtml b/module/Application/view/application/discipline/index.phtml index f0f80f092bb56cc2d32394e20293520eb5c580bf..d104fcaaa319be941496589ae8218b311339e5c0 100644 --- a/module/Application/view/application/discipline/index.phtml +++ b/module/Application/view/application/discipline/index.phtml @@ -41,7 +41,7 @@ function truncCodesCorresp($value){ <?php if (isset($libellesCodesCorresp[3])) echo '<td>'.truncCodesCorresp($discipline->getCodesCorresp3()).'</td>' ?> <?php if (isset($libellesCodesCorresp[4])) echo '<td>'.truncCodesCorresp($discipline->getCodesCorresp4()).'</td>' ?> <td style="text-align: center"> - <?php if ($discipline->getSource()->isOse() && $canEdit): ?> + <?php if (! $discipline->getSource()->getImportable() && $canEdit): ?> <a class="ajax-modal" data-event="discipline-edition" href="<?php echo $this->url('discipline/saisir', ['discipline' => $discipline->getId()])?>" title="Modifier la discipline"><span class="glyphicon glyphicon-edit"></span></a> <a class="ajax-modal" data-event="discipline-suppression" href="<?php echo $this->url('discipline/supprimer', ['discipline' => $discipline->getId()])?>" title="Supprimer la discipline"><span class="glyphicon glyphicon-remove"></span></a> <?php else: ?> diff --git a/module/Application/view/application/droits/affectations.phtml b/module/Application/view/application/droits/affectations.phtml index e634003338a6f06abcfe3ff234b28b3c3224ac5c..3595d3fad3ef3d6b8bf7bab7bbbae8d3091225c1 100644 --- a/module/Application/view/application/droits/affectations.phtml +++ b/module/Application/view/application/droits/affectations.phtml @@ -59,7 +59,7 @@ $ajoutUrl = $this->url( 'droits/affectations/edition' ); <td><?php echo $affectation->getRole() ?></td> <td><?php echo $affectation->getPersonnel() ?></td> <td style="text-align: center;width:1%;white-space: nowrap"><?php - if ($affectation->getSource()->isOse() && $canEdit){ + if (! $affectation->getSource()->getImportable() && $canEdit){ ?> <a href="<?php echo $editionUrl; ?>" class="ajax-modal" data-event="affectation-edition"><span class="glyphicon glyphicon-edit"></span></a> <a href="<?php echo $suppressionUrl; ?>" class="ajax-modal" data-event="affectation-suppression"><span class="glyphicon glyphicon-remove"></span></a> diff --git a/module/Application/view/application/droits/index.phtml b/module/Application/view/application/droits/index.phtml index b80e6f71c8c1b23607e0ab031a168a138f1baf70..32a67031aefa42d1190aa13d2f83cee30750e975 100644 --- a/module/Application/view/application/droits/index.phtml +++ b/module/Application/view/application/droits/index.phtml @@ -9,4 +9,4 @@ use Application\Provider\Privilege\Privileges; <h1 class="page-header">Gestion des droits d'accès</h1> <?php -echo $this->navigation('navigation')->menuContextuel()->setPartial('application/menu-dl.phtml'); \ No newline at end of file +echo $this->navigation('navigation')->menuContextuel()->setPartial('unicaen-app/menu-dl.phtml'); \ No newline at end of file diff --git a/module/Application/view/application/indicateur/result-item-donnees-perso-diff-import.phtml b/module/Application/view/application/indicateur/result-item-donnees-perso-diff-import.phtml index 1cfe08bb67d7c41daf21fd53edd1350f85c2ec6e..d6f21d9f8a705deb07a786cae8c603196675cf4d 100644 --- a/module/Application/view/application/indicateur/result-item-donnees-perso-diff-import.phtml +++ b/module/Application/view/application/indicateur/result-item-donnees-perso-diff-import.phtml @@ -44,5 +44,5 @@ </tbody> </table> -<a href="<?php echo $this->url('intervenant/saisir-dossier', ['intervenant' => $intervenant->getSourceCode()]) ?>" +<a href="<?php echo $this->url('intervenant/saisir-dossier', ['intervenant' => $intervenant->getRouteParam()]) ?>" >Accéder à la page des données personnelles de <?php echo $intervenant ?></a> diff --git a/module/Application/view/application/indicateur/result-item-donnees-perso-modif.phtml b/module/Application/view/application/indicateur/result-item-donnees-perso-modif.phtml index 06ea57799b957495072a1aea07f1f2df648d7221..8e5568f45b9c0d41a48ddc842bf94c6e7b3bac4e 100644 --- a/module/Application/view/application/indicateur/result-item-donnees-perso-modif.phtml +++ b/module/Application/view/application/indicateur/result-item-donnees-perso-modif.phtml @@ -4,7 +4,7 @@ <?php $modifications = $this->intervenant->getIndicModifDossier(); /** @var $modifications \Application\Entity\Db\IndicModifDossier[] */ -$urlPurge = $this->url('indicateur/purger-indicateur-donnees-perso-modif', ['intervenant' => $this->intervenant->getSourceCode()]); +$urlPurge = $this->url('indicateur/purger-indicateur-donnees-perso-modif', ['intervenant' => $this->intervenant->getRouteParam()]); $urlPostPurge = $this->url('indicateur/result', ['indicateur' => $this->indicateur->getId()]); ?> @@ -39,7 +39,7 @@ $urlPostPurge = $this->url('indicateur/result', ['indicateur' => $this->indicat </tbody> </table> -<a href="<?php echo $this->url('intervenant/saisir-dossier', ['intervenant' => $this->intervenant->getSourceCode()]) ?>" +<a href="<?php echo $this->url('intervenant/saisir-dossier', ['intervenant' => $this->intervenant->getRouteParam()]) ?>" >Accéder à la page des données personnelles de <?php echo $this->intervenant ?></a> <hr/> diff --git a/module/Application/view/application/intervenant/menu.phtml b/module/Application/view/application/intervenant/menu.phtml new file mode 100644 index 0000000000000000000000000000000000000000..6c5d0b8f8c4ee70bc212f33b3eddd68da7f8e8c9 --- /dev/null +++ b/module/Application/view/application/intervenant/menu.phtml @@ -0,0 +1,7 @@ +<?php + +/** + * @var $this \Application\View\Renderer\PhpRenderer + */ + +echo $this->navigation()->menuSecondaire('navigation')->render(); \ No newline at end of file diff --git a/module/Application/view/application/intervenant/partial/horodatage.phtml b/module/Application/view/application/intervenant/partial/horodatage.phtml new file mode 100644 index 0000000000000000000000000000000000000000..4eec62f79e6bd242be56531815085b025f748cb5 --- /dev/null +++ b/module/Application/view/application/intervenant/partial/horodatage.phtml @@ -0,0 +1,21 @@ +<?php + +/** + * @var $this \Application\View\Renderer\PhpRenderer + * @var $intervenant \Application\Entity\Db\Intervenant + * @var $typeVolumeHoraire \Application\Entity\Db\TypeVolumeHoraire + * @var $referentiel boolean + */ + +?> +<div id="s-horodatage" data-url="<?php echo $this->url('service/horodatage', [ + 'intervenant' => $intervenant->getRouteParam(), + 'typeVolumeHoraire' => $typeVolumeHoraire->getId(), + 'referentiel' => $referentiel, + ]); ?>"> + <?php echo $this->partial('application/service/horodatage', [ + 'intervenant' => $intervenant, + 'typeVolumeHoraire' => $typeVolumeHoraire, + 'referentiel' => $referentiel, + ]); ?> +</div> \ No newline at end of file diff --git a/module/Application/view/application/intervenant/services.phtml b/module/Application/view/application/intervenant/services.phtml new file mode 100644 index 0000000000000000000000000000000000000000..a1b0ceb890fa8493600666579d27ccf4d5d1c1a8 --- /dev/null +++ b/module/Application/view/application/intervenant/services.phtml @@ -0,0 +1,97 @@ +<?php + +use Application\Entity\Db\WfEtape; +use Application\Provider\Privilege\Privileges; +/** + * @var $this \Application\View\Renderer\PhpRenderer + * @var $intervenant \Application\Entity\Db\Intervenant + * @var $typeVolumeHoraire \Application\Entity\Db\TypeVolumeHoraire + */ + +$canAddService = $this->isAllowed($intervenant, Privileges::ENSEIGNEMENT_EDITION); + +if ($typeVolumeHoraire->isPrevu()){ + $nextEtape = WfEtape::CODE_SERVICE_SAISIE; + $title = 'Enseignements'; +}else{ + $nextEtape = WfEtape::CODE_SERVICE_SAISIE_REALISE; + $title = 'Constatation des enseignements réalisés'; +} + +$menuUrl = $this->url('intervenant/services', ['intervenant' => $intervenant->getRouteParam()], ['query' => ['menu' => 1]] ); + +$btnNextUrl = $this->url('workflow/feuille-de-route-btn-next', ['intervenant' => $intervenant->getRouteParam(), 'wfEtapeCode' => $nextEtape]); + +$this->headTitle()->append($intervenant->getNomUsuel())->append($title); +$title .= ' <small>'.$intervenant.'</small>'; + + +?> +<h1 class="page-header"><?php echo $title; ?></h1> +<?php + +echo $this->messenger()->addCurrentMessagesFromFlashMessenger(); + +if (isset($clotureSaisie)) echo $clotureSaisie; + +/* Services et horodatage */ +$serviceListe = $this->serviceListe( $services ); +$serviceListe->setTypeVolumeHoraire($typeVolumeHoraire)->setAddButtonVisibility($canAddService); +if ($canAddService && $typeVolumeHoraire->isPrevu()){ + $serviceListe->showPrevuToPrevu($intervenant); +} +echo $serviceListe->render(); + +echo $this->partial('application/intervenant/partial/horodatage', [ + 'intervenant' => $intervenant, + 'typeVolumeHoraire' => $typeVolumeHoraire, + 'referentiel' => false +]); + +/* Référentiel et horodatage */ +if (isset($referentiel)){ + echo $referentiel; + echo $this->partial('application/intervenant/partial/horodatage', [ + 'intervenant' => $intervenant, + 'typeVolumeHoraire' => $typeVolumeHoraire, + 'referentiel' => true + ]); +}var_dump('REFERENTIEL A FAIRE'); + +echo $formuleTotauxHetd; + +if (isset($clotureSaisie)) echo $clotureSaisie; + +?> + +<hr/> +<div id="feuille-de-route-btn-next" data-url="<?php echo $btnNextUrl ?>"> + <?php echo $this->feuillederoute($intervenant)->renderNextBtn($nextEtape); ?> +</div> +<script> + + $(function () + { + + $('.service-liste').serviceListe({ + 'heures-change-exists': function () + { + // chargement du menu pour faire apparaître ou disparaitre les liens de validation + $('#sidebar').load('<?php echo $menuUrl; ?>'); + + // rafraichissement du bouton de la feuille de route pour pointer vers la prochaine bonne étape + $('#feuille-de-route-btn-next').refresh(); + }, + 'heures-change': function () + { + // on met à jour le résultat de la formule + $("#formule-totaux-hetd").refresh(); // HETD rafraichis + + // on met à jour l'horodatage des services !! + $("#s-horodatage").refresh(); + } + }); + + }); + +</script> \ No newline at end of file diff --git a/module/Application/view/application/intervenant/voir.phtml b/module/Application/view/application/intervenant/voir.phtml index 17c5999340e09dac7bc40b17b6e6ea1d4fe67d6d..7914f7cebd57982dad1cdbf343bb2c7788c4605e 100644 --- a/module/Application/view/application/intervenant/voir.phtml +++ b/module/Application/view/application/intervenant/voir.phtml @@ -20,7 +20,7 @@ $tabs = [ 'id' => 'fiche', 'label' => '<span class="glyphicon glyphicon-eye-open"></span> Fiche', 'content' => $this->partial('application/intervenant/fiche.phtml', compact('intervenant', 'role')), - 'url' => $this->url('intervenant/fiche', ['intervenant' => $intervenant->getSourceCode()]), + 'url' => $this->url('intervenant/fiche', ['intervenant' => $intervenant->getRouteParam()]), 'force-refresh' => true, ], ]; @@ -29,7 +29,7 @@ if ($this->isAllowed(Privileges::getResourceId(Privileges::INTERVENANT_EDITION)) $tabs[] = [ 'id' => 'edition', 'label' => '<span class="glyphicon glyphicon-pencil"></span> Édition', - 'url' => $this->url('intervenant/saisir', ['intervenant' => $intervenant->getSourceCode()]), + 'url' => $this->url('intervenant/saisir', ['intervenant' => $intervenant->getRouteParam()]), ]; } diff --git a/module/Application/view/application/menu-dl.phtml b/module/Application/view/application/menu-dl.phtml deleted file mode 100644 index 4b7daeb4342f92fc299b619f23b0b526faa8a139..0000000000000000000000000000000000000000 --- a/module/Application/view/application/menu-dl.phtml +++ /dev/null @@ -1,25 +0,0 @@ -<?php - -/** - * @var $this \Application\View\Renderer\PhpRenderer - * @var $container Zend\Navigation\Navigation - */ - -?> -<dl> - <?php - foreach ($container as $page) { - if ($this->navigation()->accept($page)) { - echo $this->tag('dt')->html( $this->navigation()->htmlify($page) ); - echo $this->tag('dd')->text( $page->get('description') ); - } - } - ?> -</dl> -<style> - - dt { - padding-top: 2em; - } - -</style> \ No newline at end of file diff --git a/module/Application/view/application/paiement/index.phtml b/module/Application/view/application/paiement/index.phtml index 0b3a3dcbf9c79c9d0ab13d90da8a245b75580197..87a1b2802516688ac3b7250ef2559d1f256e414d 100644 --- a/module/Application/view/application/paiement/index.phtml +++ b/module/Application/view/application/paiement/index.phtml @@ -7,4 +7,4 @@ $this->headTitle()->append("Paiement"); <?php -echo $this->navigation('navigation')->menuContextuel()->setPartial('application/menu-dl.phtml'); +echo $this->navigation('navigation')->menuContextuel()->setPartial('unicaen-app/menu-dl.phtml'); diff --git a/module/Application/view/application/piece-jointe/configuration.phtml b/module/Application/view/application/piece-jointe/configuration.phtml index 28d6a08f9f0007dbff8e2de754cd2e20c074a210..e80693c0538e0b6338327c5701fc452b2be1c817 100644 --- a/module/Application/view/application/piece-jointe/configuration.phtml +++ b/module/Application/view/application/piece-jointe/configuration.phtml @@ -6,4 +6,4 @@ use Application\Provider\Privilege\Privileges; <h1 class="page-header">Configuration des pièces jointes</h1> <?php -echo $this->navigation('navigation')->menuContextuel()->setPartial('application/menu-dl.phtml'); \ No newline at end of file +echo $this->navigation('navigation')->menuContextuel()->setPartial('unicaen-app/menu-dl.phtml'); \ No newline at end of file diff --git a/module/Application/view/application/piece-jointe/index.phtml b/module/Application/view/application/piece-jointe/index.phtml index ae7fbe2298f6c8c08581ca548676614e5a9cd3d1..94df34210462e884aa6b7c77f3ca0781b0d1736c 100644 --- a/module/Application/view/application/piece-jointe/index.phtml +++ b/module/Application/view/application/piece-jointe/index.phtml @@ -18,7 +18,7 @@ $canEdit = $this->isAllowed(Privileges::getResourceId(Privileges::PIECE_J $canValider = $this->isAllowed(Privileges::getResourceId(Privileges::PIECE_JUSTIFICATIVE_VALIDATION)); $canDevalider = $this->isAllowed(Privileges::getResourceId(Privileges::PIECE_JUSTIFICATIVE_DEVALIDATION)); -$infosUrl = $this->url('piece-jointe/intervenant/infos', ['intervenant' => $intervenant->getSourceCode()]); +$infosUrl = $this->url('piece-jointe/intervenant/infos', ['intervenant' => $intervenant->getRouteParam()]); ?> <style> diff --git a/module/Application/view/application/pilotage/index.phtml b/module/Application/view/application/pilotage/index.phtml index 354d82bc66fdd68ea12ff5cd79f805cc3d2bae0c..e92992ec045eeba0df349ace4df39cdba68b1a64 100644 --- a/module/Application/view/application/pilotage/index.phtml +++ b/module/Application/view/application/pilotage/index.phtml @@ -7,4 +7,4 @@ $this->headTitle()->append("Pilotage"); <?php -echo $this->navigation('navigation')->menuContextuel()->setPartial('application/menu-dl.phtml'); +echo $this->navigation('navigation')->menuContextuel()->setPartial('unicaen-app/menu-dl.phtml'); diff --git a/module/Application/view/application/service-referentiel/index.phtml b/module/Application/view/application/service-referentiel/index.phtml index 50324e09e5eb46dfc1c8dbe83dcd155ea84e59d8..bd8f052d8718ffa0e18b41fa3989c965542c8ea6 100644 --- a/module/Application/view/application/service-referentiel/index.phtml +++ b/module/Application/view/application/service-referentiel/index.phtml @@ -42,7 +42,7 @@ if ($intervenant) </style> <?php if (! $intervenant): ?> - <?php if ($this->isAllowed('ServiceReferentielListView', 'info-only-structure')): ?> + <?php if ($this->isAllowed('Information', 'info-only-structure')): ?> <?php echo $this->messenger()->setMessages(['warning' => "Est visible ici le référentiel prévisionnel des intervenants affectés " . "ou enseignant dans votre structure de responsabilité ({$role->getStructure()}) ou l'une de ses sous-structures."]); ?> <?php endif; ?> diff --git a/module/Application/view/application/service/index.phtml b/module/Application/view/application/service/index.phtml index 1a935ce7577e5390b88763efe022593346ace11c..eb05277841d538188fe417189dce2c84badf18a2 100644 --- a/module/Application/view/application/service/index.phtml +++ b/module/Application/view/application/service/index.phtml @@ -3,111 +3,30 @@ /** * @var $this \Application\View\Renderer\PhpRenderer * @var $typeVolumeHoraire Application\Entity\Db\TypeVolumeHoraire - * @var $role \Application\Acl\Role */ -use Application\Entity\Db\WfEtape; - -$titles = [ - 'PREVU' => 'Enseignements', - 'REALISE' => 'Constatation des enseignements réalisés', -]; - -$title = $titles[$typeVolumeHoraire->getCode()]; -if ($intervenant){ - $title .= ' <small>'.$intervenant.'</small>'; - $this->headTitle()->append($intervenant->getNomUsuel())->append("Enseignements"); -}else{ - $this->headTitle()->append("Enseignements"); -} +$this->headTitle()->append("Enseignements"); $serviceListe = $this->serviceListe( $services ); /* @var $serviceListe \Application\View\Helper\Service\Liste */ $serviceListe->setTypeVolumeHoraire($typeVolumeHoraire) ->setAddButtonVisibility($canAddService); -if ($intervenant) $serviceListe->showPrevuToPrevu($intervenant); + $this->headTitle()->append("Enseignements"); ?> +<h1 class="page-header">Enseignements</h1> +<?php -<h1 class="page-header"><?php echo $title; ?></h1> - -<?php echo $this->messenger()->addMessagesFromFlashMessenger() ?> - -<style> - .modal-dialog { - width: 70%; - } - div.row { - padding:1px; - } - th.heures, td.heures { width: 3em !important; } -</style> - -<?php if (! $intervenant): ?> -<?php if ($this->isAllowed('ServiceListView', 'info-only-structure')): ?> -<?php echo $this->messenger()->setMessages(['warning' => "Sont visibles ici les référentiels et les enseignements prévisionnels des intervenants affectés " - . "ou enseignant dans votre structure de responsabilité ({$role->getStructure()}) ou l'une de ses sous-structures."]); ?> -<?php endif; ?> - -<div id="filtres"> - <?php echo $this->recherche; ?> -</div> -<?php endif; ?> - -<?php if ('afficher' === $action ): ?> - - <?php if ($this->isAllowed('ServiceListView', 'aide-intervenant')): ?> - <?php echo $this->messenger()->setMessage( - "Merci de saisir les heures effectuées <strong>sans majoration</strong>. Exemple: saisissez 1h CM et non 1,5h TD."); ?> - <?php endif; ?> - - <!-- bouton de cloture de la saisie du réalisé des permanents --> - <?php echo $this->clotureSaisie ?> - <hr /> - - <?php echo $serviceListe->render(); ?> - <?php if ($intervenant): ?> - <div id="s-horodatage" data-url="<?php echo $this->url('service/horodatage', [ - 'intervenant' => $intervenant->getSourceCode(), - 'typeVolumeHoraire' => $typeVolumeHoraire->getId(), - 'referentiel' => false - ]); ?>"> - <?php echo $this->partial('application/service/horodatage', [ - 'intervenant' => $intervenant, - 'typeVolumeHoraire' => $typeVolumeHoraire, - 'referentiel' => false - ]); ?> - </div> - <?php endif; ?> - - <?php if ($intervenant && $intervenant->getStatut()->getPeutSaisirReferentiel()): ?> - <?php echo $this->servicesRefListe; ?> - <div id="sr-horodatage" data-url="<?php echo $this->url('service/horodatage', [ - 'intervenant' => $intervenant->getSourceCode(), - 'typeVolumeHoraire' => $typeVolumeHoraire->getId(), - 'referentiel' => true - ]); ?>"> - <?php echo $this->partial('application/service/horodatage', [ - 'intervenant' => $intervenant, - 'typeVolumeHoraire' => $typeVolumeHoraire, - 'referentiel' => true - ]); ?> - </div> - <?php endif; ?> - - <!-- bouton de cloture de la saisie du réalisé des permanents --> - <hr /> - <?php echo $this->clotureSaisie ?> - <hr /> - - <?php echo $this->formuleTotauxHetd; ?> - - <?php if ($intervenant && $typeVolumeHoraire->getCode() === 'PREVU'): ?> - <hr /> - <?php echo $this->feuillederoute($intervenant)->renderNextBtn(WfEtape::CODE_SERVICE_SAISIE); ?> - <?php endif; ?> - -<?php else:?> +if ($this->isAllowed('Information', 'info-only-structure')){ + echo $this->messenger()->setMessages(['warning' => "Sont visibles ici les référentiels et les enseignements prévisionnels des intervenants affectés " + . "ou enseignant dans votre structure de responsabilité ou l'une de ses sous-structures."]); +} - <?php echo $this->messenger()->setMessage('Cliquez sur "Afficher" pour afficher les enseignements.', \UnicaenApp\View\Helper\Messenger::INFO); ?> +echo '<div id="filtres">'; +echo $this->recherche; +echo '</div>'; -<?php endif; ?> +if ('afficher' === $action ) { + echo $serviceListe->render(); +}else{ + echo $this->messenger()->setMessage('Cliquez sur "Afficher" pour afficher les enseignements.', \UnicaenApp\View\Helper\Messenger::INFO); +} diff --git a/module/Application/view/application/service/partial/liste.phtml b/module/Application/view/application/service/partial/liste.phtml index 0544c8290efbeb11af5ebe5360e6fdbbb9bb0b83..d2b716bf9b47d91db0a124e05ecb4f5f5cf946f4 100644 --- a/module/Application/view/application/service/partial/liste.phtml +++ b/module/Application/view/application/service/partial/liste.phtml @@ -11,8 +11,15 @@ $totalHeures = 0.0; <style> th.heures, td.heures { text-align: right; } td.heures-total { font-weight: bold; } -</style> + .modal-dialog { + width: 70%; + } + div.row { + padding:1px; + } + th.heures, td.heures { width: 3em !important; } +</style> <table class="table table-bordered table-hover table-condensed"> <thead> <tr> diff --git a/module/Application/view/application/service/rafraichir-totaux.phtml b/module/Application/view/application/service/rafraichir-totaux.phtml deleted file mode 100644 index 6bf9f2c08507422ecc91abbc93eb13294562bb60..0000000000000000000000000000000000000000 --- a/module/Application/view/application/service/rafraichir-totaux.phtml +++ /dev/null @@ -1,11 +0,0 @@ -<?php - -/* @var $services Application\Entity\Db\Service[] */ -/* @var $params array */ - -$serviceListe = $this->serviceListe( $services ); -/* @var $serviceListe Application\View\Helper\Service\Liste */ - -$serviceListe->applyParams($params); - -echo $serviceListe->renderTotaux(); \ No newline at end of file diff --git a/module/Application/view/application/service/saisie.phtml b/module/Application/view/application/service/saisie.phtml index 4fe92d23befd956cfa5e8ce0fa26a0298491bc0a..446dc6721fe5709ad80400176b9ac748db9dc67a 100644 --- a/module/Application/view/application/service/saisie.phtml +++ b/module/Application/view/application/service/saisie.phtml @@ -1,6 +1,11 @@ <?php +/** + * @var $this \Application\View\Renderer\PhpRenderer + */ + echo $this->serviceSaisieForm( $form )->render(); echo $this->formErrors( $form ); -if ($errors) echo $this->messenger()->setMessages([UnicaenApp\View\Helper\Messenger::ERROR => $errors]); \ No newline at end of file + +echo $this->messenger()->addCurrentMessagesFromFlashMessenger(); \ No newline at end of file diff --git a/module/Application/view/application/workflow/feuille-de-route-btn-next.phtml b/module/Application/view/application/workflow/feuille-de-route-btn-next.phtml new file mode 100644 index 0000000000000000000000000000000000000000..0a083e18e1f8f0ef2da018cc8ba09b5816f20460 --- /dev/null +++ b/module/Application/view/application/workflow/feuille-de-route-btn-next.phtml @@ -0,0 +1,9 @@ +<?php + +/** + * @var $this \Application\View\Renderer\PhpRenderer + * @var $intervenant \Application\Entity\Db\Intervenant + * @var $wfEtapeCode string + */ + +echo $this->feuillederoute($intervenant)->renderNextBtn($wfEtapeCode); \ No newline at end of file diff --git a/module/Application/view/application/workflow/index.phtml b/module/Application/view/application/workflow/index.phtml index b2f122a6197a5c3e065872aff6f7509d5e9b1c2c..a6c485a83499c6798dba1704b208405d1aa0c304 100644 --- a/module/Application/view/application/workflow/index.phtml +++ b/module/Application/view/application/workflow/index.phtml @@ -7,4 +7,4 @@ $this->headTitle()->append("Workflow"); <?php -echo $this->navigation('navigation')->menuContextuel()->setPartial('application/menu-dl.phtml'); +echo $this->navigation('navigation')->menuContextuel()->setPartial('unicaen-app/menu-dl.phtml'); diff --git a/module/Import/Module.php b/module/Import/Module.php deleted file mode 100644 index 4914c46af5362897046ab1cd993cc4fb79e6ad65..0000000000000000000000000000000000000000 --- a/module/Import/Module.php +++ /dev/null @@ -1,27 +0,0 @@ -<?php - -namespace Import; - -class Module -{ - - public function getAutoloaderConfig() - { - return [ - 'Zend\Loader\ClassMapAutoloader' => array( - __DIR__ . '/autoload_classmap.php', - ), - 'Zend\Loader\StandardAutoloader' => [ - 'namespaces' => [ - __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__, - ], - ], - ]; - } - - public function getConfig() - { - return include __DIR__ . '/config/module.config.php'; - } - -} \ No newline at end of file diff --git a/module/Import/autoload_classmap.php b/module/Import/autoload_classmap.php deleted file mode 100644 index cfc3634c4861c2a7579318a288838f3cdcc09bac..0000000000000000000000000000000000000000 --- a/module/Import/autoload_classmap.php +++ /dev/null @@ -1,24 +0,0 @@ -<?php -// Generated by ZF2's ./bin/classmap_generator.php -return array( - 'Import\Module' => __DIR__ . '/Module.php', - 'Import\Entity\Schema\Column' => __DIR__ . '/src/Import/Entity/Schema/Column.php', - 'Import\Entity\Differentiel\Ligne' => __DIR__ . '/src/Import/Entity/Differentiel/Ligne.php', - 'Import\Entity\Differentiel\Query' => __DIR__ . '/src/Import/Entity/Differentiel/Query.php', - 'Import\Service\Intervenant' => __DIR__ . '/src/Import/Service/Intervenant.php', - 'Import\Service\Service' => __DIR__ . '/src/Import/Service/Service.php', - 'Import\Service\Schema' => __DIR__ . '/src/Import/Service/Schema.php', - 'Import\Service\QueryGenerator' => __DIR__ . '/src/Import/Service/QueryGenerator.php', - 'Import\Service\Differentiel' => __DIR__ . '/src/Import/Service/Differentiel.php', - 'Import\Processus\Import' => __DIR__ . '/src/Import/Processus/Import.php', - 'Import\Exception\Exception' => __DIR__ . '/src/Import/Exception/Exception.php', - 'Import\Exception\MissingDependency' => __DIR__ . '/src/Import/Exception/MissingDependency.php', - 'Import\View\Helper\DifferentielListe' => __DIR__ . '/src/Import/View/Helper/DifferentielListe.php', - 'Import\View\Helper\DifferentielLigne\CheminPedagogique' => __DIR__ . '/src/Import/View/Helper/DifferentielLigne/CheminPedagogique.php', - 'Import\View\Helper\DifferentielLigne\DifferentielLigne' => __DIR__ . '/src/Import/View/Helper/DifferentielLigne/DifferentielLigne.php', - 'Import\View\Helper\DifferentielLigne\ElementPedagogique' => __DIR__ . '/src/Import/View/Helper/DifferentielLigne/ElementPedagogique.php', - 'Import\View\Helper\DifferentielLigne\Intervenant' => __DIR__ . '/src/Import/View/Helper/DifferentielLigne/Intervenant.php', - 'Import\View\Helper\DifferentielLigne\Etape' => __DIR__ . '/src/Import/View/Helper/DifferentielLigne/Etape.php', - 'Import\View\Helper\DifferentielLigne\Personnel' => __DIR__ . '/src/Import/View/Helper/DifferentielLigne/Personnel.php', - 'Import\Controller\ImportController' => __DIR__ . '/src/Import/Controller/ImportController.php', -); diff --git a/module/Import/config/module.config.php b/module/Import/config/module.config.php deleted file mode 100644 index 0977615c1d756c0429690b6e21f854564126a79f..0000000000000000000000000000000000000000 --- a/module/Import/config/module.config.php +++ /dev/null @@ -1,147 +0,0 @@ -<?php - -namespace Import; - -use UnicaenAuth\Guard\PrivilegeController; -use Application\Provider\Privilege\Privileges; - -return [ - 'controllers' => [ - 'invokables' => [ - 'Import\Controller\Import' => 'Import\Controller\ImportController', - ], - ], - - 'router' => [ - 'routes' => [ - 'import' => [ - 'type' => 'Segment', - 'options' => [ - 'route' => '/import[/:action][/:table]', - 'defaults' => [ - '__NAMESPACE__' => 'Import\Controller', - 'controller' => 'Import', - 'action' => 'index', - 'table' => null, - ], - ], - ], - ], - ], - - 'navigation' => [ - 'default' => [ - 'home' => [ - 'pages' => [ - 'import' => [ - 'label' => 'Import', - 'order' => 1, - 'route' => 'import', - 'resource' => PrivilegeController::getResourceId('Import\Controller\Import','index'), - 'pages' => [ - 'showDiff' => [ - 'label' => "Écarts entre OSE et ses sources", - 'description' => "Affiche, table par table, la liste des données différentes entre l'application et ses sources de données", - 'route' => 'import', - 'resource' => PrivilegeController::getResourceId('Import\Controller\Import','showdiff'), - 'params' => [ - 'action' => 'showDiff', - ], - ], - 'updateTables' => [ - 'label' => "Mise à jour des données à partir de leurs sources", - 'description' => "Met à jour l'ensemble des données partir de leurs sources respectives.", - 'route' => 'import', - 'resource' => PrivilegeController::getResourceId('Import\Controller\Import','updateTables'), - 'params' => [ - 'action' => 'updateTables', - ], - ], - 'show-import-tbl' => [ - 'label' => "Tableau de bord principal", - 'description' => "Liste, table par table, les colonnes dont les données sont importables ou non, leur caractéristiques et l'état de l'import à leur niveau.", - 'route' => 'import', - 'resource' => PrivilegeController::getResourceId('Import\Controller\Import','show-import-tbl'), - 'params' => [ - 'action' => 'show-import-tbl', - ], - ], - 'updateViewsAndPackages' => [ - 'label' => "Mise à jour des vues différentielles et des procédures de mise à jour", - 'description' => "Réactualise les vues différentielles d'import. Ces dernières servent à déterminer quelles données ont changé, - sont apparues ou ont disparues des sources de données. - Met également à jour les procédures de mise à jour qui actualisent les données de l'application à partir des informations - fournies par les vues différentielles. - Cette réactualisation n'est utile que si les vues sources ont été modifiées.", - 'route' => 'import', - 'resource' => PrivilegeController::getResourceId('Import\Controller\Import','updateViewsAndPackages'), - 'params' => [ - 'action' => 'updateViewsAndPackages', - ], - ], - - ], - ], - ], - ], - ], - ], - - 'bjyauthorize' => [ - 'guards' => [ - PrivilegeController::class => [ - [ - 'controller' => 'Import\Controller\Import', - 'action' => ['index'], - 'privileges' => [Privileges::IMPORT_ECARTS, Privileges::IMPORT_MAJ, Privileges::IMPORT_TBL, Privileges::IMPORT_VUES_PROCEDURES], - ], - [ - 'controller' => 'Import\Controller\Import', - 'action' => ['showDiff'], - 'privileges' => [Privileges::IMPORT_ECARTS], - ], - [ - 'controller' => 'Import\Controller\Import', - 'action' => ['show-import-tbl'], - 'privileges' => [Privileges::IMPORT_TBL], - ], - [ - 'controller' => 'Import\Controller\Import', - 'action' => ['update', 'updateTables'], - 'privileges' => [Privileges::IMPORT_MAJ], - ], - [ - 'controller' => 'Import\Controller\Import', - 'action' => ['updateViewsAndPackages'], - 'privileges' => [Privileges::IMPORT_VUES_PROCEDURES], - ], - ], - ], - ], - - 'service_manager' => [ - 'invokables' => [ - 'importServiceSchema' => Service\Schema::class, - 'importServiceQueryGenerator' => Service\QueryGenerator::class, - 'importServiceIntervenant' => Service\Intervenant::class, - 'importServiceDifferentiel' => Service\Differentiel::class, - 'importProcessusImport' => Processus\Import::class, - ], - 'factories' => [ - - ], - ], - - 'view_helpers' => [ - 'invokables' => [ - 'differentielListe' => View\Helper\DifferentielListe::class, - 'differentielLigne' => View\Helper\DifferentielLigne\DifferentielLigne::class, - ], - ], - - 'view_manager' => [ - 'template_path_stack' => [ - 'import' => __DIR__ . '/../view', - ], - ], -]; \ No newline at end of file diff --git a/module/Import/src/Import/Controller/ImportController.php b/module/Import/src/Import/Controller/ImportController.php deleted file mode 100644 index dbb9786949fbe78cf7ac87f824008870dafae4ac..0000000000000000000000000000000000000000 --- a/module/Import/src/Import/Controller/ImportController.php +++ /dev/null @@ -1,133 +0,0 @@ -<?php -namespace Import\Controller; - -use Zend\Mvc\Controller\AbstractActionController; -use Import\Entity\Differentiel\Query; - -/** - * - * - * @author Laurent Lécluse <laurent.lecluse at unicaen.fr> - */ -class ImportController extends AbstractActionController -{ - public function indexAction() - { - } - - public function updateViewsAndPackagesAction() - { - try{ - $processusImport = $this->getServiceLocator()->get('ImportProcessusImport'); - /* @var $processusImport \Import\Processus\Import */ - $processusImport->updateViewsAndPackages(); - $message = 'Mise à jour des vues différentielles et du paquetage d\'import terminés'; - }catch(\Exception $e){ - $message = 'Une erreur a été rencontrée.'; - throw new \UnicaenApp\Exception\LogicException("import impossible", null, $e); - } - $title = "Résultat"; - return compact('message', 'title'); - } - - public function showImportTblAction() - { - $schema = $this->getServiceLocator()->get('ImportServiceSchema'); - /* @var $schema \Import\Service\Schema */ - - $data = $schema->getSchema(); - return compact('data'); - } - - public function showDiffAction() - { - $tableName = $this->params()->fromRoute('table'); - - $sd = $this->getServiceLocator()->get('ImportServiceDifferentiel'); - /* @var $sd \Import\Service\Differentiel */ - - $sc = $this->getServiceLocator()->get('ImportServiceSchema'); - /* @var $sc \Import\Service\Schema */ - - $mviews = $sc->getImportMviews(); - - if ($tableName){ - $tables = [$tableName]; - }else{ - $tables = $sc->getImportTables(); - sort($tables); - } - - $data = []; - foreach( $tables as $table ){ - $query = new Query($table); - $query->setLimit(101); - $data[$table] = $sd->make($query)->fetchAll(); - } - - return compact('data', 'mviews'); - } - - public function updateAction() - { - $errors = []; - $tableName = $this->params()->fromRoute('table'); - $typeMaj = $this->params()->fromPost('type-maj'); - - $query = new Query( $tableName ); - - $sd = $this->getServiceLocator()->get('ImportServiceDifferentiel'); - /* @var $sd \Import\Service\Differentiel */ - - $sq = $this->getServiceLocator()->get('ImportServiceQueryGenerator'); - /* @var $sq \Import\Service\QueryGenerator */ - - /* Mise à jour des données et récupération des éventuelles erreurs */ - try{ - if ('vue-materialisee' == $typeMaj){ - $sq->execMajVM($tableName); - }else{ - $errors = $errors + $sq->syncTable($tableName); - //$sq->execMaj($query); - } - }catch(\Exception $e){ - $errors = [$e->getMessage()]; - } - $query->setNotNull([]); // Aucune colonne ne doit être non nulle !! - $query->setLimit(101); - $lignes = $sd->make($query)->fetchAll(); - - return [ - 'lignes' => $lignes, - 'table' => $tableName, - 'errors' => $errors - ]; - } - - public function updateTablesAction() - { - $sc = $this->getServiceLocator()->get('ImportServiceSchema'); - /* @var $sc \Import\Service\Schema */ - - $sq = $this->getServiceLocator()->get('ImportServiceQueryGenerator'); - /* @var $sq \Import\Service\QueryGenerator */ - - $tables = $sc->getImportTables(); - sort($tables); - - $message = ''; - try{ - foreach( $tables as $table ){ - $message .= '<div>Table "'.$table.'" Mise à jour.</div>'; - $sq->execMaj( new Query($table) ); - } - $message .= 'Mise à jour des données OSE terminée'; - }catch(\Exception $e){ - $message = 'Une erreur a été rencontrée.'; - throw new \UnicaenApp\Exception\LogicException("mise à jour des données OSE impossible", null, $e); - } - - $title = "Résultat"; - return compact('message', 'title'); - } -} \ No newline at end of file diff --git a/module/Import/src/Import/Entity/Differentiel/Ligne.php b/module/Import/src/Import/Entity/Differentiel/Ligne.php deleted file mode 100644 index afe1ee5ab541ab531275a819589f7a35791e2d73..0000000000000000000000000000000000000000 --- a/module/Import/src/Import/Entity/Differentiel/Ligne.php +++ /dev/null @@ -1,212 +0,0 @@ -<?php - -namespace Import\Entity\Differentiel; - -use Doctrine\ORM\EntityManager; -use Application\Entity\Db\Source; - -/** - * Classe permettant de récupérer une ligne de différentiel - * - * @author Laurent LÉCLUSE <laurent.lecluse at unicaen.fr> - */ -class Ligne -{ - - /** - * Entity Manager - * - * @var EntityManager - */ - protected $entityManager; - - /** - * Nom de la table - * - * @var string - */ - protected $tableName; - - /** - * ID - * - * @var integer - */ - protected $id; - - /** - * Action - * - * @var string - */ - protected $action; - - /** - * ID de la source - * - * @var Source - */ - protected $source; - - /** - * Code source - * - * @var string - */ - protected $sourceCode; - - /** - * Données des colonnes - * - * @var array - */ - protected $values; - - /** - * Liste des colonnes ayant changé - * - * @var boolean[] - */ - protected $changed; - - - - - /** - * - * @param Statement $stmt - */ - public function __construct(EntityManager $entityManager, $tableName, array $data) - { - $this->tableName = $tableName; - $this->entityManager = $entityManager; - - $this->id = (integer)$data['ID']; - unset($data['ID']); - - $this->action = $data['IMPORT_ACTION']; - unset($data['IMPORT_ACTION']); - - $this->source = $entityManager->find(\Application\Entity\Db\Source::class, (integer)$data['SOURCE_ID']); - unset($data['SOURCE_ID']); - - $this->sourceCode = $data['SOURCE_CODE']; - unset($data['SOURCE_CODE']); - - $keys = array_keys( $data ); - foreach( $keys as $key ){ - if (in_array('U_'.$key, $keys)){ - $this->values[$key] = $data[$key]; - $this->changed[$key] = $data['U_'.$key] === '1'; - } - } - } - - /** - * Retourne le nom de la table correspondante - * - * @return string - */ - public function getTableName() - { - return $this->tableName; - } - - /** - * Retourne l'ID OSE de l'enregistrement - * - * @return integer - */ - public function getId() - { - return $this->id; - } - - /** - * Retourne le type d'action prévue pour l'import - * - * @return string - */ - public function getAction() - { - return $this->action; - } - - /** - * Retourne lasource de données - * - * @return Source - */ - public function getSource() - { - return $this->source; - } - - /** - * Retourne le code de la donnée source - * - * @return string - */ - public function getSourceCode() - { - return $this->sourceCode; - } - - /** - * Retourne, sous forme de chaîne de caractères, la valeur de la colonne donnée - * - * @param string $colName - * @return string - */ - public function get( $colName ) - { - return $this->values[$colName]; - } - - /** - * Retourne l'entité Doctrine correspondante - * - * @return StdClass - */ - public function getEntity() - { - $filter = new \Zend\Filter\Word\UnderscoreToCamelCase; - $entityClass = 'Application\\Entity\Db\\'.$filter->filter(strtolower($this->getTableName())); - return $this->entityManager->find($entityClass, $this->getId()); - } - - /** - * Retourne true si la colonne $colName a changé, false sinon - * - * @param string $colName - * @return boolean - */ - public function hasChanged( $colName ) - { - return $this->changed[$colName]; - } - - /** - * Retourne un tableau des colonnes ayant changé - * - * @return array - */ - public function getChanges() - { - $changes = []; - foreach( $this->changed as $colName => $changed ){ - if ($changed) $changes[$colName] = $this->values[$colName]; - } - return $changes; - } - - /** - * Retourne le gestionnaire d'entités correspondant - * - * @return EntityManager - */ - public function getEntityManager() - { - return $this->entityManager; - } -} \ No newline at end of file diff --git a/module/Import/src/Import/Entity/Differentiel/Query.php b/module/Import/src/Import/Entity/Differentiel/Query.php deleted file mode 100644 index ba496d388b871c7ec3d2b6bce2ddbe020da385b9..0000000000000000000000000000000000000000 --- a/module/Import/src/Import/Entity/Differentiel/Query.php +++ /dev/null @@ -1,551 +0,0 @@ -<?php - -namespace Import\Entity\Differentiel; - -use Application\Entity\Db\Source; -use Import\Exception\Exception; -use Import\Service\Service; -use Import\Service\QueryGenerator; - -/** - * Classe permettant de créer une requête de récupération de différentiel - * - * @author Laurent LÉCLUSE <laurent.lecluse at unicaen.fr> - */ -class Query -{ - - const ACTION_INSERT = 'insert'; - const ACTION_UPDATE = 'update'; - const ACTION_DELETE = 'delete'; - const ACTION_UNDELETE = 'undelete'; - - /** - * Nom de la table - * - * @var string - */ - protected $tableName; - - /** - * ID - * - * @var integer|integer[]|null - */ - protected $id; - - /** - * Action - * - * @var string|string[]|null - */ - protected $action; - - /** - * Source de données - * - * @var Source|Source[]|null - */ - protected $source; - - /** - * Code source - * - * @var string|string[]|null - */ - protected $sourceCode; - - /** - * inTable - * - * @var string - */ - protected $inTable; - - /** - * Liste des colonnes ayant changé à filtrer - * - * @var string|string[]|null - */ - protected $colChanged; - - /** - * Liste des colonnes avec des valeurs spéciales à filtrer - * - * @var array - */ - protected $colValues = []; - - /** - * Liste des colonnes ne devant pas être nulles - * - * @var string[] - */ - protected $notNull = []; - - /** - * Limite au nombre d'enregistrements retournés - * - * @var integer - */ - protected $limit; - - /** - * ignoreFields - * - * @var string[] - */ - protected $ignoreFields; - - /** - * defaultSqlCriterion - * - * @var string - */ - protected $defaultSqlCriterion; - - - - - - /** - * Constructeur - * - * @param string $tableName - */ - function __construct( $tableName ) - { - $this->setTableName($tableName); - } - - /** - * - * @param QueryGenerator $queryGenerator - * @return self - */ - public function addDefaultSqlCriterion( QueryGenerator $queryGenerator ) - { - if ($this->getTableName()){ - $this->defaultSqlCriterion = $queryGenerator->getSqlCriterion($this->getTableName()); - } - return $this; - } - - /** - * Retourne le nom de la table correspondante - * - * @return string - */ - public function getTableName() - { - return $this->tableName; - } - - /** - * - * @param string $tableName - * @return self - */ - public function setTableName($tableName) - { - $this->tableName = (string)$tableName; - return $this; - } - - /** - * Retourne le ou les ID scrutés - * - * @return integer|integer[]|null - */ - public function getId() - { - return $this->id; - } - - /** - * Ajoute un ou plusieurs ID - * - * @param integer|integer[]|null $id - * @return self - */ - public function setId($id) - { - if (empty($id)){ - $this->id = null; - }elseif( is_array($id)){ - $this->id = []; - foreach( $id as $i ) $this->id[] = (int)$i; - }else{ - $this->id = (int)$id; - } - return $this; - } - - /** - * - * Retourne la ou les actions scrutées - * - * @return string|string[]|null - */ - public function getAction() - { - return $this->action; - } - - /** - * Ajoute une ou plusieures actions - * - * @param string|string[]|null $action - * @return self - */ - public function setAction($action) - { - $goodActions = [self::ACTION_DELETE,self::ACTION_INSERT,self::ACTION_UNDELETE,self::ACTION_UPDATE]; - - if (empty($action)){ - $this->action = null; - }elseif( is_array($action)){ - foreach( $action as $a ){ - if (! in_array($a,$goodActions)){ - throw new Exception('Requête erronée : action "'.$a.'" invalide'); - } - } - $this->action = $action; - }else{ - if (! in_array($action,$goodActions)){ - throw new Exception('Requête erronée : action "'.$action.'" invalide'); - } - $this->action = $action; - } - return $this; - } - - /** - * Retourne la ou les sources de données - * - * @return Source|Source[]|null - */ - public function getSource() - { - return $this->source; - } - - /** - * Ajoute un ou plusieurs sources de données - * - * @param Source|Source[]|null $source - * @return self - */ - public function setSource($source) - { - if (empty($source)){ - $this->source = null; - }elseif( is_array($source)){ - foreach( $source as $s ){ - if (! $s instanceof Source){ - throw new Exception('Requête erronée : classe source "'.get_class($s).'" invalide'); - } - if (! $s->getImportable()){ - throw new Exception('Requête erronée : source "'.$s->getLibelle().'" non importable'); - } - } - $this->source = $source; - }else{ - if (! $source instanceof Source){ - throw new Exception('Requête erronée : classe source "'.get_class($source).'" invalide'); - } - if (! $source->getImportable()){ - throw new Exception('Requête erronée : source "'.$source->getLibelle().'" non importable'); - } - $this->source = $source; - } - return $this; - } - - /** - * Ajoute un ou plusieurs enregistrements sources - * - * @return string|string[]|null - */ - public function getSourceCode() - { - return $this->sourceCode; - } - - /** - * - * @param string|string[]|null $sourceCode - * @return self - */ - public function setSourceCode($sourceCode) - { - if (empty($sourceCode)){ - $this->sourceCode = null; - }elseif( is_array($sourceCode)){ - $this->sourceCode = []; - foreach( $sourceCode as $sc ) $this->sourceCode[] = (string)$sc; - }else{ - $this->sourceCode = (string)$sourceCode; - } - return $this; - } - - /** - * Retourne la table pour laquelle l'enregistrement doit ou peut être présent - * - * @return string - */ - public function getInTable() - { - return $this->inTable; - } - - /** - * Détermine si l'enregistrement doit ou peut être présent dans la table nommée ou non - * - * @param string $inTable - * @return self - */ - public function setInTable($inTable) - { - $this->inTable = $inTable; - return $this; - } - - - /** - * Retourne la liste des colonnes scrutées - * - * @return string|string[]|null - */ - public function getColChanged() - { - return $this->colChanged; - } - - /** - * Ajoute une ou plusieurs colonnes - * - * @param string|string[]|null $colChanged - * @return self - */ - public function setColChanged($colChanged) - { - if (empty($colChanged)){ - $this->colChanged = null; - }elseif( is_array($colChanged)){ - $this->colChanged = []; - foreach( $colChanged as $c ) $this->colChanged[] = (string)$c; - }else{ - $this->colChanged = (string)$colChanged; - } - return $this; - } - - /** - * Retourne le liste des valeurs à filtrer, colonne par colonne - * - * @return array - */ - public function getColValues() - { - return $this->colValues; - } - - /** - * Applique une liste de colonnes à scruter en fonction des valeurs transmises - * - * format du tableau : {Nom de colonne => Valeur(s) à scruter} - * - * @param array $colValues - * @return self - */ - public function setColValues( array $colValues ) - { - $this->colValues = $colValues; - } - - /** - * Détermine une valeu à scruter pour une colonne donnée - * - * @param string $column - * @param mixed $value - */ - public function addColValue( $column, $value ) - { - $this->colValues[$column] = $value; - } - - /** - * Retourne la liste des colonnes ne devant pas être nulles - * - * @return string[] - */ - public function getNotNull() - { - return $this->notNull; - } - - /** - * Applique une liste de colonnes ne devant pas être nulles - * - * - * @param string[] $notNull - * @return self - */ - public function setNotNull( array $notNull ) - { - $this->notNull = $notNull; - } - - /** - * Ajoute une colonne ne devant pas être nulle - * - * @param string $column - */ - public function addNotNull( $column ) - { - $this->notNull[] = $column; - return $this; - } - - /** - * - * @return integer - */ - public function getLimit() - { - return $this->limit; - } - - /** - * - * @param integer $limit - * @return self - */ - public function setLimit($limit) - { - $this->limit = (int)$limit; - return $this; - } - - /** - * Retourne la liste des champs à ignorer pour la MAJ - * - * @return string[] - */ - public function getIgnoreFields() - { - return $this->ignoreFields; - } - - /** - * Modifie la liste des champs à ignorer pour la MAJ - * - * @param string[] $ignoreFields - * @return self - */ - public function setIgnoreFields(array $ignoreFields) - { - $this->ignoreFields = $ignoreFields; - return $this; - } - - /** - * Ajoute un champ à la liste des champs à ignorer pour la MAJ - * - * @param string $ignoreField - * @return self - */ - public function addIgnoreField($ignoreField) - { - if (! is_array($this->ignoreFields)) $this->ignoreFields = []; - if (! in_array($ignoreField, $this->ignoreFields)){ - $this->ignoreFields[] = $ignoreField; - } - return $this; - } - - /** - * Construit la requête SQL correspondante - * - * @return string - */ - public function toSql($full=true) - { - $viewName = Service::escapeKW('V_DIFF_'.$this->tableName); - - $where = []; - if (! empty($this->id)){ - $where[] = $viewName.'.ID'.Service::equals($this->id); - } - - if (! empty($this->action)){ - $w = $viewName.'.IMPORT_ACTION'.Service::equals($this->action); - if (! empty($this->inTable)){ - $w = '('.$w.' OR '.$viewName.'.SOURCE_CODE IN (SELECT SOURCE_CODE FROM '.Service::escapeKW($this->inTable).')'.')'; - } - $where[] = $w; - } - - if (! empty($this->source)){ - if (is_array($this->source)){ - $values = []; - foreach( $this->source as $value ){ $values[] = $value->getId(); } - $where[] = $viewName.'.SOURCE_ID'.Service::equals($values); - }else{ - $where[] = $viewName.'.SOURCE_ID'.Service::equals($this->source->getId()); - } - } - - if (! empty($this->sourceCode)){ - $where[] = $viewName.'.SOURCE_CODE'.Service::equals($this->sourceCode); - } - - if (! empty($this->colChanged)){ - $cols = (array)$this->colChanged; - $cond = []; - foreach( $cols as $column ){ - $cond[] = $viewName.'.'.Service::escapeKW ('U_'.$column).' = 1'; - } - $where[] = '('.implode( ' OR ', $cond).')'; - } - - if (! empty($this->colValues)){ - foreach( $this->colValues as $column => $value ){ - $where[] = $viewName.'.'.Service::escapeKW($column).Service::equals($value); - } - } - - if (! empty($this->notNull)){ - foreach( $this->notNull as $column ){ - $where[] = $viewName.'.'.Service::escapeKW($column).' IS NOT NULL'; - } - } - - if ($this->limit !== null){ - $where[] = 'ROWNUM <= '.$this->limit; - } - - - if ($full){ - $sql = 'SELECT * FROM '.$viewName.' '; - }else{ - $sql = ''; - } - if (! empty($where)){ - if (! empty($this->defaultSqlCriterion)){ - $sql .= $this->defaultSqlCriterion.' AND '.implode( ' AND ', $where ); - }else{ - $sql .= 'WHERE '.implode( ' AND ', $where ); - } - }else{ - if (! empty($this->defaultSqlCriterion)){ - $sql .= $this->defaultSqlCriterion; - } - } - - return $sql; - } - -} \ No newline at end of file diff --git a/module/Import/src/Import/Entity/Schema/Column.php b/module/Import/src/Import/Entity/Schema/Column.php deleted file mode 100644 index 91b1dcbec0bf02befebe92481bf24d24d3bb3ca0..0000000000000000000000000000000000000000 --- a/module/Import/src/Import/Entity/Schema/Column.php +++ /dev/null @@ -1,64 +0,0 @@ -<?php - -namespace Import\Entity\Schema; - - - -/** - * - * - * @author Laurent LÉCLUSE <laurent.lecluse at unicaen.fr> - */ -class Column -{ - - /** - * Type de données - * - * @var string - */ - public $dataType; - - /** - * Longueur - * - * @var integer - */ - public $length; - - /** - * Nullable - * - * @var boolean - */ - public $nullable; - - /** - * Si la colonne possède ou non une valeur par défaut - * - * @var boolean - */ - public $hasDefault; - - /** - * Nom de la table référence (si clé étrangère) - * - * @var string - */ - public $refTableName; - - /** - * Nom du champ référence (si clé étrangère) - * - * @var string - */ - public $refColumnName; - - /** - * Si l'import par synchronisation est actif ou non - * - * @var boolean - */ - public $importActif; - -} \ No newline at end of file diff --git a/module/Import/src/Import/Exception/Exception.php b/module/Import/src/Import/Exception/Exception.php deleted file mode 100644 index ed59b6732c07f54f3a7d4bf7d064502af83f9778..0000000000000000000000000000000000000000 --- a/module/Import/src/Import/Exception/Exception.php +++ /dev/null @@ -1,54 +0,0 @@ -<?php - -namespace Import\Exception; - -use RuntimeException; - -/** - * - * - * @author Laurent Lécluse <laurent.lecluse at unicaen.fr> - */ -class Exception extends RuntimeException { - - /** - * @param \Exception $exception - * @param string $tableName - * - * @return \Doctrine\DBAL\DBALException - */ - public static function duringMajMVException(\Exception $exception, $tableName) - { - if (! $exception->getPrevious() instanceof \Doctrine\DBAL\Driver\OCI8\OCI8Exception){ - // Non gérée - return $exception; - } - - $msg = $exception->getPrevious()->getMessage(); - - $msg = "Erreur lors de la mise à jour de la vue métarialisée liée à la table $tableName\n\n$msg"; - - return new self($msg, 0, $exception); - } - - /** - * @param \Exception $exception - * @param string $tableName - * - * @return \Doctrine\DBAL\DBALException - */ - public static function duringMajException(\Exception $exception, $tableName) - { - if (! $exception->getPrevious() instanceof \Doctrine\DBAL\Driver\OCI8\OCI8Exception){ - // Non gérée - return $exception; - } - - $msg = $exception->getPrevious()->getMessage(); - - $msg = "Erreur lors d'une mise à jour de données dans la table $tableName\n\n$msg"; - - return new self($msg, 0, $exception); - } - -} \ No newline at end of file diff --git a/module/Import/src/Import/Exception/MissingDependency.php b/module/Import/src/Import/Exception/MissingDependency.php deleted file mode 100644 index 86ff74fcb3cc869487f4ba9d6677b9ff7e235fac..0000000000000000000000000000000000000000 --- a/module/Import/src/Import/Exception/MissingDependency.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php - -namespace Import\Exception; - -/** - * - * - * @author Laurent Lécluse <laurent.lecluse at unicaen.fr> - */ -class MissingDependency extends Exception { - -} \ No newline at end of file diff --git a/module/Import/src/Import/Processus/Import.php b/module/Import/src/Import/Processus/Import.php deleted file mode 100644 index 396795b903d8fdcbf4039ca9be7ecdfba710e94e..0000000000000000000000000000000000000000 --- a/module/Import/src/Import/Processus/Import.php +++ /dev/null @@ -1,307 +0,0 @@ -<?php - -namespace Import\Processus; - -use Import\Entity\Differentiel\Query; -use Application\Entity\Db\Etablissement; -use Application\Entity\Db\SectionCnu; -use Application\Entity\Db\Corps; -use Application\Entity\Db\Intervenant; -use Application\Entity\Db\GroupeTypeFormation; -use Application\Entity\Db\TypeFormation; -use Application\Entity\Db\Etape; -use Zend\ServiceManager\ServiceLocatorAwareInterface; -use Zend\ServiceManager\ServiceLocatorAwareTrait; -use Application\Service\Traits\ContextAwareTrait; - - -/** - * - * - * @author Laurent Lécluse <laurent.lecluse at unicaen.fr> - */ -class Import implements ServiceLocatorAwareInterface -{ - use ServiceLocatorAwareTrait; - use ContextAwareTrait; - - - - /** - * Mise à jour de l'existant uniquement - */ - const A_UPDATE = 'update'; - - /** - * Insertion de nouvelles données ou restauration d'anciennes uniquement - */ - const A_INSERT = 'insert'; - - /** - * Mise à jour globale - */ - const A_ALL = 'all'; - - /** - * Retourne le générateur de requêtes - * - * @return \Import\Service\QueryGenerator - */ - protected function getQueryGenerator() - { - return $this->getServiceLocator()->get('importServiceQueryGenerator'); - } - - /** - * Retourne le service différentiel - * - * @return \Import\Service\Differentiel - */ - protected function getDifferentiel() - { - return $this->getServiceLocator()->get('importServiceDifferentiel'); - } - - /** - * Mise à jour des vues différentielles et des paquetages de mise à jour des données - * - * @return self - */ - public function updateViewsAndPackages() - { - $this->getQueryGenerator()->updateViewsAndPackages(); - return $this; - } - - /** - * Import d'une ou plusieurs structures - * - * @param string|array|null $sourceCode Identifiant source de la structure - * @param string $action Action - * @return self - */ - public function structure( $sourceCode=null, $action=self::A_ALL ) - { - $this->execMaj( 'STRUCTURE', 'SOURCE_CODE', $sourceCode, $action ); - - $id = $this->getQueryGenerator()->getIdFromSourceCode( 'STRUCTURE', $sourceCode ); - if (! empty($id)){ - $this->execMaj( 'ADRESSE_STRUCTURE', 'STRUCTURE_ID', $id, $action ); - $this->execMaj( 'ROLE', 'STRUCTURE_ID', $id, $action ); - } - return $this; - } - - /** - * Import d'un, plusieurs ou tous les personnels - * - * @param string|array|null $sourceCode Identifiant source du personnel - * @param string $action Action - * @retun self - */ - public function personnel( $sourceCode=null, $action=self::A_ALL ) - { - $this->execMaj( 'PERSONNEL', 'SOURCE_CODE', $sourceCode, $action ); - return $this; - } - - /** - * Import d'un, plusieurs ou tous les établissements - * - * @param string|array|null $sourceCode Identifiant source de l\'établissement - * @param string $action Action - * @retun self - */ - public function etablissement( $sourceCode=null, $action=self::A_ALL ) - { - $this->execMaj( 'ETABLISSEMENT', 'SOURCE_CODE', $sourceCode, $action ); - return $this; - } - - /** - * Retourne les lignes de différentiel correspondantes à l'établissement - * - * @param Etablissement $etablissement - * @return Ligne[]|array() - */ - public function etablissementGetDifferentiel( Etablissement $etablissement ) - { - $q = new Query('etablissement'); - $q->setSourceCode($etablissement->getSourceCode()); - $diff = $this->getDifferentiel()->make($q)->fetchAll(); - - return $diff; - } - - /** - * Import d'un, plusieurs ou tous les corps - * - * @param string|array|null $sourceCode Identifiant source du corps - * @param string $action Action - * @retun self - */ - public function corps( $sourceCode=null, $action=self::A_ALL ) - { - $this->execMaj( 'CORPS', 'SOURCE_CODE', $sourceCode, $action ); - return $this; - } - - /** - * Import d'un ou plusieurs ou tous les intervenants - * - * @param string|array|null $sourceCode Identifiant source de l\'intervenant - * @param string $action Action - * @return self - */ - public function intervenant( $sourceCode=null, $action=null ) - { - $this->execMaj( 'INTERVENANT', 'SOURCE_CODE', $sourceCode, $action ?: self::A_INSERT ); - $id = $this->getQueryGenerator()->getIdFromSourceCode( 'INTERVENANT', $sourceCode, $this->getServiceContext()->getAnnee()->getId() ); - if (! empty($id)){ - $this->execMaj( 'ADRESSE_INTERVENANT', 'INTERVENANT_ID', $id, $action ?: self::A_ALL ); - $this->execMaj( 'AFFECTATION_RECHERCHE', 'INTERVENANT_ID', $id, $action ?: self::A_ALL ); - } - return $this; - } - - /** - * Retourne les lignes de différentiel correspondantes à l'intervenant - * - * @param Intervenant $intervenant - * @return Ligne[]|array() - */ - public function intervenantGetDifferentiel( Intervenant $intervenant ) - { - $differentiel = $this->getDifferentiel(); - - $q1 = new Query('INTERVENANT'); - $q1->setSourceCode($intervenant->getSourceCode()); - - $q2 = new Query('ADRESSE_INTERVENANT'); - $q2->addColValue('INTERVENANT_ID', $intervenant->getId() ); - - $q3 = new Query('AFFECTATION_RECHERCHE'); - $q3->addColValue('INTERVENANT_ID', $intervenant->getId() ); - - $diff = array_merge( - $differentiel->make($q1)->fetchAll(), - $differentiel->make($q2)->fetchAll(), - $differentiel->make($q3)->fetchAll() - ); - - return $diff; - } - - /** - * Import d'un, plusieurs ou tous groupes de type de formation - * - * @param string|array|null $sourceCode Identifiant source - * @param string $action Action - * @retun self - */ - public function groupeTypeFormation( $sourceCode=null, $action=self::A_ALL ) - { - $this->execMaj( 'GROUPE_TYPE_FORMATION', 'SOURCE_CODE', $sourceCode, $action ); - return $this; - } - - /** - * Retourne les lignes de différentiel correspondantes aux groupes de types de formation - * - * @param GroupeTypeFormation $groupeTypeFormation - * @return Ligne[]|array() - */ - public function groupeTypeFormationGetDifferentiel( GroupeTypeFormation $groupeTypeFormation ) - { - $q = new Query('groupeTypeFormation'); - $q->setSourceCode($groupeTypeFormation->getSourceCode()); - $diff = $this->getDifferentiel()->make($q)->fetchAll(); - - return $diff; - } - - /** - * Import d'un, plusieurs ou tous les types de formation - * - * @param string|array|null $sourceCode Identifiant source - * @param string $action Action - * @retun self - */ - public function typeFormation( $sourceCode=null, $action=self::A_ALL ) - { - $this->execMaj( 'TYPE_FORMATION', 'SOURCE_CODE', $sourceCode, $action ); - return $this; - } - - /** - * Retourne les lignes de différentiel correspondantes aux types de formation - * - * @param TypeFormation $typeFormation - * @return Ligne[]|array() - */ - public function typeFormationGetDifferentiel( TypeFormation $typeFormation ) - { - $q = new Query('typeFormation'); - $q->setSourceCode($typeFormation->getSourceCode()); - $diff = $this->getDifferentiel()->make($q)->fetchAll(); - - return $diff; - } - - /** - * Import d'un, plusieurs ou toutes les étapes - * - * @param string|array|null $sourceCode Identifiant source - * @param string $action Action - * @retun self - */ - public function etape( $sourceCode=null, $action=self::A_ALL ) - { - $this->execMaj( 'ETAPE', 'SOURCE_CODE', $sourceCode, $action ); - return $this; - } - - /** - * Retourne les lignes de différentiel correspondantes aux étapes - * - * @param Etape $etape - * @return Ligne[]|array() - */ - public function etapeGetDifferentiel( Etape $etape ) - { - $q = new Query('etape'); - $q->setSourceCode($etape->getSourceCode()); - $diff = $this->getDifferentiel()->make($q)->fetchAll(); - - return $diff; - } - - /** - * Construit et exécute la reqûete d'interrogation des vues différentielles - * - * @param string $tableName Nom de la table - * @param string $name Nom du champ à tester - * @param string|null $value Valeur de test du champ - * @param string $action Action - * @retun self - */ - protected function execMaj( $tableName, $name, $value=null, $action=self::A_ALL ) - { - if ('SOURCE_CODE' == $name && $value !== null){ - $value = (string)$value; - } - $query = new Query($tableName); - if (null !== $value) $query->addColValue($name, $value); - switch( $action ){ - case 'insert': - $query->setAction ([Query::ACTION_INSERT,Query::ACTION_UNDELETE]); - break; - case 'update': - $query->setAction ([Query::ACTION_UPDATE,Query::ACTION_DELETE]); - break; - } - $this->getQueryGenerator()->execMaj($query); - return $this; - } - -} \ No newline at end of file diff --git a/module/Import/src/Import/Service/Differentiel.php b/module/Import/src/Import/Service/Differentiel.php deleted file mode 100644 index 4d2554f86d9ae36a4ead3dddf7343f1c935c1569..0000000000000000000000000000000000000000 --- a/module/Import/src/Import/Service/Differentiel.php +++ /dev/null @@ -1,78 +0,0 @@ -<?php - -namespace Import\Service; - -use Doctrine\DBAL\Driver\Statement; -use Import\Entity\Differentiel\Ligne; -use Import\Entity\Differentiel\Query; - - -/** - * Classe permettant de récupérer le différentiel entre une table source et une table OSE - * - * @author Laurent LÉCLUSE <laurent.lecluse at unicaen.fr> - */ -class Differentiel extends Service -{ - - /** - * Statement - * - * @var Statement - */ - protected $stmt; - - /** - * Nom de la table courante - * - * @var string - */ - protected $tableName; - - - - - - /** - * Construit un différentiel - * - * @param string $query Requête de filtrage - * @return self - */ - public function make( Query $query ) - { - $sqg = $this->getServiceManager()->get('importServiceQueryGenerator'); - /* @var $sqg QueryGenerator */ - - $this->tableName = $query->getTableName(); - $query->addDefaultSqlCriterion( $sqg ); - $this->stmt = $this->getEntityManager()->getConnection()->executeQuery( $query->toSql(), [] ); - return $this; - } - - /** - * Récupère la prochaine ligne de différentiel - * - * @return Ligne|false - */ - public function fetchNext() - { - $data = $this->stmt->fetch(); - if ($data) return new Ligne( $this->getEntityManager(), $this->tableName, $data ); - return false; - } - - /** - * Retourne toutes les lignes concernées - * - * @return Ligne[] - */ - public function fetchAll() - { - $result = []; - while( $data = $this->stmt->fetch() ){ - if ($data) $result[] = new Ligne( $this->getEntityManager(), $this->tableName, $data ); - } - return $result; - } -} \ No newline at end of file diff --git a/module/Import/src/Import/Service/Intervenant.php b/module/Import/src/Import/Service/Intervenant.php deleted file mode 100644 index 5bd6a77442d9950858f46313d6cfa5f6b665d053..0000000000000000000000000000000000000000 --- a/module/Import/src/Import/Service/Intervenant.php +++ /dev/null @@ -1,83 +0,0 @@ -<?php - -namespace Import\Service; - -use Application\Entity\Db\Structure; -use Application\Entity\Db\TypeIntervenant; - -/** - * - * - * @author Laurent Lécluse <laurent.lecluse at unicaen.fr> - */ -class Intervenant extends Service { - - /** - * Recherche un ensemble d'intervenants - * - * @param string $criterion - * @param Structure|null $structure - * @param TypeIntervenant|null $typeIntervenant - * @return array[] - */ - public function searchIntervenant( $criterion, Structure $structure=null, TypeIntervenant $typeIntervenant=null ) - { - - $params = [ - 'criterionId' => (integer)$criterion, - 'limit' => 100 - ]; - - $criterion = explode( ' ', $criterion ); - - $sqlCrit = ''; - for( $i=0; $i<count($criterion); $i++ ){ - if ('' != $sqlCrit) $sqlCrit .= ' AND '; - $sqlCrit .= "(lower(CONVERT(i.nom_usuel,'US7ASCII')) LIKE LOWER(CONVERT(:criterionStr$i,'US7ASCII'))" - ." OR lower(CONVERT(i.nom_patronymique,'US7ASCII')) LIKE LOWER(CONVERT(:criterionStr$i,'US7ASCII'))" - ." OR lower(CONVERT(i.prenom,'US7ASCII')) LIKE LOWER(CONVERT(:criterionStr$i,'US7ASCII')))"; - $params["criterionStr$i"] = '%'.$criterion[$i].'%'; - } - - $where = ''; - if ($structure){ - $where .= 'AND i.structure_id = '.$structure->getId()."\n"; - } - if ($typeIntervenant){ - $where .= 'AND i.type_id = '.$typeIntervenant->getId()."\n"; - } - - $sql = <<<EOS - SELECT DISTINCT - i.source_code, - c.libelle_court civilite, - i.nom_usuel, - i.nom_patronymique, - decode(c.sexe, 'F', 1, 0) est_une_femme, - i.prenom, - i.date_naissance, - s.libelle_court affectation - FROM - SRC_INTERVENANT i - JOIN CIVILITE c ON (c.ID = i.CIVILITE_ID) - JOIN STRUCTURE s ON (s.ID = i.STRUCTURE_ID) - WHERE - (i.source_code = :criterionId OR ($sqlCrit)) - $where - AND rownum <= :limit - ORDER BY - nom_usuel, prenom -EOS; - - $res = $this->query($sql, $params ); - - $result = []; - $f = new \Application\Filter\IntervenantTrouveFormatter(); - foreach( $res as $r ){ - $result[$r['SOURCE_CODE']] = $f->filter($r); - } - - return $result; - } - -} \ No newline at end of file diff --git a/module/Import/src/Import/Service/QueryGenerator.php b/module/Import/src/Import/Service/QueryGenerator.php deleted file mode 100644 index 258e48c59fb1d283c6e7b419b50c84afe4d0b67e..0000000000000000000000000000000000000000 --- a/module/Import/src/Import/Service/QueryGenerator.php +++ /dev/null @@ -1,553 +0,0 @@ -<?php -namespace Import\Service; - -use Import\Exception\Exception; -use Import\Entity\Differentiel\Query; - -/** - * - * - * @author Laurent LÉCLUSE <laurent.lecluse at unicaen.fr> - */ -class QueryGenerator extends Service -{ - const AG_BEGIN = '-- AUTOMATIC GENERATION --'; - const AG_END = '-- END OF AUTOMATIC GENERATION --'; - const ANNEE_COLUMN_NAME = 'ANNEE_ID'; - - /** - * Tables - * - * @var string[] - */ - protected $tables; - - /** - * Colonnes - * - * @var array - */ - protected $cols = []; - - - - - - /** - * Retourne la liste des tables importables - * - * @return string[] - */ - protected function getTables() - { - if (empty($this->tables)){ - $this->tables = $this->getServiceSchema()->getImportTables(); - } - return $this->tables; - } - - - - /** - * Retourne la liste des colonnes importables d'une table - * - * @param string $tableName - * @return string[] - */ - protected function getCols( $tableName ) - { - if (! isset($this->cols[$tableName])){ - $this->cols[$tableName] = $this->getServiceSchema()->getImportCols( $tableName ); - } - return $this->cols[$tableName]; - } - - - - public function execMajVM( $tableName ) - { - $mviewName = $this->escape('MV_'.$tableName); - $sql = "BEGIN DBMS_MVIEW.REFRESH($mviewName, 'C'); END;"; - try{ - $this->getEntityManager()->getConnection()->exec($sql); - }catch(\Doctrine\DBAL\DBALException $e){ - throw Exception::duringMajMVException($e, $tableName); - } - } - - - - /** - * Met à jour des données d'après la requête transmise - * - * @param Query $query Requête de filtrage pour la mise à jour - * @retun self - */ - public function execMaj( Query $query ) - { - $currentUser = $this->getDbUser(); - if (empty($currentUser)){ - throw new Exception('Vous devez être authentifié pour réaliser cette action'); - } - $userId = $this->escape($currentUser->getId()); - $procName = $this->escapeKW('MAJ_'.$query->getTableName()); - $conditions = $query->toSql(false); - if (! empty($conditions)){ - $conditions = $this->escape($conditions); - }else{ - $conditions = 'NULL'; - } - $ignoreFields = $query->getIgnoreFields(); - if (empty($ignoreFields)){ - $ignoreFields = 'NULL'; - }else{ - $ignoreFields = $this->escape(implode(',',$ignoreFields)); - } - - $sql = "BEGIN OSE_IMPORT.SET_CURRENT_USER($userId);OSE_IMPORT.$procName($conditions,$ignoreFields); END;"; - try{ - $this->getEntityManager()->getConnection()->exec($sql); - }catch(\Doctrine\DBAL\DBALException $e){ - throw Exception::duringMajException($e, $query->getTableName()); - } - return $this; - } - - /** - * Synchronise une table - * - * @param string $tableName - * @return string[] - */ - public function syncTable( $tableName ) - { - $currentUser = $this->getDbUser(); - if (empty($currentUser)){ - throw new Exception('Vous devez être authentifié pour réaliser cette action'); - } - $userId = $this->escape($currentUser->getId()); - - $errors = []; - $lastLogId = $this->getLastLogId(); - $sql = "BEGIN OSE_IMPORT.SET_CURRENT_USER($userId);OSE_IMPORT.".$this->escapeKW('MAJ_'.$tableName)."; END;"; - try{ - $this->getEntityManager()->getConnection()->exec($sql); - }catch(\Doctrine\DBAL\DBALException $e){ - $errors[] = Exception::duringMajException($e, $tableName)->getMessage(); - } - $errors = $errors + $this->getLogMessages($lastLogId); - return $errors; - } - - /** - * retourne le dernier ID du log de synchronisation - * - * @return int - */ - protected function getLastLogId() - { - $sql = "SELECT MAX(id) last_log_id FROM SYNC_LOG"; - $stmt = $this->getEntityManager()->getConnection()->executeQuery( $sql ); - if($r = $stmt->fetch()){ - return (int)$r['LAST_LOG_ID']; - } - return 0; - } - - /** - * Retourne tous les messages d'erreur qui sont apparue depuis $since - * - * @param int $since - * @return string[] - */ - protected function getLogMessages( $since ) - { - $since = (int)$since; - $sql = "SELECT message FROM sync_log WHERE id > :since ORDER BY id"; - $messages = []; - $stmt = $this->getEntityManager()->getConnection()->executeQuery( $sql, ['since' => (int)$since] ); - while($r = $stmt->fetch()){ - $messages[] = $r['MESSAGE']; - } - return $messages; - } - - /** - * - * @param string $tableName - * @return null|string - */ - public function getSqlCriterion( $tableName ) - { - $sql = 'SELECT OSE_IMPORT.GET_SQL_CRITERION('.$this->escape($tableName).',\'\') res FROM DUAL'; - $stmt = $this->getEntityManager()->getConnection()->executeQuery( $sql ); - - if($r = $stmt->fetch()){ - $res = $r['RES']; - if ($res) return $res; else return null; - } - return null; - } - - /** - * Retourne les identifiants des données concernés - * - * @param string $tableName - * @param string|string[]|null $sourceCode - * @param integer|null $anneeId - * @return integer[]|null - */ - public function getIdFromSourceCode( $tableName, $sourceCode, $anneeId=null ) - { - if (empty($sourceCode)) return null; - - $sql = 'SELECT ID FROM '.$this->escapeKW($tableName).' WHERE SOURCE_CODE IN (:sourceCode)'; - if ($anneeId){ - $sql .= ' AND ANNEE_ID = '.(string)(int)$anneeId; - } - $stmt = $this->getEntityManager()->getConnection()->executeQuery( - $sql, - ['sourceCode' => (array)$sourceCode], - ['sourceCode' => \Doctrine\DBAL\Connection::PARAM_INT_ARRAY] - ); - if ($r = $stmt->fetch()){; - return (int)$r['ID']; - }else{ - return null; - } - } - - - - /** - * Mettre à jour toutes les infos dans la BDD - * - * @return self - */ - public function updateViewsAndPackages() - { - $views = $this->makeDiffViews(); - - foreach( $views as $vn => $view ){ - $this->exec( $view ); - } - - $declaration = $this->makePackageDeclaration(); - $this->exec( $declaration ); - - $body = $this->makePackageBody(); - $this->exec( $body ); - - return $this; - } - - - - /** - * Retourne le code source du package d'import - * - * @return string - */ - protected function getPackageDeclaration() - { - $sql = "SELECT TEXT FROM USER_SOURCE WHERE NAME = 'OSE_IMPORT' AND type = 'PACKAGE'"; - $result = $this->query($sql, [], 'TEXT'); - return implode("", $result); - } - - - - /** - * Retourne le code source du package d'import - * - * @return string - */ - protected function getPackageBody() - { - $sql = "SELECT TEXT FROM USER_SOURCE WHERE NAME = 'OSE_IMPORT' AND type = 'PACKAGE BODY'"; - $result = $this->query($sql, [], 'TEXT'); - return implode("", $result); - } - - - - /** - * Construit toutes les vues différentielles - * - * @return array - */ - protected function makeDiffViews() - { - $tables = $this->getTables(); - $result = []; - foreach( $tables as $table ){ - $result[$table] = $this->makeDiffView($table); - } - return $result; - } - - - - /** - * Construit toutes les déclarations de procédures - * - * @return array - */ - protected function makeProcDeclarations() - { - $tables = $this->getTables(); - $result = []; - foreach( $tables as $table ){ - $result[$table] = $this->makeProcDeclaration($table); - } - return $result; - } - - - - /** - * Construit tous les corps de procédures - * - * @return array - */ - protected function makeProcBodies() - { - $tables = $this->getTables(); - $result = []; - foreach( $tables as $table ){ - $result[$table] = $this->makeProcBody($table); - } - return $result; - } - - - - /** - * Constuit la nouvelle déclaration du package OSE_IMPORT - * - * @return string - */ - protected function makePackageDeclaration() - { - $src = $this->getPackageDeclaration(); - $decl = implode( "\n", $this->makeProcDeclarations() ); - return $this->updatePackageContent($src, $decl); - } - - - - /** - * Constuit la nouvelle déclaration du package OSE_IMPORT - * - * @return string - */ - protected function makePackageBody() - { - $src = $this->getPackageBody(); - $decl = implode( "\n\n\n\n", $this->makeProcBodies() ); - return $this->updatePackageContent($src, $decl); - } - - - - /** - * Mise à jour du contenu d'un package (déclaration ou corps) - * - * @param string $packageSource - * @param string $newContent - * @return string - */ - protected function updatePackageContent( $packageSource, $newContent ) - { - $src = $packageSource; - if (null === $begin = strpos($packageSource, self::AG_BEGIN)) - throw new Exception('Le tag indiquant le début de la zone automatique du package n\'a pas été trouvée'); - - if (null === $end = strpos($packageSource, self::AG_END)) - throw new Exception('Le tag indiquant la fin de la zone automatique du package n\'a pas été trouvée'); - - $src = 'CREATE OR REPLACE ' - . substr( $packageSource, 0, $begin + strlen(self::AG_BEGIN) ) - . "\n\n" . $newContent . "\n\n " - . substr( $packageSource, $end ); - - return $src; - } - - - - /** - * Génère une vue différentielle pour une table donnée - * - * @param string $tableName - * @return string - */ - protected function makeDiffView( $tableName ) - { - // Pour l'annualisation : - $schema = $this->getServiceSchema()->getSchema($tableName); - $joinCond = ''; - $delCond = ''; - $depJoin = ''; - if (array_key_exists(self::ANNEE_COLUMN_NAME, $schema)){ - // Si la table courante est annualisée ... - if ($this->getServiceSchema()->hasColumn('V_DIFF_'.$tableName, self::ANNEE_COLUMN_NAME)){ - // ... et que la source est également annualisée alors concordance nécessaire - $joinCond = ' AND S.'.self::ANNEE_COLUMN_NAME.' = d.'.self::ANNEE_COLUMN_NAME; - } - // destruction ssi dans l'année d'import courante - $delCond = ' AND d.'.self::ANNEE_COLUMN_NAME.' = ose_import.get_current_annee'; - }else{ - // on recherche si la table dépend d'une table qui, elle, serait annualisée - foreach($schema as $columnName => $column){ - /* @var $column \Import\Entity\Schema\Column */ - if (! empty($column->refTableName)){ - $refSchema = $this->getServiceSchema()->getSchema( $column->refTableName ); - if (! empty($refSchema) && array_key_exists(self::ANNEE_COLUMN_NAME, $refSchema)){ - // Oui, la table dépend d'une table annualisée!! - // Donc, on utilise la table référente - $depJoin = "\n LEFT JOIN ".$column->refTableName." rt ON rt.".$column->refColumnName." = d.".$columnName; - // destruction ssi dans l'année d'import courante de la table référente - $delCond = ' AND rt.'.self::ANNEE_COLUMN_NAME.' = ose_import.get_current_annee'; - - break; - /* on stoppe à la première table contenant une année. - * S'il en existe une autre tant pis pour elle, - * les années doivent de toute manière être concordantes entres sources!!! - */ - } - } - } - } - - // on génère ensuite la bonne requête !!! - $cols = $this->getCols($tableName); - $sql = "CREATE OR REPLACE FORCE VIEW OSE.V_DIFF_$tableName AS -select diff.* from (SELECT - COALESCE( D.id, S.id ) id, - COALESCE( S.source_id, D.source_id ) source_id, - COALESCE( S.source_code, D.source_code ) source_code, -CASE - WHEN S.source_code IS NOT NULL AND D.source_code IS NULL THEN 'insert' - WHEN S.source_code IS NOT NULL AND D.source_code IS NOT NULL AND (D.histo_destruction IS NULL OR D.histo_destruction > SYSDATE) THEN 'update' - WHEN S.source_code IS NULL AND D.source_code IS NOT NULL AND (D.histo_destruction IS NULL OR D.histo_destruction > SYSDATE)$delCond THEN 'delete' - WHEN S.source_code IS NOT NULL AND D.source_code IS NOT NULL AND D.histo_destruction IS NOT NULL AND D.histo_destruction <= SYSDATE THEN 'undelete' END import_action, - ".$this->formatColQuery($cols, ' CASE WHEN S.source_code IS NULL AND D.source_code IS NOT NULL THEN D.:column ELSE S.:column END :column', ",\n ").", - ".$this->formatColQuery($cols, ' CASE WHEN D.:column <> S.:column OR (D.:column IS NULL AND S.:column IS NOT NULL) OR (D.:column IS NOT NULL AND S.:column IS NULL) THEN 1 ELSE 0 END U_:column',",\n " ). " -FROM - $tableName D$depJoin - FULL JOIN SRC_$tableName S ON S.source_id = D.source_id AND S.source_code = D.source_code$joinCond -WHERE - (S.source_code IS NOT NULL AND D.source_code IS NOT NULL AND D.histo_destruction IS NOT NULL AND D.histo_destruction <= SYSDATE) - OR (S.source_code IS NULL AND D.source_code IS NOT NULL AND (D.histo_destruction IS NULL OR D.histo_destruction > SYSDATE)) - OR (S.source_code IS NOT NULL AND D.source_code IS NULL) - OR ".$this->formatColQuery($cols, 'D.:column <> S.:column OR (D.:column IS NULL AND S.:column IS NOT NULL) OR (D.:column IS NOT NULL AND S.:column IS NULL)',"\n OR ")." -) diff JOIN source on source.id = diff.source_id WHERE import_action IS NOT NULL AND source.importable = 1"; - return $sql; - } - - - - /** - * Génère une déclaration de procédure pour une table donnée - * - * @param string $tableName - * @return string - */ - protected function makeProcDeclaration( $tableName ) - { - return " PROCEDURE MAJ_$tableName(SQL_CRITERION CLOB DEFAULT '', IGNORE_UPD_COLS CLOB DEFAULT '');"; - } - - - - /** - * Génère un corps de procédure pour une table donnée - * - * @param string $tableName - * @return string - */ - protected function makeProcBody( $tableName ) - { - $cols = $this->getCols($tableName); - - $sql = " PROCEDURE MAJ_$tableName(SQL_CRITERION CLOB DEFAULT '', IGNORE_UPD_COLS CLOB DEFAULT '') IS - TYPE r_cursor IS REF CURSOR; - sql_query CLOB; - diff_cur r_cursor; - diff_row V_DIFF_$tableName%ROWTYPE; - BEGIN - sql_query := 'SELECT V_DIFF_$tableName.* FROM V_DIFF_$tableName ' || get_sql_criterion('$tableName',SQL_CRITERION); - OPEN diff_cur FOR sql_query; - LOOP - FETCH diff_cur INTO diff_row; EXIT WHEN diff_cur%NOTFOUND; - BEGIN - - CASE diff_row.import_action - WHEN 'insert' THEN - INSERT INTO OSE.$tableName - ( id, ".$this->formatColQuery($cols).", source_id, source_code, histo_createur_id, histo_modificateur_id ) - VALUES - ( COALESCE(diff_row.id,$tableName"."_ID_SEQ.NEXTVAL), ".$this->formatColQuery($cols,'diff_row.:column').", diff_row.source_id, diff_row.source_code, get_current_user, get_current_user ); - - WHEN 'update' THEN - ".$this->formatColQuery( - $cols, - "IF (diff_row.u_:column = 1 AND IN_COLUMN_LIST(':column',IGNORE_UPD_COLS) = 0) THEN UPDATE OSE.$tableName SET :column = diff_row.:column WHERE ID = diff_row.id; END IF;" - ,"\n " - )." - - WHEN 'delete' THEN - UPDATE OSE.$tableName SET histo_destruction = SYSDATE, histo_destructeur_id = get_current_user WHERE ID = diff_row.id; - - WHEN 'undelete' THEN - ".$this->formatColQuery( - $cols, - "IF (diff_row.u_:column = 1 AND IN_COLUMN_LIST(':column',IGNORE_UPD_COLS) = 0) THEN UPDATE OSE.$tableName SET :column = diff_row.:column WHERE ID = diff_row.id; END IF;" - ,"\n " - )." - UPDATE OSE.$tableName SET histo_destruction = NULL, histo_destructeur_id = NULL WHERE ID = diff_row.id; - - END CASE; - - EXCEPTION WHEN OTHERS THEN - OSE_IMPORT.SYNC_LOG( SQLERRM, '$tableName', diff_row.source_code ); - END; - END LOOP; - CLOSE diff_cur; - - END MAJ_$tableName;"; - return $sql; - } - - - - /** - * Retourne une chaîne SQL correspondant, pour chaque colonne donnée, au résultat du formatage donné, - * concaténé selon le séparateur transmis. - * - * L'opérateur $c permet de situer l'endroit où devont être placées les colonnes. - * - * @param array $cols - * @param string $format - * @param string $separator - * @return string - */ - protected function formatColQuery( array $cols, $format=':column', $separator=',' ) - { - $res = []; - foreach( $cols as $col ){ - $res[] = str_replace( ':column', $col, $format ); - } - return implode( $separator, $res ); - } - - - /** - * @return Schema - */ - protected function getServiceSchema() - { - return $this->getServiceManager()->get('importServiceSchema'); - } -} \ No newline at end of file diff --git a/module/Import/src/Import/Service/Schema.php b/module/Import/src/Import/Service/Schema.php deleted file mode 100644 index 4fb88d1b980789e397963cd6af295ef335505e5e..0000000000000000000000000000000000000000 --- a/module/Import/src/Import/Service/Schema.php +++ /dev/null @@ -1,146 +0,0 @@ -<?php -namespace Import\Service; - -use Import\Exception\Exception; -use Import\Entity\Schema\Column; - -/** - * - * - * @author Laurent LÉCLUSE <laurent.lecluse at unicaen.fr> - */ -class Schema extends Service -{ - /** - * Schéma - * - * @var array - */ - protected $schema; - - - - - - /** - * Retourne le schéma de la BDD - * - * @return array - */ - public function getSchema( $tableName=null ) - { - if (empty($this->schema)){ - $this->schema = $this->makeSchema(); - } - if (empty($tableName)){ - return $this->schema; - }elseif(array_key_exists($tableName, $this->schema)){ - return $this->schema[$tableName]; - }else{ - return null; - } - } - - - - /** - * @return Column[][] - */ - public function makeSchema() - { - $sql = 'SELECT * FROM V_IMPORT_TAB_COLS'; - $d = $this->query( $sql, [] ); - - $sc = []; - foreach( $d as $col ){ - $column = new Column; - $column->dataType = $col['DATA_TYPE']; - $column->length = (null === $col['LENGTH']) ? null : (integer)$col['LENGTH']; - $column->nullable = $col['NULLABLE'] == '1'; - $column->hasDefault = $col['HAS_DEFAULT'] == '1'; - $column->refTableName = $col['C_TABLE_NAME']; - $column->refColumnName = $col['C_COLUMN_NAME']; - $column->importActif = $col['IMPORT_ACTIF'] == '1'; - $sc[$col['TABLE_NAME']][$col['COLUMN_NAME']] = $column; - } - return $sc; - } - - - - /** - * retourne la liste des tables supportées par l'import automatique - * - * @return array - */ - public function getImportTables() - { - $sql = "SELECT SUBSTR(name,5) as TABLE_NAME FROM ( - SELECT mview_name AS name FROM USER_MVIEWS - UNION SELECT view_name AS name FROM USER_VIEWS - UNION SELECT TABLE_NAME AS name FROM USER_TABLES - ) t JOIN user_tables ut ON (ut.table_name = SUBSTR(name,5)) - WHERE name LIKE 'SRC_%'"; - return $this->query( $sql, [], 'TABLE_NAME'); - } - - /** - * Retourne la liste des tables ayant des vues matérialisées - * - * @return string[] - */ - public function getImportMviews() - { - $sql = "SELECT mview_name FROM USER_MVIEWS WHERE mview_name LIKE 'MV_%'"; - $stmt = $this->getEntityManager()->getConnection()->query($sql); - $mviews = []; - while ($d = $stmt->fetch()){ - $mvn = substr( $d['MVIEW_NAME'], 3 ); - $mviews[] = $mvn; - } - return $mviews; - } - - /** - * - * @param string $tableName - * @param string $columnName - */ - public function hasColumn( $tableName, $columnName ) - { - $sql = " - SELECT - COUNT(*) result - FROM - USER_TAB_COLS utc - WHERE - utc.table_name = :tableName - AND utc.column_name = :columnName - "; - $result = $this->query( $sql, compact('tableName', 'columnName'), 'RESULT'); - return $result[0] === '1'; - } - - /** - * Retourne les colonnes concernées par l'import pour une table donnée - */ - public function getImportCols( $tableName ) - { - $sql = " - SELECT - utc.COLUMN_NAME - FROM - USER_TAB_COLS utc - JOIN ALL_TAB_COLS atc ON (atc.table_name = 'SRC_' || utc.table_name AND atc.column_name = utc.column_name) - WHERE - utc.COLUMN_NAME NOT IN ('ID') - AND utc.COLUMN_NAME NOT LIKE 'HISTO_%' - AND utc.COLUMN_NAME NOT LIKE 'SOURCE_%' - AND utc.table_name = :tableName - ORDER BY - utc.COLUMN_NAME"; - - return $this->query( $sql, ['tableName' => $tableName], 'COLUMN_NAME'); - } - -} \ No newline at end of file diff --git a/module/Import/src/Import/Service/Service.php b/module/Import/src/Import/Service/Service.php deleted file mode 100644 index 326c41f8fd01e4602d7ec51853b30ccca7bff9a4..0000000000000000000000000000000000000000 --- a/module/Import/src/Import/Service/Service.php +++ /dev/null @@ -1,178 +0,0 @@ -<?php - -namespace Import\Service; - -use Doctrine\ORM\EntityManager; -use Zend\ServiceManager\ServiceManager; -use Zend\ServiceManager\ServiceManagerAwareInterface; -use Import\Exception\Exception; -use ZfcUser\Entity\UserInterface; -use UnicaenAuth\Service\DbUserAwareInterface; -use Application\Entity\Db\Utilisateur; - -/** - * Classe mère des services - * - * @author Laurent Lécluse <laurent.lecluse at unicaen.fr> - */ -class Service implements ServiceManagerAwareInterface, DbUserAwareInterface { - - /** - * @var ServiceManager - */ - protected $serviceManager; - - /** - * utilisateur courant - * - * @var UserInterface - */ - protected $currentUser; - - /** - * @var EntityManager - */ - protected $entityManager; - - - - /** - * Echappe une chaîne de caractères pour convertir en SQL - * - * @param string $string - * @return string - */ - public static function escapeKW($string) - { - return '"'.str_replace( '"', '""', strtoupper($string) ).'"'; - } - - /** - * Echappe une valeur pour convertir en SQL - * - * @param mixed $value - * @return string - */ - public static function escape($value) - { - if (null === $value) return 'NULL'; - switch( gettype($value)){ - case 'string': return "'".str_replace( "'", "''", $value )."'"; - case 'integer': return (string)$value; - case 'boolean': return $value ? '1' : '0'; - case 'double': return (string)$value; - case 'array': return '('.implode(',',array_map('Import\Service\Service::escape', $value)).')'; - } - throw new Exception('La valeur transmise ne peut pas être convertie en SQL'); - } - - /** - * Retourne le code SQL correspondant à la valeur transmise, précédé de "=", "IS" ou "IN" suivant le contexte. - * - * @param mixed $value - * @return string - */ - public static function equals($value) - { - if (null === $value) $eq = ' IS '; - elseif (is_array($value)) $eq = ' IN '; - else $eq = ' = '; - - return $eq.self::escape($value); - } - - /** - * Retourne une tableau des résultats de la requête transmise. - * - * - * @param string $sql - * @param array $params - * @param string $colRes - * @return array - */ - protected function query( $sql, $params=null, $colRes=null ) - { - $stmt = $this->getEntityManager()->getConnection()->executeQuery( $sql, $params ); - $result = []; - while($r = $stmt->fetch()){ - if (empty($colRes)) $result[] = $r; else $result[] = $r[$colRes]; - } - return $result; - } - - /** - * exécute un ordre SQL - * - * @param string $sql - * @return integer - */ - protected function exec( $sql ) - { - return $this->getEntityManager()->getConnection()->exec($sql); - } - - /** - * Retourne le gestionnaire d'entités Doctrine - * - * @return EntityManager - */ - public function getEntityManager() - { - if (empty($this->entityManager)) - $this->entityManager = $this->getServiceManager()->get('Doctrine\ORM\EntityManager'); - return $this->entityManager; - } - - /** - * Get service manager - * - * @return ServiceManager - */ - public function getServiceManager() - { - return $this->serviceManager; - } - - /** - * Set service manager - * - * @param ServiceManager $serviceManager - * @return self - */ - public function setServiceManager(ServiceManager $serviceManager) - { - $this->serviceManager = $serviceManager; - return $this; - } - - /** - * - * @return UserInterface - */ - public function getDbUser() - { - if (null === $this->currentUser) { - $this->currentUser = $this->getAppDbUser(); - } - return $this->currentUser; - } - - /** - * Set Current User - * - * @param UserInterface $currentUser - */ - public function setDbUser( UserInterface $currentUser ) - { - $this->currentUser = $currentUser; - } - - /** - * - * @return UserInterface - */ - public function getAppDbUser() - { - return $this->getEntityManager()->find(\Application\Entity\Db\Utilisateur::class, Utilisateur::APP_UTILISATEUR_ID); - } -} \ No newline at end of file diff --git a/module/Import/src/Import/View/Helper/DifferentielLigne/DifferentielLigne.php b/module/Import/src/Import/View/Helper/DifferentielLigne/DifferentielLigne.php deleted file mode 100644 index b8c3f00efc1b50ffc11a1209074f0615f4c8a93b..0000000000000000000000000000000000000000 --- a/module/Import/src/Import/View/Helper/DifferentielLigne/DifferentielLigne.php +++ /dev/null @@ -1,175 +0,0 @@ -<?php -namespace Import\View\Helper\DifferentielLigne; - -use Zend\View\Helper\AbstractHelper; -use Import\Entity\Differentiel\Ligne; -use Zend\ServiceManager\ServiceLocatorAwareInterface; -use Zend\ServiceManager\ServiceLocatorAwareTrait; - -/** - * Aide de vue permettant d'afficher une ligne de différentiel d'import - * - * @author Laurent LÉCLUSE <laurent.lecluse at unicaen.fr> - */ -class DifferentielLigne extends AbstractHelper implements ServiceLocatorAwareInterface -{ - use ServiceLocatorAwareTrait; - - /** - * @var Ligne - */ - protected $ligne; - - /** - * Helper entry point. - * - * @return self - */ - final public function __invoke( Ligne $ligne) - { - $filter = new \Zend\Filter\Word\UnderscoreToCamelCase; - $helperClass = __NAMESPACE__.'\\'.$filter->filter(strtolower($ligne->getTableName())); - - if (class_exists($helperClass)){ - $helperObject = new $helperClass; - $helperObject->setServiceLocator( $this->getServiceLocator() ); // transmission du serviceLocator - $helperObject->setLigne($ligne); - $helperObject->setView( $this->getView() ); - return $helperObject; - }else{ - $this->setLigne($ligne); - return $this; - } - } - - /** - * Retourne le code HTML généré par cette aide de vue. - * - * @return string - */ - public function __toString() - { - return $this->render(); - } - - /** - * Génère le code HTML. - * - * @return string - */ - protected function render(){ - $out = $this->getType().' '.$this->getSujet().' '.$this->getAction().' depuis '.$this->getSource().'<br />'; - $details = $this->getDetails(); - if (! empty($details)) $out .= 'Détails : '.implode( ', ', $details ).''; - return (string)$this->getView()->messenger()->setMessage($out, \UnicaenApp\View\Helper\Messenger::WARNING); - } - - /** - * Retourne le type de ligne (en fonction du nom de la table) - * - * @return string - */ - public function getType() - { - $type = ucwords(str_replace( '_', ' ', strtolower($this->ligne->getTableName()))); - return $type; - } - - /** - * Retourne le sujet de la ligne - * - * @return string - */ - public function getSujet() - { - return 'Code initial : '.$this->ligne->getSourceCode(); - } - - /** - * Retourne l'action à effectuer pour que la mise à jour s'effectue - * - * @return string - */ - public function getAction() - { - switch ($this->ligne->getAction()){ - case 'insert' : return 'à importer'; - case 'update' : return 'à mettre à jour'; - case 'delete' : return 'à supprimer'; - case 'undelete' : return 'à restaurer'; - } - return 'Action non définie'; - } - - /** - * Retourne les détails de l'action à effectuer - * - * @return string[] - */ - public function getDetails() - { - $details = []; - if ('update' == $this->ligne->getAction()){ - $changes = $this->ligne->getChanges(); - foreach( $changes as $column => $value ){ - $columnDetails = $this->getColumnDetails( $column, $value ); - if ($columnDetails) $details[] = $columnDetails; - } - } - return $details; - } - - public function getColumnDetails($column, $value) - { - switch( $column ){ - case 'VALIDITE_DEBUT': - if ($value){ - $date = new \DateTime($value); - return 'valide depuis le '.$date->format('d/m/Y'); - }else{ - return 'valide depuis toujours'; - } - case 'VALIDITE_FIN': - if ($value){ - $date = new \DateTime($value); - return 'valide jusqu\'au '.$date->format('d/m/Y'); - }else{ - return 'valide pour toujours'; - } - default: - $column = str_replace( '_', ' ', strtolower($column)); - return $column.' devient '.$value; - } - } - - /** - * Retourne la source de données - * - * @return string - */ - public function getSource() - { - return $this->ligne->getSource()->getLibelle(); - } - - /** - * - * @return Ligne - */ - public function getLigne() - { - return $this->ligne; - } - - /** - * - * @param Ligne $ligne - * @return DifferentielLigne - */ - public function setLigne(Ligne $ligne) - { - $this->ligne = $ligne; - return $this; - } - -} \ No newline at end of file diff --git a/module/Import/src/Import/View/Helper/DifferentielListe.php b/module/Import/src/Import/View/Helper/DifferentielListe.php deleted file mode 100644 index 638b16f830b2c3021f076981396412da6d7dcc0f..0000000000000000000000000000000000000000 --- a/module/Import/src/Import/View/Helper/DifferentielListe.php +++ /dev/null @@ -1,122 +0,0 @@ -<?php -namespace Import\View\Helper; - -use Zend\View\Helper\AbstractHelper; -use Import\Service\Differentiel; -use Import\Entity\Differentiel\Ligne; -use Import\Exception\Exception; -use Import\View\Helper\DifferentielLigne\DifferentielLigne; - -/** - * Aide de vue permettant d'afficher une liste de données différentielles - * - * @author Laurent LÉCLUSE <laurent.lecluse at unicaen.fr> - */ -class DifferentielListe extends AbstractHelper -{ - /** - * Lignes de différentiel - * - * @var Ligne[] - */ - protected $lignes; - - - - - - /** - * Helper entry point. - * - * @param Ligne[]|Differentiel $lignes - * @return self - */ - final public function __invoke( $lignes ) - { - $this->setLignes($lignes); - return $this; - } - - /** - * Retourne le code HTML généré par cette aide de vue. - * - * @return string - */ - public function __toString() - { - return $this->render(); - } - - /** - * Génère le code HTML. - * - * @return string - */ - public function render(){ - $aucunEcart = 'Il n\'y a aucun écart entre les sources de données et OSE'; - if (empty($this->lignes)) return $aucunEcart; - $out = ''; - foreach( $this->lignes as $ligne ){ - $dl = $this->getView()->differentielLigne( $ligne ); - if ($ligne->getAction() != 'update' || $dl->getDetails()){ - $out .= '<tr>' - .'<td>'.$dl->getType().'</td>' - .'<td>'.$dl->getSujet().'</td>' - .'<td>'.ucfirst($dl->getAction()).'</td>' - .'<td>'.$dl->getSource().'</td>' - .'<td>'.ucfirst(implode( ', ', $dl->getDetails() )).'</td>' - .'</tr>'."\n"; - } - } - if ($out){ - $out = '<table class="table">'."\n" - .'<tr><th>Type</th><th>Sujet</th><th>Action</th><th>Source</th><th>Détails</th></tr>' - .$out - .'</table>'."\n"; - }else{ - return $aucunEcart; - } - return $out; - } - - /** - * Retourne la liste des lignes - * - * @return Ligne[] - */ - public function getLignes() - { - return $this->lignes; - } - - public function addLigne( Ligne $ligne ) - { - $this->lignes[] = $ligne; - } - - /** - * - * - * @param Ligne[]|Differentiel $lignes - * @return DifferentielLigne - */ - public function setLignes($lignes) - { - $this->lignes = []; - if( $lignes instanceof Differentiel ){ - while( $ligne = $lignes->fetchNext() ){ - $this->addLigne($ligne); - } - }elseif(is_array($lignes)){ - foreach( $lignes as $ligne ){ - if (! $ligne instanceof Ligne){ - throw new Exception('La ligne de différentiel transmise n\'est pas au bon format.'); - } - $this->addLigne( $ligne ); - } - } - return $this; - } - - -} \ No newline at end of file diff --git a/module/Import/view/import/import/config.phtml b/module/Import/view/import/import/config.phtml deleted file mode 100644 index e812886068d748ae429b18269e3d716bc2ea523e..0000000000000000000000000000000000000000 --- a/module/Import/view/import/import/config.phtml +++ /dev/null @@ -1,3 +0,0 @@ -<h1>OSE : Import de données</h1> - -TEST CONFIG = <?php echo $test ?> \ No newline at end of file diff --git a/module/Import/view/import/import/index.phtml b/module/Import/view/import/import/index.phtml deleted file mode 100644 index 493009d3a3e19b260607590ab6e6f6aca4417e05..0000000000000000000000000000000000000000 --- a/module/Import/view/import/import/index.phtml +++ /dev/null @@ -1,10 +0,0 @@ -<?php - -$this->headTitle()->append("Import de données"); - -?> -<h1 class="page-header">Import de données</h1> - -<?php - -echo $this->navigation('navigation')->menuContextuel()->setPartial('application/menu-dl.phtml'); \ No newline at end of file diff --git a/module/Import/view/import/import/show-diff.phtml b/module/Import/view/import/import/show-diff.phtml deleted file mode 100644 index 0dc7190e00c6e3f9001685413c1e4ec44a81a6ac..0000000000000000000000000000000000000000 --- a/module/Import/view/import/import/show-diff.phtml +++ /dev/null @@ -1,56 +0,0 @@ -<?php - -use Application\Provider\Privilege\Privileges; - -?> -<h1>Écarts entre l'application et ses sources</h1> - -<?php foreach( $data as $table => $lignes ): - $tableLabel = ucwords(str_replace( '_', ' ', strtolower($table))); -?> -<h2><?php echo $tableLabel ?></h2> -<div id="DIV_<?php echo $table ?>" data-url="<?php echo $this->url('import', ['action' => 'update','table' => $table]) ?>"> -<?php echo $this->differentielListe( $lignes )->render(); ?> - -<?php if (count($lignes) > 100) : ?> -<div>Toutes les lignes n'ont pas été affichées, leur nombre dépassant 100</div> -<?php endif; ?> - -<?php if ($this->isAllowed(Privileges::getResourceId(Privileges::IMPORT_MAJ))): ?> -<div> -<?php if (in_array($table, $mviews)): ?> - <a class="import-update-mv" href="javascript:void(0)" data-table="<?php echo $table ?>"> - <span class="glyphicon glyphicon-refresh"></span> - Mettre à jour la vue matérialisée - </a> -<?php endif; ?> -<?php if (count($lignes) > 0) : ?> - <a class="import-update" href="javascript:void(0)" data-table="<?php echo $table ?>"> - <span class="glyphicon glyphicon-refresh"></span> - Mettre à jour les données - </a> -<?php endif; ?> -</div> -<div class="alert alert-info" role="alert" id="DIV_WAIT_<?php echo $table ?>" style="display:none"> - <span class="loading" style="padding-right:1em"> </span> - Traitement en cours, merci de patienter. L'opération peut prendre jusqu'à plusieurs minutes. -</div> -<?php endif; ?> -</div> -<?php endforeach; ?> - -<script> - $(function() { - - $("body").on("click", "a.import-update-mv", function(e) { - $( "#DIV_WAIT_"+$(this).data('table') ).show(); - $( "#DIV_"+$(this).data('table') ).refresh({'type-maj': 'vue-materialisee'}); - }); - - $("body").on("click", "a.import-update", function(e) { - $( "#DIV_WAIT_"+$(this).data('table') ).show(); - $( "#DIV_"+$(this).data('table') ).refresh({'type-maj': 'donnees'}); - }); - - }); -</script> \ No newline at end of file diff --git a/module/Import/view/import/import/show-import-tbl.phtml b/module/Import/view/import/import/show-import-tbl.phtml deleted file mode 100644 index 6642a4067f387b127f5819aec494c5192b9f11f6..0000000000000000000000000000000000000000 --- a/module/Import/view/import/import/show-import-tbl.phtml +++ /dev/null @@ -1,33 +0,0 @@ - -<h1>Tableau de bord principal</h1> - -<?php foreach( $data as $tname => $columns ): ?> - <h2><?php echo $tname ?></h2> - <table class="table table-striped table-bordered table-hover"> - <tr> - <th>Colonne</th> - <th>Type</th> - <th>Longueur</th> - <th>Nullable</th> - <th>Val. par défaut</th> - <th>Table de réf.</th> - <th>Colonne de réf.</th> - <th>Import actif</th> - </tr> - <?php foreach( $columns as $cname => $column ): ?> - <tr class="<?php - if (! $column->importActif && ! $column->hasDefault && ! $column->nullable) echo 'danger'; - elseif (! $column->importActif) echo 'warning'; - ?>"> - <th><?php echo $cname ?></th> - <td><?php echo $column->dataType ?></td> - <td style="text-align:center"><?php echo $column->length ?></td> - <td style="text-align:center"><?php echo $column->nullable ? '<span class="glyphicon glyphicon-ok"></span>' : '' ?></td> - <td style="text-align:center"><?php echo $column->hasDefault ? '<span class="glyphicon glyphicon-ok"></span>' : '' ?></td> - <td><?php echo $column->refTableName ?></td> - <td><?php echo $column->refColumnName ?></td> - <td style="text-align:center"><?php echo $column->importActif ? '<span class="glyphicon glyphicon-ok"></span>' : '' ?></td> - </tr> - <?php endforeach; ?> - </table> -<?php endforeach; ?> diff --git a/module/Import/view/import/import/update-materialized-view.php b/module/Import/view/import/import/update-materialized-view.php deleted file mode 100644 index 3ac00faa65fb817ea29da4755b6c823685234399..0000000000000000000000000000000000000000 --- a/module/Import/view/import/import/update-materialized-view.php +++ /dev/null @@ -1,8 +0,0 @@ -<?php - -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - diff --git a/module/Import/view/import/import/update-tables.phtml b/module/Import/view/import/import/update-tables.phtml deleted file mode 100644 index f85e95b8ac2e74325539cfa7418341bec03caf9c..0000000000000000000000000000000000000000 --- a/module/Import/view/import/import/update-tables.phtml +++ /dev/null @@ -1 +0,0 @@ -<?php echo $this->messenger()->setMessage($message, \UnicaenApp\View\Helper\Messenger::SUCCESS); ?> \ No newline at end of file diff --git a/module/Import/view/import/import/update-views-and-packages.phtml b/module/Import/view/import/import/update-views-and-packages.phtml deleted file mode 100644 index f85e95b8ac2e74325539cfa7418341bec03caf9c..0000000000000000000000000000000000000000 --- a/module/Import/view/import/import/update-views-and-packages.phtml +++ /dev/null @@ -1 +0,0 @@ -<?php echo $this->messenger()->setMessage($message, \UnicaenApp\View\Helper\Messenger::SUCCESS); ?> \ No newline at end of file diff --git a/module/Import/view/import/import/update.phtml b/module/Import/view/import/import/update.phtml deleted file mode 100644 index 8247233c0783bd4a8f135c90512fdff7e2f08aee..0000000000000000000000000000000000000000 --- a/module/Import/view/import/import/update.phtml +++ /dev/null @@ -1,28 +0,0 @@ -<?php echo $this->differentielListe( $lignes ); ?> -<?php if (count($lignes) > 100) : ?> -<div>Toutes les lignes n'ont pas été affichées, leur nombre dépassant 100</div> -<?php endif; ?> - -<div> - <a class="import-update-mv" href="javascript:void(0)" data-table="<?php echo $table ?>"> - <span class="glyphicon glyphicon-refresh"></span> - Mettre à jour la vue matérialisée - </a> -<?php if (count($lignes) > 0) : ?> - <a class="import-update" href="javascript:void(0)" data-table="<?php echo $table ?>"> - <span class="glyphicon glyphicon-refresh"></span> - Mettre à jour les données - </a> -<?php endif; ?> -</div> -<div class="alert alert-info" role="alert" id="DIV_WAIT_<?php echo $table ?>" style="display:none"> - <span class="loading" style="padding-right:1em"> </span> - Traitement en cours, merci de patienter. L'opération peut prendre jusqu'à plusieurs minutes. -</div> -<?php - -if ($errors){ - echo $this->messenger()->setMessages([UnicaenApp\View\Helper\Messenger::ERROR => $errors]); -}else{ - echo $this->messenger()->setMessages([UnicaenApp\View\Helper\Messenger::SUCCESS => ['Action réalisée avec succès']]); -} \ No newline at end of file diff --git a/public/js/app.js b/public/js/app.js index 6b1758eeccd503800115352636fd327ecc596983..40dee4fc9000fcb875a3a7f21b50496cf27cc426 100755 --- a/public/js/app.js +++ b/public/js/app.js @@ -53,11 +53,11 @@ Util = { heures = Math.round(heures * 100) / 100; var parts = heures.toString().split("."); if (undefined === parts[1]) { - parts[1] = '<span class="heures-dec-00">,00</span>'; + parts[1] = '<span class="number-dec-00">,00</span>'; } else { parts[1] = ',' + parts[1]; } - return '<span class="heures heures-' + hclass + '">' + parts[0] + parts[1] + '</span>'; + return '<span class="number number-' + hclass + '">' + parts[0] + parts[1] + '</span>'; }, json: { diff --git a/public/js/service.js b/public/js/service.js index cbb7705944ba9deabd13ff197e444175da206912..a069eb26ca5e7054607fa3c86f68864bd2366cee 100644 --- a/public/js/service.js +++ b/public/js/service.js @@ -3,60 +3,61 @@ /***************************************************************************************************************************************************/ $.widget("ose.serviceListe", { + totaux: {}, + total: 0, showHideTypesIntervention: function () { - var that = this; - - // initialisation des visibilités : tout masqué par défaut - for (var i in this.params["types-intervention-visibility"]) { // initialisation - this.params["types-intervention-visibility"][i] = false; + var count = 0; + for (var i in this.totaux) { + if (this.totaux[i] != 0) { + count++; + this.element.find("table.service tr th." + i).show(); // entête + this.element.find("table.service tr.service-ligne td.type-intervention." + i).show(); + this.element.find("table.service tfoot tr td." + i).show(); // total + } else { + this.element.find("table.service tr th." + i).hide(); // entête + this.element.find("table.service tr.service-ligne td.type-intervention." + i).hide(); + this.element.find("table.service tfoot tr td." + i).hide(); // total + } + } + this.element.find("table.service #total-general").attr('colspan', count); + if (count == 0) { + this.element.find("table.service tfoot").hide(); + } else { + this.element.find("table.service tfoot").show(); } + }, - // on détecte les types (par leur code) qui ne doivent plus être masqués et on en profite pour mettre à jour les paramètres - this.element.find("table.service tr.service-ligne td.type-intervention").each(function () - { - var typeInterventionCode = $(this).data('type-intervention-code'); - var visibility = '1' == $(this).data('visibility'); - if (visibility) { - that.params["types-intervention-visibility"][typeInterventionCode] = true; - } - }); - // on applique la visilibité fraichement calculées sur les colonnes + calculTotaux: function () + { + var that = this; + this.totaux = {}; + this.total = 0; + this.element.find("table.service tr.service-ligne td.type-intervention").each(function () { var typeInterventionCode = $(this).data('type-intervention-code'); - var visibility = that.params["types-intervention-visibility"][typeInterventionCode]; + var value = $(this).data('value'); - if (visibility) { - $(this).show(200); - } else { - $(this).hide(200); - } + if (that.totaux[typeInterventionCode] == undefined) that.totaux[typeInterventionCode] = 0; + + that.totaux[typeInterventionCode] += value; + that.total += value; }); // on met à jour aussi les entêtes et les totaux - var count = 0; - for (var i in this.params["types-intervention-visibility"]) { - if (this.params["types-intervention-visibility"][i]) { - count++; - this.element.find("table.service tr th." + i).show(200); // entête - this.element.find("table.service tfoot tr td." + i).show(200); // total - } else { - this.element.find("table.service tr th." + i).hide(200); // entête - this.element.find("table.service tfoot tr td." + i).hide(200); // total - } - } - this.element.find("table.service #total-general").attr('colspan', count); - if (count == 0) { - this.element.find("table.service tfoot").hide(); - } else { - this.element.find("table.service tfoot").show(); + for (var ti in this.totaux) { + var heures = this.totaux[ti]; + this.element.find("table.service tfoot tr td." + ti).html(Util.formattedHeures(heures)); } + this.element.find("table.service #total-general").html(Util.formattedHeures(this.total)); }, + + showHideDetails: function (serviceId, action) { var tr = this.element.find("#service-" + serviceId + "-volume-horaire-tr"); @@ -99,29 +100,36 @@ $.widget("ose.serviceListe", { }); }, + + + hasHeures: function () + { + return this.total > 0; + }, + + + onAfterChange: function () { - var that = this; + var exHasHeures = this.hasHeures(); + var exHeures = this.total; this.init2(); - this.element.find("tfoot").refresh({params: this.params}, function () - { - that.showHideTypesIntervention(); - }); // rafraichissement des totaux - - // autres modifications... - $("#formule-totaux-hetd").refresh({}, function () - { - that.showHideTypesIntervention(); - }); + this.showHideTypesIntervention(); + if (this.hasHeures() !== exHasHeures) { + this._trigger('heures-change-exists', null, this); + } + if (this.heures != exHeures){ + this._trigger('heures-change', null, this); + } if ($("#service-resume").length > 0) { // Si on est dans le résumé (si nécessaire) $("#service-resume").refresh(); } - $("#wf-nav-next").refresh(); // mise à jour de la navigation du Workflow - $("#s-horodatage").refresh(); }, + + onAfterSaisie: function (serviceId) { var that = this; @@ -217,9 +225,10 @@ $.widget("ose.serviceListe", { $(this).show(); } }); + this.calculTotaux(); }, - _create: function() + _create: function () { var that = this; @@ -288,7 +297,7 @@ $.widget("ose.serviceListe", { }, - getElementPrevuToPrevu : function (){ return this.element.find(".prevu-to-prevu") } + getElementPrevuToPrevu: function () { return this.element.find(".prevu-to-prevu") } }); $(function () diff --git a/tests/OSETest/Entity/Db/Asset.php b/tests/OSETest/Entity/Db/Asset.php index 42fb0cfe99b06aa3a5afa8024e5d3e072878db11..c903bad282f695976caec4e6a03fb5b2699f8e61 100644 --- a/tests/OSETest/Entity/Db/Asset.php +++ b/tests/OSETest/Entity/Db/Asset.php @@ -10,7 +10,6 @@ use Application\Entity\Db\Intervenant; use Application\Entity\Db\IntervenantExterieur; use Application\Entity\Db\IntervenantPermanent; use Application\Entity\Db\RegimeSecu; -use Application\Entity\Db\Source; use Application\Entity\Db\Utilisateur; use Application\Entity\Db\Structure; use Application\Entity\Db\TypeIntervenant; @@ -47,32 +46,7 @@ use DateTime; class Asset { const SOURCE_TEST = 'Test'; - - /** - * @var Source - */ - static protected $source; - - static public function setSource(Source $source) - { - static::$source = $source; - } - - static public function getSource() - { - if (null === static::$source) { - throw new \LogicException("Vous devez spécifier une source par défaut avec " . __CLASS__ . "::setSource()."); - } - return static::$source; - } - - static public function newSource() - { - $e = new Source(); - $e->setLibelle('Source de test'); - - return $e; - } + static public function newUser() { diff --git a/tests/OSETest/Entity/Db/EntityProvider.php b/tests/OSETest/Entity/Db/EntityProvider.php index a88ed6560802befa7f28d220d51b433bb06dc2de..8b96d00b94d649b649397bd6b051d70f7c1996f9 100644 --- a/tests/OSETest/Entity/Db/EntityProvider.php +++ b/tests/OSETest/Entity/Db/EntityProvider.php @@ -6,7 +6,6 @@ use Application\Entity\Db\Civilite; use Application\Entity\Db\Corps; use Application\Entity\Db\Etablissement; use Application\Entity\Db\RegimeSecu; -use Application\Entity\Db\Source; use Application\Entity\Db\Intervenant; use Application\Entity\Db\IntervenantPermanent; use Application\Entity\Db\IntervenantExterieur; @@ -55,11 +54,6 @@ class EntityProvider */ private $newEntities; - /** - * @var Source - */ - private $source; - /** * @var Annee */ @@ -168,7 +162,7 @@ class EntityProvider { $this->setEntityManager($entityManager); - Asset::setSource($this->getSource()); + //Asset::setSource($this->getSource()); // recherche du pseudo-utilisateur OSE if (!($param = $this->getEntityManager()->getRepository("Application\Entity\Db\Parametre")->findOneByNom($nom = 'oseuser'))) { @@ -238,26 +232,6 @@ class EntityProvider } - - - /** - * Recherche et retourne la source de test. - * - * @return Source - */ - public function getSource() - { - if (null === $this->source) { - $this->source = $this->getEntityManager()->getRepository('Application\Entity\Db\Source') - ->findOneBy(['libelle' => "Test"]); - if (!$this->source) { - throw new RuntimeException("Source de test (libelle = Test) introuvable."); - } - } - - return $this->source; - } - /** * Recherche et retourne l'année en cours. *