From 9ca2e7f3b212ca7434bb169f7c1b9ac0f8b2b22e Mon Sep 17 00:00:00 2001 From: polo Date: Fri, 17 Jul 2026 23:04:59 +0200 Subject: param ?Client dans newService() et modifyData(), gitignore, config-template --- src/sections/2_service.php | 10 ++++------ src/sections/3_modify_data.php | 11 ++++------- 2 files changed, 8 insertions(+), 13 deletions(-) (limited to 'src/sections') 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 @@ // // -- SECTION 2: Prestation et devis -- -use Doctrine\ORM\EntityManager; - -function newService($Client): array // $Client est un Client ou null +function newService(?Client $Client = null): array { // fenêtres recherche d'un client $RechercheClient = new zenityEntry(ZenitySetup::$recherche_client['text']); @@ -25,11 +23,11 @@ function newService($Client): array // $Client est un Client ou null // -- partie 1: le client -- - if($Client == null || get_class($Client) !== 'Client') + if(!$Client) { - $Client = Client::getObject($RechercheClient, $ResultatsRechercheClient); // retourne un Client ou 0 + $Client = Client::find($RechercheClient, $ResultatsRechercheClient); // retourne un Client ou 0 //$ResultatsRechercheClient->cleanCommand(); // inutile parce qu'on ne boucle pas dans cette fonction - if($Client === 0) + if(!$Client) { echo "debug: annulation sélection client\n"; 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 @@ require('3-1_windows.php'); -use Doctrine\ORM\EntityManager; - -function modifyData($Client): array +function modifyData(?Client $Client = null): array { // -- partie 1: rechercher un client -- @@ -19,12 +17,11 @@ function modifyData($Client): array $TypeDeClient = new ZenityList(ZenitySetup::$type_client['text'], ZenitySetup::$type_client['entrees']); $Calendrier = new ZenityCalendar(ZenitySetup::$calendar['section3']); - if($Client == null || get_class($Client) !== 'Client') // étape sautable + if(!$Client) { - $Client = Client::getObject($RechercheClient, $ResultatsRechercheClient); // = 0 ou type "Client" + $Client = Client::find($RechercheClient, $ResultatsRechercheClient); //$ResultatsRechercheClient->cleanCommand(); // inutile parce qu'on ne boucle pas dans cette fonction - //if(!is_object($Client) || !get_class($Client) == 'Client') - if($Client === 0) + if(!$Client) { echo "debug: annulation sélection client\n"; return [0, null]; // menu principal -- cgit v1.2.3