Skip to content
Snippets Groups Projects
Commit 2e2e2822 authored by Thibaut Vallee's avatar Thibaut Vallee
Browse files

Remplacement de toStringValue en toStringRefus et ajout de la justification dans le viewHelper

parent 8bf75cee
No related branches found
No related tags found
No related merge requests found
Pipeline #26058 passed
......@@ -70,10 +70,9 @@ class ValidationInstance implements HistoriqueAwareInterface {
return $this->getJustification();
}
public function toStringValeur() : string
public function toStringRefus() : string
{
if ($this->getJustification() === null) return "Aucune valeur associée à la validation";
return $this->getJustification();
return (!$this->isRefus()) ? "Validée" : "Refusée";
}
public function toStringValidateur() : string
......
......@@ -21,6 +21,6 @@ class ValidationAfficherViewHelper extends AbstractHelper
$view = $this->getView();
$view->resolver()->attach(new TemplatePathStack(['script_paths' => [__DIR__ . "/partial"]]));
return $view->partial('validation-afficher', ['instance' => $validation]);
return $view->partial('validation-afficher', ['instance' => $validation, 'options' => $options]);
}
}
\ No newline at end of file
......@@ -10,6 +10,7 @@ use UnicaenValidation\Entity\Db\ValidationInstance;
$type = $instance->getType();
$afficherCode = isset($options['afficher-code']) && $options['afficher-code'] === true ;
$afficherJustificatif = isset($options['afficher-justificatif']) && $options['afficher-justificatif'] === true ;
?>
......@@ -22,13 +23,13 @@ $afficherCode = isset($options['afficher-code']) && $options['afficher-code'] ==
<strong><?php echo $type->getLibelle(); ?></strong>
<br>
<?php if ($instance->isRefus()) : ?>
Refusée
<?php else : ?>
Validée
<?php endif; ?>
<?php echo $instance->toStringRefus() ?>
le <?php echo $instance->getHistoModification()->format('d/m/Y à H:i:s'); ?>
par <?php echo $instance->getHistoModificateur()->getDisplayName(); ?>.
<?php if($afficherJustificatif) :?>
<br/> <strong>Justification :</strong> <?= $instance->toStringJustification() ?>
<?php endif; ?>
</div>
</div>
......@@ -10,7 +10,6 @@ use UnicaenValidation\Entity\Db\ValidationInstance;
$texte = (isset($options['texte']) AND $options['texte'] === true);
?>
<?php if ($validation !== null) : ?>
<?php if (!$validation->isRefus()) : ?>
<span class="icon ok" style="color: darkgreen;"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment