Commit 0efd7531 authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Ajustements

parent 45414c78
Loading
Loading
Loading
Loading
Loading
+29 −4
Original line number Diff line number Diff line
@@ -53,6 +53,11 @@ class Evenement {
     */
    private $dateTraitement;

    /**
     * @var DateTime
     */
    private $dateFin;

    /**
     * @var string
     */
@@ -202,7 +207,7 @@ class Evenement {
    /**
     * @return DateTime
     */
    public function getDatePlanification()
    public function getDatePlanification(): ?DateTime
    {
        return $this->datePlanification;
    }
@@ -211,7 +216,7 @@ class Evenement {
     * @param DateTime $datePlanification
     * @return self
     */
    public function setDatePlanification($datePlanification)
    public function setDatePlanification(DateTime $datePlanification) : Evenement
    {
        $this->datePlanification = $datePlanification;

@@ -221,7 +226,7 @@ class Evenement {
    /**
     * @return DateTime
     */
    public function getDateTraitement()
    public function getDateTraitement(): ?DateTime
    {
        return $this->dateTraitement;
    }
@@ -230,13 +235,33 @@ class Evenement {
     * @param DateTime $dateTraitement
     * @return self
     */
    public function setDateTraitement($dateTraitement)
    public function setDateTraitement(DateTime $dateTraitement) : Evenement
    {
        $this->dateTraitement = $dateTraitement;

        return $this;
    }

    /**
     * @return DateTime
     */
    public function getDateFin(): ?DateTime
    {
        return $this->dateFin;
    }

    /**
     * @param DateTime $dateFin
     * @return Evenement
     */
    public function setDateFin(DateTime $dateFin): Evenement
    {
        $this->dateFin = $dateFin;
        return $this;
    }



    /**
     * @return string
     */
+1 −0
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@
        <field name="dateCreation" type="datetime" column="DATE_CREATION" nullable="false"/>
        <field name="datePlanification" type="datetime" column="DATE_PLANIFICATION" nullable="false"/>
        <field name="dateTraitement" type="datetime" column="DATE_TRAITEMENT" nullable="true"/>
        <field name="dateFin" type="datetime" column="DATE_FIN" nullable="true"/>
        <field name="log" type="string" column="LOG" nullable="true"/>

        <many-to-one target-entity="UnicaenEvenement\Entity\Db\Type"  field="type">
+1 −0
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@ class Type {
    // ENTRETIEN PROFESSIONNEL
    const RAPPEL_CAMPAGNE_AVANCEMENT = 'rappel_campagne';
    const RAPPEL_ENTRETIEN_PROFESSIONNEL = 'rappel_entretienpro';
    const RAPPEL_PAS_OBSERVATION_ENTRETIEN_PROFESSIONNEL = 'rappel_pas_observation_entretienpro';


    // FORMATION
+21 −0
Original line number Diff line number Diff line
@@ -20,6 +20,27 @@ class EvenementService extends CommonService implements EvenementServiceInterfac
    use EtatServiceAwareTrait;
    use TypeServiceAwareTrait;

    /** @var Type */
    private $type;

    /**
     * @param Type $type
     * @return EvenementService
     */
    public function setType(Type $type): EvenementService
    {
        $this->type = $type;
        return $this;
    }

    /**
     * @return Type
     */
    public function getType(): Type
    {
        return $this->type;
    }

    public function __construct()
    {
    }
+13 −1
Original line number Diff line number Diff line
@@ -86,12 +86,24 @@ class EvenementGestionService
                } catch(Exception $e) {
                    throw new RuntimeException("Un problème est survenu lors du calcul de la prochaine plnification", 0, $e);
                }
                if ($evenement->getDateFin() === null OR $evenement->getDateFin() > $newdate) {
                    $json_parametres = json_decode($evenement->getParametres());
                    $parametres = [];
                    if ($json_parametres) {
                        foreach ($json_parametres as $param => $value) {
                            $parametres[$param] = $value;
                        }
                    }


                    $newevenement = $this->getEvenementService()->createEvent($evenement->getNom(), $evenement->getDescription(),
                        $this->getEtatEvenementService()->findByCode(Etat::EN_ATTENTE), $evenement->getType(),
                    ($evenement->getParametres())?explode(",",$evenement->getParametres()):null, $newdate);
                        ($parametres) ? $parametres : null, $newdate);
                    if ($evenement->getDateFin()) $newevenement->setDateFin($evenement->getDateFin());
                    $this->getEvenementService()->create($newevenement);
                }
            }
        }

        return $evenement;
    }