Passed
Push — master ( b34e09...053e2a )
by
unknown
02:52
created
core/modules/modSubtotal.class.php 1 patch
Indentation   +402 added lines, -402 removed lines patch added patch discarded remove patch
@@ -31,187 +31,187 @@  discard block
 block discarded – undo
31 31
 class modSubtotal extends DolibarrModules
32 32
 {
33 33
 
34
-    /**
35
-     * 	Constructor. Define names, constants, directories, boxes, permissions
36
-     *
37
-     * 	@param	DoliDB		$db	Database handler
38
-     */
34
+	/**
35
+	 * 	Constructor. Define names, constants, directories, boxes, permissions
36
+	 *
37
+	 * 	@param	DoliDB		$db	Database handler
38
+	 */
39 39
      
40
-    public function __construct($db)
41
-    {
42
-        global $langs, $conf;
40
+	public function __construct($db)
41
+	{
42
+		global $langs, $conf;
43 43
 
44
-        $this->db = $db;
44
+		$this->db = $db;
45 45
 
46 46
 		$this->editor_name = 'ATM-Consulting';
47
-        // Id for module (must be unique).
48
-        // Use a free id here
49
-        // (See in Home -> System information -> Dolibarr for list of used modules id).
50
-        $this->numero = 104777; // 104000 to 104999 for ATM CONSULTING
51
-        // Key text used to identify module (for permissions, menus, etc...)
52
-        $this->rights_class = 'subtotal';
47
+		// Id for module (must be unique).
48
+		// Use a free id here
49
+		// (See in Home -> System information -> Dolibarr for list of used modules id).
50
+		$this->numero = 104777; // 104000 to 104999 for ATM CONSULTING
51
+		// Key text used to identify module (for permissions, menus, etc...)
52
+		$this->rights_class = 'subtotal';
53 53
 
54
-        // Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
55
-        // It is used to group modules in module setup page
56
-        $this->family = "technic";
57
-        // Module label (no space allowed)
58
-        // used if translation string 'ModuleXXXName' not found
59
-        // (where XXX is value of numeric property 'numero' of module)
60
-        $this->name = preg_replace('/^mod/i', '', get_class($this));
61
-        // Module description
62
-        // used if translation string 'ModuleXXXDesc' not found
63
-        // (where XXX is value of numeric property 'numero' of module)
64
-        $this->description = "Module permettant l'ajout de sous-totaux et sous-totaux intermédiaires et le déplacement d'une ligne aisée de l'un dans l'autre";
65
-        // Possible values for version are: 'development', 'experimental' or version
66
-        $this->version = '3.3.1';
67
-        // Key used in llx_const table to save module status enabled/disabled
68
-        // (where MYMODULE is value of property name of module in uppercase)
69
-        $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name);
70
-        // Where to store the module in setup page
71
-        // (0=common,1=interface,2=others,3=very specific)
72
-        $this->special = 2;
73
-        // Name of image file used for this module.
74
-        // If file is in theme/yourtheme/img directory under name object_pictovalue.png
75
-        // use this->picto='pictovalue'
76
-        // If file is in module/img directory under name object_pictovalue.png
77
-        // use this->picto='pictovalue@module'
78
-        $this->picto = 'subtotal@subtotal'; // mypicto@titre
79
-        // Defined all module parts (triggers, login, substitutions, menus, css, etc...)
80
-        // for default path (eg: /titre/core/xxxxx) (0=disable, 1=enable)
81
-        // for specific path of parts (eg: /titre/core/modules/barcode)
82
-        // for specific css file (eg: /titre/css/titre.css.php)
83
-        $this->module_parts = array(
84
-            // Set this to 1 if module has its own trigger directory
85
-            'triggers' => 1,
86
-            // Set this to 1 if module has its own login method directory
87
-            //'login' => 0,
88
-            // Set this to 1 if module has its own substitution function file
89
-            //'substitutions' => 0,
90
-            // Set this to 1 if module has its own menus handler directory
91
-            //'menus' => 0,
92
-            // Set this to 1 if module has its own barcode directory
93
-            //'barcode' => 0,
94
-            // Set this to 1 if module has its own models directory
95
-            'models' => 1,
96
-            // Set this to relative path of css if module has its own css file
97
-            //'css' => '/titre/css/mycss.css.php',
98
-            // Set here all hooks context managed by module
99
-            'hooks' => array(
100
-                'invoicecard'
101
-                ,'invoicesuppliercard'
102
-                ,'propalcard'
103
-                ,'supplier_proposalcard'
104
-                ,'ordercard'
105
-                ,'ordersuppliercard'
106
-                ,'odtgeneration'
107
-                ,'orderstoinvoice'
108
-                ,'orderstoinvoicesupplier'
109
-                ,'admin'
110
-                ,'invoicereccard'
111
-                ,'consumptionthirdparty'
112
-            	,'ordershipmentcard'
113
-            	,'expeditioncard'
54
+		// Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
55
+		// It is used to group modules in module setup page
56
+		$this->family = "technic";
57
+		// Module label (no space allowed)
58
+		// used if translation string 'ModuleXXXName' not found
59
+		// (where XXX is value of numeric property 'numero' of module)
60
+		$this->name = preg_replace('/^mod/i', '', get_class($this));
61
+		// Module description
62
+		// used if translation string 'ModuleXXXDesc' not found
63
+		// (where XXX is value of numeric property 'numero' of module)
64
+		$this->description = "Module permettant l'ajout de sous-totaux et sous-totaux intermédiaires et le déplacement d'une ligne aisée de l'un dans l'autre";
65
+		// Possible values for version are: 'development', 'experimental' or version
66
+		$this->version = '3.3.1';
67
+		// Key used in llx_const table to save module status enabled/disabled
68
+		// (where MYMODULE is value of property name of module in uppercase)
69
+		$this->const_name = 'MAIN_MODULE_' . strtoupper($this->name);
70
+		// Where to store the module in setup page
71
+		// (0=common,1=interface,2=others,3=very specific)
72
+		$this->special = 2;
73
+		// Name of image file used for this module.
74
+		// If file is in theme/yourtheme/img directory under name object_pictovalue.png
75
+		// use this->picto='pictovalue'
76
+		// If file is in module/img directory under name object_pictovalue.png
77
+		// use this->picto='pictovalue@module'
78
+		$this->picto = 'subtotal@subtotal'; // mypicto@titre
79
+		// Defined all module parts (triggers, login, substitutions, menus, css, etc...)
80
+		// for default path (eg: /titre/core/xxxxx) (0=disable, 1=enable)
81
+		// for specific path of parts (eg: /titre/core/modules/barcode)
82
+		// for specific css file (eg: /titre/css/titre.css.php)
83
+		$this->module_parts = array(
84
+			// Set this to 1 if module has its own trigger directory
85
+			'triggers' => 1,
86
+			// Set this to 1 if module has its own login method directory
87
+			//'login' => 0,
88
+			// Set this to 1 if module has its own substitution function file
89
+			//'substitutions' => 0,
90
+			// Set this to 1 if module has its own menus handler directory
91
+			//'menus' => 0,
92
+			// Set this to 1 if module has its own barcode directory
93
+			//'barcode' => 0,
94
+			// Set this to 1 if module has its own models directory
95
+			'models' => 1,
96
+			// Set this to relative path of css if module has its own css file
97
+			//'css' => '/titre/css/mycss.css.php',
98
+			// Set here all hooks context managed by module
99
+			'hooks' => array(
100
+				'invoicecard'
101
+				,'invoicesuppliercard'
102
+				,'propalcard'
103
+				,'supplier_proposalcard'
104
+				,'ordercard'
105
+				,'ordersuppliercard'
106
+				,'odtgeneration'
107
+				,'orderstoinvoice'
108
+				,'orderstoinvoicesupplier'
109
+				,'admin'
110
+				,'invoicereccard'
111
+				,'consumptionthirdparty'
112
+				,'ordershipmentcard'
113
+				,'expeditioncard'
114 114
 				,'deliverycard'
115 115
 				,'paiementcard'
116
-            )
117
-            // Set here all workflow context managed by module
118
-            //'workflow' => array('order' => array('WORKFLOW_ORDER_AUTOCREATE_INVOICE'))
119
-        );
116
+			)
117
+			// Set here all workflow context managed by module
118
+			//'workflow' => array('order' => array('WORKFLOW_ORDER_AUTOCREATE_INVOICE'))
119
+		);
120 120
 
121
-        // Data directories to create when module is enabled.
122
-        // Example: this->dirs = array("/titre/temp");
123
-        $this->dirs = array();
121
+		// Data directories to create when module is enabled.
122
+		// Example: this->dirs = array("/titre/temp");
123
+		$this->dirs = array();
124 124
 
125
-        // Config pages. Put here list of php pages
126
-        // stored into titre/admin directory, used to setup module.
127
-        $this->config_page_url = array("subtotal_setup.php@subtotal");
125
+		// Config pages. Put here list of php pages
126
+		// stored into titre/admin directory, used to setup module.
127
+		$this->config_page_url = array("subtotal_setup.php@subtotal");
128 128
 
129
-        // Dependencies
130
-        // List of modules id that must be enabled if this module is enabled
131
-        $this->depends = array();
129
+		// Dependencies
130
+		// List of modules id that must be enabled if this module is enabled
131
+		$this->depends = array();
132 132
 
133 133
 		$this->conflictwith=array('modMilestone');
134
-        // List of modules id to disable if this one is disabled
135
-        $this->requiredby = array();
136
-        // Minimum version of PHP required by module
137
-        $this->phpmin = array(5, 3);
138
-        // Minimum version of Dolibarr required by module
139
-        $this->need_dolibarr_version = array(3, 2);
140
-        $this->langfiles = array("subtotal@subtotal"); // langfiles@titre
141
-        // Constants
142
-        // List of particular constants to add when module is enabled
143
-        // (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
144
-        // Example:
145
-        $this->const = array(
146
-            	0=>array(
147
-            		'SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES',
148
-            		'chaine',
149
-            		'I',
150
-            		'Définit le style (B : gras, I : Italique, U : Souligné) des sous titres lorsque le détail des lignes et des ensembles est caché',
151
-            		1
152
-            	)
134
+		// List of modules id to disable if this one is disabled
135
+		$this->requiredby = array();
136
+		// Minimum version of PHP required by module
137
+		$this->phpmin = array(5, 3);
138
+		// Minimum version of Dolibarr required by module
139
+		$this->need_dolibarr_version = array(3, 2);
140
+		$this->langfiles = array("subtotal@subtotal"); // langfiles@titre
141
+		// Constants
142
+		// List of particular constants to add when module is enabled
143
+		// (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
144
+		// Example:
145
+		$this->const = array(
146
+				0=>array(
147
+					'SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES',
148
+					'chaine',
149
+					'I',
150
+					'Définit le style (B : gras, I : Italique, U : Souligné) des sous titres lorsque le détail des lignes et des ensembles est caché',
151
+					1
152
+				)
153 153
 				,1=>array('SUBTOTAL_ALLOW_ADD_BLOCK', 'chaine', '1', 'Permet l\'ajout de titres et sous-totaux')
154 154
 				,2=>array('SUBTOTAL_ALLOW_EDIT_BLOCK', 'chaine', '1', 'Permet de modifier titres et sous-totaux')
155 155
 				,3=>array('SUBTOTAL_ALLOW_REMOVE_BLOCK', 'chaine', '1', 'Permet de supprimer les titres et sous-totaux')
156 156
 				,4=>array('SUBTOTAL_TITLE_STYLE', 'chaine', 'BU')
157 157
 				,5=>array('SUBTOTAL_SUBTOTAL_STYLE', 'chaine', 'B')
158
-            //	1=>array(
159
-            //		'MYMODULE_MYNEWCONST2',
160
-            //		'chaine',
161
-            //		'myvalue',
162
-            //		'This is another constant to add',
163
-            //		0
164
-            //	)
165
-        );
158
+			//	1=>array(
159
+			//		'MYMODULE_MYNEWCONST2',
160
+			//		'chaine',
161
+			//		'myvalue',
162
+			//		'This is another constant to add',
163
+			//		0
164
+			//	)
165
+		);
166 166
 		
167 167
 
168 168
 
169 169
 
170
-        // Array to add new pages in new tabs
171
-        // Example:
172
-        $this->tabs = array(
173
-            //	// To add a new tab identified by code tabname1
174
-            //	'objecttype:+tabname1:Title1:langfile@titre:$user->rights->titre->read:/titre/mynewtab1.php?id=__ID__',
175
-            //	// To add another new tab identified by code tabname2
176
-            //	'objecttype:+tabname2:Title2:langfile@titre:$user->rights->othermodule->read:/titre/mynewtab2.php?id=__ID__',
177
-            //	// To remove an existing tab identified by code tabname
178
-            //	'objecttype:-tabname'
179
-        );
180
-        // where objecttype can be
181
-        // 'thirdparty'			to add a tab in third party view
182
-        // 'intervention'		to add a tab in intervention view
183
-        // 'order_supplier'		to add a tab in supplier order view
184
-        // 'invoice_supplier'	to add a tab in supplier invoice view
185
-        // 'invoice'			to add a tab in customer invoice view
186
-        // 'order'				to add a tab in customer order view
187
-        // 'product'			to add a tab in product view
188
-        // 'stock'				to add a tab in stock view
189
-        // 'propal'				to add a tab in propal view
190
-        // 'member'				to add a tab in fundation member view
191
-        // 'contract'			to add a tab in contract view
192
-        // 'user'				to add a tab in user view
193
-        // 'group'				to add a tab in group view
194
-        // 'contact'			to add a tab in contact view
195
-        // 'categories_x'		to add a tab in category view
196
-        // (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member)
197
-        // Dictionnaries
198
-        if (! isset($conf->subtotal->enabled)) {
199
-            $conf->subtotal=new stdClass();
200
-            $conf->subtotal->enabled = 0;
201
-        }
202
-        $this->dictionaries = array(
170
+		// Array to add new pages in new tabs
171
+		// Example:
172
+		$this->tabs = array(
173
+			//	// To add a new tab identified by code tabname1
174
+			//	'objecttype:+tabname1:Title1:langfile@titre:$user->rights->titre->read:/titre/mynewtab1.php?id=__ID__',
175
+			//	// To add another new tab identified by code tabname2
176
+			//	'objecttype:+tabname2:Title2:langfile@titre:$user->rights->othermodule->read:/titre/mynewtab2.php?id=__ID__',
177
+			//	// To remove an existing tab identified by code tabname
178
+			//	'objecttype:-tabname'
179
+		);
180
+		// where objecttype can be
181
+		// 'thirdparty'			to add a tab in third party view
182
+		// 'intervention'		to add a tab in intervention view
183
+		// 'order_supplier'		to add a tab in supplier order view
184
+		// 'invoice_supplier'	to add a tab in supplier invoice view
185
+		// 'invoice'			to add a tab in customer invoice view
186
+		// 'order'				to add a tab in customer order view
187
+		// 'product'			to add a tab in product view
188
+		// 'stock'				to add a tab in stock view
189
+		// 'propal'				to add a tab in propal view
190
+		// 'member'				to add a tab in fundation member view
191
+		// 'contract'			to add a tab in contract view
192
+		// 'user'				to add a tab in user view
193
+		// 'group'				to add a tab in group view
194
+		// 'contact'			to add a tab in contact view
195
+		// 'categories_x'		to add a tab in category view
196
+		// (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member)
197
+		// Dictionnaries
198
+		if (! isset($conf->subtotal->enabled)) {
199
+			$conf->subtotal=new stdClass();
200
+			$conf->subtotal->enabled = 0;
201
+		}
202
+		$this->dictionaries = array(
203 203
 			'langs'=>'subtotal@subtotal',
204
-            'tabname'=>array(MAIN_DB_PREFIX.'c_subtotal_free_text'),		// List of tables we want to see into dictonnary editor
205
-            'tablib'=>array($langs->trans('subtotalFreeLineDictionary')),													// Label of tables
206
-            'tabsql'=>array('SELECT f.rowid as rowid, f.label, f.content, f.entity, f.active FROM '.MAIN_DB_PREFIX.'c_subtotal_free_text as f WHERE f.entity='.$conf->entity),	// Request to select fields
207
-            'tabsqlsort'=>array('label ASC'),																					// Sort order
208
-            'tabfield'=>array('label,content'),							// List of fields (result of select to show dictionary)
209
-            'tabfieldvalue'=>array('label,content'),						// List of fields (list of fields to edit a record)
210
-            'tabfieldinsert'=>array('label,content,entity'),					// List of fields (list of fields for insert)
211
-            'tabrowid'=>array('rowid'),											// Name of columns with primary key (try to always name it 'rowid')
212
-            'tabcond'=>array($conf->subtotal->enabled)	
204
+			'tabname'=>array(MAIN_DB_PREFIX.'c_subtotal_free_text'),		// List of tables we want to see into dictonnary editor
205
+			'tablib'=>array($langs->trans('subtotalFreeLineDictionary')),													// Label of tables
206
+			'tabsql'=>array('SELECT f.rowid as rowid, f.label, f.content, f.entity, f.active FROM '.MAIN_DB_PREFIX.'c_subtotal_free_text as f WHERE f.entity='.$conf->entity),	// Request to select fields
207
+			'tabsqlsort'=>array('label ASC'),																					// Sort order
208
+			'tabfield'=>array('label,content'),							// List of fields (result of select to show dictionary)
209
+			'tabfieldvalue'=>array('label,content'),						// List of fields (list of fields to edit a record)
210
+			'tabfieldinsert'=>array('label,content,entity'),					// List of fields (list of fields for insert)
211
+			'tabrowid'=>array('rowid'),											// Name of columns with primary key (try to always name it 'rowid')
212
+			'tabcond'=>array($conf->subtotal->enabled)	
213 213
 		);
214
-        /* Example:
214
+		/* Example:
215 215
           // This is to avoid warnings
216 216
           if (! isset($conf->titre->enabled)) $conf->titre->enabled=0;
217 217
           $this->dictionnaries=array(
@@ -252,223 +252,223 @@  discard block
 block discarded – undo
252 252
           );
253 253
          */
254 254
 
255
-        // Boxes
256
-        // Add here list of php file(s) stored in core/boxes that contains class to show a box.
257
-        $this->boxes = array(); // Boxes list
255
+		// Boxes
256
+		// Add here list of php file(s) stored in core/boxes that contains class to show a box.
257
+		$this->boxes = array(); // Boxes list
258 258
        
259
-        /*
259
+		/*
260 260
           $this->boxes[$r][1] = "myboxb.php";
261 261
           $r++;
262 262
          */
263 263
 
264
-        // Permissions
265
-        $this->rights = array(); // Permission array used by this module
266
-        $r = 0;
264
+		// Permissions
265
+		$this->rights = array(); // Permission array used by this module
266
+		$r = 0;
267 267
 
268
-        // Add here list of permission defined by
269
-        // an id, a label, a boolean and two constant strings.
270
-        // Example:
271
-        //// Permission id (must not be already used)
272
-        //$this->rights[$r][0] = 2000;
273
-        //// Permission label
274
-        //$this->rights[$r][1] = 'Permision label';
275
-        //// Permission by default for new user (0/1)
276
-        //$this->rights[$r][3] = 1;
277
-        //// In php code, permission will be checked by test
278
-        //// if ($user->rights->permkey->level1->level2)
279
-        //$this->rights[$r][4] = 'level1';
280
-        //// In php code, permission will be checked by test
281
-        //// if ($user->rights->permkey->level1->level2)
282
-        //$this->rights[$r][5] = 'level2';
283
-        //$r++;
284
-        // Main menu entries
285
-        $this->menus = array(); // List of menus to add
286
-        $r = 0;
268
+		// Add here list of permission defined by
269
+		// an id, a label, a boolean and two constant strings.
270
+		// Example:
271
+		//// Permission id (must not be already used)
272
+		//$this->rights[$r][0] = 2000;
273
+		//// Permission label
274
+		//$this->rights[$r][1] = 'Permision label';
275
+		//// Permission by default for new user (0/1)
276
+		//$this->rights[$r][3] = 1;
277
+		//// In php code, permission will be checked by test
278
+		//// if ($user->rights->permkey->level1->level2)
279
+		//$this->rights[$r][4] = 'level1';
280
+		//// In php code, permission will be checked by test
281
+		//// if ($user->rights->permkey->level1->level2)
282
+		//$this->rights[$r][5] = 'level2';
283
+		//$r++;
284
+		// Main menu entries
285
+		$this->menus = array(); // List of menus to add
286
+		$r = 0;
287 287
 
288
-        // Add here entries to declare new menus
289
-        //
290
-        // Example to declare a new Top Menu entry and its Left menu entry:
291
-        //$this->menu[$r]=array(
292
-        //	// Put 0 if this is a top menu
293
-        //	'fk_menu'=>0,
294
-        //	// This is a Top menu entry
295
-        //	'type'=>'top',
296
-        //	'titre'=>'titre top menu',
297
-        //	'mainmenu'=>'titre',
298
-        //	'leftmenu'=>'titre',
299
-        //	'url'=>'/titre/pagetop.php',
300
-        //	// Lang file to use (without .lang) by module.
301
-        //	// File must be in langs/code_CODE/ directory.
302
-        //	'langs'=>'mylangfile',
303
-        //	'position'=>100,
304
-        //	// Define condition to show or hide menu entry.
305
-        //	// Use '$conf->titre->enabled' if entry must be visible if module is enabled.
306
-        //	'enabled'=>'$conf->titre->enabled',
307
-        //	// Use 'perms'=>'$user->rights->titre->level1->level2'
308
-        //	// if you want your menu with a permission rules
309
-        //	'perms'=>'1',
310
-        //	'target'=>'',
311
-        //	// 0=Menu for internal users, 1=external users, 2=both
312
-        //	'user'=>2
313
-        //);
314
-        //$r++;
315
-        //$this->menu[$r]=array(
316
-        //	// Use r=value where r is index key used for the parent menu entry
317
-        //	// (higher parent must be a top menu entry)
318
-        //	'fk_menu'=>'r=0',
319
-        //	// This is a Left menu entry
320
-        //	'type'=>'left',
321
-        //	'titre'=>'titre left menu',
322
-        //	'mainmenu'=>'titre',
323
-        //	'leftmenu'=>'titre',
324
-        //	'url'=>'/titre/pagelevel1.php',
325
-        //	// Lang file to use (without .lang) by module.
326
-        //	// File must be in langs/code_CODE/ directory.
327
-        //	'langs'=>'mylangfile',
328
-        //	'position'=>100,
329
-        //	// Define condition to show or hide menu entry.
330
-        //	// Use '$conf->titre->enabled' if entry must be visible if module is enabled.
331
-        //	'enabled'=>'$conf->titre->enabled',
332
-        //	// Use 'perms'=>'$user->rights->titre->level1->level2'
333
-        //	// if you want your menu with a permission rules
334
-        //	'perms'=>'1',
335
-        //	'target'=>'',
336
-        //	// 0=Menu for internal users, 1=external users, 2=both
337
-        //	'user'=>2
338
-        //);
339
-        //$r++;
340
-        //
341
-        // Example to declare a Left Menu entry into an existing Top menu entry:
342
-        //$this->menu[$r]=array(
343
-        //	// Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy'
344
-        //	'fk_menu'=>'fk_mainmenu=mainmenucode',
345
-        //	// This is a Left menu entry
346
-        //	'type'=>'left',
347
-        //	'titre'=>'titre left menu',
348
-        //	'mainmenu'=>'mainmenucode',
349
-        //	'leftmenu'=>'titre',
350
-        //	'url'=>'/titre/pagelevel2.php',
351
-        //	// Lang file to use (without .lang) by module.
352
-        //	// File must be in langs/code_CODE/ directory.
353
-        //	'langs'=>'mylangfile',
354
-        //	'position'=>100,
355
-        //	// Define condition to show or hide menu entry.
356
-        //	// Use '$conf->titre->enabled' if entry must be visible if module is enabled.
357
-        //	// Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
358
-        //	'enabled'=>'$conf->titre->enabled',
359
-        //	// Use 'perms'=>'$user->rights->titre->level1->level2'
360
-        //	// if you want your menu with a permission rules
361
-        //	'perms'=>'1',
362
-        //	'target'=>'',
363
-        //	// 0=Menu for internal users, 1=external users, 2=both
364
-        //	'user'=>2
365
-        //);
366
-        //$r++;
367
-        // Exports
368
-        $r = 1;
288
+		// Add here entries to declare new menus
289
+		//
290
+		// Example to declare a new Top Menu entry and its Left menu entry:
291
+		//$this->menu[$r]=array(
292
+		//	// Put 0 if this is a top menu
293
+		//	'fk_menu'=>0,
294
+		//	// This is a Top menu entry
295
+		//	'type'=>'top',
296
+		//	'titre'=>'titre top menu',
297
+		//	'mainmenu'=>'titre',
298
+		//	'leftmenu'=>'titre',
299
+		//	'url'=>'/titre/pagetop.php',
300
+		//	// Lang file to use (without .lang) by module.
301
+		//	// File must be in langs/code_CODE/ directory.
302
+		//	'langs'=>'mylangfile',
303
+		//	'position'=>100,
304
+		//	// Define condition to show or hide menu entry.
305
+		//	// Use '$conf->titre->enabled' if entry must be visible if module is enabled.
306
+		//	'enabled'=>'$conf->titre->enabled',
307
+		//	// Use 'perms'=>'$user->rights->titre->level1->level2'
308
+		//	// if you want your menu with a permission rules
309
+		//	'perms'=>'1',
310
+		//	'target'=>'',
311
+		//	// 0=Menu for internal users, 1=external users, 2=both
312
+		//	'user'=>2
313
+		//);
314
+		//$r++;
315
+		//$this->menu[$r]=array(
316
+		//	// Use r=value where r is index key used for the parent menu entry
317
+		//	// (higher parent must be a top menu entry)
318
+		//	'fk_menu'=>'r=0',
319
+		//	// This is a Left menu entry
320
+		//	'type'=>'left',
321
+		//	'titre'=>'titre left menu',
322
+		//	'mainmenu'=>'titre',
323
+		//	'leftmenu'=>'titre',
324
+		//	'url'=>'/titre/pagelevel1.php',
325
+		//	// Lang file to use (without .lang) by module.
326
+		//	// File must be in langs/code_CODE/ directory.
327
+		//	'langs'=>'mylangfile',
328
+		//	'position'=>100,
329
+		//	// Define condition to show or hide menu entry.
330
+		//	// Use '$conf->titre->enabled' if entry must be visible if module is enabled.
331
+		//	'enabled'=>'$conf->titre->enabled',
332
+		//	// Use 'perms'=>'$user->rights->titre->level1->level2'
333
+		//	// if you want your menu with a permission rules
334
+		//	'perms'=>'1',
335
+		//	'target'=>'',
336
+		//	// 0=Menu for internal users, 1=external users, 2=both
337
+		//	'user'=>2
338
+		//);
339
+		//$r++;
340
+		//
341
+		// Example to declare a Left Menu entry into an existing Top menu entry:
342
+		//$this->menu[$r]=array(
343
+		//	// Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy'
344
+		//	'fk_menu'=>'fk_mainmenu=mainmenucode',
345
+		//	// This is a Left menu entry
346
+		//	'type'=>'left',
347
+		//	'titre'=>'titre left menu',
348
+		//	'mainmenu'=>'mainmenucode',
349
+		//	'leftmenu'=>'titre',
350
+		//	'url'=>'/titre/pagelevel2.php',
351
+		//	// Lang file to use (without .lang) by module.
352
+		//	// File must be in langs/code_CODE/ directory.
353
+		//	'langs'=>'mylangfile',
354
+		//	'position'=>100,
355
+		//	// Define condition to show or hide menu entry.
356
+		//	// Use '$conf->titre->enabled' if entry must be visible if module is enabled.
357
+		//	// Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
358
+		//	'enabled'=>'$conf->titre->enabled',
359
+		//	// Use 'perms'=>'$user->rights->titre->level1->level2'
360
+		//	// if you want your menu with a permission rules
361
+		//	'perms'=>'1',
362
+		//	'target'=>'',
363
+		//	// 0=Menu for internal users, 1=external users, 2=both
364
+		//	'user'=>2
365
+		//);
366
+		//$r++;
367
+		// Exports
368
+		$r = 1;
369 369
 
370
-        // Example:
371
-        //$this->export_code[$r]=$this->rights_class.'_'.$r;
372
-        //// Translation key (used only if key ExportDataset_xxx_z not found)
373
-        //$this->export_label[$r]='CustomersInvoicesAndInvoiceLines';
374
-        //// Condition to show export in list (ie: '$user->id==3').
375
-        //// Set to 1 to always show when module is enabled.
376
-        //$this->export_enabled[$r]='1';
377
-        //$this->export_permission[$r]=array(array("facture","facture","export"));
378
-        //$this->export_fields_array[$r]=array(
379
-        //	's.rowid'=>"IdCompany",
380
-        //	's.nom'=>'CompanyName',
381
-        //	's.address'=>'Address',
382
-        //	's.cp'=>'Zip',
383
-        //	's.ville'=>'Town',
384
-        //	's.fk_pays'=>'Country',
385
-        //	's.tel'=>'Phone',
386
-        //	's.siren'=>'ProfId1',
387
-        //	's.siret'=>'ProfId2',
388
-        //	's.ape'=>'ProfId3',
389
-        //	's.idprof4'=>'ProfId4',
390
-        //	's.code_compta'=>'CustomerAccountancyCode',
391
-        //	's.code_compta_fournisseur'=>'SupplierAccountancyCode',
392
-        //	'f.rowid'=>"InvoiceId",
393
-        //	'f.facnumber'=>"InvoiceRef",
394
-        //	'f.datec'=>"InvoiceDateCreation",
395
-        //	'f.datef'=>"DateInvoice",
396
-        //	'f.total'=>"TotalHT",
397
-        //	'f.total_ttc'=>"TotalTTC",
398
-        //	'f.tva'=>"TotalVAT",
399
-        //	'f.paye'=>"InvoicePaid",
400
-        //	'f.fk_statut'=>'InvoiceStatus',
401
-        //	'f.note'=>"InvoiceNote",
402
-        //	'fd.rowid'=>'LineId',
403
-        //	'fd.description'=>"LineDescription",
404
-        //	'fd.price'=>"LineUnitPrice",
405
-        //	'fd.tva_tx'=>"LineVATRate",
406
-        //	'fd.qty'=>"LineQty",
407
-        //	'fd.total_ht'=>"LineTotalHT",
408
-        //	'fd.total_tva'=>"LineTotalTVA",
409
-        //	'fd.total_ttc'=>"LineTotalTTC",
410
-        //	'fd.date_start'=>"DateStart",
411
-        //	'fd.date_end'=>"DateEnd",
412
-        //	'fd.fk_product'=>'ProductId',
413
-        //	'p.ref'=>'ProductRef'
414
-        //);
415
-        //$this->export_entities_array[$r]=array('s.rowid'=>"company",
416
-        //	's.nom'=>'company',
417
-        //	's.address'=>'company',
418
-        //	's.cp'=>'company',
419
-        //	's.ville'=>'company',
420
-        //	's.fk_pays'=>'company',
421
-        //	's.tel'=>'company',
422
-        //	's.siren'=>'company',
423
-        //	's.siret'=>'company',
424
-        //	's.ape'=>'company',
425
-        //	's.idprof4'=>'company',
426
-        //	's.code_compta'=>'company',
427
-        //	's.code_compta_fournisseur'=>'company',
428
-        //	'f.rowid'=>"invoice",
429
-        //	'f.facnumber'=>"invoice",
430
-        //	'f.datec'=>"invoice",
431
-        //	'f.datef'=>"invoice",
432
-        //	'f.total'=>"invoice",
433
-        //	'f.total_ttc'=>"invoice",
434
-        //	'f.tva'=>"invoice",
435
-        //	'f.paye'=>"invoice",
436
-        //	'f.fk_statut'=>'invoice',
437
-        //	'f.note'=>"invoice",
438
-        //	'fd.rowid'=>'invoice_line',
439
-        //	'fd.description'=>"invoice_line",
440
-        //	'fd.price'=>"invoice_line",
441
-        //	'fd.total_ht'=>"invoice_line",
442
-        //	'fd.total_tva'=>"invoice_line",
443
-        //	'fd.total_ttc'=>"invoice_line",
444
-        //	'fd.tva_tx'=>"invoice_line",
445
-        //	'fd.qty'=>"invoice_line",
446
-        //	'fd.date_start'=>"invoice_line",
447
-        //	'fd.date_end'=>"invoice_line",
448
-        //	'fd.fk_product'=>'product',
449
-        //	'p.ref'=>'product'
450
-        //);
451
-        //$this->export_sql_start[$r] = 'SELECT DISTINCT ';
452
-        //$this->export_sql_end[$r] = ' FROM (' . MAIN_DB_PREFIX . 'facture as f, '
453
-        //	. MAIN_DB_PREFIX . 'facturedet as fd, ' . MAIN_DB_PREFIX . 'societe as s)';
454
-        //$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX
455
-        //	. 'product as p on (fd.fk_product = p.rowid)';
456
-        //$this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid '
457
-        //	. 'AND f.rowid = fd.fk_facture';
458
-        //$r++;
459
-    }
370
+		// Example:
371
+		//$this->export_code[$r]=$this->rights_class.'_'.$r;
372
+		//// Translation key (used only if key ExportDataset_xxx_z not found)
373
+		//$this->export_label[$r]='CustomersInvoicesAndInvoiceLines';
374
+		//// Condition to show export in list (ie: '$user->id==3').
375
+		//// Set to 1 to always show when module is enabled.
376
+		//$this->export_enabled[$r]='1';
377
+		//$this->export_permission[$r]=array(array("facture","facture","export"));
378
+		//$this->export_fields_array[$r]=array(
379
+		//	's.rowid'=>"IdCompany",
380
+		//	's.nom'=>'CompanyName',
381
+		//	's.address'=>'Address',
382
+		//	's.cp'=>'Zip',
383
+		//	's.ville'=>'Town',
384
+		//	's.fk_pays'=>'Country',
385
+		//	's.tel'=>'Phone',
386
+		//	's.siren'=>'ProfId1',
387
+		//	's.siret'=>'ProfId2',
388
+		//	's.ape'=>'ProfId3',
389
+		//	's.idprof4'=>'ProfId4',
390
+		//	's.code_compta'=>'CustomerAccountancyCode',
391
+		//	's.code_compta_fournisseur'=>'SupplierAccountancyCode',
392
+		//	'f.rowid'=>"InvoiceId",
393
+		//	'f.facnumber'=>"InvoiceRef",
394
+		//	'f.datec'=>"InvoiceDateCreation",
395
+		//	'f.datef'=>"DateInvoice",
396
+		//	'f.total'=>"TotalHT",
397
+		//	'f.total_ttc'=>"TotalTTC",
398
+		//	'f.tva'=>"TotalVAT",
399
+		//	'f.paye'=>"InvoicePaid",
400
+		//	'f.fk_statut'=>'InvoiceStatus',
401
+		//	'f.note'=>"InvoiceNote",
402
+		//	'fd.rowid'=>'LineId',
403
+		//	'fd.description'=>"LineDescription",
404
+		//	'fd.price'=>"LineUnitPrice",
405
+		//	'fd.tva_tx'=>"LineVATRate",
406
+		//	'fd.qty'=>"LineQty",
407
+		//	'fd.total_ht'=>"LineTotalHT",
408
+		//	'fd.total_tva'=>"LineTotalTVA",
409
+		//	'fd.total_ttc'=>"LineTotalTTC",
410
+		//	'fd.date_start'=>"DateStart",
411
+		//	'fd.date_end'=>"DateEnd",
412
+		//	'fd.fk_product'=>'ProductId',
413
+		//	'p.ref'=>'ProductRef'
414
+		//);
415
+		//$this->export_entities_array[$r]=array('s.rowid'=>"company",
416
+		//	's.nom'=>'company',
417
+		//	's.address'=>'company',
418
+		//	's.cp'=>'company',
419
+		//	's.ville'=>'company',
420
+		//	's.fk_pays'=>'company',
421
+		//	's.tel'=>'company',
422
+		//	's.siren'=>'company',
423
+		//	's.siret'=>'company',
424
+		//	's.ape'=>'company',
425
+		//	's.idprof4'=>'company',
426
+		//	's.code_compta'=>'company',
427
+		//	's.code_compta_fournisseur'=>'company',
428
+		//	'f.rowid'=>"invoice",
429
+		//	'f.facnumber'=>"invoice",
430
+		//	'f.datec'=>"invoice",
431
+		//	'f.datef'=>"invoice",
432
+		//	'f.total'=>"invoice",
433
+		//	'f.total_ttc'=>"invoice",
434
+		//	'f.tva'=>"invoice",
435
+		//	'f.paye'=>"invoice",
436
+		//	'f.fk_statut'=>'invoice',
437
+		//	'f.note'=>"invoice",
438
+		//	'fd.rowid'=>'invoice_line',
439
+		//	'fd.description'=>"invoice_line",
440
+		//	'fd.price'=>"invoice_line",
441
+		//	'fd.total_ht'=>"invoice_line",
442
+		//	'fd.total_tva'=>"invoice_line",
443
+		//	'fd.total_ttc'=>"invoice_line",
444
+		//	'fd.tva_tx'=>"invoice_line",
445
+		//	'fd.qty'=>"invoice_line",
446
+		//	'fd.date_start'=>"invoice_line",
447
+		//	'fd.date_end'=>"invoice_line",
448
+		//	'fd.fk_product'=>'product',
449
+		//	'p.ref'=>'product'
450
+		//);
451
+		//$this->export_sql_start[$r] = 'SELECT DISTINCT ';
452
+		//$this->export_sql_end[$r] = ' FROM (' . MAIN_DB_PREFIX . 'facture as f, '
453
+		//	. MAIN_DB_PREFIX . 'facturedet as fd, ' . MAIN_DB_PREFIX . 'societe as s)';
454
+		//$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX
455
+		//	. 'product as p on (fd.fk_product = p.rowid)';
456
+		//$this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid '
457
+		//	. 'AND f.rowid = fd.fk_facture';
458
+		//$r++;
459
+	}
460 460
 
461
-    /**
462
-     * Function called when module is enabled.
463
-     * The init function add constants, boxes, permissions and menus
464
-     * (defined in constructor) into Dolibarr database.
465
-     * It also creates data directories
466
-     *
467
-     * 	@param		string	$options	Options when enabling module ('', 'noboxes')
468
-     * 	@return		int					1 if OK, 0 if KO
469
-     */
470
-    public function init($options = '')
471
-    {
461
+	/**
462
+	 * Function called when module is enabled.
463
+	 * The init function add constants, boxes, permissions and menus
464
+	 * (defined in constructor) into Dolibarr database.
465
+	 * It also creates data directories
466
+	 *
467
+	 * 	@param		string	$options	Options when enabling module ('', 'noboxes')
468
+	 * 	@return		int					1 if OK, 0 if KO
469
+	 */
470
+	public function init($options = '')
471
+	{
472 472
 	  	global $conf, $db;
473 473
 		
474 474
 		
@@ -476,46 +476,46 @@  discard block
 block discarded – undo
476 476
 			exit("Attention, ce module rentre ne conflit avec le module Jalon/Milestones. Merci de le désactiver auparavant.");
477 477
 		}
478 478
       */
479
-	    $sql = array();
479
+		$sql = array();
480 480
 
481
-        $result = $this->loadTables();
482
-        dol_include_once('/core/class/extrafields.class.php');
481
+		$result = $this->loadTables();
482
+		dol_include_once('/core/class/extrafields.class.php');
483 483
 	
484
-        $extra = new ExtraFields($db); // propaldet, commandedet, facturedet
485
-        $TElementType = array('propaldet', 'commandedet', 'facturedet', 'supplier_proposaldet', 'commande_fournisseurdet', 'facture_fourn_det');
486
-        foreach($TElementType as $element_type) {
487
-            $extra->addExtraField('show_total_ht', 'Afficher le Total HT sur le sous-total', 'int', 0, 10, $element_type, 0, 0, '', unserialize('a:1:{s:7:"options";a:1:{s:0:"";N;}}'), 0, '', 0, 1);
488
-            $extra->addExtraField('show_reduc', 'Afficher la réduction sur le sous-total', 'int', 0, 10, $element_type, 0, 0, '', unserialize('a:1:{s:7:"options";a:1:{s:0:"";N;}}'), 0, '', 0, 1);
489
-        }
484
+		$extra = new ExtraFields($db); // propaldet, commandedet, facturedet
485
+		$TElementType = array('propaldet', 'commandedet', 'facturedet', 'supplier_proposaldet', 'commande_fournisseurdet', 'facture_fourn_det');
486
+		foreach($TElementType as $element_type) {
487
+			$extra->addExtraField('show_total_ht', 'Afficher le Total HT sur le sous-total', 'int', 0, 10, $element_type, 0, 0, '', unserialize('a:1:{s:7:"options";a:1:{s:0:"";N;}}'), 0, '', 0, 1);
488
+			$extra->addExtraField('show_reduc', 'Afficher la réduction sur le sous-total', 'int', 0, 10, $element_type, 0, 0, '', unserialize('a:1:{s:7:"options";a:1:{s:0:"";N;}}'), 0, '', 0, 1);
489
+		}
490 490
 		
491
-        return $this->_init($sql, $options);
492
-    }
491
+		return $this->_init($sql, $options);
492
+	}
493 493
 
494
-    /**
495
-     * Function called when module is disabled.
496
-     * Remove from database constants, boxes and permissions from Dolibarr database.
497
-     * Data directories are not deleted
498
-     *
499
-     * 	@param		string	$options	Options when enabling module ('', 'noboxes')
500
-     * 	@return		int					1 if OK, 0 if KO
501
-     */
502
-    public function remove($options = '')
503
-    {
504
-        $sql = array();
494
+	/**
495
+	 * Function called when module is disabled.
496
+	 * Remove from database constants, boxes and permissions from Dolibarr database.
497
+	 * Data directories are not deleted
498
+	 *
499
+	 * 	@param		string	$options	Options when enabling module ('', 'noboxes')
500
+	 * 	@return		int					1 if OK, 0 if KO
501
+	 */
502
+	public function remove($options = '')
503
+	{
504
+		$sql = array();
505 505
 
506
-        return $this->_remove($sql, $options);
507
-    }
506
+		return $this->_remove($sql, $options);
507
+	}
508 508
 
509
-    /**
510
-     * Create tables, keys and data required by module
511
-     * Files llx_table1.sql, llx_table1.key.sql llx_data.sql with create table, create keys
512
-     * and create data commands must be stored in directory /titre/sql/
513
-     * This function is called by this->init
514
-     *
515
-     * 	@return		int		<=0 if KO, >0 if OK
516
-     */
517
-    private function loadTables()
518
-    {
519
-        return $this->_load_tables('/subtotal/sql/');
520
-    }
509
+	/**
510
+	 * Create tables, keys and data required by module
511
+	 * Files llx_table1.sql, llx_table1.key.sql llx_data.sql with create table, create keys
512
+	 * and create data commands must be stored in directory /titre/sql/
513
+	 * This function is called by this->init
514
+	 *
515
+	 * 	@return		int		<=0 if KO, >0 if OK
516
+	 */
517
+	private function loadTables()
518
+	{
519
+		return $this->_load_tables('/subtotal/sql/');
520
+	}
521 521
 }
Please login to merge, or discard this patch.