dolibarr 20.0.0
mod_codeclient_leopard.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2006-2014 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
5 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.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
28require_once DOL_DOCUMENT_ROOT.'/core/modules/societe/modules_societe.class.php';
29
30
35{
36 /*
37 * Attention ce module est utilise par default si aucun module n'a
38 * ete definite dans la configuration
39 *
40 * Le fonctionnement de celui-ci doit donc rester le plus ouvert possible
41 */
42
43 // variables inherited from ModeleThirdPartyCode class
44 public $name = 'Leopard';
45 public $version = 'dolibarr';
46
47
53 public function __construct($db)
54 {
55 $this->db = $db;
56
57 $this->code_null = 1;
58 $this->code_modifiable = 1;
59 $this->code_modifiable_invalide = 1;
60 $this->code_modifiable_null = 1;
61 $this->code_auto = 0;
62 }
63
64
71 public function info($langs)
72 {
73 $langs->load("companies");
74 return $langs->trans("LeopardNumRefModelDesc");
75 }
76
85 public function getExample($langs, $objsoc = '', $type = -1)
86 {
87 return '';
88 }
89
97 public function getNextValue($objsoc = '', $type = -1)
98 {
99 return '';
100 }
101
102
116 public function verif($db, &$code, $soc, $type)
117 {
118 $result = 0;
119 $code = trim($code);
120
121 if (empty($code) && $this->code_null && !getDolGlobalString('MAIN_COMPANY_CODE_ALWAYS_REQUIRED')) {
122 $result = 0;
123 } elseif (empty($code) && (!$this->code_null || getDolGlobalString('MAIN_COMPANY_CODE_ALWAYS_REQUIRED'))) {
124 $result = -2;
125 }
126
127 dol_syslog(get_class($this)."::verif type=".$type." result=".$result);
128 return $result;
129 }
130}
Parent class for third parties code generators.
Class to manage numbering of thirdparties code.
verif($db, &$code, $soc, $type)
Check validity of code according to its rules.
info($langs)
Return description of module.
getNextValue($objsoc='', $type=-1)
Return an example of result returned by getNextValue.
getExample($langs, $objsoc='', $type=-1)
Return an example of result returned by getNextValue.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.