Commit 3715f635 authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

Les modifications de motifs de non paiement fonctionnement de nouveau en mode calendaire (#40037)

parent 02e32af0
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ Objectif : Plafonds personnalisables
* Correction de bug empêchant le calcul des charges d'enseignement (#40991)
* Prise en compte des accents dans les recherches (#40917)
* Correction sur la complétude des données personnelles lorsque la case 'INSEE provisoire' est cochée (#41141).
* Les modifications de motifs de non paiement fonctionnement de nouveau en mode calendaire (#40037)

## Notes de mise à jour

+22 −35
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ class VolumeHoraireListe
        self::FILTRE_NEW,
    ];

    CONST FILTRES_LIST = [
    const FILTRES_LIST = [
        self::FILTRE_CONTRAT             => [
            'class'       => Contrat::class,
            'accessor'    => 'Contrat',
@@ -904,15 +904,15 @@ class VolumeHoraireListe


    /**
     * @param \DateTime|null        $horaireDebut
     * @param \DateTime|null        $horaireFin
     * @param TypeIntervention      $typeIntervention
     * @param Periode               $periode
     * @param MotifNonPaiement|null $motifNonPaiement
     * @param bool|\DateTime|null        $horaireDebut
     * @param bool|\DateTime|null        $horaireFin
     * @param bool|TypeIntervention      $typeIntervention
     * @param bool|Periode               $periode
     * @param bool|MotifNonPaiement|null $motifNonPaiement
     *
     * @return $this
     */
    public function changeAll($horaireDebut, $horaireFin, TypeIntervention $typeIntervention, Periode $periode, $motifNonPaiement)
    public function changeAll($horaireDebut, $horaireFin, $typeIntervention, $periode, $motifNonPaiement)
    {
        if ($this->__debug) $this->__debug->dumpAction('changeAll', $horaireDebut, $horaireFin, $typeIntervention, $periode, $motifNonPaiement);

@@ -929,24 +929,21 @@ class VolumeHoraireListe
        ];

        foreach ($vhs as $vh) {
            $change =
                ($vh->getTypeIntervention() != $typeIntervention)
                || ($vh->getPeriode() != $periode)
                || (!is_bool($horaireDebut) && $vh->getHoraireDebut() != $horaireDebut)
                || (!is_bool($horaireFin) && $vh->getHoraireFin() != $horaireFin)
                || (!is_bool($motifNonPaiement) && $vh->getMotifNonPaiement() != $motifNonPaiement);

            if ($change) {
            if (!empty($reportFilters)) {
                if ($this->isVolumeHoraireModifiable($vh)) {
                    if ($typeIntervention !== false) {
                        $vh->setTypeIntervention($typeIntervention);
                    }
                    if ($periode !== false) {
                        $vh->setPeriode($periode);
                    if (!is_bool($horaireDebut)) {
                    }
                    if ($horaireDebut !== false) {
                        $vh->setHoraireDebut($horaireDebut);
                    }
                    if (!is_bool($horaireFin)) {
                    if ($horaireFin !== false) {
                        $vh->setHoraireFin($horaireFin);
                    }
                    if (!is_bool($motifNonPaiement)) {
                    if ($motifNonPaiement !== false) {
                        $vh->setMotifNonPaiement($motifNonPaiement);
                    }
                } else {
@@ -969,21 +966,11 @@ class VolumeHoraireListe
        }

        /* On met à jour les filtres si besoin */
        if ($this->getHoraireDebut() !== false) {
        $this->setHoraireDebut($horaireDebut);
        }
        if ($this->getHoraireFin() !== false) {
        $this->setHoraireFin($horaireFin);
        }
        if ($this->getTypeIntervention() instanceof TypeIntervention) {
        $this->setTypeIntervention($typeIntervention);
        }
        if ($this->getPeriode() instanceof Periode) {
        $this->setPeriode($periode);
        }
        if ($motifNonPaiement && ($this->getMotifNonPaiement() instanceof MotifNonPaiement || null === $this->getMotifNonPaiement())) {
        $this->setMotifNonPaiement($motifNonPaiement);
        }

        /* On ajoute les heures correspondant aux nouveaux filtres */
        if ($heuresAReporter !== 0) {
+1 −2
Original line number Diff line number Diff line
@@ -389,9 +389,8 @@ class SaisieCalendaireHydrator implements HydratorInterface
        $object->setMotifNonPaiement($ancienMotifNonPaiement != $motifNonPaiement ? $ancienMotifNonPaiement : $motifNonPaiement);

        $heures = (float)$this->getVal('heures');
        $object->setHeures($heures);

        $object->changeAll($horaireDebut, $horaireFin, $typeIntervention, $periode, $motifNonPaiement);
        $object->setHeures($heures);

        //$dumper->dumpEndToFile();

+5 −1
Original line number Diff line number Diff line
@@ -308,7 +308,11 @@ class ServiceService extends AbstractEntityService
                /* @var $volumeHoraire \Application\Entity\Db\Volumehoraire */
                if ($result !== $entity) $volumeHoraire->setService($result);
                if ($volumeHoraire->getRemove()) {
                    if ($volumeHoraire->getId()) {
                        $serviceVolumeHoraire->delete($volumeHoraire);
                    } else {
                        $entity->removeVolumeHoraire($volumeHoraire);
                    }
                } else {
                    $serviceVolumeHoraire->save($volumeHoraire, false); // pas de contrôle de plafond sur le VH ! ! !
                }
+1 −1
Original line number Diff line number Diff line
@@ -373,7 +373,7 @@ class VolumeHoraireListeTest
    public function dumpEndToFile($filename = null)
    {
        if (null === $filename) {
            $filename = '/home/laurent/UnicaenCode/dumps/vhl-' . uniqid(); // à revoir!!
            $filename = getcwd() . '/cache/vhl-' . uniqid();
        }

        file_put_contents($filename, var_export($this->dumpEnd(), true));