dolibarr 21.0.0-alpha
commonnumrefgenerator.class.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2023 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
4 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 * or see https://www.gnu.org/
19 */
20
32{
36 public $name = '';
37
41 public $version = '';
42
46 public $error = '';
47
51 public $errors = array();
52
56 protected $db;
57
61 public $code_null;
62
66 public $code_modifiable;
67
71 public $code_modifiable_invalide;
72
76 public $code_modifiable_null;
77
81 public $code_auto;
82
86 public $prefixIsRequired;
87
95 public function getNom($langs)
96 {
97 return $this->getName($langs);
98 }
99
105 public function getName($langs)
106 {
107 return empty($this->name) ? get_class($this) : $this->name;
108 }
109
115 public function isEnabled()
116 {
117 return true;
118 }
119
126 public function info($langs)
127 {
128 return $langs->trans("NoDescription");
129 }
130
138 public function canBeActivated($object)
139 {
140 return true;
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 }
156 if ($this->version == 'experimental') {
157 return $langs->trans("VersionExperimental");
158 }
159 if ($this->version == 'dolibarr') {
160 return DOL_VERSION;
161 }
162 if ($this->version) {
163 return $this->version;
164 }
165 return $langs->trans("NotAvailable");
166 }
167}
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:58
Parent class for number ref generators.
getVersion()
Returns version of numbering module.
isEnabled()
Return if a module can be used or not.
getNom($langs)
Return model name.
getName($langs)
Return model name.
canBeActivated($object)
Checks if the numbers already in the database do not cause conflicts that would prevent this numberin...
info($langs)
Returns the default description of the numbering template.
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition repair.php:142