dolibarr 20.0.0
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 * 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/product/modules_product.class.php';
29
30
36{
37 /*
38 * Please note this module is used by default if no module has been defined in the configuration
39 *
40 * Its operation must therefore remain as open as possible
41 */
42
43 // variables inherited from ModelProductCode class
44 public $name = 'Leopard';
45 public $version = 'dolibarr';
46
50 public function __construct()
51 {
52 $this->code_null = 1;
53 $this->code_modifiable = 1;
54 $this->code_modifiable_invalide = 1;
55 $this->code_modifiable_null = 1;
56 $this->code_auto = 0;
57 }
58
59
66 public function info($langs)
67 {
68 $langs->load("companies");
69 return $langs->trans("LeopardNumRefModelDesc");
70 }
71
80 public function getExample($langs, $objproduct = null, $type = -1)
81 {
82 return '';
83 }
84
92 public function getNextValue($objproduct = '', $type = -1)
93 {
94 return '';
95 }
96
97
111 public function verif($db, &$code, $product, $type)
112 {
113 global $conf;
114
115 $result = 0;
116 $code = strtoupper(trim($code));
117
118 if (empty($code) && $this->code_null && !getDolGlobalString('MAIN_COMPANY_CODE_ALWAYS_REQUIRED')) {
119 $result = 0;
120 } elseif (empty($code) && (!$this->code_null || getDolGlobalString('MAIN_COMPANY_CODE_ALWAYS_REQUIRED'))) {
121 $result = -2;
122 }
123
124 dol_syslog("mod_codeproduct_leopard::verif type=".$type." result=".$result);
125 return $result;
126 }
127}
Class template for classes of numbering product.
Class permettant la gestion leopard des codes produits.
verif($db, &$code, $product, $type)
Check validity of code according to its rules.
info($langs)
Return description of module.
getExample($langs, $objproduct=null, $type=-1)
Return an example of result returned by getNextValue.
getNextValue($objproduct='', $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.