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
88
96 public function getNom($langs)
97 {
98 return $this->getName($langs);
99 }
100
106 public function getName($langs)
107 {
108 return empty($this->name) ? get_class($this) : $this->name;
109 }
110
116 public function isEnabled()
117 {
118 return true;
119 }
120
127 public function info($langs)
128 {
129 return $langs->trans("NoDescription");
130 }
131
139 public function canBeActivated($object)
140 {
141 return true;
142 }
143
149 public function getVersion()
150 {
151 global $langs;
152 $langs->load("admin");
153
154 if ($this->version == 'development') {
155 return $langs->trans("VersionDevelopment");
156 }
157 if ($this->version == 'experimental') {
158 return $langs->trans("VersionExperimental");
159 }
160 if ($this->version == 'dolibarr') {
161 return DOL_VERSION;
162 }
163 if ($this->version) {
164 return $this->version;
165 }
166 return $langs->trans("NotAvailable");
167 }
168}
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:140