dolibarr  16.0.5
modules_facture.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
5  * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
6  * Copyright (C) 2014 Marcos GarcĂ­a <marcosgdf@gmail.com>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <https://www.gnu.org/licenses/>.
20  * or see https://www.gnu.org/
21  */
22 
30 require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
31 require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
32 require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Required because used in classes that inherit
33 
34 
38 abstract class ModelePDFFactures extends CommonDocGenerator
39 {
43  public $error = '';
44 
45  public $tva;
46  public $tva_array;
47  public $localtax1;
48  public $localtax2;
49 
50  public $atleastonediscount = 0;
51  public $atleastoneratenotnull = 0;
52 
53  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
61  public static function liste_modeles($db, $maxfilenamelength = 0)
62  {
63  // phpcs:enable
64  global $conf;
65 
66  $type = 'invoice';
67  $list = array();
68 
69  include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
70  $list = getListOfModels($db, $type, $maxfilenamelength);
71 
72  return $list;
73  }
74 }
75 
79 abstract class ModeleNumRefFactures
80 {
84  public $error = '';
85 
91  public function isEnabled()
92  {
93  return true;
94  }
95 
101  public function info()
102  {
103  global $langs;
104  $langs->load("bills");
105  return $langs->trans("NoDescription");
106  }
107 
113  public function getExample()
114  {
115  global $langs;
116  $langs->load("bills");
117  return $langs->trans("NoExample");
118  }
119 
126  public function canBeActivated()
127  {
128  return true;
129  }
130 
139  public function getNextValue($objsoc, $invoice, $mode = 'next')
140  {
141  global $langs;
142  return $langs->trans("NotAvailable");
143  }
144 
150  public function getVersion()
151  {
152  global $langs;
153  $langs->load("admin");
154 
155  if ($this->version == 'development') {
156  return $langs->trans("VersionDevelopment");
157  } elseif ($this->version == 'experimental') {
158  return $langs->trans("VersionExperimental");
159  } elseif ($this->version == 'dolibarr') {
160  return DOL_VERSION;
161  } elseif ($this->version) {
162  return $this->version;
163  } else {
164  return $langs->trans("NotAvailable");
165  }
166  }
167 }
ModelePDFFactures\liste_modeles
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation modules.
Definition: modules_facture.php:61
ModelePDFFactures
Parent class of invoice document generators.
Definition: modules_facture.php:38
ModeleNumRefFactures
Parent class of invoice reference numbering templates.
Definition: modules_facture.php:79
ModeleNumRefFactures\getVersion
getVersion()
Renvoi version du modele de numerotation.
Definition: modules_facture.php:150
getListOfModels
getListOfModels($db, $type, $maxfilenamelength=0)
Return list of activated modules usable for document generation.
Definition: functions2.lib.php:1919
ModeleNumRefFactures\info
info()
Renvoi la description par defaut du modele de numerotation.
Definition: modules_facture.php:101
ModeleNumRefFactures\getNextValue
getNextValue($objsoc, $invoice, $mode='next')
Renvoi prochaine valeur attribuee.
Definition: modules_facture.php:139
ModeleNumRefFactures\isEnabled
isEnabled()
Return if a module can be used or not.
Definition: modules_facture.php:91
CommonDocGenerator
Parent class for documents generators.
Definition: commondocgenerator.class.php:36
ModeleNumRefFactures\getExample
getExample()
Return an example of numbering.
Definition: modules_facture.php:113
ModeleNumRefFactures\canBeActivated
canBeActivated()
Checks if the numbers already in the database do not cause conflicts that would prevent this numberin...
Definition: modules_facture.php:126