Commit 49790747 authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

Amélioration des interactions entre saisie et suivi au niveau des droits de dévalidation

parent b3f0e596
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -398,6 +398,13 @@ class Mission implements HistoriqueAwareInterface, ResourceInterface, EntityMana



    public function hasSuivi(): bool
    {
        return $this->heuresRealisees() > 0;
    }



    public function heuresRealisees(): float
    {
        $vhs = $this->getVolumesHorairesRealises();
@@ -431,7 +438,7 @@ class Mission implements HistoriqueAwareInterface, ResourceInterface, EntityMana

    public function canDevalider(): bool
    {
        return $this->isValide();
        return $this->isValide() && !$this->hasSuivi();
    }


@@ -445,6 +452,8 @@ class Mission implements HistoriqueAwareInterface, ResourceInterface, EntityMana

    public function canAddSuivi(\DateTime $date): bool
    {
        return $this->getDateDebut() <= $date && $this->getDateFin() >= $date;
        $dateOk = $this->getDateDebut() <= $date && $this->getDateFin() >= $date;

        return $this->isValide() && $dateOk;
    }
}
+4 −0
Original line number Diff line number Diff line
@@ -104,6 +104,10 @@ class MissionService extends AbstractEntityService
            'contrat',
            'valide',
            'validation',
            'canSaisie',
            'canValider',
            'canDevalider',
            'canSupprimer',
        ];

        $triggers = [