dolibarr  18.0.0-alpha
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 
35 abstract 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 
68 abstract class ModeleNumRefMembers
69 {
73  public $error = '';
74 
80  public function isEnabled()
81  {
82  return true;
83  }
84 
90  public function info()
91  {
92  global $langs;
93  $langs->load("members");
94  return $langs->trans("NoDescription");
95  }
96 
102  public function getName()
103  {
104  return $this->name;
105  }
106 
112  public function getExample()
113  {
114  global $langs;
115  $langs->load("members");
116  return $langs->trans("NoExample");
117  }
118 
125  public function canBeActivated()
126  {
127  return true;
128  }
129 
137  public function getNextValue($objsoc, $object)
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 
173  public function getToolTip($langs, $soc)
174  {
175  global $conf;
176 
177  $langs->loadLangs(array("admin", "companies"));
178 
179  $strikestart = '';
180  $strikeend = '';
181  if (!empty($conf->global->MAIN_MEMBER_CODE_ALWAYS_REQUIRED) && !empty($this->code_null)) {
182  $strikestart = '<strike>';
183  $strikeend = '</strike> '.yn(1, 1, 2).' ('.$langs->trans("ForcedToByAModule", $langs->transnoentities("yes")).')';
184  }
185 
186  $s = '';
187  $s .= $langs->trans("Name").': <b>'.$this->getName().'</b><br>';
188  $s .= $langs->trans("Version").': <b>'.$this->getVersion().'</b><br>';
189  $s .= $langs->trans("MemberCodeDesc").'<br>';
190  $s .= $langs->trans("ValidityControledByModule").': <b>'.$this->getName().'</b><br>';
191  $s .= '<br>';
192  $s .= '<u>'.$langs->trans("ThisIsModuleRules").':</u><br>';
193 
194  $s .= $langs->trans("Required").': '.$strikestart;
195  $s .= yn(!$this->code_null, 1, 2).$strikeend;
196  $s .= '<br>';
197  $s .= $langs->trans("CanBeModifiedIfOk").': ';
198  $s .= yn($this->code_modifiable, 1, 2);
199  $s .= '<br>';
200  $s .= $langs->trans("CanBeModifiedIfKo").': '.yn($this->code_modifiable_invalide, 1, 2).'<br>';
201  $s .= $langs->trans("AutomaticCode").': '.yn($this->code_auto, 1, 2).'<br>';
202  $s .= '<br>';
203  $nextval = $this->getNextValue($soc, 0);
204  if (empty($nextval)) {
205  $nextval = $langs->trans("Undefined");
206  }
207  $s .= $langs->trans("NextValue").' ('.$langs->trans("Member").'): <b>'.$nextval.'</b><br>';
208 
209  return $s;
210  }
211 }
yn
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
Definition: functions.lib.php:6743
ModeleNumRefMembers\isEnabled
isEnabled()
Return if a module can be used or not.
Definition: modules_member.class.php:80
ModeleNumRefMembers
Classe mere des modeles de numerotation des references de members.
Definition: modules_member.class.php:68
ModeleNumRefMembers\getExample
getExample()
Return an example of numbering.
Definition: modules_member.class.php:112
ModeleNumRefMembers\getToolTip
getToolTip($langs, $soc)
Return description of module parameters.
Definition: modules_member.class.php:173
ModelePDFMember
Parent class to manage intervention document templates.
Definition: modules_member.class.php:35
ModeleNumRefMembers\canBeActivated
canBeActivated()
Checks if the numbers already in the database do not cause conflicts that would prevent this numberin...
Definition: modules_member.class.php:125
ModeleNumRefMembers\getNextValue
getNextValue($objsoc, $object)
Renvoi prochaine valeur attribuee.
Definition: modules_member.class.php:137
ModelePDFMember\liste_modeles
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation modules.
Definition: modules_member.class.php:51
getListOfModels
getListOfModels($db, $type, $maxfilenamelength=0)
Return list of activated modules usable for document generation.
Definition: functions2.lib.php:1925
CommonDocGenerator
Parent class for documents generators.
Definition: commondocgenerator.class.php:36
ModeleNumRefMembers\getName
getName()
Return name of module.
Definition: modules_member.class.php:102
ModeleNumRefMembers\getVersion
getVersion()
Renvoi version du module numerotation.
Definition: modules_member.class.php:148
ModeleNumRefMembers\info
info()
Returns the default description of the numbering pattern.
Definition: modules_member.class.php:90