From 32843e50aa981f190bdb4fbc9adbeacc06fdf775 Mon Sep 17 00:00:00 2001 From: polo Date: Sat, 17 Oct 2026 23:47:31 +0200 Subject: =?UTF-8?q?retypage=20date=20prestations=20en=20string=203,=20clas?= =?UTF-8?q?se=20Dates=20supprim=C3=A9e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/sections/3_modify_data.php | 44 +++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'src/sections/3_modify_data.php') 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 return [3, $Client]; // menu précédent } $type_presta = $Presta->getTypePresta(); - switch($type_presta) - { + $classe = ''; + switch($type_presta){ case 'facture': $classe = 'Facture'; break; @@ -117,6 +117,8 @@ function modifyData(?Client $Client = null): array case 'non_vendue': $PrestaDetails = null; break; + default: + echo "erreur: type de prestation buggué\n"; } if($type_presta != 'non_vendue') { @@ -134,29 +136,27 @@ function modifyData(?Client $Client = null): array if($choix_niv3 === 'Date:') { - $Date = new Dates(exec($Calendrier->get())); // exec() renvoie soit une chaîne soit un false - if($Date->getDate() == '') // clic sur "annuler", touche "échap" - { + $date_array = explode('/', exec($Calendrier->get())); // 17/10/2026 + if(count($date_array) === 1){ echo "debug: annulation à la saisie d'une date\n"; + return [3, $Client]; } - else + + // entités et BDD + $Presta->set($choix_niv3, $date_array[2] . '-' . $date_array[1] . '-' . $date_array[0]); // 2026-10-09 + $old_code = $Presta->getCodePresta(); + $Presta->setCodePresta(0); + $Presta::$entityManager->flush(); + + // documents + if($type_presta === 'devis' || $type_presta === 'facture' || $type_presta === 'location') { - // entités et BDD - $Presta->set($choix_niv3, $Date); - $old_code = $Presta->getCodePresta(); - $Presta->setCodePresta(0); - $Presta::$entityManager->flush(); + $DocumentPresta = Latex::makeInstance($Presta->getTypePresta()); // $type = facture, devis, location + $DocumentPresta->setData($Client)->setData($Presta)->setData($PrestaDetails); + $DocumentPresta->makeLatex(); // en mémoire - // documents - if($type_presta === 'devis' || $type_presta === 'facture' || $type_presta === 'location') - { - $DocumentPresta = Latex::makeInstance($Presta->getTypePresta()); // $type = facture, devis, location - $DocumentPresta->setData($Client)->setData($Presta)->setData($PrestaDetails); - $DocumentPresta->makeLatex(); // en mémoire - - renameFiles($DocumentPresta, $old_code, $Presta->getCodePresta()); - makeTexAndPdf($DocumentPresta); // une nouvelle facture est créée, supprimer l'ancienne ou la renommer avec la nouvelle date - } + renameFiles($DocumentPresta, $old_code, $Presta->getCodePresta()); + makeTexAndPdf($DocumentPresta); // une nouvelle facture est créée, supprimer l'ancienne ou la renommer avec la nouvelle date } return [3, $Client]; // menu précédent @@ -191,7 +191,7 @@ function modifyData(?Client $Client = null): array if($type_presta === 'devis' || $type_presta === 'facture' || $type_presta === 'location') { $DocumentPresta = Latex::makeInstance($type_presta); - $DocumentPresta->setData($Client)->setData($Presta)->setData($PrestaDetails); + $DocumentPresta->setData($Client)->setData($Presta)->setData($PrestaDetails); // polymorphisme $DocumentPresta->makeLatex(); renameFiles($DocumentPresta, $old_code, $Presta->getCodePresta()); -- cgit v1.2.3