dolibarr  16.0.5
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 
26 require_once DOL_DOCUMENT_ROOT.'/core/modules/product/modules_product.class.php';
27 
28 
34 {
35  /*
36  * Attention ce module est utilise par defaut si aucun module n'a
37  * ete definit dans la configuration
38  *
39  * Le fonctionnement de celui-ci doit donc rester le plus ouvert possible
40  */
41 
47  public $nom = 'Leopard';
48 
52  public $name = 'Leopard';
53 
54  public $code_modifiable; // Code modifiable
55 
56  public $code_modifiable_invalide; // Code modifiable si il est invalide
57 
58  public $code_modifiable_null; // Code modifiables si il est null
59 
60  public $code_null; // Code facultatif
61 
66  public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
67 
71  public $code_auto;
72 
73 
77  public function __construct()
78  {
79  $this->code_null = 1;
80  $this->code_modifiable = 1;
81  $this->code_modifiable_invalide = 1;
82  $this->code_modifiable_null = 1;
83  $this->code_auto = 0;
84  }
85 
86 
93  public function info($langs)
94  {
95  $langs->load("companies");
96  return $langs->trans("LeopardNumRefModelDesc");
97  }
98 
99 
107  public function getNextValue($objproduct = 0, $type = -1)
108  {
109  global $langs;
110  return '';
111  }
112 
113 
127  public function verif($db, &$code, $product, $type)
128  {
129  global $conf;
130 
131  $result = 0;
132  $code = strtoupper(trim($code));
133 
134  if (empty($code) && $this->code_null && empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED)) {
135  $result = 0;
136  } elseif (empty($code) && (!$this->code_null || !empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED))) {
137  $result = -2;
138  }
139 
140  dol_syslog("mod_codeproduct_leopard::verif type=".$type." result=".$result);
141  return $result;
142  }
143 }
mod_codeproduct_leopard\verif
verif($db, &$code, $product, $type)
Check validity of code according to its rules.
Definition: mod_codeproduct_leopard.php:127
ModeleProductCode
Class template for classes of numbering product.
Definition: modules_product.class.php:100
mod_codeproduct_leopard
Classe permettant la gestion leopard des codes produits.
Definition: mod_codeproduct_leopard.php:33
dol_syslog
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
Definition: functions.lib.php:1603
mod_codeproduct_leopard\getNextValue
getNextValue($objproduct=0, $type=-1)
Return an example of result returned by getNextValue.
Definition: mod_codeproduct_leopard.php:107
mod_codeproduct_leopard\__construct
__construct()
Constructor.
Definition: mod_codeproduct_leopard.php:77
mod_codeproduct_leopard\info
info($langs)
Return description of module.
Definition: mod_codeproduct_leopard.php:93