diff options
Diffstat (limited to 'src/sections')
| -rw-r--r-- | src/sections/1_customer.php | 14 | ||||
| -rw-r--r-- | src/sections/2_service.php | 118 | ||||
| -rw-r--r-- | src/sections/3-1_windows.php | 2 | ||||
| -rw-r--r-- | src/sections/3_modify_data.php | 39 |
4 files changed, 89 insertions, 84 deletions
diff --git a/src/sections/1_customer.php b/src/sections/1_customer.php index ca20d08..ae8067f 100644 --- a/src/sections/1_customer.php +++ b/src/sections/1_customer.php | |||
| @@ -6,19 +6,19 @@ | |||
| 6 | function newCustomer(): array | 6 | function newCustomer(): array |
| 7 | { | 7 | { |
| 8 | // fenêtres | 8 | // fenêtres |
| 9 | $TypeDeClient = new ZenityList(ZenitySetup::$type_client_text, ZenitySetup::$type_client_entrees); | 9 | $TypeDeClient = new ZenityList(ZenitySetup::$type_client['text'], ZenitySetup::$type_client['entrees']); |
| 10 | //~ $NouveauClient = new ZenityForms(ZenitySetup::$nouveau_client_text, ZenitySetup::$nouveau_client_entrees); | 10 | //~ $NouveauClient = new ZenityForms(ZenitySetup::$nouveau_client_text, ZenitySetup::$nouveau_client_entrees); |
| 11 | $FinSection1 = new ZenityList(ZenitySetup::$fin_section_1_text, ZenitySetup::$fin_section_1_entrees); | 11 | $FinSection1 = new ZenityList(ZenitySetup::$fin_section_1['text'], ZenitySetup::$fin_section_1['entrees']); |
| 12 | 12 | ||
| 13 | // -- partie 1: client ou prospect? -- | 13 | // -- partie 1: client ou prospect? -- |
| 14 | $Client = new Clients; | 14 | $Client = new Clients; |
| 15 | $choix_niv2 = exec($TypeDeClient->get()); | 15 | $choix_niv2 = exec($TypeDeClient->get()); |
| 16 | if($choix_niv2 === ZenitySetup::$type_client_entrees[0]) | 16 | if($choix_niv2 === ZenitySetup::$type_client['entrees'][0]) |
| 17 | { | 17 | { |
| 18 | echo "choix: " . $choix_niv2 . "\n"; | 18 | echo "choix: " . $choix_niv2 . "\n"; |
| 19 | $Client->setType('client'); | 19 | $Client->setType('client'); |
| 20 | } | 20 | } |
| 21 | elseif($choix_niv2 === ZenitySetup::$type_client_entrees[1]) | 21 | elseif($choix_niv2 === ZenitySetup::$type_client['entrees'][1]) |
| 22 | { | 22 | { |
| 23 | echo "choix: " . $choix_niv2 . "\n"; | 23 | echo "choix: " . $choix_niv2 . "\n"; |
| 24 | $Client->setType('prospect'); | 24 | $Client->setType('prospect'); |
| @@ -33,15 +33,15 @@ function newCustomer(): array | |||
| 33 | { | 33 | { |
| 34 | // -- partie 3: on fait quoi maintenant -- | 34 | // -- partie 3: on fait quoi maintenant -- |
| 35 | $choix_niv3 = exec($FinSection1->get()); | 35 | $choix_niv3 = exec($FinSection1->get()); |
| 36 | if($choix_niv3 === ZenitySetup::$fin_section_1_entrees[0]) | 36 | if($choix_niv3 === ZenitySetup::$fin_section_1['entrees'][0]) |
| 37 | { | 37 | { |
| 38 | return [2, $Client]; // section 2: newService() | 38 | return [2, $Client]; // section 2: newService() |
| 39 | } | 39 | } |
| 40 | elseif($choix_niv3 === ZenitySetup::$fin_section_1_entrees[1]) | 40 | elseif($choix_niv3 === ZenitySetup::$fin_section_1['entrees'][1]) |
| 41 | { | 41 | { |
| 42 | return [3, $Client]; // section 3: modifyData() | 42 | return [3, $Client]; // section 3: modifyData() |
| 43 | } | 43 | } |
| 44 | elseif($choix_niv3 === ZenitySetup::$fin_section_1_entrees[2]) | 44 | elseif($choix_niv3 === ZenitySetup::$fin_section_1['entrees'][2]) |
| 45 | { | 45 | { |
| 46 | return [1, null]; // relancer section 1: newCustomer() | 46 | return [1, null]; // relancer section 1: newCustomer() |
| 47 | } | 47 | } |
diff --git a/src/sections/2_service.php b/src/sections/2_service.php index 1d58606..9683ef9 100644 --- a/src/sections/2_service.php +++ b/src/sections/2_service.php | |||
| @@ -8,13 +8,14 @@ function newService($Client): array // $Client est un Client ou null | |||
| 8 | // fenêtres | 8 | // fenêtres |
| 9 | $MenuEnregistrement = new ZenityList(ZenitySetup::$menu_enregistrement_text, ZenitySetup::$menu_enregistrement_entrees); | 9 | $MenuEnregistrement = new ZenityList(ZenitySetup::$menu_enregistrement_text, ZenitySetup::$menu_enregistrement_entrees); |
| 10 | $Calendrier = new ZenityCalendar(ZenitySetup::$calendar['section2']); | 10 | $Calendrier = new ZenityCalendar(ZenitySetup::$calendar['section2']); |
| 11 | $FormulaireDevis = new ZenityForms(ZenitySetup::$formulaire_text, ZenitySetup::$formulaire_devis_entrees); | 11 | $FormulaireDevis = new ZenityForms(ZenitySetup::$formulaire['text'], ZenitySetup::$formulaire['devis_entrees']); |
| 12 | $FormulaireFacture = new ZenityForms(ZenitySetup::$formulaire_text, ZenitySetup::$formulaire_facture_entrees); | 12 | $FormulaireFacture = new ZenityForms(ZenitySetup::$formulaire['text'], ZenitySetup::$formulaire['facture_entrees']); |
| 13 | $FormulaireCesu = new ZenityForms(ZenitySetup::$formulaire_text, ZenitySetup::$formulaire_cesu_entrees); | 13 | $FormulaireFactureReduit = new ZenityForms(ZenitySetup::$formulaire['text'], ZenitySetup::$formulaire['facture_entrees_reduit']); |
| 14 | $FormulaireLocation = new ZenityForms(ZenitySetup::$formulaire_text, ZenitySetup::$formulaire_location_entrees); | 14 | $FormulaireCesu = new ZenityForms(ZenitySetup::$formulaire['text'], ZenitySetup::$formulaire['cesu_entrees']); |
| 15 | $FormulaireLocation = new ZenityForms(ZenitySetup::$formulaire['text'], ZenitySetup::$formulaire['location_entrees']); | ||
| 15 | $CommentairePrestation = new ZenityEntry(ZenitySetup::$commentaire_prestation_text); | 16 | $CommentairePrestation = new ZenityEntry(ZenitySetup::$commentaire_prestation_text); |
| 16 | //$Recapitulatif = new ZenityList(ZenitySetup::$recapitulatif_text, ZenitySetup::$recapitulatif_entrees); // tableau à multiples colonnes | 17 | //$Recapitulatif = new ZenityList(ZenitySetup::$recapitulatif_text, ZenitySetup::$recapitulatif_entrees); // tableau à multiples colonnes |
| 17 | $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']); |
| 18 | 19 | ||
| 19 | 20 | ||
| 20 | // -- partie 1: le client -- | 21 | // -- partie 1: le client -- |
| @@ -57,44 +58,38 @@ function newService($Client): array // $Client est un Client ou null | |||
| 57 | case ZenitySetup::$menu_enregistrement_entrees[0]: // "Devis" | 58 | case ZenitySetup::$menu_enregistrement_entrees[0]: // "Devis" |
| 58 | $PrestaDetails = new DevisFactures('devis'); | 59 | $PrestaDetails = new DevisFactures('devis'); |
| 59 | $Presta->setTypePresta('devis'); | 60 | $Presta->setTypePresta('devis'); |
| 60 | $input = exec($FormulaireDevis->get()); | 61 | $answers = exec($FormulaireDevis->get()); |
| 61 | break; | 62 | break; |
| 62 | case ZenitySetup::$menu_enregistrement_entrees[1]: // "Facture" | 63 | case ZenitySetup::$menu_enregistrement_entrees[1]: // "Facture" |
| 64 | $PrestaDetails = new DevisFactures('factures'); // attention! type "facture" mais table "factures" | ||
| 65 | $Presta->setTypePresta('facture'); | ||
| 66 | $answers = exec($FormulaireFacture->get()); | ||
| 67 | break; | ||
| 68 | case ZenitySetup::$menu_enregistrement_entrees[2]: // "Facture à partir d'un devis" | ||
| 69 | // recherche du devis | ||
| 70 | $Quotation = getServices($Client, 'devis'); // rechercher un devis, type 'devis' spécifié pour $Presta->getIDsByIdClient() | ||
| 71 | if(!is_object($Quotation) || get_class($Quotation) != 'Prestations' || $Quotation->getTypePresta() != 'devis') | ||
| 72 | { | ||
| 73 | echo "debug: annulation sélection client\n"; | ||
| 74 | return [2, $Client]; // menu précédent | ||
| 75 | } | ||
| 76 | $QuotationDetails = new DevisFactures('devis'); | ||
| 77 | // facture: objet vide et formulaire | ||
| 63 | $PrestaDetails = new DevisFactures('factures'); | 78 | $PrestaDetails = new DevisFactures('factures'); |
| 64 | $Presta->setTypePresta('facture'); | 79 | $Presta->setTypePresta('facture'); |
| 65 | $input =exec($FormulaireFacture->get()); | 80 | $answers = exec($FormulaireFactureReduit->get()); |
| 81 | //$answers = '' + answers[0], answers[1], answers[2], answers[3], '', '', '', '', '', answers[4]; | ||
| 82 | //var_dump($answers); | ||
| 66 | break; | 83 | break; |
| 67 | |||
| 68 | //~ case ZenitySetup::$menu_enregistrement_entrees[2]: // "Facture à partir d'un devis" | ||
| 69 | //~ $PrestaDetails = new DevisFactures('facture'); | ||
| 70 | //~ $Presta->setTypePresta('facture'); | ||
| 71 | // 1 choix d'un devis | ||
| 72 | //makeObjectService(); // liste les devis existants pour ce client | ||
| 73 | // | ||
| 74 | // 2 hydratation | ||
| 75 | // | ||
| 76 | // 3 préremplissage du formulaire | ||
| 77 | //$FormulaireFacture->set($Data) | ||
| 78 | // | ||
| 79 | // et plus loin: | ||
| 80 | // 4 édition de la facture | ||
| 81 | //$input = exec($FormulaireFacture->get()); | ||
| 82 | // | ||
| 83 | // 5 hydratation avec les changements | ||
| 84 | // | ||
| 85 | //echo $FormulaireFacture->get() . "\n"; | ||
| 86 | //~ $input = exec($FormulaireFacture->get()); | ||
| 87 | //~ break; | ||
| 88 | |||
| 89 | case ZenitySetup::$menu_enregistrement_entrees[3]: // "CESU" | 84 | case ZenitySetup::$menu_enregistrement_entrees[3]: // "CESU" |
| 90 | $PrestaDetails = new CESU(); | 85 | $PrestaDetails = new CESU(); |
| 91 | $Presta->setTypePresta('cesu'); | 86 | $Presta->setTypePresta('cesu'); |
| 92 | $input = exec($FormulaireCesu->get()); | 87 | $answers = exec($FormulaireCesu->get()); |
| 93 | break; | 88 | break; |
| 94 | case ZenitySetup::$menu_enregistrement_entrees[4]: // "Location" | 89 | case ZenitySetup::$menu_enregistrement_entrees[4]: // "Location" |
| 95 | $PrestaDetails = new Locations(); | 90 | $PrestaDetails = new Locations(); |
| 96 | $Presta->setTypePresta('location'); | 91 | $Presta->setTypePresta('location'); |
| 97 | $input = exec($FormulaireLocation->get()); | 92 | $answers = exec($FormulaireLocation->get()); |
| 98 | break; | 93 | break; |
| 99 | case ZenitySetup::$menu_enregistrement_entrees[5]: // "Prestation non vendue" | 94 | case ZenitySetup::$menu_enregistrement_entrees[5]: // "Prestation non vendue" |
| 100 | $Presta->setTypePresta('non_vendue'); | 95 | $Presta->setTypePresta('non_vendue'); |
| @@ -106,28 +101,12 @@ function newService($Client): array // $Client est un Client ou null | |||
| 106 | 101 | ||
| 107 | $Presta->makeCodePresta($Date, $Client->getCodeClient()); // d'un objet à l'autre | 102 | $Presta->makeCodePresta($Date, $Client->getCodeClient()); // d'un objet à l'autre |
| 108 | 103 | ||
| 109 | // hydratation ou saut étape 3/3 si presta non vendu | ||
| 110 | if($choix_niv2 != ZenitySetup::$menu_enregistrement_entrees[5]) | ||
| 111 | { | ||
| 112 | if($input == '') // annulation | ||
| 113 | { | ||
| 114 | echo "debug: annulation lors de l'enregistrement des détails de la prestation\n"; | ||
| 115 | return [0, null]; | ||
| 116 | } | ||
| 117 | elseif(isset($PrestaDetails) && !$PrestaDetails->hydrateFromForm($input, $Presta)) // echec de l'hydratation | ||
| 118 | { | ||
| 119 | echo "debug: erreur de hydrateFromForm()\n"; // messages d'erreur à mettre ici ou dans hydrateFromForm()? | ||
| 120 | return [0, null]; | ||
| 121 | } | ||
| 122 | unset($input); | ||
| 123 | } | ||
| 124 | |||
| 125 | // commentaire - étape 3/3 | 104 | // commentaire - étape 3/3 |
| 126 | $input = exec($CommentairePrestation->get()); | 105 | $comment = exec($CommentairePrestation->get()); |
| 127 | if($input == '') | 106 | if($comment == '') |
| 128 | { | 107 | { |
| 129 | echo "debug: pas de commentaire saisi\n"; | 108 | echo "debug: pas de commentaire saisi\n"; |
| 130 | // on n'interrompt pas le script et on enregistre dans tous les cas (annulatation, chaîne vide) | 109 | // on n'interrompt pas le script et on enregistre dans tous les cas (annulatation comprise) |
| 131 | } | 110 | } |
| 132 | // Cliquer sur annuler (ou appuyer sur échap) revient dont à valider avec une chaîne vide et enregistrer la prestation | 111 | // Cliquer sur annuler (ou appuyer sur échap) revient dont à valider avec une chaîne vide et enregistrer la prestation |
| 133 | // la commande 'echo $?' ($? est le code de sortie de la commande précédente) renvoit 1 si on annule avec la touche échap () | 112 | // la commande 'echo $?' ($? est le code de sortie de la commande précédente) renvoit 1 si on annule avec la touche échap () |
| @@ -140,13 +119,39 @@ function newService($Client): array // $Client est un Client ou null | |||
| 140 | //~ echo "debug: annulation à la saisie d'un commentaire\n"; | 119 | //~ echo "debug: annulation à la saisie d'un commentaire\n"; |
| 141 | //~ return 0; | 120 | //~ return 0; |
| 142 | //~ } | 121 | //~ } |
| 143 | $Presta->setCommentaires($input); | 122 | $Presta->setCommentaires($comment); |
| 144 | unset($input); | 123 | |
| 124 | // hydratation d'une facture à partir d'un devis | ||
| 125 | if($choix_niv2 === ZenitySetup::$menu_enregistrement_entrees[2]) // cas: facture à partir d'un devis | ||
| 126 | { | ||
| 127 | // devis retrouvé ($Quotation est déjà hydraté) | ||
| 128 | $QuotationDetails->setIDPresta($Quotation->getID()); | ||
| 129 | $QuotationDetails->hydrate($QuotationDetails->getDetailsByIdPresta()); | ||
| 130 | |||
| 131 | // facture avec le devis | ||
| 132 | $QuotationDetails->hydrateReceiptWithQuotation($PrestaDetails); | ||
| 133 | } | ||
| 134 | |||
| 135 | // hydratation avec la saisie du formulaire | ||
| 136 | if($choix_niv2 != ZenitySetup::$menu_enregistrement_entrees[5]) // cas: tous les cas sauf presta non vendue | ||
| 137 | { | ||
| 138 | if($answers == '') // annulation | ||
| 139 | { | ||
| 140 | echo "debug: annulation lors de l'enregistrement des détails de la prestation\n"; | ||
| 141 | return [0, null]; | ||
| 142 | } | ||
| 143 | elseif(isset($PrestaDetails) && !$PrestaDetails->hydrateFromForm($answers, $Presta)) // echec de l'hydratation | ||
| 144 | { | ||
| 145 | echo "debug: erreur de hydrateFromForm()\n"; // messages d'erreur à mettre ici ou dans hydrateFromForm()? | ||
| 146 | return [0, null]; | ||
| 147 | } | ||
| 148 | } | ||
| 145 | 149 | ||
| 150 | // mise à jour base de données | ||
| 146 | $Presta->create(); | 151 | $Presta->create(); |
| 147 | $Presta->setID(); // sans paramètre, exécute un $this->db->lastInsertId() | 152 | $Presta->setID(); // sans paramètre, exécute un $this->db->lastInsertId() |
| 148 | 153 | ||
| 149 | if(isset($PrestaDetails)) // presta non vendue | 154 | if(isset($PrestaDetails)) // presta vendue |
| 150 | { | 155 | { |
| 151 | $PrestaDetails->setIDPresta($Presta->getID()); // d'un objet à l'autre | 156 | $PrestaDetails->setIDPresta($Presta->getID()); // d'un objet à l'autre |
| 152 | $PrestaDetails->create(); | 157 | $PrestaDetails->create(); |
| @@ -210,18 +215,19 @@ function newService($Client): array // $Client est un Client ou null | |||
| 210 | //~ $imprimer_facture = exec('zenity --question --width=250 --title="Base de données mise à jour" --text="Imprimer la facture?"'); | 215 | //~ $imprimer_facture = exec('zenity --question --width=250 --title="Base de données mise à jour" --text="Imprimer la facture?"'); |
| 211 | //~ $imprimer_enveloppe = exec('zenity --question --width=250 --title="Base de données mise à jour" --text="Imprimer l\'adresse sur une enveloppe? (insérer une enveloppe DL sans fenêtre dans l\'imprimante"'); | 216 | //~ $imprimer_enveloppe = exec('zenity --question --width=250 --title="Base de données mise à jour" --text="Imprimer l\'adresse sur une enveloppe? (insérer une enveloppe DL sans fenêtre dans l\'imprimante"'); |
| 212 | 217 | ||
| 218 | // ? modifications avec le menu de la section 3 obtenu avec makeModifyCustomerWindow() | ||
| 213 | 219 | ||
| 214 | // -- partie 5: on fait quoi maintenant -- | 220 | // -- partie 5: on fait quoi maintenant -- |
| 215 | $choix_niv2 = exec($FinSection2->get()); | 221 | $choix_niv2 = exec($FinSection2->get()); |
| 216 | if($choix_niv2 === ZenitySetup::$fin_section_2_entrees[0]) | 222 | if($choix_niv2 === ZenitySetup::$fin_section_2['entrees'][0]) // afficher le document |
| 217 | { | 223 | { |
| 218 | return [4, null]; // section 4: getDocument() | 224 | return [4, null]; // section 4: getDocument() |
| 219 | } | 225 | } |
| 220 | elseif($choix_niv2 === ZenitySetup::$fin_section_2_entrees[1]) | 226 | elseif($choix_niv2 === ZenitySetup::$fin_section_2['entrees'][1]) // modifier les informations |
| 221 | { | 227 | { |
| 222 | return [3, $Client]; // section 3: modifyData() | 228 | return [3, $Client]; // section 3: modifyData() |
| 223 | } | 229 | } |
| 224 | elseif($choix_niv2 === ZenitySetup::$fin_section_2_entrees[2]) | 230 | elseif($choix_niv2 === ZenitySetup::$fin_section_2['entrees'][2]) // enregistrer une autre prestation |
| 225 | { | 231 | { |
| 226 | return [2, null]; // relancer section 2: newService() | 232 | return [2, null]; // relancer section 2: newService() |
| 227 | } | 233 | } |
diff --git a/src/sections/3-1_windows.php b/src/sections/3-1_windows.php index 7952f6d..7e7367b 100644 --- a/src/sections/3-1_windows.php +++ b/src/sections/3-1_windows.php | |||
| @@ -55,7 +55,7 @@ function makeModifyServiceWindow(Prestations $Service, $ServiceDetails = null): | |||
| 55 | 55 | ||
| 56 | if($Service->getTypePresta() === 'devis') | 56 | if($Service->getTypePresta() === 'devis') |
| 57 | { | 57 | { |
| 58 | $entrees[$i][] = ZenitySetup::$modification_presta['devis_facture']; // option changer le devis en facture | 58 | $entrees[$i][] = ZenitySetup::$modification_presta['devis_facture']; // option créer une facture à partir du devis |
| 59 | $entrees[$i][] = ''; | 59 | $entrees[$i][] = ''; |
| 60 | //~ $i++; | 60 | //~ $i++; |
| 61 | } | 61 | } |
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); |
