diff options
Diffstat (limited to 'src/sections/3_modify_data.php')
-rw-r--r-- | src/sections/3_modify_data.php | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/src/sections/3_modify_data.php b/src/sections/3_modify_data.php index 5da7ed9..0a67cea 100644 --- a/src/sections/3_modify_data.php +++ b/src/sections/3_modify_data.php | |||
@@ -7,6 +7,11 @@ require('3-1_windows.php'); | |||
7 | 7 | ||
8 | function modifyData($Client): array | 8 | function modifyData($Client): array |
9 | { | 9 | { |
10 | // fenêtres fixes | ||
11 | $TypeDeClient = new ZenityList(ZenitySetup::$type_client['text'], ZenitySetup::$type_client['entrees']); | ||
12 | $Calendrier = new ZenityCalendar(ZenitySetup::$calendar['section3']); | ||
13 | |||
14 | |||
10 | // -- partie 1: rechercher un client -- | 15 | // -- partie 1: rechercher un client -- |
11 | if($Client == null || get_class($Client) !== 'Clients') // étape sautable | 16 | if($Client == null || get_class($Client) !== 'Clients') // étape sautable |
12 | { | 17 | { |
@@ -25,22 +30,21 @@ function modifyData($Client): array | |||
25 | $ModificationClientMenu = makeModifyCustomerWindow($Client); | 30 | $ModificationClientMenu = makeModifyCustomerWindow($Client); |
26 | 31 | ||
27 | $choix_niv2 = exec($ModificationClientMenu->get()); | 32 | $choix_niv2 = exec($ModificationClientMenu->get()); |
28 | if($choix_niv2 === ZenitySetup::$modification_client['service']) // ne pas modifier le client mais une prestation | 33 | if($choix_niv2 === ZenitySetup::$modification_client['service']) // clic sur "Modifier une prestation" |
29 | { | 34 | { |
30 | echo "choix: modifier une prestation\n"; | 35 | echo "choix: modifier une prestation\n"; |
31 | // on passe à la suite | 36 | // ne rien faire dans cette partie et passer à la suite |
32 | } | 37 | } |
33 | elseif($choix_niv2 === "Client ou Prospect?") // modifier type de client | 38 | elseif($choix_niv2 === "Client ou Prospect?") |
34 | { | 39 | { |
35 | echo "choix: modifier" . $choix_niv2 . "\n"; | 40 | echo "choix: modifier" . $choix_niv2 . "\n"; |
36 | $TypeDeClient = new ZenityList(ZenitySetup::$type_client_text, ZenitySetup::$type_client_entrees); | ||
37 | $input = exec($TypeDeClient->get()); | 41 | $input = exec($TypeDeClient->get()); |
38 | if($input === ZenitySetup::$type_client_entrees[0]) | 42 | if($input === ZenitySetup::$type_client['entrees'][0]) |
39 | { | 43 | { |
40 | echo "choix: " . $input . "\n"; | 44 | echo "choix: " . $input . "\n"; |
41 | $Client->setType('client'); | 45 | $Client->setType('client'); |
42 | } | 46 | } |
43 | elseif($input === ZenitySetup::$type_client_entrees[1]) | 47 | elseif($input === ZenitySetup::$type_client['entrees'][1]) |
44 | { | 48 | { |
45 | echo "choix: " . $input . "\n"; | 49 | echo "choix: " . $input . "\n"; |
46 | $Client->setType('prospect'); | 50 | $Client->setType('prospect'); |
@@ -52,7 +56,7 @@ function modifyData($Client): array | |||
52 | $Client->update(); | 56 | $Client->update(); |
53 | return [3, $Client]; // menu précédent | 57 | return [3, $Client]; // menu précédent |
54 | } | 58 | } |
55 | elseif(is_string($choix_niv2) && $choix_niv2 != '') // modifier une valeur | 59 | elseif(is_string($choix_niv2) && $choix_niv2 != '') // autres choix, modifier une valeur |
56 | { | 60 | { |
57 | echo "choix: modifier" . $choix_niv2 . "\n"; | 61 | echo "choix: modifier" . $choix_niv2 . "\n"; |
58 | $ModificationClient = new ZenityEntry($choix_niv2); | 62 | $ModificationClient = new ZenityEntry($choix_niv2); |
@@ -74,7 +78,7 @@ function modifyData($Client): array | |||
74 | } | 78 | } |
75 | return [3, $Client]; // menu précédent | 79 | return [3, $Client]; // menu précédent |
76 | } | 80 | } |
77 | else // annuler | 81 | else |
78 | { | 82 | { |
79 | echo "annulation: retour au menu principal\n"; | 83 | echo "annulation: retour au menu principal\n"; |
80 | return [0, null]; // menu principal | 84 | return [0, null]; // menu principal |
@@ -95,7 +99,6 @@ function modifyData($Client): array | |||
95 | case 'facture': | 99 | case 'facture': |
96 | $PrestaDetails = new DevisFactures('factures'); | 100 | $PrestaDetails = new DevisFactures('factures'); |
97 | break; | 101 | break; |
98 | |||
99 | case 'devis': | 102 | case 'devis': |
100 | $PrestaDetails = new DevisFactures('devis'); | 103 | $PrestaDetails = new DevisFactures('devis'); |
101 | break; | 104 | break; |
@@ -122,16 +125,13 @@ function modifyData($Client): array | |||
122 | $ModificationPrestaMenu = makeModifyServiceWindow($Presta, $PrestaDetails); | 125 | $ModificationPrestaMenu = makeModifyServiceWindow($Presta, $PrestaDetails); |
123 | 126 | ||
124 | $choix_niv3 = exec($ModificationPrestaMenu->get()); | 127 | $choix_niv3 = exec($ModificationPrestaMenu->get()); |
125 | if($choix_niv3 === ZenitySetup::$modification_presta['devis_facture']) // devis -> facture | 128 | //~ if($choix_niv3 === ZenitySetup::$modification_presta['devis_facture']) // devis -> facture |
126 | { | 129 | //~ { |
127 | echo "choix: changer un devis en facture\n"; | 130 | //~ echo "choix: changer un devis en facture\n"; |
128 | return [3, $Client]; // menu "client" | 131 | //~ return [2, $Client]; // menu "client" |
129 | } | 132 | //~ } |
130 | elseif($choix_niv3 === 'Date:') | 133 | if($choix_niv3 === 'Date:') |
131 | { | 134 | { |
132 | // fenêtre | ||
133 | $Calendrier = new ZenityCalendar(ZenitySetup::$calendar['section3']); | ||
134 | |||
135 | $Date = new Dates(exec($Calendrier->get())); // exec() renvoie soit une chaîne soit un false | 135 | $Date = new Dates(exec($Calendrier->get())); // exec() renvoie soit une chaîne soit un false |
136 | if($Date->getDate() == '') // clic sur "annuler", touche "échap" | 136 | if($Date->getDate() == '') // clic sur "annuler", touche "échap" |
137 | { | 137 | { |
@@ -157,7 +157,7 @@ function modifyData($Client): array | |||
157 | } | 157 | } |
158 | //~ elseif($choix_niv3 === 'Type de Presta:') // choix impossible pour le moment | 158 | //~ elseif($choix_niv3 === 'Type de Presta:') // choix impossible pour le moment |
159 | //~ { | 159 | //~ { |
160 | //~ echo "choix: Impossible de modifier le type de prestation\n"; | 160 | //~ echo "choix: changer le type de prestation (devis, facture, etc)\n"; |
161 | //~ return [3, $Client]; // menu "client" | 161 | //~ return [3, $Client]; // menu "client" |
162 | //~ } | 162 | //~ } |
163 | elseif(is_string($choix_niv3) && $choix_niv3 != '') // modifier une valeur | 163 | elseif(is_string($choix_niv3) && $choix_niv3 != '') // modifier une valeur |
@@ -179,7 +179,6 @@ function modifyData($Client): array | |||
179 | } | 179 | } |
180 | 180 | ||
181 | // mettre à jour les documents | 181 | // mettre à jour les documents |
182 | //$type = $Presta->getTypePresta(); | ||
183 | if($type === 'devis' || $type === 'facture' || $type === 'location') | 182 | if($type === 'devis' || $type === 'facture' || $type === 'location') |
184 | { | 183 | { |
185 | $DocumentPresta = Latex::makeInstance($type); | 184 | $DocumentPresta = Latex::makeInstance($type); |