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

Nombre et genre

parent 303323af
Loading
Loading
Loading
Loading
Loading
+20 −2
Original line number Diff line number Diff line
@@ -70,9 +70,27 @@ class ValidationInstance implements HistoriqueAwareInterface {
        return $this->getJustification();
    }

    public function toStringRefus() : string
    /**
     * @param string $genre (parmi F, M)
     * @param string $nombre (parmi S,P)
     * @return string
     */
    public function toStringRefus(string $genre = "F", string $nombre = "S") : string
    {
        return (!$this->isRefus()) ? "Validée" : "Refusée";
        if (!$this->isRefus()) {
            if ($nombre === "S") {
                return $genre === "F" ? "Validée" : "Validé";
            } else {
                return $genre === "F" ? "Validées" : "Validés";
            }
        } else {
            if ($nombre === "S") {
                return $genre === "F" ? "Refusée" : "Refusé";
            } else {
                return $genre === "F" ? "Refusées" : "Refusés";
            }

        }
    }

    public function toStringValidateur() : string
+5 −1
Original line number Diff line number Diff line
@@ -7,6 +7,10 @@

use UnicaenValidation\Entity\Db\ValidationInstance;


$genre = $options['genre']??"F";
$nombre = $options['nombre']??"S";

$type = $instance->getType();

$afficherCode = isset($options['afficher-code']) && $options['afficher-code'] === true ;
@@ -26,7 +30,7 @@ $afficherJustificatif = isset($options['afficher-justificatif']) && $options['af
        <br>
        <?php endif; ?>

        <?php echo $instance->toStringRefus() ?>
        <?php echo $instance->toStringRefus($genre, $nombre) ?>

        le  <?php echo $instance->getHistoModification()->format('d/m/Y à H:i:s'); ?>
        par <?php echo $instance->getHistoModificateur()->getDisplayName(); ?>.