diff options
author | polo <ordipolo@gmx.fr> | 2023-02-25 17:30:20 +0100 |
---|---|---|
committer | polo <ordipolo@gmx.fr> | 2023-02-25 17:30:20 +0100 |
commit | b9c74de6d12ef40ab4baf67303ab22a10fcd5b32 (patch) | |
tree | dea294f55810471ca2165811515dcd3c8d0e006e | |
parent | 9d8133643773912d54fb0c7d86ef04e6acffa8c9 (diff) | |
download | AppliGestionPHP-b9c74de6d12ef40ab4baf67303ab22a10fcd5b32.zip |
document locations, correction de pas mal de problèmes
-rw-r--r-- | data/dev.sqlite | bin | 36864 -> 36864 bytes | |||
-rw-r--r-- | src/functions.php | 9 | ||||
-rw-r--r-- | src/latex_templates/devis.php | 21 | ||||
-rw-r--r-- | src/latex_templates/enveloppe_verso.php | 7 | ||||
-rw-r--r-- | src/latex_templates/facture.php | 19 | ||||
-rw-r--r-- | src/latex_templates/location.php | 38 | ||||
-rw-r--r-- | src/latex_templates/originaux_pas_toucher/devis.tex | 2 | ||||
-rw-r--r-- | src/latex_templates/originaux_pas_toucher/location.tex | 44 | ||||
-rw-r--r-- | src/model/Locations.php | 5 | ||||
-rw-r--r-- | src/model/Model.php | 6 | ||||
-rw-r--r-- | src/model/Prestations.php | 2 | ||||
-rw-r--r-- | src/model/StructTablesDB.php | 2 | ||||
-rw-r--r-- | src/sections/1_new_service.php | 42 |
13 files changed, 136 insertions, 61 deletions
diff --git a/data/dev.sqlite b/data/dev.sqlite index f74d69d..337e5da 100644 --- a/data/dev.sqlite +++ b/data/dev.sqlite | |||
Binary files differ | |||
diff --git a/src/functions.php b/src/functions.php index 89bfbc9..bd91ddf 100644 --- a/src/functions.php +++ b/src/functions.php | |||
@@ -59,12 +59,7 @@ function makeLatexAndPdfDocument($documentType, Clients $Client = null, Prestati | |||
59 | 59 | ||
60 | if($Client == null) // verso d'une enveloppe | 60 | if($Client == null) // verso d'une enveloppe |
61 | { | 61 | { |
62 | $data[0] = Config::$business_guy; | 62 | $latex = makeLatex($documentType); // pas de données transmises, elles sont dans la classe Config |
63 | $data[1] = Config::$business_address; | ||
64 | $data[2] = implode(str_split(Config::$business_postcode)); | ||
65 | $data[3] = Config::$business_city; | ||
66 | |||
67 | $latex = makeLatex($documentType, $data); // injection des variables | ||
68 | $file_name = 'enveloppe_verso'; | 63 | $file_name = 'enveloppe_verso'; |
69 | } | 64 | } |
70 | else | 65 | else |
@@ -106,7 +101,7 @@ function makeLatexAndPdfDocument($documentType, Clients $Client = null, Prestati | |||
106 | latexToPdf($latex_path, $file_name, $pdf_path); | 101 | latexToPdf($latex_path, $file_name, $pdf_path); |
107 | } | 102 | } |
108 | 103 | ||
109 | function makeLatex(string $documentType, array $data, Dates $Date = null) | 104 | function makeLatex(string $documentType, array $data = [], Dates $Date = null) |
110 | { | 105 | { |
111 | $date = ''; | 106 | $date = ''; |
112 | if($Date != null) | 107 | if($Date != null) |
diff --git a/src/latex_templates/devis.php b/src/latex_templates/devis.php index bd9c89d..7f1c8f7 100644 --- a/src/latex_templates/devis.php +++ b/src/latex_templates/devis.php | |||
@@ -1,6 +1,23 @@ | |||
1 | <?php | 1 | <?php |
2 | // latex_templates/devis.php | 2 | // latex_templates/devis.php |
3 | 3 | ||
4 | if($data['total_main_d_oeuvre'] != 0) | ||
5 | { | ||
6 | $data['total_main_d_oeuvre'] = ((string) $data['total_main_d_oeuvre']) . '€'; | ||
7 | } | ||
8 | if($data['total_pieces'] != 0) | ||
9 | { | ||
10 | $data['total_pieces'] = ((string) $data['total_pieces']) . '€'; | ||
11 | } | ||
12 | if($data['deplacement'] != 0) | ||
13 | { | ||
14 | $data['deplacement'] = ((string) $data['deplacement']) . '€'; | ||
15 | } | ||
16 | if($data['total_HT'] != 0) | ||
17 | { | ||
18 | $data['total_HT'] = ((string) $data['total_HT']) . '€'; | ||
19 | } | ||
20 | |||
4 | ob_start(); | 21 | ob_start(); |
5 | ?> | 22 | ?> |
6 | \documentclass{report} | 23 | \documentclass{report} |
@@ -47,11 +64,11 @@ ob_start(); | |||
47 | \begin{tabularx}{\linewidth}{@{}X@{}@{}X@{}} | 64 | \begin{tabularx}{\linewidth}{@{}X@{}@{}X@{}} |
48 | Mme, M : \textcolor{vert}{<?= $data['prenom_nom'] ?>} & | 65 | Mme, M : \textcolor{vert}{<?= $data['prenom_nom'] ?>} & |
49 | Date du devis : \textcolor{vert}{<?= $date ?>}\\ | 66 | Date du devis : \textcolor{vert}{<?= $date ?>}\\ |
50 | Adresse : \textcolor{vert}{<?= $data['adresse'] ?>} & | 67 | Adresse : \textcolor{vert}{<?php echo($data['adresse'] . ', ' . $data['code_postal'] . ' ' . $data['ville']); ?>} & |
51 | Delai de livraison : \textcolor{vert}{<?= $data['delai_livraison'] ?>}\\ | 68 | Delai de livraison : \textcolor{vert}{<?= $data['delai_livraison'] ?>}\\ |
52 | & | 69 | & |
53 | Durée de validité : \textcolor{vert}{<?= $data['validite_devis'] ?>}\\ | 70 | Durée de validité : \textcolor{vert}{<?= $data['validite_devis'] ?>}\\ |
54 | \end{tabularx}\\\\ | 71 | \end{tabularx}\\ |
55 | 72 | ||
56 | PRESTATION\\ | 73 | PRESTATION\\ |
57 | 74 | ||
diff --git a/src/latex_templates/enveloppe_verso.php b/src/latex_templates/enveloppe_verso.php index 866fd04..81f6271 100644 --- a/src/latex_templates/enveloppe_verso.php +++ b/src/latex_templates/enveloppe_verso.php | |||
@@ -1,11 +1,6 @@ | |||
1 | <?php | 1 | <?php |
2 | // src/latex_templates/enveloppe_verso.php | 2 | // src/latex_templates/enveloppe_verso.php |
3 | 3 | ||
4 | $adresse[0] = 'Paul Jusot'; | ||
5 | $adresse[1] = "2A rue de l'île de Man"; | ||
6 | $adresse[2] = '29000'; | ||
7 | $adresse[3] = 'Quimper'; | ||
8 | |||
9 | ob_start(); | 4 | ob_start(); |
10 | ?> | 5 | ?> |
11 | \documentclass[]{report} | 6 | \documentclass[]{report} |
@@ -19,7 +14,7 @@ ob_start(); | |||
19 | 14 | ||
20 | \begin{document} | 15 | \begin{document} |
21 | \setlength{\parindent}{0cm} | 16 | \setlength{\parindent}{0cm} |
22 | \Large{<?= $data[0] ?>\\<?= $data[1] ?>\\<?= $data[2] ?> <?= $data[3] ?>} | 17 | \Large{<?= Config::$business_guy ?>\\<?= Config::$business_address ?>\\<?= Config::$business_postcode ?> <?= Config::$business_city ?>} |
23 | \end{document} | 18 | \end{document} |
24 | <?php | 19 | <?php |
25 | $latex = ob_get_clean(); | 20 | $latex = ob_get_clean(); |
diff --git a/src/latex_templates/facture.php b/src/latex_templates/facture.php index 2ff4ac6..bbc20ce 100644 --- a/src/latex_templates/facture.php +++ b/src/latex_templates/facture.php | |||
@@ -1,6 +1,23 @@ | |||
1 | <?php | 1 | <?php |
2 | // latex_templates/facture.php | 2 | // latex_templates/facture.php |
3 | 3 | ||
4 | if($data['total_main_d_oeuvre'] != 0) | ||
5 | { | ||
6 | $data['total_main_d_oeuvre'] = ((string) $data['total_main_d_oeuvre']) . '€'; | ||
7 | } | ||
8 | if($data['total_pieces'] != 0) | ||
9 | { | ||
10 | $data['total_pieces'] = ((string) $data['total_pieces']) . '€'; | ||
11 | } | ||
12 | if($data['deplacement'] != 0) | ||
13 | { | ||
14 | $data['deplacement'] = ((string) $data['deplacement']) . '€'; | ||
15 | } | ||
16 | if($data['total_HT'] != 0) | ||
17 | { | ||
18 | $data['total_HT'] = ((string) $data['total_HT']) . '€'; | ||
19 | } | ||
20 | |||
4 | ob_start(); | 21 | ob_start(); |
5 | ?> | 22 | ?> |
6 | \documentclass{report} | 23 | \documentclass{report} |
@@ -47,7 +64,7 @@ ob_start(); | |||
47 | Mme, M : \textcolor{vert}{<?= $data['prenom_nom'] ?>} & | 64 | Mme, M : \textcolor{vert}{<?= $data['prenom_nom'] ?>} & |
48 | Date : \textcolor{vert}{<?= $date ?>}\\ | 65 | Date : \textcolor{vert}{<?= $date ?>}\\ |
49 | \end{tabularx}\\ | 66 | \end{tabularx}\\ |
50 | Adresse : \textcolor{vert}{<?= $data['adresse'] ?>}\\ | 67 | Adresse : \textcolor{vert}{<?php echo($data['adresse'] . ', ' . $data['code_postal'] . ' ' . $data['ville']); ?>}\\ |
51 | 68 | ||
52 | PRESTATION\\ | 69 | PRESTATION\\ |
53 | 70 | ||
diff --git a/src/latex_templates/location.php b/src/latex_templates/location.php index dce7f04..2f7eb52 100644 --- a/src/latex_templates/location.php +++ b/src/latex_templates/location.php | |||
@@ -1,6 +1,15 @@ | |||
1 | <?php | 1 | <?php |
2 | // latex_templates/location.php | 2 | // latex_templates/location.php |
3 | 3 | ||
4 | if($data['valeur'] != 0) | ||
5 | { | ||
6 | $data['valeur'] = ((string) $data['valeur']) . '€'; | ||
7 | } | ||
8 | if($data['loyer_mensuel'] != 0) | ||
9 | { | ||
10 | $data['loyer_mensuel'] = ((string) $data['loyer_mensuel']) . '€'; | ||
11 | } | ||
12 | |||
4 | ob_start(); | 13 | ob_start(); |
5 | ?> | 14 | ?> |
6 | \documentclass{report} | 15 | \documentclass{report} |
@@ -44,40 +53,39 @@ ob_start(); | |||
44 | 53 | ||
45 | PROPRIÉTAIRE\\ | 54 | PROPRIÉTAIRE\\ |
46 | 55 | ||
47 | Mme, M : \textcolor{vert}{Paul Jusot}\\ | 56 | Mme, M : \textcolor{vert}{<?= Config::$business_guy ?>}\\ |
48 | Adresse : \textcolor{vert}{2A, rue de l'île de Man, 29000 Quimper}\\ | 57 | Adresse : \textcolor{vert}{<?php echo(Config::$business_address . ', ' . Config::$business_postcode . ' ' . Config::$business_city) ?>}\\ |
49 | 58 | ||
50 | LOCATAIRE\\ | 59 | LOCATAIRE\\ |
51 | 60 | ||
52 | \begin{tabularx}{\linewidth}{@{}X@{}@{}X@{}} | 61 | \begin{tabularx}{\linewidth}{@{}X@{}@{}X@{}} |
53 | Mme, M : \textcolor{vert}{} & tel : \textcolor{vert}{}\\ | 62 | Mme, M : \textcolor{vert}{<?= $data['prenom_nom'] ?>} & tel : \textcolor{vert}{<?= $data['telephone'] ?>}\\ |
54 | Adresse : \textcolor{vert}{} & courriel : \textcolor{vert}{} | 63 | Adresse : \textcolor{vert}{<?php echo($data['adresse'] . ', ' . $data['code_postal'] . ' ' . $data['ville']); ?>} & courriel : \textcolor{vert}{<?= $data['courriel'] ?>} |
55 | \end{tabularx}\\\\ | 64 | \end{tabularx}\\\\ |
56 | 65 | ||
57 | BIEN LOUÉ\\ | 66 | BIEN LOUÉ\\ |
58 | 67 | ||
59 | Désignation : \textcolor{vert}{}\\ | 68 | Désignation : \textcolor{vert}{<?= $data['designation'] ?>}\\ |
60 | Modèle, description : \textcolor{vert}{}\\ | 69 | Modèle, description : \textcolor{vert}{<?= $data['modele_description'] ?>}\\ |
61 | 70 | Valeur : \textcolor{vert}{<?= $data['valeur'] ?>}\\\\ | |
62 | État des lieux initial : \textcolor{vert}{}\\\\ | 71 | État des lieux initial : \textcolor{vert}{<?= $data['etat_des_lieux_debut'] ?>}\\\\\\ |
63 | 72 | État des lieux final : \textcolor{vert}{<?= $data['etat_des_lieux_fin'] ?>}\\\\ | |
64 | État des lieux final : \textcolor{vert}{}\\\\ | ||
65 | 73 | ||
66 | CLAUSES\\ | 74 | CLAUSES\\ |
67 | 75 | ||
68 | Durée du prêt : \textcolor{vert}{}\\ | 76 | Durée du prêt : \textcolor{vert}{<?= $data['duree_location'] ?>}\\ |
69 | Loyer mensuel : \textcolor{vert}{}\\ | 77 | Loyer mensuel : \textcolor{vert}{<?= $data['loyer_mensuel'] ?>}\\ |
70 | 78 | ||
71 | 79 | ||
72 | \textbf{Le bénéficiaire de cette location s’engage à prendre soin du bien désigné et à en faire un usage strictement personnel.}\\ | 80 | \textbf{Le bénéficiaire de cette location s’engage à prendre soin du bien désigné et à en faire un usage strictement personnel.}\\ |
73 | 81 | ||
74 | \begin{tabularx}{\linewidth}{@{}X@{}@{}X@{}} | 82 | \begin{tabularx}{\linewidth}{@{}X@{}@{}X@{}} |
75 | Fait en deux exemplaires à : \textcolor{vert}{} & le : \textcolor{vert}{} \\ | 83 | Fait en deux exemplaires à : \textcolor{vert}{<?= Config::$business_city ?>} & le : \textcolor{vert}{<?= $date ?>} \\ |
76 | \end{tabularx}\\ | 84 | \end{tabularx}\\ |
77 | 85 | ||
78 | \begin{tabularx}{\linewidth}{@{}X@{}@{}X@{}} | 86 | \begin{tabularx}{\linewidth}{@{}X@{}@{}X@{}} |
79 | Le bénéficiaire du prêt : \textcolor{vert}{} & | 87 | Le bénéficiaire du prêt : \textcolor{vert}{<?= $data['prenom_nom'] ?>} & |
80 | Le loueur : \textcolor{vert}{}\\ | 88 | Le loueur : \textcolor{vert}{<?= Config::$business_guy ?>}\\ |
81 | \end{tabularx}\\ | 89 | \end{tabularx}\\ |
82 | \normalsize(précéder la signature de la mention « lu et approuvé ») | 90 | \normalsize(précéder la signature de la mention « lu et approuvé ») |
83 | 91 | ||
diff --git a/src/latex_templates/originaux_pas_toucher/devis.tex b/src/latex_templates/originaux_pas_toucher/devis.tex index 634ade1..bc44694 100644 --- a/src/latex_templates/originaux_pas_toucher/devis.tex +++ b/src/latex_templates/originaux_pas_toucher/devis.tex | |||
@@ -46,7 +46,7 @@ | |||
46 | Delai de livraison : \textcolor{vert}{}\\ | 46 | Delai de livraison : \textcolor{vert}{}\\ |
47 | & | 47 | & |
48 | Durée de validité : \textcolor{vert}{}\\ | 48 | Durée de validité : \textcolor{vert}{}\\ |
49 | \end{tabularx}\\\\ | 49 | \end{tabularx}\\ |
50 | 50 | ||
51 | PRESTATION\\ | 51 | PRESTATION\\ |
52 | 52 | ||
diff --git a/src/latex_templates/originaux_pas_toucher/location.tex b/src/latex_templates/originaux_pas_toucher/location.tex index 0d525fe..5be9e47 100644 --- a/src/latex_templates/originaux_pas_toucher/location.tex +++ b/src/latex_templates/originaux_pas_toucher/location.tex | |||
@@ -33,12 +33,46 @@ | |||
33 | Plus d'infos sur le site web: https\string://ordipolo.fr\\ | 33 | Plus d'infos sur le site web: https\string://ordipolo.fr\\ |
34 | % \string supprime l'espace devant les : | 34 | % \string supprime l'espace devant les : |
35 | 35 | ||
36 | CLIENT\\ | 36 | \begin{center} |
37 | \large\textbf{CONTRAT DE LOCATION} | ||
38 | \end{center} | ||
37 | 39 | ||
38 | \begin{tabularx}{\linewidth}{@{}X@{}@{}X@{}} | 40 | PROPRIÉTAIRE\\ |
39 | Mme, M : \textcolor{vert}{} & | 41 | |
40 | Date : \textcolor{vert}{}\\ | 42 | Mme, M : \textcolor{vert}{}\\ |
41 | \end{tabularx}\\ | ||
42 | Adresse : \textcolor{vert}{}\\ | 43 | Adresse : \textcolor{vert}{}\\ |
43 | 44 | ||
45 | LOCATAIRE\\ | ||
46 | |||
47 | \begin{tabularx}{\linewidth}{@{}X@{}@{}X@{}} | ||
48 | Mme, M : \textcolor{vert}{} & tel : \textcolor{vert}{}\\ | ||
49 | Adresse : \textcolor{vert}{} & courriel : \textcolor{vert}{} | ||
50 | \end{tabularx}\\\\ | ||
51 | |||
52 | BIEN LOUÉ\\ | ||
53 | |||
54 | Désignation : \textcolor{vert}{}\\ | ||
55 | Modèle, description : \textcolor{vert}{}\\ | ||
56 | Valeur : \textcolor{vert}{}\\\\ | ||
57 | État des lieux initial : \textcolor{vert}{}\\\\\\ | ||
58 | État des lieux final : \textcolor{vert}{}\\\\ | ||
59 | |||
60 | CLAUSES\\ | ||
61 | |||
62 | Durée du prêt : \textcolor{vert}{}\\ | ||
63 | Loyer mensuel : \textcolor{vert}{}\\ | ||
64 | |||
65 | |||
66 | \textbf{Le bénéficiaire de cette location s’engage à prendre soin du bien désigné et à en faire un usage strictement personnel.}\\ | ||
67 | |||
68 | \begin{tabularx}{\linewidth}{@{}X@{}@{}X@{}} | ||
69 | Fait en deux exemplaires à : \textcolor{vert}{} & le : \textcolor{vert}{} \\ | ||
70 | \end{tabularx}\\ | ||
71 | |||
72 | \begin{tabularx}{\linewidth}{@{}X@{}@{}X@{}} | ||
73 | Le bénéficiaire du prêt : \textcolor{vert}{} & | ||
74 | Le loueur : \textcolor{vert}{}\\ | ||
75 | \end{tabularx}\\ | ||
76 | \normalsize(précéder la signature de la mention « lu et approuvé ») | ||
77 | |||
44 | \end{document} \ No newline at end of file | 78 | \end{document} \ No newline at end of file |
diff --git a/src/model/Locations.php b/src/model/Locations.php index 8ebf757..149c1f1 100644 --- a/src/model/Locations.php +++ b/src/model/Locations.php | |||
@@ -54,10 +54,9 @@ class Locations extends Model | |||
54 | $this->etat_des_lieux_fin = $value; | 54 | $this->etat_des_lieux_fin = $value; |
55 | return($this); | 55 | return($this); |
56 | } | 56 | } |
57 | public function setDureeLocation($value) | 57 | public function setDureeLocation(string $value) |
58 | { | 58 | { |
59 | $value = str_replace(',', '.', $value); | 59 | $this->duree_location = $value; |
60 | $this->duree_location = (float) $value; | ||
61 | return($this); | 60 | return($this); |
62 | } | 61 | } |
63 | public function setLoyerMensuel($value) | 62 | public function setLoyerMensuel($value) |
diff --git a/src/model/Model.php b/src/model/Model.php index 6a7907c..9039aa6 100644 --- a/src/model/Model.php +++ b/src/model/Model.php | |||
@@ -7,11 +7,11 @@ abstract class Model extends DB | |||
7 | protected $table; // <= enfant | 7 | protected $table; // <= enfant |
8 | //static protected $tableStructure; | 8 | //static protected $tableStructure; |
9 | 9 | ||
10 | public function __construct() // à surcharger | 10 | //~ public function __construct() // à surcharger |
11 | { | 11 | //~ { |
12 | //~ $this->table = strtolower(__CLASS__); | 12 | //~ $this->table = strtolower(__CLASS__); |
13 | //~ echo "TABLE = " . $this->table . "\n"; | 13 | //~ echo "TABLE = " . $this->table . "\n"; |
14 | } | 14 | //~ } |
15 | 15 | ||
16 | // getters | 16 | // getters |
17 | public function getTable(): string | 17 | public function getTable(): string |
diff --git a/src/model/Prestations.php b/src/model/Prestations.php index ddd785b..2011dbe 100644 --- a/src/model/Prestations.php +++ b/src/model/Prestations.php | |||
@@ -95,7 +95,7 @@ class Prestations extends Model | |||
95 | // on récupère un tableau contenant toutes les prestations d'un client tous types confondus (devis, facture, cesu, location, enregistrement sans vente) | 95 | // on récupère un tableau contenant toutes les prestations d'un client tous types confondus (devis, facture, cesu, location, enregistrement sans vente) |
96 | $combientieme_fois = count($this->find(['ID_client' => $this->ID_client])) + 1; | 96 | $combientieme_fois = count($this->find(['ID_client' => $this->ID_client])) + 1; |
97 | 97 | ||
98 | $array_code = [$Date->getYear(), $Date->getMonth(), $Date->getDay(), $code_client, $combientieme_fois]; | 98 | $array_code = [$Date->getYear(), $Date->getMonth(), $Date->getDay(), $code_client, $this->type_presta, $combientieme_fois]; |
99 | $this->code_presta = implode('-', $array_code); | 99 | $this->code_presta = implode('-', $array_code); |
100 | } | 100 | } |
101 | } | 101 | } |
diff --git a/src/model/StructTablesDB.php b/src/model/StructTablesDB.php index 32ae92d..b1e3c7a 100644 --- a/src/model/StructTablesDB.php +++ b/src/model/StructTablesDB.php | |||
@@ -14,7 +14,7 @@ class StructTablesDB | |||
14 | 'devis' => ['ID' => 'INTEGER', 'ID_presta' => 'INTEGER', 'taches' => 'TEXT', 'total_main_d_oeuvre' => 'REAL', 'pieces' => 'TEXT', 'total_pieces' => 'REAL', 'deplacement' => 'REAL', 'total_HT' => 'REAL', 'delai_livraison' => 'TEXT', 'validite_devis' => 'TEXT', 'signature_devis' => 'TEXT'], | 14 | 'devis' => ['ID' => 'INTEGER', 'ID_presta' => 'INTEGER', 'taches' => 'TEXT', 'total_main_d_oeuvre' => 'REAL', 'pieces' => 'TEXT', 'total_pieces' => 'REAL', 'deplacement' => 'REAL', 'total_HT' => 'REAL', 'delai_livraison' => 'TEXT', 'validite_devis' => 'TEXT', 'signature_devis' => 'TEXT'], |
15 | 'factures' => ['ID' => 'INTEGER', 'ID_presta' => 'INTEGER', 'taches' => 'TEXT', 'machine' => 'TEXT', 'OS' => 'TEXT', 'donnees' => 'TEXT', 'cles_licences' => 'TEXT', 'total_main_d_oeuvre' => 'REAL', 'pieces' => 'TEXT', 'total_pieces' => 'REAL', 'deplacement' => 'REAL', 'total_HT' => 'REAL'], | 15 | 'factures' => ['ID' => 'INTEGER', 'ID_presta' => 'INTEGER', 'taches' => 'TEXT', 'machine' => 'TEXT', 'OS' => 'TEXT', 'donnees' => 'TEXT', 'cles_licences' => 'TEXT', 'total_main_d_oeuvre' => 'REAL', 'pieces' => 'TEXT', 'total_pieces' => 'REAL', 'deplacement' => 'REAL', 'total_HT' => 'REAL'], |
16 | 'cesu' => ['ID' => 'INTEGER', 'ID_presta' => 'INTEGER', 'taches' => 'TEXT', 'duree_travail' => 'TEXT', 'salaire' => 'REAL'], | 16 | 'cesu' => ['ID' => 'INTEGER', 'ID_presta' => 'INTEGER', 'taches' => 'TEXT', 'duree_travail' => 'TEXT', 'salaire' => 'REAL'], |
17 | 'locations' => ['ID' => 'INTEGER', 'ID_presta' => 'INTEGER', 'designation' => 'TEXT', 'modele_description' => 'TEXT', 'valeur' => 'REAL', 'etat_des_lieux_debut' => 'TEXT', 'etat_des_lieux_fin' => 'TEXT', 'duree_location' => 'INTEGER', 'loyer_mensuel' => 'REAL', 'loyers_payes' => 'INTEGER', 'caution' => 'INTEGER'] | 17 | 'locations' => ['ID' => 'INTEGER', 'ID_presta' => 'INTEGER', 'designation' => 'TEXT', 'modele_description' => 'TEXT', 'valeur' => 'REAL', 'etat_des_lieux_debut' => 'TEXT', 'etat_des_lieux_fin' => 'TEXT', 'duree_location' => 'TEXT', 'loyer_mensuel' => 'REAL', 'loyers_payes' => 'INTEGER', 'caution' => 'INTEGER'] |
18 | ]; | 18 | ]; |
19 | 19 | ||
20 | // les types de variables de sqlite sont peu nombreux et autorisent un typage automatique | 20 | // les types de variables de sqlite sont peu nombreux et autorisent un typage automatique |
diff --git a/src/sections/1_new_service.php b/src/sections/1_new_service.php index d516329..ae2d2ef 100644 --- a/src/sections/1_new_service.php +++ b/src/sections/1_new_service.php | |||
@@ -102,7 +102,6 @@ function newService(): int // code de retour, si 0 retour menu principal, si 2 a | |||
102 | } | 102 | } |
103 | 103 | ||
104 | $Presta->setDate($Date->getTimestamp()); // un entier pour la BDD | 104 | $Presta->setDate($Date->getTimestamp()); // un entier pour la BDD |
105 | $Presta->makeCodePresta($Date, $Client->getCodeClient()); // d'un objet à l'autre | ||
106 | 105 | ||
107 | switch($choix_niv2) | 106 | switch($choix_niv2) |
108 | { | 107 | { |
@@ -135,17 +134,22 @@ function newService(): int // code de retour, si 0 retour menu principal, si 2 a | |||
135 | return(0); | 134 | return(0); |
136 | } | 135 | } |
137 | 136 | ||
138 | if($input == '') | 137 | $Presta->makeCodePresta($Date, $Client->getCodeClient()); // d'un objet à l'autre |
139 | { | 138 | |
140 | echo "debug: annulation lors de l'enregistrement des détails de la prestation\n"; | 139 | if($choix_niv2 != ZenitySetup::$menu_enregistrement_entrees[4]) // si presta non vendue, saut étape 3/3 |
141 | return(0); | ||
142 | } | ||
143 | elseif(isset($Details) && !$Details->hydrateFromForm($input, $Presta)) // echec de l'hydratation | ||
144 | { | 140 | { |
145 | echo "debug: erreur de hydrateFromForm()\n"; // messages d'erreur à mettre ici ou dans hydrateFromForm()? | 141 | if($input == '') // annulation |
146 | return(0); | 142 | { |
143 | echo "debug: annulation lors de l'enregistrement des détails de la prestation\n"; | ||
144 | return(0); | ||
145 | } | ||
146 | elseif(isset($Details) && !$Details->hydrateFromForm($input, $Presta)) // echec de l'hydratation | ||
147 | { | ||
148 | echo "debug: erreur de hydrateFromForm()\n"; // messages d'erreur à mettre ici ou dans hydrateFromForm()? | ||
149 | return(0); | ||
150 | } | ||
151 | unset($input); | ||
147 | } | 152 | } |
148 | unset($input); | ||
149 | 153 | ||
150 | // commentaire - étape 3/3 | 154 | // commentaire - étape 3/3 |
151 | $input = exec($CommentairePrestation->get()); | 155 | $input = exec($CommentairePrestation->get()); |
@@ -171,9 +175,12 @@ function newService(): int // code de retour, si 0 retour menu principal, si 2 a | |||
171 | $Presta->create(); | 175 | $Presta->create(); |
172 | $Presta->setID(); // sans paramètre, exécute un $this->db->lastInsertId() | 176 | $Presta->setID(); // sans paramètre, exécute un $this->db->lastInsertId() |
173 | 177 | ||
174 | $Details->setIDPresta($Presta->getID()); // d'un objet à l'autre | 178 | if(isset($Details)) // presta non vendue |
175 | $Details->create(); | 179 | { |
176 | $Details->setID(); // sans paramètre, exécute un $this->db->lastInsertId() | 180 | $Details->setIDPresta($Presta->getID()); // d'un objet à l'autre |
181 | $Details->create(); | ||
182 | $Details->setID(); // sans paramètre, exécute un $this->db->lastInsertId() | ||
183 | } | ||
177 | 184 | ||
178 | 185 | ||
179 | // -- partie 3: LaTeX -- | 186 | // -- partie 3: LaTeX -- |
@@ -208,9 +215,12 @@ function newService(): int // code de retour, si 0 retour menu principal, si 2 a | |||
208 | $type = 'enveloppe_recto'; | 215 | $type = 'enveloppe_recto'; |
209 | makeLatexAndPdfDocument($type, $Client); | 216 | makeLatexAndPdfDocument($type, $Client); |
210 | 217 | ||
211 | // le verso ne dépend pas du client mais de l'entreprise | 218 | // le verso ne dépend pas du client mais de l'entreprise, dans la classe Config |
212 | $type = 'enveloppe_verso'; | 219 | if(!file_exists(Config::$pdf_path . 'enveloppe_verso.pdf')) |
213 | makeLatexAndPdfDocument($type); | 220 | { |
221 | $type = 'enveloppe_verso'; | ||
222 | makeLatexAndPdfDocument($type); | ||
223 | } | ||
214 | 224 | ||
215 | 225 | ||
216 | // -- partie 4: récapitulatif -- | 226 | // -- partie 4: récapitulatif -- |