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

Ajout d'une fonction pour afficher dernière état de modification dans HistoriqueAware*

parent 29789fff
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
<?php

use Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain;
use Doctrine\ORM\Mapping\Driver\XmlDriver;
use Doctrine\Persistence\Mapping\Driver\MappingDriverChain;
use UnicaenUtilisateur\ORM\Event\Listeners\HistoriqueListener;
use UnicaenUtilisateur\ORM\Event\Listeners\HistoriqueListenerFactory;
use UnicaenUtilisateur\View\Helper\RoleViewHelper;
+2 −0
Original line number Diff line number Diff line
@@ -119,4 +119,6 @@ interface HistoriqueAwareInterface
     * @return $this
     */
    public function dehistoriser();

    public function deniereModification(): string;
}
 No newline at end of file
+14 −0
Original line number Diff line number Diff line
@@ -266,4 +266,18 @@ trait HistoriqueAwareTrait

        return true;
    }

    public function deniereModification() : string
    {
        if ($this->getHistoDestruction() !== null) {
            return "Historisation ". $this->getHistoDestruction()->format('d/m/Y à H:i:s') ." par ". $this->getHistoDestructeur()->getDisplayName() ;
        }
        if ($this->getHistoModification() !== null) {
            return "Modification ". $this->getHistoModification()->format('d/m/Y à H:i:s') ." par ". $this->getHistoModificateur()->getDisplayName() ;
        }
        if ($this->getHistoCreation() !== null) {
            return "Création ". $this->getHistoCreation()->format('d/m/Y à H:i:s') ." par ". $this->getHistoCreateur()->getDisplayName() ;
        }
        return "Aucune donnée d'historisation";
    }
}
 No newline at end of file