diff options
| author | polo <ordipolo@gmx.fr> | 2023-08-30 12:20:39 +0200 |
|---|---|---|
| committer | polo <ordipolo@gmx.fr> | 2023-08-30 12:20:39 +0200 |
| commit | 6f4cc3afffde36a13618458ffda72e6104624f36 (patch) | |
| tree | fbf77181dee390e048bc5fa340ca60bd078ab22b /src/sections | |
| parent | 747674b450d6840ce9bd9aecd765cf31445ef8d3 (diff) | |
| download | AppliGestionPHP-6f4cc3afffde36a13618458ffda72e6104624f36.tar.gz AppliGestionPHP-6f4cc3afffde36a13618458ffda72e6104624f36.tar.bz2 AppliGestionPHP-6f4cc3afffde36a13618458ffda72e6104624f36.zip | |
section client à part, section modif en cours, bug dans Dates,
Diffstat (limited to 'src/sections')
| -rw-r--r-- | src/sections/1_customer.php | 25 | ||||
| -rw-r--r-- | src/sections/2_service.php | 62 | ||||
| -rw-r--r-- | src/sections/3_modify_data.php | 170 | ||||
| -rw-r--r-- | src/sections/4_get_document.php | 2 | ||||
| -rw-r--r-- | src/sections/main_loop.php | 30 |
5 files changed, 244 insertions, 45 deletions
diff --git a/src/sections/1_customer.php b/src/sections/1_customer.php index cdec448..ca20d08 100644 --- a/src/sections/1_customer.php +++ b/src/sections/1_customer.php | |||
| @@ -12,29 +12,36 @@ function newCustomer(): array | |||
| 12 | 12 | ||
| 13 | // -- partie 1: client ou prospect? -- | 13 | // -- partie 1: client ou prospect? -- |
| 14 | $Client = new Clients; | 14 | $Client = new Clients; |
| 15 | if(exec($TypeDeClient->get()) === 'Client') | 15 | $choix_niv2 = exec($TypeDeClient->get()); |
| 16 | if($choix_niv2 === ZenitySetup::$type_client_entrees[0]) | ||
| 16 | { | 17 | { |
| 18 | echo "choix: " . $choix_niv2 . "\n"; | ||
| 17 | $Client->setType('client'); | 19 | $Client->setType('client'); |
| 18 | } | 20 | } |
| 19 | //~ else // | 21 | elseif($choix_niv2 === ZenitySetup::$type_client_entrees[1]) |
| 20 | //~ { | 22 | { |
| 21 | //~ $Client->setType('prospect'); | 23 | echo "choix: " . $choix_niv2 . "\n"; |
| 22 | //~ } | 24 | $Client->setType('prospect'); |
| 25 | } | ||
| 26 | else | ||
| 27 | { | ||
| 28 | return [0, null]; // menu principal | ||
| 29 | } | ||
| 23 | 30 | ||
| 24 | // -- partie 2: saisie des infos -- | 31 | // -- partie 2: saisie des infos -- |
| 25 | if(enterCustomer($Client)) | 32 | if(enterCustomer($Client)) |
| 26 | { | 33 | { |
| 27 | // -- partie 3: on fait quoi maintenant -- | 34 | // -- partie 3: on fait quoi maintenant -- |
| 28 | $choix_niv2 = exec($FinSection1->get()); | 35 | $choix_niv3 = exec($FinSection1->get()); |
| 29 | if($choix_niv2 === ZenitySetup::$fin_section_1_entrees[0]) | 36 | if($choix_niv3 === ZenitySetup::$fin_section_1_entrees[0]) |
| 30 | { | 37 | { |
| 31 | return [2, $Client]; // section 2: newService() | 38 | return [2, $Client]; // section 2: newService() |
| 32 | } | 39 | } |
| 33 | elseif($choix_niv2 === ZenitySetup::$fin_section_1_entrees[1]) | 40 | elseif($choix_niv3 === ZenitySetup::$fin_section_1_entrees[1]) |
| 34 | { | 41 | { |
| 35 | return [3, $Client]; // section 3: modifyData() | 42 | return [3, $Client]; // section 3: modifyData() |
| 36 | } | 43 | } |
| 37 | elseif($choix_niv2 === ZenitySetup::$fin_section_1_entrees[2]) | 44 | elseif($choix_niv3 === ZenitySetup::$fin_section_1_entrees[2]) |
| 38 | { | 45 | { |
| 39 | return [1, null]; // relancer section 1: newCustomer() | 46 | return [1, null]; // relancer section 1: newCustomer() |
| 40 | } | 47 | } |
diff --git a/src/sections/2_service.php b/src/sections/2_service.php index 8109b31..2680db6 100644 --- a/src/sections/2_service.php +++ b/src/sections/2_service.php | |||
| @@ -13,7 +13,7 @@ function newService($Client): array // $Client est un Client ou null | |||
| 13 | $FormulaireCesu = new ZenityForms(ZenitySetup::$formulaire_text, ZenitySetup::$formulaire_cesu_entrees); | 13 | $FormulaireCesu = new ZenityForms(ZenitySetup::$formulaire_text, ZenitySetup::$formulaire_cesu_entrees); |
| 14 | $FormulaireLocation = new ZenityForms(ZenitySetup::$formulaire_text, ZenitySetup::$formulaire_location_entrees); | 14 | $FormulaireLocation = new ZenityForms(ZenitySetup::$formulaire_text, ZenitySetup::$formulaire_location_entrees); |
| 15 | $CommentairePrestation = new ZenityEntry(ZenitySetup::$commentaire_prestation_text); | 15 | $CommentairePrestation = new ZenityEntry(ZenitySetup::$commentaire_prestation_text); |
| 16 | $Recapitulatif = new ZenityList(ZenitySetup::$recapitulatif_text, ZenitySetup::$recapitulatif_entrees); // tableau à multiples colonnes | 16 | //$Recapitulatif = new ZenityList(ZenitySetup::$recapitulatif_text, ZenitySetup::$recapitulatif_entrees); // tableau à multiples colonnes |
| 17 | //$QuestionModifierPrestation = new ZenityQuestion(ZenitySetup::$question_modification_text); | 17 | //$QuestionModifierPrestation = new ZenityQuestion(ZenitySetup::$question_modification_text); |
| 18 | $FinSection2 = new ZenityList(ZenitySetup::$fin_section_2_text, ZenitySetup::$fin_section_2_entrees); | 18 | $FinSection2 = new ZenityList(ZenitySetup::$fin_section_2_text, ZenitySetup::$fin_section_2_entrees); |
| 19 | 19 | ||
| @@ -32,7 +32,7 @@ function newService($Client): array // $Client est un Client ou null | |||
| 32 | 32 | ||
| 33 | // -- partie 2: la prestation -- | 33 | // -- partie 2: la prestation -- |
| 34 | 34 | ||
| 35 | // niveau 2: type comptable d'enregistrement: devis, facture, cesu, location ou pas de prestation | 35 | // niveau 2: type comptable d'enregistrement: devis, facture, cesu, location ou prestation non vendue |
| 36 | $choix_niv2 = exec($MenuEnregistrement->get()); | 36 | $choix_niv2 = exec($MenuEnregistrement->get()); |
| 37 | if($choix_niv2 === '') | 37 | if($choix_niv2 === '') |
| 38 | { | 38 | { |
| @@ -40,9 +40,6 @@ function newService($Client): array // $Client est un Client ou null | |||
| 40 | return [0, null]; // menu principal | 40 | return [0, null]; // menu principal |
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | $Presta = new Prestations($Client->getID()); | ||
| 44 | |||
| 45 | // détail de la prestation | ||
| 46 | // calendrier - étape 1/3 | 43 | // calendrier - étape 1/3 |
| 47 | $Date = new Dates(exec($Calendrier->get())); // exec() renvoie soit une chaîne soit un false | 44 | $Date = new Dates(exec($Calendrier->get())); // exec() renvoie soit une chaîne soit un false |
| 48 | if($Date->getDate() == '') // on n'a pas cliqué sur "annuler" | 45 | if($Date->getDate() == '') // on n'a pas cliqué sur "annuler" |
| @@ -51,32 +48,56 @@ function newService($Client): array // $Client est un Client ou null | |||
| 51 | return [0, null]; // menu principal | 48 | return [0, null]; // menu principal |
| 52 | } | 49 | } |
| 53 | 50 | ||
| 51 | $Presta = new Prestations($Client->getID()); | ||
| 54 | $Presta->setDate($Date->getTimestamp()); // un entier pour la BDD | 52 | $Presta->setDate($Date->getTimestamp()); // un entier pour la BDD |
| 55 | 53 | ||
| 54 | // formulaire - étape 2/3 | ||
| 56 | switch($choix_niv2) | 55 | switch($choix_niv2) |
| 57 | { | 56 | { |
| 58 | // formulaire - étape 2/3 | 57 | // comparaison retour de $MenuEnregistrement->get() avec les noms des entrées du même menu |
| 59 | //~ case ZenitySetup::$menu_enregistrement_entrees[0]: // "Devis" | 58 | case ZenitySetup::$menu_enregistrement_entrees[0]: // "Devis" |
| 60 | //~ $PrestaDetails = new DevisFactures('devis'); | 59 | $PrestaDetails = new DevisFactures('devis'); |
| 61 | //~ $Presta->setTypePresta('devis'); | 60 | $Presta->setTypePresta('devis'); |
| 62 | //~ $input = exec($FormulaireDevis->get()); | 61 | $input = exec($FormulaireDevis->get()); |
| 63 | //~ break; | 62 | break; |
| 64 | case ZenitySetup::$menu_enregistrement_entrees[0]: // "Facture" | 63 | case ZenitySetup::$menu_enregistrement_entrees[1]: // "Facture" |
| 65 | $PrestaDetails = new DevisFactures('factures'); // 'factures' est le nom de la table, pas le type de presta | 64 | $PrestaDetails = new DevisFactures('factures'); |
| 66 | $Presta->setTypePresta('facture'); | 65 | $Presta->setTypePresta('facture'); |
| 67 | $input =exec($FormulaireFacture->get()); | 66 | $input =exec($FormulaireFacture->get()); |
| 68 | break; | 67 | break; |
| 69 | case ZenitySetup::$menu_enregistrement_entrees[1]: // "CESU" | 68 | |
| 69 | //~ case ZenitySetup::$menu_enregistrement_entrees[2]: // "Facture à partir d'un devis" | ||
| 70 | //~ $PrestaDetails = new DevisFactures('facture'); | ||
| 71 | //~ $Presta->setTypePresta('facture'); | ||
| 72 | // 1 choix d'un devis | ||
| 73 | //makeObjectService(); // liste les devis existants pour ce client | ||
| 74 | // | ||
| 75 | // 2 hydratation | ||
| 76 | // | ||
| 77 | // 3 préremplissage du formulaire | ||
| 78 | //$FormulaireFacture->set($Data) | ||
| 79 | // | ||
| 80 | // et plus loin: | ||
| 81 | // 4 édition de la facture | ||
| 82 | //$input = exec($FormulaireFacture->get()); | ||
| 83 | // | ||
| 84 | // 5 hydratation avec les changements | ||
| 85 | // | ||
| 86 | //echo $FormulaireFacture->get() . "\n"; | ||
| 87 | //~ $input = exec($FormulaireFacture->get()); | ||
| 88 | //~ break; | ||
| 89 | |||
| 90 | case ZenitySetup::$menu_enregistrement_entrees[3]: // "CESU" | ||
| 70 | $PrestaDetails = new CESU(); | 91 | $PrestaDetails = new CESU(); |
| 71 | $Presta->setTypePresta('cesu'); | 92 | $Presta->setTypePresta('cesu'); |
| 72 | $input = exec($FormulaireCesu->get()); | 93 | $input = exec($FormulaireCesu->get()); |
| 73 | break; | 94 | break; |
| 74 | case ZenitySetup::$menu_enregistrement_entrees[2]: // "Location" | 95 | case ZenitySetup::$menu_enregistrement_entrees[4]: // "Location" |
| 75 | $PrestaDetails = new Locations(); | 96 | $PrestaDetails = new Locations(); |
| 76 | $Presta->setTypePresta('location'); | 97 | $Presta->setTypePresta('location'); |
| 77 | $input = exec($FormulaireLocation->get()); | 98 | $input = exec($FormulaireLocation->get()); |
| 78 | break; | 99 | break; |
| 79 | case ZenitySetup::$menu_enregistrement_entrees[3]: // "Prestation non vendue" | 100 | case ZenitySetup::$menu_enregistrement_entrees[5]: // "Prestation non vendue" |
| 80 | $Presta->setTypePresta('non_vendue'); | 101 | $Presta->setTypePresta('non_vendue'); |
| 81 | break; | 102 | break; |
| 82 | default: // inutile normallement, cas déjà géré avant | 103 | default: // inutile normallement, cas déjà géré avant |
| @@ -86,7 +107,8 @@ function newService($Client): array // $Client est un Client ou null | |||
| 86 | 107 | ||
| 87 | $Presta->makeCodePresta($Date, $Client->getCodeClient()); // d'un objet à l'autre | 108 | $Presta->makeCodePresta($Date, $Client->getCodeClient()); // d'un objet à l'autre |
| 88 | 109 | ||
| 89 | if($choix_niv2 != ZenitySetup::$menu_enregistrement_entrees[3]) // si presta non vendue, saut étape 3/3 | 110 | // hydratation ou saut étape 3/3 si presta non vendu |
| 111 | if($choix_niv2 != ZenitySetup::$menu_enregistrement_entrees[5]) | ||
| 90 | { | 112 | { |
| 91 | if($input == '') // annulation | 113 | if($input == '') // annulation |
| 92 | { | 114 | { |
| @@ -154,9 +176,9 @@ function newService($Client): array // $Client est un Client ou null | |||
| 154 | //~ {} | 176 | //~ {} |
| 155 | 177 | ||
| 156 | // fabrique d'objets (sans connaître les noms des classes) | 178 | // fabrique d'objets (sans connaître les noms des classes) |
| 157 | $EnveloppeRecto = Latex::makeLatexSubClass('enveloppe_recto'); | 179 | $EnveloppeRecto = Latex::makeInstance('enveloppe_recto'); |
| 158 | $EnveloppeVerso = Latex::makeLatexSubClass('enveloppe_verso'); | 180 | $EnveloppeVerso = Latex::makeInstance('enveloppe_verso'); |
| 159 | $DocumentPresta = Latex::makeLatexSubClass($Presta->getTypePresta()); // $type = facture, devis, location | 181 | $DocumentPresta = Latex::makeInstance($Presta->getTypePresta()); // $type = facture, devis, location |
| 160 | 182 | ||
| 161 | // génération du latex | 183 | // génération du latex |
| 162 | $EnveloppeRecto->setData($Client); | 184 | $EnveloppeRecto->setData($Client); |
diff --git a/src/sections/3_modify_data.php b/src/sections/3_modify_data.php index cc95468..e16a58f 100644 --- a/src/sections/3_modify_data.php +++ b/src/sections/3_modify_data.php | |||
| @@ -3,7 +3,175 @@ | |||
| 3 | // | 3 | // |
| 4 | // -- SECTION 3: Modifier un client, un prospect, une prestation, un devis -- | 4 | // -- SECTION 3: Modifier un client, un prospect, une prestation, un devis -- |
| 5 | 5 | ||
| 6 | function modifyData($Objet): array | 6 | function modifyData($Client): array |
| 7 | { | 7 | { |
| 8 | // -- partie 1: rechercher un client -- | ||
| 9 | if($Client == null || get_class($Client) !== 'Clients') // étape sautable | ||
| 10 | { | ||
| 11 | $Client = makeObjectClient(); // = 0 ou type "Clients" | ||
| 12 | if(!is_object($Client) || !get_class($Client) == 'Clients') | ||
| 13 | { | ||
| 14 | echo "debug: annulation sélection client\n"; | ||
| 15 | return [0, null]; // menu principal | ||
| 16 | } | ||
| 17 | } | ||
| 18 | |||
| 19 | |||
| 20 | // -- partie 2: modifier un client -- | ||
| 21 | |||
| 22 | // fenêtre $ModificationClient | ||
| 23 | $ModificationClientMenu = new ZenityList(ZenitySetup::$modification_client['text'], []); | ||
| 24 | $entrees = []; | ||
| 25 | $i = 0; | ||
| 26 | $client_data = $Client->getAllWithWindowFields(); | ||
| 27 | //var_dump($client_data); | ||
| 28 | foreach($client_data as $key => $value) | ||
| 29 | { | ||
| 30 | $entrees[$i][] = $key; | ||
| 31 | $entrees[$i][] = $value; | ||
| 32 | $i++; | ||
| 33 | } | ||
| 34 | $entrees[$i][] = ZenitySetup::$modification_client['service']; | ||
| 35 | $entrees[$i][] = ''; | ||
| 36 | $i++; | ||
| 37 | $entrees[$i][] = ZenitySetup::$modification_client['return']; | ||
| 38 | $entrees[$i][] = ''; | ||
| 39 | $ModificationClientMenu->setListRows($entrees, 2, 2.5); | ||
| 40 | |||
| 41 | // modifier une valeur | ||
| 42 | $choix_niv2 = exec($ModificationClientMenu->get()); | ||
| 43 | if($choix_niv2 === ZenitySetup::$modification_client['service']) // ne pas modifier le client mais une prestation | ||
| 44 | { | ||
| 45 | echo "choix: modifier une prestation\n"; | ||
| 46 | // on passe à la suite | ||
| 47 | } | ||
| 48 | elseif($choix_niv2 === ZenitySetup::$modification_client['return']) // annuler | ||
| 49 | { | ||
| 50 | echo "choix: retour au menu principal\n"; | ||
| 51 | return [0, null]; // menu principal | ||
| 52 | } | ||
| 53 | elseif($choix_niv2 === "Client ou Prospect?") // modifier le client | ||
| 54 | { | ||
| 55 | echo "choix: modifier" . $choix_niv2 . "\n"; | ||
| 56 | $TypeDeClient = new ZenityList(ZenitySetup::$type_client_text, ZenitySetup::$type_client_entrees); | ||
| 57 | $input = exec($TypeDeClient->get()); | ||
| 58 | if($input === ZenitySetup::$type_client_entrees[0]) | ||
| 59 | { | ||
| 60 | echo "choix: " . $input . "\n"; | ||
| 61 | $Client->setType('client'); | ||
| 62 | } | ||
| 63 | elseif($input === ZenitySetup::$type_client_entrees[1]) | ||
| 64 | { | ||
| 65 | echo "choix: " . $input . "\n"; | ||
| 66 | $Client->setType('prospect'); | ||
| 67 | } | ||
| 68 | else | ||
| 69 | { | ||
| 70 | echo "choix: annulation\n"; | ||
| 71 | } | ||
| 72 | $Client->update(); | ||
| 73 | return [3, $Client]; // menu précédent | ||
| 74 | } | ||
| 75 | elseif(is_string($choix_niv2) && $choix_niv2 != '') // modifier le client | ||
| 76 | { | ||
| 77 | echo "choix: modifier" . $choix_niv2 . "\n"; | ||
| 78 | $ModificationClient = new ZenityEntry($choix_niv2); | ||
| 79 | $input = exec($ModificationClient->get()); | ||
| 80 | if(is_string($input) && $input != '') | ||
| 81 | { | ||
| 82 | $Client->getSetterAndSet($choix_niv2, $input); | ||
| 83 | $Client->update(); | ||
| 84 | |||
| 85 | // mettre à jour les documents | ||
| 86 | |||
| 87 | } | ||
| 88 | else | ||
| 89 | { | ||
| 90 | echo "choix: annulation\n"; | ||
| 91 | } | ||
| 92 | return [3, $Client]; // menu précédent | ||
| 93 | } | ||
| 94 | else // annuler | ||
| 95 | { | ||
| 96 | echo "annulation: retour au menu principal\n"; | ||
| 97 | return [0, null]; // menu principal | ||
| 98 | } | ||
| 99 | |||
| 100 | |||
| 101 | // -- partie 3: rechercher une prestation -- | ||
| 102 | $Presta = getServices($Client); // = 0 ou type "Prestations" | ||
| 103 | if(!is_object($Presta) || !get_class($Presta) == 'Prestations') | ||
| 104 | { | ||
| 105 | echo "debug: annulation sélection client\n"; | ||
| 106 | return [3, $Client]; // menu précédent | ||
| 107 | } | ||
| 108 | |||
| 109 | |||
| 110 | // -- partie 4: modifier une prestation -- | ||
| 111 | |||
| 112 | // fenêtre $ModificationPresta | ||
| 113 | $ModificationPrestaMenu = new ZenityList(ZenitySetup::$modification_presta['text'], []); | ||
| 114 | $entrees = []; | ||
| 115 | $i = 0; | ||
| 116 | |||
| 117 | $presta_data = $Presta->getAllWithWindowFields(); | ||
| 118 | var_dump($presta_data); | ||
| 119 | foreach($presta_data as $key => $value) | ||
| 120 | { | ||
| 121 | $entrees[$i][] = $key; | ||
| 122 | $entrees[$i][] = $value; | ||
| 123 | $i++; | ||
| 124 | } | ||
| 125 | |||
| 126 | // infos des sous-tables 'facture', 'devis', etc | ||
| 127 | switch($Presta->getTypePresta()) | ||
| 128 | { | ||
| 129 | case 'facture': | ||
| 130 | $PrestaDetails = new DevisFactures('factures'); | ||
| 131 | break; | ||
| 132 | |||
| 133 | case 'devis': | ||
| 134 | $PrestaDetails = new DevisFactures('devis'); | ||
| 135 | break; | ||
| 136 | case 'cesu': | ||
| 137 | $PrestaDetails = new CESU(); | ||
| 138 | break; | ||
| 139 | case 'location': | ||
| 140 | $PrestaDetails = new Locations(); | ||
| 141 | break; | ||
| 142 | } | ||
| 143 | if(isset($PrestaDetails)) | ||
| 144 | { | ||
| 145 | $PrestaDetails->setIDPresta($Presta->getID()); | ||
| 146 | $PrestaDetails->hydrate($PrestaDetails->getDetailsByIdPresta()); | ||
| 147 | $presta_data = $PrestaDetails->getAllWithWindowFields(); | ||
| 148 | var_dump($presta_data); | ||
| 149 | foreach($presta_data as $key => $value) | ||
| 150 | { | ||
| 151 | $entrees[$i][] = $key; | ||
| 152 | $entrees[$i][] = $value; | ||
| 153 | $i++; | ||
| 154 | } | ||
| 155 | } | ||
| 156 | |||
| 157 | if($Presta->getTypePresta() === 'devis') | ||
| 158 | { | ||
| 159 | $entrees[$i][] = ZenitySetup::$modification_presta['devis_facture']; // option changer le devis en facture | ||
| 160 | $entrees[$i][] = ''; | ||
| 161 | $i++; | ||
| 162 | } | ||
| 163 | $entrees[$i][] = ZenitySetup::$modification_presta['service']; | ||
| 164 | $entrees[$i][] = ''; | ||
| 165 | $i++; | ||
| 166 | $entrees[$i][] = ZenitySetup::$modification_presta['return']; | ||
| 167 | $entrees[$i][] = ''; | ||
| 168 | $ModificationPrestaMenu->setListRows($entrees, 2, 2.5); | ||
| 169 | |||
| 170 | // modifier une valeur | ||
| 171 | $choix_niv3 = exec($ModificationPrestaMenu->get()); | ||
| 172 | var_dump($choix_niv3); | ||
| 173 | |||
| 174 | // si changement de type de prestation autre que de devis à facture, ça devient compliqué! | ||
| 175 | |||
| 8 | return [0, null]; // menu principal | 176 | return [0, null]; // menu principal |
| 9 | } | 177 | } |
diff --git a/src/sections/4_get_document.php b/src/sections/4_get_document.php index e28e526..baad117 100644 --- a/src/sections/4_get_document.php +++ b/src/sections/4_get_document.php | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | // | 3 | // |
| 4 | // -- SECTION 4: Afficher, imprimer un document -- | 4 | // -- SECTION 4: Afficher, imprimer un document -- |
| 5 | 5 | ||
| 6 | function getDocument($Objet): array | 6 | function getOrPrintDocument(): array |
| 7 | { | 7 | { |
| 8 | $MenuDocuments = new ZenityList(ZenitySetup::$menu_documents_text, ZenitySetup::$menu_documents_entrees); | 8 | $MenuDocuments = new ZenityList(ZenitySetup::$menu_documents_text, ZenitySetup::$menu_documents_entrees); |
| 9 | 9 | ||
diff --git a/src/sections/main_loop.php b/src/sections/main_loop.php index 7dd1af0..f68c251 100644 --- a/src/sections/main_loop.php +++ b/src/sections/main_loop.php | |||
| @@ -6,14 +6,15 @@ | |||
| 6 | require('sections/1_customer.php'); | 6 | require('sections/1_customer.php'); |
| 7 | require('sections/2_service.php'); | 7 | require('sections/2_service.php'); |
| 8 | require('sections/3_modify_data.php'); | 8 | require('sections/3_modify_data.php'); |
| 9 | require('sections/4_get_document.php'); | ||
| 9 | 10 | ||
| 10 | $main_loop = true; | 11 | $main_loop = true; |
| 11 | $returned = [0, null]; // [code de retour, éventuelles données] | 12 | $section = [0, null]; // [code de retour, éventuelles données] |
| 12 | 13 | ||
| 13 | while($main_loop) | 14 | while($main_loop) |
| 14 | { | 15 | { |
| 15 | // -- MENU PRINCIPAL (niveau 1) -- | 16 | // -- MENU PRINCIPAL (niveau 1) -- |
| 16 | if($returned[0] === 0) | 17 | if($section[0] === 0) |
| 17 | { | 18 | { |
| 18 | echo("Menu principal\n"); | 19 | echo("Menu principal\n"); |
| 19 | $MenuPrincipal = new ZenityList(ZenitySetup::$menu_principal_text, ZenitySetup::$menu_principal_entrees); | 20 | $MenuPrincipal = new ZenityList(ZenitySetup::$menu_principal_text, ZenitySetup::$menu_principal_entrees); |
| @@ -24,44 +25,45 @@ while($main_loop) | |||
| 24 | $choix_niv1 = ''; | 25 | $choix_niv1 = ''; |
| 25 | } | 26 | } |
| 26 | 27 | ||
| 27 | 28 | // comparaison du retour de $MenuPrincipal->get() avec les noms des entrées du même menu | |
| 29 | |||
| 28 | // -- SECTION 1: Clients et prospects -- | 30 | // -- SECTION 1: Clients et prospects -- |
| 29 | if($choix_niv1 === ZenitySetup::$menu_principal_entrees[0] || $returned[0] === 1) | 31 | if($choix_niv1 === ZenitySetup::$menu_principal_entrees[0] || $section[0] === 1) |
| 30 | { | 32 | { |
| 31 | echo("choix: ". ZenitySetup::$menu_principal_entrees[0] . "\n"); | 33 | echo("choix: ". ZenitySetup::$menu_principal_entrees[0] . "\n"); |
| 32 | $returned = newCustomer(); | 34 | $section = newCustomer(); |
| 33 | } | 35 | } |
| 34 | 36 | ||
| 35 | // -- SECTION 2: Prestations et devis -- | 37 | // -- SECTION 2: Prestations et devis -- |
| 36 | elseif($choix_niv1 === ZenitySetup::$menu_principal_entrees[1] || $returned[0] === 2) | 38 | elseif($choix_niv1 === ZenitySetup::$menu_principal_entrees[1] || $section[0] === 2) |
| 37 | { | 39 | { |
| 38 | echo("choix: ". ZenitySetup::$menu_principal_entrees[1] . "\n"); | 40 | echo("choix: ". ZenitySetup::$menu_principal_entrees[1] . "\n"); |
| 39 | $returned = newService($returned[1]); // $returned[1] vaut un type Clients ou null | 41 | $section = newService($section[1]); // $section[1] vaut un type Clients ou null |
| 40 | } | 42 | } |
| 41 | 43 | ||
| 42 | // -- SECTION 3: Modifier un enregistrement -- | 44 | // -- SECTION 3: Modifier un enregistrement -- |
| 43 | elseif($choix_niv1 === ZenitySetup::$menu_principal_entrees[2] || $returned[0] === 3) | 45 | elseif($choix_niv1 === ZenitySetup::$menu_principal_entrees[2] || $section[0] === 3) |
| 44 | { | 46 | { |
| 45 | echo("choix: " . ZenitySetup::$menu_principal_entrees[2] . "\n"); | 47 | echo("choix: " . ZenitySetup::$menu_principal_entrees[2] . "\n"); |
| 46 | $returned = modifyData(); | 48 | $section = modifyData($section[1]); // $section[1] vaut un type Clients ou null |
| 47 | } | 49 | } |
| 48 | 50 | ||
| 49 | // -- SECTION 4: Consulter, Imprimer un document -- | 51 | // -- SECTION 4: Consulter, Imprimer un document -- |
| 50 | elseif($choix_niv1 === ZenitySetup::$menu_principal_entrees[3] || $returned[0] === 4) // = Imprimer un document | 52 | elseif($choix_niv1 === ZenitySetup::$menu_principal_entrees[3] || $section[0] === 4) // = Imprimer un document |
| 51 | { | 53 | { |
| 52 | echo("choix: ". ZenitySetup::$menu_principal_entrees[3] . "\n"); | 54 | echo("choix: ". ZenitySetup::$menu_principal_entrees[3] . "\n"); |
| 53 | $returned = getDocument(); | 55 | $section = getOrPrintDocument(); |
| 54 | } | 56 | } |
| 55 | 57 | ||
| 56 | // -- SECTION 5: Consulter/analyser les données -- | 58 | // -- SECTION 5: Consulter/analyser les données -- |
| 57 | elseif($choix_niv1 === ZenitySetup::$menu_principal_entrees[4] || $returned[0] === 5) | 59 | elseif($choix_niv1 === ZenitySetup::$menu_principal_entrees[4] || $section[0] === 5) |
| 58 | { | 60 | { |
| 59 | echo("choix: ". ZenitySetup::$menu_principal_entrees[4] . "\n"); | 61 | echo("choix: ". ZenitySetup::$menu_principal_entrees[4] . "\n"); |
| 60 | // quel affichage? des tableaux avec zenity? LaTeX? une page web? un autre outil servant à faire des tableaux et graphiques | 62 | // quel affichage? des tableaux avec zenity? LaTeX? une page web? un autre outil servant à faire des tableaux et graphiques |
| 61 | } | 63 | } |
| 62 | 64 | ||
| 63 | // -- SECTION 6: Supports de communication -- | 65 | // -- SECTION 6: Supports de communication -- |
| 64 | elseif($choix_niv1 === ZenitySetup::$menu_principal_entrees[5] || $returned[0] === 6) // = Communication | 66 | elseif($choix_niv1 === ZenitySetup::$menu_principal_entrees[5] || $section[0] === 6) // = Communication |
| 65 | { | 67 | { |
| 66 | echo("choix: ". ZenitySetup::$menu_principal_entrees[5] . "\n"); | 68 | echo("choix: ". ZenitySetup::$menu_principal_entrees[5] . "\n"); |
| 67 | $MenuCommunication = new ZenityList(ZenitySetup::$menu_communication_text, ZenitySetup::$menu_communication_entrees); | 69 | $MenuCommunication = new ZenityList(ZenitySetup::$menu_communication_text, ZenitySetup::$menu_communication_entrees); |
| @@ -85,7 +87,7 @@ while($main_loop) | |||
| 85 | } | 87 | } |
| 86 | 88 | ||
| 87 | // -- SECTION 7: BDD -- | 89 | // -- SECTION 7: BDD -- |
| 88 | elseif($choix_niv1 === ZenitySetup::$menu_principal_entrees[6] || $returned[0] === 7) // = Base de données | 90 | elseif($choix_niv1 === ZenitySetup::$menu_principal_entrees[6] || $section[0] === 7) // = Base de données |
| 89 | { | 91 | { |
| 90 | echo("choix: ". ZenitySetup::$menu_principal_entrees[6] . "\n"); | 92 | echo("choix: ". ZenitySetup::$menu_principal_entrees[6] . "\n"); |
| 91 | if($sqlitebrowser_enable) | 93 | if($sqlitebrowser_enable) |
