Completed
Push — master ( 06978a...0fa0cf )
by
unknown
13s queued 11s
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.2.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.2.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.
core/triggers/interface_90_modSubtotal_subtotaltrigger.class.php 1 patch
Indentation   +567 added lines, -567 removed lines patch added patch discarded remove patch
@@ -36,68 +36,68 @@  discard block
 block discarded – undo
36 36
 class Interfacesubtotaltrigger
37 37
 {
38 38
 
39
-    private $db;
40
-
41
-    /**
42
-     * Constructor
43
-     *
44
-     * 	@param		DoliDB		$db		Database handler
45
-     */
46
-    public function __construct($db)
47
-    {
48
-        $this->db = $db;
49
-
50
-        $this->name = preg_replace('/^Interface/i', '', get_class($this));
51
-        $this->family = "demo";
52
-        $this->description = "Triggers of this module are empty functions."
53
-            . "They have no effect."
54
-            . "They are provided for tutorial purpose only.";
55
-        // 'development', 'experimental', 'dolibarr' or version
56
-        $this->version = 'development';
57
-        $this->picto = 'titre@titre';
58
-    }
59
-
60
-    /**
61
-     * Trigger name
62
-     *
63
-     * 	@return		string	Name of trigger file
64
-     */
65
-    public function getName()
66
-    {
67
-        return $this->name;
68
-    }
69
-
70
-    /**
71
-     * Trigger description
72
-     *
73
-     * 	@return		string	Description of trigger file
74
-     */
75
-    public function getDesc()
76
-    {
77
-        return $this->description;
78
-    }
79
-
80
-    /**
81
-     * Trigger version
82
-     *
83
-     * 	@return		string	Version of trigger file
84
-     */
85
-    public function getVersion()
86
-    {
87
-        global $langs;
88
-        $langs->load("admin");
89
-
90
-        if ($this->version == 'development') {
91
-            return $langs->trans("Development");
92
-        } elseif ($this->version == 'experimental')
93
-
94
-                return $langs->trans("Experimental");
95
-        elseif ($this->version == 'dolibarr') return DOL_VERSION;
96
-        elseif ($this->version) return $this->version;
97
-        else {
98
-            return $langs->trans("Unknown");
99
-        }
100
-    }
39
+	private $db;
40
+
41
+	/**
42
+	 * Constructor
43
+	 *
44
+	 * 	@param		DoliDB		$db		Database handler
45
+	 */
46
+	public function __construct($db)
47
+	{
48
+		$this->db = $db;
49
+
50
+		$this->name = preg_replace('/^Interface/i', '', get_class($this));
51
+		$this->family = "demo";
52
+		$this->description = "Triggers of this module are empty functions."
53
+			. "They have no effect."
54
+			. "They are provided for tutorial purpose only.";
55
+		// 'development', 'experimental', 'dolibarr' or version
56
+		$this->version = 'development';
57
+		$this->picto = 'titre@titre';
58
+	}
59
+
60
+	/**
61
+	 * Trigger name
62
+	 *
63
+	 * 	@return		string	Name of trigger file
64
+	 */
65
+	public function getName()
66
+	{
67
+		return $this->name;
68
+	}
69
+
70
+	/**
71
+	 * Trigger description
72
+	 *
73
+	 * 	@return		string	Description of trigger file
74
+	 */
75
+	public function getDesc()
76
+	{
77
+		return $this->description;
78
+	}
79
+
80
+	/**
81
+	 * Trigger version
82
+	 *
83
+	 * 	@return		string	Version of trigger file
84
+	 */
85
+	public function getVersion()
86
+	{
87
+		global $langs;
88
+		$langs->load("admin");
89
+
90
+		if ($this->version == 'development') {
91
+			return $langs->trans("Development");
92
+		} elseif ($this->version == 'experimental')
93
+
94
+				return $langs->trans("Experimental");
95
+		elseif ($this->version == 'dolibarr') return DOL_VERSION;
96
+		elseif ($this->version) return $this->version;
97
+		else {
98
+			return $langs->trans("Unknown");
99
+		}
100
+	}
101 101
 	
102 102
 	public function addToBegin(&$parent, &$object, $rang)
103 103
 	{
@@ -147,27 +147,27 @@  discard block
 block discarded – undo
147 147
 		}
148 148
 	}
149 149
 	
150
-    /**
151
-     * Function called when a Dolibarrr business event is done.
152
-     * All functions "run_trigger" are triggered if file
153
-     * is inside directory core/triggers
154
-     *
155
-     * 	@param		string		$action		Event action code
156
-     * 	@param		Object		$object		Object
157
-     * 	@param		User		$user		Object user
158
-     * 	@param		Translate	$langs		Object langs
159
-     * 	@param		conf		$conf		Object conf
160
-     * 	@return		int						<0 if KO, 0 if no triggered ran, >0 if OK
161
-     */
162
-    public function run_trigger($action, $object, $user, $langs, $conf)
163
-    {
164
-        // Put here code you want to execute when a Dolibarr business events occurs.
165
-        // Data and type of action are stored into $object and $action
166
-        // Users
167
-        dol_include_once('/subtotal/class/subtotal.class.php');
168
-        $langs->load('subtotal@subtotal');
169
-
170
-        if (!empty($conf->global->SUBTOTAL_ALLOW_ADD_LINE_UNDER_TITLE) && in_array($action, array('LINEPROPAL_INSERT', 'LINEORDER_INSERT', 'LINEBILL_INSERT')))
150
+	/**
151
+	 * Function called when a Dolibarrr business event is done.
152
+	 * All functions "run_trigger" are triggered if file
153
+	 * is inside directory core/triggers
154
+	 *
155
+	 * 	@param		string		$action		Event action code
156
+	 * 	@param		Object		$object		Object
157
+	 * 	@param		User		$user		Object user
158
+	 * 	@param		Translate	$langs		Object langs
159
+	 * 	@param		conf		$conf		Object conf
160
+	 * 	@return		int						<0 if KO, 0 if no triggered ran, >0 if OK
161
+	 */
162
+	public function run_trigger($action, $object, $user, $langs, $conf)
163
+	{
164
+		// Put here code you want to execute when a Dolibarr business events occurs.
165
+		// Data and type of action are stored into $object and $action
166
+		// Users
167
+		dol_include_once('/subtotal/class/subtotal.class.php');
168
+		$langs->load('subtotal@subtotal');
169
+
170
+		if (!empty($conf->global->SUBTOTAL_ALLOW_ADD_LINE_UNDER_TITLE) && in_array($action, array('LINEPROPAL_INSERT', 'LINEORDER_INSERT', 'LINEBILL_INSERT')))
171 171
 		{
172 172
 			
173 173
 			$rang = GETPOST('under_title', 'int'); // Rang du titre
@@ -199,9 +199,9 @@  discard block
 block discarded – undo
199 199
 		}
200 200
         
201 201
 		
202
-        if ($action == 'LINEBILL_INSERT' || $action == 'LINEBILL_SUPPLIER_CREATE')
202
+		if ($action == 'LINEBILL_INSERT' || $action == 'LINEBILL_SUPPLIER_CREATE')
203 203
 		{
204
-		    $is_supplier = $action == 'LINEBILL_SUPPLIER_CREATE' ? true : false;
204
+			$is_supplier = $action == 'LINEBILL_SUPPLIER_CREATE' ? true : false;
205 205
 			$subtotal_add_title_bloc_from_orderstoinvoice = GETPOST('subtotal_add_title_bloc_from_orderstoinvoice');
206 206
 			if (!empty($subtotal_add_title_bloc_from_orderstoinvoice))
207 207
 			{
@@ -211,38 +211,38 @@  discard block
 block discarded – undo
211 211
 				$last_fk_commandedet = TSubtotal::getLastLineOrderId($this->db, $current_fk_commande, $is_supplier);
212 212
 
213 213
 				if (!$is_supplier){
214
-				    $facture = new Facture($this->db);
215
-				    $ret = $facture->fetch($object->fk_facture);
216
-                }
214
+					$facture = new Facture($this->db);
215
+					$ret = $facture->fetch($object->fk_facture);
216
+				}
217 217
 				else
218
-                {
219
-				    $facture = new FactureFournisseur($this->db);
220
-				    $ret = $facture->fetch($object->fk_facture_fourn);
221
-                }
218
+				{
219
+					$facture = new FactureFournisseur($this->db);
220
+					$ret = $facture->fetch($object->fk_facture_fourn);
221
+				}
222 222
 
223 223
 				if ($ret > 0)
224 224
 				{
225 225
 					$rang = !empty($subtotal_current_rang) ? $subtotal_current_rang : $object->rang;
226 226
 					// Si le fk_commande courrant est différent alors on change de commande => ajout d'un titre
227 227
 					if ($current_fk_commande != $subtotal_bloc_previous_fk_commande ) {
228
-                        if (!$is_supplier) $commande = new Commande($this->db);
229
-                        else $commande = new CommandeFournisseur($this->db);
230
-                        $commande->fetch($current_fk_commande);
231
-
232
-                        $label = $conf->global->SUBTOTAL_TEXT_FOR_TITLE_ORDETSTOINVOICE;
233
-                        if (empty($label)) {
234
-                            $label = 'Commande [__REFORDER__]';
235
-                            if (!$is_supplier) $label .= ' - Référence client : [__REFCUSTOMER__]';
236
-                        }
237
-                        $label = str_replace(array('__REFORDER__', '__REFCUSTOMER__'), array($commande->ref, $commande->ref_client), $label);
238
-
239
-                        if (!empty($current_fk_commande)) {
240
-                            TSubtotal::addTitle($facture, $label, 1, $rang);
241
-                            $rang++;
242
-                        }
243
-                    }
244
-
245
-                    $object->rang = $rang;
228
+						if (!$is_supplier) $commande = new Commande($this->db);
229
+						else $commande = new CommandeFournisseur($this->db);
230
+						$commande->fetch($current_fk_commande);
231
+
232
+						$label = $conf->global->SUBTOTAL_TEXT_FOR_TITLE_ORDETSTOINVOICE;
233
+						if (empty($label)) {
234
+							$label = 'Commande [__REFORDER__]';
235
+							if (!$is_supplier) $label .= ' - Référence client : [__REFCUSTOMER__]';
236
+						}
237
+						$label = str_replace(array('__REFORDER__', '__REFCUSTOMER__'), array($commande->ref, $commande->ref_client), $label);
238
+
239
+						if (!empty($current_fk_commande)) {
240
+							TSubtotal::addTitle($facture, $label, 1, $rang);
241
+							$rang++;
242
+						}
243
+					}
244
+
245
+					$object->rang = $rang;
246 246
 					$facture->updateRangOfLine($object->id, $rang);
247 247
 
248 248
 					$rang++;
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 		
272 272
 		if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && in_array($action, array('LINEPROPAL_INSERT', 'LINEPROPAL_UPDATE', 'LINEORDER_INSERT', 'LINEORDER_UPDATE', 'LINEBILL_INSERT', 'LINEBILL_UPDATE')))
273 273
 		{
274
-            if(! function_exists('_updateLineNC')) dol_include_once('/subtotal/lib/subtotal.lib.php');
274
+			if(! function_exists('_updateLineNC')) dol_include_once('/subtotal/lib/subtotal.lib.php');
275 275
 
276 276
 			$doli_action = GETPOST('action');
277 277
 			$set = GETPOST('set');
@@ -337,173 +337,173 @@  discard block
 block discarded – undo
337 337
 		}
338 338
 		
339 339
         
340
-        if ($action == 'USER_LOGIN') {
341
-            dol_syslog(
342
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
343
-            );
344
-        } elseif ($action == 'USER_UPDATE_SESSION') {
345
-            // Warning: To increase performances, this action is triggered only if
346
-            // constant MAIN_ACTIVATE_UPDATESESSIONTRIGGER is set to 1.
347
-            dol_syslog(
348
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
349
-            );
350
-        } elseif ($action == 'USER_CREATE') {
351
-            dol_syslog(
352
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
353
-            );
354
-        } elseif ($action == 'USER_CREATE_FROM_CONTACT') {
355
-            dol_syslog(
356
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
357
-            );
358
-        } elseif ($action == 'USER_MODIFY') {
359
-            dol_syslog(
360
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
361
-            );
362
-        } elseif ($action == 'USER_NEW_PASSWORD') {
363
-            dol_syslog(
364
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
365
-            );
366
-        } elseif ($action == 'USER_ENABLEDISABLE') {
367
-            dol_syslog(
368
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
369
-            );
370
-        } elseif ($action == 'USER_DELETE') {
371
-            dol_syslog(
372
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
373
-            );
374
-        } elseif ($action == 'USER_LOGOUT') {
375
-            dol_syslog(
376
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
377
-            );
378
-        } elseif ($action == 'USER_SETINGROUP') {
379
-            dol_syslog(
380
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
381
-            );
382
-        } elseif ($action == 'USER_REMOVEFROMGROUP') {
383
-            dol_syslog(
384
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
385
-            );
386
-        }
387
-
388
-        // Groups
389
-        elseif ($action == 'GROUP_CREATE') {
390
-            dol_syslog(
391
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
392
-            );
393
-        } elseif ($action == 'GROUP_MODIFY') {
394
-            dol_syslog(
395
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
396
-            );
397
-        } elseif ($action == 'GROUP_DELETE') {
398
-            dol_syslog(
399
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
400
-            );
401
-        }
402
-
403
-        // Companies
404
-        elseif ($action == 'COMPANY_CREATE') {
405
-            dol_syslog(
406
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
407
-            );
408
-        } elseif ($action == 'COMPANY_MODIFY') {
409
-            dol_syslog(
410
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
411
-            );
412
-        } elseif ($action == 'COMPANY_DELETE') {
413
-            dol_syslog(
414
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
415
-            );
416
-        }
417
-
418
-        // Contacts
419
-        elseif ($action == 'CONTACT_CREATE') {
420
-            dol_syslog(
421
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
422
-            );
423
-        } elseif ($action == 'CONTACT_MODIFY') {
424
-            dol_syslog(
425
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
426
-            );
427
-        } elseif ($action == 'CONTACT_DELETE') {
428
-            dol_syslog(
429
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
430
-            );
431
-        }
432
-
433
-        // Products
434
-        elseif ($action == 'PRODUCT_CREATE') {
435
-            dol_syslog(
436
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
437
-            );
438
-        } elseif ($action == 'PRODUCT_MODIFY') {
439
-            dol_syslog(
440
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
441
-            );
442
-        } elseif ($action == 'PRODUCT_DELETE') {
443
-            dol_syslog(
444
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
445
-            );
446
-        }
447
-
448
-        // Customer orders
449
-        elseif ($action == 'ORDER_CREATE') {
450
-            dol_syslog(
451
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
452
-            );
453
-        } elseif ($action == 'ORDER_VALIDATE') {
454
-            dol_syslog(
455
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
456
-            );
457
-        } elseif ($action == 'ORDER_DELETE') {
458
-            dol_syslog(
459
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
460
-            );
461
-        } elseif ($action == 'ORDER_BUILDDOC') {
462
-            dol_syslog(
463
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
464
-            );
465
-        } elseif ($action == 'ORDER_SENTBYMAIL') {
466
-            dol_syslog(
467
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
468
-            );
469
-        } elseif ($action == 'LINEORDER_INSERT') {
470
-            dol_syslog(
471
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
472
-            );
473
-        } elseif ($action == 'LINEORDER_DELETE') {
474
-            dol_syslog(
475
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
476
-            );
477
-        }
478
-
479
-        // Supplier orders
480
-        elseif ($action == 'ORDER_SUPPLIER_CREATE') {
481
-            dol_syslog(
482
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
483
-            );
484
-        } elseif ($action == 'ORDER_SUPPLIER_VALIDATE') {
485
-            dol_syslog(
486
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
487
-            );
488
-        } elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') {
489
-            dol_syslog(
490
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
491
-            );
492
-        } elseif ($action == 'SUPPLIER_ORDER_BUILDDOC') {
493
-            dol_syslog(
494
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
495
-            );
496
-        }
497
-
498
-        // Proposals
499
-        elseif ($action == 'PROPAL_CREATE') {
500
-            dol_syslog(
501
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
502
-            );
503
-        } elseif (in_array($action, array('PROPAL_CLONE', 'ORDER_CLONE', 'BILL_CLONE'))) {
504
-            dol_syslog(
505
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
506
-            );
340
+		if ($action == 'USER_LOGIN') {
341
+			dol_syslog(
342
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
343
+			);
344
+		} elseif ($action == 'USER_UPDATE_SESSION') {
345
+			// Warning: To increase performances, this action is triggered only if
346
+			// constant MAIN_ACTIVATE_UPDATESESSIONTRIGGER is set to 1.
347
+			dol_syslog(
348
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
349
+			);
350
+		} elseif ($action == 'USER_CREATE') {
351
+			dol_syslog(
352
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
353
+			);
354
+		} elseif ($action == 'USER_CREATE_FROM_CONTACT') {
355
+			dol_syslog(
356
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
357
+			);
358
+		} elseif ($action == 'USER_MODIFY') {
359
+			dol_syslog(
360
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
361
+			);
362
+		} elseif ($action == 'USER_NEW_PASSWORD') {
363
+			dol_syslog(
364
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
365
+			);
366
+		} elseif ($action == 'USER_ENABLEDISABLE') {
367
+			dol_syslog(
368
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
369
+			);
370
+		} elseif ($action == 'USER_DELETE') {
371
+			dol_syslog(
372
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
373
+			);
374
+		} elseif ($action == 'USER_LOGOUT') {
375
+			dol_syslog(
376
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
377
+			);
378
+		} elseif ($action == 'USER_SETINGROUP') {
379
+			dol_syslog(
380
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
381
+			);
382
+		} elseif ($action == 'USER_REMOVEFROMGROUP') {
383
+			dol_syslog(
384
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
385
+			);
386
+		}
387
+
388
+		// Groups
389
+		elseif ($action == 'GROUP_CREATE') {
390
+			dol_syslog(
391
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
392
+			);
393
+		} elseif ($action == 'GROUP_MODIFY') {
394
+			dol_syslog(
395
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
396
+			);
397
+		} elseif ($action == 'GROUP_DELETE') {
398
+			dol_syslog(
399
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
400
+			);
401
+		}
402
+
403
+		// Companies
404
+		elseif ($action == 'COMPANY_CREATE') {
405
+			dol_syslog(
406
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
407
+			);
408
+		} elseif ($action == 'COMPANY_MODIFY') {
409
+			dol_syslog(
410
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
411
+			);
412
+		} elseif ($action == 'COMPANY_DELETE') {
413
+			dol_syslog(
414
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
415
+			);
416
+		}
417
+
418
+		// Contacts
419
+		elseif ($action == 'CONTACT_CREATE') {
420
+			dol_syslog(
421
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
422
+			);
423
+		} elseif ($action == 'CONTACT_MODIFY') {
424
+			dol_syslog(
425
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
426
+			);
427
+		} elseif ($action == 'CONTACT_DELETE') {
428
+			dol_syslog(
429
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
430
+			);
431
+		}
432
+
433
+		// Products
434
+		elseif ($action == 'PRODUCT_CREATE') {
435
+			dol_syslog(
436
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
437
+			);
438
+		} elseif ($action == 'PRODUCT_MODIFY') {
439
+			dol_syslog(
440
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
441
+			);
442
+		} elseif ($action == 'PRODUCT_DELETE') {
443
+			dol_syslog(
444
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
445
+			);
446
+		}
447
+
448
+		// Customer orders
449
+		elseif ($action == 'ORDER_CREATE') {
450
+			dol_syslog(
451
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
452
+			);
453
+		} elseif ($action == 'ORDER_VALIDATE') {
454
+			dol_syslog(
455
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
456
+			);
457
+		} elseif ($action == 'ORDER_DELETE') {
458
+			dol_syslog(
459
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
460
+			);
461
+		} elseif ($action == 'ORDER_BUILDDOC') {
462
+			dol_syslog(
463
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
464
+			);
465
+		} elseif ($action == 'ORDER_SENTBYMAIL') {
466
+			dol_syslog(
467
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
468
+			);
469
+		} elseif ($action == 'LINEORDER_INSERT') {
470
+			dol_syslog(
471
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
472
+			);
473
+		} elseif ($action == 'LINEORDER_DELETE') {
474
+			dol_syslog(
475
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
476
+			);
477
+		}
478
+
479
+		// Supplier orders
480
+		elseif ($action == 'ORDER_SUPPLIER_CREATE') {
481
+			dol_syslog(
482
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
483
+			);
484
+		} elseif ($action == 'ORDER_SUPPLIER_VALIDATE') {
485
+			dol_syslog(
486
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
487
+			);
488
+		} elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') {
489
+			dol_syslog(
490
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
491
+			);
492
+		} elseif ($action == 'SUPPLIER_ORDER_BUILDDOC') {
493
+			dol_syslog(
494
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
495
+			);
496
+		}
497
+
498
+		// Proposals
499
+		elseif ($action == 'PROPAL_CREATE') {
500
+			dol_syslog(
501
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
502
+			);
503
+		} elseif (in_array($action, array('PROPAL_CLONE', 'ORDER_CLONE', 'BILL_CLONE'))) {
504
+			dol_syslog(
505
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
506
+			);
507 507
 			
508 508
 			$doli_action = GETPOST('action');
509 509
 
@@ -536,296 +536,296 @@  discard block
 block discarded – undo
536 536
 				if (!empty($line)) $object->update_price(1);
537 537
 			}
538 538
 			
539
-        } elseif ($action == 'PROPAL_MODIFY') {
540
-            dol_syslog(
541
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
542
-            );
543
-        } elseif ($action == 'PROPAL_VALIDATE') {
544
-            dol_syslog(
545
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
546
-            );
547
-        } elseif ($action == 'PROPAL_BUILDDOC') {
548
-            dol_syslog(
549
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
550
-            );
551
-        } elseif ($action == 'PROPAL_SENTBYMAIL') {
552
-            dol_syslog(
553
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
554
-            );
555
-        } elseif ($action == 'PROPAL_CLOSE_SIGNED') {
556
-            dol_syslog(
557
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
558
-            );
559
-        } elseif ($action == 'PROPAL_CLOSE_REFUSED') {
560
-            dol_syslog(
561
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
562
-            );
563
-        } elseif ($action == 'PROPAL_DELETE') {
564
-            dol_syslog(
565
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
566
-            );
567
-        } elseif ($action == 'LINEPROPAL_INSERT') {
568
-            dol_syslog(
569
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
570
-            );
571
-        } elseif ($action == 'LINEPROPAL_MODIFY') {
572
-            dol_syslog(
573
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
574
-            );
575
-        } elseif ($action == 'LINEPROPAL_DELETE') {
576
-            dol_syslog(
577
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
578
-            );
579
-        }
580
-
581
-        // Contracts
582
-        elseif ($action == 'CONTRACT_CREATE') {
583
-            dol_syslog(
584
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
585
-            );
586
-        } elseif ($action == 'CONTRACT_MODIFY') {
587
-            dol_syslog(
588
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
589
-            );
590
-        } elseif ($action == 'CONTRACT_ACTIVATE') {
591
-            dol_syslog(
592
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
593
-            );
594
-        } elseif ($action == 'CONTRACT_CANCEL') {
595
-            dol_syslog(
596
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
597
-            );
598
-        } elseif ($action == 'CONTRACT_CLOSE') {
599
-            dol_syslog(
600
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
601
-            );
602
-        } elseif ($action == 'CONTRACT_DELETE') {
603
-            dol_syslog(
604
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
605
-            );
606
-        }
539
+		} elseif ($action == 'PROPAL_MODIFY') {
540
+			dol_syslog(
541
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
542
+			);
543
+		} elseif ($action == 'PROPAL_VALIDATE') {
544
+			dol_syslog(
545
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
546
+			);
547
+		} elseif ($action == 'PROPAL_BUILDDOC') {
548
+			dol_syslog(
549
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
550
+			);
551
+		} elseif ($action == 'PROPAL_SENTBYMAIL') {
552
+			dol_syslog(
553
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
554
+			);
555
+		} elseif ($action == 'PROPAL_CLOSE_SIGNED') {
556
+			dol_syslog(
557
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
558
+			);
559
+		} elseif ($action == 'PROPAL_CLOSE_REFUSED') {
560
+			dol_syslog(
561
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
562
+			);
563
+		} elseif ($action == 'PROPAL_DELETE') {
564
+			dol_syslog(
565
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
566
+			);
567
+		} elseif ($action == 'LINEPROPAL_INSERT') {
568
+			dol_syslog(
569
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
570
+			);
571
+		} elseif ($action == 'LINEPROPAL_MODIFY') {
572
+			dol_syslog(
573
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
574
+			);
575
+		} elseif ($action == 'LINEPROPAL_DELETE') {
576
+			dol_syslog(
577
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
578
+			);
579
+		}
580
+
581
+		// Contracts
582
+		elseif ($action == 'CONTRACT_CREATE') {
583
+			dol_syslog(
584
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
585
+			);
586
+		} elseif ($action == 'CONTRACT_MODIFY') {
587
+			dol_syslog(
588
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
589
+			);
590
+		} elseif ($action == 'CONTRACT_ACTIVATE') {
591
+			dol_syslog(
592
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
593
+			);
594
+		} elseif ($action == 'CONTRACT_CANCEL') {
595
+			dol_syslog(
596
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
597
+			);
598
+		} elseif ($action == 'CONTRACT_CLOSE') {
599
+			dol_syslog(
600
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
601
+			);
602
+		} elseif ($action == 'CONTRACT_DELETE') {
603
+			dol_syslog(
604
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
605
+			);
606
+		}
607 607
 
608 608
 		elseif ($action == 'BILL_MODIFY') {
609
-            dol_syslog(
610
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
611
-            );
612
-
613
-
614
-            global $conf;
615
-
616
-            if (!empty($conf->global->INVOICE_USE_SITUATION) && $object->element == 'facture' && $object->type == Facture::TYPE_SITUATION)
617
-            {
618
-                $object->situation_final = 1;
619
-                foreach($object->lines as $i => $line) {
620
-                    if(!TSubtotal::isModSubtotalLine($line) && $line->situation_percent != 100){
621
-                        $object->situation_final = 0;
622
-                        break;
623
-                    }
624
-                }
625
-                // ne pas utiliser $object->setFinal ne peut pas marcher
626
-                $sql = 'UPDATE ' . MAIN_DB_PREFIX . 'facture SET situation_final = ' . $object->situation_final . ' where rowid = ' . $object->id;
627
-                $resql=$object->db->query($sql);
628
-            }
629
-
630
-
631
-        } elseif ($action == 'BILL_VALIDATE') {
632
-            dol_syslog(
633
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
634
-            );
635
-        } elseif ($action == 'BILL_BUILDDOC') {
636
-            dol_syslog(
637
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
638
-            );
639
-        } elseif ($action == 'BILL_SENTBYMAIL') {
640
-            dol_syslog(
641
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
642
-            );
643
-        } elseif ($action == 'BILL_CANCEL') {
644
-            dol_syslog(
645
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
646
-            );
647
-        } elseif ($action == 'BILL_DELETE') {
648
-            dol_syslog(
649
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
650
-            );
651
-        } elseif ($action == 'LINEBILL_INSERT') {
609
+			dol_syslog(
610
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
611
+			);
612
+
613
+
614
+			global $conf;
615
+
616
+			if (!empty($conf->global->INVOICE_USE_SITUATION) && $object->element == 'facture' && $object->type == Facture::TYPE_SITUATION)
617
+			{
618
+				$object->situation_final = 1;
619
+				foreach($object->lines as $i => $line) {
620
+					if(!TSubtotal::isModSubtotalLine($line) && $line->situation_percent != 100){
621
+						$object->situation_final = 0;
622
+						break;
623
+					}
624
+				}
625
+				// ne pas utiliser $object->setFinal ne peut pas marcher
626
+				$sql = 'UPDATE ' . MAIN_DB_PREFIX . 'facture SET situation_final = ' . $object->situation_final . ' where rowid = ' . $object->id;
627
+				$resql=$object->db->query($sql);
628
+			}
629
+
630
+
631
+		} elseif ($action == 'BILL_VALIDATE') {
632
+			dol_syslog(
633
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
634
+			);
635
+		} elseif ($action == 'BILL_BUILDDOC') {
636
+			dol_syslog(
637
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
638
+			);
639
+		} elseif ($action == 'BILL_SENTBYMAIL') {
640
+			dol_syslog(
641
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
642
+			);
643
+		} elseif ($action == 'BILL_CANCEL') {
644
+			dol_syslog(
645
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
646
+			);
647
+		} elseif ($action == 'BILL_DELETE') {
648
+			dol_syslog(
649
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
650
+			);
651
+		} elseif ($action == 'LINEBILL_INSERT') {
652 652
 				
653
-        	dol_syslog(
654
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
655
-            );
656
-        } elseif ($action == 'LINEBILL_DELETE') {
657
-            dol_syslog(
658
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
659
-            );
660
-        }
661
-
662
-        // Payments
663
-        elseif ($action == 'PAYMENT_CUSTOMER_CREATE') {
664
-            dol_syslog(
665
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
666
-            );
667
-        } elseif ($action == 'PAYMENT_SUPPLIER_CREATE') {
668
-            dol_syslog(
669
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
670
-            );
671
-        } elseif ($action == 'PAYMENT_ADD_TO_BANK') {
672
-            dol_syslog(
673
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
674
-            );
675
-        } elseif ($action == 'PAYMENT_DELETE') {
676
-            dol_syslog(
677
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
678
-            );
679
-        }
680
-
681
-        // Interventions
682
-        elseif ($action == 'FICHEINTER_CREATE') {
683
-            dol_syslog(
684
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
685
-            );
686
-        } elseif ($action == 'FICHEINTER_MODIFY') {
687
-            dol_syslog(
688
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
689
-            );
690
-        } elseif ($action == 'FICHEINTER_VALIDATE') {
691
-            dol_syslog(
692
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
693
-            );
694
-        } elseif ($action == 'FICHEINTER_DELETE') {
695
-            dol_syslog(
696
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
697
-            );
698
-        }
699
-
700
-        // Members
701
-        elseif ($action == 'MEMBER_CREATE') {
702
-            dol_syslog(
703
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
704
-            );
705
-        } elseif ($action == 'MEMBER_VALIDATE') {
706
-            dol_syslog(
707
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
708
-            );
709
-        } elseif ($action == 'MEMBER_SUBSCRIPTION') {
710
-            dol_syslog(
711
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
712
-            );
713
-        } elseif ($action == 'MEMBER_MODIFY') {
714
-            dol_syslog(
715
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
716
-            );
717
-        } elseif ($action == 'MEMBER_NEW_PASSWORD') {
718
-            dol_syslog(
719
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
720
-            );
721
-        } elseif ($action == 'MEMBER_RESILIATE') {
722
-            dol_syslog(
723
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
724
-            );
725
-        } elseif ($action == 'MEMBER_DELETE') {
726
-            dol_syslog(
727
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
728
-            );
729
-        }
730
-
731
-        // Categories
732
-        elseif ($action == 'CATEGORY_CREATE') {
733
-            dol_syslog(
734
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
735
-            );
736
-        } elseif ($action == 'CATEGORY_MODIFY') {
737
-            dol_syslog(
738
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
739
-            );
740
-        } elseif ($action == 'CATEGORY_DELETE') {
741
-            dol_syslog(
742
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
743
-            );
744
-        }
745
-
746
-        // Projects
747
-        elseif ($action == 'PROJECT_CREATE') {
748
-            dol_syslog(
749
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
750
-            );
751
-        } elseif ($action == 'PROJECT_MODIFY') {
752
-            dol_syslog(
753
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
754
-            );
755
-        } elseif ($action == 'PROJECT_DELETE') {
756
-            dol_syslog(
757
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
758
-            );
759
-        }
760
-
761
-        // Project tasks
762
-        elseif ($action == 'TASK_CREATE') {
763
-            dol_syslog(
764
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
765
-            );
766
-        } elseif ($action == 'TASK_MODIFY') {
767
-            dol_syslog(
768
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
769
-            );
770
-        } elseif ($action == 'TASK_DELETE') {
771
-            dol_syslog(
772
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
773
-            );
774
-        }
775
-
776
-        // Task time spent
777
-        elseif ($action == 'TASK_TIMESPENT_CREATE') {
778
-            dol_syslog(
779
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
780
-            );
781
-        } elseif ($action == 'TASK_TIMESPENT_MODIFY') {
782
-            dol_syslog(
783
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
784
-            );
785
-        } elseif ($action == 'TASK_TIMESPENT_DELETE') {
786
-            dol_syslog(
787
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
788
-            );
789
-        }
790
-
791
-        // Shipping
792
-        elseif ($action == 'SHIPPING_CREATE') {
793
-            dol_syslog(
794
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
795
-            );
796
-        } elseif ($action == 'SHIPPING_MODIFY') {
797
-            dol_syslog(
798
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
799
-            );
800
-        } elseif ($action == 'SHIPPING_VALIDATE') {
801
-            dol_syslog(
802
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
803
-            );
804
-        } elseif ($action == 'SHIPPING_SENTBYMAIL') {
805
-            dol_syslog(
806
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
807
-            );
808
-        } elseif ($action == 'SHIPPING_DELETE') {
809
-            dol_syslog(
810
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
811
-            );
812
-        } elseif ($action == 'SHIPPING_BUILDDOC') {
813
-            dol_syslog(
814
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
815
-            );
816
-        }
817
-
818
-        // File
819
-        elseif ($action == 'FILE_UPLOAD') {
820
-            dol_syslog(
821
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
822
-            );
823
-        } elseif ($action == 'FILE_DELETE') {
824
-            dol_syslog(
825
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
826
-            );
827
-        }
828
-
829
-        return 0;
830
-    }
653
+			dol_syslog(
654
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
655
+			);
656
+		} elseif ($action == 'LINEBILL_DELETE') {
657
+			dol_syslog(
658
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
659
+			);
660
+		}
661
+
662
+		// Payments
663
+		elseif ($action == 'PAYMENT_CUSTOMER_CREATE') {
664
+			dol_syslog(
665
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
666
+			);
667
+		} elseif ($action == 'PAYMENT_SUPPLIER_CREATE') {
668
+			dol_syslog(
669
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
670
+			);
671
+		} elseif ($action == 'PAYMENT_ADD_TO_BANK') {
672
+			dol_syslog(
673
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
674
+			);
675
+		} elseif ($action == 'PAYMENT_DELETE') {
676
+			dol_syslog(
677
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
678
+			);
679
+		}
680
+
681
+		// Interventions
682
+		elseif ($action == 'FICHEINTER_CREATE') {
683
+			dol_syslog(
684
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
685
+			);
686
+		} elseif ($action == 'FICHEINTER_MODIFY') {
687
+			dol_syslog(
688
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
689
+			);
690
+		} elseif ($action == 'FICHEINTER_VALIDATE') {
691
+			dol_syslog(
692
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
693
+			);
694
+		} elseif ($action == 'FICHEINTER_DELETE') {
695
+			dol_syslog(
696
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
697
+			);
698
+		}
699
+
700
+		// Members
701
+		elseif ($action == 'MEMBER_CREATE') {
702
+			dol_syslog(
703
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
704
+			);
705
+		} elseif ($action == 'MEMBER_VALIDATE') {
706
+			dol_syslog(
707
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
708
+			);
709
+		} elseif ($action == 'MEMBER_SUBSCRIPTION') {
710
+			dol_syslog(
711
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
712
+			);
713
+		} elseif ($action == 'MEMBER_MODIFY') {
714
+			dol_syslog(
715
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
716
+			);
717
+		} elseif ($action == 'MEMBER_NEW_PASSWORD') {
718
+			dol_syslog(
719
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
720
+			);
721
+		} elseif ($action == 'MEMBER_RESILIATE') {
722
+			dol_syslog(
723
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
724
+			);
725
+		} elseif ($action == 'MEMBER_DELETE') {
726
+			dol_syslog(
727
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
728
+			);
729
+		}
730
+
731
+		// Categories
732
+		elseif ($action == 'CATEGORY_CREATE') {
733
+			dol_syslog(
734
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
735
+			);
736
+		} elseif ($action == 'CATEGORY_MODIFY') {
737
+			dol_syslog(
738
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
739
+			);
740
+		} elseif ($action == 'CATEGORY_DELETE') {
741
+			dol_syslog(
742
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
743
+			);
744
+		}
745
+
746
+		// Projects
747
+		elseif ($action == 'PROJECT_CREATE') {
748
+			dol_syslog(
749
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
750
+			);
751
+		} elseif ($action == 'PROJECT_MODIFY') {
752
+			dol_syslog(
753
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
754
+			);
755
+		} elseif ($action == 'PROJECT_DELETE') {
756
+			dol_syslog(
757
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
758
+			);
759
+		}
760
+
761
+		// Project tasks
762
+		elseif ($action == 'TASK_CREATE') {
763
+			dol_syslog(
764
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
765
+			);
766
+		} elseif ($action == 'TASK_MODIFY') {
767
+			dol_syslog(
768
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
769
+			);
770
+		} elseif ($action == 'TASK_DELETE') {
771
+			dol_syslog(
772
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
773
+			);
774
+		}
775
+
776
+		// Task time spent
777
+		elseif ($action == 'TASK_TIMESPENT_CREATE') {
778
+			dol_syslog(
779
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
780
+			);
781
+		} elseif ($action == 'TASK_TIMESPENT_MODIFY') {
782
+			dol_syslog(
783
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
784
+			);
785
+		} elseif ($action == 'TASK_TIMESPENT_DELETE') {
786
+			dol_syslog(
787
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
788
+			);
789
+		}
790
+
791
+		// Shipping
792
+		elseif ($action == 'SHIPPING_CREATE') {
793
+			dol_syslog(
794
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
795
+			);
796
+		} elseif ($action == 'SHIPPING_MODIFY') {
797
+			dol_syslog(
798
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
799
+			);
800
+		} elseif ($action == 'SHIPPING_VALIDATE') {
801
+			dol_syslog(
802
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
803
+			);
804
+		} elseif ($action == 'SHIPPING_SENTBYMAIL') {
805
+			dol_syslog(
806
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
807
+			);
808
+		} elseif ($action == 'SHIPPING_DELETE') {
809
+			dol_syslog(
810
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
811
+			);
812
+		} elseif ($action == 'SHIPPING_BUILDDOC') {
813
+			dol_syslog(
814
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
815
+			);
816
+		}
817
+
818
+		// File
819
+		elseif ($action == 'FILE_UPLOAD') {
820
+			dol_syslog(
821
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
822
+			);
823
+		} elseif ($action == 'FILE_DELETE') {
824
+			dol_syslog(
825
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
826
+			);
827
+		}
828
+
829
+		return 0;
830
+	}
831 831
 }
832 832
\ No newline at end of file
Please login to merge, or discard this patch.