diff options
| author | polo <ordipolo@gmx.fr> | 2026-10-12 21:42:42 +0200 |
|---|---|---|
| committer | polo <ordipolo@gmx.fr> | 2026-10-12 21:42:42 +0200 |
| commit | 63365247e23c206bc9eea63a224447543f1ec9b5 (patch) | |
| tree | a6f8ab1098b4336ee08d199c821563fcfb15c09d /src/model/entities/CESU.php | |
| parent | 084264d336fa9156e1b26196d3936eb3cf2c9782 (diff) | |
| download | AppliGestionPHP-63365247e23c206bc9eea63a224447543f1ec9b5.tar.gz AppliGestionPHP-63365247e23c206bc9eea63a224447543f1ec9b5.tar.bz2 AppliGestionPHP-63365247e23c206bc9eea63a224447543f1ec9b5.zip | |
préparation date bulletin de paie des CESU, relecture
Diffstat (limited to 'src/model/entities/CESU.php')
| -rw-r--r-- | src/model/entities/CESU.php | 40 |
1 files changed, 24 insertions, 16 deletions
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 | |||
| 27 | #[ORM\Column] | 27 | #[ORM\Column] |
| 28 | private float $salaire; | 28 | private float $salaire; |
| 29 | 29 | ||
| 30 | /*#[ORM\Column]*/ // pour plus tard | ||
| 31 | private ?string $date_bulletin_paie = null; // format Y-m-d conservé tout du long: formulaire, BDD, affichage | ||
| 32 | |||
| 30 | public static EntityManager $entityManager; | 33 | public static EntityManager $entityManager; |
| 31 | 34 | ||
| 32 | public function __construct(Prestation $presta = null) | 35 | public function __construct(?Prestation $presta = null){ |
| 33 | { | 36 | $this->setPresta($presta); |
| 34 | if($presta != null) | ||
| 35 | { | ||
| 36 | $this->setPresta($presta); | ||
| 37 | } | ||
| 38 | } | 37 | } |
| 39 | 38 | ||
| 40 | // getters | 39 | // getters |
| 41 | public function getPresta(): Prestation | 40 | public function getPresta(): ?Prestation |
| 42 | { | 41 | { |
| 43 | return $this->presta; | 42 | return $this->presta; |
| 44 | } | 43 | } |
| @@ -46,6 +45,11 @@ class CESU | |||
| 46 | { | 45 | { |
| 47 | return $this->salaire; | 46 | return $this->salaire; |
| 48 | } | 47 | } |
| 48 | |||
| 49 | public function getPaySlipDate(): string | ||
| 50 | { | ||
| 51 | return $this->date_bulletin_paie; | ||
| 52 | } | ||
| 49 | 53 | ||
| 50 | public function getAllWithWindowFields(): array | 54 | public function getAllWithWindowFields(): array |
| 51 | { | 55 | { |
| @@ -72,28 +76,33 @@ class CESU | |||
| 72 | break; | 76 | break; |
| 73 | } | 77 | } |
| 74 | } | 78 | } |
| 75 | private function setPresta(Prestation $input) // private? | 79 | private function setPresta(Prestation $input): void |
| 76 | { | 80 | { |
| 77 | $this->presta = $input; | 81 | $this->presta = $input; |
| 78 | } | 82 | } |
| 79 | public function setTaches(string $value) | 83 | public function setTaches(string $value): CESU |
| 80 | { | 84 | { |
| 81 | $this->taches = $value; | 85 | $this->taches = $value; |
| 82 | return($this); | 86 | return($this); |
| 83 | } | 87 | } |
| 84 | public function setDureeTravail(string $value) | 88 | public function setDureeTravail(string $value): CESU |
| 85 | { | 89 | { |
| 86 | $this->duree_travail = $value; | 90 | $this->duree_travail = $value; |
| 87 | return($this); | 91 | return($this); |
| 88 | } | 92 | } |
| 89 | public function setSalaire($value) | 93 | public function setSalaire($value): CESU |
| 90 | { | 94 | { |
| 91 | $value = str_replace(',', '.', $value); | 95 | $value = str_replace(',', '.', $value); |
| 92 | $this->salaire = (float) $value; | 96 | $this->salaire = (float) $value; |
| 93 | return($this); | 97 | return($this); |
| 94 | } | 98 | } |
| 95 | 99 | ||
| 96 | private function setAll(array $input) // private? | 100 | public function setPaySlipDate(string $date): void // date 'aaaa-mm-jj' (sans heure) |
| 101 | { | ||
| 102 | $this->date_bulletin_paie = $date; | ||
| 103 | } | ||
| 104 | |||
| 105 | private function setAll(array $input): void | ||
| 97 | { | 106 | { |
| 98 | $this->taches = $input[0]; | 107 | $this->taches = $input[0]; |
| 99 | $this->duree_travail = $input[1]; | 108 | $this->duree_travail = $input[1]; |
| @@ -107,17 +116,16 @@ class CESU | |||
| 107 | return str_replace($search, '', $data); | 116 | return str_replace($search, '', $data); |
| 108 | } | 117 | } |
| 109 | // à mettre plus tard dans une classe mère | 118 | // à mettre plus tard dans une classe mère |
| 110 | public function hydrate(string $answers) | 119 | public function hydrate(string $answers): void |
| 111 | { | 120 | { |
| 112 | $answers = $this->cleanSpecialChars($answers); // possibilité que $answers devienne une chaine vide | 121 | $answers = $this->cleanSpecialChars($answers); // possibilité que $answers devienne une chaine vide |
| 113 | if($answers == '') | 122 | if($answers == '') |
| 114 | { | 123 | { |
| 115 | echo "erreur de CESU::hydrate(), la chaine \$answers est vide.\n"; | 124 | echo "erreur de CESU::hydrate(), la chaine \$answers est vide.\n"; |
| 116 | return false; | 125 | return; |
| 117 | } | 126 | } |
| 118 | $data_array = explode('|', $answers); // array | 127 | $data_array = explode('|', $answers); // array |
| 119 | 128 | ||
| 120 | $check = false; | ||
| 121 | if(count($data_array) === 4) // facture normale | 129 | if(count($data_array) === 4) // facture normale |
| 122 | { | 130 | { |
| 123 | $this->getPresta()->setModePaiement($data_array[3]); | 131 | $this->getPresta()->setModePaiement($data_array[3]); |
| @@ -128,7 +136,7 @@ class CESU | |||
| 128 | else | 136 | else |
| 129 | { | 137 | { |
| 130 | echo "erreur de CESU::hydrate(), le tableau \$data_array n'a pas la taille attendue.\n"; | 138 | echo "erreur de CESU::hydrate(), le tableau \$data_array n'a pas la taille attendue.\n"; |
| 131 | return false; | 139 | return; |
| 132 | } | 140 | } |
| 133 | 141 | ||
| 134 | //self::$entityManager->persist('Prestation'); | 142 | //self::$entityManager->persist('Prestation'); |
