Loading module/Application/src/Application/Controller/TheseController.php +1 −2 Changes for module/Application/src/Application/Controller/TheseController.php: 1 added line, 2 removed lines. Original line number Diff line number Diff line Loading @@ -1393,7 +1393,6 @@ class TheseController extends AbstractController $these = $this->requestedThese(); $versionArchivage = $this->fichierService->fetchVersionFichier($this->params()->fromQuery('version')); //$fichierTheseRetraite = $these->getFichiersByNatureEtVersion(NatureFichier::CODE_THESE_PDF, $versionArchivage, true)->first(); $fichierTheseRetraite = current($this->fichierService->getRepository()->fetchFichiers($these, NatureFichier::CODE_THESE_PDF, $versionArchivage, true)); $form = new ConformiteFichierForm('conformite'); Loading @@ -1404,7 +1403,7 @@ class TheseController extends AbstractController $form->setData($post); if ($form->isValid()) { $conforme = $post->get('conforme'); $this->theseService->updateConformiteTheseRetraitee($these, $conforme); $this->fichierService->updateConformiteFichierTheseRetraitee($these, $conforme); if ($conforme && $versionArchivage->estVersionCorrigee()) { $this->validationService->validateDepotTheseCorrigee($these); Loading module/Application/src/Application/Service/Fichier/FichierService.php +36 −2 Changes for module/Application/src/Application/Service/Fichier/FichierService.php: 36 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -3,7 +3,6 @@ namespace Application\Service\Fichier; use Application\Command\MergeCommand; use Application\Command\ShellCommandRunner; use Application\Command\ShellScriptRunner; use Application\Command\TruncateAndMergeCommand; use Application\Entity\Db\Acteur; Loading Loading @@ -546,7 +545,8 @@ class FichierService extends BaseService * @param These $these * @return PdcData */ public function fetchInformationsPageDeCouverture(These $these) { public function fetchInformationsPageDeCouverture(These $these) { $pdcData = new PdcData(); $informations = []; Loading Loading @@ -819,4 +819,38 @@ class FichierService extends BaseService $runner->setAsync(); $runner->run($args); } /** * Recherche le fichier de la version d'archivage de la thèse (corrigée, le cas échéant) * et modifie son témoin de conformité. * * @param These $these * @param string $conforme "1" (conforme), "0" (non conforme) ou null (i.e. pas de réponse) */ public function updateConformiteFichierTheseRetraitee(These $these, $conforme = null) { $repo = $this->getRepository(); $fichiersVA = $repo->fetchFichiers($these, NatureFichier::CODE_THESE_PDF , VersionFichier::CODE_ARCHI); $fichiersVAC = $repo->fetchFichiers($these, NatureFichier::CODE_THESE_PDF , VersionFichier::CODE_ARCHI_CORR); /** @var Fichier $fichier */ if (! empty($fichiersVAC)) { $fichier = current($fichiersVAC) ?: null; } else { $fichier = current($fichiersVA) ?: null; } // il n'existe pas forcément de fichier en version d'archivage (si la version originale est testée archivable) if ($fichier === null) { return; } $fichier->setEstConforme($conforme); try { $this->entityManager->flush($fichier); } catch (OptimisticLockException $e) { throw new RuntimeException("Erreur rencontrée lors de l'enregistrement", null, $e); } } } No newline at end of file module/Application/src/Application/Service/These/TheseService.php +0 −45 Changes for module/Application/src/Application/Service/These/TheseService.php: 0 added lines, 45 removed lines. Original line number Diff line number Diff line Loading @@ -4,35 +4,26 @@ namespace Application\Service\These; use Application\Entity\Db\Attestation; use Application\Entity\Db\Diffusion; use Application\Entity\Db\Fichier; use Application\Entity\Db\MetadonneeThese; use Application\Entity\Db\NatureFichier; use Application\Entity\Db\RdvBu; use Application\Entity\Db\Repository\TheseRepository; use Application\Entity\Db\These; use Application\Entity\Db\TypeValidation; use Application\Entity\Db\Validation; use Application\Entity\Db\VersionFichier; use Application\Notification\ValidationRdvBuNotification; use Application\Service\BaseService; use Application\Service\Fichier\FichierServiceAwareTrait; use Application\Service\Notification\NotifierServiceAwareTrait; use Application\Service\UserContextServiceAwareTrait; use Application\Service\Validation\ValidationServiceAwareTrait; use Application\Service\Variable\VariableServiceAwareTrait; use Assert\Assertion; use DateInterval; use Doctrine\ORM\OptimisticLockException; use UnicaenApp\Exception\RuntimeException; use UnicaenApp\Traits\MessageAwareInterface; use UnicaenAuth\Entity\Db\UserInterface; use Zend\Validator\Date; class TheseService extends BaseService { use ValidationServiceAwareTrait; use NotifierServiceAwareTrait; use FichierServiceAwareTrait; use VariableServiceAwareTrait; use UserContextServiceAwareTrait; Loading Loading @@ -186,42 +177,6 @@ class TheseService extends BaseService } } /** * Recherche le fichier de la version d'archivage de la thèse (corrigée, le cas échéant) * et modifie son témoin de conformité. * * @param These $these * @param string $conforme "1" (conforme), "0" (non conforme) ou null (i.e. pas de réponse) */ public function updateConformiteTheseRetraitee(These $these, $conforme = null) { // $fichiersVA = $these->getFichiersByVersion(VersionFichier::CODE_ARCHI, false); // $fichiersVAC = $these->getFichiersByVersion(VersionFichier::CODE_ARCHI_CORR, false); $fichiersVA = $this->fichierService->getRepository()->fetchFichiers($these, NatureFichier::CODE_THESE_PDF , VersionFichier::CODE_ARCHI); $fichiersVAC = $this->fichierService->getRepository()->fetchFichiers($these, NatureFichier::CODE_THESE_PDF , VersionFichier::CODE_ARCHI_CORR); /** @var Fichier $fichier */ if (! empty($fichiersVAC)) { $fichier = current($fichiersVAC) ?: null; } else { $fichier = current($fichiersVA) ?: null; } // il n'existe pas forcément de fichier en version d'archivage (si la version originale est testée archivable) if ($fichier === null) { return; } $fichier->setEstConforme($conforme); try { $this->entityManager->flush($fichier); } catch (OptimisticLockException $e) { throw new RuntimeException("Erreur rencontrée lors de l'enregistrement", null, $e); } } /** * @param These $these * @param RdvBu $rdvBu Loading Loading
module/Application/src/Application/Controller/TheseController.php +1 −2 Changes for module/Application/src/Application/Controller/TheseController.php: 1 added line, 2 removed lines. Original line number Diff line number Diff line Loading @@ -1393,7 +1393,6 @@ class TheseController extends AbstractController $these = $this->requestedThese(); $versionArchivage = $this->fichierService->fetchVersionFichier($this->params()->fromQuery('version')); //$fichierTheseRetraite = $these->getFichiersByNatureEtVersion(NatureFichier::CODE_THESE_PDF, $versionArchivage, true)->first(); $fichierTheseRetraite = current($this->fichierService->getRepository()->fetchFichiers($these, NatureFichier::CODE_THESE_PDF, $versionArchivage, true)); $form = new ConformiteFichierForm('conformite'); Loading @@ -1404,7 +1403,7 @@ class TheseController extends AbstractController $form->setData($post); if ($form->isValid()) { $conforme = $post->get('conforme'); $this->theseService->updateConformiteTheseRetraitee($these, $conforme); $this->fichierService->updateConformiteFichierTheseRetraitee($these, $conforme); if ($conforme && $versionArchivage->estVersionCorrigee()) { $this->validationService->validateDepotTheseCorrigee($these); Loading
module/Application/src/Application/Service/Fichier/FichierService.php +36 −2 Changes for module/Application/src/Application/Service/Fichier/FichierService.php: 36 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -3,7 +3,6 @@ namespace Application\Service\Fichier; use Application\Command\MergeCommand; use Application\Command\ShellCommandRunner; use Application\Command\ShellScriptRunner; use Application\Command\TruncateAndMergeCommand; use Application\Entity\Db\Acteur; Loading Loading @@ -546,7 +545,8 @@ class FichierService extends BaseService * @param These $these * @return PdcData */ public function fetchInformationsPageDeCouverture(These $these) { public function fetchInformationsPageDeCouverture(These $these) { $pdcData = new PdcData(); $informations = []; Loading Loading @@ -819,4 +819,38 @@ class FichierService extends BaseService $runner->setAsync(); $runner->run($args); } /** * Recherche le fichier de la version d'archivage de la thèse (corrigée, le cas échéant) * et modifie son témoin de conformité. * * @param These $these * @param string $conforme "1" (conforme), "0" (non conforme) ou null (i.e. pas de réponse) */ public function updateConformiteFichierTheseRetraitee(These $these, $conforme = null) { $repo = $this->getRepository(); $fichiersVA = $repo->fetchFichiers($these, NatureFichier::CODE_THESE_PDF , VersionFichier::CODE_ARCHI); $fichiersVAC = $repo->fetchFichiers($these, NatureFichier::CODE_THESE_PDF , VersionFichier::CODE_ARCHI_CORR); /** @var Fichier $fichier */ if (! empty($fichiersVAC)) { $fichier = current($fichiersVAC) ?: null; } else { $fichier = current($fichiersVA) ?: null; } // il n'existe pas forcément de fichier en version d'archivage (si la version originale est testée archivable) if ($fichier === null) { return; } $fichier->setEstConforme($conforme); try { $this->entityManager->flush($fichier); } catch (OptimisticLockException $e) { throw new RuntimeException("Erreur rencontrée lors de l'enregistrement", null, $e); } } } No newline at end of file
module/Application/src/Application/Service/These/TheseService.php +0 −45 Changes for module/Application/src/Application/Service/These/TheseService.php: 0 added lines, 45 removed lines. Original line number Diff line number Diff line Loading @@ -4,35 +4,26 @@ namespace Application\Service\These; use Application\Entity\Db\Attestation; use Application\Entity\Db\Diffusion; use Application\Entity\Db\Fichier; use Application\Entity\Db\MetadonneeThese; use Application\Entity\Db\NatureFichier; use Application\Entity\Db\RdvBu; use Application\Entity\Db\Repository\TheseRepository; use Application\Entity\Db\These; use Application\Entity\Db\TypeValidation; use Application\Entity\Db\Validation; use Application\Entity\Db\VersionFichier; use Application\Notification\ValidationRdvBuNotification; use Application\Service\BaseService; use Application\Service\Fichier\FichierServiceAwareTrait; use Application\Service\Notification\NotifierServiceAwareTrait; use Application\Service\UserContextServiceAwareTrait; use Application\Service\Validation\ValidationServiceAwareTrait; use Application\Service\Variable\VariableServiceAwareTrait; use Assert\Assertion; use DateInterval; use Doctrine\ORM\OptimisticLockException; use UnicaenApp\Exception\RuntimeException; use UnicaenApp\Traits\MessageAwareInterface; use UnicaenAuth\Entity\Db\UserInterface; use Zend\Validator\Date; class TheseService extends BaseService { use ValidationServiceAwareTrait; use NotifierServiceAwareTrait; use FichierServiceAwareTrait; use VariableServiceAwareTrait; use UserContextServiceAwareTrait; Loading Loading @@ -186,42 +177,6 @@ class TheseService extends BaseService } } /** * Recherche le fichier de la version d'archivage de la thèse (corrigée, le cas échéant) * et modifie son témoin de conformité. * * @param These $these * @param string $conforme "1" (conforme), "0" (non conforme) ou null (i.e. pas de réponse) */ public function updateConformiteTheseRetraitee(These $these, $conforme = null) { // $fichiersVA = $these->getFichiersByVersion(VersionFichier::CODE_ARCHI, false); // $fichiersVAC = $these->getFichiersByVersion(VersionFichier::CODE_ARCHI_CORR, false); $fichiersVA = $this->fichierService->getRepository()->fetchFichiers($these, NatureFichier::CODE_THESE_PDF , VersionFichier::CODE_ARCHI); $fichiersVAC = $this->fichierService->getRepository()->fetchFichiers($these, NatureFichier::CODE_THESE_PDF , VersionFichier::CODE_ARCHI_CORR); /** @var Fichier $fichier */ if (! empty($fichiersVAC)) { $fichier = current($fichiersVAC) ?: null; } else { $fichier = current($fichiersVA) ?: null; } // il n'existe pas forcément de fichier en version d'archivage (si la version originale est testée archivable) if ($fichier === null) { return; } $fichier->setEstConforme($conforme); try { $this->entityManager->flush($fichier); } catch (OptimisticLockException $e) { throw new RuntimeException("Erreur rencontrée lors de l'enregistrement", null, $e); } } /** * @param These $these * @param RdvBu $rdvBu Loading