dolibarr 18.0.6
modules_member.class.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2004-2010 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 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 * or see https://www.gnu.org/
20 */
21
22
23
30 require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
31
35abstract class ModelePDFMember extends CommonDocGenerator
36{
40 public $error = '';
41
42
43 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
51 public static function liste_modeles($db, $maxfilenamelength = 0)
52 {
53 // phpcs:enable
54 $type = 'member';
55 $list = array();
56
57 include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
58 $list = getListOfModels($db, $type, $maxfilenamelength);
59 return $list;
60 }
61}
62
63
64
68abstract class ModeleNumRefMembers
69{
70
71 public $code_modifiable; // Editable code
72
73 public $code_modifiable_invalide; // Modified code if it is invalid
74
75 public $code_modifiable_null; // Modified code if it is null
76
77 public $code_null; //
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("members");
103 return $langs->trans("NoDescription");
104 }
105
111 public function getName()
112 {
113 return $this->name;
114 }
115
121 public function getExample()
122 {
123 global $langs;
124 $langs->load("members");
125 return $langs->trans("NoExample");
126 }
127
134 public function canBeActivated()
135 {
136 return true;
137 }
138
146 public function getNextValue($objsoc, $object)
147 {
148 global $langs;
149 return $langs->trans("NotAvailable");
150 }
151
157 public function getVersion()
158 {
159 global $langs;
160 $langs->load("admin");
161
162 if ($this->version == 'development') {
163 return $langs->trans("VersionDevelopment");
164 } elseif ($this->version == 'experimental') {
165 return $langs->trans("VersionExperimental");
166 } elseif ($this->version == 'dolibarr') {
167 return DOL_VERSION;
168 } elseif ($this->version) {
169 return $this->version;
170 } else {
171 return $langs->trans("NotAvailable");
172 }
173 }
174
182 public function getToolTip($langs, $soc)
183 {
184 global $conf;
185
186 $langs->loadLangs(array("admin", "companies"));
187
188 $strikestart = '';
189 $strikeend = '';
190 if (!empty($conf->global->MAIN_MEMBER_CODE_ALWAYS_REQUIRED) && !empty($this->code_null)) {
191 $strikestart = '<strike>';
192 $strikeend = '</strike> '.yn(1, 1, 2).' ('.$langs->trans("ForcedToByAModule", $langs->transnoentities("yes")).')';
193 }
194
195 $s = '';
196 $s .= $langs->trans("Name").': <b>'.$this->getName().'</b><br>';
197 $s .= $langs->trans("Version").': <b>'.$this->getVersion().'</b><br>';
198 $s .= $langs->trans("MemberCodeDesc").'<br>';
199 $s .= $langs->trans("ValidityControledByModule").': <b>'.$this->getName().'</b><br>';
200 $s .= '<br>';
201 $s .= '<u>'.$langs->trans("ThisIsModuleRules").':</u><br>';
202
203 $s .= $langs->trans("Required").': '.$strikestart;
204 $s .= yn(!$this->code_null, 1, 2).$strikeend;
205 $s .= '<br>';
206 $s .= $langs->trans("CanBeModifiedIfOk").': ';
207 $s .= yn($this->code_modifiable, 1, 2);
208 $s .= '<br>';
209 $s .= $langs->trans("CanBeModifiedIfKo").': '.yn($this->code_modifiable_invalide, 1, 2).'<br>';
210 $s .= $langs->trans("AutomaticCode").': '.yn($this->code_auto, 1, 2).'<br>';
211 $s .= '<br>';
212 $nextval = $this->getNextValue($soc, 0);
213 if (empty($nextval)) {
214 $nextval = $langs->trans("Undefined");
215 }
216 $s .= $langs->trans("NextValue").' ('.$langs->trans("Member").'): <b>'.$nextval.'</b><br>';
217
218 return $s;
219 }
220}
Parent class for documents generators.
Classe mere des modeles de numerotation des references de members.
getToolTip($langs, $soc)
Return description of module parameters.
getNextValue($objsoc, $object)
Renvoi prochaine valeur attribuee.
info()
Returns the default description of the numbering pattern.
getVersion()
Renvoi version du module numerotation.
getName()
Return name of module.
getExample()
Return an example of numbering.
canBeActivated()
Checks if the numbers already in the database do not cause conflicts that would prevent this numberin...
isEnabled()
Return if a module can be used or not.
Parent class to manage intervention document templates.
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation modules.
getListOfModels($db, $type, $maxfilenamelength=0)
Return list of activated modules usable for document generation.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.