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

Amelioration export

parent fe364bcc
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -71,16 +71,16 @@ class ExportController extends AbstractController
            'Date de prévisionnel de soutenance'    => function (These $these) { return $these->getDatePrevisionSoutenance(); },
            'Date de soutenance'                    => function (These $these) { return $these->getDateSoutenance(); },
            'Date de fin de confientialité'         => function (These $these) { return $these->getDateFinConfidentialite(); },
            'Date de dépôt version initiale'        => function (These $these) { $file = $this->fichierService->getRepository()->fetchFichiers($these, NatureFichier::CODE_THESE_PDF, VersionFichier::CODE_ORIG)[0]; if ($file !== null) return $file->getHistoCreation()->format('d/m/Y'); },
            'Date de dépôt version corigée'         => function (These $these) { $file = $this->fichierService->getRepository()->fetchFichiers($these, NatureFichier::CODE_THESE_PDF,VersionFichier::CODE_ORIG_CORR)[0]; if ($file !== null) return $file->getHistoCreation()->format('d/m/Y'); },
            'Date de dépôt version initiale'        => function (These $these) { $file = $these->hasVersionInitiale(); if ($file) return $file->getHistoCreation()->format('d/m/Y'); },
            'Date de dépôt version corigée'         => function (These $these) { $file = $these->hasVersionCorrigee(); if ($file) return $file->getHistoCreation()->format('d/m/Y'); },
            //Flags
            'Etat de la thèse'                      => function (These $these) { return $these->getEtatTheseToString();},
            'Autorisation à soutenir'               => function (These $these) { return $these->getSoutenanceAutorisee();},
            'Est confidentielle'                    => function (These $these) { $now = new \DateTime(); $end= $these->getDateFinConfidentialite(); if ($now > $end) return "N"; else return "O"; },
            'Résultat'                              => function (These $these) { return $these->getResultat();},
            'Corrections'                           => function (These $these) { return $these->getCorrectionAutorisee();},
            'Thèse format PDF'                      => function (These $these) { if (!empty($this->fichierService->getRepository()->fetchFichiers($these, NatureFichier::CODE_THESE_PDF))) return 'O'; else return 'N'; },
            'Annexe non PDF'                        => function (These $these) { if (!empty($this->fichierService->getRepository()->fetchFichiers($these, NatureFichier::CODE_FICHIER_NON_PDF))) return 'O'; else return 'N'; },
            'Thèse format PDF'                      => function (These $these) { if ($these->hasMemoire())  return 'O'; else return 'N'; },
            'Annexe non PDF'                        => function (These $these) { if ($these->hasAnnexe())   return 'O'; else return 'N'; },

        ];

+35 −1
Original line number Diff line number Diff line
@@ -598,7 +598,7 @@ class These implements HistoriqueAwareInterface, ResourceInterface
     * @param string|null $correctionAutoriseeForcee
     * @return These
     */
    public function setCorrectionAutoriseeForcee(string $correctionAutoriseeForcee = null): These
    public function setCorrectionAutoriseeForcee(string $correctionAutoriseeForcee = null)
    {
        Assertion::inArray($correctionAutoriseeForcee, [
            self::CORRECTION_AUTORISEE_FORCAGE_NON,
@@ -1404,4 +1404,38 @@ class These implements HistoriqueAwareInterface, ResourceInterface
        }
        return false;
    }

    public function hasAnnexe()
    {
        /** @var Fichier $fichier */
        foreach ($this->fichiers as $fichier) {
            if ($fichier->getNature() === NatureFichier::CODE_FICHIER_NON_PDF) return true;
        }
        return false;
    }

    public function hasMemoire()
    {
        /** @var Fichier $fichier */
        foreach ($this->fichiers as $fichier) {
            if ($fichier->getNature() === NatureFichier::CODE_THESE_PDF) return true;
        }
        return false;
    }

    public function hasVersionInitiale() {
        /** @var Fichier $fichier */
        foreach ($this->fichiers as $fichier) {
            if ($fichier->getHistoDestruction() === null && $fichier->getNature() === NatureFichier::CODE_THESE_PDF && $fichier->getVersion() === VersionFichier::CODE_ORIG) return $fichier;
        }
        return null;
    }

    public function hasVersionCorrigee() {
        /** @var Fichier $fichier */
        foreach ($this->fichiers as $fichier) {
            if ($fichier->getHistoDestruction() === null && $fichier->getNature() === NatureFichier::CODE_THESE_PDF && $fichier->getVersion() === VersionFichier::CODE_ORIG_CORR) return $fichier;
        }
        return null;
    }
}
+1 −0
Original line number Diff line number Diff line
@@ -321,6 +321,7 @@ class TheseRechercheService
            ->addSelect('i')->leftJoin('a.individu', 'i')
            ->addSelect('r')->leftJoin('a.role', 'r')
            ->addSelect('f')->leftJoin('t.financements', 'f')
            ->addSelect('fi')->leftJoin('t.fichiers', 'fi')
            ->andWhere('1 = pasHistorise(t)');

        foreach ($this->filters as $filter) {