From 6f4cc3afffde36a13618458ffda72e6104624f36 Mon Sep 17 00:00:00 2001 From: polo Date: Wed, 30 Aug 2023 12:20:39 +0200 Subject: =?UTF-8?q?section=20client=20=C3=A0=20part,=20section=20modif=20e?= =?UTF-8?q?n=20cours,=20bug=20dans=20Dates,?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Latex.php | 53 ++++++++++++++++++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 21 deletions(-) (limited to 'src/Latex.php') diff --git a/src/Latex.php b/src/Latex.php index 547c130..fd76f7b 100644 --- a/src/Latex.php +++ b/src/Latex.php @@ -12,21 +12,21 @@ abstract class Latex protected $data = []; // données à insérer dans le template protected $latex = ''; // latex pur - static function makeLatexSubClass(string $type) + static function makeInstance(string $type) { switch($type) { // documents pour les clients case 'devis': - return new DevisLatex($type); + return new DevisLatex; case 'facture': - return new FactureLatex($type); + return new FactureLatex; case 'location': - return new LocationLatex($type); + return new LocationLatex; case 'enveloppe_recto': - return new EnveloppeRectoLatex($type); + return new EnveloppeRectoLatex; case 'enveloppe_verso': - return new EnveloppeVersoLatex($type); + return new EnveloppeVersoLatex; // pas de document case 'cesu': return null; @@ -41,10 +41,8 @@ abstract class Latex } } - public function __construct(string $type) - { - $this->type = $type; - } + //~ public function __construct() + //~ {} public function makeLatex() { @@ -104,10 +102,8 @@ abstract class PrestaLatex extends Latex { protected $Date; // sera un type "Dates" - //~ public function __construct(string $type) - //~ { - //~ $this->type = $type; - //~ } + //~ public function __construct() + //~ {} public function setData(Object $Object): self { @@ -158,17 +154,32 @@ abstract class PrestaLatex extends Latex } } class DevisLatex extends PrestaLatex // extends Latex -{} +{ + public function __construct() + { + $this->type = 'devis'; + } +} class FactureLatex extends PrestaLatex // extends Latex -{} +{ + public function __construct() + { + $this->type = 'facture'; + } +} class LocationLatex extends PrestaLatex // extends Latex -{} +{ + public function __construct() + { + $this->type = 'location'; + } +} class EnveloppeRectoLatex extends Latex { - public function __construct(string $type) + public function __construct() { - $this->type = $type; + $this->type = 'enveloppe_recto'; $this->latex_path = Config::$latex_path . 'enveloppes_recto/'; $this->pdf_path = Config::$pdf_path . 'enveloppes_recto/'; } @@ -188,9 +199,9 @@ class EnveloppeRectoLatex extends Latex } class EnveloppeVersoLatex extends Latex { - public function __construct(string $type) + public function __construct() { - $this->type = $type; + $this->type = 'enveloppe_verso'; $this->file_name = 'enveloppe_verso.tex'; $this->latex_path = Config::$latex_path; $this->pdf_path = Config::$pdf_path; -- cgit v1.2.3