Completed
Branch develop (eec106)
by
unknown
20:48
created

ModeleNumRefSupplierPayments::isEnabled()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
/* Copyright (C) 2015      Juanjo Menent	    <[email protected]>
3
 *
4
 * This program is free software; you can redistribute it and/or modify
5
 * it under the terms of the GNU General Public License as published by
6
 * the Free Software Foundation; either version 3 of the License, or
7
 * (at your option) any later version.
8
 *
9
 * This program is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 * GNU General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU General Public License
15
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16
 * or see http://www.gnu.org/
17
 */
18
19
require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
20
/**
21
 *	Parent class for supplier invoices models
22
 */
23
abstract class ModelePDFSuppliersPayments extends CommonDocGenerator
24
{
25
	var $error='';
26
27
28
	/**
29
	 *  Return list of active generation models
30
	 *
31
     *  @param	DoliDB	$db     			Database handler
32
     *  @param  integer	$maxfilenamelength  Max length of value to show
33
     *  @return	array						List of numbers
34
	 */
35
	static function liste_modeles($db,$maxfilenamelength=0)
36
	{
37
		global $conf;
38
39
		$type='supplier_payment';
40
		$liste=array();
41
42
		include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
43
		$liste=getListOfModels($db,$type,$maxfilenamelength);
44
45
		return $liste;
46
	}
47
48
}
49
50
/**
51
 *  \class      ModeleNumRefSupplierPayments
52
 *  \brief      Payment numbering references mother class
53
 */
54
55
abstract class ModeleNumRefSupplierPayments
56
{
57
	var $error='';
58
59
	/**
60
	 *	Return if a module can be used or not
61
	 *
62
	 *	@return		boolean     true if module can be used
63
	 */
64
	function isEnabled()
65
	{
66
		return true;
67
	}
68
69
	/**
70
	 *	Return the default description of numbering module
71
	 *
72
	 *	@return     string      Texte descripif
73
	 */
74
	function info()
75
	{
76
		global $langs;
77
		$langs->load("bills");
78
		return $langs->trans("NoDescription");
79
	}
80
81
	/**
82
	 *	Return numbering example
83
	 *
84
	 *	@return     string      Example
85
	 */
86
	function getExample()
87
	{
88
		global $langs;
89
		$langs->load("bills");
90
		return $langs->trans("NoExample");
91
	}
92
93
	/**
94
	 *  Test if the existing numbers in the database do not cause conflicts that would prevent this numbering run.
95
	 *
96
	 *	@return     boolean     false si conflit, true si ok
97
	 */
98
	function canBeActivated()
99
	{
100
		return true;
101
	}
102
103
	/**
104
	 *	Returns the next value
105
	 *
106
	 *	@param	Societe		$objsoc     Object thirdparty
107
	 *	@param	Object		$object		Object we need next value for
108
	 *	@return	string      Valeur
109
	 */
110
	function getNextValue($objsoc,$object)
111
	{
112
		global $langs;
113
		return $langs->trans("NotAvailable");
114
	}
115
116
	/**
117
	 *	Returns the module numbering version
118
	 *
119
	 *	@return     string      Value
120
	 */
121
	function getVersion()
122
	{
123
		global $langs;
124
		$langs->load("admin");
125
126
		if ($this->version == 'development') return $langs->trans("VersionDevelopment");
127
		if ($this->version == 'experimental') return $langs->trans("VersionExperimental");
128
		if ($this->version == 'dolibarr') return DOL_VERSION;
129
		if ($this->version) return $this->version;
130
		return $langs->trans("NotAvailable");
131
	}
132
}
133