Commit 509f25c3 authored by Florian Joriot's avatar Florian Joriot
Browse files

Contournement du probleme de droit pour enregistrer un taux sur un ep

parent 7fc5b5ff
Loading
Loading
Loading
Loading
+1 −2
Changes for module/OffreFormation/src/Form/EtapeTauxRemu/ElementTauxRemuFieldset.php: 1 added line, 2 removed lines.
Original line number Diff line number Diff line
@@ -167,8 +167,7 @@ class ElementTauxRemusFieldsetHydrator implements HydratorInterface
        if ($data['tauxRemu']) {
            $tauxRemu =  $this->getServiceTauxRemu()->get((int)$data['tauxRemu']);
        }
        $element->setTauxRemuEp($tauxRemu);
        $this->getServiceElementPedagogique()->save($element);
        $this->getServiceElementPedagogique()->updateTauxRemu($element, $tauxRemu);

        return $element;
    }
+21 −0
Changes for module/OffreFormation/src/Service/ElementPedagogiqueService.php: 21 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -9,6 +9,9 @@ use Application\Entity\Db\Etape;
use Application\Entity\NiveauEtape;
use Application\Provider\Privilege\Privileges;
use Application\Service\AbstractEntityService;
use Doctrine\ORM\Exception\ORMException;
use Doctrine\ORM\OptimisticLockException;
use Paiement\Entity\Db\TauxRemu;
use RuntimeException;
use Application\Service\Traits\SourceServiceAwareTrait;
use BjyAuthorize\Exception\UnAuthorizedException;
@@ -350,6 +353,24 @@ where rang = 1



    /**
     * @param ElementPedagogique $elementPedagogique
     * @param TauxRemu|null      $tauxRemu
     *
     * @return void
     * @throws ORMException
     * @throws OptimisticLockException
     */
    public function updateTauxRemu(ElementPedagogique $elementPedagogique, ?TauxRemu $tauxRemu){

        /** @var ElementPedagogique $elp */
        $elp = $this->get($elementPedagogique->getId());
        $elp->setTauxRemuEp($tauxRemu);
        $this->getEntityManager()->persist($elp);
        $this->getEntityManager()->flush($elp);

    }

    public function forcerTauxMixite(ElementPedagogique $elementPedagogique, $tauxFi, $tauxFc, $tauxFa)
    {
        /** @var ElementTauxRegimes $etr */