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 | |
| 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')
| -rw-r--r-- | src/File.php (renamed from src/model/File.php) | 2 | ||||
| -rw-r--r-- | src/model/entities/CESU.php | 40 | ||||
| -rw-r--r-- | src/model/entities/Devis.php | 13 | ||||
| -rw-r--r-- | src/model/entities/Facture.php | 23 | ||||
| -rw-r--r-- | src/model/entities/Location.php | 15 | ||||
| -rw-r--r-- | src/model/entities/Prestation.php | 25 |
6 files changed, 54 insertions, 64 deletions
diff --git a/src/model/File.php b/src/File.php index 31691dc..660a2e1 100644 --- a/src/model/File.php +++ b/src/File.php | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | <?php | 1 | <?php |
| 2 | // src/model/File.php | 2 | // src/File.php |
| 3 | // | 3 | // |
| 4 | // manipulations des fichiers | 4 | // manipulations des fichiers |
| 5 | 5 | ||
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'); |
diff --git a/src/model/entities/Devis.php b/src/model/entities/Devis.php index ce2a043..70a3cbf 100644 --- a/src/model/entities/Devis.php +++ b/src/model/entities/Devis.php | |||
| @@ -38,15 +38,13 @@ class Devis | |||
| 38 | private string $delai_livraison; | 38 | private string $delai_livraison; |
| 39 | #[ORM\Column] | 39 | #[ORM\Column] |
| 40 | private string $validite_devis; | 40 | private string $validite_devis; |
| 41 | #[ORM\Column (options: ['default' => 'non'])] | 41 | #[ORM\Column (options: ['default' => 'non'])] // défaut dans le cas d'un requête SQL ignorant ce champ |
| 42 | private string $signature_devis = 'non'; | 42 | private string $signature_devis = 'non'; |
| 43 | 43 | ||
| 44 | public static EntityManager $entityManager; | 44 | public static EntityManager $entityManager; |
| 45 | 45 | ||
| 46 | public function __construct(?Prestation $presta = null){ | 46 | public function __construct(?Prestation $presta = null){ |
| 47 | if($presta != null){ | 47 | $this->setPresta($presta); |
| 48 | $this->setPresta($presta); | ||
| 49 | } | ||
| 50 | } | 48 | } |
| 51 | 49 | ||
| 52 | // getters | 50 | // getters |
| @@ -207,17 +205,16 @@ class Devis | |||
| 207 | return str_replace($search, '', $data); | 205 | return str_replace($search, '', $data); |
| 208 | } | 206 | } |
| 209 | // à mettre plus tard dans une classe mère | 207 | // à mettre plus tard dans une classe mère |
| 210 | public function hydrate(string $answers) | 208 | public function hydrate(string $answers): void |
| 211 | { | 209 | { |
| 212 | $answers = $this->cleanSpecialChars($answers); // possibilité que $answers devienne une chaine vide | 210 | $answers = $this->cleanSpecialChars($answers); // possibilité que $answers devienne une chaine vide |
| 213 | if($answers == '') | 211 | if($answers == '') |
| 214 | { | 212 | { |
| 215 | echo "erreur de Devis::hydrate(), la chaine \$answers est vide.\n"; | 213 | echo "erreur de Devis::hydrate(), la chaine \$answers est vide.\n"; |
| 216 | return false; | 214 | return; |
| 217 | } | 215 | } |
| 218 | $data_array = explode('|', $answers); // array | 216 | $data_array = explode('|', $answers); // array |
| 219 | 217 | ||
| 220 | //$check = false; | ||
| 221 | if(count($data_array) === 9) // facture normale, "=== 9" = merdique | 218 | if(count($data_array) === 9) // facture normale, "=== 9" = merdique |
| 222 | { | 219 | { |
| 223 | $this->getPresta()->setModePaiement(''); // sécurité, doctrine plante si "null" | 220 | $this->getPresta()->setModePaiement(''); // sécurité, doctrine plante si "null" |
| @@ -226,7 +223,7 @@ class Devis | |||
| 226 | else | 223 | else |
| 227 | { | 224 | { |
| 228 | echo "erreur de Devis::hydrate(), le tableau \$data_array n'a pas la taille attendue.\n"; | 225 | echo "erreur de Devis::hydrate(), le tableau \$data_array n'a pas la taille attendue.\n"; |
| 229 | return false; | 226 | return; |
| 230 | } | 227 | } |
| 231 | 228 | ||
| 232 | //self::$entityManager->persist('Prestation'); | 229 | //self::$entityManager->persist('Prestation'); |
diff --git a/src/model/entities/Facture.php b/src/model/entities/Facture.php index 2eea0e5..9a9a89d 100644 --- a/src/model/entities/Facture.php +++ b/src/model/entities/Facture.php | |||
| @@ -43,12 +43,8 @@ class Facture | |||
| 43 | 43 | ||
| 44 | public static EntityManager $entityManager; | 44 | public static EntityManager $entityManager; |
| 45 | 45 | ||
| 46 | public function __construct(Prestation $presta = null) | 46 | public function __construct(?Prestation $presta = null){ |
| 47 | { | 47 | $this->setPresta($presta); |
| 48 | if($presta != null) | ||
| 49 | { | ||
| 50 | $this->setPresta($presta); | ||
| 51 | } | ||
| 52 | } | 48 | } |
| 53 | 49 | ||
| 54 | // getters | 50 | // getters |
| @@ -62,8 +58,8 @@ class Facture | |||
| 62 | return get_object_vars($this); | 58 | return get_object_vars($this); |
| 63 | } | 59 | } |
| 64 | public function getTotalMainDOeuvre(): float | 60 | public function getTotalMainDOeuvre(): float |
| 65 | { | 61 | { |
| 66 | return $this->total_main_d_oeuvre; | 62 | return $this->total_main_d_oeuvre; |
| 67 | } | 63 | } |
| 68 | public function getTotalPieces(): float | 64 | public function getTotalPieces(): float |
| 69 | { | 65 | { |
| @@ -75,7 +71,7 @@ class Facture | |||
| 75 | } | 71 | } |
| 76 | 72 | ||
| 77 | public function getAllWithWindowFields(): array | 73 | public function getAllWithWindowFields(): array |
| 78 | { | 74 | { |
| 79 | //~ $taches = ["Tâches:" => $this->taches]; | 75 | //~ $taches = ["Tâches:" => $this->taches]; |
| 80 | //~ $champs_facture = [ | 76 | //~ $champs_facture = [ |
| 81 | //~ "PC:" => $this->machine, | 77 | //~ "PC:" => $this->machine, |
| @@ -99,7 +95,7 @@ class Facture | |||
| 99 | "Pièces:" => $this->pieces, | 95 | "Pièces:" => $this->pieces, |
| 100 | "Total des pièces:" => $this->total_pieces, | 96 | "Total des pièces:" => $this->total_pieces, |
| 101 | "Déplacement:" => $this->deplacement, | 97 | "Déplacement:" => $this->deplacement, |
| 102 | "Total HT:" => $this->total_HT]; | 98 | "Total HT:" => $this->total_HT]; |
| 103 | } | 99 | } |
| 104 | 100 | ||
| 105 | // setters | 101 | // setters |
| @@ -227,17 +223,16 @@ class Facture | |||
| 227 | return str_replace($search, '', $data); | 223 | return str_replace($search, '', $data); |
| 228 | } | 224 | } |
| 229 | // à mettre plus tard dans une classe mère | 225 | // à mettre plus tard dans une classe mère |
| 230 | public function hydrate(string $answers) | 226 | public function hydrate(string $answers): void |
| 231 | { | 227 | { |
| 232 | $answers = $this->cleanSpecialChars($answers); // possibilité que $answers devienne une chaine vide | 228 | $answers = $this->cleanSpecialChars($answers); // possibilité que $answers devienne une chaine vide |
| 233 | if($answers == '') | 229 | if($answers == '') |
| 234 | { | 230 | { |
| 235 | echo "erreur de Facture::hydrate(), la chaine \$answers est vide.\n"; | 231 | echo "erreur de Facture::hydrate(), la chaine \$answers est vide.\n"; |
| 236 | return false; | 232 | return; |
| 237 | } | 233 | } |
| 238 | $data_array = explode('|', $answers); // array | 234 | $data_array = explode('|', $answers); // array |
| 239 | 235 | ||
| 240 | $check = false; | ||
| 241 | if(count($data_array) === 11) // facture normale | 236 | if(count($data_array) === 11) // facture normale |
| 242 | { | 237 | { |
| 243 | $this->getPresta()->setModePaiement($data_array[10]); | 238 | $this->getPresta()->setModePaiement($data_array[10]); |
| @@ -254,7 +249,7 @@ class Facture | |||
| 254 | else | 249 | else |
| 255 | { | 250 | { |
| 256 | echo "erreur de Facture::hydrate(), le tableau \$data_array n'a pas la taille attendue.\n"; | 251 | echo "erreur de Facture::hydrate(), le tableau \$data_array n'a pas la taille attendue.\n"; |
| 257 | return false; | 252 | return; |
| 258 | } | 253 | } |
| 259 | 254 | ||
| 260 | //self::$entityManager->persist('Prestation'); | 255 | //self::$entityManager->persist('Prestation'); |
diff --git a/src/model/entities/Location.php b/src/model/entities/Location.php index b3c2f8a..66c3385 100644 --- a/src/model/entities/Location.php +++ b/src/model/entities/Location.php | |||
| @@ -41,12 +41,8 @@ class Location | |||
| 41 | 41 | ||
| 42 | public static EntityManager $entityManager; | 42 | public static EntityManager $entityManager; |
| 43 | 43 | ||
| 44 | public function __construct(Prestation $presta = null) | 44 | public function __construct(?Prestation $presta = null){ |
| 45 | { | 45 | $this->setPresta($presta); |
| 46 | if($presta != null) | ||
| 47 | { | ||
| 48 | $this->setPresta($presta); | ||
| 49 | } | ||
| 50 | } | 46 | } |
| 51 | 47 | ||
| 52 | // getters | 48 | // getters |
| @@ -191,17 +187,16 @@ class Location | |||
| 191 | return str_replace($search, '', $data); | 187 | return str_replace($search, '', $data); |
| 192 | } | 188 | } |
| 193 | // à mettre plus tard dans une classe mère | 189 | // à mettre plus tard dans une classe mère |
| 194 | public function hydrate(string $answers) | 190 | public function hydrate(string $answers): void |
| 195 | { | 191 | { |
| 196 | $answers = $this->cleanSpecialChars($answers); // possibilité que $answers devienne une chaine vide | 192 | $answers = $this->cleanSpecialChars($answers); // possibilité que $answers devienne une chaine vide |
| 197 | if($answers == '') | 193 | if($answers == '') |
| 198 | { | 194 | { |
| 199 | echo "erreur de Location::hydrate(), la chaine \$answers est vide.\n"; | 195 | echo "erreur de Location::hydrate(), la chaine \$answers est vide.\n"; |
| 200 | return false; | 196 | return; |
| 201 | } | 197 | } |
| 202 | $data_array = explode('|', $answers); // array | 198 | $data_array = explode('|', $answers); // array |
| 203 | 199 | ||
| 204 | $check = false; | ||
| 205 | if(count($data_array) === 8) | 200 | if(count($data_array) === 8) |
| 206 | { | 201 | { |
| 207 | $this->getPresta()->setModePaiement(''); // sécurité, doctrine plante si "null" | 202 | $this->getPresta()->setModePaiement(''); // sécurité, doctrine plante si "null" |
| @@ -210,7 +205,7 @@ class Location | |||
| 210 | else | 205 | else |
| 211 | { | 206 | { |
| 212 | echo "erreur de Location::hydrate(), le tableau \$data_array n'a pas la taille attendue.\n"; | 207 | echo "erreur de Location::hydrate(), le tableau \$data_array n'a pas la taille attendue.\n"; |
| 213 | return false; | 208 | return; |
| 214 | } | 209 | } |
| 215 | 210 | ||
| 216 | //self::$entityManager->persist('Prestation'); | 211 | //self::$entityManager->persist('Prestation'); |
diff --git a/src/model/entities/Prestation.php b/src/model/entities/Prestation.php index ee9b3c0..e7abd8b 100644 --- a/src/model/entities/Prestation.php +++ b/src/model/entities/Prestation.php | |||
| @@ -15,7 +15,7 @@ class Prestation | |||
| 15 | 15 | ||
| 16 | #[ORM\ManyToOne(targetEntity: Client::class, cascade: ['persist'])] | 16 | #[ORM\ManyToOne(targetEntity: Client::class, cascade: ['persist'])] |
| 17 | #[ORM\JoinColumn(name: 'id_client', referencedColumnName: 'id')] | 17 | #[ORM\JoinColumn(name: 'id_client', referencedColumnName: 'id')] |
| 18 | private Client|null $client = null; // type int en SQL et dans la base | 18 | private ?Client $client = null; // type int en SQL et dans la base |
| 19 | 19 | ||
| 20 | #[ORM\Column] | 20 | #[ORM\Column] |
| 21 | private string $code_presta; | 21 | private string $code_presta; |
| @@ -40,12 +40,8 @@ class Prestation | |||
| 40 | public static EntityManager $entityManager; | 40 | public static EntityManager $entityManager; |
| 41 | 41 | ||
| 42 | 42 | ||
| 43 | public function __construct(?Client $client = null) | 43 | public function __construct(?Client $client = null){ |
| 44 | { | 44 | $this->setClient($client); |
| 45 | if($client != null) | ||
| 46 | { | ||
| 47 | $this->setClient($client); | ||
| 48 | } | ||
| 49 | } | 45 | } |
| 50 | 46 | ||
| 51 | // getters | 47 | // getters |
| @@ -94,8 +90,8 @@ class Prestation | |||
| 94 | 90 | ||
| 95 | // une interface pour ça c'est bien aussi non? | 91 | // une interface pour ça c'est bien aussi non? |
| 96 | public function getFacture(): ?Facture | 92 | public function getFacture(): ?Facture |
| 97 | { | 93 | { |
| 98 | return $this->facture; | 94 | return $this->facture; |
| 99 | } | 95 | } |
| 100 | public function getDevis(): ?Devis | 96 | public function getDevis(): ?Devis |
| 101 | { | 97 | { |
| @@ -162,14 +158,13 @@ class Prestation | |||
| 162 | //$input->typeToClient(); // on modifie $client ici (merci les références PHP) | 158 | //$input->typeToClient(); // on modifie $client ici (merci les références PHP) |
| 163 | } | 159 | } |
| 164 | 160 | ||
| 165 | public function set(string $entry, $input) // $input = chaîne ou entier | 161 | public function set(string $entry, string|Dates $input): void |
| 166 | { | 162 | { |
| 167 | if(gettype($input) === 'string') | 163 | if(gettype($input) === 'string'){ |
| 168 | { | 164 | $input = $this->cleanSpecialChars($input); // possibilité que $input devienne une chaine vide |
| 169 | $input = $this->cleanSpecialChars($input); // possibilité que $input devienne une chaine vide | ||
| 170 | } | 165 | } |
| 171 | switch($entry) | 166 | |
| 172 | { | 167 | switch($entry){ |
| 173 | // pas de cas "code presta" qui généré par setCodePresta, on peut modifier la date (ici) et le code client (ailleurs) | 168 | // pas de cas "code presta" qui généré par setCodePresta, on peut modifier la date (ici) et le code client (ailleurs) |
| 174 | //~ case "Numéro prestation:": | 169 | //~ case "Numéro prestation:": |
| 175 | //~ $this->setNumeroPresta($input); | 170 | //~ $this->setNumeroPresta($input); |
