From ecb77199a60c8d924e02da7d9afab1c9f026a525 Mon Sep 17 00:00:00 2001 From: polo Date: Sat, 23 Dec 2023 15:34:55 +0100 Subject: =?UTF-8?q?modification=20de=20prestation=20moins=20dangereuse=20g?= =?UTF-8?q?r=C3=A2ce=20=C3=A0=20shell=5Fexec()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/dev.sqlite | Bin 36864 -> 36864 bytes src/functions.php | 2 +- src/sections/1_customer.php | 1 - src/sections/3-1_windows.php | 20 +++++++++++--------- src/sections/3_modify_data.php | 3 +-- src/view/ZenitySetup.php | 10 ++++++---- "structure base de donn\303\251es.ods" | Bin 26353 -> 0 bytes 7 files changed, 19 insertions(+), 17 deletions(-) delete mode 100644 "structure base de donn\303\251es.ods" diff --git a/data/dev.sqlite b/data/dev.sqlite index b4f0774..1be9645 100644 Binary files a/data/dev.sqlite and b/data/dev.sqlite differ diff --git a/src/functions.php b/src/functions.php index 9bb59d6..e7c2e5b 100644 --- a/src/functions.php +++ b/src/functions.php @@ -24,7 +24,7 @@ function windowAppCommand(string $app, string $path = ''): string function enterCustomer($Client): bool { // fenêtre - $NouveauClient = new ZenityForms(ZenitySetup::$nouveau_client_text, ZenitySetup::$nouveau_client_entrees); + $NouveauClient = new ZenityForms(ZenitySetup::$nouveau_client['text'], ZenitySetup::$nouveau_client['entrees']); $input = exec($NouveauClient->get()); if($input == '') diff --git a/src/sections/1_customer.php b/src/sections/1_customer.php index ae8067f..b0e3283 100644 --- a/src/sections/1_customer.php +++ b/src/sections/1_customer.php @@ -7,7 +7,6 @@ function newCustomer(): array { // fenêtres $TypeDeClient = new ZenityList(ZenitySetup::$type_client['text'], ZenitySetup::$type_client['entrees']); - //~ $NouveauClient = new ZenityForms(ZenitySetup::$nouveau_client_text, ZenitySetup::$nouveau_client_entrees); $FinSection1 = new ZenityList(ZenitySetup::$fin_section_1['text'], ZenitySetup::$fin_section_1['entrees']); // -- partie 1: client ou prospect? -- diff --git a/src/sections/3-1_windows.php b/src/sections/3-1_windows.php index 7e7367b..31c6cee 100644 --- a/src/sections/3-1_windows.php +++ b/src/sections/3-1_windows.php @@ -5,7 +5,9 @@ function makeModifyCustomerWindow(Clients $Customer): ZenityList { + // fenêtre $ModifyCustomer = new ZenityList(ZenitySetup::$modification_client['text'], []); + $entries = []; $i = 0; $client_data = $Customer->getAllWithWindowFields(); @@ -18,7 +20,6 @@ function makeModifyCustomerWindow(Clients $Customer): ZenityList } $entries[$i][] = ZenitySetup::$modification_client['service']; $entries[$i][] = ''; - //~ $i++; //~ $entries[$i][] = ZenitySetup::$modification_client['return']; //~ $entries[$i][] = ''; $ModifyCustomer->setListRows($entries, 2, 2.5); @@ -28,10 +29,11 @@ function makeModifyCustomerWindow(Clients $Customer): ZenityList function makeModifyServiceWindow(Prestations $Service, $ServiceDetails = null): ZenityList { + // fenêtre $ModifyService = new ZenityList(ZenitySetup::$modification_presta['text'], []); + $entrees = []; $i = 0; - $presta_data = $Service->getAllWithWindowFields(); //var_dump($presta_data); foreach($presta_data as $key => $value) @@ -53,18 +55,18 @@ function makeModifyServiceWindow(Prestations $Service, $ServiceDetails = null): } } - if($Service->getTypePresta() === 'devis') - { - $entrees[$i][] = ZenitySetup::$modification_presta['devis_facture']; // option créer une facture à partir du devis - $entrees[$i][] = ''; - //~ $i++; - } + //~ if($Service->getTypePresta() === 'devis') + //~ { + //~ $entrees[$i][] = ZenitySetup::$modification_presta['devis_facture']; // option créer une facture à partir du devis + //~ $entrees[$i][] = ''; + //~ } + //~ $entrees[$i][] = ZenitySetup::$modification_presta['service']; //~ $entrees[$i][] = ''; //~ $i++; //~ $entrees[$i][] = ZenitySetup::$modification_presta['return']; //~ $entrees[$i][] = ''; - $ModifyService->setListRows($entrees, 2, 2.5); + $ModifyService->setListRows($entrees, 2, 2.5); return $ModifyService; } diff --git a/src/sections/3_modify_data.php b/src/sections/3_modify_data.php index 0a67cea..279310b 100644 --- a/src/sections/3_modify_data.php +++ b/src/sections/3_modify_data.php @@ -164,8 +164,7 @@ function modifyData($Client): array { echo "choix: modifier" . $choix_niv3 . "\n"; $ModificationPrestaForm = new ZenityEntry($choix_niv3); - $input = exec($ModificationPrestaForm->get()); - //if(is_string($input) && $input != '') + $input = shell_exec($ModificationPrestaForm->get()); // shell_exec() retourne null si la commande échoue, exec() retourne la dernière ligne de texte en sortie ou null si aucune commande ne réussit if(is_string($input)) // chaine vide autorisée { // mettre à jour la base de données diff --git a/src/view/ZenitySetup.php b/src/view/ZenitySetup.php index a876c04..88621bf 100644 --- a/src/view/ZenitySetup.php +++ b/src/view/ZenitySetup.php @@ -25,8 +25,10 @@ class ZenitySetup static public $recherche_client_text = "Recherche d'un client avec son nom ou son code client"; static public $resultats_recherche_client_text = "Résultats de la recherche, sélectionner un client"; static public $resultats_recherche_presta_text = "Sélectionner une prestation"; - static public $nouveau_client_text = "Nouveau client"; - static public $nouveau_client_entrees = ["Prénom Nom:", "Code client (J.C.Dusse):", "Adresse:", "Code postal:", "Ville:", "Telephone:", "Courriel:", "À propos:"]; + static public $nouveau_client = ['text' => "Nouveau client", + 'entrees' => ["Prénom Nom:", "Code client (J.C.Dusse):", "Adresse:", "Code postal:", "Ville:", "Telephone:", "Courriel:", "À propos:"]]; + //~ static public $nouveau_client_text = "Nouveau client"; + //~ static public $nouveau_client_entrees = ["Prénom Nom:", "Code client (J.C.Dusse):", "Adresse:", "Code postal:", "Ville:", "Telephone:", "Courriel:", "À propos:"]; static public $calendar = ['section2' => 'Nouvelle prestation étape 1/3 - Choisir une date', 'section3' => 'Choisir une nouvelle date']; static public $formulaire = ['text' => 'Nouvelle prestation 2/3 - Détail des travaux', @@ -39,8 +41,8 @@ class ZenitySetup static public $modification_client = ['text' => 'Modifier une information concernant un client', 'service' => "Modifier une prestation"]; //'return' => "Retour menu principal"]; - static public $modification_presta = ['text' => 'Modifier une prestation', - 'devis_facture' => "Créer une facture à partir d'un devis"]; + static public $modification_presta = ['text' => 'Modifier une prestation']; + //'devis_facture' => "Créer une facture à partir d'un devis"]; //'service' => "Modifier une autre prestation", //'return' => "Retour menu précédent"]; diff --git "a/structure base de donn\303\251es.ods" "b/structure base de donn\303\251es.ods" deleted file mode 100644 index c050af8..0000000 Binary files "a/structure base de donn\303\251es.ods" and /dev/null differ -- cgit v1.2.3