diff options
Diffstat (limited to 'src/sections')
| -rw-r--r-- | src/sections/1_new_service.php | 54 |
1 files changed, 49 insertions, 5 deletions
diff --git a/src/sections/1_new_service.php b/src/sections/1_new_service.php index e7e3564..6f5a72c 100644 --- a/src/sections/1_new_service.php +++ b/src/sections/1_new_service.php | |||
| @@ -130,13 +130,57 @@ function newService(): int // code de retour, si 0 retour menu principal, si 2 a | |||
| 130 | 130 | ||
| 131 | // -- partie 3: LaTeX -- | 131 | // -- partie 3: LaTeX -- |
| 132 | 132 | ||
| 133 | makeLatexAndPdfDocuments($Client, $Presta, $PrestaDetails); | 133 | //makeLatexAndPdfDocuments($Client, $Presta, $PrestaDetails); |
| 134 | // factoriser tout ça | ||
| 135 | /* plusieurs parties: | ||
| 136 | * - une fonction ou on crée et manipule les objets (une classe par type de document) | ||
| 137 | * - manipulation des données | ||
| 138 | * - chemins et noms de fichiers | ||
| 139 | * - insertion des variables | ||
| 140 | * - écriture du fichier (+ dossier si nécessaire) | ||
| 141 | */ | ||
| 142 | // et pour bien faire ajouter aussi une interface | ||
| 134 | 143 | ||
| 135 | // fabrique d'objets (sans connaître les noms des classes) | 144 | // fabrique d'objets (sans connaître les noms des classes) |
| 136 | 145 | $EnveloppeRecto = Latex::makeLatexSubClass('enveloppe_recto'); | |
| 137 | //~ $EnveloppeRecto = Latex::makeLatexSubClass('enveloppe_recto'); | 146 | $EnveloppeVerso = Latex::makeLatexSubClass('enveloppe_verso'); |
| 138 | //~ $EnveloppeVerso = Latex::makeLatexSubClass('enveloppe_verso'); | 147 | $DocumentPresta = Latex::makeLatexSubClass($Presta->getTypePresta()); // $type = facture, devis, location |
| 139 | //~ $DocumentPresta = Latex::makeLatexSubClass($Presta->getTypePresta()); // $type = facture, devis, location | 148 | |
| 149 | // génération du latex | ||
| 150 | $EnveloppeRecto->setData($Client); | ||
| 151 | $EnveloppeRecto->setFileName($Client->getCodeClient() . '.tex'); | ||
| 152 | $EnveloppeRecto->setLatexPath(Config::$latex_path . 'enveloppes_recto/'); | ||
| 153 | $EnveloppeRecto->setPdfPath(Config::$pdf_path . 'enveloppes_recto/'); | ||
| 154 | $EnveloppeRecto->spacesInPostCode(); | ||
| 155 | $EnveloppeRecto->makeLatex(); | ||
| 156 | |||
| 157 | $EnveloppeVerso->setFileName('enveloppe_verso.tex'); | ||
| 158 | $EnveloppeVerso->setLatexPath(Config::$latex_path); | ||
| 159 | $EnveloppeVerso->setPdfPath(Config::$pdf_path); | ||
| 160 | $EnveloppeVerso->makeLatex(); | ||
| 161 | |||
| 162 | $DocumentPresta->setData($Client); | ||
| 163 | $DocumentPresta->setData($Presta); | ||
| 164 | $DocumentPresta->setData($PrestaDetails); | ||
| 165 | $DocumentPresta->makeDateInstance($Presta->getDate()); // paramètre = int | ||
| 166 | $DocumentPresta->setFileName($Presta->getCodePresta() . '.tex'); | ||
| 167 | $DocumentPresta->setLatexPath(Config::$latex_path . $DocumentPresta->getYear() . '/'); | ||
| 168 | $DocumentPresta->setPdfPath(Config::$pdf_path . $DocumentPresta->getYear() . '/'); | ||
| 169 | $DocumentPresta->makeLatex(); | ||
| 170 | |||
| 171 | // création des fichiers | ||
| 172 | makeFolder($EnveloppeRecto->getLatexPath()); | ||
| 173 | makeFolder($EnveloppeRecto->getPdfPath()); | ||
| 174 | makeFile($EnveloppeRecto->getLatexPath(), $EnveloppeRecto->getFileName(), $EnveloppeRecto->getLatex()); | ||
| 175 | latexToPdf($EnveloppeRecto->getLatexPath(), $EnveloppeRecto->getFileName(), $EnveloppeRecto->getPdfPath()); | ||
| 176 | |||
| 177 | makeFile($EnveloppeVerso->getLatexPath(), $EnveloppeVerso->getFileName(), $EnveloppeVerso->getLatex()); | ||
| 178 | latexToPdf($EnveloppeVerso->getLatexPath(), $EnveloppeVerso->getFileName(), $EnveloppeVerso->getPdfPath()); | ||
| 179 | |||
| 180 | makeFolder($DocumentPresta->getLatexPath()); | ||
| 181 | makeFolder($DocumentPresta->getPdfPath()); | ||
| 182 | makeFile($DocumentPresta->getLatexPath(), $DocumentPresta->getFileName(), $DocumentPresta->getLatex()); | ||
| 183 | latexToPdf($DocumentPresta->getLatexPath(), $DocumentPresta->getFileName(), $DocumentPresta->getPdfPath()); | ||
| 140 | 184 | ||
| 141 | 185 | ||
| 142 | // -- partie 4: récapitulatif -- | 186 | // -- partie 4: récapitulatif -- |
