diff options
author | polo <ordipolo@gmx.fr> | 2023-09-03 02:45:17 +0200 |
---|---|---|
committer | polo <ordipolo@gmx.fr> | 2023-09-03 02:45:17 +0200 |
commit | 78439b6a178e238ab8fb73d25567a85df78d6681 (patch) | |
tree | 219181bc81bff750d9ec3a44c5ccb2a3028694e4 | |
parent | 45262760a7d575a9d612cc2056e66bf105e43df8 (diff) | |
download | AppliGestionPHP-78439b6a178e238ab8fb73d25567a85df78d6681.zip |
section 3 prestas non vendues
-rw-r--r-- | data/dev.sqlite | bin | 36864 -> 36864 bytes | |||
-rw-r--r-- | src/model/Model.php | 4 | ||||
-rw-r--r-- | src/model/Prestations.php | 2 | ||||
-rw-r--r-- | src/sections/3_modify_data.php | 48 | ||||
-rw-r--r-- | src/view/ZenitySetup.php | 8 |
5 files changed, 39 insertions, 23 deletions
diff --git a/data/dev.sqlite b/data/dev.sqlite index 6d55fd5..3762c69 100644 --- a/data/dev.sqlite +++ b/data/dev.sqlite | |||
Binary files differ | |||
diff --git a/src/model/Model.php b/src/model/Model.php index 4c4a80c..07826af 100644 --- a/src/model/Model.php +++ b/src/model/Model.php | |||
@@ -183,7 +183,7 @@ abstract class Model extends DB | |||
183 | return($this->execQuery('SELECT * FROM ' . $this->table)->fetchAll()); // fonctionne aussi sans le point virgule dans le SQL!! | 183 | return($this->execQuery('SELECT * FROM ' . $this->table)->fetchAll()); // fonctionne aussi sans le point virgule dans le SQL!! |
184 | } | 184 | } |
185 | 185 | ||
186 | public function findById() // obtenir une entrée avec son ID | 186 | public function findById() // obtenir une entrée grace à son ID |
187 | { | 187 | { |
188 | return($this->execQuery('SELECT * FROM ' . $this->table . ' WHERE id = ' . $this->ID)->fetch()); | 188 | return($this->execQuery('SELECT * FROM ' . $this->table . ' WHERE id = ' . $this->ID)->fetch()); |
189 | } | 189 | } |
@@ -191,7 +191,7 @@ abstract class Model extends DB | |||
191 | { | 191 | { |
192 | if($this->table == 'prestations') | 192 | if($this->table == 'prestations') |
193 | { | 193 | { |
194 | // à l'occaz, rendre abstraite la classe Prestations | 194 | // à l'occaz, créer une classe NonVendue et rendre Prestations abstraite |
195 | echo 'erreur: ne pas appeler Model::getDetailsByIdPresta() si la table ciblée est "prestations".'; | 195 | echo 'erreur: ne pas appeler Model::getDetailsByIdPresta() si la table ciblée est "prestations".'; |
196 | return 0; | 196 | return 0; |
197 | } | 197 | } |
diff --git a/src/model/Prestations.php b/src/model/Prestations.php index e9ba7a1..54ad4b7 100644 --- a/src/model/Prestations.php +++ b/src/model/Prestations.php | |||
@@ -59,7 +59,7 @@ class Prestations extends Model | |||
59 | "Numéro prestation:" => end($code_presta_tableau), // dernière case | 59 | "Numéro prestation:" => end($code_presta_tableau), // dernière case |
60 | "Date:" => $Date->getDate(), | 60 | "Date:" => $Date->getDate(), |
61 | //"Type de Presta:" => $this->type_presta, // choix impossible pour le moment | 61 | //"Type de Presta:" => $this->type_presta, // choix impossible pour le moment |
62 | "Mode de paiement:" => $this->mode_paiement, | 62 | "Mode de paiement:" => $this->mode_paiement, // non pertinent pour un devis |
63 | "Commentaires:" => $this->commentaires]; | 63 | "Commentaires:" => $this->commentaires]; |
64 | } | 64 | } |
65 | public function set(string $entry, string $input) | 65 | public function set(string $entry, string $input) |
diff --git a/src/sections/3_modify_data.php b/src/sections/3_modify_data.php index 1f48870..5da7ed9 100644 --- a/src/sections/3_modify_data.php +++ b/src/sections/3_modify_data.php | |||
@@ -88,7 +88,9 @@ function modifyData($Client): array | |||
88 | echo "debug: annulation sélection client\n"; | 88 | echo "debug: annulation sélection client\n"; |
89 | return [3, $Client]; // menu précédent | 89 | return [3, $Client]; // menu précédent |
90 | } | 90 | } |
91 | switch($Presta->getTypePresta()) | 91 | |
92 | $type = $Presta->getTypePresta(); | ||
93 | switch($type) | ||
92 | { | 94 | { |
93 | case 'facture': | 95 | case 'facture': |
94 | $PrestaDetails = new DevisFactures('factures'); | 96 | $PrestaDetails = new DevisFactures('factures'); |
@@ -103,16 +105,21 @@ function modifyData($Client): array | |||
103 | case 'location': | 105 | case 'location': |
104 | $PrestaDetails = new Locations(); | 106 | $PrestaDetails = new Locations(); |
105 | break; | 107 | break; |
108 | case 'non_vendue': | ||
109 | $PrestaDetails = null; | ||
110 | break; | ||
111 | } | ||
112 | if($type != 'non_vendue') | ||
113 | { | ||
114 | $PrestaDetails->setIDPresta($Presta->getID()); | ||
115 | $PrestaDetails->hydrate($PrestaDetails->getDetailsByIdPresta()); | ||
106 | } | 116 | } |
107 | $PrestaDetails->setIDPresta($Presta->getID()); | ||
108 | $PrestaDetails->hydrate($PrestaDetails->getDetailsByIdPresta()); | ||
109 | 117 | ||
110 | 118 | ||
111 | // -- partie 4: modifier une prestation -- | 119 | // -- partie 4: modifier une prestation -- |
112 | 120 | ||
113 | // fenêtre | 121 | // fenêtre |
114 | $ModificationPrestaMenu = makeModifyServiceWindow($Presta, $PrestaDetails); | 122 | $ModificationPrestaMenu = makeModifyServiceWindow($Presta, $PrestaDetails); |
115 | $Calendrier = new ZenityCalendar(ZenitySetup::$calendar['section3']); | ||
116 | 123 | ||
117 | $choix_niv3 = exec($ModificationPrestaMenu->get()); | 124 | $choix_niv3 = exec($ModificationPrestaMenu->get()); |
118 | if($choix_niv3 === ZenitySetup::$modification_presta['devis_facture']) // devis -> facture | 125 | if($choix_niv3 === ZenitySetup::$modification_presta['devis_facture']) // devis -> facture |
@@ -122,11 +129,13 @@ function modifyData($Client): array | |||
122 | } | 129 | } |
123 | elseif($choix_niv3 === 'Date:') | 130 | elseif($choix_niv3 === 'Date:') |
124 | { | 131 | { |
132 | // fenêtre | ||
133 | $Calendrier = new ZenityCalendar(ZenitySetup::$calendar['section3']); | ||
134 | |||
125 | $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 |
126 | if($Date->getDate() == '') // on n'a pas cliqué sur "annuler" | 136 | if($Date->getDate() == '') // clic sur "annuler", touche "échap" |
127 | { | 137 | { |
128 | echo "debug: annulation à la saisie d'une date\n"; | 138 | echo "debug: annulation à la saisie d'une date\n"; |
129 | //return [3, $Client]; // menu principal | ||
130 | } | 139 | } |
131 | else | 140 | else |
132 | { | 141 | { |
@@ -135,10 +144,13 @@ function modifyData($Client): array | |||
135 | $Presta->update(); | 144 | $Presta->update(); |
136 | 145 | ||
137 | // mettre à jour les documents | 146 | // mettre à jour les documents |
138 | $DocumentPresta = Latex::makeInstance($Presta->getTypePresta()); // $type = facture, devis, location | 147 | if($type === 'devis' || $type === 'facture' || $type === 'location') |
139 | $DocumentPresta->setData($Client)->setData($Presta)->setData($PrestaDetails); | 148 | { |
140 | $DocumentPresta->makeLatex(); | 149 | $DocumentPresta = Latex::makeInstance($Presta->getTypePresta()); // $type = facture, devis, location |
141 | makeTexAndPdf($DocumentPresta); | 150 | $DocumentPresta->setData($Client)->setData($Presta)->setData($PrestaDetails); |
151 | $DocumentPresta->makeLatex(); | ||
152 | makeTexAndPdf($DocumentPresta); | ||
153 | } | ||
142 | } | 154 | } |
143 | 155 | ||
144 | return [3, $Client]; // menu précédent | 156 | return [3, $Client]; // menu précédent |
@@ -156,17 +168,21 @@ function modifyData($Client): array | |||
156 | //if(is_string($input) && $input != '') | 168 | //if(is_string($input) && $input != '') |
157 | if(is_string($input)) // chaine vide autorisée | 169 | if(is_string($input)) // chaine vide autorisée |
158 | { | 170 | { |
159 | $Presta->set($choix_niv3, $input); | ||
160 | $PrestaDetails->set($choix_niv3, $input); | ||
161 | |||
162 | // mettre à jour la base de données | 171 | // mettre à jour la base de données |
172 | $Presta->set($choix_niv3, $input); | ||
163 | $Presta->update(); | 173 | $Presta->update(); |
164 | $PrestaDetails->update(); | 174 | |
175 | if($type != 'non_vendue') | ||
176 | { | ||
177 | $PrestaDetails->set($choix_niv3, $input); | ||
178 | $PrestaDetails->update(); | ||
179 | } | ||
165 | 180 | ||
166 | // mettre à jour les documents | 181 | // mettre à jour les documents |
167 | if($Presta->getTypePresta() === 'devis' || $Presta->getTypePresta() === 'facture' || $Presta->getTypePresta() === 'location') | 182 | //$type = $Presta->getTypePresta(); |
183 | if($type === 'devis' || $type === 'facture' || $type === 'location') | ||
168 | { | 184 | { |
169 | $DocumentPresta = Latex::makeInstance($Presta->getTypePresta()); // $type = facture, devis, location | 185 | $DocumentPresta = Latex::makeInstance($type); |
170 | $DocumentPresta->setData($Client)->setData($Presta)->setData($PrestaDetails); | 186 | $DocumentPresta->setData($Client)->setData($Presta)->setData($PrestaDetails); |
171 | $DocumentPresta->makeLatex(); | 187 | $DocumentPresta->makeLatex(); |
172 | makeTexAndPdf($DocumentPresta); | 188 | makeTexAndPdf($DocumentPresta); |
diff --git a/src/view/ZenitySetup.php b/src/view/ZenitySetup.php index cf3ed11..d2b5796 100644 --- a/src/view/ZenitySetup.php +++ b/src/view/ZenitySetup.php | |||
@@ -33,10 +33,10 @@ class ZenitySetup | |||
33 | 'section3' => 'Choisir une nouvelle date']; | 33 | 'section3' => 'Choisir une nouvelle date']; |
34 | 34 | ||
35 | static public $formulaire_text = 'Nouvelle prestation 2/3 - Détail des travaux'; | 35 | static public $formulaire_text = 'Nouvelle prestation 2/3 - Détail des travaux'; |
36 | static public $formulaire_devis_entrees = ["Tâches effectuées:", "Total main d\'oeuvre (euros):", "Détail des pièces:", "Total pièces (euros):", "Déplacement (euros)", "Total HT (euros):", "Delai de livraison", "Durée de validite du devis:"]; | 36 | static public $formulaire_devis_entrees = ["Tâches effectuées:", "Total main d\'oeuvre (euros):", "Détail des pièces:", "Total pièces (euros):", "Déplacement (euros):", "Total HT (euros):", "Delai de livraison", "Durée de validite du devis:"]; |
37 | static public $formulaire_facture_entrees = ["Tâches effectuées:", "Modèle du PC:", "OS:", "Données sauvegardées:", "Clés d\'activation:", "Total main d\'oeuvre (euros):", "Détail des pièces:", "Total pièces (euros):", "Déplacement (euros)", "Total HT (euros):", "Mode de paiement"]; | 37 | static public $formulaire_facture_entrees = ["Tâches effectuées:", "Modèle du PC:", "OS:", "Données sauvegardées:", "Clés d\'activation:", "Total main d\'oeuvre (euros):", "Détail des pièces:", "Total pièces (euros):", "Déplacement (euros)", "Total HT (euros):", "Mode de paiement:"]; |
38 | static public $formulaire_cesu_entrees = ["Tâches effectuées:", "Duree de travail:", "Salaire net", "Mode de paiement"]; // en fait je pourrais ajouter plein d'autres trucs | 38 | static public $formulaire_cesu_entrees = ["Tâches effectuées:", "Duree de travail:", "Salaire net:", "Mode de paiement:"]; // en fait je pourrais ajouter plein d'autres trucs |
39 | static public $formulaire_location_entrees = ["Désignation du bien", "Modèle, numéro de série, description:", "Valeur", "État des lieux du début:", "État des lieux de fin:", "Durée de la location en mois:", "Loyer mensuel:", "Nombre de loyers déjà payés:", "Montant du chèque de caution:"]; | 39 | static public $formulaire_location_entrees = ["Désignation du bien:", "Modèle, numéro de série, description:", "Valeur:", "État des lieux du début:", "État des lieux de fin:", "Durée de la location en mois:", "Loyer mensuel:", "Nombre de loyers déjà payés:", "Montant du chèque de caution:"]; |
40 | static public $commentaire_prestation_text = 'Nouvelle prestation 3/3 - Commentaires'; | 40 | static public $commentaire_prestation_text = 'Nouvelle prestation 3/3 - Commentaires'; |
41 | 41 | ||
42 | static public $modification_client = ['text' => 'Modifier une information concernant un client', | 42 | static public $modification_client = ['text' => 'Modifier une information concernant un client', |