diff options
Diffstat (limited to 'src/model/Clients.php')
-rw-r--r-- | src/model/Clients.php | 49 |
1 files changed, 46 insertions, 3 deletions
diff --git a/src/model/Clients.php b/src/model/Clients.php index f36acc1..6a4dcf5 100644 --- a/src/model/Clients.php +++ b/src/model/Clients.php | |||
@@ -14,8 +14,6 @@ class Clients extends Model | |||
14 | protected $courriel; | 14 | protected $courriel; |
15 | protected $apropos; | 15 | protected $apropos; |
16 | protected $type = 'prospect'; | 16 | protected $type = 'prospect'; |
17 | |||
18 | //~ use ModelChildren; | ||
19 | 17 | ||
20 | public function __construct() | 18 | public function __construct() |
21 | { | 19 | { |
@@ -31,6 +29,52 @@ class Clients extends Model | |||
31 | { | 29 | { |
32 | return $this->code_client; | 30 | return $this->code_client; |
33 | } | 31 | } |
32 | public function getAllWithWindowFields(): array // différent de Model::getAll() qui retourne get_object_vars($this) | ||
33 | { | ||
34 | return [ | ||
35 | "Prénom Nom:" => $this->prenom_nom, | ||
36 | "Code client (J.C.Dusse):" => $this->code_client, | ||
37 | "Adresse:" => $this->adresse, | ||
38 | "Code postal:" => $this->code_postal, | ||
39 | "Ville:" => $this->ville, | ||
40 | "Telephone:" => $this->telephone, | ||
41 | "Courriel:" => $this->courriel, | ||
42 | "À propos:" => $this->apropos, | ||
43 | "Client ou Prospect?" => $this->type]; | ||
44 | } | ||
45 | public function getSetterAndSet(string $entry, string $input) | ||
46 | { | ||
47 | switch($entry) | ||
48 | { | ||
49 | case "Prénom Nom:": | ||
50 | $this->setPrenomNom($input); | ||
51 | break; | ||
52 | case "Code client (J.C.Dusse):": | ||
53 | $this->setCodeClient($input); | ||
54 | break; | ||
55 | case "Adresse:": | ||
56 | $this->setAdresse($input); | ||
57 | break; | ||
58 | case "Code postal:": | ||
59 | $this->setCodePostal($input); | ||
60 | break; | ||
61 | case "Ville:": | ||
62 | $this->setVille($input); | ||
63 | break; | ||
64 | case "Telephone:": | ||
65 | $this->setTelephone($input); | ||
66 | break; | ||
67 | case "Courriel:": | ||
68 | $this->setCourriel($input); | ||
69 | break; | ||
70 | case "À propos:": | ||
71 | $this->setApropos($input); | ||
72 | break; | ||
73 | case "Client ou Prospect?": | ||
74 | $this->setType($input); | ||
75 | break; | ||
76 | } | ||
77 | } | ||
34 | 78 | ||
35 | // setters | 79 | // setters |
36 | public function setPrenomNom($value) | 80 | public function setPrenomNom($value) |
@@ -58,7 +102,6 @@ class Clients extends Model | |||
58 | $this->ville = (string) $value; | 102 | $this->ville = (string) $value; |
59 | return $this; | 103 | return $this; |
60 | } | 104 | } |
61 | |||
62 | public function setTelephone($value) // chaine parce que zenity renvoie une chaine et parce qu'on garde le 0 au début | 105 | public function setTelephone($value) // chaine parce que zenity renvoie une chaine et parce qu'on garde le 0 au début |
63 | { | 106 | { |
64 | if(is_numeric($value)) | 107 | if(is_numeric($value)) |