dolibarr 19.0.3
mod_contract_olive.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) 2014 Floran Henry <florian.henry@open-concept.pro>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 * or see https://www.gnu.org/
19 */
20
27require_once DOL_DOCUMENT_ROOT.'/core/modules/contract/modules_contract.php';
28
29
34{
40 public $nom = 'Olive';
41
45 public $name = 'Olive';
46
47 public $code_modifiable = 1; // Code modifiable
48
49 public $code_modifiable_invalide = 1; // Code modifiable si il est invalide
50
51 public $code_modifiable_null = 1; // Code modifiables si il est null
52
53 public $code_null = 1; // Code facultatif
54
59 public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
60
64 public $code_auto = 0;
65
66
73 public function info($langs)
74 {
75 global $langs;
76
77 $langs->load("companies");
78 return $langs->trans("LeopardNumRefModelDesc");
79 }
80
86 public function getExample()
87 {
88 return '';
89 }
90
98 public function getNextValue($objsoc, $contract)
99 {
100 return '';
101 }
102
103
117 public function verif($db, &$code, $product, $type)
118 {
119 global $conf;
120
121 $result = 0;
122 $code = strtoupper(trim($code));
123
124 if (empty($code) && $this->code_null && !getDolGlobalString('MAIN_CONTRACT_CODE_ALWAYS_REQUIRED')) {
125 $result = 0;
126 } elseif (empty($code) && (!$this->code_null || getDolGlobalString('MAIN_CONTRACT_CODE_ALWAYS_REQUIRED'))) {
127 $result = -2;
128 }
129
130 dol_syslog("mod_contract_olive::verif type=".$type." result=".$result);
131 return $result;
132 }
133}
Parent class for all contract numbering modules.
Class to manage contract numbering rules Olive.
verif($db, &$code, $product, $type)
Check validity of code according to its rules.
info($langs)
Return description of module.
getExample()
Return numbering example.
getNextValue($objsoc, $contract)
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.