From 63365247e23c206bc9eea63a224447543f1ec9b5 Mon Sep 17 00:00:00 2001 From: polo Date: Mon, 12 Oct 2026 21:42:42 +0200 Subject: =?UTF-8?q?pr=C3=A9paration=20date=20bulletin=20de=20paie=20des=20?= =?UTF-8?q?CESU,=20relecture?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/model/entities/CESU.php | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) (limited to 'src/model/entities/CESU.php') diff --git a/src/model/entities/CESU.php b/src/model/entities/CESU.php index de3a359..90eec69 100644 --- a/src/model/entities/CESU.php +++ b/src/model/entities/CESU.php @@ -27,18 +27,17 @@ class CESU #[ORM\Column] private float $salaire; + /*#[ORM\Column]*/ // pour plus tard + private ?string $date_bulletin_paie = null; // format Y-m-d conservé tout du long: formulaire, BDD, affichage + public static EntityManager $entityManager; - public function __construct(Prestation $presta = null) - { - if($presta != null) - { - $this->setPresta($presta); - } + public function __construct(?Prestation $presta = null){ + $this->setPresta($presta); } // getters - public function getPresta(): Prestation + public function getPresta(): ?Prestation { return $this->presta; } @@ -46,6 +45,11 @@ class CESU { return $this->salaire; } + + public function getPaySlipDate(): string + { + return $this->date_bulletin_paie; + } public function getAllWithWindowFields(): array { @@ -72,28 +76,33 @@ class CESU break; } } - private function setPresta(Prestation $input) // private? + private function setPresta(Prestation $input): void { $this->presta = $input; } - public function setTaches(string $value) + public function setTaches(string $value): CESU { $this->taches = $value; return($this); } - public function setDureeTravail(string $value) + public function setDureeTravail(string $value): CESU { $this->duree_travail = $value; return($this); } - public function setSalaire($value) + public function setSalaire($value): CESU { $value = str_replace(',', '.', $value); $this->salaire = (float) $value; return($this); } - private function setAll(array $input) // private? + public function setPaySlipDate(string $date): void // date 'aaaa-mm-jj' (sans heure) + { + $this->date_bulletin_paie = $date; + } + + private function setAll(array $input): void { $this->taches = $input[0]; $this->duree_travail = $input[1]; @@ -107,17 +116,16 @@ class CESU return str_replace($search, '', $data); } // à mettre plus tard dans une classe mère - public function hydrate(string $answers) + public function hydrate(string $answers): void { $answers = $this->cleanSpecialChars($answers); // possibilité que $answers devienne une chaine vide if($answers == '') { echo "erreur de CESU::hydrate(), la chaine \$answers est vide.\n"; - return false; + return; } $data_array = explode('|', $answers); // array - $check = false; if(count($data_array) === 4) // facture normale { $this->getPresta()->setModePaiement($data_array[3]); @@ -128,7 +136,7 @@ class CESU else { echo "erreur de CESU::hydrate(), le tableau \$data_array n'a pas la taille attendue.\n"; - return false; + return; } //self::$entityManager->persist('Prestation'); -- cgit v1.2.3