diff options
| author | polo <ordipolo@gmx.fr> | 2026-10-09 17:45:25 +0200 |
|---|---|---|
| committer | polo <ordipolo@gmx.fr> | 2026-10-09 17:45:25 +0200 |
| commit | 084264d336fa9156e1b26196d3936eb3cf2c9782 (patch) | |
| tree | 11f177504172de9e75184fa4f61c01d4cf85be1c /src/model/entities/Client.php | |
| parent | f2f5560339203baad7951006c5a63d10f237ee6a (diff) | |
| download | AppliGestionPHP-084264d336fa9156e1b26196d3936eb3cf2c9782.tar.gz AppliGestionPHP-084264d336fa9156e1b26196d3936eb3cf2c9782.tar.bz2 AppliGestionPHP-084264d336fa9156e1b26196d3936eb3cf2c9782.zip | |
Client::controlForm() filtre un client sans nom ou code client, écrire "gratuit" pour un devis gratuit
Diffstat (limited to 'src/model/entities/Client.php')
| -rw-r--r-- | src/model/entities/Client.php | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/src/model/entities/Client.php b/src/model/entities/Client.php index 97951be..a0bc405 100644 --- a/src/model/entities/Client.php +++ b/src/model/entities/Client.php | |||
| @@ -173,31 +173,27 @@ class Client | |||
| 173 | return str_replace($search, '', $data); | 173 | return str_replace($search, '', $data); |
| 174 | } | 174 | } |
| 175 | 175 | ||
| 176 | // une partie du code vient de Model::hydrateFromForm() | 176 | public static function controlForm(string $input): string|false |
| 177 | // à mettre dans une classe ClientManager? | ||
| 178 | public function enterCustomer(ZenityForms $Form): bool | ||
| 179 | { | 177 | { |
| 180 | $input = exec($Form->get()); | ||
| 181 | if($input == ''){ | ||
| 182 | echo "debug: annulation lors de l'enregistrement d'un nouveau client\n"; | ||
| 183 | return false; | ||
| 184 | } | ||
| 185 | |||
| 186 | $data_array = explode('|', $input); // array | 178 | $data_array = explode('|', $input); // array |
| 187 | if($data_array[0] == ''){ | 179 | |
| 188 | echo "debug: données insuffisantes, le nom du client doit au minimum être renseigné\n"; | 180 | if($data_array[0] == '' || $data_array[1] == ''){ |
| 181 | echo "debug: données insuffisantes, renseignez au moins un nom et un code client\n"; | ||
| 189 | return false; | 182 | return false; |
| 190 | } | 183 | } |
| 191 | else{ | ||
| 192 | $this->setAll($data_array); | ||
| 193 | } | ||
| 194 | 184 | ||
| 185 | return $input; | ||
| 186 | } | ||
| 187 | |||
| 188 | // une partie du code vient de Model::hydrateFromForm() | ||
| 189 | // à mettre dans une classe ClientManager? | ||
| 190 | public function enterCustomer(string $input): void | ||
| 191 | { | ||
| 192 | $this->setAll(explode('|', $input)); | ||
| 195 | self::$entityManager->persist($this); | 193 | self::$entityManager->persist($this); |
| 196 | self::$entityManager->flush(); | 194 | self::$entityManager->flush(); |
| 197 | 195 | ||
| 198 | //$this->id = $this->db->lastInsertId(); // synchro automatique avec doctrine | 196 | //$this->id = $this->db->lastInsertId(); // synchro automatique avec doctrine |
| 199 | |||
| 200 | return true; | ||
| 201 | } | 197 | } |
| 202 | 198 | ||
| 203 | public static function find(ZenityEntry $SearchCustomerForm, ZenityList $SearchCustomerResults): ?Client | 199 | public static function find(ZenityEntry $SearchCustomerForm, ZenityList $SearchCustomerResults): ?Client |
