dolibarr 19.0.3
commonnumrefgenerator.class.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2023 Laurent Destailleur <eldy@users.sourceforge.net>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 * or see https://www.gnu.org/
17 */
18
30{
34 public $name = '';
35
39 public $version = '';
40
44 public $error = '';
45
49 public $errors = array();
50
54 protected $db;
55
56
63 public function getNom($langs)
64 {
65 return empty($this->name) ? get_class($this) : $this->name;
66 }
67
73 public function getName($langs)
74 {
75 return empty($this->name) ? get_class($this) : $this->name;
76 }
77
83 public function isEnabled()
84 {
85 return true;
86 }
87
94 public function info($langs)
95 {
96 return $langs->trans("NoDescription");
97 }
98
106 public function canBeActivated($object)
107 {
108 return true;
109 }
110
116 public function getVersion()
117 {
118 global $langs;
119 $langs->load("admin");
120
121 if ($this->version == 'development') {
122 return $langs->trans("VersionDevelopment");
123 }
124 if ($this->version == 'experimental') {
125 return $langs->trans("VersionExperimental");
126 }
127 if ($this->version == 'dolibarr') {
128 return DOL_VERSION;
129 }
130 if ($this->version) {
131 return $this->version;
132 }
133 return $langs->trans("NotAvailable");
134 }
135}
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 TODO Replace with getName()
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:124