Commit fb48916d authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Merge branch 'selectionStructureRole'

parents bc2bc7c7 8234f395
Loading
Loading
Loading
Loading
Loading
+4 −0
Changes for module/Application/src/Application/Controller/Factory/UtilisateurControllerFactory.php: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@ use Application\Service\Etablissement\EtablissementService;
use Application\Service\Individu\IndividuServiceLocateTrait;
use Application\Service\Notification\NotifierService;
use Application\Service\Role\RoleService;
use Application\Service\Structure\StructureService;
use Application\Service\UniteRecherche\UniteRechercheService;
use Application\Service\Utilisateur\UtilisateurService;
use Doctrine\ORM\EntityManager;
@@ -27,6 +28,7 @@ class UtilisateurControllerFactory
         * @var EtablissementService $etablissementService
         * @var EcoleDoctoraleService $ecoleService
         * @var UniteRechercheService $uniteService
         * @var StructureService $structureService
         * @var EntityManager $entityManager
         * @var NotifierService $notifierService
         */
@@ -35,6 +37,7 @@ class UtilisateurControllerFactory
        $etablissementService = $sl->get('EtablissementService');
        $ecoleService = $sl->get('EcoleDoctoraleService');
        $uniteService = $sl->get('UniteRechercheService');
        $structureService = $sl->get(StructureService::class);
        $notifierService = $controllerManager->getServiceLocator()->get(NotifierService::class);
        $entityManager = $sl->get('doctrine.entitymanager.orm_default');

@@ -45,6 +48,7 @@ class UtilisateurControllerFactory
        $controller->setUniteRechercheService($uniteService);
        $controller->setEcoleDoctoraleService($ecoleService);
        $controller->setEtablissementService($etablissementService);
        $controller->setStructureService($structureService);
        $controller->setNotifierService($notifierService);
        $controller->setEntityManager($entityManager);

+6 −3
Changes for module/Application/src/Application/Controller/UtilisateurController.php: 6 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ namespace Application\Controller;

use Application\Entity\Db\CreationUtilisateurInfos;
use Application\Entity\Db\Individu;
use Application\Entity\Db\TypeStructure;
use Application\Entity\Db\Utilisateur;
use Application\Filter\EtablissementPrefixFilter;
use Application\Form\CreationUtilisateurForm;
@@ -12,6 +13,7 @@ use Application\Service\Etablissement\EtablissementServiceAwareTrait;
use Application\Service\Individu\IndividuServiceAwareTrait;
use Application\Service\Notification\NotifierServiceAwareTrait;
use Application\Service\Role\RoleServiceAwareTrait;
use Application\Service\Structure\StructureServiceAwareTrait;
use Application\Service\UniteRecherche\UniteRechercheServiceAwareTrait;
use Application\Service\UserContextServiceAwareTrait;
use Application\Service\Utilisateur\UtilisateurService;
@@ -41,6 +43,7 @@ class UtilisateurController extends \UnicaenAuth\Controller\UtilisateurControlle
    use UniteRechercheServiceAwareTrait;
    use EtablissementServiceAwareTrait;
    use NotifierServiceAwareTrait;
    use StructureServiceAwareTrait;

    /**
     * NOTA BENE : il s'agit des individus et non des utilisateurs car ils sont ceux qui portent les rôles
@@ -67,9 +70,9 @@ class UtilisateurController extends \UnicaenAuth\Controller\UtilisateurControlle
        }

        $roles = $this->roleService->getRoles();
        $etablissements = $this->getEtablissementService()->getRepository()->findAll();
        $unites = $this->getUniteRechercheService()->getRepository()->findAll();
        $ecoles = $this->getEcoleDoctoraleService()->getRepository()->findAll();
        $etablissements = $this->getStructureService()->getAllStructuresAffichablesByType(TypeStructure::CODE_ETABLISSEMENT, 'libelle');
        $unites = $this->getStructureService()->getAllStructuresAffichablesByType(TypeStructure::CODE_UNITE_RECHERCHE, 'libelle');
        $ecoles = $this->getStructureService()->getAllStructuresAffichablesByType(TypeStructure::CODE_ECOLE_DOCTORALE, 'libelle');

        return new ViewModel([
            'individu' => $individu,
+3 −0
Changes for module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.UniteRecherche.dcm.xml: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -59,5 +59,8 @@
      </join-table>
    </many-to-many>

    <one-to-many field="theses" target-entity="Application\Entity\Db\These" mapped-by="id" />


  </entity>
</doctrine-mapping>
+11 −1
Changes for module/Application/src/Application/Entity/Db/UniteRecherche.php: 11 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -53,6 +53,10 @@ class UniteRecherche implements StructureConcreteInterface, HistoriqueAwareInter
    /**
     * UniteRecherche constructor.
     */

    /** @var These[] */
    private $theses;

    public function __construct()
    {
        $this->structure = new Structure();
@@ -286,5 +290,11 @@ class UniteRecherche implements StructureConcreteInterface, HistoriqueAwareInter
        return $this;
    }


    /**
     * @return These[]
     */
    public function getTheses()
    {
        return $this->theses;
    }
}
 No newline at end of file
+24 −0
Changes for module/Application/src/Application/Service/Role/RoleService.php: 24 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -221,6 +221,7 @@ class RoleService extends BaseService
        $role->setHistoCreation(new \DateTime());
        $role->setHistoModificateur($userSygal);
        $role->setHistoModification(new \DateTime());
        $role->setOrdreAffichage("zzz");

        $this->getEntityManager()->persist($role);
        $this->getEntityManager()->flush($role);
@@ -275,4 +276,27 @@ class RoleService extends BaseService
//        }
//        return $role;
//    }


    public function getRolesEcolesDoctorales()
    {
        $typeStructureId = 2;

        $qb = $this->getEntityManager()->getRepository(Role::class)->createQueryBuilder('role')
            ->andWhere('role.typeStructureDependant = :typeStructureId')
            ->setParameter('typeStructureId', $typeStructureId)
            ->join('role.structure', 'structure')
            ->leftJoin('structure.structureSubstituante', 'substitutionTo')
            ->andWhere('substitutionTo.id IS NULL');

        $result = $qb->getQuery()->getResult();
        return $result;
    }

//SELECT * FROM ROLE R
//JOIN STRUCTURE S on R.STRUCTURE_ID = S.ID
//LEFT JOIN STRUCTURE_SUBSTIT SS on S.ID = SS.FROM_STRUCTURE_ID
//WHERE TYPE_STRUCTURE_DEPENDANT_ID = 2
//  and SS.TO_STRUCTURE_ID IS NULL

}
 No newline at end of file
Loading