diff options
author | polo <ordipolo@gmx.fr> | 2024-06-02 23:19:01 +0200 |
---|---|---|
committer | polo <ordipolo@gmx.fr> | 2024-06-02 23:19:01 +0200 |
commit | 546302cde914a2143f86e6a384cbc5085d55396a (patch) | |
tree | b6e059ed2e7689c29c06d7c92c0d4f30aa9b5022 /src/model/Clients.php | |
parent | 46591fffb0226b0fa87e68248b06182389825f80 (diff) | |
download | AppliGestionPHP-546302cde914a2143f86e6a384cbc5085d55396a.zip |
méthode cleanSpecialChars() pour gérer les ", un peu sale
Diffstat (limited to 'src/model/Clients.php')
-rw-r--r-- | src/model/Clients.php | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/model/Clients.php b/src/model/Clients.php index 0f70eb6..ce38d86 100644 --- a/src/model/Clients.php +++ b/src/model/Clients.php | |||
@@ -44,6 +44,7 @@ class Clients extends Model | |||
44 | } | 44 | } |
45 | public function set(string $entry, string $input) | 45 | public function set(string $entry, string $input) |
46 | { | 46 | { |
47 | $input = $this->cleanSpecialChars($input); // possibilité que $input devienne une chaine vide | ||
47 | switch($entry) | 48 | switch($entry) |
48 | { | 49 | { |
49 | case "Prénom Nom:": | 50 | case "Prénom Nom:": |
@@ -104,8 +105,9 @@ class Clients extends Model | |||
104 | } | 105 | } |
105 | public function setTelephone($value) | 106 | public function setTelephone($value) |
106 | { | 107 | { |
107 | // type string parce que | 108 | // type string parce que: |
108 | // zenity renvoie une chaine, on peut ainsi garder le 0 au début et avoir plusieurs numéros (séparés par virgule et espace) | 109 | // - zenity renvoie une chaine |
110 | // - permet de garder le 0 au début et d'inscrire plusieurs numéros | ||
109 | $this->telephone = (string) $value; | 111 | $this->telephone = (string) $value; |
110 | return $this; | 112 | return $this; |
111 | } | 113 | } |
@@ -124,6 +126,7 @@ class Clients extends Model | |||
124 | $this->type = (string) $value; | 126 | $this->type = (string) $value; |
125 | return $this; | 127 | return $this; |
126 | } | 128 | } |
129 | |||
127 | public function typeToClient(): bool | 130 | public function typeToClient(): bool |
128 | { | 131 | { |
129 | if($this->type != 'client') | 132 | if($this->type != 'client') |
@@ -137,7 +140,6 @@ class Clients extends Model | |||
137 | } | 140 | } |
138 | } | 141 | } |
139 | 142 | ||
140 | |||
141 | public function findByKeywords(array $keywords, string $field): array // n'hydrate pas les variables, on doit choisir un client et hydrater ensuite | 143 | public function findByKeywords(array $keywords, string $field): array // n'hydrate pas les variables, on doit choisir un client et hydrater ensuite |
142 | { | 144 | { |
143 | $result = []; | 145 | $result = []; |