diff options
Diffstat (limited to 'src/model/Prestations.php')
-rw-r--r-- | src/model/Prestations.php | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/src/model/Prestations.php b/src/model/Prestations.php index 22865df..fe09133 100644 --- a/src/model/Prestations.php +++ b/src/model/Prestations.php | |||
@@ -11,8 +11,6 @@ class Prestations extends Model | |||
11 | protected $type_presta = ''; | 11 | protected $type_presta = ''; |
12 | protected $mode_paiement = ''; | 12 | protected $mode_paiement = ''; |
13 | protected $commentaires = ''; | 13 | protected $commentaires = ''; |
14 | |||
15 | //~ use ModelChildren; | ||
16 | 14 | ||
17 | public function __construct(int $ID_client) | 15 | public function __construct(int $ID_client) |
18 | { | 16 | { |
@@ -29,6 +27,16 @@ class Prestations extends Model | |||
29 | { | 27 | { |
30 | return $this->ID_client; | 28 | return $this->ID_client; |
31 | } | 29 | } |
30 | public function getIDsByIdClient() // obtenir une entrée avec son ID_client | ||
31 | { | ||
32 | $IDs = $this->execQuery('SELECT id FROM ' . $this->table . ' WHERE id_client = ' . $this->ID_client)->fetchAll(); | ||
33 | // changer le tableau de tableaux en tableau simple | ||
34 | for($i = 0; $i < count($IDs); $i++) | ||
35 | { | ||
36 | $IDs[$i] = $IDs[$i]['ID']; | ||
37 | } | ||
38 | return($IDs); | ||
39 | } | ||
32 | public function getCodePresta(): string | 40 | public function getCodePresta(): string |
33 | { | 41 | { |
34 | return $this->code_presta; | 42 | return $this->code_presta; |
@@ -41,6 +49,18 @@ class Prestations extends Model | |||
41 | { | 49 | { |
42 | return $this->type_presta; | 50 | return $this->type_presta; |
43 | } | 51 | } |
52 | public function getAllWithWindowFields(): array // différent de Model::getAll() qui retourne get_object_vars($this) | ||
53 | { | ||
54 | $code_presta_tableau = explode('-', $this->code_presta); | ||
55 | $Date = new Dates($this->date); | ||
56 | |||
57 | return [ | ||
58 | "Numéro prestation:" => end($code_presta_tableau), // dernière case | ||
59 | "Date:" => $Date->getDate(), | ||
60 | "Type de Presta:" => $this->type_presta, | ||
61 | "Mode de paiement:" => $this->mode_paiement, | ||
62 | "Commentaires:" => $this->commentaires]; | ||
63 | } | ||
44 | 64 | ||
45 | // setters | 65 | // setters |
46 | //~ public function setID() -> dans le trait ModelChildren | 66 | //~ public function setID() -> dans le trait ModelChildren |
@@ -81,7 +101,7 @@ class Prestations extends Model | |||
81 | return $this; | 101 | return $this; |
82 | } | 102 | } |
83 | 103 | ||
84 | // code client = année-mois-jour-codeclient-combientièmefois | 104 | // code client = année-mois-jour-codeclient-typedepresta-combientièmefois |
85 | public function makeCodePresta(Dates $Date, string $code_client) | 105 | public function makeCodePresta(Dates $Date, string $code_client) |
86 | { | 106 | { |
87 | // on récupère un tableau contenant toutes les prestations d'un client tous types confondus (devis, facture, cesu, location, enregistrement sans vente) | 107 | // on récupère un tableau contenant toutes les prestations d'un client tous types confondus (devis, facture, cesu, location, enregistrement sans vente) |