Completed
Branch develop (68bb95)
by
unknown
53:54
created

ModeleNumRefBoms::canBeActivated()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <[email protected]>
3
 * Copyright (C) 2004-2011 Laurent Destailleur  <[email protected]>
4
 * Copyright (C) 2004      Eric Seigne          <[email protected]>
5
 * Copyright (C) 2005-2012 Regis Houssin        <[email protected]>
6
 * Copyright (C) 2006      Andre Cianfarani     <[email protected]>
7
 * Copyright (C) 2012      Juanjo Menent	    <[email protected]>
8
 * Copyright (C) 2014      Marcos García        <[email protected]>
9
 *
10
 * This program is free software; you can redistribute it and/or modify
11
 * it under the terms of the GNU General Public License as published by
12
 * the Free Software Foundation; either version 3 of the License, or
13
 * (at your option) any later version.
14
 *
15
 * This program is distributed in the hope that it will be useful,
16
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 * GNU General Public License for more details.
19
 *
20
 * You should have received a copy of the GNU General Public License
21
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22
 * or see http://www.gnu.org/
23
 */
24
25
/**
26
 *  \file			htdocs/core/modules/bom/modules_bom.php
27
 *  \ingroup		bom
28
 *  \brief			File that contains parent class for boms models
29
 *                  and parent class for boms numbering models
30
 */
31
32
require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
33
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';	// required for use by classes that inherit
34
35
36
/**
37
 *	Parent class for boms models
38
 */
39
abstract class ModelePDFBoms extends CommonDocGenerator
40
{
41
42
    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
43
    /**
44
     *  Return list of active generation modules
45
     *
46
     *  @param	DoliDB	$db     			Database handler
47
     *  @param  integer	$maxfilenamelength  Max length of value to show
48
     *  @return	array						List of templates
49
	 */
50
	public static function liste_modeles($db, $maxfilenamelength = 0)
51
	{
52
        // phpcs:enable
53
		global $conf;
54
55
		$type = 'order';
56
		$list = array();
57
58
		include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
59
		$list = getListOfModels($db, $type, $maxfilenamelength);
60
61
		return $list;
62
	}
63
}
64
65
66
67
/**
68
 *  Parent class to manage numbering of BOMs
69
 */
70
abstract class ModeleNumRefBoms
71
{
72
	/**
73
	 * @var string Error code (or message)
74
	 */
75
	public $error='';
76
77
	/**
78
	 *	Return if a module can be used or not
79
	 *
80
	 *	@return		boolean     true if module can be used
81
	 */
82
	public function isEnabled()
83
	{
84
		return true;
85
	}
86
87
	/**
88
	 *	Renvoie la description par defaut du modele de numerotation
89
	 *
90
	 *	@return     string      Texte descripif
91
	 */
92
	public function info()
93
	{
94
		global $langs;
95
		$langs->load("mrp");
96
		return $langs->trans("NoDescription");
97
	}
98
99
	/**
100
	 *	Renvoie un exemple de numerotation
101
	 *
102
	 *	@return     string      Example
103
	 */
104
	public function getExample()
105
	{
106
		global $langs;
107
		$langs->load("mrp");
108
		return $langs->trans("NoExample");
109
	}
110
111
	/**
112
	 *	Test si les numeros deja en vigueur dans la base ne provoquent pas de conflits qui empecheraient cette numerotation de fonctionner.
113
	 *
114
	 *	@return     boolean     false si conflit, true si ok
115
	 */
116
	public function canBeActivated()
117
	{
118
		return true;
119
	}
120
121
	/**
122
	 *	Renvoie prochaine valeur attribuee
123
	 *
124
	 *	@param	Societe		$objsoc     Object thirdparty
125
	 *	@param	Object		$object		Object we need next value for
126
	 *	@return	string      Valeur
127
	 */
128
	public function getNextValue($objsoc, $object)
129
	{
130
		global $langs;
131
		return $langs->trans("NotAvailable");
132
	}
133
134
	/**
135
	 *	Renvoie version du module numerotation
136
	 *
137
	 *	@return     string      Valeur
138
	 */
139
	public function getVersion()
140
	{
141
		global $langs;
142
		$langs->load("admin");
143
144
		if ($this->version == 'development') return $langs->trans("VersionDevelopment");
145
		if ($this->version == 'experimental') return $langs->trans("VersionExperimental");
146
		if ($this->version == 'dolibarr') return DOL_VERSION;
147
		if ($this->version) return $this->version;
148
		return $langs->trans("NotAvailable");
149
	}
150
}
151