dolibarr 21.0.0-alpha
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 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
6 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 * or see https://www.gnu.org/
21 */
22
29require_once DOL_DOCUMENT_ROOT.'/core/modules/contract/modules_contract.php';
30
31
36{
37 // variables inherited from ModelNumRefContracts class
38 public $name = 'Olive';
39 public $version = 'dolibarr';
40
41
45 public function __construct()
46 {
47 $this->code_null = 1;
48 $this->code_modifiable = 1;
49 $this->code_modifiable_invalide = 1;
50 $this->code_modifiable_null = 1;
51 $this->code_auto = 0;
52 }
59 public function info($langs)
60 {
61 global $langs;
62
63 $langs->load("companies");
64 return $langs->trans("LeopardNumRefModelDesc");
65 }
66
72 public function getExample()
73 {
74 return '';
75 }
76
84 public function getNextValue($objsoc, $contract)
85 {
86 return '';
87 }
88
89
103 public function verif($db, &$code, $product, $type)
104 {
105 global $conf;
106
107 $result = 0;
108 $code = strtoupper(trim($code));
109
110 if (empty($code) && $this->code_null && !getDolGlobalString('MAIN_CONTRACT_CODE_ALWAYS_REQUIRED')) {
111 $result = 0;
112 } elseif (empty($code) && (!$this->code_null || getDolGlobalString('MAIN_CONTRACT_CODE_ALWAYS_REQUIRED'))) {
113 $result = -2;
114 }
115
116 dol_syslog("mod_contract_olive::verif type=".$type." result=".$result);
117 return $result;
118 }
119}
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.