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/Facture.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/Facture.php')
| -rw-r--r-- | src/model/entities/Facture.php | 23 |
1 files changed, 9 insertions, 14 deletions
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'); |
