diff options
Diffstat (limited to 'src/Latex.php')
| -rw-r--r-- | src/Latex.php | 53 |
1 files changed, 32 insertions, 21 deletions
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 | |||
| 12 | protected $data = []; // données à insérer dans le template | 12 | protected $data = []; // données à insérer dans le template |
| 13 | protected $latex = ''; // latex pur | 13 | protected $latex = ''; // latex pur |
| 14 | 14 | ||
| 15 | static function makeLatexSubClass(string $type) | 15 | static function makeInstance(string $type) |
| 16 | { | 16 | { |
| 17 | switch($type) | 17 | switch($type) |
| 18 | { | 18 | { |
| 19 | // documents pour les clients | 19 | // documents pour les clients |
| 20 | case 'devis': | 20 | case 'devis': |
| 21 | return new DevisLatex($type); | 21 | return new DevisLatex; |
| 22 | case 'facture': | 22 | case 'facture': |
| 23 | return new FactureLatex($type); | 23 | return new FactureLatex; |
| 24 | case 'location': | 24 | case 'location': |
| 25 | return new LocationLatex($type); | 25 | return new LocationLatex; |
| 26 | case 'enveloppe_recto': | 26 | case 'enveloppe_recto': |
| 27 | return new EnveloppeRectoLatex($type); | 27 | return new EnveloppeRectoLatex; |
| 28 | case 'enveloppe_verso': | 28 | case 'enveloppe_verso': |
| 29 | return new EnveloppeVersoLatex($type); | 29 | return new EnveloppeVersoLatex; |
| 30 | // pas de document | 30 | // pas de document |
| 31 | case 'cesu': | 31 | case 'cesu': |
| 32 | return null; | 32 | return null; |
| @@ -41,10 +41,8 @@ abstract class Latex | |||
| 41 | } | 41 | } |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | public function __construct(string $type) | 44 | //~ public function __construct() |
| 45 | { | 45 | //~ {} |
| 46 | $this->type = $type; | ||
| 47 | } | ||
| 48 | 46 | ||
| 49 | public function makeLatex() | 47 | public function makeLatex() |
| 50 | { | 48 | { |
| @@ -104,10 +102,8 @@ abstract class PrestaLatex extends Latex | |||
| 104 | { | 102 | { |
| 105 | protected $Date; // sera un type "Dates" | 103 | protected $Date; // sera un type "Dates" |
| 106 | 104 | ||
| 107 | //~ public function __construct(string $type) | 105 | //~ public function __construct() |
| 108 | //~ { | 106 | //~ {} |
| 109 | //~ $this->type = $type; | ||
| 110 | //~ } | ||
| 111 | 107 | ||
| 112 | public function setData(Object $Object): self | 108 | public function setData(Object $Object): self |
| 113 | { | 109 | { |
| @@ -158,17 +154,32 @@ abstract class PrestaLatex extends Latex | |||
| 158 | } | 154 | } |
| 159 | } | 155 | } |
| 160 | class DevisLatex extends PrestaLatex // extends Latex | 156 | class DevisLatex extends PrestaLatex // extends Latex |
| 161 | {} | 157 | { |
| 158 | public function __construct() | ||
| 159 | { | ||
| 160 | $this->type = 'devis'; | ||
| 161 | } | ||
| 162 | } | ||
| 162 | class FactureLatex extends PrestaLatex // extends Latex | 163 | class FactureLatex extends PrestaLatex // extends Latex |
| 163 | {} | 164 | { |
| 165 | public function __construct() | ||
| 166 | { | ||
| 167 | $this->type = 'facture'; | ||
| 168 | } | ||
| 169 | } | ||
| 164 | class LocationLatex extends PrestaLatex // extends Latex | 170 | class LocationLatex extends PrestaLatex // extends Latex |
| 165 | {} | 171 | { |
| 172 | public function __construct() | ||
| 173 | { | ||
| 174 | $this->type = 'location'; | ||
| 175 | } | ||
| 176 | } | ||
| 166 | 177 | ||
| 167 | class EnveloppeRectoLatex extends Latex | 178 | class EnveloppeRectoLatex extends Latex |
| 168 | { | 179 | { |
| 169 | public function __construct(string $type) | 180 | public function __construct() |
| 170 | { | 181 | { |
| 171 | $this->type = $type; | 182 | $this->type = 'enveloppe_recto'; |
| 172 | $this->latex_path = Config::$latex_path . 'enveloppes_recto/'; | 183 | $this->latex_path = Config::$latex_path . 'enveloppes_recto/'; |
| 173 | $this->pdf_path = Config::$pdf_path . 'enveloppes_recto/'; | 184 | $this->pdf_path = Config::$pdf_path . 'enveloppes_recto/'; |
| 174 | } | 185 | } |
| @@ -188,9 +199,9 @@ class EnveloppeRectoLatex extends Latex | |||
| 188 | } | 199 | } |
| 189 | class EnveloppeVersoLatex extends Latex | 200 | class EnveloppeVersoLatex extends Latex |
| 190 | { | 201 | { |
| 191 | public function __construct(string $type) | 202 | public function __construct() |
| 192 | { | 203 | { |
| 193 | $this->type = $type; | 204 | $this->type = 'enveloppe_verso'; |
| 194 | $this->file_name = 'enveloppe_verso.tex'; | 205 | $this->file_name = 'enveloppe_verso.tex'; |
| 195 | $this->latex_path = Config::$latex_path; | 206 | $this->latex_path = Config::$latex_path; |
| 196 | $this->pdf_path = Config::$pdf_path; | 207 | $this->pdf_path = Config::$pdf_path; |
