diff --git a/bin/database/src/sql/create_comue.template.sql b/bin/database/src/sql/create_comue.template.sql index ead37876de62f4a61b8306486b8951fc7335f181..c6f74b5e6ea6a6a4e4ff314246b466754b7e0e2b 100644 --- a/bin/database/src/sql/create_comue.template.sql +++ b/bin/database/src/sql/create_comue.template.sql @@ -9,7 +9,8 @@ select nextval('structure_id_seq'), 'COMUE', '{ETAB_COMUE_SIGLE}', --> sigle ou abbréviation à personnaliser '{ETAB_COMUE_LIBELLE}', --> libellé à personnaliser - null, 1, 'COMUE', 1, 1 + 1, 1, 'COMUE', 1, 1 +from type_structure ts where {ETAB_COMUE} = 1 ; diff --git a/module/Application/src/Application/Controller/TableauDeBordController.php b/module/Application/src/Application/Controller/TableauDeBordController.php index 22d154447b62e54298b162a4f0a6635b1f0ff439..7e0a4a40232b3dc31e356aea71e619fa770472bf 100644 --- a/module/Application/src/Application/Controller/TableauDeBordController.php +++ b/module/Application/src/Application/Controller/TableauDeBordController.php @@ -31,7 +31,7 @@ class TableauDeBordController extends AbstractController $source = $this->sourceService->fetchApplicationSource(); $etablissements = $this->getEtablissementService()->getRepository()->findAllBySource($source->getCode()); $etablissements = array_filter($etablissements, function (Etablissement $etablissement) { return count($etablissement->getStructure()->getStructuresSubstituees())==0; }); - $etablissements = array_filter($etablissements, function (Etablissement $etablissement) { return $etablissement->getSigle() != "NU";}); + $etablissements = array_filter($etablissements, function (Etablissement $etablissement) { return $etablissement->getStructure()->getSigle() != "NU";}); return new ViewModel([ 'anomaliesTables' => $anomaliesTables, diff --git a/module/Application/src/Application/Controller/Traits/LogoAwareControllerTrait.php b/module/Application/src/Application/Controller/Traits/LogoAwareControllerTrait.php deleted file mode 100644 index 5a97d840b44247495d47d64bd3d734281b06f5ca..0000000000000000000000000000000000000000 --- a/module/Application/src/Application/Controller/Traits/LogoAwareControllerTrait.php +++ /dev/null @@ -1,69 +0,0 @@ -<?php - -namespace Application\Controller\Traits; - -use Structure\Entity\Db\StructureConcreteInterface; -use Structure\Service\Structure\StructureService; -use UnicaenApp\Exception\RuntimeException; -use Laminas\Mvc\Plugin\FlashMessenger\FlashMessenger; -use Laminas\Mvc\Controller\Plugin\Params; - -/** - * Trait LogoAwareControllerTrait - * - * @method Params params() - * @method FlashMessenger flashMessenger() - * - * @property StructureService $structureService - - * @package Application\Controller\Traits - * - * @deprecated Mis dans StructureConcreteController - */ -trait LogoAwareControllerTrait -{ - /** - * Retire le logo associé à une structure : - * - effacement du chemin en bdd, - * - effacement du fichier stocké sur le serveur. - * - * @param StructureConcreteInterface $structure - */ - public function supprimerLogoStructure(StructureConcreteInterface $structure) - { - try { - $fileDeleted = $this->structureService->deleteLogoStructure($structure); - } catch (RuntimeException $e) { - $this->flashMessenger()->addErrorMessage( - "Erreur lors de l'effacement du logo de la structure '$structure' : " . $e->getMessage()); - return; - } - - if ($fileDeleted) { - $this->flashMessenger()->addSuccessMessage("Le logo de la structure '$structure' vient d'être supprimé."); - } else { - $this->flashMessenger()->addWarningMessage("Aucun logo à supprimer pour la structure '$structure'."); - } - } - - /** - * Ajoute le logo associé à une structure : - * - suppression du précédent logo éventuel, - * - modification du chemin en bdd - * - création du fichier sur le serveur. - * - * @param StructureConcreteInterface $structure - * @param string $cheminLogoUploade chemin vers le fichier temporaire associé au logo - */ - public function ajouterLogoStructure(StructureConcreteInterface $structure, $cheminLogoUploade) - { - try { - $this->structureService->updateLogoStructure($structure, $cheminLogoUploade); - } catch (RuntimeException $e) { - $this->flashMessenger()->addErrorMessage( - "Erreur lors de l'enregistrement du logo de la structure '$structure' : " . $e->getMessage()); - } - - $this->flashMessenger()->addSuccessMessage("Le logo de la structure '$structure' vient d'être ajouté."); - } -} \ No newline at end of file diff --git a/module/Application/src/Application/Navigation/ApplicationNavigationFactory.php b/module/Application/src/Application/Navigation/ApplicationNavigationFactory.php index 6a032548e195bad17d72794f3e18a949dff4affd..f5c10d565aca80307540e2fb3074d4b5398efa75 100644 --- a/module/Application/src/Application/Navigation/ApplicationNavigationFactory.php +++ b/module/Application/src/Application/Navigation/ApplicationNavigationFactory.php @@ -245,7 +245,7 @@ class ApplicationNavigationFactory extends NavigationFactory switch (true) { case $role->isEcoleDoctoraleDependant(): $ed = $role->getStructure()->getEcoleDoctorale(); - $label = $ed->getSigle(); + $label = $ed->getStructure()->getSigle(); $query = [EcoleDoctoraleSearchFilter::NAME => $ed->getSourceCode()]; break; case $role->isUniteRechercheDependant(): diff --git a/module/Application/src/Application/Service/ListeDiffusion/Address/ListeDiffusionAddressGenerator.php b/module/Application/src/Application/Service/ListeDiffusion/Address/ListeDiffusionAddressGenerator.php index ec6cecb08ff470aa73b46e8d8d7945642d8258a7..91abd6a1bfcbf4078a8d9d9c700871a870391434 100644 --- a/module/Application/src/Application/Service/ListeDiffusion/Address/ListeDiffusionAddressGenerator.php +++ b/module/Application/src/Application/Service/ListeDiffusion/Address/ListeDiffusionAddressGenerator.php @@ -128,10 +128,10 @@ class ListeDiffusionAddressGenerator return null; } - Assert::notEmpty($this->ecoleDoctorale->getSigle(), + Assert::notEmpty($this->ecoleDoctorale->getStructure()->getSigle(), "Ecole doctorale n°{$this->ecoleDoctorale->getId()} sans sigle"); - return trim(str_replace(str_split(' -_'), '', $this->ecoleDoctorale->getSigle())); // ex: 'ED590MIIS' + return trim(str_replace(str_split(' -_'), '', $this->ecoleDoctorale->getStructure()->getSigle())); // ex: 'ED590MIIS' } /** diff --git a/module/Application/src/Application/Service/Role/RoleService.php b/module/Application/src/Application/Service/Role/RoleService.php index 1c666b6a608a0f07541a0e2371755acc34d4d2b4..21e3bbec77378f9b47ebb178bbf49125c3644f2f 100644 --- a/module/Application/src/Application/Service/Role/RoleService.php +++ b/module/Application/src/Application/Service/Role/RoleService.php @@ -264,7 +264,7 @@ class RoleService extends BaseService $roleId = $roleModele->getLibelle() . " " . $structure->getStructure()->getCode(); } else { $sourceCode = $this->sourceCodeStringHelper->addDefaultPrefixTo($roleModele->getRoleCode() . "_" . $structure->getSourceCode()); - $roleId = $roleModele->getLibelle() . " " . $structure->getSigle(); + $roleId = $roleModele->getLibelle() . " " . $structure->getStructure()->getSigle(); } $role = $this->createRole($roleModele->getRoleCode(), $roleModele->getLibelle(), $sourceCode); diff --git a/module/Application/view/application/ecole-doctorale/information.phtml b/module/Application/view/application/ecole-doctorale/information.phtml index c7ef6f1d118748b464825ca48d377287eb0f677b..e92aa85f35b43ae94b6db2865841e95fb75818fe 100644 --- a/module/Application/view/application/ecole-doctorale/information.phtml +++ b/module/Application/view/application/ecole-doctorale/information.phtml @@ -31,7 +31,7 @@ $structure = $ecole->getStructure(); ?> <h1 class="page-header"> - École doctorale « <?php echo $ecole->getLibelle(); ?> » + École doctorale « <?php echo $ecole->getStructure()->getLibelle(); ?> » </h1> <?php echo $this->messenger()->addMessagesFromFlashMessengerWithNoNamespace() ?> @@ -89,9 +89,9 @@ $structure = $ecole->getStructure(); <div class="col-md-6"> <dl> <dt> Libelle :</dt> - <dd> <?php echo $ecole->getLibelle(); ?> </dd> + <dd> <?php echo $ecole->getStructure()->getLibelle(); ?> </dd> <dt> Sigle :</dt> - <dd> <?php echo $ecole->getSigle(); ?> </dd> + <dd> <?php echo $ecole->getStructure()->getSigle(); ?> </dd> <dt> Code :</dt> <dd> <?php echo $ecole->getStructure()->getCode(); ?> </dd> <dt> Id REF :</dt> diff --git a/module/Application/view/application/index/partial/soutenances.phtml b/module/Application/view/application/index/partial/soutenances.phtml index 1d95e0ce5827f7d76f72ca14abf47a9c5aac78e3..b2d8bb4f9491b10789fcf126d9b53196af2933cc 100644 --- a/module/Application/view/application/index/partial/soutenances.phtml +++ b/module/Application/view/application/index/partial/soutenances.phtml @@ -13,7 +13,7 @@ use Structure\Entity\Db\EcoleDoctorale; <li> <a href="<?php echo $this->url('soutenances-par-ecole-doctorale', ['ecole' => $ecole->getId()], [], true); ?>" - ><?php echo ($ecole->getSigle())??$ecole->getLibelle(); ?></a> + ><?php echo ($ecole->getStructure()->getSigle())??$ecole->getStructure()->getLibelle(); ?></a> </li> <?php endforeach; ?> </ul> diff --git a/module/Application/view/application/rapport/partial/rapports-table.phtml b/module/Application/view/application/rapport/partial/rapports-table.phtml index e4f6d6b900c5b36ce55d37225aa137e87ef531fe..0ed06b95d37a9322df0c12d6f88748795bd2fd2e 100644 --- a/module/Application/view/application/rapport/partial/rapports-table.phtml +++ b/module/Application/view/application/rapport/partial/rapports-table.phtml @@ -163,7 +163,7 @@ $acteursFormatterCodirecteurs->asSeparated() <?php if ($displayEtablissement): ?> <td> - <abbr title="<?php echo $these->getEtablissement()->getLibelle() ?>"> + <abbr title="<?php echo $these->getEtablissement()->getStructure()->getLibelle() ?>"> <?php echo $these->getEtablissement()->getCode() ?> </abbr> </td> @@ -206,7 +206,7 @@ $acteursFormatterCodirecteurs->asSeparated() <?php if ($displayEcoleDoctorale): ?> <td> <?php if ($ed = $these->getEcoleDoctorale()): ?> - <abbr title="<?php echo $ed->getLibelle() ?>"> + <abbr title="<?php echo $ed->getStructure()->getLibelle() ?>"> <?php echo $ed->getStructure()->getCode(); ?> </abbr> <?php endif ?> @@ -216,7 +216,7 @@ $acteursFormatterCodirecteurs->asSeparated() <?php if ($displayUniteRecherche): ?> <td> <?php if ($ur = $these->getUniteRecherche()): ?> - <abbr title="<?php echo $ur->getLibelle() ?>"> + <abbr title="<?php echo $ur->getStructure()->getLibelle() ?>"> <?php echo $ur->getStructure()->getCode(); ?> </abbr> <?php endif ?> diff --git a/module/Application/view/application/role/index.phtml b/module/Application/view/application/role/index.phtml index 64c811c64b4ea2f0a98277e6654e73801944c7d2..a1ab600c581046b67fd8eb31043f9ad14feade8b 100644 --- a/module/Application/view/application/role/index.phtml +++ b/module/Application/view/application/role/index.phtml @@ -18,7 +18,7 @@ use Application\Entity\Db\Role; <?php foreach ($etablissements as $etablissement): ?> <?php $roles = $mappedRoles[$etablissement->getStructure()->getCode()]; ?> <h2> - <?php echo $etablissement->getLibelle(); ?> + <?php echo $etablissement->getStructure()->getLibelle(); ?> <span class="badge bg-secondary"> <?php echo count($roles); ?> </span> diff --git a/module/Application/view/application/statistique/index.phtml b/module/Application/view/application/statistique/index.phtml index 578a061aa47ce19f693906c61585e972da5897f5..1b1e1521d853271a7d85470d51c916eb001d4215 100644 --- a/module/Application/view/application/statistique/index.phtml +++ b/module/Application/view/application/statistique/index.phtml @@ -76,21 +76,21 @@ $this->headTitle($this->translate("Statistiques")); //null option $("select#structure_id").append(new Option(("Selectionner un établissement ... "), null, false, true)); <?php foreach ($etablissements as $structureConcrete) : ?> - $("select#structure_id").append(new Option(<?php echo '"'.$structureConcrete->getLibelle().'"'; ?> , <?php echo $structureConcrete->getId(); ?>, false, false)); + $("select#structure_id").append(new Option(<?php echo '"'.$structureConcrete->getStructure()->getLibelle().'"'; ?> , <?php echo $structureConcrete->getId(); ?>, false, false)); <?php endforeach; ?> break; case "ED" : //null option $("select#structure_id").append(new Option(("Selectionner une école doctorale ... "), null, false, true)); <?php foreach ($ecoles as $structureConcrete) : ?> - $("select#structure_id").append(new Option(<?php echo '"'.$structureConcrete->getLibelle().'"'; ?> , <?php echo $structureConcrete->getId(); ?>, false, false)); + $("select#structure_id").append(new Option(<?php echo '"'.$structureConcrete->getStructure()->getLibelle().'"'; ?> , <?php echo $structureConcrete->getId(); ?>, false, false)); <?php endforeach; ?> break; case "UR" : //null option $("select#structure_id").append(new Option(("Selectionner une unité de recherche ... "), null, false, true)); <?php foreach ($unites as $structureConcrete) : ?> - $("select#structure_id").append(new Option(<?php echo '"'.$structureConcrete->getLibelle().'"'; ?> , <?php echo $structureConcrete->getId(); ?>, false, false)); + $("select#structure_id").append(new Option(<?php echo '"'.$structureConcrete->getStructure()->getLibelle().'"'; ?> , <?php echo $structureConcrete->getId(); ?>, false, false)); <?php endforeach; ?> break; } diff --git a/module/Application/view/application/tableau-de-bord/partial/form-filtrage.phtml b/module/Application/view/application/tableau-de-bord/partial/form-filtrage.phtml index 6f708df2a441d2431b37c65e63a68e4f2df2cab3..0fc899b3c9354cb492bc952b67f1945531d91931 100644 --- a/module/Application/view/application/tableau-de-bord/partial/form-filtrage.phtml +++ b/module/Application/view/application/tableau-de-bord/partial/form-filtrage.phtml @@ -25,7 +25,7 @@ $paramEtablissements = []; $paramEtablissements[] = ['value' => '', 'label' => $this->translate("Tous") ]; /** @var Etablissement[] $etablissements */ foreach ($etablissements as $etablissement) { - $paramEtablissements[] = ['value' => $v = $etablissement->getStructure()->getCode(), 'label' => $etablissement->getSigle() ]; + $paramEtablissements[] = ['value' => $v = $etablissement->getStructure()->getCode(), 'label' => $etablissement->getStructure()->getSigle() ]; } echo $this->filterPanel([ diff --git a/module/Application/view/application/unite-recherche/information.phtml b/module/Application/view/application/unite-recherche/information.phtml index 720a825aa5258a9a57256943440dc16a504936fc..96b525c508a5b4cecee4fbe52245142f7a447eda 100644 --- a/module/Application/view/application/unite-recherche/information.phtml +++ b/module/Application/view/application/unite-recherche/information.phtml @@ -31,7 +31,7 @@ $structure = $unite->getStructure(); ?> <h1 class="page-header"> - Unité de recherche « <?php echo $unite->getLibelle(); ?> » + Unité de recherche « <?php echo $unite->getStructure()->getLibelle(); ?> » </h1> <?php echo $this->messenger()->addMessagesFromFlashMessengerWithNoNamespace() ?> @@ -89,9 +89,9 @@ $structure = $unite->getStructure(); <div class="col-md-8"> <dl> <dt> Libelle :</dt> - <dd> <?php echo $unite->getLibelle(); ?> </dd> + <dd> <?php echo $unite->getStructure()->getLibelle(); ?> </dd> <dt> Sigle :</dt> - <dd> <?php echo $unite->getSigle(); ?> </dd> + <dd> <?php echo $unite->getStructure()->getSigle(); ?> </dd> <dt> Code :</dt> <dd> <?php echo $unite->getStructure()->getCode(); ?> </dd> <dt> Id REF: </dt> @@ -108,7 +108,7 @@ $structure = $unite->getStructure(); <dd> <ul> <?php foreach ($etablissementsRattachements as $etablissementRattachement) : ?> - <li> <?php echo $etablissementRattachement->getEtablissement()->getLibelle(); ?></li> + <li> <?php echo $etablissementRattachement->getEtablissement()->getStructure()->getLibelle(); ?></li> <?php endforeach; ?> </ul> </dd> diff --git a/module/Application/view/application/utilisateur/gerer-utilisateur.phtml b/module/Application/view/application/utilisateur/gerer-utilisateur.phtml index 4fa1f10c118e5278bd22e2f2b1d9b989a140dffa..9d76315595c1477fb8692159153788fec44fe235 100644 --- a/module/Application/view/application/utilisateur/gerer-utilisateur.phtml +++ b/module/Application/view/application/utilisateur/gerer-utilisateur.phtml @@ -85,7 +85,7 @@ use Application\Entity\Db\Utilisateur; </td> <td> <?php if ($acteur->getEtablissement() !== null) : ?> - <?php echo $acteur->getEtablissement()->getLibelle(); ?> + <?php echo $acteur->getEtablissement()->getStructure()->getLibelle(); ?> <?php else : ?> Aucun établissement <?php endif; ?> diff --git a/module/Application/view/application/utilisateur/lier-individu.phtml b/module/Application/view/application/utilisateur/lier-individu.phtml index 6345c8b157878dc2b85254c9ba38dfd2e1475dbd..f07075c925958f86b820063124e31233971b337b 100644 --- a/module/Application/view/application/utilisateur/lier-individu.phtml +++ b/module/Application/view/application/utilisateur/lier-individu.phtml @@ -141,7 +141,7 @@ use UnicaenApp\Form\Element\SearchAndSelect; </td> <td> <?php if ($acteur->getEtablissement() !== null) : ?> - <?php echo $acteur->getEtablissement()->getLibelle(); ?> + <?php echo $acteur->getEtablissement()->getStructure()->getLibelle(); ?> <?php else : ?> Aucun établissement <?php endif; ?> diff --git a/module/Fichier/src/Fichier/Service/Fichier/FichierStorageService.php b/module/Fichier/src/Fichier/Service/Fichier/FichierStorageService.php index 14870e8472d576600d9163c1881bf909c6719263..ec8008edef3768ac4bcebac0e51fd0fe6e1d014f 100644 --- a/module/Fichier/src/Fichier/Service/Fichier/FichierStorageService.php +++ b/module/Fichier/src/Fichier/Service/Fichier/FichierStorageService.php @@ -2,20 +2,14 @@ namespace Fichier\Service\Fichier; -use Fichier\Exporter\PageFichierIntrouvablePdfExporterTrait; -use InvalidArgumentException; -use Structure\Entity\Db\EcoleDoctorale; -use Structure\Entity\Db\Etablissement; -use Structure\Entity\Db\Structure; -use Structure\Entity\Db\StructureConcreteInterface; -use Structure\Entity\Db\StructureInterface; -use Structure\Entity\Db\UniteRecherche; use Fichier\Entity\Db\Fichier; +use Fichier\Exporter\PageFichierIntrouvablePdfExporterTrait; use Fichier\Service\Storage\Adapter\Exception\StorageAdapterException; use Fichier\Service\Storage\Adapter\StorageAdapterInterface; use Generator; +use InvalidArgumentException; use RuntimeException; -use UnexpectedValueException; +use Structure\Entity\Db\StructureInterface; use UnicaenApp\Util; class FichierStorageService @@ -188,23 +182,16 @@ class FichierStorageService */ private function computeDirectoryNameForLogoStructure(StructureInterface $structure): string { + $type = $structure->getTypeStructure(); $dir = null; // sous-répertoire identifiant le type de structure - if ($structure instanceof EcoleDoctorale) { + if ($type->isEtablissement()) { + $dir = self::DIR_ETAB; + } elseif ($type->isEcoleDoctorale()) { $dir = self::DIR_ED; - } elseif ($structure instanceof UniteRecherche) { + } elseif ($type->isUniteRecherche()) { $dir = self::DIR_UR; - } elseif ($structure instanceof Etablissement) { - $dir = self::DIR_ETAB; - } elseif ($structure instanceof Structure) { - if ($structure->getTypeStructure()->isEtablissement()) { - $dir = self::DIR_ETAB; - } elseif ($structure->getTypeStructure()->isEcoleDoctorale()) { - $dir = self::DIR_ED; - } elseif ($structure->getTypeStructure()->isUniteRecherche()) { - $dir = self::DIR_UR; - } } if ($dir === null) { throw new RuntimeException("Structure spécifiée imprévue."); @@ -252,12 +239,6 @@ class FichierStorageService $name = $structure->getCode(); - if ($structure instanceof StructureConcreteInterface) { - if ($type = $structure->getStructure()->getTypeStructure()) { - $name = $type->getCode() . '-' . $name; - } - } - $name = str_replace(["'", ':'], '_', $name); $name = str_replace(' ', '', $name); diff --git a/module/Formation/src/Formation/Controller/InscriptionController.php b/module/Formation/src/Formation/Controller/InscriptionController.php index 4467e8e815b3af207381ed8eb5f95a036be192f2..c1c573692f26f9d5aef8a6e7dde0da9b709e5440 100644 --- a/module/Formation/src/Formation/Controller/InscriptionController.php +++ b/module/Formation/src/Formation/Controller/InscriptionController.php @@ -214,13 +214,13 @@ class InscriptionController extends AbstractController $logos = []; try { - $logos['site'] = $this->fichierStorageService->getFileForLogoStructure($session->getSite()); + $logos['site'] = $this->fichierStorageService->getFileForLogoStructure($session->getSite()->getStructure()); } catch (StorageAdapterException $e) { $logos['site'] = null; } if ($comue = $this->etablissementService->fetchEtablissementComue()) { try { - $logos['comue'] = $this->fichierStorageService->getFileForLogoStructure($comue); + $logos['comue'] = $this->fichierStorageService->getFileForLogoStructure($comue->getStructure()); } catch (StorageAdapterException $e) { $logos['comue'] = null; } @@ -247,13 +247,13 @@ class InscriptionController extends AbstractController $logos = []; try { - $logos['site'] = $this->fichierStorageService->getFileForLogoStructure($session->getSite()); + $logos['site'] = $this->fichierStorageService->getFileForLogoStructure($session->getSite()->getStructure()); } catch (StorageAdapterException $e) { $logos['site'] = null; } if ($comue = $this->etablissementService->fetchEtablissementComue()) { try { - $logos['comue'] = $this->fichierStorageService->getFileForLogoStructure($comue); + $logos['comue'] = $this->fichierStorageService->getFileForLogoStructure($comue->getStructure()); } catch (StorageAdapterException $e) { $logos['comue'] = null; } diff --git a/module/Formation/src/Formation/Controller/SeanceController.php b/module/Formation/src/Formation/Controller/SeanceController.php index a2edb80b209e93f3cced09f77c32654d1efa7f18..c2acbe3cdc4ebd03cb8ccb61ed4623934c8655fb 100644 --- a/module/Formation/src/Formation/Controller/SeanceController.php +++ b/module/Formation/src/Formation/Controller/SeanceController.php @@ -146,13 +146,13 @@ class SeanceController extends AbstractController $logos = []; try { - $logos['site'] = $this->fichierStorageService->getFileForLogoStructure($session->getSite()); + $logos['site'] = $this->fichierStorageService->getFileForLogoStructure($session->getSite()->getStructure()); } catch (StorageAdapterException $e) { $logos['site'] = null; } if ($comue = $this->etablissementService->fetchEtablissementComue()) { try { - $logos['comue'] = $this->fichierStorageService->getFileForLogoStructure($comue); + $logos['comue'] = $this->fichierStorageService->getFileForLogoStructure($comue->getStructure()); } catch (StorageAdapterException $e) { $logos['comue'] = null; } diff --git a/module/Formation/src/Formation/Controller/SessionController.php b/module/Formation/src/Formation/Controller/SessionController.php index 2160f4caf6496966c366df3ea73c4ddf9619fd2d..52049b940e5dab5b3752c1401e6762e80d7a5cf4 100644 --- a/module/Formation/src/Formation/Controller/SessionController.php +++ b/module/Formation/src/Formation/Controller/SessionController.php @@ -304,9 +304,9 @@ class SessionController extends AbstractController foreach ($inscriptions as $inscription) { $doctorant = $inscription->getDoctorant(); $theses = array_filter($doctorant->getTheses(), function (These $t) { return $t->getEtatThese() === These::ETAT_EN_COURS; }); - $etablissements = array_map(function (These $t) { return ($t->getEtablissement())?$t->getEtablissement()->getLibelle():"Établissement non renseigné";}, $theses); - $ecoles = array_map(function (These $t) { return ($t->getEcoleDoctorale())?$t->getEcoleDoctorale()->getLibelle():"École doctorale non renseignée";}, $theses); - $unites = array_map(function (These $t) { return ($t->getUniteRecherche())?$t->getUniteRecherche()->getLibelle():"Unité de recherche non renseignée";}, $theses); + $etablissements = array_map(function (These $t) { return ($t->getEtablissement())?$t->getEtablissement()->getStructure()->getLibelle():"Établissement non renseigné";}, $theses); + $ecoles = array_map(function (These $t) { return ($t->getEcoleDoctorale())?$t->getEcoleDoctorale()->getStructure()->getLibelle():"École doctorale non renseignée";}, $theses); + $unites = array_map(function (These $t) { return ($t->getUniteRecherche())?$t->getUniteRecherche()->getStructure()->getLibelle():"Unité de recherche non renseignée";}, $theses); $entry = [ 'Liste' => $inscription->getListe(), 'Dénomination étudiant' => $doctorant->getIndividu()->getNomComplet(), @@ -339,14 +339,14 @@ class SessionController extends AbstractController $logos = []; try { - $logos['site'] = $this->fichierStorageService->getFileForLogoStructure($session->getSite()); + $logos['site'] = $this->fichierStorageService->getFileForLogoStructure($session->getSite()->getStructure()); } catch (StorageAdapterException $e) { $logos['site'] = null; } if ($comue = $this->etablissementService->fetchEtablissementComue()) { try { - $logos['comue'] = $this->fichierStorageService->getFileForLogoStructure($comue); + $logos['comue'] = $this->fichierStorageService->getFileForLogoStructure($comue->getStructure()); } catch (StorageAdapterException $e) { $logos['comue'] = null; } diff --git a/module/Formation/src/Formation/Service/Exporter/Emargement/emargement.phtml b/module/Formation/src/Formation/Service/Exporter/Emargement/emargement.phtml index bc61a9cd34098c70cfb3826173d9f314f2a079d0..6bc5f2e5602d06a8998aa36f4043594614e96eb3 100644 --- a/module/Formation/src/Formation/Service/Exporter/Emargement/emargement.phtml +++ b/module/Formation/src/Formation/Service/Exporter/Emargement/emargement.phtml @@ -61,11 +61,11 @@ $formateurs = $session->getFormateurs(); $theses = array_filter($theses, function(These $t) { return $t->getEtatThese() === These::ETAT_EN_COURS;}); $etablissements = []; $ecoles = []; $unites = []; foreach ($theses as $these) { - $etablissement = ($these->getEtablissement())?$these->getEtablissement()->getSigle():"Établissement non renseigné"; + $etablissement = ($these->getEtablissement())?$these->getEtablissement()->getStructure()->getSigle():"Établissement non renseigné"; $etablissements[$etablissement] = $etablissement; - $ecole = ($these->getEcoleDoctorale())?$these->getEcoleDoctorale()->getSigle():"École doctorale non renseignée"; + $ecole = ($these->getEcoleDoctorale())?$these->getEcoleDoctorale()->getStructure()->getSigle():"École doctorale non renseignée"; $ecoles[$ecole] = $ecole; - $unite = ($these->getUniteRecherche())?$these->getUniteRecherche()->getSigle():"Unité de recherche non renseignée"; + $unite = ($these->getUniteRecherche())?$these->getUniteRecherche()->getStructure()->getSigle():"Unité de recherche non renseignée"; $unites[$unite] = $unite; } ?> diff --git a/module/Formation/src/Formation/View/Helper/partial/site.phtml b/module/Formation/src/Formation/View/Helper/partial/site.phtml index 746759a67b75198d489c7a0958c4a49dd2bbc17d..42f1ce1776056e1f993c2d101acffd67479cba77 100644 --- a/module/Formation/src/Formation/View/Helper/partial/site.phtml +++ b/module/Formation/src/Formation/View/Helper/partial/site.phtml @@ -10,9 +10,9 @@ use Structure\Entity\Db\Etablissement; ?> <?php if ($site !== null) : ?> - <span class="site" title="<?php echo $site->getLibelle(); ?>" + <span class="site" title="<?php echo $site->getStructure()->getLibelle(); ?>" data-bs-toggle="tooltip" data-bs-html="true"> - <?php echo $site->getSigle(); ?> + <?php echo $site->getStructure()->getSigle(); ?> </span> <?php else : ?> <span class="site" title="Formation dispensée pour tous les sites" diff --git a/module/Indicateur/src/Indicateur/Controller/IndicateurController.php b/module/Indicateur/src/Indicateur/Controller/IndicateurController.php index b1e40f74cc0a36b8e8b1c48553193d8482816100..3516ede67b35851c3c852cc89e3ad2bc35173f0a 100644 --- a/module/Indicateur/src/Indicateur/Controller/IndicateurController.php +++ b/module/Indicateur/src/Indicateur/Controller/IndicateurController.php @@ -226,22 +226,22 @@ class IndicateurController extends AbstractActionController { case 'Établissement d\'inscription' : if ($entry[$fct]) { /** @var Etablissement $etablissement */ - $etablissement = $this->getStructureService()->getStructuresConcreteByTypeAndStructureConcreteId(TypeStructure::CODE_ETABLISSEMENT, $entry[$fct]); - $value = $etablissement->getLibelle(); + $etablissement = $this->getStructureService()->getStructureConcreteByTypeAndStructureConcreteId(TypeStructure::CODE_ETABLISSEMENT, $entry[$fct]); + $value = $etablissement->getStructure()->getLibelle(); } else $value .= ""; break; case 'École doctorale' : if ($entry[$fct]) { /** @var EcoleDoctorale $ecole */ - $ecole = $this->getStructureService()->getStructuresConcreteByTypeAndStructureConcreteId(TypeStructure::CODE_ECOLE_DOCTORALE, $entry[$fct]); - $value = $ecole->getLibelle(); + $ecole = $this->getStructureService()->getStructureConcreteByTypeAndStructureConcreteId(TypeStructure::CODE_ECOLE_DOCTORALE, $entry[$fct]); + $value = $ecole->getStructure()->getLibelle(); } else $value .= ""; break; case 'Unité de recherche' : if ($entry[$fct]) { /** @var UniteRecherche $unite */ - $unite = $this->getStructureService()->getStructuresConcreteByTypeAndStructureConcreteId(TypeStructure::CODE_UNITE_RECHERCHE, $entry[$fct]); - $value = $unite->getLibelle(); + $unite = $this->getStructureService()->getStructureConcreteByTypeAndStructureConcreteId(TypeStructure::CODE_UNITE_RECHERCHE, $entry[$fct]); + $value = $unite->getStructure()->getLibelle(); } else $value .= ""; break; default: diff --git a/module/Indicateur/src/Indicateur/View/Helper/CompletIndicateurTheseHelper.php b/module/Indicateur/src/Indicateur/View/Helper/CompletIndicateurTheseHelper.php index 82782a2690fe10397f28dd944882966dc04a3e34..17fef64a1af73c90b5172a8a1bb5d409538c68b5 100644 --- a/module/Indicateur/src/Indicateur/View/Helper/CompletIndicateurTheseHelper.php +++ b/module/Indicateur/src/Indicateur/View/Helper/CompletIndicateurTheseHelper.php @@ -54,15 +54,15 @@ class CompletIndicateurTheseHelper extends AbstractHelper case 'Établissement d\'inscription': if ($entry[$valeur]) { /** @var Etablissement $etablissement */ - $etablissement = $structureService->getStructuresConcreteByTypeAndStructureConcreteId(TypeStructure::CODE_ETABLISSEMENT, $entry[$valeur]); - $html .= '<abbr title="' . $etablissement->getLibelle() . '">' . $etablissement->getSigle() . '</abbr>'; + $etablissement = $structureService->getStructureConcreteByTypeAndStructureConcreteId(TypeStructure::CODE_ETABLISSEMENT, $entry[$valeur]); + $html .= '<abbr title="' . $etablissement->getStructure()->getLibelle() . '">' . $etablissement->getStructure()->getSigle() . '</abbr>'; } else $html .= "---"; break; case 'École doctorale': if ($entry[$valeur]) { /** @var EcoleDoctorale $ecole */ - $ecole = $structureService->getStructuresConcreteByTypeAndStructureConcreteId(TypeStructure::CODE_ECOLE_DOCTORALE, $entry[$valeur]); - $html .= '<abbr title="' . $ecole->getLibelle() . '">' . $ecole->getSigle() . '</abbr>'; + $ecole = $structureService->getStructureConcreteByTypeAndStructureConcreteId(TypeStructure::CODE_ECOLE_DOCTORALE, $entry[$valeur]); + $html .= '<abbr title="' . $ecole->getStructure()->getLibelle() . '">' . $ecole->getStructure()->getSigle() . '</abbr>'; } else { $html .= "---"; } @@ -70,8 +70,8 @@ class CompletIndicateurTheseHelper extends AbstractHelper case 'Unité de recherche': if ($entry[$valeur]) { /** @var UniteRecherche $unite */ - $unite = $structureService->getStructuresConcreteByTypeAndStructureConcreteId(TypeStructure::CODE_UNITE_RECHERCHE, $entry[$valeur]); - $html .= '<abbr title="' . $unite->getLibelle() . '">' . $unite->getSigle() . '</abbr>'; + $unite = $structureService->getStructureConcreteByTypeAndStructureConcreteId(TypeStructure::CODE_UNITE_RECHERCHE, $entry[$valeur]); + $html .= '<abbr title="' . $unite->getStructure()->getLibelle() . '">' . $unite->getStructure()->getSigle() . '</abbr>'; } else { $html .= "---"; } diff --git a/module/Individu/src/Individu/Form/IndividuCompl/IndividuComplHydrator.php b/module/Individu/src/Individu/Form/IndividuCompl/IndividuComplHydrator.php index 999e8b80d0124610374b1e159cdf8ae0359ce4b4..e390629f2832514309769c8cb9fea8fa4c5ef3b2 100644 --- a/module/Individu/src/Individu/Form/IndividuCompl/IndividuComplHydrator.php +++ b/module/Individu/src/Individu/Form/IndividuCompl/IndividuComplHydrator.php @@ -27,11 +27,11 @@ class IndividuComplHydrator implements HydratorInterface { 'email' => ($object->getEmail())?:null, 'etablissement' => [ 'id' => ($object->getEtablissement())?$object->getEtablissement()->getId():null, - 'label' => ($object->getEtablissement())?$object->getEtablissement()->getLibelle():null, + 'label' => ($object->getEtablissement())?$object->getEtablissement()->getStructure()->getLibelle():null, ], 'uniteRecherche' => [ 'id' => ($object->getUniteRecherche())?$object->getUniteRecherche()->getId():null, - 'label' => ($object->getUniteRecherche())?$object->getUniteRecherche()->getLibelle():null, + 'label' => ($object->getUniteRecherche())?$object->getUniteRecherche()->getStructure()->getLibelle():null, ], ]; return $data; diff --git a/module/Individu/view/individu/individu-compl/index.phtml b/module/Individu/view/individu/individu-compl/index.phtml index 98d43b411532d7df9d2c51b79a8dab41d6bb6bdc..74354e805a0d5a953fdd0a793c2a36de4b23bf45 100644 --- a/module/Individu/view/individu/individu-compl/index.phtml +++ b/module/Individu/view/individu/individu-compl/index.phtml @@ -73,14 +73,14 @@ $canHistoriser = $canAjouter; </td> <td> <?php if ($complement->getEtablissement()) : ?> - <?php echo $complement->getEtablissement()->getLibelle(); ?> + <?php echo $complement->getEtablissement()->getStructure()->getLibelle(); ?> <?php else: ?> (Non renseigné·e) <?php endif; ?> </td> <td> <?php if ($complement->getUniteRecherche()) : ?> - <?php echo $complement->getUniteRecherche()->getLibelle(); ?> + <?php echo $complement->getUniteRecherche()->getStructure()->getLibelle(); ?> <?php else: ?> (Non renseigné·e) <?php endif; ?> diff --git a/module/Individu/view/individu/individu/partial/roles.phtml b/module/Individu/view/individu/individu/partial/roles.phtml index 8020eefc2548b1cf450ebf54afe4115eb965799f..de6dc799984658dea86ba25970cd49c6f7177fba 100644 --- a/module/Individu/view/individu/individu/partial/roles.phtml +++ b/module/Individu/view/individu/individu/partial/roles.phtml @@ -113,7 +113,7 @@ function generateSelect($structures, $id, $roles = null) foreach ($structuresValides as $structure) { $texte .= '<option value="' . $structure->getStructure()->getId() . '">'; $texte .= $structure->getStructure()->getLibelle(); - $texte .= ' (' . $structure->getSigle() . ')'; + $texte .= ' (' . $structure->getStructure()->getSigle() . ')'; $texte .= '</option>'; } $texte .= "</select>"; diff --git a/module/RapportActivite/src/RapportActivite/Service/RapportActiviteService.php b/module/RapportActivite/src/RapportActivite/Service/RapportActiviteService.php index 45b290339f823e46c1551adc6743e8b428fd4abb..fbd38532f55c0fa0ed8c8518c662b6228805d4c1 100644 --- a/module/RapportActivite/src/RapportActivite/Service/RapportActiviteService.php +++ b/module/RapportActivite/src/RapportActivite/Service/RapportActiviteService.php @@ -297,7 +297,7 @@ class RapportActiviteService extends BaseService } // structures - $exportData->etablissement = $etablissement->getLibelle(); + $exportData->etablissement = $etablissement->getStructure()->getLibelle(); $exportData->ecoleDoctorale = $ed->getStructure()->getLibelle(); $exportData->uniteRecherche = $ur->getStructure()->getLibelle(); @@ -307,11 +307,11 @@ class RapportActiviteService extends BaseService $exportData->useCOMUE = false; if ($comue = $this->etablissementService->fetchEtablissementComue()) { $exportData->useCOMUE = true; - if (!$comue->getCheminLogo()) { + if (!$comue->getStructure()->getCheminLogo()) { throw new PageValidationExportDataException("La COMUE '{$comue}' n'a aucun logo !"); } try { - $exportData->logoCOMUE = $this->fichierStorageService->getFileForLogoStructure($comue); + $exportData->logoCOMUE = $this->fichierStorageService->getFileForLogoStructure($comue->getStructure()); } catch (StorageAdapterException $e) { throw new PageValidationExportDataException( "Accès impossible au logo de la COMUE '{$comue}' : " . $e->getMessage()); @@ -319,33 +319,33 @@ class RapportActiviteService extends BaseService } // logo etablissement - if (!$etablissement->getCheminLogo()) { + if (!$etablissement->getStructure()->getCheminLogo()) { throw new PageValidationExportDataException("L'établissement '{$etablissement}' n'a aucun logo !"); } try { - $exportData->logoEtablissement = $this->fichierStorageService->getFileForLogoStructure($etablissement); + $exportData->logoEtablissement = $this->fichierStorageService->getFileForLogoStructure($etablissement->getStructure()); } catch (StorageAdapterException $e) { throw new PageValidationExportDataException( "Accès impossible au logo de l'établissement '{$etablissement}' : " . $e->getMessage()); } // logo ED - if (!$ed->getCheminLogo()) { + if (!$ed->getStructure()->getCheminLogo()) { throw new PageValidationExportDataException("L'ED '{$ed}' n'a aucun logo !"); } try { - $exportData->logoEcoleDoctorale = $this->fichierStorageService->getFileForLogoStructure($ed); + $exportData->logoEcoleDoctorale = $this->fichierStorageService->getFileForLogoStructure($ed->getStructure()); } catch (StorageAdapterException $e) { throw new PageValidationExportDataException( "Accès impossible au logo de l'ED '{$ed}' : " . $e->getMessage()); } // logo UR - if (!$ur->getCheminLogo()) { + if (!$ur->getStructure()->getCheminLogo()) { throw new PageValidationExportDataException("L'UR '{$ur}' n'a aucun logo !"); } try { - $exportData->logoUniteRecherche = $this->fichierStorageService->getFileForLogoStructure($ur); + $exportData->logoUniteRecherche = $this->fichierStorageService->getFileForLogoStructure($ur->getStructure()); } catch (StorageAdapterException $e) { throw new PageValidationExportDataException( "Accès impossible au logo de l'UR '{$ur}' : " . $e->getMessage()); diff --git a/module/RapportActivite/view/rapport-activite/partial/rapports-table.phtml b/module/RapportActivite/view/rapport-activite/partial/rapports-table.phtml index 7f0c93b58461687ca575da60a19651f21fef32c4..194a7208e5d57d11ae7a9672dd0f7b4d0835cad5 100644 --- a/module/RapportActivite/view/rapport-activite/partial/rapports-table.phtml +++ b/module/RapportActivite/view/rapport-activite/partial/rapports-table.phtml @@ -149,7 +149,7 @@ $ajaxModalEvent = 'EVENT_AVIS_SAISI'; <?php if ($displayEtablissement): ?> <td> - <abbr title="<?php echo $these->getEtablissement()->getLibelle() ?>"> + <abbr title="<?php echo $these->getEtablissement()->getStructure()->getLibelle() ?>"> <?php echo $these->getEtablissement()->getCode() ?> </abbr> </td> @@ -196,7 +196,7 @@ $ajaxModalEvent = 'EVENT_AVIS_SAISI'; <?php if ($displayEcoleDoctorale): ?> <td> <?php if ($ed = $these->getEcoleDoctorale()): ?> - <abbr title="<?php echo $ed->getLibelle() ?>"> + <abbr title="<?php echo $ed->getStructure()->getLibelle() ?>"> <?php echo $ed->getStructure()->getCode(); ?> </abbr> <?php endif ?> @@ -206,7 +206,7 @@ $ajaxModalEvent = 'EVENT_AVIS_SAISI'; <?php if ($displayUniteRecherche): ?> <td> <?php if ($ur = $these->getUniteRecherche()): ?> - <abbr title="<?php echo $ur->getLibelle() ?>"> + <abbr title="<?php echo $ur->getStructure()->getLibelle() ?>"> <?php echo $ur->getStructure()->getCode(); ?> </abbr> <?php endif ?> diff --git a/module/Soutenance/src/Soutenance/Controller/PresoutenanceController.php b/module/Soutenance/src/Soutenance/Controller/PresoutenanceController.php index 8f84eb14a0bdc315262ad4fa60ffa770601db1e4..2ff450f9e2502aa28ab461f6016df2f6e16a6290 100644 --- a/module/Soutenance/src/Soutenance/Controller/PresoutenanceController.php +++ b/module/Soutenance/src/Soutenance/Controller/PresoutenanceController.php @@ -444,7 +444,7 @@ class PresoutenanceController extends AbstractController */ private function getVille(Etablissement $etablissement) : string { - switch ($etablissement->getSigle()) { + switch ($etablissement->getStructure()->getSigle()) { case "UCN" : $ville = "Caen"; break; diff --git a/module/Soutenance/src/Soutenance/Service/Exporter/Convocation/convocation_doctorant.phtml b/module/Soutenance/src/Soutenance/Service/Exporter/Convocation/convocation_doctorant.phtml index 459bf5e32e8bc3658ea25663911e6f8db32f0ab1..7db0bafaeedf0c59fc244c123f99ed2885c7d89a 100644 --- a/module/Soutenance/src/Soutenance/Service/Exporter/Convocation/convocation_doctorant.phtml +++ b/module/Soutenance/src/Soutenance/Service/Exporter/Convocation/convocation_doctorant.phtml @@ -141,7 +141,7 @@ $civilite = ($these->getDoctorant()->getIndividu()->getCivilite() === 'M.')?"Mon <br/> <br/> Visa de l'établissement d'inscription du doctorant,<br/> - <?php echo $these->getEtablissement()->getLibelle(); ?> + <?php echo $these->getEtablissement()->getStructure()->getLibelle(); ?> </td> </tr> <tr> diff --git a/module/Soutenance/src/Soutenance/Service/Exporter/Convocation/convocation_membre.phtml b/module/Soutenance/src/Soutenance/Service/Exporter/Convocation/convocation_membre.phtml index a8ddc754c5733395f01ed396ffb6386d45ffc9a9..7e977bbf9bf107f3a3eca0a364f23190281d6d9c 100644 --- a/module/Soutenance/src/Soutenance/Service/Exporter/Convocation/convocation_membre.phtml +++ b/module/Soutenance/src/Soutenance/Service/Exporter/Convocation/convocation_membre.phtml @@ -105,7 +105,7 @@ Par décision en date du Date manquante, </span> <?php endif; ?> -le chef de l'établissement <?php echo $these->getEtablissement()->getLibelle(); ?> vous a désigné<?php if($civilite==="Madame") echo "e"; ?> +le chef de l'établissement <?php echo $these->getEtablissement()->getStructure()->getLibelle(); ?> vous a désigné<?php if($civilite==="Madame") echo "e"; ?> pour participer au jury devant examiner les travaux de <?php echo $these->getDoctorant()->getIndividu()->getNomComplet(true); ?> en vue de l'obtention du diplôme : <br/> Doctorat en <?php echo $these->getLibelleDiscipline(); ?>. @@ -172,7 +172,7 @@ $texte_directeur = implode(" et ", $encadrement); <br/> <br/> Visa de l'établissement d'inscription du doctorant,<br/> - <?php echo $these->getEtablissement()->getLibelle(); ?> + <?php echo $these->getEtablissement()->getStructure()->getLibelle(); ?> </td> </tr> <tr> diff --git a/module/Soutenance/src/Soutenance/Service/Membre/MembreService.php b/module/Soutenance/src/Soutenance/Service/Membre/MembreService.php index 7e55973d1dbefb88eecba75789b5fa7ab98f5129..9716a45446a8ea84aa69e3fa11b4d45e683bf911 100644 --- a/module/Soutenance/src/Soutenance/Service/Membre/MembreService.php +++ b/module/Soutenance/src/Soutenance/Service/Membre/MembreService.php @@ -244,7 +244,7 @@ class MembreService { $membre->setGenre(($acteur->getIndividu()->estUneFemme())?"F":"H"); $qualite = $this->getQualiteService()->getQualiteByLibelle($acteur->getQualite()); $membre->setQualite(($qualite !== null)?$qualite:$inconnue); - $membre->setEtablissement(($acteur->getEtablissement())?$acteur->getEtablissement()->getLibelle():"Etablissement inconnu"); + $membre->setEtablissement(($acteur->getEtablissement())?$acteur->getEtablissement()->getStructure()->getLibelle():"Etablissement inconnu"); $membre->setRole(Membre::MEMBRE_JURY); $membre->setExterieur("non"); $membre->setEmail($acteur->getIndividu()->getEmail()); diff --git a/module/Soutenance/src/Soutenance/Service/Proposition/PropositionService.php b/module/Soutenance/src/Soutenance/Service/Proposition/PropositionService.php index ef013fef969c50ed99811e16e6fcc4489b2656d1..337cf183723d83100a67953eaa196f854f68e73b 100644 --- a/module/Soutenance/src/Soutenance/Service/Proposition/PropositionService.php +++ b/module/Soutenance/src/Soutenance/Service/Proposition/PropositionService.php @@ -516,14 +516,14 @@ class PropositionService { $logos['COMUE'] = null; if ($comue = $this->getEtablissementService()->fetchEtablissementComue()) { try { - $logos['COMUE'] = $this->fichierStorageService->getFileForLogoStructure($comue); + $logos['COMUE'] = $this->fichierStorageService->getFileForLogoStructure($comue->getStructure()); } catch (StorageAdapterException $e) { $logos['COMUE'] = null; } } try { - $logos['ETAB'] = $this->fichierStorageService->getFileForLogoStructure($these->getEtablissement()); + $logos['ETAB'] = $this->fichierStorageService->getFileForLogoStructure($these->getEtablissement()->getStructure()); } catch (StorageAdapterException $e) { $logos['ETAB'] = null; } diff --git a/module/Soutenance/src/Soutenance/Service/SignaturePresident/signature-president.phtml b/module/Soutenance/src/Soutenance/Service/SignaturePresident/signature-president.phtml index 54be45a1a505555327311939cad014b8ee45b2da..ef17f0941ffc232e8319823494823bc92b465c25 100644 --- a/module/Soutenance/src/Soutenance/Service/SignaturePresident/signature-president.phtml +++ b/module/Soutenance/src/Soutenance/Service/SignaturePresident/signature-president.phtml @@ -17,8 +17,8 @@ use Soutenance\Entity\Proposition; */ $these = $proposition->getThese(); -$unite = ($these->getUniteRecherche())?$these->getUniteRecherche()->getLibelle():$these->getLibelleUniteRecherche(); -$ecole = ($these->getEcoleDoctorale())?$these->getEcoleDoctorale()->getLibelle():"Information manquante"; +$unite = ($these->getUniteRecherche())?$these->getUniteRecherche()->getStructure()->getLibelle():$these->getLibelleUniteRecherche(); +$ecole = ($these->getEcoleDoctorale())?$these->getEcoleDoctorale()->getStructure()->getLibelle():"Information manquante"; ?> <style> diff --git a/module/Soutenance/view/soutenance/index/index-structure.phtml b/module/Soutenance/view/soutenance/index/index-structure.phtml index aebba475ee6f3d01073f41c77a5bf5ee9b1f7d48..67e1d4248ba46cddc047e8b69aaee70f3fde5edd 100644 --- a/module/Soutenance/view/soutenance/index/index-structure.phtml +++ b/module/Soutenance/view/soutenance/index/index-structure.phtml @@ -95,9 +95,9 @@ $canSuppression = ($role->getCode() === Role::CODE_ADMIN_TECH); <td> <?php if ($these->getEtablissement()) : ?> <span class="structure etablissement" - title="Établissement : <?php echo $these->getEtablissement()->getLibelle(); ?> (<?php echo $these->getEtablissement()->getCode(); ?>)" + title="Établissement : <?php echo $these->getEtablissement()->getStructure()->getLibelle(); ?> (<?php echo $these->getEtablissement()->getCode(); ?>)" > - <?php echo $these->getEtablissement()->getLibelle(); ?> + <?php echo $these->getEtablissement()->getStructure()->getLibelle(); ?> </span> <?php else : ?> <strong style="color:darkred;"> @@ -108,9 +108,9 @@ $canSuppression = ($role->getCode() === Role::CODE_ADMIN_TECH); <?php if ($these->getEcoleDoctorale()) : ?> <span class="structure ecole-doctorale" - title="École doctorale : <?php echo $these->getEcoleDoctorale()->getLibelle(); ?> <?php echo "(".$these->getEcoleDoctorale()->getSigle() .")"; ?>" + title="École doctorale : <?php echo $these->getEcoleDoctorale()->getStructure()->getLibelle(); ?> <?php echo "(".$these->getEcoleDoctorale()->getStructure()->getSigle() .")"; ?>" > - <?php echo $these->getEcoleDoctorale()->getLibelle(); ?> + <?php echo $these->getEcoleDoctorale()->getStructure()->getLibelle(); ?> </span> <?php else : ?> <strong style="color:darkred;"> @@ -121,9 +121,9 @@ $canSuppression = ($role->getCode() === Role::CODE_ADMIN_TECH); <?php if ($these->getUniteRecherche()) : ?> <span class="structure unite-recherche" - title="Unité de recherche : <?php echo $these->getUniteRecherche()->getLibelle(); ?> <?php echo "(".$these->getUniteRecherche()->getSigle() .")"; ?>" + title="Unité de recherche : <?php echo $these->getUniteRecherche()->getStructure()->getLibelle(); ?> <?php echo "(".$these->getUniteRecherche()->getStructure()->getSigle() .")"; ?>" > - <?php echo $these->getUniteRecherche()->getLibelle(); ?> + <?php echo $these->getUniteRecherche()->getStructure()->getLibelle(); ?> </span> <?php else : ?> <!-- Gestion des unités de recherche --> diff --git a/module/Soutenance/view/soutenance/index/partial/filtre-proposition.phtml b/module/Soutenance/view/soutenance/index/partial/filtre-proposition.phtml index a3cb9bd5ed66f095603fcfc945e4e53206318984..edaf003fec2c6064043cadedb18bd73b98b8b42c 100644 --- a/module/Soutenance/view/soutenance/index/partial/filtre-proposition.phtml +++ b/module/Soutenance/view/soutenance/index/partial/filtre-proposition.phtml @@ -30,7 +30,7 @@ use Soutenance\Entity\Etat; <option value="">Tous les établissements </option> <?php foreach ($etablissements as $etablissement) : ?> <option value="<?php echo $etablissement->getId(); ?>" <?php if ($etablissement->getId() == $etablissementId) echo " selected "; ?>> - <?php echo $etablissement->getLibelle(); ?> + <?php echo $etablissement->getStructure()->getLibelle(); ?> </option> <?php endforeach; ?> </select> @@ -41,8 +41,8 @@ use Soutenance\Entity\Etat; <option value="">Toutes les écoles doctorales </option> <?php foreach ($ecoles as $ecole) : ?> <option value="<?php echo $ecole->getId(); ?>" <?php if ($ecole->getId() == $ecoleDoctoraleId) echo " selected "; ?>> - <?php echo $ecole->getSigle(); ?> : - <?php echo $ecole->getLibelle(); ?> + <?php echo $ecole->getStructure()->getSigle(); ?> : + <?php echo $ecole->getStructure()->getLibelle(); ?> </option> <?php endforeach; ?> </select> @@ -53,8 +53,8 @@ use Soutenance\Entity\Etat; <option value="">Toutes les unités de recherche </option> <?php foreach ($unites as $unite) : ?> <option value="<?php echo $unite->getId(); ?>" <?php if ($unite->getId() == $uniteRechercheId) echo " selected "; ?>> - <?php echo $unite->getSigle(); ?> : - <?php echo $unite->getLibelle(); ?> + <?php echo $unite->getStructure()->getSigle(); ?> : + <?php echo $unite->getStructure()->getLibelle(); ?> </option> <?php endforeach; ?> </select> diff --git a/module/Soutenance/view/soutenance/notification/convocation-membre.phtml b/module/Soutenance/view/soutenance/notification/convocation-membre.phtml index ab155aaa812da8600b6b58ed8cf01d63b9901732..117de135e4fd48ed135ad3c533b16faf67704565 100644 --- a/module/Soutenance/view/soutenance/notification/convocation-membre.phtml +++ b/module/Soutenance/view/soutenance/notification/convocation-membre.phtml @@ -34,7 +34,7 @@ Par décision en date du Date manquante, </span> <?php endif; ?> -le chef de l'établissement <?php echo $these->getEtablissement()->getLibelle(); ?> vous a désigné<?php if($civilite==="Madame") echo "e"; ?> +le chef de l'établissement <?php echo $these->getEtablissement()->getStructure()->getLibelle(); ?> vous a désigné<?php if($civilite==="Madame") echo "e"; ?> pour participer au jury devant examiner les travaux de <?php echo $these->getDoctorant()->getIndividu()->getNomComplet(true); ?> en vue de l'obtention du diplôme : <br/> Doctorat en <?php echo $these->getLibelleDiscipline(); ?>. diff --git a/module/Soutenance/view/soutenance/notification/validation-structure.phtml b/module/Soutenance/view/soutenance/notification/validation-structure.phtml index 7b01d846a48607708c32f22ce711dc8a1b7082d1..324ab77da7a8c1cce34d8b060b88fe951a580517 100644 --- a/module/Soutenance/view/soutenance/notification/validation-structure.phtml +++ b/module/Soutenance/view/soutenance/notification/validation-structure.phtml @@ -64,7 +64,7 @@ $justification = true; <?php if ($panic) : ?> <p> - <strong>Aucun responsable de site n'a pu être trouvé pour le site '<?php echo $these->getEtablissement()->getLibelle(); ?>'</strong><span class=""></span> + <strong>Aucun responsable de site n'a pu être trouvé pour le site '<?php echo $these->getEtablissement()->getStructure()->getLibelle(); ?>'</strong><span class=""></span> </p> <?php endif; ?> diff --git a/module/Soutenance/view/soutenance/presoutenance/associer-jury.phtml b/module/Soutenance/view/soutenance/presoutenance/associer-jury.phtml index 17fef5da4f3bb0efcdc541355e3eb1acb7a8ae81..7b0b39153e1c3d983239fc8765a656b526dcab33 100644 --- a/module/Soutenance/view/soutenance/presoutenance/associer-jury.phtml +++ b/module/Soutenance/view/soutenance/presoutenance/associer-jury.phtml @@ -22,7 +22,7 @@ use Soutenance\Entity\Membre; <!-- --><?php //echo $acteur->getIndividu()->getNomComplet(false,false,false, true); ?> <?php echo $acteur->getIndividu()->getNomComplet(false,false,false, true); ?> <?php echo $acteur->getQualite(); ?> - <?php echo ($acteur->getEtablissement())?$acteur->getEtablissement()->getLibelle():"Établissement inconnu"; ?> + <?php echo ($acteur->getEtablissement())?$acteur->getEtablissement()->getStructure()->getLibelle():"Établissement inconnu"; ?> </option> <?php endforeach; ?> </select> diff --git a/module/Soutenance/view/soutenance/proposition/afficher-soutenances-par-ecole-doctorale.phtml b/module/Soutenance/view/soutenance/proposition/afficher-soutenances-par-ecole-doctorale.phtml index 56e78ecf212b65103f65a76af7585d0d6a3906dd..5d0715be60e65d32cff65cf3289797b40f4c43ed 100644 --- a/module/Soutenance/view/soutenance/proposition/afficher-soutenances-par-ecole-doctorale.phtml +++ b/module/Soutenance/view/soutenance/proposition/afficher-soutenances-par-ecole-doctorale.phtml @@ -12,7 +12,7 @@ use These\Entity\Db\Acteur; use Structure\Entity\Db\EcoleDoctorale; use Soutenance\Entity\Proposition; -$this->headTitle("Soutenances autorisées pour l'école doctorale [".$ecole->getSigle()."] " . $ecole->getLibelle()); +$this->headTitle("Soutenances autorisées pour l'école doctorale [".$ecole->getStructure()->getSigle()."] " . $ecole->getStructure()->getLibelle()); $count = count($soutenances); ?> @@ -28,7 +28,7 @@ $count = count($soutenances); <div id="content" class="col-12 col-md-10"> <h1 class="page-header"> Soutenances autorisées pour l'école doctorale <br/> - [<?php echo $ecole->getSigle(); ?>] <?php echo $ecole->getLibelle(); ?> + [<?php echo $ecole->getStructure()->getSigle(); ?>] <?php echo $ecole->getStructure()->getLibelle(); ?> </h1> <?php if ($count > 0) : ?> diff --git a/module/Soutenance/view/soutenance/proposition/declaration-non-plagiat.phtml b/module/Soutenance/view/soutenance/proposition/declaration-non-plagiat.phtml index 80cfd90cf38bac1ce5ced5ef102810cb68fd1401..778786d79ac959b7d4aa87bed7a279672d265465 100644 --- a/module/Soutenance/view/soutenance/proposition/declaration-non-plagiat.phtml +++ b/module/Soutenance/view/soutenance/proposition/declaration-non-plagiat.phtml @@ -39,7 +39,7 @@ if (!empty($acteurs)) { $unite = "unité de recherche non renseignée"; $ur = $these->getUniteRecherche(); if ($ur !== null) { - $unite = $ur->getLibelle() . " (" . $ur->getSigle() . ")"; + $unite = $ur->getStructure()->getLibelle() . " (" . $ur->getStructure()->getSigle() . ")"; } $canValider = $this->isAllowed($these, PropositionPrivileges::PROPOSITION_DECLARATION_HONNEUR_VALIDER); diff --git a/module/Soutenance/view/soutenance/proposition/partial/informations.phtml b/module/Soutenance/view/soutenance/proposition/partial/informations.phtml index 9eb3930a79f1ea7872c74f8fd53f5ad5fe05810f..be0e1ff88919fb7958293bbd175e9fd2f5f460c9 100644 --- a/module/Soutenance/view/soutenance/proposition/partial/informations.phtml +++ b/module/Soutenance/view/soutenance/proposition/partial/informations.phtml @@ -73,7 +73,7 @@ $etablissement = $these->getEtablissement(); <?php if (!$unite) : ?> <strong class="text-danger">Aucune unité de recherche !</strong> <?php else : ?> - <?php echo $unite->getLibelle(); ?> + <?php echo $unite->getStructure()->getLibelle(); ?> <?php if (empty($uniteResponsables)) : ?> <div class="alert alert-danger"> <span class="icon icon-attention"></span> Aucun reponsable de site @@ -95,7 +95,7 @@ $etablissement = $these->getEtablissement(); <?php if (!$ecole) : ?> <strong class="text-danger">Aucune école doctorale !</strong> <?php else : ?> - <?php echo $ecole->getLibelle(); ?> + <?php echo $ecole->getStructure()->getLibelle(); ?> <?php if (empty($ecoleResponsables)) : ?> <div class="alert alert-danger"> <span class="icon icon-attention"></span> Aucun reponsable de site @@ -117,7 +117,7 @@ $etablissement = $these->getEtablissement(); <?php if (!$ecole) : ?> <strong class="text-danger">Aucun établissement !</strong> <?php else : ?> - <?php echo $etablissement->getLibelle(); ?> + <?php echo $etablissement->getStructure()->getLibelle(); ?> <?php if (empty($etablissementResponsables)) : ?> <div class="alert alert-danger"> <span class="icon icon-attention"></span> Aucun reponsable de site diff --git a/module/Soutenance/view/soutenance/proposition/partial/validations-structures.phtml b/module/Soutenance/view/soutenance/proposition/partial/validations-structures.phtml index 0883fe209e66e4a1118f363c1b1f6fa2273106dd..ca1ac6a84d42f45cc67d7c0f0260ccbe3bcd246d 100644 --- a/module/Soutenance/view/soutenance/proposition/partial/validations-structures.phtml +++ b/module/Soutenance/view/soutenance/proposition/partial/validations-structures.phtml @@ -29,7 +29,7 @@ $these = $proposition->getThese(); <ul> <li> <?php if ($these->getUniteRecherche()) : ?> - <?php echo $these->getUniteRecherche()->getLibelle(); ?> (Unité de recherche) <br/> + <?php echo $these->getUniteRecherche()->getStructure()->getLibelle(); ?> (Unité de recherche) <br/> <?php else: ?> <strong style="color:darkred;"> Libellé complémentaire : @@ -53,7 +53,7 @@ $these = $proposition->getThese(); </li> <li> <?php if ($these->getEcoleDoctorale()) : ?> - <?php echo $these->getEcoleDoctorale()->getLibelle(); ?> (École Doctorale) <br/> + <?php echo $these->getEcoleDoctorale()->getStructure()->getLibelle(); ?> (École Doctorale) <br/> <?php else: ?> <strong style="color:darkred;"> Aucune @@ -71,7 +71,7 @@ $these = $proposition->getThese(); <?php endif; ?> </li> <li> - <?php echo $these->getEtablissement()->getLibelle(); ?> + <?php echo $these->getEtablissement()->getStructure()->getLibelle(); ?> (Signature de la proposition de soutenance par la direction de l'établissement) <br/> <?php if ($validations[Role::CODE_BDD]) : ?> <?php $validation = current($validations[Role::CODE_BDD]); ?> diff --git a/module/Structure/src/Structure/Controller/EcoleDoctoraleController.php b/module/Structure/src/Structure/Controller/EcoleDoctoraleController.php index ae9153ebe5a0e58be847a9e7e30f61db7cfdb1af..9a8af4ceaf24841edb724a7d7ce6e7207479bb2f 100644 --- a/module/Structure/src/Structure/Controller/EcoleDoctoraleController.php +++ b/module/Structure/src/Structure/Controller/EcoleDoctoraleController.php @@ -106,8 +106,8 @@ class EcoleDoctoraleController extends StructureConcreteController foreach ($unites as $unite) { $result[] = array( 'id' => $unite->getId(), // identifiant unique de l'item - 'label' => $unite->getLibelle(), // libellé de l'item - 'extra' => $unite->getSigle(), // infos complémentaires (facultatives) sur l'item + 'label' => $unite->getStructure()->getLibelle(), // libellé de l'item + 'extra' => $unite->getStructure()->getSigle(), // infos complémentaires (facultatives) sur l'item ); } usort($result, function ($a, $b) { diff --git a/module/Structure/src/Structure/Controller/EtablissementController.php b/module/Structure/src/Structure/Controller/EtablissementController.php index 14de12b0c7b04de5041ff0d4d1bec21f06730b7c..e6a785ed00f21d3ecba5adc8142c7ff7c02d53eb 100644 --- a/module/Structure/src/Structure/Controller/EtablissementController.php +++ b/module/Structure/src/Structure/Controller/EtablissementController.php @@ -106,7 +106,7 @@ class EtablissementController extends StructureConcreteController 'etablissement' => $etablissement, 'roleListing' => $roleListings, 'individuListing' => $individuListings, - 'logoContent' => $this->structureService->getLogoStructureContent($etablissement), + 'logoContent' => $this->structureService->getLogoStructureContent($etablissement->getStructure()), 'contenus' => $contenus, ]); } @@ -151,8 +151,8 @@ class EtablissementController extends StructureConcreteController foreach ($unites as $unite) { $result[] = array( 'id' => $unite->getId(), // identifiant unique de l'item - 'label' => $unite->getLibelle(), // libellé de l'item - 'extra' => $unite->getSigle(), // infos complémentaires (facultatives) sur l'item + 'label' => $unite->getStructure()->getLibelle(), // libellé de l'item + 'extra' => $unite->getStructure()->getSigle(), // infos complémentaires (facultatives) sur l'item ); } usort($result, function ($a, $b) { diff --git a/module/Structure/src/Structure/Controller/Factory/EcoleDoctoraleControllerFactory.php b/module/Structure/src/Structure/Controller/Factory/EcoleDoctoraleControllerFactory.php index e323f116a9fb602d0e9a197b98a5e74601828a1d..27c2b0a41cdbfd0faf49f8ae66ebefec24989049 100644 --- a/module/Structure/src/Structure/Controller/Factory/EcoleDoctoraleControllerFactory.php +++ b/module/Structure/src/Structure/Controller/Factory/EcoleDoctoraleControllerFactory.php @@ -21,7 +21,7 @@ class EcoleDoctoraleControllerFactory * @throws \Psr\Container\ContainerExceptionInterface * @throws \Psr\Container\NotFoundExceptionInterface */ - public function __invoke(ContainerInterface $container) + public function __invoke(ContainerInterface $container): EcoleDoctoraleController { /** @var EcoleDoctoraleForm $form */ $form = $container->get('FormElementManager')->get('EcoleDoctoraleForm'); diff --git a/module/Structure/src/Structure/Controller/Factory/EtablissementControllerFactory.php b/module/Structure/src/Structure/Controller/Factory/EtablissementControllerFactory.php index aa6b0c2b31f32cd2d31ed473084436412cc3b7cd..21829c4b9f627482e28d0409258611b09b61b931 100644 --- a/module/Structure/src/Structure/Controller/Factory/EtablissementControllerFactory.php +++ b/module/Structure/src/Structure/Controller/Factory/EtablissementControllerFactory.php @@ -2,24 +2,22 @@ namespace Structure\Controller\Factory; +use Application\Service\Role\RoleService; +use Individu\Service\IndividuService; +use Interop\Container\ContainerInterface; use Structure\Controller\EtablissementController; use Structure\Form\EtablissementForm; use Structure\Service\Etablissement\EtablissementService; -use Individu\Service\IndividuService; -use Application\Service\Role\RoleService; use Structure\Service\Structure\StructureService; use Structure\Service\StructureDocument\StructureDocumentService; -use Interop\Container\ContainerInterface; class EtablissementControllerFactory { /** - * Create service - * - * @param ContainerInterface $container - * @return EtablissementController + * @throws \Psr\Container\ContainerExceptionInterface + * @throws \Psr\Container\NotFoundExceptionInterface */ - public function __invoke(ContainerInterface $container) + public function __invoke(ContainerInterface $container): EtablissementController { /** @var EtablissementForm $form */ $form = $container->get('FormElementManager')->get('EtablissementForm'); diff --git a/module/Structure/src/Structure/Controller/Factory/StructureControllerFactory.php b/module/Structure/src/Structure/Controller/Factory/StructureControllerFactory.php index 4f05ac86d5446ec84763f1701957d7779fb4d2f6..f7b844789a1959f2bd5f9b5548f1efeae9083230 100644 --- a/module/Structure/src/Structure/Controller/Factory/StructureControllerFactory.php +++ b/module/Structure/src/Structure/Controller/Factory/StructureControllerFactory.php @@ -2,27 +2,25 @@ namespace Structure\Controller\Factory; +use Application\Service\Role\RoleService; +use Fichier\Service\Fichier\FichierService; +use Fichier\Service\NatureFichier\NatureFichierService; +use Individu\Service\IndividuService; +use Interop\Container\ContainerInterface; use Structure\Controller\StructureController; use Structure\Service\EcoleDoctorale\EcoleDoctoraleService; use Structure\Service\Etablissement\EtablissementService; -use Fichier\Service\Fichier\FichierService; -use Individu\Service\IndividuService; -use Fichier\Service\NatureFichier\NatureFichierService; -use Application\Service\Role\RoleService; use Structure\Service\Structure\StructureService; use Structure\Service\StructureDocument\StructureDocumentService; use Structure\Service\UniteRecherche\UniteRechercheService; -use Interop\Container\ContainerInterface; class StructureControllerFactory { /** - * Create service - * - * @param ContainerInterface $container - * @return StructureController + * @throws \Psr\Container\ContainerExceptionInterface + * @throws \Psr\Container\NotFoundExceptionInterface */ - public function __invoke(ContainerInterface $container) + public function __invoke(ContainerInterface $container): StructureController { /** * @var IndividuService $individuService @@ -57,7 +55,6 @@ class StructureControllerFactory $controller->setFichierService($fichierService); $controller->setStructureDocumentService($structureDocumentService); - return $controller; } } \ No newline at end of file diff --git a/module/Structure/src/Structure/Controller/Factory/SubstitutionControllerFactory.php b/module/Structure/src/Structure/Controller/Factory/SubstitutionControllerFactory.php index 055b9d4e40f70201ecf75c7782069ddd87858e4e..2d17804a7fda1ddd368b8bd6c65002557d40b040 100644 --- a/module/Structure/src/Structure/Controller/Factory/SubstitutionControllerFactory.php +++ b/module/Structure/src/Structure/Controller/Factory/SubstitutionControllerFactory.php @@ -2,24 +2,22 @@ namespace Structure\Controller\Factory; +use Application\SourceCodeStringHelper; +use Doctrine\ORM\EntityManager; +use Interop\Container\ContainerInterface; use Structure\Controller\SubstitutionController; use Structure\Service\EcoleDoctorale\EcoleDoctoraleService; use Structure\Service\Etablissement\EtablissementService; use Structure\Service\Structure\StructureService; use Structure\Service\UniteRecherche\UniteRechercheService; -use Application\SourceCodeStringHelper; -use Doctrine\ORM\EntityManager; -use Interop\Container\ContainerInterface; class SubstitutionControllerFactory { /** - * Create service - * - * @param ContainerInterface $container - * @return SubstitutionController + * @throws \Psr\Container\ContainerExceptionInterface + * @throws \Psr\Container\NotFoundExceptionInterface */ - public function __invoke(ContainerInterface $container) + public function __invoke(ContainerInterface $container): SubstitutionController { /** * @var EntityManager $entityManager diff --git a/module/Structure/src/Structure/Controller/Factory/UniteRechercheControllerFactory.php b/module/Structure/src/Structure/Controller/Factory/UniteRechercheControllerFactory.php index fb9e7cb3f8679f4a961a3e8315c5a9dbc2d7a5d3..10dde5cd832a099dbef76f3fa44d9ab4feab56a8 100644 --- a/module/Structure/src/Structure/Controller/Factory/UniteRechercheControllerFactory.php +++ b/module/Structure/src/Structure/Controller/Factory/UniteRechercheControllerFactory.php @@ -2,29 +2,26 @@ namespace Structure\Controller\Factory; +use Application\Service\DomaineScientifiqueService; +use Application\Service\Role\RoleService; +use Interop\Container\ContainerInterface; use Structure\Controller\UniteRechercheController; use Structure\Form\UniteRechercheForm; -use These\Service\CoEncadrant\CoEncadrantService; -use Application\Service\DomaineScientifiqueService; use Structure\Service\Etablissement\EtablissementServiceLocateTrait; -use Individu\Service\Individu\IndividuService; -use Application\Service\Role\RoleService; use Structure\Service\Structure\StructureService; use Structure\Service\StructureDocument\StructureDocumentService; use Structure\Service\UniteRecherche\UniteRechercheService; -use Interop\Container\ContainerInterface; +use These\Service\CoEncadrant\CoEncadrantService; class UniteRechercheControllerFactory { use EtablissementServiceLocateTrait; /** - * Create service - * - * @param ContainerInterface $container - * @return UniteRechercheController + * @throws \Psr\Container\ContainerExceptionInterface + * @throws \Psr\Container\NotFoundExceptionInterface */ - public function __invoke(ContainerInterface $container) + public function __invoke(ContainerInterface $container): UniteRechercheController { /** @var UniteRechercheForm $form */ $form = $container->get('FormElementManager')->get('UniteRechercheForm'); @@ -32,7 +29,6 @@ class UniteRechercheControllerFactory /** * @var CoEncadrantService $coEncadrantService * @var UniteRechercheService $uniteRechercheService - * @var IndividuService $individuService * @var RoleService $roleService * @var StructureService $structureService * @var DomaineScientifiqueService $domaineService diff --git a/module/Structure/src/Structure/Controller/StructureConcreteController.php b/module/Structure/src/Structure/Controller/StructureConcreteController.php index 33c076aeff7d147a8810a416c331e1a2c5a2d637..0ad622964ae26b38c6b1c79df2efd3ad5c51f451 100644 --- a/module/Structure/src/Structure/Controller/StructureConcreteController.php +++ b/module/Structure/src/Structure/Controller/StructureConcreteController.php @@ -7,6 +7,7 @@ use Structure\Entity\Db\EcoleDoctorale; use Individu\Entity\Db\Individu; use Individu\Entity\Db\IndividuRole; use Application\Entity\Db\Role; +use Structure\Entity\Db\Etablissement; use Structure\Entity\Db\StructureConcreteInterface; use Structure\Entity\Db\TypeStructure; use Structure\Entity\Db\UniteRecherche; @@ -121,7 +122,7 @@ abstract class StructureConcreteController extends AbstractController 'structure' => $structureConcrete, 'roleListing' => $roleListings, 'individuRoles' => $individuRoles, - 'logoContent' => $this->structureService->getLogoStructureContent($structureConcrete), + 'logoContent' => $this->structureService->getLogoStructureContent($structureConcrete->getStructure()), ]); } @@ -135,21 +136,19 @@ abstract class StructureConcreteController extends AbstractController */ public function modifierAction() { - /** @var UniteRecherche $structureConcrete */ $structureId = $this->params()->fromRoute("structure"); $structureConcrete = $this->getStructureConcreteService()->getRepository()->findByStructureId($structureId); $this->structureForm->bind($structureConcrete); - // si POST alors on revient du formulaire - if ($data = $this->params()->fromPost()) { + $request = $this->getRequest(); + if ($request->isPost()) { // récupération des données et des fichiers - $request = $this->getRequest(); $data = $request->getPost()->toArray(); $file = $request->getFiles()->toArray(); // action de modification - $cheminLogo = $structureConcrete->getCheminLogo(); + $cheminLogo = $structureConcrete->getStructure()->getCheminLogo(); $this->structureForm->setData($data); if ($this->structureForm->isValid()) { @@ -157,9 +156,10 @@ abstract class StructureConcreteController extends AbstractController if ($file['cheminLogo']['tmp_name'] !== '') { $this->ajouterLogoStructure($file['cheminLogo']['tmp_name']); } else { - $structureConcrete->setCheminLogo($cheminLogo); + $structureConcrete->getStructure()->setCheminLogo($cheminLogo); } // mise à jour des données relatives aux structures + /** @var EcoleDoctorale|Etablissement|UniteRecherche $structureConcrete */ $structureConcrete = $this->structureForm->getData(); $this->getStructureConcreteService()->update($structureConcrete); @@ -172,17 +172,11 @@ abstract class StructureConcreteController extends AbstractController return $this->redirect()->toRoute($this->routeName, [], ['query' => ['selected' => $structureId]], true); } - $viewModel = new ViewModel([ + return new ViewModel([ 'structure' => $structureConcrete, - 'form' => $this->structureForm, -// 'etablissements' => $etablissements, -// 'etablissementsRattachements' => $etablissementsRattachements, -// 'domainesAssocies' => $unite->getDomaines(), -// 'domainesScientifiques' => $domaineScientifiques, - 'logoContent' => $this->structureService->getLogoStructureContent($structureConcrete), + 'form' => $this->structureForm, + 'logoContent' => $this->structureService->getLogoStructureContent($structureConcrete->getStructure()), ]); - - return $viewModel; } /** @@ -190,16 +184,16 @@ abstract class StructureConcreteController extends AbstractController */ public function ajouterAction() { - if ($data = $this->params()->fromPost()) { + $request = $this->getRequest(); + if ($request->isPost()) { // récupération des données et des fichiers - $request = $this->getRequest(); $data = $request->getPost()->toArray(); $file = $request->getFiles()->toArray(); $this->structureForm->setData($data); if ($this->structureForm->isValid()) { - /** @var EcoleDoctorale $structureConcrete */ + /** @var EcoleDoctorale|Etablissement|UniteRecherche $structureConcrete */ $structureConcrete = $this->structureForm->getData(); $structureConcrete = $this->getStructureConcreteService()->create($structureConcrete, $this->userContextService->getIdentityDb()); @@ -221,11 +215,9 @@ abstract class StructureConcreteController extends AbstractController $this->structureForm->setAttribute('action', $this->url()->fromRoute($this->routeName . '/ajouter')); - $viewModel = new ViewModel([ + return new ViewModel([ 'form' => $this->structureForm, ]); - - return $viewModel; } /** @@ -285,7 +277,7 @@ abstract class StructureConcreteController extends AbstractController $structure = $this->getStructureConcreteService()->getRepository()->findByStructureId($structureId); try { - $fileDeleted = $this->structureService->deleteLogoStructure($structure); + $fileDeleted = $this->structureService->deleteLogoStructure($structure->getStructure(false)); } catch (RuntimeException $e) { $this->flashMessenger()->addErrorMessage( "Erreur lors de l'effacement du logo de la structure '$structure' : " . $e->getMessage()); @@ -305,10 +297,10 @@ abstract class StructureConcreteController extends AbstractController * - modification du chemin en bdd * - création du fichier sur le serveur. * - * @param string $cheminLogoUploade chemin vers le fichier temporaire associé au logo - * @param StructureConcreteInterface $structure + * @param string $cheminLogoUploade chemin vers le fichier temporaire associé au logo + * @param \Structure\Entity\Db\StructureConcreteInterface|null $structure */ - protected function ajouterLogoStructure($cheminLogoUploade, StructureConcreteInterface $structure = null) + protected function ajouterLogoStructure(string $cheminLogoUploade, StructureConcreteInterface $structure = null) { if ($structure === null) { $structureId = $this->params()->fromRoute("structure"); @@ -316,7 +308,7 @@ abstract class StructureConcreteController extends AbstractController } try { - $this->structureService->updateLogoStructure($structure, $cheminLogoUploade); + $this->structureService->updateLogoStructure($structure->getStructure(false), $cheminLogoUploade); } catch (RuntimeException $e) { $this->flashMessenger()->addErrorMessage( "Erreur lors de l'enregistrement du logo de la structure '$structure' : " . $e->getMessage()); diff --git a/module/Structure/src/Structure/Controller/SubstitutionController.php b/module/Structure/src/Structure/Controller/SubstitutionController.php index f5fb477dd38a40650e463e138daa54c3b182a8cf..adb262364f1ff458d49111687f925c90ae3207f4 100644 --- a/module/Structure/src/Structure/Controller/SubstitutionController.php +++ b/module/Structure/src/Structure/Controller/SubstitutionController.php @@ -3,17 +3,17 @@ namespace Structure\Controller; use Application\Controller\AbstractController; +use Application\SourceCodeStringHelperAwareTrait; +use Laminas\Http\Response; +use Laminas\View\Model\ViewModel; use Structure\Entity\Db\Structure; use Structure\Entity\Db\StructureConcreteInterface; -use Structure\Entity\Db\StructureInterface; use Structure\Entity\Db\TypeStructure; use Structure\Service\EcoleDoctorale\EcoleDoctoraleServiceAwareTrait; use Structure\Service\Etablissement\EtablissementServiceAwareTrait; use Structure\Service\Structure\StructureServiceAwareTrait; use Structure\Service\UniteRecherche\UniteRechercheServiceAwareTrait; -use Application\SourceCodeStringHelperAwareTrait; use UnicaenApp\Service\EntityManagerAwareTrait; -use Laminas\View\Model\ViewModel; class SubstitutionController extends AbstractController { @@ -68,7 +68,7 @@ class SubstitutionController extends AbstractController // récupération des structures sources $sources = []; foreach ($data['sourceIds'] as $sourceId) { - $structureConcrete = $this->getStructureService()->getStructuresConcreteByTypeAndStructureId($type, $sourceId); + $structureConcrete = $this->getStructureService()->getStructureConcreteByTypeAndStructureId($type, $sourceId); $sources[] = $structureConcrete; } @@ -84,10 +84,8 @@ class SubstitutionController extends AbstractController $this->structureService->updateStructureSubstitutions($sources, $structureCible->getStructure()); } - $message = "La substitution <strong>" . $structureCible->getLibelle() . "</strong> vient d'être créée. Elle regroupe les structures : "; - $message .= implode(", ", array_map(function (StructureConcreteInterface $s) { - return "<i>" . $s->getLibelle() . "</i>"; - }, $sources)); + $message = "La structure substituante <strong>$structureCible</strong> a été créée. Elle regroupe les structures de type '$type' suivantes : "; + $message .= implode(", ", array_map(fn(StructureConcreteInterface $s) => sprintf("<i>%s (%d)</i>", $s, $s->getId()), $sources)); $this->flashMessenger()->addSuccessMessage($message); return $this->redirect()->toRoute('substitution-modifier', ['cible' => $structureCible->getStructure()->getId()], [], true); @@ -98,7 +96,6 @@ class SubstitutionController extends AbstractController } $vm = new ViewModel([ -// 'title' => "Création d'une substitution (".$type.")", 'cible' => $cible, 'structuresConcretesSubstituees' => $structuresConcretesSubstituees, 'structuresConcretes' => $structures, @@ -117,14 +114,7 @@ class SubstitutionController extends AbstractController $structureCible = $this->getStructureService()->findStructureSubsitutionCibleById($idCible); $type = $structureCible->getTypeStructure(); - $structuresSubstituees = $structureCible->getStructuresSubstituees(); - - $structuresConcretesSubstituees = []; - foreach ($structuresSubstituees as $structureSubstituee) { - $structureConcreteSubstituee = $this->getStructureService()->findStructureConcreteFromStructure($structureSubstituee); - $structuresConcretesSubstituees[] = $structureConcreteSubstituee; - } - + $structuresConcretesSubstituees = $structureCible->getStructuresConcretesSubstituees()->toArray(); $structures = $this->getStructureService()->getStructuresSubstituablesByType($type); $request = $this->getRequest(); @@ -134,7 +124,7 @@ class SubstitutionController extends AbstractController // récupération des structures sources $sources = []; foreach ($data['sourceIds'] as $sourceId) { - $structureConcrete = $this->getStructureService()->getStructuresConcreteByTypeAndStructureId($type, $sourceId); + $structureConcrete = $this->getStructureService()->getStructureConcreteByTypeAndStructureId($type, $sourceId); $sources[] = $structureConcrete; } @@ -142,34 +132,30 @@ class SubstitutionController extends AbstractController $this->structureService->updateFromPostData($structureCible, $data['cible']); $this->structureService->updateStructureSubstitutions($sources, $structureCible); - $message = "La substitution <strong>" . $structureCible->getLibelle() . "</strong> vient d'être mise à jour. Elle regroupe les structures : "; - $message .= implode(", ", array_map(function (StructureConcreteInterface $s) { - return "<i>" . $s->getLibelle() . "</i>"; - }, $sources)); + $message = "La structure substituante <strong>$structureCible</strong> a été mise à jour. Elle regroupe les structures de type '$type' suivantes : "; + $message .= implode(", ", array_map(fn(StructureConcreteInterface $s) => sprintf("<i>%s (%d)</i>", $s->getStructure(false)->getLibelle(), $s->getId()), $sources)); $this->flashMessenger()->addSuccessMessage($message); return $this->redirect()->toRoute(null, [], [], true); } return new ViewModel([ -// 'title' => "Modification d'une substitution (".$type.")", 'cible' => $structureCible, 'structuresConcretes' => $structures, 'structuresConcretesSubstituees' => $structuresConcretesSubstituees, 'structureCibleLogoContent' => $this->structureService->getLogoStructureContent($structureCible), - 'structuresConcretesSubstitueesLogosContents' => array_map(function (StructureInterface $structureConcreteSubstituee) { - return $this->structureService->getLogoStructureContent($structureConcreteSubstituee); + 'structuresConcretesSubstitueesLogosContents' => array_map(function (StructureConcreteInterface $structureConcreteSubstituee) { + return $this->structureService->getLogoStructureContent($structureConcreteSubstituee->getStructure(false)); }, $structuresConcretesSubstituees), ]); } /** Fonction de destruction */ - public function detruireAction() + public function detruireAction(): Response { $idCible = $this->params()->fromRoute('cible'); $structure = $this->structureService->findStructureById($idCible); - $cible = $this->structureService->findStructureConcreteFromStructure($structure); - $this->structureService->removeSubstitution($cible); + $this->structureService->removeSubstitution($structure->getStructureConcrete()); return $this->redirect()->toRoute('substitution-index', [], [], true); } @@ -183,7 +169,7 @@ class SubstitutionController extends AbstractController return new ViewModel([ 'structure' => $structureConcrete, - 'structureSourceLogoContent' => $this->structureService->getLogoStructureContent($structureConcrete), + 'structureSourceLogoContent' => $this->structureService->getLogoStructureContent($structureConcrete->getStructure(false)), ]); } @@ -193,13 +179,13 @@ class SubstitutionController extends AbstractController $typeStructure = ($code = $this->params()->fromRoute('type')) ? $this->structureService->fetchTypeStructure($code) : null; if ($typeStructure !== null) { - $substitutionsEcolesDoctorales = $typeStructure->isEcoleDoctorale() ? $this->structureService->checkStructure($typeStructure->getCode()) : null; - $substitutionsEtablissements = $typeStructure->isEtablissement() ? $this->structureService->checkStructure($typeStructure->getCode()) : null; - $substitutionsUnitesRecherches = $typeStructure->isUniteRecherche() ? $this->structureService->checkStructure($typeStructure->getCode()) : null; + $substitutionsEcolesDoctorales = $typeStructure->isEcoleDoctorale() ? $this->structureService->findStructuresSubstituablesSelonSourceCode($typeStructure->getCode()) : null; + $substitutionsEtablissements = $typeStructure->isEtablissement() ? $this->structureService->findStructuresSubstituablesSelonSourceCode($typeStructure->getCode()) : null; + $substitutionsUnitesRecherches = $typeStructure->isUniteRecherche() ? $this->structureService->findStructuresSubstituablesSelonSourceCode($typeStructure->getCode()) : null; } else { - $substitutionsEcolesDoctorales = $this->getStructureService()->checkStructure(TypeStructure::CODE_ECOLE_DOCTORALE); - $substitutionsEtablissements = $this->getStructureService()->checkStructure(TypeStructure::CODE_ETABLISSEMENT); - $substitutionsUnitesRecherches = $this->getStructureService()->checkStructure(TypeStructure::CODE_UNITE_RECHERCHE); + $substitutionsEcolesDoctorales = $this->getStructureService()->findStructuresSubstituablesSelonSourceCode(TypeStructure::CODE_ECOLE_DOCTORALE); + $substitutionsEtablissements = $this->getStructureService()->findStructuresSubstituablesSelonSourceCode(TypeStructure::CODE_ETABLISSEMENT); + $substitutionsUnitesRecherches = $this->getStructureService()->findStructuresSubstituablesSelonSourceCode(TypeStructure::CODE_UNITE_RECHERCHE); } return new ViewModel([ @@ -216,8 +202,8 @@ class SubstitutionController extends AbstractController $type = $this->params()->fromRoute('type'); $identifiant = $this->params()->fromRoute('identifiant'); - $structures = $this->getStructureService()->getStructuresBySuffixe($identifiant, $type); - + /** @var StructureConcreteInterface[] $sources */ + /** @var StructureConcreteInterface $cible */ $dictionnary = $this->getStructureService()->getSubstitutionDictionnary($identifiant, $type); $sources = $dictionnary["sources"]; $cible = $dictionnary["cible"]; @@ -227,9 +213,9 @@ class SubstitutionController extends AbstractController } else { /** @var StructureConcreteInterface $cible */ $cible = $this->getStructureService()->createStructureConcrete($type); - $cible->getStructure()->setLibelle($sources[0]->getLibelle()); - $cible->getStructure()->setSigle($sources[0]->getSigle()); - $cible->getStructure()->setCode($sources[0]->getCode()); + $cible->getStructure()->setLibelle($sources[0]->getStructure(false)->getLibelle()); + $cible->getStructure()->setSigle($sources[0]->getStructure(false)->getSigle()); + $cible->getStructure()->setCode($sources[0]->getStructure(false)->getCode()); $this->getStructureService()->createStructureSubstitutions($sources, $cible); } @@ -245,7 +231,7 @@ class SubstitutionController extends AbstractController $sources = $dictionnary["sources"]; $cible = $dictionnary["cible"]; - $structures = $this->getStructureService()->getAllStructuresAffichablesByType($type); + $structures = $this->getStructureService()->getStructuresSubstituablesByType($type); $request = $this->getRequest(); if ($request->isPost()) { @@ -260,18 +246,18 @@ class SubstitutionController extends AbstractController if ($cible === null) { /** @var StructureConcreteInterface $cible */ $cible = $this->getStructureService()->createStructureConcrete($type); - $cible->getStructure()->setLibelle($sources[0]->getLibelle()); - $cible->getStructure()->setSigle($sources[0]->getSigle()); - $cible->getStructure()->setCode($sources[0]->getCode()); + $cible->getStructure()->setLibelle($sources[0]->getStructure(false)->getLibelle()); + $cible->getStructure()->setSigle($sources[0]->getStructure(false)->getSigle()); + $cible->getStructure()->setCode($sources[0]->getStructure(false)->getCode()); $this->getStructureService()->createStructureSubstitutions($sources, $cible); } else { $this->structureService->updateFromPostData($cible, $data['cible']); $this->structureService->updateStructureSubstitutions($sources, $cible->getStructure()); } - $message = "La substitution <strong>" . $cible->getLibelle() . "</strong> vient d'être mise à jour. Elle regroupe les structures : "; + $message = "La substitution <strong>" . $cible->getStructure()->getLibelle() . "</strong> vient d'être mise à jour. Elle regroupe les structures : "; $message .= implode(", ", array_map(function (StructureConcreteInterface $s) { - return "<i>" . $s->getLibelle() . "</i>"; + return "<i>" . $s->getStructure(false)->getLibelle() . "</i>"; }, $sources)); $this->flashMessenger()->addSuccessMessage($message); @@ -291,7 +277,7 @@ class SubstitutionController extends AbstractController 'identifiant' => $identifiant, 'structuresConcretes' => $structures, 'structuresConcretesSubstituees' => $sources, - 'structureCibleLogoContent' => $this->structureService->getLogoStructureContent($cible), + 'structureCibleLogoContent' => $this->structureService->getLogoStructureContent($cible->getStructure(false)), ]); $vm->setTemplate('structure/substitution/modifier'); return $vm; diff --git a/module/Structure/src/Structure/Controller/UniteRechercheController.php b/module/Structure/src/Structure/Controller/UniteRechercheController.php index a3b0d5a441b34e8166de3ee6eb3aa67b7d805723..50cef67183817b6c2bbae1caede10869b22d3787 100644 --- a/module/Structure/src/Structure/Controller/UniteRechercheController.php +++ b/module/Structure/src/Structure/Controller/UniteRechercheController.php @@ -129,12 +129,13 @@ class UniteRechercheController extends StructureConcreteController if ($etablissementId == 0) { $this->flashMessenger()->addErrorMessage("Pour ajouter un établissement de rattachement, veuillez sélectionner un établissement."); } else { + /** @var \Structure\Entity\Db\Etablissement $etablissement */ $etablissement = $this->getEtablissementService()->getRepository()->find($etablissementId); if ($this->getUniteRechercheService()->existEtablissementRattachement($unite, $etablissement)) { - $this->flashMessenger()->addErrorMessage("L'établissement de rattachement <strong>" . $etablissement->getLibelle() . "</strong> n'a pas pu être ajouter car déjà enregistré comme établissement de rattachement de l'unité de recherche <strong>" . $unite->getLibelle() . "</strong>."); + $this->flashMessenger()->addErrorMessage("L'établissement de rattachement <strong>" . $etablissement->getLibelle() . "</strong> n'a pas pu être ajouter car déjà enregistré comme établissement de rattachement de l'unité de recherche <strong>" . $unite->getStructure()->getLibelle() . "</strong>."); } else { $this->getUniteRechercheService()->addEtablissementRattachement($unite, $etablissement); - $this->flashMessenger()->addSuccessMessage("L'établissement <strong>" . $etablissement->getLibelle() . "</strong> vient d'être ajouter comme établissement de rattachement de l'unité de recherche <strong>" . $unite->getLibelle() . "</strong>."); + $this->flashMessenger()->addSuccessMessage("L'établissement <strong>" . $etablissement->getLibelle() . "</strong> vient d'être ajouter comme établissement de rattachement de l'unité de recherche <strong>" . $unite->getStructure()->getLibelle() . "</strong>."); } } @@ -146,10 +147,11 @@ class UniteRechercheController extends StructureConcreteController $structureId = $this->params()->fromRoute("structure"); $unite = $this->getUniteRechercheService()->getRepository()->findByStructureId($structureId); $etablissementId = $this->params()->fromRoute("etablissement"); + /** @var \Structure\Entity\Db\Etablissement $etablissement */ $etablissement = $this->getEtablissementService()->getRepository()->find($etablissementId); $this->getUniteRechercheService()->removeEtablissementRattachement($unite, $etablissement); - $this->flashMessenger()->addSuccessMessage("L'établissement <strong>" . $etablissement->getLibelle() . "</strong> n'est plus un établissement de rattachement de l'unité de recherche <strong>" . $unite->getLibelle() . "</strong>."); + $this->flashMessenger()->addSuccessMessage("L'établissement <strong>" . $etablissement->getLibelle() . "</strong> n'est plus un établissement de rattachement de l'unité de recherche <strong>" . $unite->getStructure()->getLibelle() . "</strong>."); $this->redirect()->toRoute("unite-recherche/modifier", [], [], true); } @@ -170,7 +172,7 @@ class UniteRechercheController extends StructureConcreteController $this->getDomaineScientifiqueService()->updateDomaineScientifique($domaine); - $this->flashMessenger()->addSuccessMessage("Le domaine scientifique <strong>" . $domaine->getLibelle() . "</strong> est maintenant un des domaines scientifiques de l'unité de recherche <strong>" . $unite->getLibelle() . "</strong>."); + $this->flashMessenger()->addSuccessMessage("Le domaine scientifique <strong>" . $domaine->getLibelle() . "</strong> est maintenant un des domaines scientifiques de l'unité de recherche <strong>" . $unite->getStructure()->getLibelle() . "</strong>."); } $this->redirect()->toRoute("unite-recherche/modifier", [], [], true); } @@ -190,7 +192,7 @@ class UniteRechercheController extends StructureConcreteController $this->getDomaineScientifiqueService()->updateDomaineScientifique($domaine); - $this->flashMessenger()->addSuccessMessage("Le domaine scientifique <strong>" . $domaine->getLibelle() . "</strong> ne fait plus parti des domaines scientifiques de l'unité de recherche <strong>" . $unite->getLibelle() . "</strong>."); + $this->flashMessenger()->addSuccessMessage("Le domaine scientifique <strong>" . $domaine->getLibelle() . "</strong> ne fait plus parti des domaines scientifiques de l'unité de recherche <strong>" . $unite->getStructure()->getLibelle() . "</strong>."); return $this->redirect()->toRoute("unite-recherche/modifier", [], [], true); } @@ -203,8 +205,8 @@ class UniteRechercheController extends StructureConcreteController foreach ($unites as $unite) { $result[] = array( 'id' => $unite->getId(), // identifiant unique de l'item - 'label' => $unite->getLibelle(), // libellé de l'item - 'extra' => $unite->getSigle(), // infos complémentaires (facultatives) sur l'item + 'label' => $unite->getStructure()->getLibelle(), // libellé de l'item + 'extra' => $unite->getStructure()->getSigle(), // infos complémentaires (facultatives) sur l'item ); } usort($result, function ($a, $b) { diff --git a/module/Structure/src/Structure/Entity/Db/EcoleDoctorale.php b/module/Structure/src/Structure/Entity/Db/EcoleDoctorale.php index be3d550fdfeca2f3ed93a88cd744ba1cf00700e1..6c4987e2b2edc8f8e41e15c0118b7d4ea7c462d5 100644 --- a/module/Structure/src/Structure/Entity/Db/EcoleDoctorale.php +++ b/module/Structure/src/Structure/Entity/Db/EcoleDoctorale.php @@ -3,11 +3,11 @@ namespace Structure\Entity\Db; use Application\Search\Filter\SearchFilterValueInterface; -use UnicaenDbImport\Entity\Db\Traits\SourceAwareTrait; +use Laminas\Permissions\Acl\Resource\ResourceInterface; use UnicaenApp\Entity\HistoriqueAwareInterface; use UnicaenApp\Entity\HistoriqueAwareTrait; use UnicaenDbImport\Entity\Db\Interfaces\SourceAwareInterface; -use Laminas\Permissions\Acl\Resource\ResourceInterface; +use UnicaenDbImport\Entity\Db\Traits\SourceAwareTrait; /** * EcoleDoctorale @@ -93,67 +93,11 @@ class EcoleDoctorale * * @return string */ - public function getSourceCode() + public function getSourceCode(): ?string { return $this->sourceCode; } - /** - * @return string|null - */ - public function getCode(): ?string - { - return $this->structure->getCode(); - } - - /** - * @return string - */ - public function getLibelle() - { - return $this->getStructure()->getLibelle(); - } - - /** - * @param string $libelle - */ - public function setLibelle($libelle) - { - $this->getStructure()->setLibelle($libelle); - } - - /** - * @return string - */ - public function getCheminLogo() - { - return $this->getStructure()->getCheminLogo(); - } - - /** - * @param string $cheminLogo - */ - public function setCheminLogo($cheminLogo) - { - $this->getStructure()->setCheminLogo($cheminLogo); - } - - /** - * @return string - */ - public function getSigle() - { - return $this->getStructure()->getSigle(); - } - - /** - * @param string $sigle - */ - public function setSigle($sigle) - { - $this->getStructure()->setSigle($sigle); - } - /** * Retourne l'éventuelle école doctorale substituant celle-ci. * @@ -178,7 +122,7 @@ class EcoleDoctorale */ public function estTouteEcoleDoctoraleConfondue() { - return $this->getStructure()->getCode() === self::CODE_TOUTE_ECOLE_DOCTORALE_CONFONDUE; + return $this->structure->getCode() === self::CODE_TOUTE_ECOLE_DOCTORALE_CONFONDUE; } /** @@ -222,16 +166,16 @@ class EcoleDoctorale */ public function createSearchFilterValueOption(): array { - $estFermee = $this->getStructure()->estFermee(); + $estFermee = $this->structure->estFermee(); - $subtext = $this->getLibelle(); + $subtext = $this->structure->getLibelle(); if ($estFermee) { $subtext .= " - FERMÉE"; } return [ 'value' => $this->getSourceCode(), - 'label' => $this->getSigle(), + 'label' => $this->structure->getSigle(), 'subtext' => $subtext, 'class' => $estFermee ? 'fermee' : '', ]; diff --git a/module/Structure/src/Structure/Entity/Db/Etablissement.php b/module/Structure/src/Structure/Entity/Db/Etablissement.php index c96f9a457f11e16aa6eef989b27ba3906b942bf8..e6178ea42bc9991599d6157185eb887baad29e75 100644 --- a/module/Structure/src/Structure/Entity/Db/Etablissement.php +++ b/module/Structure/src/Structure/Entity/Db/Etablissement.php @@ -122,7 +122,7 @@ class Etablissement * * @return string */ - public function getSourceCode() + public function getSourceCode(): ?string { return $this->sourceCode; } @@ -143,38 +143,6 @@ class Etablissement $this->domaine = $domaine; } - /** - * @return string - */ - public function getLibelle() - { - return $this->getStructure()->getLibelle(); - } - - /** - * @param string $libelle - */ - public function setLibelle($libelle) - { - $this->getStructure()->setLibelle($libelle); - } - - /** - * @return string|null - */ - public function getSigle(): ?string - { - return $this->getStructure()->getSigle(); - } - - /** - * @param string|null $sigle - */ - public function setSigle(string $sigle = null) - { - $this->getStructure()->setSigle($sigle); - } - /** * @return bool */ @@ -250,22 +218,6 @@ class Etablissement return $this; } - /** - * @return string - */ - public function getCheminLogo() - { - return $this->getStructure()->getCheminLogo(); - } - - /** - * @param string $cheminLogo - */ - public function setCheminLogo($cheminLogo) - { - $this->getStructure()->setCheminLogo($cheminLogo); - } - /** * Retourne l'éventuel établissement substituant celui-ci. * @@ -314,7 +266,7 @@ class Etablissement */ public function estToutEtablissementConfondu() { - return $this->getStructure()->getCode() === self::CODE_TOUT_ETABLISSEMENT_CONFONDU; + return $this->structure->getCode() === self::CODE_TOUT_ETABLISSEMENT_CONFONDU; } /** @@ -322,8 +274,8 @@ class Etablissement */ public function createSearchFilterValueOption(): array { - $label = ($this->getCode() ?: $this->getSigle()) ?: $this->getLibelle(); - if ($this->getStructure()->estFermee()) { + $label = ($this->code ?: $this->structure->getSigle()) ?: $this->structure->getLibelle(); + if ($this->structure->estFermee()) { $label .= " FERMÉ"; } diff --git a/module/Structure/src/Structure/Entity/Db/Repository/EcoleDoctoraleRepository.php b/module/Structure/src/Structure/Entity/Db/Repository/EcoleDoctoraleRepository.php index 0a15c3acb6cbb5b89778ea4483d7d958ce75d3b2..579e44dc5670297ecd24649e590a6ffa3f645952 100644 --- a/module/Structure/src/Structure/Entity/Db/Repository/EcoleDoctoraleRepository.php +++ b/module/Structure/src/Structure/Entity/Db/Repository/EcoleDoctoraleRepository.php @@ -45,19 +45,35 @@ class EcoleDoctoraleRepository extends DefaultEntityRepository return $qb->getQuery()->getResult(); } - public function findByStructureId($id) + /** + * @return EcoleDoctorale[] + */ + public function findSubstituables(): array + { + $qb = $this->createQueryBuilder("ed"); + $qb + ->addSelect("typ") + ->leftJoin("structure.typeStructure", "typ") + ->addSelect("structuresSubstituees") + ->leftJoin("structure.structuresSubstituees", "structuresSubstituees") + ->andWhere('structure.estFermee = false') + ->andWhere('structureSubstituante IS NULL') + ->andWhere('structuresSubstituees IS NULL') + ->orderBy("structure.libelle"); + + return $qb->getQuery()->getResult(); + } + + public function findByStructureId($id): ?EcoleDoctorale { - /** @var EcoleDoctorale $ecole */ $qb = $this->createQueryBuilder("ed") ->andWhere("structure.id = :id") ->setParameter("id", $id); try { - $ecole = $qb->getQuery()->getOneOrNullResult(); + return $qb->getQuery()->getOneOrNullResult(); } catch (NonUniqueResultException $e) { throw new RuntimeException("EcoleDoctoraleRepository::findByStructureId(".$id.") retourne de multiples écoles doctorales !"); } - - return $ecole; } /** diff --git a/module/Structure/src/Structure/Entity/Db/Repository/EtablissementRepository.php b/module/Structure/src/Structure/Entity/Db/Repository/EtablissementRepository.php index bd705b7cf915af653030fee6a4b62959593dea40..5ac6511e8ab3a6be22ed0408e51f49319d80f078 100644 --- a/module/Structure/src/Structure/Entity/Db/Repository/EtablissementRepository.php +++ b/module/Structure/src/Structure/Entity/Db/Repository/EtablissementRepository.php @@ -92,6 +92,25 @@ class EtablissementRepository extends DefaultEntityRepository return $qb->getQuery()->getResult(); } + /** + * @return Etablissement[] + */ + public function findSubstituables(): array + { + $qb = $this->createQueryBuilder("ed"); + $qb + ->addSelect("typ") + ->leftJoin("structure.typeStructure", "typ") + ->addSelect("structuresSubstituees") + ->leftJoin("structure.structuresSubstituees", "structuresSubstituees") + ->andWhere('structure.estFermee = false') + ->andWhere('structureSubstituante IS NULL') + ->andWhere('structuresSubstituees IS NULL') + ->orderBy("structure.libelle"); + + return $qb->getQuery()->getResult(); + } + /** * @param string source * @param boolean $include (si 'true' alors seulement la source sinon tous sauf la source) @@ -176,18 +195,16 @@ class EtablissementRepository extends DefaultEntityRepository return $etab; } - public function findByStructureId($structureId) + public function findByStructureId($structureId): ?Etablissement { $qb = $this->createQueryBuilder("e") ->andWhere("structure.id = :structureId") ->setParameter("structureId", $structureId); try { - $etablissement = $qb->getQuery()->getOneOrNullResult(); + return $qb->getQuery()->getOneOrNullResult(); } catch (NonUniqueResultException $e) { throw new RuntimeException("Anomalie plusieurs établissements avec le même id.", 0, $e); } - - return $etablissement; } /** @@ -206,7 +223,7 @@ class EtablissementRepository extends DefaultEntityRepository * @param bool $cacheable * @return Etablissement[] */ - public function findAllEtablissementsInscriptions(bool $cacheable): array + public function findAllEtablissementsInscriptions(bool $cacheable = false): array { $qb = $this->createQueryBuilder("e") ->andWhere("e.estInscription = true") diff --git a/module/Structure/src/Structure/Entity/Db/Repository/UniteRechercheRepository.php b/module/Structure/src/Structure/Entity/Db/Repository/UniteRechercheRepository.php index 7617ae3a0c39c21ca759f51eb6d9e253437c7ed4..1b86517708031d8683bd20494c8a2c8f875be90b 100644 --- a/module/Structure/src/Structure/Entity/Db/Repository/UniteRechercheRepository.php +++ b/module/Structure/src/Structure/Entity/Db/Repository/UniteRechercheRepository.php @@ -46,6 +46,22 @@ class UniteRechercheRepository extends DefaultEntityRepository return $qb->getQuery()->getResult(); } + /** + * @return UniteRecherche[] + */ + public function findSubstituables(): array + { + $qb = $this->createQueryBuilder("ed"); + $qb + ->addSelect("typ") + ->join("structure.typeStructure", "typ") + ->andWhere('structureSubstituante IS NULL') + ->andWhere('structure.structuresSubstituees IS EMPTY') + ->orderBy("structure.libelle"); + + return $qb->getQuery()->getResult(); + } + /** * @param int|null $id * @return UniteRecherche|null @@ -67,19 +83,16 @@ class UniteRechercheRepository extends DefaultEntityRepository return $unite; } - public function findByStructureId($id) + public function findByStructureId($id): ?UniteRecherche { - /** @var UniteRecherche $unite */ $qb = $this->createQueryBuilder("u") ->andWhere("structure.id = :id") ->setParameter("id", $id); try { - $unite = $qb->getQuery()->getOneOrNullResult(); + return $qb->getQuery()->getOneOrNullResult(); } catch (NonUniqueResultException $e) { throw new RuntimeException("UniteRechercheRepository::findByStructureId(".$id.") retourne de multiples unités de recherches !"); } - - return $unite; } /** diff --git a/module/Structure/src/Structure/Entity/Db/Structure.php b/module/Structure/src/Structure/Entity/Db/Structure.php index 1bec18a5188734a1f3c98d7cea59f0981a3f127a..6f0ad50e0112db82014a9887cbb0bb06ef7bae8c 100644 --- a/module/Structure/src/Structure/Entity/Db/Structure.php +++ b/module/Structure/src/Structure/Entity/Db/Structure.php @@ -6,6 +6,7 @@ use Application\Entity\Db\Role; use Application\Entity\Db\Source; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; +use InvalidArgumentException; use UnicaenApp\Entity\HistoriqueAwareInterface; use UnicaenApp\Entity\HistoriqueAwareTrait; use UnicaenApp\Exception\LogicException; @@ -110,11 +111,11 @@ class Structure implements StructureInterface, HistoriqueAwareInterface, SourceA $structureRattach = new Structure(); $structureRattach->setTypeStructure($type); $structureRattach->setSource($source); - $structureRattach->setCheminLogo($data->getCheminLogo()); - $structureRattach->setLibelle($data->getLibelle()); - $structureRattach->setSigle($data->getSigle()); + $structureRattach->setCheminLogo($data->getStructure()->getCheminLogo()); + $structureRattach->setLibelle($data->getStructure()->getLibelle()); + $structureRattach->setSigle($data->getStructure()->getSigle()); $structureRattach->setSourceCode($data->getSourceCode()); - $structureRattach->setCode($data->getCode()); + $structureRattach->setCode($data->getStructure()->getCode()); // structure concrète switch (true) { @@ -296,7 +297,7 @@ class Structure implements StructureInterface, HistoriqueAwareInterface, SourceA /** * @return TypeStructure */ - public function getTypeStructure() + public function getTypeStructure(): TypeStructure { return $this->typeStructure; } @@ -305,23 +306,63 @@ class Structure implements StructureInterface, HistoriqueAwareInterface, SourceA * @param TypeStructure $typeStructure * @return self */ - public function setTypeStructure(TypeStructure $typeStructure) + public function setTypeStructure(TypeStructure $typeStructure): self { $this->typeStructure = $typeStructure; return $this; } + /** + * Retourne la Structure "concrète" correspondant à cette Structure "abstraite". + * + * @return \Structure\Entity\Db\StructureConcreteInterface + */ + public function getStructureConcrete(): StructureConcreteInterface + { + switch (true) { + case $this->typeStructure->isEtablissement(): + return $this->etablissement; + case $this->typeStructure->isEcoleDoctorale(): + return $this->ecoleDoctorale; + case $this->typeStructure->isUniteRecherche(): + return $this->uniteRecherche; + default: + throw new InvalidArgumentException("Type de structure inattendu"); + } + } + + /** + * Retourne l'éventuel Etablissement correspondant à cette Structure "abstraite", + * telle que défini par la jointure Doctrine. + * + * @see getStructureConcrete() + * @return \Structure\Entity\Db\Etablissement|null + */ public function getEtablissement(): ?Etablissement { return $this->etablissement; } + /** + * Retourne l'éventuelle EcoleDoctorale correspondant à cette Structure "abstraite", + * telle que définie par la jointure Doctrine. + * + * @see getStructureConcrete() + * @return \Structure\Entity\Db\EcoleDoctorale|null + */ public function getEcoleDoctorale(): ?EcoleDoctorale { return $this->ecoleDoctorale; } + /** + * Retourne l'éventuelle UniteRecherche correspondant à cette Structure "abstraite", + * telle que défini par la jointure Doctrine. + * + * @see getStructureConcrete() + * @return \Structure\Entity\Db\UniteRecherche|null + */ public function getUniteRecherche(): ?UniteRecherche { return $this->uniteRecherche; @@ -330,13 +371,25 @@ class Structure implements StructureInterface, HistoriqueAwareInterface, SourceA /** * Retourne les éventuelles structures substituées par celle-ci. * - * @return \Doctrine\Common\Collections\Collection + * @see getStructuresConcretesSubstituees() + * @return \Doctrine\Common\Collections\Collection|\Structure\Entity\Db\Structure[] */ public function getStructuresSubstituees(): Collection { return $this->structuresSubstituees; } + /** + * Retourne les éventuelles structures "concrètes" substituées par celle-ci. + * + * @see getStructuresSubstituees() + * @return \Doctrine\Common\Collections\Collection|\Structure\Entity\Db\StructureConcreteInterface[] + */ + public function getStructuresConcretesSubstituees(): Collection + { + return $this->structuresSubstituees->map(fn(Structure $s) => $s->getStructureConcrete()); + } + /** * Retourne l'éventuelle "structure substituante", càd qui substitue celle-ci. * diff --git a/module/Structure/src/Structure/Entity/Db/StructureConcreteInterface.php b/module/Structure/src/Structure/Entity/Db/StructureConcreteInterface.php index f58d72a9c7f9d3011b4fa77a0c9db94be6c402ec..96ee6cb9afd660b5e99a1f890892ec596128442a 100644 --- a/module/Structure/src/Structure/Entity/Db/StructureConcreteInterface.php +++ b/module/Structure/src/Structure/Entity/Db/StructureConcreteInterface.php @@ -2,8 +2,30 @@ namespace Structure\Entity\Db; -interface StructureConcreteInterface extends StructureInterface +use Application\Entity\Db\Source; + +interface StructureConcreteInterface { + /** + * @return string + */ + public function __toString(); + + /** + * @return string + */ + public function getId(); + + /** + * @return string + */ + public function getSourceCode(); + + /** + * @return Source + */ + public function getSource(); + /** * @param Structure $structure * @return self @@ -11,7 +33,10 @@ interface StructureConcreteInterface extends StructureInterface public function setStructure(Structure $structure): self; /** - * @return Structure + * Retourne l'éventuelle structure liée *ou son substitut le cas échéant*. + * + * @param bool $returnSubstitIfExists À true, retourne la structure substituante s'il y en a une ; sinon la structure d'origine. + * @return Structure|null */ - public function getStructure(): ?Structure; + public function getStructure(bool $returnSubstitIfExists = true): ?Structure; } \ No newline at end of file diff --git a/module/Structure/src/Structure/Entity/Db/StructureInterface.php b/module/Structure/src/Structure/Entity/Db/StructureInterface.php index a7103c793ff62e90aefb2d8e1cdec3aa5a7f0b6d..2181b364f6aacb2b9889fba905e87f68a66c8603 100644 --- a/module/Structure/src/Structure/Entity/Db/StructureInterface.php +++ b/module/Structure/src/Structure/Entity/Db/StructureInterface.php @@ -11,11 +11,6 @@ interface StructureInterface */ public function getId(); - /** - * @return string - */ - public function getSigle(); - /** * @return string */ @@ -31,6 +26,11 @@ interface StructureInterface */ public function getLibelle(); + /** + * @return string + */ + public function getSigle(); + /** * SPécifie le Nom du fichier (pas le chemin!) * diff --git a/module/Structure/src/Structure/Entity/Db/StructureSubstit.php b/module/Structure/src/Structure/Entity/Db/StructureSubstit.php index fc80356c94d564539f0b45c18188d3b69c95beab..6852f1b67f6ee5aac0f2290ccd534d262bd621ef 100644 --- a/module/Structure/src/Structure/Entity/Db/StructureSubstit.php +++ b/module/Structure/src/Structure/Entity/Db/StructureSubstit.php @@ -31,7 +31,7 @@ class StructureSubstit implements HistoriqueAwareInterface /** * StructureSubstit factory. * - * @param Structure[] $structuresSources + * @param \Structure\Entity\Db\StructureConcreteInterface[]\Structure\Entity\Db\StructureInterface[] $structuresSources * @param Structure $structureCible * @return self[] */ diff --git a/module/Structure/src/Structure/Entity/Db/UniteRecherche.php b/module/Structure/src/Structure/Entity/Db/UniteRecherche.php index aeb3ccfa734d412915bd5e65d5ea49beddaf0476..b48608398895183ff59651be6fd2018dcf174ada 100644 --- a/module/Structure/src/Structure/Entity/Db/UniteRecherche.php +++ b/module/Structure/src/Structure/Entity/Db/UniteRecherche.php @@ -3,13 +3,13 @@ namespace Structure\Entity\Db; use Application\Entity\Db\DomaineScientifique; -use These\Entity\Db\These; use Application\Search\Filter\SearchFilterValueInterface; -use UnicaenDbImport\Entity\Db\Traits\SourceAwareTrait; +use Laminas\Permissions\Acl\Resource\ResourceInterface; +use These\Entity\Db\These; use UnicaenApp\Entity\HistoriqueAwareInterface; use UnicaenApp\Entity\HistoriqueAwareTrait; use UnicaenDbImport\Entity\Db\Interfaces\SourceAwareInterface; -use Laminas\Permissions\Acl\Resource\ResourceInterface; +use UnicaenDbImport\Entity\Db\Traits\SourceAwareTrait; /** * UniteRecherche @@ -46,12 +46,8 @@ class UniteRecherche */ protected $domaines; - /** @var string RNSR */ protected $RNSR; - /** - * UniteRecherche constructor. - */ /** @var These[] */ private $theses; @@ -107,67 +103,11 @@ class UniteRecherche * * @return string */ - public function getSourceCode() + public function getSourceCode(): ?string { return $this->sourceCode; } - /** - * @return string - */ - public function getCode(): ?string - { - return $this->structure->getCode(); - } - - /** - * @return string - */ - public function getLibelle() - { - return $this->getStructure()->getLibelle(); - } - - /** - * @param string $libelle - */ - public function setLibelle($libelle) - { - $this->getStructure()->setLibelle($libelle); - } - - /** - * @return string - */ - public function getCheminLogo() - { - return $this->getStructure()->getCheminLogo(); - } - - /** - * @param string $cheminLogo - */ - public function setCheminLogo($cheminLogo) - { - $this->getStructure()->setCheminLogo($cheminLogo); - } - - /** - * @return string - */ - public function getSigle() - { - return $this->getStructure()->getSigle(); - } - - /** - * @param string $sigle - */ - public function setSigle($sigle) - { - $this->getStructure()->setSigle($sigle); - } - /** * @return string */ @@ -282,16 +222,16 @@ class UniteRecherche */ public function createSearchFilterValueOption(): array { - $estFermee = $this->getStructure()->estFermee(); + $estFermee = $this->structure->estFermee(); - $subtext = $this->getLibelle(); + $subtext = $this->structure->getLibelle(); if ($estFermee) { $subtext .= " - FERMÉE"; } return [ 'value' => $this->getSourceCode(), - 'label' => $this->getSigle(), + 'label' => $this->structure->getSigle(), 'subtext' => $subtext, 'class' => $estFermee ? 'fermee' : '', ]; diff --git a/module/Structure/src/Structure/Form/Hydrator/StructureHydrator.php b/module/Structure/src/Structure/Form/Hydrator/StructureHydrator.php index 9a3e1c2c5a9d3d943ed796fb5088230e87169338..3a311d950735a322d975cce19e1c61dc296c35e6 100644 --- a/module/Structure/src/Structure/Form/Hydrator/StructureHydrator.php +++ b/module/Structure/src/Structure/Form/Hydrator/StructureHydrator.php @@ -15,10 +15,10 @@ abstract class StructureHydrator extends DoctrineObject { $data = parent::extract($structure); - $data['libelle'] = $structure->getLibelle(); + $data['libelle'] = $structure->getStructure()->getLibelle(); $data['code'] = $structure->getStructure()->getCode(); - $data['sigle'] = $structure->getSigle(); - $data['cheminLogo'] = $structure->getCheminLogo(); + $data['sigle'] = $structure->getStructure()->getSigle(); + $data['cheminLogo'] = $structure->getStructure()->getCheminLogo(); $data['estFerme'] = $structure->getStructure()->estFermee(); $data['id_ref'] = $structure->getStructure()->getIdRef(); $data['id_hal'] = $structure->getStructure()->getIdHal(); @@ -36,12 +36,12 @@ abstract class StructureHydrator extends DoctrineObject /** @var StructureConcreteInterface $object */ $object = parent::hydrate($data, $structure); - $object->setLibelle($data['libelle']); - $object->setSigle($data['sigle']); + $object->getStructure()->setLibelle($data['libelle']); + $object->getStructure()->setSigle($data['sigle']); $object->getStructure()->setCode($data['code']); $object->getStructure()->setIdRef($data['id_ref']); $object->getStructure()->setIdHal($data['id_hal']); - $object->setCheminLogo($data['cheminLogo']); + $object->getStructure()->setCheminLogo($data['cheminLogo']); $object->getStructure()->setEstFermee(isset($data['estFerme']) and $data['estFerme'] === "1"); return $object; diff --git a/module/Structure/src/Structure/Service/EcoleDoctorale/EcoleDoctoraleService.php b/module/Structure/src/Structure/Service/EcoleDoctorale/EcoleDoctoraleService.php index 6463af7d6a62b0ca052dbfea417104256df8804f..a36eb6bc98c1918959ed9fb4ed994bf00df5df60 100644 --- a/module/Structure/src/Structure/Service/EcoleDoctorale/EcoleDoctoraleService.php +++ b/module/Structure/src/Structure/Service/EcoleDoctorale/EcoleDoctoraleService.php @@ -6,6 +6,7 @@ use Application\Entity\Db\Utilisateur; use Application\Service\BaseService; use Application\SourceCodeStringHelperAwareTrait; use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\ORMException; use Laminas\Mvc\Controller\AbstractActionController; use Structure\Entity\Db\EcoleDoctorale; use Structure\Entity\Db\Repository\EcoleDoctoraleRepository; @@ -68,13 +69,13 @@ class EcoleDoctoraleService extends BaseService $this->entityManager->beginTransaction(); - $this->entityManager->persist($structure); - $this->entityManager->persist($structureConcrete); try { + $this->entityManager->persist($structure); + $this->entityManager->persist($structureConcrete); $this->entityManager->flush($structure); $this->entityManager->flush($structureConcrete); $this->entityManager->commit(); - } catch (\Exception $e) { + } catch (ORMException $e) { $this->rollback(); throw new RuntimeException("Erreur lors de l'enregistrement de l'ED '$structure'", null, $e); } @@ -91,7 +92,7 @@ class EcoleDoctoraleService extends BaseService public function setLogo(EcoleDoctorale $ecole, $cheminLogo) { - $ecole->setCheminLogo($cheminLogo); + $ecole->getStructure()->setCheminLogo($cheminLogo); $this->flush($ecole); return $ecole; @@ -99,7 +100,7 @@ class EcoleDoctoraleService extends BaseService public function deleteLogo(EcoleDoctorale $ecole) { - $ecole->setCheminLogo(null); + $ecole->getStructure()->setCheminLogo(null); $this->flush($ecole); return $ecole; @@ -141,18 +142,12 @@ class EcoleDoctoraleService extends BaseService return $ed; } - private function persist(EcoleDoctorale $ecole) - { - $this->getEntityManager()->persist($ecole); - $this->getEntityManager()->persist($ecole->getStructure()); - } - private function flush(EcoleDoctorale $ecole) { try { $this->getEntityManager()->flush($ecole); $this->getEntityManager()->flush($ecole->getStructure()); - } catch (OptimisticLockException $e) { + } catch (ORMException $e) { throw new RuntimeException("Erreur lors de l'enregistrement de l'ED", null, $e); } } @@ -177,7 +172,7 @@ class EcoleDoctoraleService extends BaseService $options = []; foreach ($ecoles as $ecole) { - $options[$ecole->getId()] = $ecole->getLibelle() . " " ."<span class='badge'>".$ecole->getSigle()."</span>"; + $options[$ecole->getId()] = $ecole->getStructure()->getLibelle() . " " ."<span class='badge'>".$ecole->getStructure()->getSigle()."</span>"; } return $options; } diff --git a/module/Structure/src/Structure/Service/Etablissement/EtablissementService.php b/module/Structure/src/Structure/Service/Etablissement/EtablissementService.php index 2986aade77e6178425c49020c330d8df578e742a..bb2912ad788e0ab02adde61546983d1a1732d9cf 100644 --- a/module/Structure/src/Structure/Service/Etablissement/EtablissementService.php +++ b/module/Structure/src/Structure/Service/Etablissement/EtablissementService.php @@ -2,16 +2,16 @@ namespace Structure\Service\Etablissement; -use Structure\Entity\Db\Etablissement; -use Structure\Entity\Db\Repository\EtablissementRepository; -use Structure\Entity\Db\Structure; -use Structure\Entity\Db\TypeStructure; use Application\Entity\Db\Utilisateur; use Application\Service\BaseService; -use Fichier\Service\Fichier\FichierServiceAwareTrait; use Application\SourceCodeStringHelperAwareTrait; use Doctrine\ORM\NonUniqueResultException; use Doctrine\ORM\ORMException; +use Fichier\Service\Fichier\FichierServiceAwareTrait; +use Structure\Entity\Db\Etablissement; +use Structure\Entity\Db\Repository\EtablissementRepository; +use Structure\Entity\Db\Structure; +use Structure\Entity\Db\TypeStructure; use UnicaenApp\Exception\RuntimeException; class EtablissementService extends BaseService @@ -114,7 +114,7 @@ class EtablissementService extends BaseService public function setLogo(Etablissement $etablissement, $cheminLogo) { - $etablissement->setCheminLogo($cheminLogo); + $etablissement->getStructure()->setCheminLogo($cheminLogo); $this->flush($etablissement); return $etablissement; @@ -122,7 +122,7 @@ class EtablissementService extends BaseService public function deleteLogo(Etablissement $etablissement) { - $etablissement->setCheminLogo(null); + $etablissement->getStructure()->setCheminLogo(null); $this->flush($etablissement); return $etablissement; @@ -147,9 +147,9 @@ class EtablissementService extends BaseService public function getEtablissementsInscriptionsAsOptions() : array { - $etablissements = $this->getRepository()->findAllEtablissementsInscriptions(); + $etablissements = $this->getRepository()->findAllEtablissementsInscriptions(true); $result = []; - foreach ($etablissements as $etablissement) $result[$etablissement->getId()] = $etablissement->getLibelle(); + foreach ($etablissements as $etablissement) $result[$etablissement->getId()] = $etablissement->getStructure()->getLibelle(); return $result; } @@ -181,7 +181,7 @@ class EtablissementService extends BaseService $etablissements = $this->getRepository()->findAllEtablissementsInscriptions(); $array = []; foreach ($etablissements as $etablissement) { - $array[$etablissement->getId()] = $etablissement->getLibelle(); + $array[$etablissement->getId()] = $etablissement->getStructure()->getLibelle(); } return $array; } @@ -193,7 +193,7 @@ class EtablissementService extends BaseService $options = []; foreach ($etablissements as $etablissement) { - $options[$etablissement->getId()] = $etablissement->getLibelle() . " " ."<span class='badge'>".$etablissement->getSigle()."</span>"; + $options[$etablissement->getId()] = $etablissement->getStructure()->getLibelle() . " " ."<span class='badge'>".$etablissement->getStructure()->getSigle()."</span>"; } return $options; } diff --git a/module/Structure/src/Structure/Service/Structure/StructureService.php b/module/Structure/src/Structure/Service/Structure/StructureService.php index d6a354e5cc9d473f2aca2d8dd748359488625eb4..21a5d604b534c48fde1f6567de23c642375719c4 100755 --- a/module/Structure/src/Structure/Service/Structure/StructureService.php +++ b/module/Structure/src/Structure/Service/Structure/StructureService.php @@ -8,14 +8,12 @@ use Application\SourceCodeStringHelperAwareTrait; use Doctrine\Laminas\Hydrator\DoctrineObject; use Doctrine\ORM\EntityRepository; use Doctrine\ORM\NonUniqueResultException; -use Doctrine\ORM\OptimisticLockException; use Doctrine\ORM\ORMException; use Doctrine\ORM\Query\Expr\Join; use Doctrine\ORM\QueryBuilder; use Fichier\FileUtils; use Fichier\Service\Fichier\FichierStorageServiceAwareTrait; use Fichier\Service\Storage\Adapter\Exception\StorageAdapterException; -use Import\Service\Traits\SynchroServiceAwareTrait; use Laminas\Mvc\Controller\AbstractActionController; use Structure\Entity\Db\EcoleDoctorale; use Structure\Entity\Db\Etablissement; @@ -34,7 +32,6 @@ use Structure\Service\UniteRecherche\UniteRechercheServiceAwareTrait; use UnicaenApp\Exception\RuntimeException; use UnicaenApp\Util; use Webmozart\Assert\Assert; -use function Application\generateNameForEtab; /** * @author Unicaen @@ -42,7 +39,6 @@ use function Application\generateNameForEtab; class StructureService extends BaseService { use SourceServiceAwareTrait; - use SynchroServiceAwareTrait; use SourceCodeStringHelperAwareTrait; use EcoleDoctoraleServiceAwareTrait; use EtablissementServiceAwareTrait; @@ -70,9 +66,8 @@ class StructureService extends BaseService * Objet contenant les attributs de la structure de substitution à créer * @return StructureConcreteInterface Entités créées (une par substitution) */ - public function createStructureSubstitutions(array $structuresSources, StructureConcreteInterface $structureCibleDataObject) + public function createStructureSubstitutions(array $structuresSources, StructureConcreteInterface $structureCibleDataObject): StructureConcreteInterface { - switch (true) { case ($structuresSources[0] instanceOf Etablissement): Assert::allIsInstanceOf($structuresSources, Etablissement::class); @@ -84,12 +79,9 @@ class StructureService extends BaseService Assert::allIsInstanceOf($structuresSources, UniteRecherche::class); break; default: - new RuntimeException("La première structure est de type non connu."); - break; + throw new RuntimeException("La première structure est de type non connu."); } - //Assert::null($structureCibleDataObject->getSourceCode(), "Le source code doit être null car il est calculé"); - // le source code d'une structure cible est calculé $sourceCode = $structureCibleDataObject->getSourceCode(); if ($sourceCode === null) { @@ -136,26 +128,24 @@ class StructureService extends BaseService $substitutions = StructureSubstit::fromStructures($structuresSources, $structureRattachCible); // enregistrement en bdd - $this->getEntityManager()->beginTransaction(); + $this->entityManager->beginTransaction(); try { - $this->getEntityManager()->persist($structureRattachCible); - $this->getEntityManager()->persist($structureConcreteCible); + $this->entityManager->persist($structureRattachCible); + $this->entityManager->persist($structureConcreteCible); array_map(function(StructureSubstit $ss) { - $this->getEntityManager()->persist($ss); + $this->entityManager->persist($ss); }, $substitutions); - $this->getEntityManager()->flush($structureRattachCible); - $this->getEntityManager()->flush($structureConcreteCible); - $this->getEntityManager()->flush($substitutions); + $this->entityManager->flush($structureRattachCible); + $this->entityManager->flush($structureConcreteCible); + $this->entityManager->flush($substitutions); - $this->getEntityManager()->commit(); + $this->entityManager->commit(); } catch (\Exception $e) { - $this->getEntityManager()->rollback(); + $this->entityManager->rollback(); throw new RuntimeException("Erreur rencontrée lors de l'enregistrement des substitutions", null, $e); } - $this->runSynchroTheses($structureConcreteCible->getStructure()); - return $structureConcreteCible; } @@ -231,34 +221,6 @@ class StructureService extends BaseService $this->getEntityManager()->rollback(); throw new RuntimeException("Erreur rencontrée lors de l'enregistrement des substitutions", null, $e); } - - $this->runSynchroTheses($structureCible); - } - - /** - * Lance la synchro des thèses pour prendre en compte la substitution de structure. - * - * @deprecated Ne plus appeller cette méthode. La substitution ne doit plus être "appliquée" grâce aux vues de synchro SRC_* - * mais à la main dans le code PHP. - * - * @param \Structure\Entity\Db\Structure $structureCible - */ - private function runSynchroTheses(Structure $structureCible) - { - // Les noms de synchros sont déclinés par source/établissement (ex: 'these-UCN') ; on ne retient que - // les sources/établissements des structures substituées. - $etabs = []; - foreach ($structureCible->getStructuresSubstituees() as $structuresSubstituee) { - /** @var \Application\Entity\Db\Source $source */ - $source = $structuresSubstituee->getSource(); - $etab = $source->getEtablissement()->getCode(); - $etabs[$etab] = $etab; - } - foreach ($etabs as $etab) { - $this->synchroService->addService(generateNameForEtab('these-%s', $etab)); - } - - $this->synchroService->synchronize(); } /** @@ -296,8 +258,6 @@ class StructureService extends BaseService throw new RuntimeException("Erreur rencontrée lors de la supression des substitutions", null, $e); } - $this->runSynchroTheses($structureCible); - return $structureSubstits; } @@ -429,7 +389,8 @@ class StructureService extends BaseService } /** - * Détruit les substitutions associées à une structure cible dans la table STRUCTURE_SUBSTIT et détruit cette structure cible + * Détruit les substitutions associées à une structure cible dans la table STRUCTURE_SUBSTIT et détruit cette structure cible. + * * @param StructureConcreteInterface $cibleConcrete */ public function removeSubstitution(StructureConcreteInterface $cibleConcrete) @@ -437,20 +398,18 @@ class StructureService extends BaseService $qb = $this->getEntityManager()->getRepository(StructureSubstit::class)->createQueryBuilder("ss") ->andWhere("ss.toStructure = :cible") ->setParameter("cible", $cibleConcrete->getStructure()); - $result = $qb->getQuery()->getResult(); - foreach($result as $entry) { - $this->getEntityManager()->remove($entry); - } + $this->getEntityManager()->beginTransaction(); try { + foreach($qb->getQuery()->getResult() as $entry) { + $this->getEntityManager()->remove($entry); + } $this->getEntityManager()->remove($cibleConcrete); - } catch (ORMException $e) { - } - - try { $this->getEntityManager()->flush(); - } catch (OptimisticLockException $e) { - throw new RuntimeException("Problème lors de l'effacement des structures"); + $this->getEntityManager()->commit(); + } catch (ORMException $e) { + $this->getEntityManager()->rollback(); + throw new RuntimeException("Problème rencontré lors de la suppression de la substitution de structures"); } } @@ -458,7 +417,7 @@ class StructureService extends BaseService * @param string $typeStructure * @return StructureConcreteInterface|null */ - public function createStructureConcrete(string $typeStructure) + public function createStructureConcrete(string $typeStructure): ?StructureConcreteInterface { $sourceSygal = $this->sourceService->fetchApplicationSource(); $type = $this->fetchTypeStructure($typeStructure); @@ -485,15 +444,17 @@ class StructureService extends BaseService return $structureCibleDataObject; } - /** - * @param $structure - * @param $data + * @param \Structure\Entity\Db\StructureInterface|\Structure\Entity\Db\StructureConcreteInterface $structure + * @param array $data */ - public function updateFromPostData($structure, $data) + public function updateFromPostData($structure, array $data) { $hydrator = new DoctrineObject($this->getEntityManager()); - $hydrator->hydrate($data, $structure); + $hydrator->hydrate( + $data, + $structure instanceof StructureConcreteInterface ? $structure->getStructure(false) : $structure + ); } /** @@ -579,10 +540,10 @@ class StructureService extends BaseService } /** - * Recherche les structures qui peuvent être substituées. + * Retourne les structures qui peuvent être substituées, **hydratées au format array**. * * @param string $type - * @return StructureConcreteInterface[] + * @return array[] */ public function getStructuresSubstituablesByType(string $type): array { @@ -590,13 +551,12 @@ class StructureService extends BaseService $repo = $this->getEntityManager()->getRepository($this->getEntityByType($type)); $qb = $repo->createQueryBuilder('structureConcrete') - ->addSelect('substitutionFrom') ->leftJoin('structure.structuresSubstituees', 'substitutionFrom') - ->andWhere('substitutionFrom.id IS NULL') - ->andWhere('structureSubstituante.id IS NULL') + ->andWhere('substitutionFrom.id IS NULL') // non substituante +// ->andWhere('structureSubstituante.id IS NULL') // non déjà substituée ->orderBy('structure.libelle'); - return $qb->getQuery()->getResult(); + return $qb->getQuery()->getArrayResult(); } /** @@ -656,7 +616,7 @@ class StructureService extends BaseService * @param int|string $structureId * @return StructureConcreteInterface */ - public function getStructuresConcreteByTypeAndStructureId(string $type, $structureId): StructureConcreteInterface + public function getStructureConcreteByTypeAndStructureId(string $type, $structureId): StructureConcreteInterface { $qb = $this->getEntityManager()->getRepository($this->getEntityByType($type))->createQueryBuilder('structureConcrete') ->addSelect('structurec') @@ -679,7 +639,7 @@ class StructureService extends BaseService * @param int|string $structureId * @return StructureConcreteInterface */ - public function getStructuresConcreteByTypeAndStructureConcreteId(string $type, $structureId): StructureConcreteInterface + public function getStructureConcreteByTypeAndStructureConcreteId(string $type, $structureId): StructureConcreteInterface { $qb = $this->getEntityManager()->getRepository($this->getEntityByType($type))->createQueryBuilder('structureConcrete') ->addSelect('structurec') @@ -701,30 +661,31 @@ class StructureService extends BaseService * Identifie les structures substituables en utilisant le sourceCode. * * @param string $type - * @return array + * @return array [$identifiant => [$sources, $cible]] * - * @deprecated Mise deprecated pour penser à la renommer clairement, - * et à remplacer if ($prefix === "SyGAL" || $prefix === "COMUE"). + * @deprecated Mise deprecated pour penser à remplacer if ($prefix === "SyGAL" || $prefix === "COMUE"). */ - public function checkStructure($type) + public function findStructuresSubstituablesSelonSourceCode(string $type): array { $structures = []; switch($type) { case (TypeStructure::CODE_ECOLE_DOCTORALE): - $structures = $this->getEcoleDoctoraleService()->getRepository()->findAll(); + $structures = $this->getEcoleDoctoraleService()->getRepository()->findSubstituables(); break; case (TypeStructure::CODE_ETABLISSEMENT): - $structures = $this->getEtablissementService()->getRepository()->findAll(); + $structures = $this->getEtablissementService()->getRepository()->findSubstituables(); break; case (TypeStructure::CODE_UNITE_RECHERCHE): - $structures = $this->getUniteRechercheService()->getRepository()->findAll(); + $structures = $this->getUniteRechercheService()->getRepository()->findSubstituables(); break; } $dictionnaire = []; foreach ($structures as $structure) { $identifiant = explode("::", $structure->getSourceCode())[1]; - $dictionnaire[$identifiant][] = $structure; + if ($identifiant) { + $dictionnaire[$identifiant][] = $structure; + } } $substitutions = []; @@ -783,27 +744,24 @@ class StructureService extends BaseService */ public function deleteLogoStructure(StructureInterface $structure): bool { - $cheminLogo = $structure->getCheminLogo(); + if (!$structure->getCheminLogo()) { + return false; + } + + try { + $this->fichierStorageService->deleteFileForLogoStructure($structure); + } catch (StorageAdapterException $e) { + throw new RuntimeException("Erreur lors de la suppression du logo de la structure. " . $e->getMessage(), null, $e); + } $structure->setCheminLogo(null); try { $this->entityManager->flush($structure); - if ($structure instanceof StructureConcreteInterface) { - $this->entityManager->flush($structure->getStructure()); - } } catch (ORMException $e) { throw new RuntimeException("Erreur lors de l'enregistrement de la structure.", null, $e); } - - if ($hasLogo = ($cheminLogo !== null)) { - try { - $this->fichierStorageService->deleteFileForLogoStructure($structure); - } catch (StorageAdapterException $e) { - throw new RuntimeException("Erreur lors de la suppression du logo de la structure. " . $e->getMessage(), null, $e); - } - } - return $hasLogo; + return true; } /** @@ -821,21 +779,21 @@ class StructureService extends BaseService $logoFilepath = FileUtils::convertLogoFileToPNG($uploadedFilePath); // Suppression du logo existant - $this->deleteLogoStructure($structure); // todo: améliorer pour l'inclure dns le try-catch ci-après - + $this->entityManager->beginTransaction(); try { + $this->deleteLogoStructure($structure); + $this->fichierStorageService->saveFileForLogoStructure($logoFilepath, $structure); $logoFilename = $this->fichierStorageService->computeFileNameForNewLogoStructure($structure); $structure->setCheminLogo($logoFilename); $this->entityManager->flush($structure); - if ($structure instanceof StructureConcreteInterface) { - $this->entityManager->flush($structure->getStructure()); - } + $this->entityManager->commit(); } catch (StorageAdapterException $e) { throw new RuntimeException("Impossible d'enregistrer le fichier logo dans le storage. " . $e->getMessage(), null, $e); } catch (ORMException $e) { + $this->entityManager->rollback(); throw new RuntimeException("Erreur lors de l'enregistrement de la structure. " . $e->getMessage(), null, $e); } } @@ -858,6 +816,10 @@ class StructureService extends BaseService return Util::createImageWithText("Anomalie: Fichier|absent sur le storage. " . $e->getMessage(), 200, 200); } + if ($logoFilepath === null) { + return null; + } + return file_get_contents($logoFilepath) ?: null; } diff --git a/module/Structure/src/Structure/Service/Structure/StructureServiceFactory.php b/module/Structure/src/Structure/Service/Structure/StructureServiceFactory.php index a948e92649542cddbb2517b3ecd32c9df21b030f..18def44208c7d96f603a5c9fbedc4e991424f31a 100755 --- a/module/Structure/src/Structure/Service/Structure/StructureServiceFactory.php +++ b/module/Structure/src/Structure/Service/Structure/StructureServiceFactory.php @@ -2,35 +2,29 @@ namespace Structure\Service\Structure; -use Structure\Service\EcoleDoctorale\EcoleDoctoraleService; -use Structure\Service\Etablissement\EtablissementService; -use Fichier\Service\Fichier\FichierStorageService; use Application\Service\Source\SourceService; -use Structure\Service\UniteRecherche\UniteRechercheService; use Application\SourceCodeStringHelper; -use Import\Service\SynchroService; +use Fichier\Service\Fichier\FichierStorageService; use Interop\Container\ContainerInterface; +use Structure\Service\EcoleDoctorale\EcoleDoctoraleService; +use Structure\Service\Etablissement\EtablissementService; +use Structure\Service\UniteRecherche\UniteRechercheService; -/** - * @author Unicaen - */ class StructureServiceFactory { /** - * @param ContainerInterface $container - * @return StructureService + * @throws \Psr\Container\ContainerExceptionInterface + * @throws \Psr\Container\NotFoundExceptionInterface */ - public function __invoke(ContainerInterface $container) + public function __invoke(ContainerInterface $container): StructureService { /** * @var SourceService $sourceService - * @var SynchroService $synchroService * @var EcoleDoctoraleService $ecoleService * @var EtablissementService $etablissementService * @var UniteRechercheService $uniteRechercheService */ $sourceService = $container->get(SourceService::class); - $synchroService = $container->get(SynchroService::class); $ecoleService = $container->get(EcoleDoctoraleService::class); $etablissementService = $container->get(EtablissementService::class); $uniteRechercheService = $container->get(UniteRechercheService::class); @@ -40,7 +34,6 @@ class StructureServiceFactory $service = new StructureService; $service->setSourceService($sourceService); - $service->setSynchroService($synchroService); $service->setEcoleDoctoraleService($ecoleService); $service->setEtablissementService($etablissementService); $service->setUniteRechercheService($uniteRechercheService); diff --git a/module/Structure/src/Structure/Service/UniteRecherche/UniteRechercheService.php b/module/Structure/src/Structure/Service/UniteRecherche/UniteRechercheService.php index a58f6607a5e674fb0d7e955df91e1de80a1decfe..85df7662383bde58570d05699e23041951c6d6ac 100644 --- a/module/Structure/src/Structure/Service/UniteRecherche/UniteRechercheService.php +++ b/module/Structure/src/Structure/Service/UniteRecherche/UniteRechercheService.php @@ -6,7 +6,6 @@ use Application\Entity\Db\Utilisateur; use Application\Service\BaseService; use Application\SourceCodeStringHelperAwareTrait; use Doctrine\ORM\NonUniqueResultException; -use Doctrine\ORM\OptimisticLockException; use Doctrine\ORM\ORMException; use Structure\Entity\Db\Etablissement; use Structure\Entity\Db\EtablissementRattachement; @@ -125,7 +124,7 @@ class UniteRechercheService extends BaseService public function setLogo(UniteRecherche $unite, $cheminLogo) { - $unite->setCheminLogo($cheminLogo); + $unite->getStructure()->setCheminLogo($cheminLogo); $this->flush($unite); return $unite; @@ -133,7 +132,7 @@ class UniteRechercheService extends BaseService public function deleteLogo(UniteRecherche $unite) { - $unite->setCheminLogo(null); + $unite->getStructure()->setCheminLogo(null); $this->flush($unite); return $unite; @@ -144,7 +143,7 @@ class UniteRechercheService extends BaseService try { $this->getEntityManager()->flush($ur); $this->getEntityManager()->flush($ur->getStructure()); - } catch (OptimisticLockException $e) { + } catch (ORMException $e) { throw new RuntimeException("Erreur lors de l'enregistrement de l'UR", null, $e); } } @@ -154,22 +153,23 @@ class UniteRechercheService extends BaseService /** * @param UniteRecherche $unite * @param Etablissement $etablissement - * @throws OptimisticLockException */ public function addEtablissementRattachement(UniteRecherche $unite, Etablissement $etablissement) { $er = new EtablissementRattachement(); $er->setUniteRecherche($unite); $er->setEtablissement($etablissement); - $this->getEntityManager()->persist($er); - $this->getEntityManager()->flush($er); + try { + $this->getEntityManager()->persist($er); + $this->getEntityManager()->flush($er); + } catch (ORMException $e) { + throw new RuntimeException("Erreur lors de l'enregistrement de l'UR", null, $e); + } } /** * @param UniteRecherche $unite * @param Etablissement $etablissement - * @throws OptimisticLockException - * @throws \Doctrine\ORM\NonUniqueResultException */ public function removeEtablissementRattachement(UniteRecherche $unite, Etablissement $etablissement) { @@ -178,11 +178,19 @@ class UniteRechercheService extends BaseService ->andWhere("er.etablissement = :etablissement") ->setParameter("unite", $unite) ->setParameter("etablissement", $etablissement); - $result = $qb->getQuery()->getOneOrNullResult(); + try { + $result = $qb->getQuery()->getOneOrNullResult(); + } catch (NonUniqueResultException $e) { + throw new RuntimeException("Erreur lors de l'enregistrement de l'UR", null, $e); + } if ($result) { - $this->getEntityManager()->remove($result); - $this->getEntityManager()->flush($result); + try { + $this->getEntityManager()->remove($result); + $this->getEntityManager()->flush($result); + } catch (ORMException $e) { + throw new RuntimeException("Erreur lors de l'enregistrement de l'UR", null, $e); + } } } @@ -193,7 +201,7 @@ class UniteRechercheService extends BaseService $options = []; foreach ($unites as $unite) { - $options[$unite->getId()] = $unite->getLibelle() . " " ."<span class='badge'>".$unite->getSigle()."</span>"; + $options[$unite->getId()] = $unite->getStructure()->getLibelle() . " " ."<span class='badge'>".$unite->getStructure()->getSigle()."</span>"; } return $options; } diff --git a/module/Structure/src/Structure/View/Helper/StructureSubstitHelper.php b/module/Structure/src/Structure/View/Helper/StructureSubstitHelper.php index 03e69eae598273c739fe748657f6277016d5412e..ff1299f0ea9e1393f99ef3764b7a354e117187d8 100644 --- a/module/Structure/src/Structure/View/Helper/StructureSubstitHelper.php +++ b/module/Structure/src/Structure/View/Helper/StructureSubstitHelper.php @@ -20,32 +20,35 @@ class StructureSubstitHelper extends AbstractHelper * @param string|null $logoContent * @return string */ - public function structureSource(StructureConcreteInterface $structurestructureConcrete, ?string $logoContent) + public function structureSource(StructureConcreteInterface $structurestructureConcrete, ?string $logoContent): string { + // structure substituée SANS REMONTER À LA STRUCTURE SUBSTITUANTE + $structure = $structurestructureConcrete->getStructure(false); + $texte = '<div class="card" data-struct-id="'.$structurestructureConcrete->getId().'" id="panel_' . $structurestructureConcrete->getId() . '" >'; $texte .= '<div class="card-header bg-secondary text-white">'; - $texte .= 'Source : ' . $structurestructureConcrete->getSource() . " - Identifiant : " . $structurestructureConcrete->getStructure()->getId(); + $texte .= 'Source : ' . $structurestructureConcrete->getSource() . " / Structure abstraite " . $structure->getId() . " / Structure concrète " . $structurestructureConcrete->getId(); $texte .= '</div>'; $texte .= '<div class="card-body">'; $texte .= '<div class="float-start">'; - $texte .= '<input type="hidden" id="source" name="sourceIds[]" value="' . $structurestructureConcrete->getStructure()->getId() . '" />'; + $texte .= '<input type="hidden" id="source" name="sourceIds[]" value="' . $structure->getId() . '" />'; $texte .= '<table>'; $texte .= '<tr>'; - $texte .= '<td><input champ="sigle" id="sigle_' . $structurestructureConcrete->getSigle() . '" type="radio" name="sigle"/> </td>'; + $texte .= '<td><input champ="sigle" id="sigle_' . $structurestructureConcrete->getStructure(false)->getSigle() . '" type="radio" name="sigle"/> </td>'; $texte .= '<th> Sigle : </th>'; - $texte .= '<td>' . $structurestructureConcrete->getSigle() . '</td>'; + $texte .= '<td>' . $structurestructureConcrete->getStructure(false)->getSigle() . '</td>'; $texte .= '</tr>'; $texte .= '<tr>'; - $texte .= '<td><input champ="libelle" id="sigle_' . $structurestructureConcrete->getSigle() . '" type="radio" name="libelle"/> </td>'; + $texte .= '<td><input champ="libelle" id="sigle_' . $structurestructureConcrete->getStructure(false)->getSigle() . '" type="radio" name="libelle"/> </td>'; $texte .= '<th> Libellé : </th>'; - $texte .= '<td>' . $structurestructureConcrete->getLibelle() . '</td>'; + $texte .= '<td>' . $structurestructureConcrete->getStructure(false)->getLibelle() . '</td>'; $texte .= '</tr>'; $texte .= '<tr>'; - $texte .= '<td><input champ="code" id="sigle_' . $structurestructureConcrete->getSigle() . '" type="radio" name="code"/> </td>'; + $texte .= '<td><input champ="code" id="sigle_' . $structurestructureConcrete->getStructure(false)->getSigle() . '" type="radio" name="code"/> </td>'; $texte .= '<th> Code : </th>'; - $texte .= '<td>' . $structurestructureConcrete->getStructure()->getCode() . '</td>'; + $texte .= '<td>' . $structure->getCode() . '</td>'; $texte .= '</tr>'; $texte .= '</table>'; @@ -58,10 +61,10 @@ class StructureSubstitHelper extends AbstractHelper $texte .= '</div>'; $texte .= '<div id="logo-div" class="float-end ">'; - if ($structurestructureConcrete->getCheminLogo() !== null) - $texte .= '<input champ="logo" id="logo_' . $structurestructureConcrete->getSigle() . '" type="radio" name="logo" /> '; + if ($structurestructureConcrete->getStructure(false)->getCheminLogo() !== null) + $texte .= '<input champ="logo" id="logo_' . $structurestructureConcrete->getStructure(false)->getSigle() . '" type="radio" name="logo" /> '; $texte .= '<img class="current" style="max-width: 125px; max-height: 125px; border: 1px solid black; background-color: white;" src="data:image/*;base64,' . base64_encode($logoContent) . '"/>'; - $texte .= '<input class="path" type="hidden" champ="cheminLogo" name="cheminLogo" value="' . $structurestructureConcrete->getStructure()->getCheminLogo() . '"/>'; + $texte .= '<input class="path" type="hidden" champ="cheminLogo" name="cheminLogo" value="' . $structure->getCheminLogo() . '"/>'; $texte .= '</div>'; $texte .= '</div>'; $texte .= '</div>'; @@ -75,13 +78,13 @@ class StructureSubstitHelper extends AbstractHelper * @param string|null $logoContent * @return string */ - function structureCible(Structure $structure, ?string $logoContent) + function structureCible(Structure $structure, ?string $logoContent): string { $texte = ""; $texte .= '<div class="card">'; $texte .= ' <div class="card-header bg-success">'; - $texte .= 'Source : ' . $structure->getSource() . " - Identifiant : " . $structure->getId(); + $texte .= 'Source : ' . $structure->getSource() . " / Identifiant Structure : " . $structure->getId(); $texte .= ' </div>'; $texte .= ' <div class="card-body">'; diff --git a/module/Structure/view/structure/ecole-doctorale/index.phtml b/module/Structure/view/structure/ecole-doctorale/index.phtml index 2a7fd1bbbc8fd8503921eb2a9a56afaadc14f5eb..3e546c03157a3cf22bdc28ab2375580e7322e0e0 100644 --- a/module/Structure/view/structure/ecole-doctorale/index.phtml +++ b/module/Structure/view/structure/ecole-doctorale/index.phtml @@ -67,7 +67,7 @@ $canSubstituer = $this->isAllowed(SubstitutionPrivileges::getResourceId(Substitu <tr> <td> <a href="<?php echo $this->url('ecole-doctorale/information', ['structure' => $ecole->getStructure()->getId()], [], true); ?>"> - <?php echo $ecole->getLibelle(); ?> + <?php echo $ecole->getStructure()->getLibelle(); ?> <?php if ($ecole->getStructure()->estFermee()) : ?> <span class="badge bg-danger">Structure fermée</span> <?php endif; ?> @@ -79,7 +79,7 @@ $canSubstituer = $this->isAllowed(SubstitutionPrivileges::getResourceId(Substitu <td> <?php echo $ecole->getStructure()->getCode(); ?> </td> - <td> <?php echo $ecole->getSigle(); ?> </td> + <td> <?php echo $ecole->getStructure()->getSigle(); ?> </td> <td> <?php if (($canModifier OR $canModifierCetteEcole) && !$historisee) : ?> <a href="<?php echo $this->url('ecole-doctorale/supprimer', ["structure" => $ecole->getStructure()->getId()], [], true); ?>" diff --git a/module/Structure/view/structure/ecole-doctorale/information.phtml b/module/Structure/view/structure/ecole-doctorale/information.phtml index 1a8c07ff9a8bf9bb43df48895166b99e4c8ec796..8708b51d0199957bec1e5ffffee6cd1ab5793f4c 100644 --- a/module/Structure/view/structure/ecole-doctorale/information.phtml +++ b/module/Structure/view/structure/ecole-doctorale/information.phtml @@ -33,7 +33,7 @@ $structure = $ecole->getStructure(); ?> <h1 class="page-header"> - École doctorale « <?php echo $ecole->getLibelle(); ?> » + École doctorale « <?php echo $ecole->getStructure()->getLibelle(); ?> » </h1> <?php echo $this->messenger()->addMessagesFromFlashMessengerWithNoNamespace() ?> @@ -81,9 +81,9 @@ $structure = $ecole->getStructure(); <div class="col-md-6"> <dl> <dt> Libelle :</dt> - <dd> <?php echo $ecole->getLibelle(); ?> </dd> + <dd> <?php echo $ecole->getStructure()->getLibelle(); ?> </dd> <dt> Sigle :</dt> - <dd> <?php echo $ecole->getSigle(); ?> </dd> + <dd> <?php echo $ecole->getStructure()->getSigle(); ?> </dd> <dt> Code :</dt> <dd> <?php echo $ecole->getStructure()->getCode(); ?> </dd> <dt> Id REF :</dt> diff --git a/module/Structure/view/structure/ecole-doctorale/modifier.phtml b/module/Structure/view/structure/ecole-doctorale/modifier.phtml index 979a65e3f3c7210836a305f7ed899cb4c0ec0ad5..f3f66ba48eb9df478add2fb8ea50e70fb6e9fcab 100644 --- a/module/Structure/view/structure/ecole-doctorale/modifier.phtml +++ b/module/Structure/view/structure/ecole-doctorale/modifier.phtml @@ -33,7 +33,7 @@ $form->get('code')->setAttribute('readonly', !$editable); <?php if ($isNew): ?> Création d'une nouvelle école doctorale <?php else: ?> - Modification de l'école doctorale « <?php echo $ecole->getLibelle(); ?> » + Modification de l'école doctorale « <?php echo $ecole->getStructure()->getLibelle(); ?> » <?php endif ?> </h1> @@ -62,7 +62,7 @@ $form->get('code')->setAttribute('readonly', !$editable); <?php $content = $logoContent; if ($content === null) { - $ecole->setCheminLogo(null); + $ecole->getStructure()->setCheminLogo(null); } ?> diff --git a/module/Structure/view/structure/etablissement/index.phtml b/module/Structure/view/structure/etablissement/index.phtml index 1efc72855984e1dcb402d7cb5c01bf41f6f1b35f..70a1e23235f11b16a76a3ee7a17a76ee08bed818 100644 --- a/module/Structure/view/structure/etablissement/index.phtml +++ b/module/Structure/view/structure/etablissement/index.phtml @@ -79,7 +79,7 @@ $canSubstituer = $this->isAllowed(SubstitutionPrivileges::getResourceId(Substitu <tr> <td> <a href="<?php echo $this->url('etablissement/information', ['structure' => $etablissement->getStructure()->getId()], [], true); ?>"> - <?php echo $etablissement->getLibelle(); ?> + <?php echo $etablissement->getStructure()->getLibelle(); ?> <?php if ($etablissement->getStructure()->estFermee()) : ?> <span class="badge bg-danger">Structure fermée</span> <?php endif; ?> @@ -100,7 +100,7 @@ $canSubstituer = $this->isAllowed(SubstitutionPrivileges::getResourceId(Substitu <td> <?php echo $etablissement->getStructure()->getCode(); ?> </td> - <td> <?php echo $etablissement->getSigle(); ?> </td> + <td> <?php echo $etablissement->getStructure()->getSigle(); ?> </td> <td> <?php if (($canModifier OR $canModifierCetEtab) && !$historisee) : ?> <a href="<?php echo $this->url('etablissement/supprimer', ["structure" => $etablissement->getStructure()->getId()], [], true); ?>" @@ -161,7 +161,7 @@ $canSubstituer = $this->isAllowed(SubstitutionPrivileges::getResourceId(Substitu <tr> <td> <a href="<?php echo $this->url('etablissement/information', ['structure' => $etablissement->getStructure()->getId()], [], true); ?>"> - <?php echo $etablissement->getLibelle(); ?> + <?php echo $etablissement->getStructure()->getLibelle(); ?> </a> <?php if ($etablissement->estMembre()): ?> <span class="badge bg-primary">Membre</span> @@ -176,7 +176,7 @@ $canSubstituer = $this->isAllowed(SubstitutionPrivileges::getResourceId(Substitu <td> <?php echo $etablissement->getStructure()->getCode(); ?> </td> - <td> <?php echo $etablissement->getSigle(); ?> </td> + <td> <?php echo $etablissement->getStructure()->getSigle(); ?> </td> <td> <?php if (($canModifier OR $canModifierCetEtab) && !$historisee) : ?> <a href="<?php echo $this->url('etablissement/supprimer', ["structure" => $etablissement->getStructure()->getId()], [], true); ?>" diff --git a/module/Structure/view/structure/etablissement/information.phtml b/module/Structure/view/structure/etablissement/information.phtml index a95bfc3733e9a6721d47387d3795199b21e0938e..e0c2b1a2cf90745cfedd8ef1e08d61bde1e23a2a 100644 --- a/module/Structure/view/structure/etablissement/information.phtml +++ b/module/Structure/view/structure/etablissement/information.phtml @@ -16,7 +16,7 @@ use Structure\Entity\Db\Etablissement; use Structure\Entity\Db\TypeStructure; use Structure\Provider\Privilege\StructurePrivileges; -$this->headTitle('Details de l\'établissement ['.$etablissement->getLibelle().']'); +$this->headTitle('Details de l\'établissement ['.$etablissement->getStructure()->getLibelle().']'); $canAddRole = true; $canModifierEtablissement = $this->isAllowed(StructurePrivileges::getResourceId(StructurePrivileges::STRUCTURE_MODIFICATION_TOUTES_STRUCTURES)); @@ -25,7 +25,7 @@ $tab = $this->queryParams()['tab'] ?? StructureController::TAB_infos; ?> <h1 class="page-header"> - Details de l'établissement [ <?php echo $etablissement->getLibelle(); ?> ] + Details de l'établissement [ <?php echo $etablissement->getStructure()->getLibelle(); ?> ] </h1> <?php echo $this->messenger()->addMessagesFromFlashMessengerWithNoNamespace() ?> @@ -69,8 +69,8 @@ $tab = $this->queryParams()['tab'] ?? StructureController::TAB_infos; <div class="row"> <div class="col-md-6"> <dl> - <dt> Libelle : </dt> <dd> <?php echo $etablissement->getLibelle(); ?> </dd> - <dt> Sigle : </dt> <dd> <?php echo $etablissement->getSigle() ?: "(Non renseigné)"; ?></dd> + <dt> Libelle : </dt> <dd> <?php echo $etablissement->getStructure()->getLibelle(); ?> </dd> + <dt> Sigle : </dt> <dd> <?php echo $etablissement->getStructure()->getSigle() ?: "(Non renseigné)"; ?></dd> <dt> Adresse : </dt> <dd> <?php echo $etablissement->getStructure()->getAdresse() ?: "(Non renseignée)"; ?></dd> <dt> Téléphone : </dt> <dd> <?php echo $etablissement->getStructure()->getTelephone() ?: "(Non renseigné)"; ?></dd> <dt> Fax : </dt> <dd> <?php echo $etablissement->getStructure()->getFax() ?: "(Non renseigné)"; ?></dd> diff --git a/module/Structure/view/structure/structure/televerser-document.phtml b/module/Structure/view/structure/structure/televerser-document.phtml index 518c929a9f80bcaeb2fe07e3f5af75cb12da2f1f..f4b930ed337f6bcae85723178e80f1e42636fcb3 100644 --- a/module/Structure/view/structure/structure/televerser-document.phtml +++ b/module/Structure/view/structure/structure/televerser-document.phtml @@ -29,7 +29,7 @@ use Fichier\Entity\Db\NatureFichier; <select class="form-control" id="etablissement" name="etablissement"> <option value="null">(Aucun)</option> <?php foreach ($etablissements as $etablissement) : ?> - <option value="<?php echo $etablissement->getId(); ?>"> <?php echo $etablissement->getLibelle(); ?> </option> + <option value="<?php echo $etablissement->getId(); ?>"> <?php echo $etablissement->getStructure()->getLibelle(); ?> </option> <?php endforeach; ?> </select> </div> diff --git a/module/Structure/view/structure/substitution/afficher-automatique.phtml b/module/Structure/view/structure/substitution/afficher-automatique.phtml index a81f5c01680d9dd1a121346399244b47891ac061..d9dd336cca85f30123739e102dd367641da2a1ad 100644 --- a/module/Structure/view/structure/substitution/afficher-automatique.phtml +++ b/module/Structure/view/structure/substitution/afficher-automatique.phtml @@ -5,6 +5,8 @@ * @var string $type * @var StructureConcreteInterface[] $substituees * @var StructureConcreteInterface $substituante + * + * @see \Structure\Controller\SubstitutionController::substitutionAutomatiqueAction() */ use Structure\Entity\Db\StructureConcreteInterface; diff --git a/module/Structure/view/structure/substitution/index-structure.phtml b/module/Structure/view/structure/substitution/index-structure.phtml index d58a37b31208be8e69e9179180d585d302976812..e1c0ae4d08687af00da1ba3565c5f2a1b790dda7 100644 --- a/module/Structure/view/structure/substitution/index-structure.phtml +++ b/module/Structure/view/structure/substitution/index-structure.phtml @@ -7,7 +7,7 @@ use Structure\Provider\Privilege\SubstitutionPrivileges; /** * @see \Soutenance\Controller\IndexController::indexStructureAction() * @var string $type - * @var StructureConcreteInterface[] $structures + * @var \Structure\Entity\Db\StructureInterface[] $structures */ $libelle = 'Structure'; @@ -61,7 +61,7 @@ $canSubstitutionAutomatique = $this->isAllowed(SubstitutionPrivileges::getResour <?php if ($canSubstitutionAutomatique): ?> <a href="<?php echo $this->url('substitution-automatique', ['type' => $type], [], true);?>" class="float-end" title="Recherche automatique de substitution"> - <button class="btn btn-secondary"><span class="fas fa-cog"></span> Recherche automatique de substitutions </button> + <button class="btn btn-secondary"><span class="fas fa-cog"></span> Recherche de substitutions possibles</button> </a> <?php endif; ?> </p> diff --git a/module/Structure/view/structure/substitution/modifier.phtml b/module/Structure/view/structure/substitution/modifier.phtml index 1aa76b10cee552ebfacf1d7e921d3b5edc1eae0d..3f0139aa35a7f4c66ab97c01863c53947bf1d37d 100644 --- a/module/Structure/view/structure/substitution/modifier.phtml +++ b/module/Structure/view/structure/substitution/modifier.phtml @@ -3,7 +3,6 @@ namespace Structure; use Structure\Controller\SubstitutionController; -use Structure\Entity\Db\EcoleDoctorale; use Structure\Entity\Db\Structure; use Structure\Entity\Db\StructureConcreteInterface; use Structure\Entity\Db\TypeStructure; @@ -15,11 +14,12 @@ use Application\View\Renderer\PhpRenderer; * @var string $identifiant * @var Structure $cible * @var StructureConcreteInterface[] $structuresConcretesSubstituees - * @var StructureConcreteInterface[] $structuresConcretes + * @var array[] $structuresConcretes * @var TypeStructure $type * @var string $structureCibleLogoContent * @var string $structuresConcretesSubstitueesLogosContents * + * @see SubstitutionController::creerAction() * @see SubstitutionController::modifierAction() */ @@ -38,7 +38,7 @@ echo $messenger->addMessagesFromFlashMessenger(); <p> <a href="<?php echo $this->url('substitution-index', [], [], null); ?>" class=""> - < Retour à l'index des substitution + < Retour à l'index des substitutions </a> </p> @@ -94,18 +94,18 @@ echo $messenger->addMessagesFromFlashMessenger(); <?php /** - * @param $structuresConcretes + * @param array[] $structuresConcretes * @param \Laminas\View\Renderer\PhpRenderer $renderer * @return string */ -function generateSelect($structuresConcretes, \Laminas\View\Renderer\PhpRenderer $renderer) +function generateSelect(array $structuresConcretes, \Laminas\View\Renderer\PhpRenderer $renderer): string { - $texte = ""; - $texte .= "<select name='nouveau' class='selectpicker' data-bs-html='true' data-live-search='true'>"; + $texte = "<select name='nouveau' class='selectpicker' data-bs-html='true' data-live-search='true'>"; $texte .= "<option value=''>(Sélectionnez la structure à ajouter)</option>"; foreach ($structuresConcretes as $structuresConcrete) { - $url = $renderer->url('substitution-generer', ['id' => $structuresConcrete->getStructure()->getId()]); - $texte .= "<option data-struct-id='" . $structuresConcrete->getId() . "' value='" . $url . "'>" . $structuresConcrete->getLibelle() . "</option>"; + $url = $renderer->url('substitution-generer', ['id' => $structuresConcrete['structure']['id']]); + $disabled = isset($structuresConcrete['structure']['structureSubstituante'][0]) ? 'disabled' : ''; + $texte .= "<option data-struct-id='" . $structuresConcrete['id'] . "' value='" . $url . "' $disabled>" . $structuresConcrete['structure']['libelle'] . "</option>"; } $texte .= "</select>"; return $texte; diff --git a/module/Structure/view/structure/substitution/partial/substitution-automatique.phtml b/module/Structure/view/structure/substitution/partial/substitution-automatique.phtml index 04a3cbac2a33b50188cf1e3ac72adc77f8248eba..8fced26d7223385d4813617d01189d018c53a12f 100644 --- a/module/Structure/view/structure/substitution/partial/substitution-automatique.phtml +++ b/module/Structure/view/structure/substitution/partial/substitution-automatique.phtml @@ -5,6 +5,8 @@ * @var string $type * @var StructureConcreteInterface[] $substituees * @var StructureConcreteInterface $substituante + * + * @see \Structure\Controller\SubstitutionController::substitutionAutomatiqueAction() */ use Structure\Entity\Db\StructureConcreteInterface; @@ -13,55 +15,53 @@ use Structure\Entity\Db\StructureConcreteInterface; <div id="div_<?php echo $type; ?>_<?php echo $identifiant; ?>" class="card"> <div class="card-header bg-dark text-white"> - Substitution basé sur l'identitfiant <?php echo $identifiant; ?> + Substitution basée sur l'identifiant commun '<?php echo $identifiant; ?>' </div> <div class="row card-body"> - <div class="col-md-5"> - Substituées : + <div class="col-md-7"> + Substituables : <ol> <?php foreach($substituees as $structure): ?> <li> <?php echo $structure->getSourceCode(); ?> - - <?php echo $structure->getLibelle(); ?> + <?php echo $structure->getStructure()->getLibelle(); ?> </li> <?php endforeach; ?> </ol> </div> - <div class="col-md-5"> - Substituante : - <?php if ($substituante !== null): ?> - <ul> - <li> - <?php echo $substituante->getSourceCode(); ?> - - - <?php echo $substituante->getLibelle(); ?> - </li> - </ul> - <?php endif ?> - </div> +<!-- <div class="col-md-5">--> +<!-- Substituante :--> +<!-- --><?php //if ($substituante !== null): ?> +<!-- <ul>--> +<!-- <li>--> +<!-- --><?php //echo $substituante->getSourceCode(); ?> +<!-- ---> +<!-- --><?php //echo $substituante->getStructure()->getLibelle(); ?> +<!-- </li>--> +<!-- </ul>--> +<!-- --><?php //endif ?> +<!-- </div>--> <div class="col-md-2"> <a data-event="edition-substitution" href="<?php echo $this->url('substitution-automatique/modifier', ['type' => $type, 'identifiant' => $identifiant], [], true); ?>" - class="ajax-modal" + class="ajax-modalx" > - <button id="editer_<?php echo $type; ?>_<?php echo $identifiant; ?>" class="btn btn-info" style="width:95%;margin:2px;"> + <button id="editer_<?php echo $type; ?>_<?php echo $identifiant; ?>" class="btn btn-primary"> <span class="icon icon-edit"></span> - Personnaliser + Personnaliser... </button> </a> - <br/> - <button id="valider_<?php echo $type; ?>_<?php echo $identifiant; ?>" class="btn btn-success" style="width:95%;margin:2px;"> - <span class="icon icon-oui"></span> - Enregistrer - </button> - <br/> - <button id="annuler_<?php echo $type; ?>_<?php echo $identifiant; ?>" class="btn btn-danger" style="width:95%;margin:2px;"> +<!-- <button id="valider_--><?php //echo $type; ?><!--_--><?php //echo $identifiant; ?><!--" class="btn btn-success">--> +<!-- <span class="icon icon-oui"></span>--> +<!-- Enregistrer--> +<!-- </button>--> + <button id="annuler_<?php echo $type; ?>_<?php echo $identifiant; ?>" class="btn btn-outline-danger"> <span class="icon icon-delete"></span> Masquer - </button> <br/> + </button> </div> </div> </div> diff --git a/module/Structure/view/structure/substitution/substitution-automatique.phtml b/module/Structure/view/structure/substitution/substitution-automatique.phtml index 7571aaa47e38e641d9747f7fabb1d51505531975..baf9314bb57230b8de24b26b2ff565ebdc027a38 100644 --- a/module/Structure/view/structure/substitution/substitution-automatique.phtml +++ b/module/Structure/view/structure/substitution/substitution-automatique.phtml @@ -5,17 +5,19 @@ * @var array $substitutionsEcolesDoctorales (identifiant => EcoleDoctorale[]) * @var array $substitutionsEtablissements (identifiant => Etablissement[]) * @var array $substitutionsUnitesRecherches (identifiant => UniteRecherche[]) + * + * @see \Structure\Controller\SubstitutionController::substitutionAutomatiqueAction() */ use Structure\Entity\Db\TypeStructure; ?> -<?php $this->headTitle($this->translate("Substitutions automatiques")) ?> +<?php $this->headTitle()->append($this->translate("Recherche de substitutions possibles")) ?> <h1 class="page-header first"> - Substitutions automatiques + Recherche de substitutions possibles </h1> <?php @@ -79,7 +81,7 @@ echo $messenger->addMessagesFromFlashMessenger(); var type = id[1]; var identifiant = id[2]; - var url = "automatique/enregistrer/" + type + "/" + identifiant; + var url = type + "/enregistrer/" + identifiant; $.ajax({ type: "POST", url : url, diff --git a/module/Structure/view/structure/unite-recherche/index.phtml b/module/Structure/view/structure/unite-recherche/index.phtml index 320e07a003444309ef54806f3068fa5199159c71..7ca835e9fc364babe0eb8c7cb0a62f510c37d6e1 100644 --- a/module/Structure/view/structure/unite-recherche/index.phtml +++ b/module/Structure/view/structure/unite-recherche/index.phtml @@ -69,7 +69,7 @@ $canSubstituer = $this->isAllowed(SubstitutionPrivileges::getResourceId(Substitu <tr> <td> <a href="<?php echo $this->url('unite-recherche/information', ['structure' => $unite->getStructure()->getId()], [], true); ?>"> - <?php echo $unite->getLibelle(); ?> + <?php echo $unite->getStructure()->getLibelle(); ?> <?php if ($unite->getStructure()->estFermee()) : ?> <span class="badge bg-danger">Structure fermée</span> <?php endif; ?> @@ -81,7 +81,7 @@ $canSubstituer = $this->isAllowed(SubstitutionPrivileges::getResourceId(Substitu <td> <?php echo $unite->getStructure()->getCode(); ?> </td> - <td> <?php echo $unite->getSigle(); ?> </td> + <td> <?php echo $unite->getStructure()->getSigle(); ?> </td> <td> <?php echo $unite->getRNSR(); ?> </td> <!-- <td> --><?php //echo count($unite->getTheses()); ?><!-- </td>--> <td> diff --git a/module/Structure/view/structure/unite-recherche/information.phtml b/module/Structure/view/structure/unite-recherche/information.phtml index 1ef78cab0ddd1c4dc71ecc493164a673b67af1d0..542831286b1dfeba4dc864bf9c998de68501f7e0 100644 --- a/module/Structure/view/structure/unite-recherche/information.phtml +++ b/module/Structure/view/structure/unite-recherche/information.phtml @@ -34,7 +34,7 @@ $structure = $unite->getStructure(); ?> <h1 class="page-header"> - Unité de recherche « <?php echo $unite->getLibelle(); ?> » + Unité de recherche « <?php echo $unite->getStructure()->getLibelle(); ?> » </h1> <?php echo $this->messenger()->addMessagesFromFlashMessengerWithNoNamespace() ?> @@ -82,9 +82,9 @@ $structure = $unite->getStructure(); <div class="col-md-8"> <dl> <dt> Libelle :</dt> - <dd> <?php echo $unite->getLibelle(); ?> </dd> + <dd> <?php echo $unite->getStructure()->getLibelle(); ?> </dd> <dt> Sigle :</dt> - <dd> <?php echo $unite->getSigle(); ?> </dd> + <dd> <?php echo $unite->getStructure()->getSigle(); ?> </dd> <dt> Code :</dt> <dd> <?php echo $unite->getStructure()->getCode(); ?> </dd> <dt> Id REF: </dt> @@ -109,7 +109,7 @@ $structure = $unite->getStructure(); <dd> <ul> <?php foreach ($etablissementsRattachements as $etablissementRattachement) : ?> - <li> <?php echo $etablissementRattachement->getEtablissement()->getLibelle(); ?></li> + <li> <?php echo $etablissementRattachement->getEtablissement()->getStructure()->getLibelle(); ?></li> <?php endforeach; ?> </ul> </dd> diff --git a/module/Structure/view/structure/unite-recherche/modifier.phtml b/module/Structure/view/structure/unite-recherche/modifier.phtml index 5e9e87b724f53852dfb7a7e4206a55aa6eede884..d5aee691bd1b6002ca62dfbaa6f9b01b1865b5f0 100644 --- a/module/Structure/view/structure/unite-recherche/modifier.phtml +++ b/module/Structure/view/structure/unite-recherche/modifier.phtml @@ -40,7 +40,7 @@ $form->get('code')->setAttribute('readonly', !$editable); <?php if ($isNew): ?> Création d'une nouvelle UR <?php else: ?> - Modification de l'UR « <?php echo $unite->getLibelle(); ?> » + Modification de l'UR « <?php echo $unite->getStructure()->getLibelle(); ?> » <?php endif ?> </h1> @@ -71,7 +71,7 @@ $form->get('code')->setAttribute('readonly', !$editable); $content = $logoContent; if ($content === null) { - $unite->setCheminLogo(null); + $unite->getStructure()->setCheminLogo(null); } ?> @@ -146,7 +146,7 @@ $form->get('code')->setAttribute('readonly', !$editable); <tbody> <?php foreach ($etablissementsRattachements as $etablissementRattachement): ?> <tr> - <td> <?php echo $etablissementRattachement->getEtablissement()->getLibelle(); ?> </td> + <td> <?php echo $etablissementRattachement->getEtablissement()->getStructure()->getLibelle(); ?> </td> <td> <a href="<?php echo $this->url("unite-recherche/modifier/retirer-etablissement-rattachement", ["structure" => $idUniteRecherche, "etablissement" => $etablissementRattachement->getEtablissement()->getId()], [], true); ?>" diff --git a/module/These/src/These/Controller/CoEncadrantController.php b/module/These/src/These/Controller/CoEncadrantController.php index 5484176149bf33f5a8d65df688f52643b8ba4a5d..c6629e3d6d078db9e9d9b427929dbaf5fa02846a 100644 --- a/module/These/src/These/Controller/CoEncadrantController.php +++ b/module/These/src/These/Controller/CoEncadrantController.php @@ -164,7 +164,7 @@ class CoEncadrantController extends AbstractActionController { $logos = []; try { - $logos['etablissement'] = $this->fichierStorageService->getFileForLogoStructure($coencadrant->getEtablissement()); + $logos['etablissement'] = $this->fichierStorageService->getFileForLogoStructure($coencadrant->getEtablissement()->getStructure()); } catch (StorageAdapterException $e) { $logos['etablissement'] = null; } @@ -203,7 +203,7 @@ class CoEncadrantController extends AbstractActionController { ); $records[] = $entry; } - $filename = (new DateTime())->format('Ymd-His') . '_coencadrants-' . str_replace(' ','_',$structure->getSigle()) . '.csv'; + $filename = (new DateTime())->format('Ymd-His') . '_coencadrants-' . str_replace(' ','_',$structure->getStructure()->getSigle()) . '.csv'; $CSV = new CsvModel(); $CSV->setDelimiter(';'); $CSV->setEnclosure('"'); diff --git a/module/These/src/These/Controller/TheseController.php b/module/These/src/These/Controller/TheseController.php index 5c9fef219db60dffb55b87ea983121663e3e3bd8..f3a5472bb2a4e38c8ce405bef83f730623f9aca0 100755 --- a/module/These/src/These/Controller/TheseController.php +++ b/module/These/src/These/Controller/TheseController.php @@ -1374,7 +1374,7 @@ class TheseController extends AbstractController $etablissement = $these->getEtablissement(); } try { - $cheminLogo = $this->fichierStorageService->getFileForLogoStructure($etablissement); + $cheminLogo = $this->fichierStorageService->getFileForLogoStructure($etablissement->getStructure()); } catch (StorageAdapterException $e) { $cheminLogo = null; } diff --git a/module/These/src/These/Service/CoEncadrant/Exporter/JustificatifCoencadrements/justificatif-coencadrements.phtml b/module/These/src/These/Service/CoEncadrant/Exporter/JustificatifCoencadrements/justificatif-coencadrements.phtml index 61ed3e056f01637d8c898198843415e0da5ae9c9..cc49174bc24339b2435e817dba25672787f08e09 100644 --- a/module/These/src/These/Service/CoEncadrant/Exporter/JustificatifCoencadrements/justificatif-coencadrements.phtml +++ b/module/These/src/These/Service/CoEncadrant/Exporter/JustificatifCoencadrements/justificatif-coencadrements.phtml @@ -122,7 +122,7 @@ use Application\View\Renderer\PhpRenderer; <p> Ce document certifie que <?php echo $coencadrant->getIndividu()->getPrenom1(); ?> <?php echo $coencadrant->getIndividu()->getNomUsuel(); ?>, actuellement <?php echo ($coencadrant->getQualite() !== " ")?$coencadrant->getQualite():""; ?> à - <?php echo ($coencadrant->getEtablissement())?$coencadrant->getEtablissement()->getLibelle():"<span style='color:darkred;'>établissement manquant</span>"; ?>, + <?php echo ($coencadrant->getEtablissement())?$coencadrant->getEtablissement()->getStructure()->getLibelle():"<span style='color:darkred;'>établissement manquant</span>"; ?>, a assuré la fonction de co-encadrant sur pour les thèses suivantes : </p> @@ -135,9 +135,9 @@ use Application\View\Renderer\PhpRenderer; <?php echo $these->getDoctorant()->getIndividu()->getPrenom1(); ?> <?php echo $these->getDoctorant()->getIndividu()->getNomUsuel(); ?> - - <?php echo $these->getEtablissement()->getLibelle(); ?> + <?php echo $these->getEtablissement()->getStructure()->getLibelle(); ?> - - <?php echo $these->getUniteRecherche()->getLibelle(); ?> (<?php echo $these->getUniteRecherche()->getSigle(); ?>) + <?php echo $these->getUniteRecherche()->getStructure()->getLibelle(); ?> (<?php echo $these->getUniteRecherche()->getStructure()->getSigle(); ?>) </li> <?php endforeach; ?> </ul> diff --git a/module/These/src/These/Service/These/TheseService.php b/module/These/src/These/Service/These/TheseService.php index 6fa3093bf6e9dfc6fb4aca692b4f16fa10296099..901eb244e1fdc15996ab71bd93171ad3e8d26e28 100644 --- a/module/These/src/These/Service/These/TheseService.php +++ b/module/These/src/These/Service/These/TheseService.php @@ -503,7 +503,7 @@ class TheseService extends BaseService implements ListenerAggregateInterface $pdcData->setTitre($these->getTitre()); $pdcData->setSpecialite($these->getLibelleDiscipline()); if ($these->getEtablissement()) { - $pdcData->setEtablissement($these->getEtablissement()->getLibelle()); + $pdcData->setEtablissement($these->getEtablissement()->getStructure()->getLibelle()); } if ($these->getDoctorant()) { $pdcData->setDoctorant(strtoupper($these->getDoctorant()->getIndividu()->getNomComplet(false, true, false, true, true, false))); @@ -574,11 +574,11 @@ class TheseService extends BaseService implements ListenerAggregateInterface if ($directeur->getEtablissement()->estAssocie()) { $pdcData->setAssocie(true); try { - $pdcData->setLogoAssocie($this->fichierStorageService->getFileForLogoStructure($directeur->getEtablissement())); + $pdcData->setLogoAssocie($this->fichierStorageService->getFileForLogoStructure($directeur->getEtablissement()->getStructure())); } catch (StorageAdapterException $e) { $pdcData->setLogoAssocie(null); } - $pdcData->setLibelleAssocie($directeur->getEtablissement()->getLibelle()); + $pdcData->setLibelleAssocie($directeur->getEtablissement()->getStructure()->getLibelle()); } } } @@ -640,13 +640,13 @@ class TheseService extends BaseService implements ListenerAggregateInterface foreach ($directeurs as $directeur) { $current = strtoupper($directeur->getIndividu()->getNomComplet(false, false, false, true, true)); $structure = ($these->getUniteRecherche())?:$directeur->getIndividu()->getUniteRecherche()?:$directeur->getIndividu()->getEtablissement(); - if ($structure !== null) $current .= " (". $structure->getLibelle() .")"; + if ($structure !== null) $current .= " (". $structure->getStructure()->getLibelle() .")"; $nomination[] = $current; } foreach ($codirecteurs as $directeur) { $current = strtoupper($directeur->getIndividu()->getNomComplet(false, false, false, true, true)); $structure = ($directeur->getIndividu()->getUniteRecherche())?:$directeur->getIndividu()->getEtablissement(); - if ($structure !== null) $current .= " (". $structure->getLibelle() .")"; + if ($structure !== null) $current .= " (". $structure->getStructure()->getLibelle() .")"; $nomination[] = $current; } $pdcData->setListing(implode(" et ", $nomination)); @@ -656,26 +656,26 @@ class TheseService extends BaseService implements ListenerAggregateInterface // chemins vers les logos if ($comue = $this->etablissementService->fetchEtablissementComue()) { try { - $pdcData->setLogoCOMUE($this->fichierStorageService->getFileForLogoStructure($comue)); + $pdcData->setLogoCOMUE($this->fichierStorageService->getFileForLogoStructure($comue->getStructure())); } catch (StorageAdapterException $e) { $pdcData->setLogoCOMUE(null); } } try { - $pdcData->setLogoEtablissement($this->fichierStorageService->getFileForLogoStructure($these->getEtablissement())); + $pdcData->setLogoEtablissement($this->fichierStorageService->getFileForLogoStructure($these->getEtablissement()->getStructure())); } catch (StorageAdapterException $e) { $pdcData->setLogoEtablissement(null); } if ($these->getEcoleDoctorale() !== null) { try { - $pdcData->setLogoEcoleDoctorale($this->fichierStorageService->getFileForLogoStructure($these->getEcoleDoctorale())); + $pdcData->setLogoEcoleDoctorale($this->fichierStorageService->getFileForLogoStructure($these->getEcoleDoctorale()->getStructure())); } catch (StorageAdapterException $e) { $pdcData->setLogoEcoleDoctorale(null); } } if ($these->getUniteRecherche() !== null) { try { - $pdcData->setLogoUniteRecherche($this->fichierStorageService->getFileForLogoStructure($these->getUniteRecherche())); + $pdcData->setLogoUniteRecherche($this->fichierStorageService->getFileForLogoStructure($these->getUniteRecherche()->getStructure())); } catch (StorageAdapterException $e) { $pdcData->setLogoUniteRecherche(null); } diff --git a/module/These/view/these/co-encadrant/partial/table-these.phtml b/module/These/view/these/co-encadrant/partial/table-these.phtml index 94eed380a7ad2abf8b21ca837b38b076795183fc..0f3e273eaa21d91cbbfe51f1b06a0562396f81f6 100644 --- a/module/These/view/these/co-encadrant/partial/table-these.phtml +++ b/module/These/view/these/co-encadrant/partial/table-these.phtml @@ -28,13 +28,13 @@ use These\Entity\Db\These; <?php echo $these->getDoctorant()->getIndividu()->getNomUsuel(); ?> </td> <td> - <?php echo $these->getUniteRecherche()->getSigle(); ?> + <?php echo $these->getUniteRecherche()->getStructure()->getSigle(); ?> </td> <td> - <?php echo $these->getEcoleDoctorale()->getSigle(); ?> + <?php echo $these->getEcoleDoctorale()->getStructure()->getSigle(); ?> </td> <td> - <?php echo $these->getEtablissement()->getLibelle(); ?> + <?php echo $these->getEtablissement()->getStructure()->getLibelle(); ?> </td> <td> <?php echo $these->getEtatThese(); ?> diff --git a/module/These/view/these/these-recherche/index.phtml b/module/These/view/these/these-recherche/index.phtml index 43536a23b34d94beca303f3408c1d1c852af83b6..e6900a08de83625fb191a3101c42a9e9c39b6dd2 100644 --- a/module/These/view/these/these-recherche/index.phtml +++ b/module/These/view/these/these-recherche/index.phtml @@ -144,7 +144,7 @@ $acteursFormatterCodirecteurs->asSeparated() if ($displayEtablissement) { echo "<td>"; echo "<abbr title='"; - echo $these->getEtablissement()->getLibelle(); + echo $these->getEtablissement()->getStructure()->getLibelle(); echo "'>"; echo $these->getEtablissement()->getStructure()->getCode(); echo "</abbr>"; @@ -169,9 +169,9 @@ $acteursFormatterCodirecteurs->asSeparated() </td> <td> <?php if($these->getEcoleDoctorale()): ?> - <abbr title="<?php echo $these->getEcoleDoctorale()->getLibelle() ?>"> + <abbr title="<?php echo $these->getEcoleDoctorale()->getStructure()->getLibelle() ?>"> <?php - $sigle = $these->getEcoleDoctorale()->getSigle(); + $sigle = $these->getEcoleDoctorale()->getStructure()->getSigle(); if ($sigle && $sigle !== "") { echo $sigle; } else { @@ -183,7 +183,7 @@ $acteursFormatterCodirecteurs->asSeparated() </td> <td> <?php if($these->getUniteRecherche()): ?> - <abbr title="<?php echo $these->getUniteRecherche()->getLibelle() ?>"> + <abbr title="<?php echo $these->getUniteRecherche()->getStructure()->getLibelle() ?>"> <?php echo $these->getUniteRecherche()->getStructure()->getCode(); ?> </abbr> <?php endif ?> diff --git a/module/These/view/these/these/identite.phtml b/module/These/view/these/these/identite.phtml index 3b9e329d08e66078b1dd632eb2dcaa6bdc13e13f..a40efdd6df100242fe5a80754aead69c02e5f0c5 100644 --- a/module/These/view/these/these/identite.phtml +++ b/module/These/view/these/these/identite.phtml @@ -233,7 +233,7 @@ $financementFormatter->setDisplayAs(FinancementFormatter::DISPLAY_AS_LINE); <?php if ($these->getEtablissement()) { echo /*$these->getEtablissement()->getCode() . " - " .*/ - $these->getEtablissement()->getLibelle(); + $these->getEtablissement()->getStructure()->getLibelle(); } else { echo "<div class='alert alert-sm alert-warning'>"; echo "<span class='fas fa-exclamation-triangle'></span> Aucun établissement n'est renseignée."; @@ -258,7 +258,7 @@ $financementFormatter->setDisplayAs(FinancementFormatter::DISPLAY_AS_LINE); <?php if ($these->getUniteRecherche()) { echo /*$these->getUniteRecherche()->getSourceCode() . " - " .*/ - $these->getUniteRecherche()->getLibelle(); + $these->getUniteRecherche()->getStructure()->getLibelle(); } elseif ($these->getCodeUniteRecherche() && $these->getLibelleUniteRecherche()) { echo $these->getCodeUniteRecherche() . " - " . $these->getLibelleUniteRecherche(); echo "<div class='alert alert-sm alert-warning'>"; @@ -284,7 +284,7 @@ $financementFormatter->setDisplayAs(FinancementFormatter::DISPLAY_AS_LINE); echo "(Aucun établissement de rattachement renseigné)"; } else { foreach ($rattachements as $rattachement) { - echo $rattachement->getEtablissement()->getLibelle(); + echo $rattachement->getEtablissement()->getStructure()->getLibelle(); echo "<br/>"; } } @@ -298,7 +298,7 @@ $financementFormatter->setDisplayAs(FinancementFormatter::DISPLAY_AS_LINE); <dd class="col-md-8"> <?php if ($these->getEcoleDoctorale()) { echo /*$these->getEcoleDoctorale()->getSourceCode() . " - " .*/ - $these->getEcoleDoctorale()->getLibelle(); + $these->getEcoleDoctorale()->getStructure()->getLibelle(); } else { echo "<div class='alert alert-sm alert-warning'>"; echo "<span class='fas fa-exclamation-triangle'></span> Aucune école doctorale n'est renseignée."; diff --git a/module/These/view/these/these/partial/fiche.phtml b/module/These/view/these/these/partial/fiche.phtml index ca4a636e34f687ca2bda8e0c777694b30c2a3842..444ce770c29704cf9ca079f716251807f458ec71 100644 --- a/module/These/view/these/these/partial/fiche.phtml +++ b/module/These/view/these/these/partial/fiche.phtml @@ -48,9 +48,9 @@ $acteursFormatter = new ActeursFormatter(); <td> <?php $etablissement = $these->getEtablissement(); - if ($etablissement === null) echo "Non renseigné"; else echo $etablissement->getSigle(); + if ($etablissement === null) echo "Non renseigné"; else echo $etablissement->getStructure()->getSigle(); echo " - "; - if ($etablissement === null) echo "Non renseigné"; else echo $etablissement->getLibelle(); + if ($etablissement === null) echo "Non renseigné"; else echo $etablissement->getStructure()->getLibelle(); ?> </td> @@ -60,7 +60,7 @@ $acteursFormatter = new ActeursFormatter(); <th>École doct.</th> <td> <?php if ($these->getEcoleDoctorale()): ?> - <?php echo $these->getEcoleDoctorale()->getSigle() . " - " . $these->getEcoleDoctorale()->getLibelle() ?> + <?php echo $these->getEcoleDoctorale()->getStructure()->getSigle() . " - " . $these->getEcoleDoctorale()->getStructure()->getLibelle() ?> <?php endif ?> </td> </tr>