dolibarr 19.0.4
mod_codeproduct_leopard.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 * or see https://www.gnu.org/
18 */
19
26require_once DOL_DOCUMENT_ROOT.'/core/modules/product/modules_product.class.php';
27
28
34{
35 /*
36 * Please note this module is used by default if no module has been defined in the configuration
37 *
38 * Its operation must therefore remain as open as possible
39 */
40
46 public $nom = 'Leopard';
47
51 public $name = 'Leopard';
52
53 public $code_modifiable; // Code modifiable
54
55 public $code_modifiable_invalide; // Code modifiable si il est invalide
56
57 public $code_modifiable_null; // Code modifiables si il est null
58
59 public $code_null; // Code facultatif
60
65 public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
66
70 public $code_auto;
71
72
76 public function __construct()
77 {
78 $this->code_null = 1;
79 $this->code_modifiable = 1;
80 $this->code_modifiable_invalide = 1;
81 $this->code_modifiable_null = 1;
82 $this->code_auto = 0;
83 }
84
85
92 public function info($langs)
93 {
94 $langs->load("companies");
95 return $langs->trans("LeopardNumRefModelDesc");
96 }
97
106 public function getExample($langs, $objproduct = 0, $type = -1)
107 {
108 return '';
109 }
110
118 public function getNextValue($objproduct = 0, $type = -1)
119 {
120 return '';
121 }
122
123
137 public function verif($db, &$code, $product, $type)
138 {
139 global $conf;
140
141 $result = 0;
142 $code = strtoupper(trim($code));
143
144 if (empty($code) && $this->code_null && !getDolGlobalString('MAIN_COMPANY_CODE_ALWAYS_REQUIRED')) {
145 $result = 0;
146 } elseif (empty($code) && (!$this->code_null || getDolGlobalString('MAIN_COMPANY_CODE_ALWAYS_REQUIRED'))) {
147 $result = -2;
148 }
149
150 dol_syslog("mod_codeproduct_leopard::verif type=".$type." result=".$result);
151 return $result;
152 }
153}
Class template for classes of numbering product.
Classe permettant la gestion leopard des codes produits.
getExample($langs, $objproduct=0, $type=-1)
Return an example of result returned by getNextValue.
verif($db, &$code, $product, $type)
Check validity of code according to its rules.
info($langs)
Return description of module.
getNextValue($objproduct=0, $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.