From 45262760a7d575a9d612cc2056e66bf105e43df8 Mon Sep 17 00:00:00 2001 From: polo Date: Sat, 2 Sep 2023 11:03:16 +0200 Subject: section 3 ok (manque les prestas non-vendues) --- data/dev.sqlite | Bin 36864 -> 36864 bytes src/model/CESU.php | 16 +++++++++++++++- src/model/DevisFactures.php | 16 ++++++++-------- src/model/Locations.php | 40 ++++++++++++++++++++++++++++++++++++---- src/sections/3_modify_data.php | 14 +++++++++----- 5 files changed, 68 insertions(+), 18 deletions(-) diff --git a/data/dev.sqlite b/data/dev.sqlite index 07c5233..6d55fd5 100644 Binary files a/data/dev.sqlite and b/data/dev.sqlite differ diff --git a/src/model/CESU.php b/src/model/CESU.php index a8aa1e8..f6c6630 100644 --- a/src/model/CESU.php +++ b/src/model/CESU.php @@ -20,11 +20,25 @@ class CESU extends Model public function getAllWithWindowFields(): array // différent de Model::getAll() qui retourne get_object_vars($this) { return [ - "Numéro CESU:" => $this->ID, "Tâche effectuée:" => $this->taches, "Durée du travail:" => $this->duree_travail, "Salaire:" => $this->salaire]; } + public function set(string $entry, string $input) + { + switch($entry) + { + case "Tâche effectuée:": + $this->setTaches($input); + break; + case "Durée du travail:": + $this->setDureeTravail($input); + break; + case "Salaire:": + $this->setSalaire($input); + break; + } + } // setters public function setIDPresta(int $value) diff --git a/src/model/DevisFactures.php b/src/model/DevisFactures.php index 2a5bf8d..259690b 100644 --- a/src/model/DevisFactures.php +++ b/src/model/DevisFactures.php @@ -31,10 +31,10 @@ class DevisFactures extends Model $taches = ["Tâches:" => $this->taches]; $champs_communs = [ "Total Main d'oeuvre:" => $this->total_main_d_oeuvre, - "Pièces" => $this->pieces, - "Total des pièces" => $this->total_pieces, - "Déplacement" => $this->deplacement, - "Total HT" => $this->total_HT]; + "Pièces:" => $this->pieces, + "Total des pièces:" => $this->total_pieces, + "Déplacement:" => $this->deplacement, + "Total HT:" => $this->total_HT]; if($this->table === 'factures') { @@ -49,9 +49,9 @@ class DevisFactures extends Model elseif($this->table === 'devis') { $champs_devis = [ - "Delai de livraison" => $this->delai_livraison, - "Durée de validité" => $this->validite_devis, - "Devis signé?" => $this->signature_devis]; + "Delai de livraison:" => $this->delai_livraison, + "Durée de validité:" => $this->validite_devis, + "Devis signé:" => $this->signature_devis]; return $champs_communs + $champs_devis; } @@ -100,7 +100,7 @@ class DevisFactures extends Model case "Durée de validité:": $this->setValiditedevis($input); break; - case "Devis signé?:": + case "Devis signé:": $this->setSignatureDevis($input); break; } diff --git a/src/model/Locations.php b/src/model/Locations.php index e3c9507..ead2727 100644 --- a/src/model/Locations.php +++ b/src/model/Locations.php @@ -24,16 +24,48 @@ class Locations extends Model public function getAllWithWindowFields(): array // différent de Model::getAll() qui retourne get_object_vars($this) { return [ - "Numéro location:" => $this->ID, "Désignation:" => $this->designation, "Description du modèle:" => $this->modele_description, "Valeur:" => $this->valeur, "État des lieux de début:" => $this->etat_des_lieux_debut, "État des lieux de fin:" => $this->etat_des_lieux_fin, "Durée de la location:" => $this->duree_location, - "Loyer Mensuel" => $this->loyer_mensuel, - "Loyers Payés" => $this->loyers_payes, - "Caution" => $this->caution]; + "Loyer Mensuel:" => $this->loyer_mensuel, + "Loyers Payés:" => $this->loyers_payes, + "Caution:" => $this->caution]; + } + public function set(string $entry, string $input) + { + switch($entry) + { + case "Désignation:": + $this->setDesignation($input); + break; + case "Description du modèle:": + $this->setModeleDescription($input); + break; + case "Valeur:": + $this->setValeur($input); + break; + case "État des lieux de début:": + $this->setEtatDesLieuxDebut($input); + break; + case "État des lieux de fin:": + $this->setEtatDesLieuxFin($input); + break; + case "Durée de la location:": + $this->setDureeLocation($input); + break; + case "Loyer Mensuel:": + $this->setLoyerMensuel($input); + break; + case "Loyers Payés:": + $this->setLoyersPayes($input); + break; + case "Caution:": + $this->setCaution($input); + break; + } } // setters diff --git a/src/sections/3_modify_data.php b/src/sections/3_modify_data.php index 71b977a..1f48870 100644 --- a/src/sections/3_modify_data.php +++ b/src/sections/3_modify_data.php @@ -153,7 +153,8 @@ function modifyData($Client): array echo "choix: modifier" . $choix_niv3 . "\n"; $ModificationPrestaForm = new ZenityEntry($choix_niv3); $input = exec($ModificationPrestaForm->get()); - if(is_string($input) && $input != '') + //if(is_string($input) && $input != '') + if(is_string($input)) // chaine vide autorisée { $Presta->set($choix_niv3, $input); $PrestaDetails->set($choix_niv3, $input); @@ -163,10 +164,13 @@ function modifyData($Client): array $PrestaDetails->update(); // mettre à jour les documents - $DocumentPresta = Latex::makeInstance($Presta->getTypePresta()); // $type = facture, devis, location - $DocumentPresta->setData($Client)->setData($Presta)->setData($PrestaDetails); - $DocumentPresta->makeLatex(); - makeTexAndPdf($DocumentPresta); + if($Presta->getTypePresta() === 'devis' || $Presta->getTypePresta() === 'facture' || $Presta->getTypePresta() === 'location') + { + $DocumentPresta = Latex::makeInstance($Presta->getTypePresta()); // $type = facture, devis, location + $DocumentPresta->setData($Client)->setData($Presta)->setData($PrestaDetails); + $DocumentPresta->makeLatex(); + makeTexAndPdf($DocumentPresta); + } } else { -- cgit v1.2.3