Loading CHANGELOG.md +4 −0 Changes for CHANGELOG.md: 4 added lines, 0 removed lines. Original line number Diff line number Diff line Journal des modifications ========================= 8.3.0 ----- - Module Step-Star > Ligne de commande : améliorations des logs (affichage des critères appliqués, notamment) ; factorisation. 8.2.0 ----- - Page des privilèges accordés aux profils : cosmétiques + ancres de navigation sur les catégories et privilèges. Loading module/StepStar/src/StepStar/Controller/CriteriaAwareControllerTrait.php 0 → 100644 +43 −0 Changes for module/StepStar/src/StepStar/Controller/CriteriaAwareControllerTrait.php: 43 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace StepStar\Controller; use Laminas\Mvc\Controller\AbstractActionController; trait CriteriaAwareControllerTrait { private ?string $these; private ?string $etat; private ?bool $dateSoutenanceNull; private ?string $dateSoutenanceMin; private ?string $dateSoutenanceMax; private ?string $etablissement; private ?bool $force; private ?string $tag; protected function loadCriteriaFromControllerParams(AbstractActionController $controller): void { $this->these = $controller->params()->fromRoute('these'); // ex : '12345' ou '12345,12346' $this->etat = $controller->params()->fromRoute('etat'); // ex : 'E' ou 'E,S' $this->dateSoutenanceNull = (bool) $controller->params()->fromRoute('date-soutenance-null'); $this->dateSoutenanceMin = $controller->params()->fromRoute('date-soutenance-min'); // ex : '2022-03-11' ou 'P6M' $this->dateSoutenanceMax = $controller->params()->fromRoute('date-soutenance-max'); // ex : '2022-03-11' ou 'P6M' $this->etablissement = $controller->params()->fromRoute('etablissement'); // ex : 'UCN' ou 'UCN,URN' $this->force = (bool) $this->params()->fromRoute('force'); $this->tag = $controller->params()->fromRoute('tag'); } protected function getCriteriaAsArray(): array { return array_filter([ 'these' => $this->these, 'etat' => $this->etat, 'dateSoutenanceNull' => $this->dateSoutenanceNull, 'dateSoutenanceMin' => $this->dateSoutenanceMin, 'dateSoutenanceMax' => $this->dateSoutenanceMax, 'etablissement' => $this->etablissement, 'force' => $this->force, 'tag' => $this->tag, ]); } } No newline at end of file module/StepStar/src/StepStar/Controller/Envoi/EnvoiConsoleController.php +14 −14 Changes for module/StepStar/src/StepStar/Controller/Envoi/EnvoiConsoleController.php: 14 added lines, 14 removed lines. Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ namespace StepStar\Controller\Envoi; use StepStar\Controller\CriteriaAwareControllerTrait; use StepStar\Facade\Envoi\EnvoiFacadeAwareTrait; use StepStar\Service\Fetch\FetchServiceAwareTrait; use Unicaen\Console\Controller\AbstractConsoleController; Loading @@ -9,8 +10,8 @@ use Unicaen\Console\Controller\AbstractConsoleController; class EnvoiConsoleController extends AbstractConsoleController { use EnvoiFacadeAwareTrait; use FetchServiceAwareTrait; use CriteriaAwareControllerTrait; /** * Action pour envoyer des fichiers TEF vers STEP/STAR. Loading @@ -35,29 +36,28 @@ class EnvoiConsoleController extends AbstractConsoleController { $command = implode(' ', $this->getRequest()->getContent()); $these = $this->params()->fromRoute('these'); // ex : '12345' ou '12345,12346' $etat = $this->params()->fromRoute('etat'); // ex : 'E' ou 'E,S' $dateSoutenanceNull = (bool) $this->params()->fromRoute('date-soutenance-null'); $dateSoutenanceMin = $this->params()->fromRoute('date-soutenance-min'); // ex : '2022-03-11' ou 'P6M' $dateSoutenanceMax = $this->params()->fromRoute('date-soutenance-max'); // ex : '2022-03-11' ou 'P6M' $etablissement = $this->params()->fromRoute('etablissement'); // ex : 'UCN' ou 'UCN,URN' $force = (bool) $this->params()->fromRoute('force'); $tag = $this->params()->fromRoute('tag'); $criteria = array_filter(compact('these', 'etat', 'dateSoutenanceNull', 'dateSoutenanceMin', 'dateSoutenanceMax', 'etablissement')); $this->loadCriteriaFromControllerParams($this); $criteria = $this->getCriteriaAsArray(); $theses = $this->fetchService->fetchThesesByCriteria($criteria); $criteriaToStrings = $this->fetchService->getCriteriaToStrings(); $this->console->writeLine("Criteres de recherche specifies :"); foreach ($criteriaToStrings as $str) { $this->console->writeLine(" - " . $str); } if (empty($theses)) { $this->console->write("Aucune these trouvee avec les criteres specifies."); $this->console->writeLine("Aucune these trouvee avec les criteres specifies."); exit(0); } $this->console->writeLine("Nombre de theses trouvees : " . count($theses)); $this->envoiFacade->setSaveLogs(true); $logs = $this->envoiFacade->envoyerTheses($theses, $force, $command, $tag); $logs = $this->envoiFacade->envoyerTheses($theses, $this->force, $command, $this->tag); /** @var \StepStar\Entity\Db\Log $log */ foreach ($logs as $log) { $this->console->write($log->getLog()); $this->console->writeLine($log->getLog()); } } } No newline at end of file module/StepStar/src/StepStar/Controller/Generate/GenerateConsoleController.php +14 −13 Changes for module/StepStar/src/StepStar/Controller/Generate/GenerateConsoleController.php: 14 added lines, 13 removed lines. Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ namespace StepStar\Controller\Generate; use StepStar\Controller\CriteriaAwareControllerTrait; use StepStar\Facade\Generate\GenerateFacadeAwareTrait; use StepStar\Service\Fetch\FetchServiceAwareTrait; use Unicaen\Console\Controller\AbstractConsoleController; Loading @@ -10,6 +11,7 @@ class GenerateConsoleController extends AbstractConsoleController { use GenerateFacadeAwareTrait; use FetchServiceAwareTrait; use CriteriaAwareControllerTrait; /** * Action pour générer les fichiers nécessaires à l'envoi de plusieurs theses vers STEP/STAR. Loading @@ -18,28 +20,27 @@ class GenerateConsoleController extends AbstractConsoleController { $command = implode(' ', $this->getRequest()->getContent()); $these = $this->params()->fromRoute('these'); // ex : '12345' ou '12345,12346' $etat = $this->params()->fromRoute('etat'); // ex : 'E' ou 'E,S' $dateSoutenanceNull = (bool) $this->params()->fromRoute('date-soutenance-null'); $dateSoutenanceMin = $this->params()->fromRoute('date-soutenance-min'); // ex : '2022-03-11' ou 'P6M' $dateSoutenanceMax = $this->params()->fromRoute('date-soutenance-max'); // ex : '2022-03-11' ou 'P6M' $etablissement = $this->params()->fromRoute('etablissement'); // ex : 'UCN' ou 'UCN,URN' $tag = $this->params()->fromRoute('tag'); $criteria = array_filter(compact('these', 'etat', 'dateSoutenanceNull', 'dateSoutenanceMin', 'dateSoutenanceMax', 'etablissement')); $this->loadCriteriaFromControllerParams($this); $criteria = $this->getCriteriaAsArray(); $theses = $this->fetchService->fetchThesesByCriteria($criteria); $criteriaToStrings = $this->fetchService->getCriteriaToStrings(); $this->console->writeLine("Criteres de recherche specifies :"); foreach ($criteriaToStrings as $str) { $this->console->writeLine(" - " . $str); } if (empty($theses)) { $this->console->write("Aucune these trouvee avec les criteres specifies."); $this->console->writeLine("Aucune these trouvee avec les criteres specifies."); exit(0); } $this->console->writeLine("Nombre de theses trouvees : " . count($theses)); $logs = $this->generateFacade->generateFilesForTheses($theses, $command, $tag); $logs = $this->generateFacade->generateFilesForTheses($theses, $command, $this->tag); /** @var \StepStar\Entity\Db\Log $log */ foreach ($logs as $log) { $this->console->write("These " . $log->getTheseId()); $this->console->write($log->getLog()); $this->console->writeLine($log->getLog()); } } } No newline at end of file module/StepStar/src/StepStar/Service/Fetch/FetchService.php +61 −35 Changes for module/StepStar/src/StepStar/Service/Fetch/FetchService.php: 61 added lines, 35 removed lines. Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ use DateInterval; use DateTime; use Doctrine\ORM\Query\Expr\Join; use Doctrine\ORM\Query\QueryException; use Doctrine\ORM\QueryBuilder; use Exception; use InvalidArgumentException; use LogicException; Loading @@ -17,6 +18,19 @@ class FetchService { use TheseServiceAwareTrait; /** * @var string[] */ private array $criteriaToStrings; /** * @return string[] */ public function getCriteriaToStrings(): array { return $this->criteriaToStrings; } /** * Fetch et hydrate au format array une thèse spécifiée par son id, * avec toutes les jointures requises pour l'export XML. Loading Loading @@ -53,42 +67,8 @@ class FetchService throw new InvalidArgumentException("Une liste de critères vide n'est pas acceptée"); } $these = $criteria['these'] ?? null; // ex : '12345' ou '12345,12346' $etat = $criteria['etat'] ?? null; // ex : 'E' ou 'E,S' $dateSoutenanceNull = $criteria['dateSoutenanceNull'] ?? false; $dateSoutenanceMin = $criteria['dateSoutenanceMin'] ?? null; // ex : '2022-03-11' ou 'P6M' $dateSoutenanceMax = $criteria['dateSoutenanceMax'] ?? null; // ex : '2022-03-11' ou 'P6M' $etablissement = $criteria['etablissement'] ?? null; // ex : 'UCN' ou 'UCN,URN' $qb = $this->createQueryBuilder(); if ($these !== null) { $thesesIds = array_map('trim', explode(',', $these)); $qb->where($qb->expr()->in('t.id', $thesesIds)); } else { if ($etat !== null) { $etats = array_map('trim', explode(',', $etat)); $qb->andWhereEtatIn($etats); } if ($dateSoutenanceNull) { $qb->andWhere('t.dateSoutenance is null'); } else { if ($dateSoutenanceMin !== null) { $qb ->andWhere('t.dateSoutenance >= :dateSoutMin') ->setParameter('dateSoutMin', $this->dateFromSpec($dateSoutenanceMin)); } if ($dateSoutenanceMax !== null) { $qb ->andWhere('t.dateSoutenance <= :dateSoutMax') ->setParameter('dateSoutMax', $this->dateFromSpec($dateSoutenanceMax)); } } if ($etablissement !== null) { $codesEtabs = array_map('trim', explode(',', $etablissement)); $qb->andWhere($qb->expr()->in('es.sourceCode', $codesEtabs)); } } $this->applyCriteriaToQb($criteria, $qb); return $qb->getQuery()->getArrayResult(); } Loading Loading @@ -163,4 +143,50 @@ class FetchService return $qb; } private function applyCriteriaToQb(array $criteria, QueryBuilder $qb): void { $these = $criteria['these'] ?? null; // ex : '12345' ou '12345,12346' $etat = $criteria['etat'] ?? null; // ex : 'E' ou 'E,S' $dateSoutenanceNull = $criteria['dateSoutenanceNull'] ?? false; $dateSoutenanceMin = $criteria['dateSoutenanceMin'] ?? null; // ex : '2022-03-11' ou 'P6M' $dateSoutenanceMax = $criteria['dateSoutenanceMax'] ?? null; // ex : '2022-03-11' ou 'P6M' $etablissement = $criteria['etablissement'] ?? null; // ex : 'UCN' ou 'UCN,URN' $this->criteriaToStrings = []; if ($these !== null) { $thesesIds = array_map('trim', explode(',', $these)); $qb->where($qb->expr()->in('t.id', $thesesIds)); $this->criteriaToStrings[] = 'Ids thèses : ' . $these; } else { if ($etat !== null) { $etats = array_map('trim', explode(',', $etat)); $qb->andWhereEtatIn($etats); $this->criteriaToStrings[] = 'Etats thèses : ' . $etat; } if ($dateSoutenanceNull) { $qb->andWhere('t.dateSoutenance is null'); $this->criteriaToStrings[] = 'Date de soutenance : null'; } else { if ($dateSoutenanceMin !== null) { $qb ->andWhere('t.dateSoutenance >= :dateSoutMin') ->setParameter('dateSoutMin', $dateSoutMin = $this->dateFromSpec($dateSoutenanceMin)); $this->criteriaToStrings[] = 'Date de soutenance >= ' . $dateSoutMin; } if ($dateSoutenanceMax !== null) { $qb ->andWhere('t.dateSoutenance <= :dateSoutMax') ->setParameter('dateSoutMax', $dateSoutMax = $this->dateFromSpec($dateSoutenanceMax)); $this->criteriaToStrings[] = 'Date de soutenance <= ' . $dateSoutMax; } } if ($etablissement !== null) { $codesEtabs = array_map('trim', explode(',', $etablissement)); $qb->andWhere($qb->expr()->in('es.sourceCode', $codesEtabs)); $this->criteriaToStrings[] = 'Etablissements : ' . $etablissement; } } } } No newline at end of file Loading
CHANGELOG.md +4 −0 Changes for CHANGELOG.md: 4 added lines, 0 removed lines. Original line number Diff line number Diff line Journal des modifications ========================= 8.3.0 ----- - Module Step-Star > Ligne de commande : améliorations des logs (affichage des critères appliqués, notamment) ; factorisation. 8.2.0 ----- - Page des privilèges accordés aux profils : cosmétiques + ancres de navigation sur les catégories et privilèges. Loading
module/StepStar/src/StepStar/Controller/CriteriaAwareControllerTrait.php 0 → 100644 +43 −0 Changes for module/StepStar/src/StepStar/Controller/CriteriaAwareControllerTrait.php: 43 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace StepStar\Controller; use Laminas\Mvc\Controller\AbstractActionController; trait CriteriaAwareControllerTrait { private ?string $these; private ?string $etat; private ?bool $dateSoutenanceNull; private ?string $dateSoutenanceMin; private ?string $dateSoutenanceMax; private ?string $etablissement; private ?bool $force; private ?string $tag; protected function loadCriteriaFromControllerParams(AbstractActionController $controller): void { $this->these = $controller->params()->fromRoute('these'); // ex : '12345' ou '12345,12346' $this->etat = $controller->params()->fromRoute('etat'); // ex : 'E' ou 'E,S' $this->dateSoutenanceNull = (bool) $controller->params()->fromRoute('date-soutenance-null'); $this->dateSoutenanceMin = $controller->params()->fromRoute('date-soutenance-min'); // ex : '2022-03-11' ou 'P6M' $this->dateSoutenanceMax = $controller->params()->fromRoute('date-soutenance-max'); // ex : '2022-03-11' ou 'P6M' $this->etablissement = $controller->params()->fromRoute('etablissement'); // ex : 'UCN' ou 'UCN,URN' $this->force = (bool) $this->params()->fromRoute('force'); $this->tag = $controller->params()->fromRoute('tag'); } protected function getCriteriaAsArray(): array { return array_filter([ 'these' => $this->these, 'etat' => $this->etat, 'dateSoutenanceNull' => $this->dateSoutenanceNull, 'dateSoutenanceMin' => $this->dateSoutenanceMin, 'dateSoutenanceMax' => $this->dateSoutenanceMax, 'etablissement' => $this->etablissement, 'force' => $this->force, 'tag' => $this->tag, ]); } } No newline at end of file
module/StepStar/src/StepStar/Controller/Envoi/EnvoiConsoleController.php +14 −14 Changes for module/StepStar/src/StepStar/Controller/Envoi/EnvoiConsoleController.php: 14 added lines, 14 removed lines. Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ namespace StepStar\Controller\Envoi; use StepStar\Controller\CriteriaAwareControllerTrait; use StepStar\Facade\Envoi\EnvoiFacadeAwareTrait; use StepStar\Service\Fetch\FetchServiceAwareTrait; use Unicaen\Console\Controller\AbstractConsoleController; Loading @@ -9,8 +10,8 @@ use Unicaen\Console\Controller\AbstractConsoleController; class EnvoiConsoleController extends AbstractConsoleController { use EnvoiFacadeAwareTrait; use FetchServiceAwareTrait; use CriteriaAwareControllerTrait; /** * Action pour envoyer des fichiers TEF vers STEP/STAR. Loading @@ -35,29 +36,28 @@ class EnvoiConsoleController extends AbstractConsoleController { $command = implode(' ', $this->getRequest()->getContent()); $these = $this->params()->fromRoute('these'); // ex : '12345' ou '12345,12346' $etat = $this->params()->fromRoute('etat'); // ex : 'E' ou 'E,S' $dateSoutenanceNull = (bool) $this->params()->fromRoute('date-soutenance-null'); $dateSoutenanceMin = $this->params()->fromRoute('date-soutenance-min'); // ex : '2022-03-11' ou 'P6M' $dateSoutenanceMax = $this->params()->fromRoute('date-soutenance-max'); // ex : '2022-03-11' ou 'P6M' $etablissement = $this->params()->fromRoute('etablissement'); // ex : 'UCN' ou 'UCN,URN' $force = (bool) $this->params()->fromRoute('force'); $tag = $this->params()->fromRoute('tag'); $criteria = array_filter(compact('these', 'etat', 'dateSoutenanceNull', 'dateSoutenanceMin', 'dateSoutenanceMax', 'etablissement')); $this->loadCriteriaFromControllerParams($this); $criteria = $this->getCriteriaAsArray(); $theses = $this->fetchService->fetchThesesByCriteria($criteria); $criteriaToStrings = $this->fetchService->getCriteriaToStrings(); $this->console->writeLine("Criteres de recherche specifies :"); foreach ($criteriaToStrings as $str) { $this->console->writeLine(" - " . $str); } if (empty($theses)) { $this->console->write("Aucune these trouvee avec les criteres specifies."); $this->console->writeLine("Aucune these trouvee avec les criteres specifies."); exit(0); } $this->console->writeLine("Nombre de theses trouvees : " . count($theses)); $this->envoiFacade->setSaveLogs(true); $logs = $this->envoiFacade->envoyerTheses($theses, $force, $command, $tag); $logs = $this->envoiFacade->envoyerTheses($theses, $this->force, $command, $this->tag); /** @var \StepStar\Entity\Db\Log $log */ foreach ($logs as $log) { $this->console->write($log->getLog()); $this->console->writeLine($log->getLog()); } } } No newline at end of file
module/StepStar/src/StepStar/Controller/Generate/GenerateConsoleController.php +14 −13 Changes for module/StepStar/src/StepStar/Controller/Generate/GenerateConsoleController.php: 14 added lines, 13 removed lines. Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ namespace StepStar\Controller\Generate; use StepStar\Controller\CriteriaAwareControllerTrait; use StepStar\Facade\Generate\GenerateFacadeAwareTrait; use StepStar\Service\Fetch\FetchServiceAwareTrait; use Unicaen\Console\Controller\AbstractConsoleController; Loading @@ -10,6 +11,7 @@ class GenerateConsoleController extends AbstractConsoleController { use GenerateFacadeAwareTrait; use FetchServiceAwareTrait; use CriteriaAwareControllerTrait; /** * Action pour générer les fichiers nécessaires à l'envoi de plusieurs theses vers STEP/STAR. Loading @@ -18,28 +20,27 @@ class GenerateConsoleController extends AbstractConsoleController { $command = implode(' ', $this->getRequest()->getContent()); $these = $this->params()->fromRoute('these'); // ex : '12345' ou '12345,12346' $etat = $this->params()->fromRoute('etat'); // ex : 'E' ou 'E,S' $dateSoutenanceNull = (bool) $this->params()->fromRoute('date-soutenance-null'); $dateSoutenanceMin = $this->params()->fromRoute('date-soutenance-min'); // ex : '2022-03-11' ou 'P6M' $dateSoutenanceMax = $this->params()->fromRoute('date-soutenance-max'); // ex : '2022-03-11' ou 'P6M' $etablissement = $this->params()->fromRoute('etablissement'); // ex : 'UCN' ou 'UCN,URN' $tag = $this->params()->fromRoute('tag'); $criteria = array_filter(compact('these', 'etat', 'dateSoutenanceNull', 'dateSoutenanceMin', 'dateSoutenanceMax', 'etablissement')); $this->loadCriteriaFromControllerParams($this); $criteria = $this->getCriteriaAsArray(); $theses = $this->fetchService->fetchThesesByCriteria($criteria); $criteriaToStrings = $this->fetchService->getCriteriaToStrings(); $this->console->writeLine("Criteres de recherche specifies :"); foreach ($criteriaToStrings as $str) { $this->console->writeLine(" - " . $str); } if (empty($theses)) { $this->console->write("Aucune these trouvee avec les criteres specifies."); $this->console->writeLine("Aucune these trouvee avec les criteres specifies."); exit(0); } $this->console->writeLine("Nombre de theses trouvees : " . count($theses)); $logs = $this->generateFacade->generateFilesForTheses($theses, $command, $tag); $logs = $this->generateFacade->generateFilesForTheses($theses, $command, $this->tag); /** @var \StepStar\Entity\Db\Log $log */ foreach ($logs as $log) { $this->console->write("These " . $log->getTheseId()); $this->console->write($log->getLog()); $this->console->writeLine($log->getLog()); } } } No newline at end of file
module/StepStar/src/StepStar/Service/Fetch/FetchService.php +61 −35 Changes for module/StepStar/src/StepStar/Service/Fetch/FetchService.php: 61 added lines, 35 removed lines. Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ use DateInterval; use DateTime; use Doctrine\ORM\Query\Expr\Join; use Doctrine\ORM\Query\QueryException; use Doctrine\ORM\QueryBuilder; use Exception; use InvalidArgumentException; use LogicException; Loading @@ -17,6 +18,19 @@ class FetchService { use TheseServiceAwareTrait; /** * @var string[] */ private array $criteriaToStrings; /** * @return string[] */ public function getCriteriaToStrings(): array { return $this->criteriaToStrings; } /** * Fetch et hydrate au format array une thèse spécifiée par son id, * avec toutes les jointures requises pour l'export XML. Loading Loading @@ -53,42 +67,8 @@ class FetchService throw new InvalidArgumentException("Une liste de critères vide n'est pas acceptée"); } $these = $criteria['these'] ?? null; // ex : '12345' ou '12345,12346' $etat = $criteria['etat'] ?? null; // ex : 'E' ou 'E,S' $dateSoutenanceNull = $criteria['dateSoutenanceNull'] ?? false; $dateSoutenanceMin = $criteria['dateSoutenanceMin'] ?? null; // ex : '2022-03-11' ou 'P6M' $dateSoutenanceMax = $criteria['dateSoutenanceMax'] ?? null; // ex : '2022-03-11' ou 'P6M' $etablissement = $criteria['etablissement'] ?? null; // ex : 'UCN' ou 'UCN,URN' $qb = $this->createQueryBuilder(); if ($these !== null) { $thesesIds = array_map('trim', explode(',', $these)); $qb->where($qb->expr()->in('t.id', $thesesIds)); } else { if ($etat !== null) { $etats = array_map('trim', explode(',', $etat)); $qb->andWhereEtatIn($etats); } if ($dateSoutenanceNull) { $qb->andWhere('t.dateSoutenance is null'); } else { if ($dateSoutenanceMin !== null) { $qb ->andWhere('t.dateSoutenance >= :dateSoutMin') ->setParameter('dateSoutMin', $this->dateFromSpec($dateSoutenanceMin)); } if ($dateSoutenanceMax !== null) { $qb ->andWhere('t.dateSoutenance <= :dateSoutMax') ->setParameter('dateSoutMax', $this->dateFromSpec($dateSoutenanceMax)); } } if ($etablissement !== null) { $codesEtabs = array_map('trim', explode(',', $etablissement)); $qb->andWhere($qb->expr()->in('es.sourceCode', $codesEtabs)); } } $this->applyCriteriaToQb($criteria, $qb); return $qb->getQuery()->getArrayResult(); } Loading Loading @@ -163,4 +143,50 @@ class FetchService return $qb; } private function applyCriteriaToQb(array $criteria, QueryBuilder $qb): void { $these = $criteria['these'] ?? null; // ex : '12345' ou '12345,12346' $etat = $criteria['etat'] ?? null; // ex : 'E' ou 'E,S' $dateSoutenanceNull = $criteria['dateSoutenanceNull'] ?? false; $dateSoutenanceMin = $criteria['dateSoutenanceMin'] ?? null; // ex : '2022-03-11' ou 'P6M' $dateSoutenanceMax = $criteria['dateSoutenanceMax'] ?? null; // ex : '2022-03-11' ou 'P6M' $etablissement = $criteria['etablissement'] ?? null; // ex : 'UCN' ou 'UCN,URN' $this->criteriaToStrings = []; if ($these !== null) { $thesesIds = array_map('trim', explode(',', $these)); $qb->where($qb->expr()->in('t.id', $thesesIds)); $this->criteriaToStrings[] = 'Ids thèses : ' . $these; } else { if ($etat !== null) { $etats = array_map('trim', explode(',', $etat)); $qb->andWhereEtatIn($etats); $this->criteriaToStrings[] = 'Etats thèses : ' . $etat; } if ($dateSoutenanceNull) { $qb->andWhere('t.dateSoutenance is null'); $this->criteriaToStrings[] = 'Date de soutenance : null'; } else { if ($dateSoutenanceMin !== null) { $qb ->andWhere('t.dateSoutenance >= :dateSoutMin') ->setParameter('dateSoutMin', $dateSoutMin = $this->dateFromSpec($dateSoutenanceMin)); $this->criteriaToStrings[] = 'Date de soutenance >= ' . $dateSoutMin; } if ($dateSoutenanceMax !== null) { $qb ->andWhere('t.dateSoutenance <= :dateSoutMax') ->setParameter('dateSoutMax', $dateSoutMax = $this->dateFromSpec($dateSoutenanceMax)); $this->criteriaToStrings[] = 'Date de soutenance <= ' . $dateSoutMax; } } if ($etablissement !== null) { $codesEtabs = array_map('trim', explode(',', $etablissement)); $qb->andWhere($qb->expr()->in('es.sourceCode', $codesEtabs)); $this->criteriaToStrings[] = 'Etablissements : ' . $etablissement; } } } } No newline at end of file