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

Merge branch 'master' of https://git.unicaen.fr/open-source/OSE

parents 19dd2733 604e6bb4
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -296,6 +296,7 @@ CREATE OR REPLACE PACKAGE BODY "OSE_FORMULE" AS
        vh.ponderation_service_compl,
        vh.service_statutaire,
        vh.heures,
        length, -- on ignore ensuite
        vh_horaire_debut,
        vh_horaire_fin,
        vh.type_intervention_code,
+49 −0
Original line number Diff line number Diff line
@@ -1301,6 +1301,7 @@ return [
        'REFERENTIEL_REALISE_VISU',
        'CONTRAT_ETAT_SORTIE_ID',
        'TAUX_CHARGES_TTC',
        'CONTRAT_GENERATION',
    ],
    'STRUCTURE'                      => [
        'ID',
@@ -2113,6 +2114,54 @@ return [
        'HISTO_DESTRUCTION',
        'HISTO_DESTRUCTEUR_ID',
    ],
    'MODELE_CONTRAT'                 => [
        'ID',
        'LIBELLE',
        'STATUT_ID',
        'STRUCTURE_ID',
        'FICHIER',
        'REQUETE',
        'BLOC1_NOM',
        'BLOC1_ZONE',
        'BLOC1_REQUETE',
        'BLOC2_NOM',
        'BLOC2_ZONE',
        'BLOC2_REQUETE',
        'BLOC3_NOM',
        'BLOC3_ZONE',
        'BLOC3_REQUETE',
        'BLOC4_NOM',
        'BLOC4_ZONE',
        'BLOC4_REQUETE',
        'BLOC5_NOM',
        'BLOC5_ZONE',
        'BLOC5_REQUETE',
        'BLOC6_NOM',
        'BLOC6_ZONE',
        'BLOC6_REQUETE',
        'BLOC7_NOM',
        'BLOC7_ZONE',
        'BLOC7_REQUETE',
        'BLOC8_NOM',
        'BLOC8_ZONE',
        'BLOC8_REQUETE',
        'BLOC9_NOM',
        'BLOC9_ZONE',
        'BLOC9_REQUETE',
        'BLOC10_NOM',
        'BLOC10_ZONE',
        'BLOC10_REQUETE',
    ],
    'SAVE_V17_STATUT'                => [
        'ANNEE_ID',
        'INTERVENANT_ID',
        'STATUT_CODE',
    ],
    'TEST_INTERVENANT'               => [
        'INTERVENANT_ID',
        'STATUT_CODE',
        'STATUT_DOSSIER_CODE',
    ],
];

//@formatter:on
+37 −3
Original line number Diff line number Diff line
@@ -2,9 +2,11 @@

namespace Application\Form\Agrement;

use Application\Constants;
use Application\Form\AbstractForm;
use Laminas\Form\Element\Csrf;
use Laminas\Hydrator\ClassMethodsHydrator;
use Laminas\Hydrator\HydratorInterface;
use UnicaenApp\Hydrator\Strategy\DateStrategy;

/**
@@ -16,21 +18,23 @@ class Saisie extends AbstractForm

    public function init()
    {
        $this->setHydrator(new ClassMethodsHydrator(false));
        $this->setHydrator(new AgreementRetourFormHydrator());

        $this->setAttribute('action', $this->getCurrentUrl());


        $this->add([
            'name'       => 'dateDecision',
            'type'       => 'UnicaenApp\Form\Element\Date',
            'type'       => 'DateTime',
            'options'    => [
                'label' => "Date de la décision",
                'format' => Constants::DATE_FORMAT,
            ],
            'attributes' => [
                'id' => uniqid('dateDecision'),
            ],
        ]);
        $this->getHydrator()->addStrategy('dateDecision', new DateStrategy($this->get('dateDecision')));
//        $this->getHydrator()->addStrategy('dateDecision', new DateStrategy($this->get('dateDecision')));

        $this->add(new Csrf('security'));

@@ -62,3 +66,33 @@ class Saisie extends AbstractForm
        ];
    }
}

class AgreementRetourFormHydrator implements HydratorInterface
{

    /**
     * @param array $data
     * @param       $object
     */
    public function hydrate(array $data, $object)
    {
        $object->setDateDecision($data['dateDecision'] ? \DateTime::createFromFormat(Constants::DATE_FORMAT, $data['dateDecision']) : null);
    }



    /**
     *
     * @param $object
     *
     * @return array
     */
    public function extract($object): array
    {
        $data = [
            'dateDecision' => $object->getDateDecision() ? $object->getDateDecision()->format(Constants::DATE_FORMAT) : null,
        ];

        return $data;
    }
}
 No newline at end of file