dolibarr  18.0.0-alpha
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  $type = 'invoice';
65  $list = array();
66 
67  include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
68  $list = getListOfModels($db, $type, $maxfilenamelength);
69 
70  return $list;
71  }
72 }
73 
77 abstract class ModeleNumRefFactures
78 {
82  public $error = '';
83 
89  public function isEnabled()
90  {
91  return true;
92  }
93 
99  public function info()
100  {
101  global $langs;
102  $langs->load("bills");
103  return $langs->trans("NoDescription");
104  }
105 
111  public function getExample()
112  {
113  global $langs;
114  $langs->load("bills");
115  return $langs->trans("NoExample");
116  }
117 
124  public function canBeActivated()
125  {
126  return true;
127  }
128 
137  public function getNextValue($objsoc, $invoice, $mode = 'next')
138  {
139  global $langs;
140  return $langs->trans("NotAvailable");
141  }
142 
148  public function getVersion()
149  {
150  global $langs;
151  $langs->load("admin");
152 
153  if ($this->version == 'development') {
154  return $langs->trans("VersionDevelopment");
155  } elseif ($this->version == 'experimental') {
156  return $langs->trans("VersionExperimental");
157  } elseif ($this->version == 'dolibarr') {
158  return DOL_VERSION;
159  } elseif ($this->version) {
160  return $this->version;
161  } else {
162  return $langs->trans("NotAvailable");
163  }
164  }
165 }
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:77
ModeleNumRefFactures\getVersion
getVersion()
Renvoi version du modele de numerotation.
Definition: modules_facture.php:148
getListOfModels
getListOfModels($db, $type, $maxfilenamelength=0)
Return list of activated modules usable for document generation.
Definition: functions2.lib.php:1925
ModeleNumRefFactures\info
info()
Returns the default description of the numbering pattern.
Definition: modules_facture.php:99
ModeleNumRefFactures\getNextValue
getNextValue($objsoc, $invoice, $mode='next')
Renvoi prochaine valeur attribuee.
Definition: modules_facture.php:137
ModeleNumRefFactures\isEnabled
isEnabled()
Return if a module can be used or not.
Definition: modules_facture.php:89
CommonDocGenerator
Parent class for documents generators.
Definition: commondocgenerator.class.php:36
ModeleNumRefFactures\getExample
getExample()
Return an example of numbering.
Definition: modules_facture.php:111
ModeleNumRefFactures\canBeActivated
canBeActivated()
Checks if the numbers already in the database do not cause conflicts that would prevent this numberin...
Definition: modules_facture.php:124