Passed
Branch develop (ad461a)
by
unknown
27:24
created

modIntracommreport::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 89
Code Lines 50

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 50
nc 2
nop 1
dl 0
loc 89
rs 9.0909
c 0
b 0
f 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
/* Copyright (C) 2003       Rodolphe Quiedeville    <[email protected]>
3
 * Copyright (C) 2004-2012  Laurent Destailleur     <[email protected]>
4
 * Copyright (C) 2005-2012  Regis Houssin           <[email protected]>
5
 * Copyright (C) 2019       Open-DSI                <[email protected]>
6
 *
7
 * This program is free software; you can redistribute it and/or modify
8
 * it under the terms of the GNU General Public License as published by
9
 * the Free Software Foundation; either version 3 of the License, or
10
 * (at your option) any later version.
11
 *
12
 * This program is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 * GNU General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU General Public License
18
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19
 */
20
21
/**
22
 *  \file       htdocs/core/modules/modIntracommreport.class.php
23
 * 	\ingroup    Intracomm report
24
 *	\brief      Module to activate intracomm report module
25
 */
26
include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
27
28
29
/**
30
 *  Description and activation class for module intracommreport
31
 */
32
class modIntracommreport extends DolibarrModules
33
{
34
	/**
35
	 *   Constructor. Define names, constants, directories, boxes, permissions
36
	 *
37
	 *   @param      DoliDB		$db      Database handler
38
	 */
39
	public function __construct($db)
40
	{
41
        global $conf, $langs;
42
43
        $this->db = $db;
44
        $this->numero = 68000;
45
46
        $this->family = "financial";
47
        $this->module_position = '100';
48
        // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
49
        $this->name = preg_replace('/^mod/i', '', get_class($this));
50
        $this->description = "Intracomm report management (Support for French DEB/DES format)";
51
52
        // Possible values for version are: 'development', 'experimental', 'dolibarr' or 'dolibarr_deprecated' or version
53
        $this->version = 'development';
54
55
        $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name);
56
        $this->picto = 'intracommreport';
57
58
        // Data directories to create when module is enabled
59
        $this->dirs = array('/intracommreport/temp');
60
61
        // Config pages
62
        $this->config_page_url = array("intracommreport.php@intracommreport");
63
64
		// Dependencies
65
		$this->depends = array("modFacture","modTax");  // List of modules id that must be enabled if this module is enabled
66
		$this->requiredby = array();                    // List of modules id to disable if this one is disabled
67
		$this->conflictwith = array();                  // List of modules id this module is in conflict with
68
		$this->phpmin = array(5,5);                     // Minimum version of PHP required by module
69
		$this->need_dolibarr_version = array(13, 0, -5);     // Minimum version of Dolibarr required by module
70
		$this->langfiles = array("intracommreport");
71
72
		// Constants
73
		// List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
74
		// Example: $this->const=array(0=>array('MYMODULE_MYNEWCONST1','chaine','myvalue','This is a constant to add',1),
75
		//                             1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0, 'current', 1)
76
		// );
77
		$this->const = array();
78
79
        // Tabs
80
        $this->tabs = array();
81
82
        // Css
83
        $this->module_parts = array();
84
85
        // Boxes
86
        $this->boxes = array();
87
88
        // Dictionaries
89
	    if (! isset($conf->intracommreport->enabled))
90
        {
91
        	$conf->intracommreport=new stdClass();
92
        	$conf->intracommreport->enabled=0;
93
        }
94
		$this->dictionaries=array();
95
96
        // Permissions
97
		$this->rights = array();
98
		$this->rights_class = 'intracommreport';
99
        $r = 0;
100
101
        $r++;
102
        $this->rights[$r][0] = 68001;
103
        $this->rights[$r][1] = 'Read intracomm report';
104
        $this->rights[$r][2] = 'r';
105
        $this->rights[$r][3] = 0;
106
        $this->rights[$r][4] = 'read';
107
108
        $r++;
109
        $this->rights[$r][0] = 68002;
110
        $this->rights[$r][1] = 'Create/modify intracomm report';
111
        $this->rights[$r][2] = 'w';
112
        $this->rights[$r][3] = 0;
113
        $this->rights[$r][4] = 'write';
114
115
		$r++;
116
        $this->rights[$r][0] = 68004;
117
        $this->rights[$r][1] = 'Delete intracomm report';
118
        $this->rights[$r][2] = 'd';
119
        $this->rights[$r][3] = 0;
120
        $this->rights[$r][4] = 'delete';
121
122
		// Main menu entries
123
		$this->menu = array();			// List of menus to add
124
		$r=0;
125
126
		// Exports
127
		$r=1;
128
	}
129
}
130