Loading module/Application/src/Application/Entity/Db/Fichier.php +10 −0 Changes for module/Application/src/Application/Entity/Db/Fichier.php: 10 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -282,6 +282,16 @@ class Fichier implements HistoriqueAwareInterface, ResourceInterface, UploadedFi return $this->id; } /** * Get first part of uuid4 hash id. * * @return string */ public function getShortId() { return strstr($this->id, '-', true); } /** * Set type * Loading module/Application/src/Application/Filter/NomFichierFormatter.php +20 −5 Changes for module/Application/src/Application/Filter/NomFichierFormatter.php: 20 added lines, 5 removed lines. Original line number Diff line number Diff line Loading @@ -8,10 +8,9 @@ use Zend\Filter\AbstractFilter; use Zend\Filter\Exception; /** * Created by PhpStorm. * User: gauthierb * Date: 26/04/16 * Time: 10:54 * Filtre générateur du nom de fichier téléversé. * * @author Unicaen */ class NomFichierFormatter extends AbstractFilter { Loading @@ -30,14 +29,30 @@ class NomFichierFormatter extends AbstractFilter $parts = []; $parts['annee'] = date('Y'); $date = $fichier->getThese()->getDateSoutenance() ?: $fichier->getThese()->getDatePrevisionSoutenance(); $parts['annee'] = $date ? $date->format('Y') : date('Y'); $parts['nomDoctorant'] = mb_strtoupper($this->transformText($doctorant->getNomUsuel())); $parts['prenomDoctorant'] = mb_strtoupper($this->transformText($doctorant->getPrenom())); // on inclue un id unique car il peut y avoir plusieurs fichiers de même nature déposés, exemples : // - plusieurs pré-rapports de soutenance pour une même thèse, // - 2 fichiers de thèses pour un doctorant menant 2 thèses en parallèle. $parts['id'] = $fichier->getShortId(); switch (true) { case $fichier->getNature()->estThesePdf(): case $fichier->getNature()->estFichierNonPdf(): $parts['version'] = $fichier->getVersion()->getCode(); break; default: $nature = str_replace('_', '-', $fichier->getNature()->getCode()); $parts['nature'] = mb_strtoupper($nature); break; } if ($fichier->getEstAnnexe()) { unset($parts['id']); $parts['annexe'] = uniqid('ANNEXE-'); } Loading Loading
module/Application/src/Application/Entity/Db/Fichier.php +10 −0 Changes for module/Application/src/Application/Entity/Db/Fichier.php: 10 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -282,6 +282,16 @@ class Fichier implements HistoriqueAwareInterface, ResourceInterface, UploadedFi return $this->id; } /** * Get first part of uuid4 hash id. * * @return string */ public function getShortId() { return strstr($this->id, '-', true); } /** * Set type * Loading
module/Application/src/Application/Filter/NomFichierFormatter.php +20 −5 Changes for module/Application/src/Application/Filter/NomFichierFormatter.php: 20 added lines, 5 removed lines. Original line number Diff line number Diff line Loading @@ -8,10 +8,9 @@ use Zend\Filter\AbstractFilter; use Zend\Filter\Exception; /** * Created by PhpStorm. * User: gauthierb * Date: 26/04/16 * Time: 10:54 * Filtre générateur du nom de fichier téléversé. * * @author Unicaen */ class NomFichierFormatter extends AbstractFilter { Loading @@ -30,14 +29,30 @@ class NomFichierFormatter extends AbstractFilter $parts = []; $parts['annee'] = date('Y'); $date = $fichier->getThese()->getDateSoutenance() ?: $fichier->getThese()->getDatePrevisionSoutenance(); $parts['annee'] = $date ? $date->format('Y') : date('Y'); $parts['nomDoctorant'] = mb_strtoupper($this->transformText($doctorant->getNomUsuel())); $parts['prenomDoctorant'] = mb_strtoupper($this->transformText($doctorant->getPrenom())); // on inclue un id unique car il peut y avoir plusieurs fichiers de même nature déposés, exemples : // - plusieurs pré-rapports de soutenance pour une même thèse, // - 2 fichiers de thèses pour un doctorant menant 2 thèses en parallèle. $parts['id'] = $fichier->getShortId(); switch (true) { case $fichier->getNature()->estThesePdf(): case $fichier->getNature()->estFichierNonPdf(): $parts['version'] = $fichier->getVersion()->getCode(); break; default: $nature = str_replace('_', '-', $fichier->getNature()->getCode()); $parts['nature'] = mb_strtoupper($nature); break; } if ($fichier->getEstAnnexe()) { unset($parts['id']); $parts['annexe'] = uniqid('ANNEXE-'); } Loading