dolibarr 25.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
44 public $position = 20;
45
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 }
64 public function info($langs)
65 {
66 global $langs;
67
68 $langs->load("companies");
69 return $langs->trans("LeopardNumRefModelDesc");
70 }
71
77 public function getExample()
78 {
79 return '';
80 }
81
89 public function getNextValue($objsoc, $contract)
90 {
91 return '';
92 }
93
94
108 public function verif($db, &$code, $product, $type)
109 {
110 global $conf;
111
112 $result = 0;
113 $code = strtoupper(trim($code));
114
115 if (empty($code) && $this->code_null && !getDolGlobalString('MAIN_CONTRACT_CODE_ALWAYS_REQUIRED')) {
116 $result = 0;
117 } elseif (empty($code) && (!$this->code_null || getDolGlobalString('MAIN_CONTRACT_CODE_ALWAYS_REQUIRED'))) {
118 $result = -2;
119 }
120
121 dol_syslog("mod_contract_olive::verif type=".$type." result=".$result);
122 return $result;
123 }
124}
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.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.