dolibarr  7.0.0-beta
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 <http://www.gnu.org/licenses/>.
17  * or see http://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 
42  var $nom='Leopard'; // Nom du modele
43  var $name='Leopard'; // Nom du modele
44  var $code_modifiable; // Code modifiable
45  var $code_modifiable_invalide; // Code modifiable si il est invalide
46  var $code_modifiable_null; // Code modifiables si il est null
47  var $code_null; // Code facultatif
48  var $version='dolibarr'; // 'development', 'experimental', 'dolibarr'
49  var $code_auto; // Numerotation automatique
50 
51 
55  function __construct()
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 
70  function info($langs)
71  {
72  $langs->load("companies");
73  return $langs->trans("LeopardNumRefModelDesc");
74  }
75 
76 
84  function getNextValue($objproduct=0,$type=-1)
85  {
86  global $langs;
87  return '';
88  }
89 
90 
104  function verif($db, &$code, $product, $type)
105  {
106  global $conf;
107 
108  $result=0;
109  $code = strtoupper(trim($code));
110 
111  if (empty($code) && $this->code_null && empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED))
112  {
113  $result=0;
114  }
115  else if (empty($code) && (! $this->code_null || ! empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED)) )
116  {
117  $result=-2;
118  }
119 
120  dol_syslog("mod_codeproduct_leopard::verif type=".$type." result=".$result);
121  return $result;
122  }
123 }
124 
getNextValue($objproduct=0, $type=-1)
Return an example of result returned by getNextValue.
Classe permettant la gestion leopard des codes produits.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='')
Write log message into outputs.
info($langs)
Return description of module.
verif($db, &$code, $product, $type)
Check validity of code according to its rules.
Parent class for product code generators.