summaryrefslogtreecommitdiff
path: root/src/sections
diff options
context:
space:
mode:
authorpolo <ordipolo@gmx.fr>2026-10-17 23:47:31 +0200
committerpolo <ordipolo@gmx.fr>2026-10-17 23:47:45 +0200
commit32843e50aa981f190bdb4fbc9adbeacc06fdf775 (patch)
treea24ca45e170a69546a251f284dc1ebc578d14be8 /src/sections
parent93c5a89a7a4ff7e7e3d83fd6799df96b7da4283a (diff)
downloadAppliGestionPHP-32843e50aa981f190bdb4fbc9adbeacc06fdf775.tar.gz
AppliGestionPHP-32843e50aa981f190bdb4fbc9adbeacc06fdf775.tar.bz2
AppliGestionPHP-32843e50aa981f190bdb4fbc9adbeacc06fdf775.zip
retypage date prestations en string 3, classe Dates supprimée
Diffstat (limited to 'src/sections')
-rw-r--r--src/sections/2_service.php10
-rw-r--r--src/sections/3_modify_data.php44
2 files changed, 26 insertions, 28 deletions
diff --git a/src/sections/2_service.php b/src/sections/2_service.php
index 9269503..4dccdb9 100644
--- a/src/sections/2_service.php
+++ b/src/sections/2_service.php
@@ -46,17 +46,15 @@ function newService(?Client $Client = null): array
46 } 46 }
47 47
48 // calendrier - étape 1/3 48 // calendrier - étape 1/3
49 $Date = new Dates(exec($Calendrier->get())); // exec() renvoie soit une chaîne soit un false 49 $date_array = explode('/', exec($Calendrier->get())); // 17/10/2026
50 if($Date->getDate() == '') // on n'a pas cliqué sur "annuler" 50 if(count($date_array) === 1){
51 {
52 echo "debug: annulation à la saisie d'une date\n"; 51 echo "debug: annulation à la saisie d'une date\n";
53 return [0, null]; // menu principal 52 return [2, $Client];
54 } 53 }
55 54
56 $Presta = new Prestation($Client); 55 $Presta = new Prestation($Client);
57 //var_dump($Client);die; 56 //var_dump($Client);die;
58 //$Presta->setDate($Date->getTimestamp()); 57 $Presta->setDate($date_array[2] . '-' . $date_array[1] . '-' . $date_array[0]); // 2026-10-17
59 $Presta->setDate($Date); // envoi d'un objet, la BDD gardera le timestamp
60 58
61 // formulaire - étape 2/3 59 // formulaire - étape 2/3
62 switch($choix_niv2) 60 switch($choix_niv2)
diff --git a/src/sections/3_modify_data.php b/src/sections/3_modify_data.php
index 607638b..af40ebd 100644
--- a/src/sections/3_modify_data.php
+++ b/src/sections/3_modify_data.php
@@ -100,8 +100,8 @@ function modifyData(?Client $Client = null): array
100 return [3, $Client]; // menu précédent 100 return [3, $Client]; // menu précédent
101 } 101 }
102 $type_presta = $Presta->getTypePresta(); 102 $type_presta = $Presta->getTypePresta();
103 switch($type_presta) 103 $classe = '';
104 { 104 switch($type_presta){
105 case 'facture': 105 case 'facture':
106 $classe = 'Facture'; 106 $classe = 'Facture';
107 break; 107 break;
@@ -117,6 +117,8 @@ function modifyData(?Client $Client = null): array
117 case 'non_vendue': 117 case 'non_vendue':
118 $PrestaDetails = null; 118 $PrestaDetails = null;
119 break; 119 break;
120 default:
121 echo "erreur: type de prestation buggué\n";
120 } 122 }
121 if($type_presta != 'non_vendue') 123 if($type_presta != 'non_vendue')
122 { 124 {
@@ -134,29 +136,27 @@ function modifyData(?Client $Client = null): array
134 136
135 if($choix_niv3 === 'Date:') 137 if($choix_niv3 === 'Date:')
136 { 138 {
137 $Date = new Dates(exec($Calendrier->get())); // exec() renvoie soit une chaîne soit un false 139 $date_array = explode('/', exec($Calendrier->get())); // 17/10/2026
138 if($Date->getDate() == '') // clic sur "annuler", touche "échap" 140 if(count($date_array) === 1){
139 {
140 echo "debug: annulation à la saisie d'une date\n"; 141 echo "debug: annulation à la saisie d'une date\n";
142 return [3, $Client];
141 } 143 }
142 else 144
145 // entités et BDD
146 $Presta->set($choix_niv3, $date_array[2] . '-' . $date_array[1] . '-' . $date_array[0]); // 2026-10-09
147 $old_code = $Presta->getCodePresta();
148 $Presta->setCodePresta(0);
149 $Presta::$entityManager->flush();
150
151 // documents
152 if($type_presta === 'devis' || $type_presta === 'facture' || $type_presta === 'location')
143 { 153 {
144 // entités et BDD 154 $DocumentPresta = Latex::makeInstance($Presta->getTypePresta()); // $type = facture, devis, location
145 $Presta->set($choix_niv3, $Date); 155 $DocumentPresta->setData($Client)->setData($Presta)->setData($PrestaDetails);
146 $old_code = $Presta->getCodePresta(); 156 $DocumentPresta->makeLatex(); // en mémoire
147 $Presta->setCodePresta(0);
148 $Presta::$entityManager->flush();
149 157
150 // documents 158 renameFiles($DocumentPresta, $old_code, $Presta->getCodePresta());
151 if($type_presta === 'devis' || $type_presta === 'facture' || $type_presta === 'location') 159 makeTexAndPdf($DocumentPresta); // une nouvelle facture est créée, supprimer l'ancienne ou la renommer avec la nouvelle date
152 {
153 $DocumentPresta = Latex::makeInstance($Presta->getTypePresta()); // $type = facture, devis, location
154 $DocumentPresta->setData($Client)->setData($Presta)->setData($PrestaDetails);
155 $DocumentPresta->makeLatex(); // en mémoire
156
157 renameFiles($DocumentPresta, $old_code, $Presta->getCodePresta());
158 makeTexAndPdf($DocumentPresta); // une nouvelle facture est créée, supprimer l'ancienne ou la renommer avec la nouvelle date
159 }
160 } 160 }
161 161
162 return [3, $Client]; // menu précédent 162 return [3, $Client]; // menu précédent
@@ -191,7 +191,7 @@ function modifyData(?Client $Client = null): array
191 if($type_presta === 'devis' || $type_presta === 'facture' || $type_presta === 'location') 191 if($type_presta === 'devis' || $type_presta === 'facture' || $type_presta === 'location')
192 { 192 {
193 $DocumentPresta = Latex::makeInstance($type_presta); 193 $DocumentPresta = Latex::makeInstance($type_presta);
194 $DocumentPresta->setData($Client)->setData($Presta)->setData($PrestaDetails); 194 $DocumentPresta->setData($Client)->setData($Presta)->setData($PrestaDetails); // polymorphisme
195 $DocumentPresta->makeLatex(); 195 $DocumentPresta->makeLatex();
196 196
197 renameFiles($DocumentPresta, $old_code, $Presta->getCodePresta()); 197 renameFiles($DocumentPresta, $old_code, $Presta->getCodePresta());