summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpolo <ordipolo@gmx.fr>2026-07-17 23:04:59 +0200
committerpolo <ordipolo@gmx.fr>2026-07-17 23:04:59 +0200
commit9ca2e7f3b212ca7434bb169f7c1b9ac0f8b2b22e (patch)
tree754f601c6010fa428425178b36f102e2c732908f
parente30f1b6f6bc6df56aa7ed2dff4169ab7d7f93fc4 (diff)
downloadAppliGestionPHP-9ca2e7f3b212ca7434bb169f7c1b9ac0f8b2b22e.tar.gz
AppliGestionPHP-9ca2e7f3b212ca7434bb169f7c1b9ac0f8b2b22e.tar.bz2
AppliGestionPHP-9ca2e7f3b212ca7434bb169f7c1b9ac0f8b2b22e.zip
param ?Client dans newService() et modifyData(), gitignore, config-template
-rw-r--r--.gitignore2
-rw-r--r--config/config-template.ini (renamed from config/config.ini)15
-rw-r--r--src/model/entities/Client.php12
-rw-r--r--src/sections/2_service.php10
-rw-r--r--src/sections/3_modify_data.php11
5 files changed, 23 insertions, 27 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..194cf4f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
1data/
2config/config.ini
diff --git a/config/config.ini b/config/config-template.ini
index 6f72cb4..0a8b941 100644
--- a/config/config.ini
+++ b/config/config-template.ini
@@ -5,14 +5,13 @@
5; ATTENTION aux chemins relatifs! 5; ATTENTION aux chemins relatifs!
6; ils sont relatifs par rapport au dossier 'src' où s'exécute le programme 6; ils sont relatifs par rapport au dossier 'src' où s'exécute le programme
7 7
8business_name = ORDIPOLO 8business_name = 'ma boite'
9business_guy = 'Paul Jusot' 9business_guy = "je m'appelle"
10business_address = "2A rue de l'île de Man" 10business_address = 'mon adresse'
11business_postcode = '29000' 11business_postcode = '00000'
12business_city = 'Quimper' 12business_city = 'ma ville'
13 13
14;db_name = ordipolo 14db_name = ma_boite
15db_name = dev
16 15
17; défaut = racine de l'appli = dossier parent de celui du code source 16; défaut = racine de l'appli = dossier parent de celui du code source
18db_path = 'data/' 17db_path = 'data/'
diff --git a/src/model/entities/Client.php b/src/model/entities/Client.php
index 7dd3be6..a81519a 100644
--- a/src/model/entities/Client.php
+++ b/src/model/entities/Client.php
@@ -216,7 +216,7 @@ class Client
216 return true; 216 return true;
217 } 217 }
218 218
219 public static function getObject(ZenityEntry $SearchCustomerForm, ZenityList $SearchCustomerResults) // renvoie un Client ou 0 219 public static function find(ZenityEntry $SearchCustomerForm, ZenityList $SearchCustomerResults): ?Client
220 { 220 {
221 // fenêtres 221 // fenêtres
222 /*$SearchCustomerForm = new ZenityEntry(ZenitySetup::$recherche_client_text); 222 /*$SearchCustomerForm = new ZenityEntry(ZenitySetup::$recherche_client_text);
@@ -228,11 +228,11 @@ class Client
228 if($input == '') // commenter ce if pour qu'une saisie vide permette d'obtenir tous les clients 228 if($input == '') // commenter ce if pour qu'une saisie vide permette d'obtenir tous les clients
229 { 229 {
230 echo "debug: recherche annulée ou saisie vide\n"; 230 echo "debug: recherche annulée ou saisie vide\n";
231 return 0; 231 return null;
232 } 232 }
233 echo "debug: recherche effectuée\n"; 233 echo "debug: recherche effectuée\n";
234 234
235 $MatchedObjects = self::searchCustomer($input, $Customer); 235 $MatchedObjects = self::search($input, $Customer);
236 if(count($MatchedObjects) === 0) // si aucun client ne correspond, les prendre tous! 236 if(count($MatchedObjects) === 0) // si aucun client ne correspond, les prendre tous!
237 { 237 {
238 $repository = self::$entityManager->getRepository('Client'); 238 $repository = self::$entityManager->getRepository('Client');
@@ -241,7 +241,7 @@ class Client
241 if(count($MatchedObjects) === 0) // toujours rien 241 if(count($MatchedObjects) === 0) // toujours rien
242 { 242 {
243 echo "debug: aucun client dans la base de données\n"; 243 echo "debug: aucun client dans la base de données\n";
244 return 0; 244 return null;
245 } 245 }
246 } 246 }
247 247
@@ -261,7 +261,7 @@ class Client
261 if($input == '') 261 if($input == '')
262 { 262 {
263 echo "debug: client pas trouvé ou pas sélectionné\n"; 263 echo "debug: client pas trouvé ou pas sélectionné\n";
264 return 0; 264 return null;
265 } 265 }
266 266
267 echo "debug: client sélectionné\n"; 267 echo "debug: client sélectionné\n";
@@ -273,7 +273,7 @@ class Client
273 return $Customer; 273 return $Customer;
274 } 274 }
275 275
276 private static function searchCustomer(string $input, Client $Customer): array 276 private static function search(string $input, Client $Customer): array
277 { 277 {
278 $input_array = explode(' ', $input); // si plusieurs mot, on les recherche tous l'un après l'autre 278 $input_array = explode(' ', $input); // si plusieurs mot, on les recherche tous l'un après l'autre
279 return $Customer->findByKeywords($input_array, 'prenom_nom'); // on obtient un tableau à deux dimensions avec les entrées trouvées 279 return $Customer->findByKeywords($input_array, 'prenom_nom'); // on obtient un tableau à deux dimensions avec les entrées trouvées
diff --git a/src/sections/2_service.php b/src/sections/2_service.php
index e25d677..9ebf303 100644
--- a/src/sections/2_service.php
+++ b/src/sections/2_service.php
@@ -3,9 +3,7 @@
3// 3//
4// -- SECTION 2: Prestation et devis -- 4// -- SECTION 2: Prestation et devis --
5 5
6use Doctrine\ORM\EntityManager; 6function newService(?Client $Client = null): array
7
8function newService($Client): array // $Client est un Client ou null
9{ 7{
10 // fenêtres recherche d'un client 8 // fenêtres recherche d'un client
11 $RechercheClient = new zenityEntry(ZenitySetup::$recherche_client['text']); 9 $RechercheClient = new zenityEntry(ZenitySetup::$recherche_client['text']);
@@ -25,11 +23,11 @@ function newService($Client): array // $Client est un Client ou null
25 23
26 24
27 // -- partie 1: le client -- 25 // -- partie 1: le client --
28 if($Client == null || get_class($Client) !== 'Client') 26 if(!$Client)
29 { 27 {
30 $Client = Client::getObject($RechercheClient, $ResultatsRechercheClient); // retourne un Client ou 0 28 $Client = Client::find($RechercheClient, $ResultatsRechercheClient); // retourne un Client ou 0
31 //$ResultatsRechercheClient->cleanCommand(); // inutile parce qu'on ne boucle pas dans cette fonction 29 //$ResultatsRechercheClient->cleanCommand(); // inutile parce qu'on ne boucle pas dans cette fonction
32 if($Client === 0) 30 if(!$Client)
33 { 31 {
34 echo "debug: annulation sélection client\n"; 32 echo "debug: annulation sélection client\n";
35 return [0, null]; // menu principal 33 return [0, null]; // menu principal
diff --git a/src/sections/3_modify_data.php b/src/sections/3_modify_data.php
index 00fe220..607638b 100644
--- a/src/sections/3_modify_data.php
+++ b/src/sections/3_modify_data.php
@@ -5,9 +5,7 @@
5 5
6require('3-1_windows.php'); 6require('3-1_windows.php');
7 7
8use Doctrine\ORM\EntityManager; 8function modifyData(?Client $Client = null): array
9
10function modifyData($Client): array
11{ 9{
12 // -- partie 1: rechercher un client -- 10 // -- partie 1: rechercher un client --
13 11
@@ -19,12 +17,11 @@ function modifyData($Client): array
19 $TypeDeClient = new ZenityList(ZenitySetup::$type_client['text'], ZenitySetup::$type_client['entrees']); 17 $TypeDeClient = new ZenityList(ZenitySetup::$type_client['text'], ZenitySetup::$type_client['entrees']);
20 $Calendrier = new ZenityCalendar(ZenitySetup::$calendar['section3']); 18 $Calendrier = new ZenityCalendar(ZenitySetup::$calendar['section3']);
21 19
22 if($Client == null || get_class($Client) !== 'Client') // étape sautable 20 if(!$Client)
23 { 21 {
24 $Client = Client::getObject($RechercheClient, $ResultatsRechercheClient); // = 0 ou type "Client" 22 $Client = Client::find($RechercheClient, $ResultatsRechercheClient);
25 //$ResultatsRechercheClient->cleanCommand(); // inutile parce qu'on ne boucle pas dans cette fonction 23 //$ResultatsRechercheClient->cleanCommand(); // inutile parce qu'on ne boucle pas dans cette fonction
26 //if(!is_object($Client) || !get_class($Client) == 'Client') 24 if(!$Client)
27 if($Client === 0)
28 { 25 {
29 echo "debug: annulation sélection client\n"; 26 echo "debug: annulation sélection client\n";
30 return [0, null]; // menu principal 27 return [0, null]; // menu principal