From 644b99d8ef540a52aebf1aa72cf0efb40542b440 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Laurent=20L=C3=A9cluse?= <laurent.lecluse@unicaen.fr>
Date: Wed, 17 Nov 2021 16:49:27 +0100
Subject: [PATCH] =?UTF-8?q?Possibilit=C3=A9=20pour=20OSE=20de=20fonctionne?=
 =?UTF-8?q?r=20en=20ayant=20suprim=C3=A9=20le=20paiement=20tardif?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../Application/Form/Paiement/MiseEnPaiementForm.php   |  5 ++---
 .../src/Application/Service/PeriodeService.php         | 10 +++++-----
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/module/Application/src/Application/Form/Paiement/MiseEnPaiementForm.php b/module/Application/src/Application/Form/Paiement/MiseEnPaiementForm.php
index 2bfc3a286d..b9a2186260 100755
--- a/module/Application/src/Application/Form/Paiement/MiseEnPaiementForm.php
+++ b/module/Application/src/Application/Form/Paiement/MiseEnPaiementForm.php
@@ -18,7 +18,6 @@ class MiseEnPaiementForm extends AbstractForm
     use PeriodeServiceAwareTrait;
 
 
-
     /**
      *
      */
@@ -32,11 +31,11 @@ class MiseEnPaiementForm extends AbstractForm
             $datesMiseEnPaiement[$periode->getId()] = $periode->getDatePaiement($annee)->format('d/m/Y');
         }
 
-
+        $paiementTardif = $this->getServicePeriode()->getPaiementTardif();
         $this->setAttribute('method', 'post')
             ->setAttribute('class', 'paiement-mise-en-paiement-form')
             ->setAttribute('data-dates-mise-en-paiement', json_encode($datesMiseEnPaiement))
-            ->setAttribute('data-periode-paiement-tardif-id', $this->getServicePeriode()->getPaiementTardif()->getId());
+            ->setAttribute('data-periode-paiement-tardif-id', ($paiementTardif ? $paiementTardif->getId() : null));
 
 
         $defaultPeriode = $this->getServicePeriode()->getPeriodePaiement();
diff --git a/module/Application/src/Application/Service/PeriodeService.php b/module/Application/src/Application/Service/PeriodeService.php
index e3a850e7b2..f99bd23cff 100755
--- a/module/Application/src/Application/Service/PeriodeService.php
+++ b/module/Application/src/Application/Service/PeriodeService.php
@@ -110,7 +110,7 @@ class PeriodeService extends AbstractEntityService
      */
     public function finderByEnseignement(QueryBuilder $qb = null, $alias = null)
     {
-        list($qb, $alias) = $this->initQuery($qb, $alias);
+        [$qb, $alias] = $this->initQuery($qb, $alias);
         $qb->andWhere("$alias.enseignement = 1");
 
         return $qb;
@@ -122,7 +122,7 @@ class PeriodeService extends AbstractEntityService
     {
         $serviceMIS = $this->getServiceMiseEnPaiementIntervenantStructure();
 
-        list($qb, $alias) = $this->initQuery($qb, $alias);
+        [$qb, $alias] = $this->initQuery($qb, $alias);
 
         $this->join($serviceMIS, $qb, 'miseEnPaiementIntervenantStructure', false, $alias);
         $serviceMIS->join($this->getServiceMiseEnPaiement(), $qb, 'miseEnPaiement');
@@ -146,7 +146,7 @@ class PeriodeService extends AbstractEntityService
      */
     public function orderBy(QueryBuilder $qb = null, $alias = null)
     {
-        list($qb, $alias) = $this->initQuery($qb, $alias);
+        [$qb, $alias] = $this->initQuery($qb, $alias);
 
         $qb->orderBy("$alias.ordre");
 
@@ -198,9 +198,9 @@ class PeriodeService extends AbstractEntityService
     /**
      * Retourne le paiement tardif
      *
-     * @return Periode
+     * @return Periode|null
      */
-    public function getPaiementTardif()
+    public function getPaiementTardif(): ?Periode
     {
         return $this->getRepo()->findOneBy(['code' => Periode::PAIEMENT_TARDIF]);
     }
-- 
GitLab