Passed
Push — master ( 77ae4e...036d63 )
by
unknown
03:05
created
core/triggers/interface_90_modSubtotal_subtotaltrigger.class.php 1 patch
Indentation   +544 added lines, -544 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');
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 169
    
170
-        if (!empty($conf->global->SUBTOTAL_ALLOW_ADD_LINE_UNDER_TITLE) && in_array($action, array('LINEPROPAL_INSERT', 'LINEORDER_INSERT', 'LINEBILL_INSERT')))
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,7 +199,7 @@  discard block
 block discarded – undo
199 199
 		}
200 200
         
201 201
 		
202
-        if ($action == 'LINEBILL_INSERT' )
202
+		if ($action == 'LINEBILL_INSERT' )
203 203
 		{
204 204
 			$subtotal_add_title_bloc_from_orderstoinvoice = GETPOST('subtotal_add_title_bloc_from_orderstoinvoice');
205 205
 			if (!empty($subtotal_add_title_bloc_from_orderstoinvoice))
@@ -223,10 +223,10 @@  discard block
 block discarded – undo
223 223
 						if (empty($label)) $label = 'Commande [__REFORDER__] - Référence client : [__REFCUSTOMER__]';
224 224
 						$label = str_replace(array('__REFORDER__', '__REFCUSTOMER__'), array($commande->ref, $commande->ref_client), $label);
225 225
 
226
-                        if(!empty($current_fk_commande)) {
227
-                            TSubtotal::addTitle($facture, $label, 1, $rang);
228
-                            $rang++;
229
-                        }
226
+						if(!empty($current_fk_commande)) {
227
+							TSubtotal::addTitle($facture, $label, 1, $rang);
228
+							$rang++;
229
+						}
230 230
 					}
231 231
 					
232 232
 					$object->rang = $rang;
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 		
258 258
 		if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && in_array($action, array('LINEPROPAL_INSERT', 'LINEPROPAL_UPDATE', 'LINEORDER_INSERT', 'LINEORDER_UPDATE', 'LINEBILL_INSERT', 'LINEBILL_UPDATE')))
259 259
 		{
260
-            if(! function_exists('_updateLineNC')) dol_include_once('/subtotal/lib/subtotal.lib.php');
260
+			if(! function_exists('_updateLineNC')) dol_include_once('/subtotal/lib/subtotal.lib.php');
261 261
 
262 262
 			$doli_action = GETPOST('action');
263 263
 			$set = GETPOST('set');
@@ -323,173 +323,173 @@  discard block
 block discarded – undo
323 323
 		}
324 324
 		
325 325
         
326
-        if ($action == 'USER_LOGIN') {
327
-            dol_syslog(
328
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
329
-            );
330
-        } elseif ($action == 'USER_UPDATE_SESSION') {
331
-            // Warning: To increase performances, this action is triggered only if
332
-            // constant MAIN_ACTIVATE_UPDATESESSIONTRIGGER is set to 1.
333
-            dol_syslog(
334
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
335
-            );
336
-        } elseif ($action == 'USER_CREATE') {
337
-            dol_syslog(
338
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
339
-            );
340
-        } elseif ($action == 'USER_CREATE_FROM_CONTACT') {
341
-            dol_syslog(
342
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
343
-            );
344
-        } elseif ($action == 'USER_MODIFY') {
345
-            dol_syslog(
346
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
347
-            );
348
-        } elseif ($action == 'USER_NEW_PASSWORD') {
349
-            dol_syslog(
350
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
351
-            );
352
-        } elseif ($action == 'USER_ENABLEDISABLE') {
353
-            dol_syslog(
354
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
355
-            );
356
-        } elseif ($action == 'USER_DELETE') {
357
-            dol_syslog(
358
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
359
-            );
360
-        } elseif ($action == 'USER_LOGOUT') {
361
-            dol_syslog(
362
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
363
-            );
364
-        } elseif ($action == 'USER_SETINGROUP') {
365
-            dol_syslog(
366
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
367
-            );
368
-        } elseif ($action == 'USER_REMOVEFROMGROUP') {
369
-            dol_syslog(
370
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
371
-            );
372
-        }
373
-
374
-        // Groups
375
-        elseif ($action == 'GROUP_CREATE') {
376
-            dol_syslog(
377
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
378
-            );
379
-        } elseif ($action == 'GROUP_MODIFY') {
380
-            dol_syslog(
381
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
382
-            );
383
-        } elseif ($action == 'GROUP_DELETE') {
384
-            dol_syslog(
385
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
386
-            );
387
-        }
388
-
389
-        // Companies
390
-        elseif ($action == 'COMPANY_CREATE') {
391
-            dol_syslog(
392
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
393
-            );
394
-        } elseif ($action == 'COMPANY_MODIFY') {
395
-            dol_syslog(
396
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
397
-            );
398
-        } elseif ($action == 'COMPANY_DELETE') {
399
-            dol_syslog(
400
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
401
-            );
402
-        }
403
-
404
-        // Contacts
405
-        elseif ($action == 'CONTACT_CREATE') {
406
-            dol_syslog(
407
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
408
-            );
409
-        } elseif ($action == 'CONTACT_MODIFY') {
410
-            dol_syslog(
411
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
412
-            );
413
-        } elseif ($action == 'CONTACT_DELETE') {
414
-            dol_syslog(
415
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
416
-            );
417
-        }
418
-
419
-        // Products
420
-        elseif ($action == 'PRODUCT_CREATE') {
421
-            dol_syslog(
422
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
423
-            );
424
-        } elseif ($action == 'PRODUCT_MODIFY') {
425
-            dol_syslog(
426
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
427
-            );
428
-        } elseif ($action == 'PRODUCT_DELETE') {
429
-            dol_syslog(
430
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
431
-            );
432
-        }
433
-
434
-        // Customer orders
435
-        elseif ($action == 'ORDER_CREATE') {
436
-            dol_syslog(
437
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
438
-            );
439
-        } elseif ($action == 'ORDER_VALIDATE') {
440
-            dol_syslog(
441
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
442
-            );
443
-        } elseif ($action == 'ORDER_DELETE') {
444
-            dol_syslog(
445
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
446
-            );
447
-        } elseif ($action == 'ORDER_BUILDDOC') {
448
-            dol_syslog(
449
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
450
-            );
451
-        } elseif ($action == 'ORDER_SENTBYMAIL') {
452
-            dol_syslog(
453
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
454
-            );
455
-        } elseif ($action == 'LINEORDER_INSERT') {
456
-            dol_syslog(
457
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
458
-            );
459
-        } elseif ($action == 'LINEORDER_DELETE') {
460
-            dol_syslog(
461
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
462
-            );
463
-        }
464
-
465
-        // Supplier orders
466
-        elseif ($action == 'ORDER_SUPPLIER_CREATE') {
467
-            dol_syslog(
468
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
469
-            );
470
-        } elseif ($action == 'ORDER_SUPPLIER_VALIDATE') {
471
-            dol_syslog(
472
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
473
-            );
474
-        } elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') {
475
-            dol_syslog(
476
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
477
-            );
478
-        } elseif ($action == 'SUPPLIER_ORDER_BUILDDOC') {
479
-            dol_syslog(
480
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
481
-            );
482
-        }
483
-
484
-        // Proposals
485
-        elseif ($action == 'PROPAL_CREATE') {
486
-            dol_syslog(
487
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
488
-            );
489
-        } elseif (in_array($action, array('PROPAL_CLONE', 'ORDER_CLONE', 'BILL_CLONE'))) {
490
-            dol_syslog(
491
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
492
-            );
326
+		if ($action == 'USER_LOGIN') {
327
+			dol_syslog(
328
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
329
+			);
330
+		} elseif ($action == 'USER_UPDATE_SESSION') {
331
+			// Warning: To increase performances, this action is triggered only if
332
+			// constant MAIN_ACTIVATE_UPDATESESSIONTRIGGER is set to 1.
333
+			dol_syslog(
334
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
335
+			);
336
+		} elseif ($action == 'USER_CREATE') {
337
+			dol_syslog(
338
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
339
+			);
340
+		} elseif ($action == 'USER_CREATE_FROM_CONTACT') {
341
+			dol_syslog(
342
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
343
+			);
344
+		} elseif ($action == 'USER_MODIFY') {
345
+			dol_syslog(
346
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
347
+			);
348
+		} elseif ($action == 'USER_NEW_PASSWORD') {
349
+			dol_syslog(
350
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
351
+			);
352
+		} elseif ($action == 'USER_ENABLEDISABLE') {
353
+			dol_syslog(
354
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
355
+			);
356
+		} elseif ($action == 'USER_DELETE') {
357
+			dol_syslog(
358
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
359
+			);
360
+		} elseif ($action == 'USER_LOGOUT') {
361
+			dol_syslog(
362
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
363
+			);
364
+		} elseif ($action == 'USER_SETINGROUP') {
365
+			dol_syslog(
366
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
367
+			);
368
+		} elseif ($action == 'USER_REMOVEFROMGROUP') {
369
+			dol_syslog(
370
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
371
+			);
372
+		}
373
+
374
+		// Groups
375
+		elseif ($action == 'GROUP_CREATE') {
376
+			dol_syslog(
377
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
378
+			);
379
+		} elseif ($action == 'GROUP_MODIFY') {
380
+			dol_syslog(
381
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
382
+			);
383
+		} elseif ($action == 'GROUP_DELETE') {
384
+			dol_syslog(
385
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
386
+			);
387
+		}
388
+
389
+		// Companies
390
+		elseif ($action == 'COMPANY_CREATE') {
391
+			dol_syslog(
392
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
393
+			);
394
+		} elseif ($action == 'COMPANY_MODIFY') {
395
+			dol_syslog(
396
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
397
+			);
398
+		} elseif ($action == 'COMPANY_DELETE') {
399
+			dol_syslog(
400
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
401
+			);
402
+		}
403
+
404
+		// Contacts
405
+		elseif ($action == 'CONTACT_CREATE') {
406
+			dol_syslog(
407
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
408
+			);
409
+		} elseif ($action == 'CONTACT_MODIFY') {
410
+			dol_syslog(
411
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
412
+			);
413
+		} elseif ($action == 'CONTACT_DELETE') {
414
+			dol_syslog(
415
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
416
+			);
417
+		}
418
+
419
+		// Products
420
+		elseif ($action == 'PRODUCT_CREATE') {
421
+			dol_syslog(
422
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
423
+			);
424
+		} elseif ($action == 'PRODUCT_MODIFY') {
425
+			dol_syslog(
426
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
427
+			);
428
+		} elseif ($action == 'PRODUCT_DELETE') {
429
+			dol_syslog(
430
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
431
+			);
432
+		}
433
+
434
+		// Customer orders
435
+		elseif ($action == 'ORDER_CREATE') {
436
+			dol_syslog(
437
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
438
+			);
439
+		} elseif ($action == 'ORDER_VALIDATE') {
440
+			dol_syslog(
441
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
442
+			);
443
+		} elseif ($action == 'ORDER_DELETE') {
444
+			dol_syslog(
445
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
446
+			);
447
+		} elseif ($action == 'ORDER_BUILDDOC') {
448
+			dol_syslog(
449
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
450
+			);
451
+		} elseif ($action == 'ORDER_SENTBYMAIL') {
452
+			dol_syslog(
453
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
454
+			);
455
+		} elseif ($action == 'LINEORDER_INSERT') {
456
+			dol_syslog(
457
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
458
+			);
459
+		} elseif ($action == 'LINEORDER_DELETE') {
460
+			dol_syslog(
461
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
462
+			);
463
+		}
464
+
465
+		// Supplier orders
466
+		elseif ($action == 'ORDER_SUPPLIER_CREATE') {
467
+			dol_syslog(
468
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
469
+			);
470
+		} elseif ($action == 'ORDER_SUPPLIER_VALIDATE') {
471
+			dol_syslog(
472
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
473
+			);
474
+		} elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') {
475
+			dol_syslog(
476
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
477
+			);
478
+		} elseif ($action == 'SUPPLIER_ORDER_BUILDDOC') {
479
+			dol_syslog(
480
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
481
+			);
482
+		}
483
+
484
+		// Proposals
485
+		elseif ($action == 'PROPAL_CREATE') {
486
+			dol_syslog(
487
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
488
+			);
489
+		} elseif (in_array($action, array('PROPAL_CLONE', 'ORDER_CLONE', 'BILL_CLONE'))) {
490
+			dol_syslog(
491
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
492
+			);
493 493
 			
494 494
 			$doli_action = GETPOST('action');
495 495
 
@@ -522,296 +522,296 @@  discard block
 block discarded – undo
522 522
 				if (!empty($line)) $object->update_price(1);
523 523
 			}
524 524
 			
525
-        } elseif ($action == 'PROPAL_MODIFY') {
526
-            dol_syslog(
527
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
528
-            );
529
-        } elseif ($action == 'PROPAL_VALIDATE') {
530
-            dol_syslog(
531
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
532
-            );
533
-        } elseif ($action == 'PROPAL_BUILDDOC') {
534
-            dol_syslog(
535
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
536
-            );
537
-        } elseif ($action == 'PROPAL_SENTBYMAIL') {
538
-            dol_syslog(
539
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
540
-            );
541
-        } elseif ($action == 'PROPAL_CLOSE_SIGNED') {
542
-            dol_syslog(
543
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
544
-            );
545
-        } elseif ($action == 'PROPAL_CLOSE_REFUSED') {
546
-            dol_syslog(
547
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
548
-            );
549
-        } elseif ($action == 'PROPAL_DELETE') {
550
-            dol_syslog(
551
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
552
-            );
553
-        } elseif ($action == 'LINEPROPAL_INSERT') {
554
-            dol_syslog(
555
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
556
-            );
557
-        } elseif ($action == 'LINEPROPAL_MODIFY') {
558
-            dol_syslog(
559
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
560
-            );
561
-        } elseif ($action == 'LINEPROPAL_DELETE') {
562
-            dol_syslog(
563
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
564
-            );
565
-        }
566
-
567
-        // Contracts
568
-        elseif ($action == 'CONTRACT_CREATE') {
569
-            dol_syslog(
570
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
571
-            );
572
-        } elseif ($action == 'CONTRACT_MODIFY') {
573
-            dol_syslog(
574
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
575
-            );
576
-        } elseif ($action == 'CONTRACT_ACTIVATE') {
577
-            dol_syslog(
578
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
579
-            );
580
-        } elseif ($action == 'CONTRACT_CANCEL') {
581
-            dol_syslog(
582
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
583
-            );
584
-        } elseif ($action == 'CONTRACT_CLOSE') {
585
-            dol_syslog(
586
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
587
-            );
588
-        } elseif ($action == 'CONTRACT_DELETE') {
589
-            dol_syslog(
590
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
591
-            );
592
-        }
525
+		} elseif ($action == 'PROPAL_MODIFY') {
526
+			dol_syslog(
527
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
528
+			);
529
+		} elseif ($action == 'PROPAL_VALIDATE') {
530
+			dol_syslog(
531
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
532
+			);
533
+		} elseif ($action == 'PROPAL_BUILDDOC') {
534
+			dol_syslog(
535
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
536
+			);
537
+		} elseif ($action == 'PROPAL_SENTBYMAIL') {
538
+			dol_syslog(
539
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
540
+			);
541
+		} elseif ($action == 'PROPAL_CLOSE_SIGNED') {
542
+			dol_syslog(
543
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
544
+			);
545
+		} elseif ($action == 'PROPAL_CLOSE_REFUSED') {
546
+			dol_syslog(
547
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
548
+			);
549
+		} elseif ($action == 'PROPAL_DELETE') {
550
+			dol_syslog(
551
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
552
+			);
553
+		} elseif ($action == 'LINEPROPAL_INSERT') {
554
+			dol_syslog(
555
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
556
+			);
557
+		} elseif ($action == 'LINEPROPAL_MODIFY') {
558
+			dol_syslog(
559
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
560
+			);
561
+		} elseif ($action == 'LINEPROPAL_DELETE') {
562
+			dol_syslog(
563
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
564
+			);
565
+		}
566
+
567
+		// Contracts
568
+		elseif ($action == 'CONTRACT_CREATE') {
569
+			dol_syslog(
570
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
571
+			);
572
+		} elseif ($action == 'CONTRACT_MODIFY') {
573
+			dol_syslog(
574
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
575
+			);
576
+		} elseif ($action == 'CONTRACT_ACTIVATE') {
577
+			dol_syslog(
578
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
579
+			);
580
+		} elseif ($action == 'CONTRACT_CANCEL') {
581
+			dol_syslog(
582
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
583
+			);
584
+		} elseif ($action == 'CONTRACT_CLOSE') {
585
+			dol_syslog(
586
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
587
+			);
588
+		} elseif ($action == 'CONTRACT_DELETE') {
589
+			dol_syslog(
590
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
591
+			);
592
+		}
593 593
 
594 594
 		elseif ($action == 'BILL_MODIFY') {
595
-            dol_syslog(
596
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
597
-            );
598
-
599
-
600
-            global $conf;
601
-
602
-            if (!empty($conf->global->INVOICE_USE_SITUATION) && $object->element == 'facture' && $object->type == Facture::TYPE_SITUATION)
603
-            {
604
-                $object->situation_final = 1;
605
-                foreach($object->lines as $i => $line) {
606
-                    if(!TSubtotal::isModSubtotalLine($line) && $line->situation_percent != 100){
607
-                        $object->situation_final = 0;
608
-                        break;
609
-                    }
610
-                }
611
-                // ne pas utiliser $object->setFinal ne peut pas marcher
612
-                $sql = 'UPDATE ' . MAIN_DB_PREFIX . 'facture SET situation_final = ' . $object->situation_final . ' where rowid = ' . $object->id;
613
-                $resql=$object->db->query($sql);
614
-            }
615
-
616
-
617
-        } elseif ($action == 'BILL_VALIDATE') {
618
-            dol_syslog(
619
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
620
-            );
621
-        } elseif ($action == 'BILL_BUILDDOC') {
622
-            dol_syslog(
623
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
624
-            );
625
-        } elseif ($action == 'BILL_SENTBYMAIL') {
626
-            dol_syslog(
627
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
628
-            );
629
-        } elseif ($action == 'BILL_CANCEL') {
630
-            dol_syslog(
631
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
632
-            );
633
-        } elseif ($action == 'BILL_DELETE') {
634
-            dol_syslog(
635
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
636
-            );
637
-        } elseif ($action == 'LINEBILL_INSERT') {
595
+			dol_syslog(
596
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
597
+			);
598
+
599
+
600
+			global $conf;
601
+
602
+			if (!empty($conf->global->INVOICE_USE_SITUATION) && $object->element == 'facture' && $object->type == Facture::TYPE_SITUATION)
603
+			{
604
+				$object->situation_final = 1;
605
+				foreach($object->lines as $i => $line) {
606
+					if(!TSubtotal::isModSubtotalLine($line) && $line->situation_percent != 100){
607
+						$object->situation_final = 0;
608
+						break;
609
+					}
610
+				}
611
+				// ne pas utiliser $object->setFinal ne peut pas marcher
612
+				$sql = 'UPDATE ' . MAIN_DB_PREFIX . 'facture SET situation_final = ' . $object->situation_final . ' where rowid = ' . $object->id;
613
+				$resql=$object->db->query($sql);
614
+			}
615
+
616
+
617
+		} elseif ($action == 'BILL_VALIDATE') {
618
+			dol_syslog(
619
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
620
+			);
621
+		} elseif ($action == 'BILL_BUILDDOC') {
622
+			dol_syslog(
623
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
624
+			);
625
+		} elseif ($action == 'BILL_SENTBYMAIL') {
626
+			dol_syslog(
627
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
628
+			);
629
+		} elseif ($action == 'BILL_CANCEL') {
630
+			dol_syslog(
631
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
632
+			);
633
+		} elseif ($action == 'BILL_DELETE') {
634
+			dol_syslog(
635
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
636
+			);
637
+		} elseif ($action == 'LINEBILL_INSERT') {
638 638
 				
639
-        	dol_syslog(
640
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
641
-            );
642
-        } elseif ($action == 'LINEBILL_DELETE') {
643
-            dol_syslog(
644
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
645
-            );
646
-        }
647
-
648
-        // Payments
649
-        elseif ($action == 'PAYMENT_CUSTOMER_CREATE') {
650
-            dol_syslog(
651
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
652
-            );
653
-        } elseif ($action == 'PAYMENT_SUPPLIER_CREATE') {
654
-            dol_syslog(
655
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
656
-            );
657
-        } elseif ($action == 'PAYMENT_ADD_TO_BANK') {
658
-            dol_syslog(
659
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
660
-            );
661
-        } elseif ($action == 'PAYMENT_DELETE') {
662
-            dol_syslog(
663
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
664
-            );
665
-        }
666
-
667
-        // Interventions
668
-        elseif ($action == 'FICHEINTER_CREATE') {
669
-            dol_syslog(
670
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
671
-            );
672
-        } elseif ($action == 'FICHEINTER_MODIFY') {
673
-            dol_syslog(
674
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
675
-            );
676
-        } elseif ($action == 'FICHEINTER_VALIDATE') {
677
-            dol_syslog(
678
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
679
-            );
680
-        } elseif ($action == 'FICHEINTER_DELETE') {
681
-            dol_syslog(
682
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
683
-            );
684
-        }
685
-
686
-        // Members
687
-        elseif ($action == 'MEMBER_CREATE') {
688
-            dol_syslog(
689
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
690
-            );
691
-        } elseif ($action == 'MEMBER_VALIDATE') {
692
-            dol_syslog(
693
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
694
-            );
695
-        } elseif ($action == 'MEMBER_SUBSCRIPTION') {
696
-            dol_syslog(
697
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
698
-            );
699
-        } elseif ($action == 'MEMBER_MODIFY') {
700
-            dol_syslog(
701
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
702
-            );
703
-        } elseif ($action == 'MEMBER_NEW_PASSWORD') {
704
-            dol_syslog(
705
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
706
-            );
707
-        } elseif ($action == 'MEMBER_RESILIATE') {
708
-            dol_syslog(
709
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
710
-            );
711
-        } elseif ($action == 'MEMBER_DELETE') {
712
-            dol_syslog(
713
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
714
-            );
715
-        }
716
-
717
-        // Categories
718
-        elseif ($action == 'CATEGORY_CREATE') {
719
-            dol_syslog(
720
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
721
-            );
722
-        } elseif ($action == 'CATEGORY_MODIFY') {
723
-            dol_syslog(
724
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
725
-            );
726
-        } elseif ($action == 'CATEGORY_DELETE') {
727
-            dol_syslog(
728
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
729
-            );
730
-        }
731
-
732
-        // Projects
733
-        elseif ($action == 'PROJECT_CREATE') {
734
-            dol_syslog(
735
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
736
-            );
737
-        } elseif ($action == 'PROJECT_MODIFY') {
738
-            dol_syslog(
739
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
740
-            );
741
-        } elseif ($action == 'PROJECT_DELETE') {
742
-            dol_syslog(
743
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
744
-            );
745
-        }
746
-
747
-        // Project tasks
748
-        elseif ($action == 'TASK_CREATE') {
749
-            dol_syslog(
750
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
751
-            );
752
-        } elseif ($action == 'TASK_MODIFY') {
753
-            dol_syslog(
754
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
755
-            );
756
-        } elseif ($action == 'TASK_DELETE') {
757
-            dol_syslog(
758
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
759
-            );
760
-        }
761
-
762
-        // Task time spent
763
-        elseif ($action == 'TASK_TIMESPENT_CREATE') {
764
-            dol_syslog(
765
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
766
-            );
767
-        } elseif ($action == 'TASK_TIMESPENT_MODIFY') {
768
-            dol_syslog(
769
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
770
-            );
771
-        } elseif ($action == 'TASK_TIMESPENT_DELETE') {
772
-            dol_syslog(
773
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
774
-            );
775
-        }
776
-
777
-        // Shipping
778
-        elseif ($action == 'SHIPPING_CREATE') {
779
-            dol_syslog(
780
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
781
-            );
782
-        } elseif ($action == 'SHIPPING_MODIFY') {
783
-            dol_syslog(
784
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
785
-            );
786
-        } elseif ($action == 'SHIPPING_VALIDATE') {
787
-            dol_syslog(
788
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
789
-            );
790
-        } elseif ($action == 'SHIPPING_SENTBYMAIL') {
791
-            dol_syslog(
792
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
793
-            );
794
-        } elseif ($action == 'SHIPPING_DELETE') {
795
-            dol_syslog(
796
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
797
-            );
798
-        } elseif ($action == 'SHIPPING_BUILDDOC') {
799
-            dol_syslog(
800
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
801
-            );
802
-        }
803
-
804
-        // File
805
-        elseif ($action == 'FILE_UPLOAD') {
806
-            dol_syslog(
807
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
808
-            );
809
-        } elseif ($action == 'FILE_DELETE') {
810
-            dol_syslog(
811
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
812
-            );
813
-        }
814
-
815
-        return 0;
816
-    }
639
+			dol_syslog(
640
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
641
+			);
642
+		} elseif ($action == 'LINEBILL_DELETE') {
643
+			dol_syslog(
644
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
645
+			);
646
+		}
647
+
648
+		// Payments
649
+		elseif ($action == 'PAYMENT_CUSTOMER_CREATE') {
650
+			dol_syslog(
651
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
652
+			);
653
+		} elseif ($action == 'PAYMENT_SUPPLIER_CREATE') {
654
+			dol_syslog(
655
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
656
+			);
657
+		} elseif ($action == 'PAYMENT_ADD_TO_BANK') {
658
+			dol_syslog(
659
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
660
+			);
661
+		} elseif ($action == 'PAYMENT_DELETE') {
662
+			dol_syslog(
663
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
664
+			);
665
+		}
666
+
667
+		// Interventions
668
+		elseif ($action == 'FICHEINTER_CREATE') {
669
+			dol_syslog(
670
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
671
+			);
672
+		} elseif ($action == 'FICHEINTER_MODIFY') {
673
+			dol_syslog(
674
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
675
+			);
676
+		} elseif ($action == 'FICHEINTER_VALIDATE') {
677
+			dol_syslog(
678
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
679
+			);
680
+		} elseif ($action == 'FICHEINTER_DELETE') {
681
+			dol_syslog(
682
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
683
+			);
684
+		}
685
+
686
+		// Members
687
+		elseif ($action == 'MEMBER_CREATE') {
688
+			dol_syslog(
689
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
690
+			);
691
+		} elseif ($action == 'MEMBER_VALIDATE') {
692
+			dol_syslog(
693
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
694
+			);
695
+		} elseif ($action == 'MEMBER_SUBSCRIPTION') {
696
+			dol_syslog(
697
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
698
+			);
699
+		} elseif ($action == 'MEMBER_MODIFY') {
700
+			dol_syslog(
701
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
702
+			);
703
+		} elseif ($action == 'MEMBER_NEW_PASSWORD') {
704
+			dol_syslog(
705
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
706
+			);
707
+		} elseif ($action == 'MEMBER_RESILIATE') {
708
+			dol_syslog(
709
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
710
+			);
711
+		} elseif ($action == 'MEMBER_DELETE') {
712
+			dol_syslog(
713
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
714
+			);
715
+		}
716
+
717
+		// Categories
718
+		elseif ($action == 'CATEGORY_CREATE') {
719
+			dol_syslog(
720
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
721
+			);
722
+		} elseif ($action == 'CATEGORY_MODIFY') {
723
+			dol_syslog(
724
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
725
+			);
726
+		} elseif ($action == 'CATEGORY_DELETE') {
727
+			dol_syslog(
728
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
729
+			);
730
+		}
731
+
732
+		// Projects
733
+		elseif ($action == 'PROJECT_CREATE') {
734
+			dol_syslog(
735
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
736
+			);
737
+		} elseif ($action == 'PROJECT_MODIFY') {
738
+			dol_syslog(
739
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
740
+			);
741
+		} elseif ($action == 'PROJECT_DELETE') {
742
+			dol_syslog(
743
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
744
+			);
745
+		}
746
+
747
+		// Project tasks
748
+		elseif ($action == 'TASK_CREATE') {
749
+			dol_syslog(
750
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
751
+			);
752
+		} elseif ($action == 'TASK_MODIFY') {
753
+			dol_syslog(
754
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
755
+			);
756
+		} elseif ($action == 'TASK_DELETE') {
757
+			dol_syslog(
758
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
759
+			);
760
+		}
761
+
762
+		// Task time spent
763
+		elseif ($action == 'TASK_TIMESPENT_CREATE') {
764
+			dol_syslog(
765
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
766
+			);
767
+		} elseif ($action == 'TASK_TIMESPENT_MODIFY') {
768
+			dol_syslog(
769
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
770
+			);
771
+		} elseif ($action == 'TASK_TIMESPENT_DELETE') {
772
+			dol_syslog(
773
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
774
+			);
775
+		}
776
+
777
+		// Shipping
778
+		elseif ($action == 'SHIPPING_CREATE') {
779
+			dol_syslog(
780
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
781
+			);
782
+		} elseif ($action == 'SHIPPING_MODIFY') {
783
+			dol_syslog(
784
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
785
+			);
786
+		} elseif ($action == 'SHIPPING_VALIDATE') {
787
+			dol_syslog(
788
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
789
+			);
790
+		} elseif ($action == 'SHIPPING_SENTBYMAIL') {
791
+			dol_syslog(
792
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
793
+			);
794
+		} elseif ($action == 'SHIPPING_DELETE') {
795
+			dol_syslog(
796
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
797
+			);
798
+		} elseif ($action == 'SHIPPING_BUILDDOC') {
799
+			dol_syslog(
800
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
801
+			);
802
+		}
803
+
804
+		// File
805
+		elseif ($action == 'FILE_UPLOAD') {
806
+			dol_syslog(
807
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
808
+			);
809
+		} elseif ($action == 'FILE_DELETE') {
810
+			dol_syslog(
811
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
812
+			);
813
+		}
814
+
815
+		return 0;
816
+	}
817 817
 }
818 818
\ No newline at end of file
Please login to merge, or discard this patch.
core/modules/modSubtotal.class.php 1 patch
Indentation   +401 added lines, -401 removed lines patch added patch discarded remove patch
@@ -31,186 +31,186 @@  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
-                ,'admin'
109
-                ,'invoicereccard'
110
-                ,'consumptionthirdparty'
111
-            	,'ordershipmentcard'
112
-            	,'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
+				,'admin'
109
+				,'invoicereccard'
110
+				,'consumptionthirdparty'
111
+				,'ordershipmentcard'
112
+				,'expeditioncard'
113 113
 				,'deliverycard'
114 114
 				,'paiementcard'
115
-            )
116
-            // Set here all workflow context managed by module
117
-            //'workflow' => array('order' => array('WORKFLOW_ORDER_AUTOCREATE_INVOICE'))
118
-        );
115
+			)
116
+			// Set here all workflow context managed by module
117
+			//'workflow' => array('order' => array('WORKFLOW_ORDER_AUTOCREATE_INVOICE'))
118
+		);
119 119
 
120
-        // Data directories to create when module is enabled.
121
-        // Example: this->dirs = array("/titre/temp");
122
-        $this->dirs = array();
120
+		// Data directories to create when module is enabled.
121
+		// Example: this->dirs = array("/titre/temp");
122
+		$this->dirs = array();
123 123
 
124
-        // Config pages. Put here list of php pages
125
-        // stored into titre/admin directory, used to setup module.
126
-        $this->config_page_url = array("subtotal_setup.php@subtotal");
124
+		// Config pages. Put here list of php pages
125
+		// stored into titre/admin directory, used to setup module.
126
+		$this->config_page_url = array("subtotal_setup.php@subtotal");
127 127
 
128
-        // Dependencies
129
-        // List of modules id that must be enabled if this module is enabled
130
-        $this->depends = array();
128
+		// Dependencies
129
+		// List of modules id that must be enabled if this module is enabled
130
+		$this->depends = array();
131 131
 
132 132
 		$this->conflictwith=array('modMilestone');
133
-        // List of modules id to disable if this one is disabled
134
-        $this->requiredby = array();
135
-        // Minimum version of PHP required by module
136
-        $this->phpmin = array(5, 3);
137
-        // Minimum version of Dolibarr required by module
138
-        $this->need_dolibarr_version = array(3, 2);
139
-        $this->langfiles = array("subtotal@subtotal"); // langfiles@titre
140
-        // Constants
141
-        // List of particular constants to add when module is enabled
142
-        // (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
143
-        // Example:
144
-        $this->const = array(
145
-            	0=>array(
146
-            		'SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES',
147
-            		'chaine',
148
-            		'I',
149
-            		'Définit le style (B : gras, I : Italique, U : Souligné) des sous titres lorsque le détail des lignes et des ensembles est caché',
150
-            		1
151
-            	)
133
+		// List of modules id to disable if this one is disabled
134
+		$this->requiredby = array();
135
+		// Minimum version of PHP required by module
136
+		$this->phpmin = array(5, 3);
137
+		// Minimum version of Dolibarr required by module
138
+		$this->need_dolibarr_version = array(3, 2);
139
+		$this->langfiles = array("subtotal@subtotal"); // langfiles@titre
140
+		// Constants
141
+		// List of particular constants to add when module is enabled
142
+		// (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
143
+		// Example:
144
+		$this->const = array(
145
+				0=>array(
146
+					'SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES',
147
+					'chaine',
148
+					'I',
149
+					'Définit le style (B : gras, I : Italique, U : Souligné) des sous titres lorsque le détail des lignes et des ensembles est caché',
150
+					1
151
+				)
152 152
 				,1=>array('SUBTOTAL_ALLOW_ADD_BLOCK', 'chaine', '1', 'Permet l\'ajout de titres et sous-totaux')
153 153
 				,2=>array('SUBTOTAL_ALLOW_EDIT_BLOCK', 'chaine', '1', 'Permet de modifier titres et sous-totaux')
154 154
 				,3=>array('SUBTOTAL_ALLOW_REMOVE_BLOCK', 'chaine', '1', 'Permet de supprimer les titres et sous-totaux')
155 155
 				,4=>array('SUBTOTAL_TITLE_STYLE', 'chaine', 'BU')
156 156
 				,5=>array('SUBTOTAL_SUBTOTAL_STYLE', 'chaine', 'B')
157
-            //	1=>array(
158
-            //		'MYMODULE_MYNEWCONST2',
159
-            //		'chaine',
160
-            //		'myvalue',
161
-            //		'This is another constant to add',
162
-            //		0
163
-            //	)
164
-        );
157
+			//	1=>array(
158
+			//		'MYMODULE_MYNEWCONST2',
159
+			//		'chaine',
160
+			//		'myvalue',
161
+			//		'This is another constant to add',
162
+			//		0
163
+			//	)
164
+		);
165 165
 		
166 166
 
167 167
 
168 168
 
169
-        // Array to add new pages in new tabs
170
-        // Example:
171
-        $this->tabs = array(
172
-            //	// To add a new tab identified by code tabname1
173
-            //	'objecttype:+tabname1:Title1:langfile@titre:$user->rights->titre->read:/titre/mynewtab1.php?id=__ID__',
174
-            //	// To add another new tab identified by code tabname2
175
-            //	'objecttype:+tabname2:Title2:langfile@titre:$user->rights->othermodule->read:/titre/mynewtab2.php?id=__ID__',
176
-            //	// To remove an existing tab identified by code tabname
177
-            //	'objecttype:-tabname'
178
-        );
179
-        // where objecttype can be
180
-        // 'thirdparty'			to add a tab in third party view
181
-        // 'intervention'		to add a tab in intervention view
182
-        // 'order_supplier'		to add a tab in supplier order view
183
-        // 'invoice_supplier'	to add a tab in supplier invoice view
184
-        // 'invoice'			to add a tab in customer invoice view
185
-        // 'order'				to add a tab in customer order view
186
-        // 'product'			to add a tab in product view
187
-        // 'stock'				to add a tab in stock view
188
-        // 'propal'				to add a tab in propal view
189
-        // 'member'				to add a tab in fundation member view
190
-        // 'contract'			to add a tab in contract view
191
-        // 'user'				to add a tab in user view
192
-        // 'group'				to add a tab in group view
193
-        // 'contact'			to add a tab in contact view
194
-        // 'categories_x'		to add a tab in category view
195
-        // (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member)
196
-        // Dictionnaries
197
-        if (! isset($conf->subtotal->enabled)) {
198
-            $conf->subtotal=new stdClass();
199
-            $conf->subtotal->enabled = 0;
200
-        }
201
-        $this->dictionaries = array(
169
+		// Array to add new pages in new tabs
170
+		// Example:
171
+		$this->tabs = array(
172
+			//	// To add a new tab identified by code tabname1
173
+			//	'objecttype:+tabname1:Title1:langfile@titre:$user->rights->titre->read:/titre/mynewtab1.php?id=__ID__',
174
+			//	// To add another new tab identified by code tabname2
175
+			//	'objecttype:+tabname2:Title2:langfile@titre:$user->rights->othermodule->read:/titre/mynewtab2.php?id=__ID__',
176
+			//	// To remove an existing tab identified by code tabname
177
+			//	'objecttype:-tabname'
178
+		);
179
+		// where objecttype can be
180
+		// 'thirdparty'			to add a tab in third party view
181
+		// 'intervention'		to add a tab in intervention view
182
+		// 'order_supplier'		to add a tab in supplier order view
183
+		// 'invoice_supplier'	to add a tab in supplier invoice view
184
+		// 'invoice'			to add a tab in customer invoice view
185
+		// 'order'				to add a tab in customer order view
186
+		// 'product'			to add a tab in product view
187
+		// 'stock'				to add a tab in stock view
188
+		// 'propal'				to add a tab in propal view
189
+		// 'member'				to add a tab in fundation member view
190
+		// 'contract'			to add a tab in contract view
191
+		// 'user'				to add a tab in user view
192
+		// 'group'				to add a tab in group view
193
+		// 'contact'			to add a tab in contact view
194
+		// 'categories_x'		to add a tab in category view
195
+		// (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member)
196
+		// Dictionnaries
197
+		if (! isset($conf->subtotal->enabled)) {
198
+			$conf->subtotal=new stdClass();
199
+			$conf->subtotal->enabled = 0;
200
+		}
201
+		$this->dictionaries = array(
202 202
 			'langs'=>'subtotal@subtotal',
203
-            'tabname'=>array(MAIN_DB_PREFIX.'c_subtotal_free_text'),		// List of tables we want to see into dictonnary editor
204
-            'tablib'=>array($langs->trans('subtotalFreeLineDictionary')),													// Label of tables
205
-            '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
206
-            'tabsqlsort'=>array('label ASC'),																					// Sort order
207
-            'tabfield'=>array('label,content'),							// List of fields (result of select to show dictionary)
208
-            'tabfieldvalue'=>array('label,content'),						// List of fields (list of fields to edit a record)
209
-            'tabfieldinsert'=>array('label,content,entity'),					// List of fields (list of fields for insert)
210
-            'tabrowid'=>array('rowid'),											// Name of columns with primary key (try to always name it 'rowid')
211
-            'tabcond'=>array($conf->subtotal->enabled)	
203
+			'tabname'=>array(MAIN_DB_PREFIX.'c_subtotal_free_text'),		// List of tables we want to see into dictonnary editor
204
+			'tablib'=>array($langs->trans('subtotalFreeLineDictionary')),													// Label of tables
205
+			'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
206
+			'tabsqlsort'=>array('label ASC'),																					// Sort order
207
+			'tabfield'=>array('label,content'),							// List of fields (result of select to show dictionary)
208
+			'tabfieldvalue'=>array('label,content'),						// List of fields (list of fields to edit a record)
209
+			'tabfieldinsert'=>array('label,content,entity'),					// List of fields (list of fields for insert)
210
+			'tabrowid'=>array('rowid'),											// Name of columns with primary key (try to always name it 'rowid')
211
+			'tabcond'=>array($conf->subtotal->enabled)	
212 212
 		);
213
-        /* Example:
213
+		/* Example:
214 214
           // This is to avoid warnings
215 215
           if (! isset($conf->titre->enabled)) $conf->titre->enabled=0;
216 216
           $this->dictionnaries=array(
@@ -251,223 +251,223 @@  discard block
 block discarded – undo
251 251
           );
252 252
          */
253 253
 
254
-        // Boxes
255
-        // Add here list of php file(s) stored in core/boxes that contains class to show a box.
256
-        $this->boxes = array(); // Boxes list
254
+		// Boxes
255
+		// Add here list of php file(s) stored in core/boxes that contains class to show a box.
256
+		$this->boxes = array(); // Boxes list
257 257
        
258
-        /*
258
+		/*
259 259
           $this->boxes[$r][1] = "myboxb.php";
260 260
           $r++;
261 261
          */
262 262
 
263
-        // Permissions
264
-        $this->rights = array(); // Permission array used by this module
265
-        $r = 0;
263
+		// Permissions
264
+		$this->rights = array(); // Permission array used by this module
265
+		$r = 0;
266 266
 
267
-        // Add here list of permission defined by
268
-        // an id, a label, a boolean and two constant strings.
269
-        // Example:
270
-        //// Permission id (must not be already used)
271
-        //$this->rights[$r][0] = 2000;
272
-        //// Permission label
273
-        //$this->rights[$r][1] = 'Permision label';
274
-        //// Permission by default for new user (0/1)
275
-        //$this->rights[$r][3] = 1;
276
-        //// In php code, permission will be checked by test
277
-        //// if ($user->rights->permkey->level1->level2)
278
-        //$this->rights[$r][4] = 'level1';
279
-        //// In php code, permission will be checked by test
280
-        //// if ($user->rights->permkey->level1->level2)
281
-        //$this->rights[$r][5] = 'level2';
282
-        //$r++;
283
-        // Main menu entries
284
-        $this->menus = array(); // List of menus to add
285
-        $r = 0;
267
+		// Add here list of permission defined by
268
+		// an id, a label, a boolean and two constant strings.
269
+		// Example:
270
+		//// Permission id (must not be already used)
271
+		//$this->rights[$r][0] = 2000;
272
+		//// Permission label
273
+		//$this->rights[$r][1] = 'Permision label';
274
+		//// Permission by default for new user (0/1)
275
+		//$this->rights[$r][3] = 1;
276
+		//// In php code, permission will be checked by test
277
+		//// if ($user->rights->permkey->level1->level2)
278
+		//$this->rights[$r][4] = 'level1';
279
+		//// In php code, permission will be checked by test
280
+		//// if ($user->rights->permkey->level1->level2)
281
+		//$this->rights[$r][5] = 'level2';
282
+		//$r++;
283
+		// Main menu entries
284
+		$this->menus = array(); // List of menus to add
285
+		$r = 0;
286 286
 
287
-        // Add here entries to declare new menus
288
-        //
289
-        // Example to declare a new Top Menu entry and its Left menu entry:
290
-        //$this->menu[$r]=array(
291
-        //	// Put 0 if this is a top menu
292
-        //	'fk_menu'=>0,
293
-        //	// This is a Top menu entry
294
-        //	'type'=>'top',
295
-        //	'titre'=>'titre top menu',
296
-        //	'mainmenu'=>'titre',
297
-        //	'leftmenu'=>'titre',
298
-        //	'url'=>'/titre/pagetop.php',
299
-        //	// Lang file to use (without .lang) by module.
300
-        //	// File must be in langs/code_CODE/ directory.
301
-        //	'langs'=>'mylangfile',
302
-        //	'position'=>100,
303
-        //	// Define condition to show or hide menu entry.
304
-        //	// Use '$conf->titre->enabled' if entry must be visible if module is enabled.
305
-        //	'enabled'=>'$conf->titre->enabled',
306
-        //	// Use 'perms'=>'$user->rights->titre->level1->level2'
307
-        //	// if you want your menu with a permission rules
308
-        //	'perms'=>'1',
309
-        //	'target'=>'',
310
-        //	// 0=Menu for internal users, 1=external users, 2=both
311
-        //	'user'=>2
312
-        //);
313
-        //$r++;
314
-        //$this->menu[$r]=array(
315
-        //	// Use r=value where r is index key used for the parent menu entry
316
-        //	// (higher parent must be a top menu entry)
317
-        //	'fk_menu'=>'r=0',
318
-        //	// This is a Left menu entry
319
-        //	'type'=>'left',
320
-        //	'titre'=>'titre left menu',
321
-        //	'mainmenu'=>'titre',
322
-        //	'leftmenu'=>'titre',
323
-        //	'url'=>'/titre/pagelevel1.php',
324
-        //	// Lang file to use (without .lang) by module.
325
-        //	// File must be in langs/code_CODE/ directory.
326
-        //	'langs'=>'mylangfile',
327
-        //	'position'=>100,
328
-        //	// Define condition to show or hide menu entry.
329
-        //	// Use '$conf->titre->enabled' if entry must be visible if module is enabled.
330
-        //	'enabled'=>'$conf->titre->enabled',
331
-        //	// Use 'perms'=>'$user->rights->titre->level1->level2'
332
-        //	// if you want your menu with a permission rules
333
-        //	'perms'=>'1',
334
-        //	'target'=>'',
335
-        //	// 0=Menu for internal users, 1=external users, 2=both
336
-        //	'user'=>2
337
-        //);
338
-        //$r++;
339
-        //
340
-        // Example to declare a Left Menu entry into an existing Top menu entry:
341
-        //$this->menu[$r]=array(
342
-        //	// Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy'
343
-        //	'fk_menu'=>'fk_mainmenu=mainmenucode',
344
-        //	// This is a Left menu entry
345
-        //	'type'=>'left',
346
-        //	'titre'=>'titre left menu',
347
-        //	'mainmenu'=>'mainmenucode',
348
-        //	'leftmenu'=>'titre',
349
-        //	'url'=>'/titre/pagelevel2.php',
350
-        //	// Lang file to use (without .lang) by module.
351
-        //	// File must be in langs/code_CODE/ directory.
352
-        //	'langs'=>'mylangfile',
353
-        //	'position'=>100,
354
-        //	// Define condition to show or hide menu entry.
355
-        //	// Use '$conf->titre->enabled' if entry must be visible if module is enabled.
356
-        //	// Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
357
-        //	'enabled'=>'$conf->titre->enabled',
358
-        //	// Use 'perms'=>'$user->rights->titre->level1->level2'
359
-        //	// if you want your menu with a permission rules
360
-        //	'perms'=>'1',
361
-        //	'target'=>'',
362
-        //	// 0=Menu for internal users, 1=external users, 2=both
363
-        //	'user'=>2
364
-        //);
365
-        //$r++;
366
-        // Exports
367
-        $r = 1;
287
+		// Add here entries to declare new menus
288
+		//
289
+		// Example to declare a new Top Menu entry and its Left menu entry:
290
+		//$this->menu[$r]=array(
291
+		//	// Put 0 if this is a top menu
292
+		//	'fk_menu'=>0,
293
+		//	// This is a Top menu entry
294
+		//	'type'=>'top',
295
+		//	'titre'=>'titre top menu',
296
+		//	'mainmenu'=>'titre',
297
+		//	'leftmenu'=>'titre',
298
+		//	'url'=>'/titre/pagetop.php',
299
+		//	// Lang file to use (without .lang) by module.
300
+		//	// File must be in langs/code_CODE/ directory.
301
+		//	'langs'=>'mylangfile',
302
+		//	'position'=>100,
303
+		//	// Define condition to show or hide menu entry.
304
+		//	// Use '$conf->titre->enabled' if entry must be visible if module is enabled.
305
+		//	'enabled'=>'$conf->titre->enabled',
306
+		//	// Use 'perms'=>'$user->rights->titre->level1->level2'
307
+		//	// if you want your menu with a permission rules
308
+		//	'perms'=>'1',
309
+		//	'target'=>'',
310
+		//	// 0=Menu for internal users, 1=external users, 2=both
311
+		//	'user'=>2
312
+		//);
313
+		//$r++;
314
+		//$this->menu[$r]=array(
315
+		//	// Use r=value where r is index key used for the parent menu entry
316
+		//	// (higher parent must be a top menu entry)
317
+		//	'fk_menu'=>'r=0',
318
+		//	// This is a Left menu entry
319
+		//	'type'=>'left',
320
+		//	'titre'=>'titre left menu',
321
+		//	'mainmenu'=>'titre',
322
+		//	'leftmenu'=>'titre',
323
+		//	'url'=>'/titre/pagelevel1.php',
324
+		//	// Lang file to use (without .lang) by module.
325
+		//	// File must be in langs/code_CODE/ directory.
326
+		//	'langs'=>'mylangfile',
327
+		//	'position'=>100,
328
+		//	// Define condition to show or hide menu entry.
329
+		//	// Use '$conf->titre->enabled' if entry must be visible if module is enabled.
330
+		//	'enabled'=>'$conf->titre->enabled',
331
+		//	// Use 'perms'=>'$user->rights->titre->level1->level2'
332
+		//	// if you want your menu with a permission rules
333
+		//	'perms'=>'1',
334
+		//	'target'=>'',
335
+		//	// 0=Menu for internal users, 1=external users, 2=both
336
+		//	'user'=>2
337
+		//);
338
+		//$r++;
339
+		//
340
+		// Example to declare a Left Menu entry into an existing Top menu entry:
341
+		//$this->menu[$r]=array(
342
+		//	// Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy'
343
+		//	'fk_menu'=>'fk_mainmenu=mainmenucode',
344
+		//	// This is a Left menu entry
345
+		//	'type'=>'left',
346
+		//	'titre'=>'titre left menu',
347
+		//	'mainmenu'=>'mainmenucode',
348
+		//	'leftmenu'=>'titre',
349
+		//	'url'=>'/titre/pagelevel2.php',
350
+		//	// Lang file to use (without .lang) by module.
351
+		//	// File must be in langs/code_CODE/ directory.
352
+		//	'langs'=>'mylangfile',
353
+		//	'position'=>100,
354
+		//	// Define condition to show or hide menu entry.
355
+		//	// Use '$conf->titre->enabled' if entry must be visible if module is enabled.
356
+		//	// Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
357
+		//	'enabled'=>'$conf->titre->enabled',
358
+		//	// Use 'perms'=>'$user->rights->titre->level1->level2'
359
+		//	// if you want your menu with a permission rules
360
+		//	'perms'=>'1',
361
+		//	'target'=>'',
362
+		//	// 0=Menu for internal users, 1=external users, 2=both
363
+		//	'user'=>2
364
+		//);
365
+		//$r++;
366
+		// Exports
367
+		$r = 1;
368 368
 
369
-        // Example:
370
-        //$this->export_code[$r]=$this->rights_class.'_'.$r;
371
-        //// Translation key (used only if key ExportDataset_xxx_z not found)
372
-        //$this->export_label[$r]='CustomersInvoicesAndInvoiceLines';
373
-        //// Condition to show export in list (ie: '$user->id==3').
374
-        //// Set to 1 to always show when module is enabled.
375
-        //$this->export_enabled[$r]='1';
376
-        //$this->export_permission[$r]=array(array("facture","facture","export"));
377
-        //$this->export_fields_array[$r]=array(
378
-        //	's.rowid'=>"IdCompany",
379
-        //	's.nom'=>'CompanyName',
380
-        //	's.address'=>'Address',
381
-        //	's.cp'=>'Zip',
382
-        //	's.ville'=>'Town',
383
-        //	's.fk_pays'=>'Country',
384
-        //	's.tel'=>'Phone',
385
-        //	's.siren'=>'ProfId1',
386
-        //	's.siret'=>'ProfId2',
387
-        //	's.ape'=>'ProfId3',
388
-        //	's.idprof4'=>'ProfId4',
389
-        //	's.code_compta'=>'CustomerAccountancyCode',
390
-        //	's.code_compta_fournisseur'=>'SupplierAccountancyCode',
391
-        //	'f.rowid'=>"InvoiceId",
392
-        //	'f.facnumber'=>"InvoiceRef",
393
-        //	'f.datec'=>"InvoiceDateCreation",
394
-        //	'f.datef'=>"DateInvoice",
395
-        //	'f.total'=>"TotalHT",
396
-        //	'f.total_ttc'=>"TotalTTC",
397
-        //	'f.tva'=>"TotalVAT",
398
-        //	'f.paye'=>"InvoicePaid",
399
-        //	'f.fk_statut'=>'InvoiceStatus',
400
-        //	'f.note'=>"InvoiceNote",
401
-        //	'fd.rowid'=>'LineId',
402
-        //	'fd.description'=>"LineDescription",
403
-        //	'fd.price'=>"LineUnitPrice",
404
-        //	'fd.tva_tx'=>"LineVATRate",
405
-        //	'fd.qty'=>"LineQty",
406
-        //	'fd.total_ht'=>"LineTotalHT",
407
-        //	'fd.total_tva'=>"LineTotalTVA",
408
-        //	'fd.total_ttc'=>"LineTotalTTC",
409
-        //	'fd.date_start'=>"DateStart",
410
-        //	'fd.date_end'=>"DateEnd",
411
-        //	'fd.fk_product'=>'ProductId',
412
-        //	'p.ref'=>'ProductRef'
413
-        //);
414
-        //$this->export_entities_array[$r]=array('s.rowid'=>"company",
415
-        //	's.nom'=>'company',
416
-        //	's.address'=>'company',
417
-        //	's.cp'=>'company',
418
-        //	's.ville'=>'company',
419
-        //	's.fk_pays'=>'company',
420
-        //	's.tel'=>'company',
421
-        //	's.siren'=>'company',
422
-        //	's.siret'=>'company',
423
-        //	's.ape'=>'company',
424
-        //	's.idprof4'=>'company',
425
-        //	's.code_compta'=>'company',
426
-        //	's.code_compta_fournisseur'=>'company',
427
-        //	'f.rowid'=>"invoice",
428
-        //	'f.facnumber'=>"invoice",
429
-        //	'f.datec'=>"invoice",
430
-        //	'f.datef'=>"invoice",
431
-        //	'f.total'=>"invoice",
432
-        //	'f.total_ttc'=>"invoice",
433
-        //	'f.tva'=>"invoice",
434
-        //	'f.paye'=>"invoice",
435
-        //	'f.fk_statut'=>'invoice',
436
-        //	'f.note'=>"invoice",
437
-        //	'fd.rowid'=>'invoice_line',
438
-        //	'fd.description'=>"invoice_line",
439
-        //	'fd.price'=>"invoice_line",
440
-        //	'fd.total_ht'=>"invoice_line",
441
-        //	'fd.total_tva'=>"invoice_line",
442
-        //	'fd.total_ttc'=>"invoice_line",
443
-        //	'fd.tva_tx'=>"invoice_line",
444
-        //	'fd.qty'=>"invoice_line",
445
-        //	'fd.date_start'=>"invoice_line",
446
-        //	'fd.date_end'=>"invoice_line",
447
-        //	'fd.fk_product'=>'product',
448
-        //	'p.ref'=>'product'
449
-        //);
450
-        //$this->export_sql_start[$r] = 'SELECT DISTINCT ';
451
-        //$this->export_sql_end[$r] = ' FROM (' . MAIN_DB_PREFIX . 'facture as f, '
452
-        //	. MAIN_DB_PREFIX . 'facturedet as fd, ' . MAIN_DB_PREFIX . 'societe as s)';
453
-        //$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX
454
-        //	. 'product as p on (fd.fk_product = p.rowid)';
455
-        //$this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid '
456
-        //	. 'AND f.rowid = fd.fk_facture';
457
-        //$r++;
458
-    }
369
+		// Example:
370
+		//$this->export_code[$r]=$this->rights_class.'_'.$r;
371
+		//// Translation key (used only if key ExportDataset_xxx_z not found)
372
+		//$this->export_label[$r]='CustomersInvoicesAndInvoiceLines';
373
+		//// Condition to show export in list (ie: '$user->id==3').
374
+		//// Set to 1 to always show when module is enabled.
375
+		//$this->export_enabled[$r]='1';
376
+		//$this->export_permission[$r]=array(array("facture","facture","export"));
377
+		//$this->export_fields_array[$r]=array(
378
+		//	's.rowid'=>"IdCompany",
379
+		//	's.nom'=>'CompanyName',
380
+		//	's.address'=>'Address',
381
+		//	's.cp'=>'Zip',
382
+		//	's.ville'=>'Town',
383
+		//	's.fk_pays'=>'Country',
384
+		//	's.tel'=>'Phone',
385
+		//	's.siren'=>'ProfId1',
386
+		//	's.siret'=>'ProfId2',
387
+		//	's.ape'=>'ProfId3',
388
+		//	's.idprof4'=>'ProfId4',
389
+		//	's.code_compta'=>'CustomerAccountancyCode',
390
+		//	's.code_compta_fournisseur'=>'SupplierAccountancyCode',
391
+		//	'f.rowid'=>"InvoiceId",
392
+		//	'f.facnumber'=>"InvoiceRef",
393
+		//	'f.datec'=>"InvoiceDateCreation",
394
+		//	'f.datef'=>"DateInvoice",
395
+		//	'f.total'=>"TotalHT",
396
+		//	'f.total_ttc'=>"TotalTTC",
397
+		//	'f.tva'=>"TotalVAT",
398
+		//	'f.paye'=>"InvoicePaid",
399
+		//	'f.fk_statut'=>'InvoiceStatus',
400
+		//	'f.note'=>"InvoiceNote",
401
+		//	'fd.rowid'=>'LineId',
402
+		//	'fd.description'=>"LineDescription",
403
+		//	'fd.price'=>"LineUnitPrice",
404
+		//	'fd.tva_tx'=>"LineVATRate",
405
+		//	'fd.qty'=>"LineQty",
406
+		//	'fd.total_ht'=>"LineTotalHT",
407
+		//	'fd.total_tva'=>"LineTotalTVA",
408
+		//	'fd.total_ttc'=>"LineTotalTTC",
409
+		//	'fd.date_start'=>"DateStart",
410
+		//	'fd.date_end'=>"DateEnd",
411
+		//	'fd.fk_product'=>'ProductId',
412
+		//	'p.ref'=>'ProductRef'
413
+		//);
414
+		//$this->export_entities_array[$r]=array('s.rowid'=>"company",
415
+		//	's.nom'=>'company',
416
+		//	's.address'=>'company',
417
+		//	's.cp'=>'company',
418
+		//	's.ville'=>'company',
419
+		//	's.fk_pays'=>'company',
420
+		//	's.tel'=>'company',
421
+		//	's.siren'=>'company',
422
+		//	's.siret'=>'company',
423
+		//	's.ape'=>'company',
424
+		//	's.idprof4'=>'company',
425
+		//	's.code_compta'=>'company',
426
+		//	's.code_compta_fournisseur'=>'company',
427
+		//	'f.rowid'=>"invoice",
428
+		//	'f.facnumber'=>"invoice",
429
+		//	'f.datec'=>"invoice",
430
+		//	'f.datef'=>"invoice",
431
+		//	'f.total'=>"invoice",
432
+		//	'f.total_ttc'=>"invoice",
433
+		//	'f.tva'=>"invoice",
434
+		//	'f.paye'=>"invoice",
435
+		//	'f.fk_statut'=>'invoice',
436
+		//	'f.note'=>"invoice",
437
+		//	'fd.rowid'=>'invoice_line',
438
+		//	'fd.description'=>"invoice_line",
439
+		//	'fd.price'=>"invoice_line",
440
+		//	'fd.total_ht'=>"invoice_line",
441
+		//	'fd.total_tva'=>"invoice_line",
442
+		//	'fd.total_ttc'=>"invoice_line",
443
+		//	'fd.tva_tx'=>"invoice_line",
444
+		//	'fd.qty'=>"invoice_line",
445
+		//	'fd.date_start'=>"invoice_line",
446
+		//	'fd.date_end'=>"invoice_line",
447
+		//	'fd.fk_product'=>'product',
448
+		//	'p.ref'=>'product'
449
+		//);
450
+		//$this->export_sql_start[$r] = 'SELECT DISTINCT ';
451
+		//$this->export_sql_end[$r] = ' FROM (' . MAIN_DB_PREFIX . 'facture as f, '
452
+		//	. MAIN_DB_PREFIX . 'facturedet as fd, ' . MAIN_DB_PREFIX . 'societe as s)';
453
+		//$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX
454
+		//	. 'product as p on (fd.fk_product = p.rowid)';
455
+		//$this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid '
456
+		//	. 'AND f.rowid = fd.fk_facture';
457
+		//$r++;
458
+	}
459 459
 
460
-    /**
461
-     * Function called when module is enabled.
462
-     * The init function add constants, boxes, permissions and menus
463
-     * (defined in constructor) into Dolibarr database.
464
-     * It also creates data directories
465
-     *
466
-     * 	@param		string	$options	Options when enabling module ('', 'noboxes')
467
-     * 	@return		int					1 if OK, 0 if KO
468
-     */
469
-    public function init($options = '')
470
-    {
460
+	/**
461
+	 * Function called when module is enabled.
462
+	 * The init function add constants, boxes, permissions and menus
463
+	 * (defined in constructor) into Dolibarr database.
464
+	 * It also creates data directories
465
+	 *
466
+	 * 	@param		string	$options	Options when enabling module ('', 'noboxes')
467
+	 * 	@return		int					1 if OK, 0 if KO
468
+	 */
469
+	public function init($options = '')
470
+	{
471 471
 	  	global $conf, $db;
472 472
 		
473 473
 		
@@ -475,46 +475,46 @@  discard block
 block discarded – undo
475 475
 			exit("Attention, ce module rentre ne conflit avec le module Jalon/Milestones. Merci de le désactiver auparavant.");
476 476
 		}
477 477
       */
478
-	    $sql = array();
478
+		$sql = array();
479 479
 
480
-        $result = $this->loadTables();
481
-        dol_include_once('/core/class/extrafields.class.php');
480
+		$result = $this->loadTables();
481
+		dol_include_once('/core/class/extrafields.class.php');
482 482
 	
483
-        $extra = new ExtraFields($db); // propaldet, commandedet, facturedet
484
-        $TElementType = array('propaldet', 'commandedet', 'facturedet', 'supplier_proposaldet', 'commande_fournisseurdet', 'facture_fourn_det');
485
-        foreach($TElementType as $element_type) {
486
-            $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);
487
-            $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);
488
-        }
483
+		$extra = new ExtraFields($db); // propaldet, commandedet, facturedet
484
+		$TElementType = array('propaldet', 'commandedet', 'facturedet', 'supplier_proposaldet', 'commande_fournisseurdet', 'facture_fourn_det');
485
+		foreach($TElementType as $element_type) {
486
+			$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);
487
+			$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);
488
+		}
489 489
 		
490
-        return $this->_init($sql, $options);
491
-    }
490
+		return $this->_init($sql, $options);
491
+	}
492 492
 
493
-    /**
494
-     * Function called when module is disabled.
495
-     * Remove from database constants, boxes and permissions from Dolibarr database.
496
-     * Data directories are not deleted
497
-     *
498
-     * 	@param		string	$options	Options when enabling module ('', 'noboxes')
499
-     * 	@return		int					1 if OK, 0 if KO
500
-     */
501
-    public function remove($options = '')
502
-    {
503
-        $sql = array();
493
+	/**
494
+	 * Function called when module is disabled.
495
+	 * Remove from database constants, boxes and permissions from Dolibarr database.
496
+	 * Data directories are not deleted
497
+	 *
498
+	 * 	@param		string	$options	Options when enabling module ('', 'noboxes')
499
+	 * 	@return		int					1 if OK, 0 if KO
500
+	 */
501
+	public function remove($options = '')
502
+	{
503
+		$sql = array();
504 504
 
505
-        return $this->_remove($sql, $options);
506
-    }
505
+		return $this->_remove($sql, $options);
506
+	}
507 507
 
508
-    /**
509
-     * Create tables, keys and data required by module
510
-     * Files llx_table1.sql, llx_table1.key.sql llx_data.sql with create table, create keys
511
-     * and create data commands must be stored in directory /titre/sql/
512
-     * This function is called by this->init
513
-     *
514
-     * 	@return		int		<=0 if KO, >0 if OK
515
-     */
516
-    private function loadTables()
517
-    {
518
-        return $this->_load_tables('/subtotal/sql/');
519
-    }
508
+	/**
509
+	 * Create tables, keys and data required by module
510
+	 * Files llx_table1.sql, llx_table1.key.sql llx_data.sql with create table, create keys
511
+	 * and create data commands must be stored in directory /titre/sql/
512
+	 * This function is called by this->init
513
+	 *
514
+	 * 	@return		int		<=0 if KO, >0 if OK
515
+	 */
516
+	private function loadTables()
517
+	{
518
+		return $this->_load_tables('/subtotal/sql/');
519
+	}
520 520
 }
Please login to merge, or discard this patch.
class/actions_subtotal.class.php 1 patch
Indentation   +304 added lines, -304 removed lines patch added patch discarded remove patch
@@ -101,11 +101,11 @@  discard block
 block discarded – undo
101 101
 	 * @return     void
102 102
 	 */
103 103
     
104
-    var $module_number = 104777;
104
+	var $module_number = 104777;
105 105
     
106
-    function formObjectOptions($parameters, &$object, &$action, $hookmanager) 
107
-    {
108
-      	global $langs,$db,$user, $conf;
106
+	function formObjectOptions($parameters, &$object, &$action, $hookmanager) 
107
+	{
108
+	  	global $langs,$db,$user, $conf;
109 109
 		
110 110
 		$langs->load('subtotal@subtotal');
111 111
 		
@@ -120,10 +120,10 @@  discard block
 block discarded – undo
120 120
 				$createRight = $user->rights->facture->creer;
121 121
 			} elseif($object->element == 'order_supplier' )
122 122
 			{
123
-			    $createRight = $user->rights->fournisseur->commande->creer;
123
+				$createRight = $user->rights->fournisseur->commande->creer;
124 124
 			} elseif($object->element == 'invoice_supplier' )
125 125
 			{
126
-			    $createRight = $user->rights->fournisseur->facture->creer;
126
+				$createRight = $user->rights->fournisseur->facture->creer;
127 127
 			}
128 128
 			elseif($object->element == 'shipping')
129 129
 			{
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 					
178 178
 					if (!empty($conf->global->SUBTOTAL_AUTO_ADD_SUBTOTAL_ON_ADDING_NEW_TITLE) && $qty < 10) TSubtotal::addSubtotalMissing($object, $qty);
179 179
 					
180
-	    			TSubtotal::addSubTotalLine($object, $title, $qty);
180
+					TSubtotal::addSubTotalLine($object, $title, $qty);
181 181
 				}
182 182
 				else if($action==='ask_deleteallline') {
183 183
 						$form=new Form($db);
@@ -399,36 +399,36 @@  discard block
 block discarded – undo
399 399
 		$TContext = explode(':',$parameters['context']);
400 400
 		if (
401 401
 				in_array('invoicecard',$TContext)
402
-		        || in_array('invoicesuppliercard',$TContext)
402
+				|| in_array('invoicesuppliercard',$TContext)
403 403
 				|| in_array('propalcard',$TContext)
404 404
 				|| in_array('ordercard',$TContext)
405
-		        || in_array('ordersuppliercard',$TContext)
405
+				|| in_array('ordersuppliercard',$TContext)
406 406
 				|| in_array('invoicereccard',$TContext)
407 407
 			)
408
-	        {	
409
-	            $hideInnerLines	= isset( $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] ) ?  $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] : 0;
410
-	            $hidedetails	= isset( $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] ) ?  $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] : 0;
408
+			{	
409
+				$hideInnerLines	= isset( $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] ) ?  $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] : 0;
410
+				$hidedetails	= isset( $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] ) ?  $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] : 0;
411 411
 				$hidepricesDefaultConf = !empty($conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED)?$conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED:0;
412 412
 				$hideprices= isset( $_SESSION['subtotal_hideprices_'.$parameters['modulepart']][$object->id] ) ?  $_SESSION['subtotal_hideprices_'.$parameters['modulepart']][$object->id] : $hidepricesDefaultConf;
413 413
 				
414 414
 				$var=false;
415
-		     	$out.= '<tr '.$bc[$var].'>
415
+			 	$out.= '<tr '.$bc[$var].'>
416 416
 		     			<td colspan="4" align="right">
417 417
 		     				<label for="hideInnerLines">'.$langs->trans('HideInnerLines').'</label>
418 418
 		     				<input type="checkbox" onclick="if($(this).is(\':checked\')) { $(\'#hidedetails\').prop(\'checked\', \'checked\')  }" id="hideInnerLines" name="hideInnerLines" value="1" '.(( $hideInnerLines ) ? 'checked="checked"' : '' ).' />
419 419
 		     			</td>
420 420
 		     			</tr>';
421 421
 				
422
-		     	$var=!$var;
423
-		     	$out.= '<tr '.$bc[$var].'>
422
+			 	$var=!$var;
423
+			 	$out.= '<tr '.$bc[$var].'>
424 424
 		     			<td colspan="4" align="right">
425 425
 		     				<label for="hidedetails">'.$langs->trans('SubTotalhidedetails').'</label>
426 426
 		     				<input type="checkbox" id="hidedetails" name="hidedetails" value="1" '.(( $hidedetails ) ? 'checked="checked"' : '' ).' />
427 427
 		     			</td>
428 428
 		     			</tr>';
429 429
 		     	
430
-		     	$var=!$var;
431
-		     	$out.= '<tr '.$bc[$var].'>
430
+			 	$var=!$var;
431
+			 	$out.= '<tr '.$bc[$var].'>
432 432
 		     			<td colspan="4" align="right">
433 433
 		     				<label for="hideprices">'.$langs->trans('SubTotalhidePrice').'</label>
434 434
 		     				<input type="checkbox" id="hideprices" name="hideprices" value="1" '.(( $hideprices ) ? 'checked="checked"' : '' ).' />
@@ -440,9 +440,9 @@  discard block
 block discarded – undo
440 440
 				if ( 
441 441
 					(in_array('propalcard',$TContext) && !empty($conf->global->SUBTOTAL_PROPAL_ADD_RECAP))
442 442
 					|| (in_array('ordercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP))
443
-				    || (in_array('ordersuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP))
443
+					|| (in_array('ordersuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP))
444 444
 					|| (in_array('invoicecard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP))
445
-				    || (in_array('invoicesuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP))
445
+					|| (in_array('invoicesuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP))
446 446
 					|| (in_array('invoicereccard',$TContext)  && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP ))
447 447
 				)
448 448
 				{
@@ -461,19 +461,19 @@  discard block
 block discarded – undo
461 461
 			}
462 462
 			
463 463
 		
464
-        return 1;
464
+		return 1;
465 465
 	} 
466 466
 	 
467
-    function formEditProductOptions($parameters, &$object, &$action, $hookmanager) 
468
-    {
467
+	function formEditProductOptions($parameters, &$object, &$action, $hookmanager) 
468
+	{
469 469
 		
470
-    	if (in_array('invoicecard',explode(':',$parameters['context'])))
471
-        {
470
+		if (in_array('invoicecard',explode(':',$parameters['context'])))
471
+		{
472 472
         	
473
-        }
473
+		}
474 474
 		
475
-        return 0;
476
-    }
475
+		return 0;
476
+	}
477 477
 	
478 478
 	function ODTSubstitutionLine(&$parameters, &$object, $action, $hookmanager) {
479 479
 		global $conf;
@@ -484,14 +484,14 @@  discard block
 block discarded – undo
484 484
 			$object = &$parameters['object'];
485 485
 			$substitutionarray = &$parameters['substitutionarray'];
486 486
 			
487
-            $substitutionarray['line_not_modsubtotal'] = true;
488
-            $substitutionarray['line_modsubtotal'] = false;
489
-            $substitutionarray['line_modsubtotal_total'] = false;
490
-            $substitutionarray['line_modsubtotal_title'] = false;
487
+			$substitutionarray['line_not_modsubtotal'] = true;
488
+			$substitutionarray['line_modsubtotal'] = false;
489
+			$substitutionarray['line_modsubtotal_total'] = false;
490
+			$substitutionarray['line_modsubtotal_title'] = false;
491 491
 
492 492
 			if($line->product_type == 9 && $line->special_code == $this->module_number) {
493 493
 				$substitutionarray['line_modsubtotal'] = 1;	
494
-                $substitutionarray['line_not_modsubtotal'] = false;
494
+				$substitutionarray['line_not_modsubtotal'] = false;
495 495
 				
496 496
 				$substitutionarray['line_price_ht']
497 497
 					 = $substitutionarray['line_price_vat'] 
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
 					$substitutionarray['line_modsubtotal_total'] = true;
506 506
 					
507 507
 					//list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1);
508
-                    $TInfo = $this->getTotalLineFromObject($object, $line, '', 1);
508
+					$TInfo = $this->getTotalLineFromObject($object, $line, '', 1);
509 509
 
510 510
 					$substitutionarray['line_price_ht'] = price($TInfo[0]);
511 511
 					$substitutionarray['line_price_vat'] = price($TInfo[1]);
@@ -529,11 +529,11 @@  discard block
 block discarded – undo
529 529
 	
530 530
 		if (
531 531
 				in_array('invoicecard',explode(':',$parameters['context']))
532
-		        || in_array('invoicesuppliercard',explode(':',$parameters['context']))
532
+				|| in_array('invoicesuppliercard',explode(':',$parameters['context']))
533 533
 				|| in_array('propalcard',explode(':',$parameters['context']))
534
-		        || in_array('supplier_proposalcard',explode(':',$parameters['context']))
534
+				|| in_array('supplier_proposalcard',explode(':',$parameters['context']))
535 535
 				|| in_array('ordercard',explode(':',$parameters['context']))
536
-		        || in_array('ordersuppliercard',explode(':',$parameters['context']))
536
+				|| in_array('ordersuppliercard',explode(':',$parameters['context']))
537 537
 				|| in_array('invoicereccard',explode(':',$parameters['context']))
538 538
 		) {
539 539
 			
@@ -612,20 +612,20 @@  discard block
 block discarded – undo
612 612
 				in_array('invoicecard',explode(':',$parameters['context']))
613 613
 				|| in_array('propalcard',explode(':',$parameters['context']))
614 614
 				|| in_array('ordercard',explode(':',$parameters['context']))
615
-			    || in_array('ordersuppliercard',explode(':',$parameters['context']))
616
-			    || in_array('invoicesuppliercard',explode(':',$parameters['context']))
617
-			    || in_array('supplier_proposalcard',explode(':',$parameters['context']))
615
+				|| in_array('ordersuppliercard',explode(':',$parameters['context']))
616
+				|| in_array('invoicesuppliercard',explode(':',$parameters['context']))
617
+				|| in_array('supplier_proposalcard',explode(':',$parameters['context']))
618 618
 			)
619
-	        {								
619
+			{								
620 620
 				if(in_array('invoicecard',explode(':',$parameters['context']))) {
621 621
 					$sessname = 'subtotal_hideInnerLines_facture';	
622 622
 					$sessname2 = 'subtotal_hidedetails_facture';
623 623
 					$sessname3 = 'subtotal_hideprices_facture';
624 624
 				}
625 625
 				elseif(in_array('invoicesuppliercard',explode(':',$parameters['context']))) {
626
-				    $sessname = 'subtotal_hideInnerLines_facture_fournisseur';
627
-				    $sessname2 = 'subtotal_hidedetails_facture_fournisseur';
628
-				    $sessname3 = 'subtotal_hideprices_facture_fournisseur';
626
+					$sessname = 'subtotal_hideInnerLines_facture_fournisseur';
627
+					$sessname2 = 'subtotal_hidedetails_facture_fournisseur';
628
+					$sessname3 = 'subtotal_hideprices_facture_fournisseur';
629 629
 				}
630 630
 				elseif(in_array('propalcard',explode(':',$parameters['context']))) {
631 631
 					$sessname = 'subtotal_hideInnerLines_propal';
@@ -633,9 +633,9 @@  discard block
 block discarded – undo
633 633
 					$sessname3 = 'subtotal_hideprices_propal';
634 634
 				}
635 635
 				elseif(in_array('supplier_proposalcard',explode(':',$parameters['context']))) {
636
-				    $sessname = 'subtotal_hideInnerLines_supplier_proposal';
637
-				    $sessname2 = 'subtotal_hidedetails_supplier_proposal';
638
-				    $sessname3 = 'subtotal_hideprices_supplier_proposal';
636
+					$sessname = 'subtotal_hideInnerLines_supplier_proposal';
637
+					$sessname2 = 'subtotal_hidedetails_supplier_proposal';
638
+					$sessname3 = 'subtotal_hideprices_supplier_proposal';
639 639
 				}
640 640
 				elseif(in_array('ordercard',explode(':',$parameters['context']))) {
641 641
 					$sessname = 'subtotal_hideInnerLines_commande';
@@ -643,9 +643,9 @@  discard block
 block discarded – undo
643 643
 					$sessname3 = 'subtotal_hideprices_commande';
644 644
 				}
645 645
 				elseif(in_array('ordersuppliercard',explode(':',$parameters['context']))) {
646
-				    $sessname = 'subtotal_hideInnerLines_commande_fournisseur';
647
-				    $sessname2 = 'subtotal_hidedetails_commande_fournisseur';
648
-				    $sessname3 = 'subtotal_hideprices_commande_fournisseur';
646
+					$sessname = 'subtotal_hideInnerLines_commande_fournisseur';
647
+					$sessname2 = 'subtotal_hidedetails_commande_fournisseur';
648
+					$sessname3 = 'subtotal_hideprices_commande_fournisseur';
649 649
 				}
650 650
 				else {
651 651
 					$sessname = 'subtotal_hideInnerLines_unknown';
@@ -670,17 +670,17 @@  discard block
 block discarded – undo
670 670
 				foreach($object->lines as &$line) {
671 671
 					if ($line->product_type == 9 && $line->special_code == $this->module_number) {
672 672
 					    
673
-                        if($line->qty>=90) {
674
-                            $line->modsubtotal_total = 1;
675
-                        }
676
-                        else{
677
-                            $line->modsubtotal_title = 1;
678
-                        }
673
+						if($line->qty>=90) {
674
+							$line->modsubtotal_total = 1;
675
+						}
676
+						else{
677
+							$line->modsubtotal_title = 1;
678
+						}
679 679
                         
680 680
 						$line->total_ht = $this->getTotalLineFromObject($object, $line, '');
681 681
 					}
682
-	        	}
683
-	        }
682
+				}
683
+			}
684 684
 			
685 685
 		}
686 686
 		else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') {
@@ -697,7 +697,7 @@  discard block
 block discarded – undo
697 697
 				 */
698 698
 				else if($object->element=='invoice_supplier')
699 699
 				{
700
-				    $object->deleteline($idLine);
700
+					$object->deleteline($idLine);
701 701
 				}
702 702
 				/**
703 703
 				 * @var $object Propal
@@ -720,7 +720,7 @@  discard block
 block discarded – undo
720 720
 				 */
721 721
 				else if($object->element=='order_supplier')
722 722
 				{
723
-				    $object->deleteline($idLine);
723
+					$object->deleteline($idLine);
724 724
 				}
725 725
 				/**
726 726
 				 * @var $object Facturerec
@@ -795,7 +795,7 @@  discard block
 block discarded – undo
795 795
 		
796 796
 		foreach($object->lines as $l) {
797 797
 		
798
-		    $lid = (!empty($l->rowid) ? $l->rowid : $l->id);
798
+			$lid = (!empty($l->rowid) ? $l->rowid : $l->id);
799 799
 			if($lid == $lineid) {
800 800
 
801 801
 				$found = true;
@@ -804,7 +804,7 @@  discard block
 block discarded – undo
804 804
 			
805 805
 			if($found) {
806 806
 				
807
-			    $Tab[] = (!empty($l->rowid) ? $l->rowid : $l->id);
807
+				$Tab[] = (!empty($l->rowid) ? $l->rowid : $l->id);
808 808
 				
809 809
 				if($l->special_code==$this->module_number && (($l->qty==99 && $qty_line==1) || ($l->qty==98 && $qty_line==2))   ) {
810 810
 					break; // end of story
@@ -936,7 +936,7 @@  discard block
 block discarded – undo
936 936
 		if(method_exists('Closure','bind')) {
937 937
 			$pageBreakOriginalValue = $pdf->AcceptPageBreak();
938 938
 			$sweetsThief = function ($pdf) {
939
-		    		return $pdf->bMargin ;
939
+					return $pdf->bMargin ;
940 940
 			};
941 941
 			$sweetsThief = Closure::bind($sweetsThief, null, $pdf);
942 942
 	
@@ -1007,7 +1007,7 @@  discard block
 block discarded – undo
1007 1007
 					$TTotal_tva = $TInfo[3];
1008 1008
 					$total_to_print = price($TInfo[0]);
1009 1009
 
1010
-                    $line->total_ht = $TInfo[0];
1010
+					$line->total_ht = $TInfo[0];
1011 1011
 					$line->total = $TInfo[0];
1012 1012
 					if (!TSubtotal::isModSubtotalLine($line)) $line->total_tva = $TInfo[1];
1013 1013
 					$line->total_ttc = $TInfo[2];
@@ -1164,7 +1164,7 @@  discard block
 block discarded – undo
1164 1164
 	}
1165 1165
 	
1166 1166
 	function pdf_getlinetotalexcltax($parameters=array(), &$object, &$action='') {
1167
-	    global $conf, $hideprices, $hookmanager;
1167
+		global $conf, $hideprices, $hookmanager;
1168 1168
 		
1169 1169
 		if(is_array($parameters)) $i = & $parameters['i'];
1170 1170
 		else $i = (int)$parameters;
@@ -1203,7 +1203,7 @@  discard block
 block discarded – undo
1203 1203
 			}
1204 1204
 		}
1205 1205
 		if ((int)GETPOST('hideInnerLines') && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)){
1206
-		    $this->resprints = price($object->lines[$i]->total_ht);
1206
+			$this->resprints = price($object->lines[$i]->total_ht);
1207 1207
 		}
1208 1208
 		
1209 1209
 		// Si la gestion C/NC est active et que je suis sur un ligne dont l'extrafield est coché
@@ -1332,7 +1332,7 @@  discard block
 block discarded – undo
1332 1332
 	}
1333 1333
 	
1334 1334
 	function pdf_getlineupexcltax($parameters=array(), &$object, &$action='') {
1335
-	    global $conf,$hideprices,$hookmanager;
1335
+		global $conf,$hideprices,$hookmanager;
1336 1336
 
1337 1337
 		if(is_array($parameters)) $i = & $parameters['i'];
1338 1338
 		else $i = (int)$parameters;
@@ -1340,18 +1340,18 @@  discard block
 block discarded – undo
1340 1340
 		if($this->isModSubtotalLine($parameters,$object) ) {
1341 1341
 			$this->resprints = ' ';
1342 1342
 
1343
-            $line = $object->lines[$i];
1343
+			$line = $object->lines[$i];
1344 1344
 
1345
-            // On récupère les montants du bloc pour les afficher dans la ligne de sous-total
1346
-            if(TSubtotal::isSubtotal($line)) {
1347
-                $parentTitle = TSubtotal::getParentTitleOfLine($object, $i);
1345
+			// On récupère les montants du bloc pour les afficher dans la ligne de sous-total
1346
+			if(TSubtotal::isSubtotal($line)) {
1347
+				$parentTitle = TSubtotal::getParentTitleOfLine($object, $i);
1348 1348
 
1349
-                if(is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals();
1350
-                if(! empty($parentTitle->array_options['options_show_total_ht'])) {
1351
-                    $TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle);
1352
-                    $this->resprints = price($TTotal['total_unit_subprice']);
1353
-                }
1354
-            }
1349
+				if(is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals();
1350
+				if(! empty($parentTitle->array_options['options_show_total_ht'])) {
1351
+					$TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle);
1352
+					$this->resprints = price($TTotal['total_unit_subprice']);
1353
+				}
1354
+			}
1355 1355
 		
1356 1356
 			if((float)DOL_VERSION<=3.6) {
1357 1357
 				return '';
@@ -1367,58 +1367,58 @@  discard block
 block discarded – undo
1367 1367
 		(!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))
1368 1368
 		)
1369 1369
 		{
1370
-		    // alors je dois vérifier si la méthode fait partie de la conf qui l'exclue
1371
-		    if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC)))
1372
-		    {
1373
-		        $this->resprints = ' ';
1370
+			// alors je dois vérifier si la méthode fait partie de la conf qui l'exclue
1371
+			if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC)))
1372
+			{
1373
+				$this->resprints = ' ';
1374 1374
 		        
1375
-		        // currentcontext à modifier celon l'appel
1376
-		        $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i);
1377
-		        return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1)
1375
+				// currentcontext à modifier celon l'appel
1376
+				$params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i);
1377
+				return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1)
1378 1378
 		        
1379
-		    }
1379
+			}
1380 1380
 		}
1381 1381
 		// Cache le prix pour les lignes standards dolibarr qui sont dans un ensemble
1382 1382
 		else if (!empty($hideprices))
1383 1383
 		{
1384 1384
 		    
1385
-		    // Check if a title exist for this line && if the title have subtotal
1386
-		    $lineTitle = TSubtotal::getParentTitleOfLine($object, $i);
1387
-		    if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true))
1388
-		    {
1385
+			// Check if a title exist for this line && if the title have subtotal
1386
+			$lineTitle = TSubtotal::getParentTitleOfLine($object, $i);
1387
+			if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true))
1388
+			{
1389 1389
 		        
1390
-		        $this->resprints = ' ';
1390
+				$this->resprints = ' ';
1391 1391
 		        
1392
-		        // currentcontext à modifier celon l'appel
1393
-		        $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hideprices', 'i' => $i);
1394
-		        return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1)
1395
-		    }
1392
+				// currentcontext à modifier celon l'appel
1393
+				$params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hideprices', 'i' => $i);
1394
+				return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1)
1395
+			}
1396 1396
 		}
1397 1397
 		
1398 1398
 		return 0;
1399 1399
 	}
1400 1400
 	
1401 1401
 	function pdf_getlineremisepercent($parameters=array(), &$object, &$action='') {
1402
-	    global $conf,$hideprices,$hookmanager;
1402
+		global $conf,$hideprices,$hookmanager;
1403 1403
 
1404
-        if(is_array($parameters)) $i = & $parameters['i'];
1405
-        else $i = (int) $parameters;
1404
+		if(is_array($parameters)) $i = & $parameters['i'];
1405
+		else $i = (int) $parameters;
1406 1406
 
1407 1407
 		if($this->isModSubtotalLine($parameters,$object) ) {
1408 1408
 			$this->resprints = ' ';
1409 1409
 
1410
-            $line = $object->lines[$i];
1410
+			$line = $object->lines[$i];
1411 1411
 
1412
-            // Affichage de la remise 
1413
-            if(TSubtotal::isSubtotal($line)) {
1414
-                $parentTitle = TSubtotal::getParentTitleOfLine($object, $i);
1412
+			// Affichage de la remise 
1413
+			if(TSubtotal::isSubtotal($line)) {
1414
+				$parentTitle = TSubtotal::getParentTitleOfLine($object, $i);
1415 1415
 
1416
-                if(empty($parentTitle->array_options)) $parentTitle->fetch_optionals();
1417
-                if(! empty($parentTitle->array_options['options_show_reduc'])) {
1418
-                    $TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle);
1419
-                    $this->resprints = price((1-$TTotal['total_ht'] / $TTotal['total_subprice'])*100, 0, '', 1, 2, 2).'%';
1420
-                }
1421
-            }
1416
+				if(empty($parentTitle->array_options)) $parentTitle->fetch_optionals();
1417
+				if(! empty($parentTitle->array_options['options_show_reduc'])) {
1418
+					$TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle);
1419
+					$this->resprints = price((1-$TTotal['total_ht'] / $TTotal['total_subprice'])*100, 0, '', 1, 2, 2).'%';
1420
+				}
1421
+			}
1422 1422
 		
1423 1423
 			if((float)DOL_VERSION<=3.6) {
1424 1424
 				return '';
@@ -1428,15 +1428,15 @@  discard block
 block discarded – undo
1428 1428
 			}
1429 1429
 		}
1430 1430
 		elseif (!empty($hideprices)
1431
-		        || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) )
1432
-		        )
1433
-		    {
1434
-		        if (!empty($hideprices) || !in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC)))
1435
-		        {
1436
-		            $this->resprints = ' ';
1437
-		            return 1;
1438
-		        }
1439
-		    }
1431
+				|| (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) )
1432
+				)
1433
+			{
1434
+				if (!empty($hideprices) || !in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC)))
1435
+				{
1436
+					$this->resprints = ' ';
1437
+					return 1;
1438
+				}
1439
+			}
1440 1440
 		
1441 1441
 		return 0;
1442 1442
 	}
@@ -1472,7 +1472,7 @@  discard block
 block discarded – undo
1472 1472
 	}
1473 1473
 	
1474 1474
 	function pdf_getlinevatrate($parameters=array(), &$object, &$action='') {
1475
-	    global $conf,$hideprices,$hookmanager;
1475
+		global $conf,$hideprices,$hookmanager;
1476 1476
 	    
1477 1477
 		if($this->isModSubtotalLine($parameters,$object) ){
1478 1478
 			$this->resprints = ' ';
@@ -1497,31 +1497,31 @@  discard block
 block discarded – undo
1497 1497
 		(!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))
1498 1498
 		)
1499 1499
 		{
1500
-		    // alors je dois vérifier si la méthode fait partie de la conf qui l'exclue
1501
-		    if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC)))
1502
-		    {
1503
-		        $this->resprints = ' ';
1500
+			// alors je dois vérifier si la méthode fait partie de la conf qui l'exclue
1501
+			if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC)))
1502
+			{
1503
+				$this->resprints = ' ';
1504 1504
 		        
1505
-		        // currentcontext à modifier celon l'appel
1506
-		        $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i);
1507
-		        return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1)
1508
-		    }
1505
+				// currentcontext à modifier celon l'appel
1506
+				$params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i);
1507
+				return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1)
1508
+			}
1509 1509
 		}
1510 1510
 		// Cache le prix pour les lignes standards dolibarr qui sont dans un ensemble
1511 1511
 		else if (!empty($hideprices))
1512 1512
 		{
1513 1513
 		    
1514
-		    // Check if a title exist for this line && if the title have subtotal
1515
-		    $lineTitle = TSubtotal::getParentTitleOfLine($object, $i);
1516
-		    if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true))
1517
-		    {
1514
+			// Check if a title exist for this line && if the title have subtotal
1515
+			$lineTitle = TSubtotal::getParentTitleOfLine($object, $i);
1516
+			if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true))
1517
+			{
1518 1518
 		        
1519
-		        $this->resprints = ' ';
1519
+				$this->resprints = ' ';
1520 1520
 		        
1521
-		        // currentcontext à modifier celon l'appel
1522
-		        $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hideprices', 'i' => $i);
1523
-		        return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1)
1524
-		    }
1521
+				// currentcontext à modifier celon l'appel
1522
+				$params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hideprices', 'i' => $i);
1523
+				return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1)
1524
+			}
1525 1525
 		}
1526 1526
 		
1527 1527
 		return 0;
@@ -1645,33 +1645,33 @@  discard block
 block discarded – undo
1645 1645
 		
1646 1646
 		$this->add_numerotation($object);	
1647 1647
 		
1648
-        foreach($object->lines as $k => &$l) {
1649
-            if(TSubtotal::isSubtotal($l)) {
1650
-                $parentTitle = TSubtotal::getParentTitleOfLine($object, $k);
1651
-                if(is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals();
1652
-                if(! empty($parentTitle->id) && ! empty($parentTitle->array_options['options_show_reduc'])) {
1653
-                    $l->remise_percent = 100;    // Affichage de la réduction sur la ligne de sous-total
1654
-                }
1655
-            }
1648
+		foreach($object->lines as $k => &$l) {
1649
+			if(TSubtotal::isSubtotal($l)) {
1650
+				$parentTitle = TSubtotal::getParentTitleOfLine($object, $k);
1651
+				if(is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals();
1652
+				if(! empty($parentTitle->id) && ! empty($parentTitle->array_options['options_show_reduc'])) {
1653
+					$l->remise_percent = 100;    // Affichage de la réduction sur la ligne de sous-total
1654
+				}
1655
+			}
1656 1656
 
1657 1657
 
1658
-            // Pas de hook sur les colonnes du PDF expédition, on unset les bonnes variables
1659
-            if(($object->element == 'shipping' || $object->element == 'delivery') && $this->isModSubtotalLine($k, $object))
1658
+			// Pas de hook sur les colonnes du PDF expédition, on unset les bonnes variables
1659
+			if(($object->element == 'shipping' || $object->element == 'delivery') && $this->isModSubtotalLine($k, $object))
1660 1660
 			{
1661 1661
 				$l->qty = $l->qty_asked;
1662 1662
 				unset($l->qty_asked, $l->qty_shipped, $l->volume, $l->weight);
1663 1663
 			}
1664
-        }
1664
+		}
1665 1665
 
1666 1666
 		$hideInnerLines = (int)GETPOST('hideInnerLines');
1667 1667
 		$hidedetails = (int)GETPOST('hidedetails');
1668 1668
 
1669 1669
 		if ($hideInnerLines) { // si c une ligne de titre
1670
-	    	$fk_parent_line=0;
1670
+			$fk_parent_line=0;
1671 1671
 			$TLines =array();
1672 1672
 		
1673 1673
 			$original_count=count($object->lines);
1674
-		    $TTvas = array(); // tableau de tva
1674
+			$TTvas = array(); // tableau de tva
1675 1675
 		    
1676 1676
 			foreach($object->lines as $k=>&$line) 
1677 1677
 			{
@@ -1712,48 +1712,48 @@  discard block
 block discarded – undo
1712 1712
 			
1713 1713
 				if ($hideInnerLines)
1714 1714
 				{
1715
-				    if(!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES))
1716
-				    {
1717
-				        if($line->tva_tx != '0.000' && $line->product_type!=9){
1715
+					if(!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES))
1716
+					{
1717
+						if($line->tva_tx != '0.000' && $line->product_type!=9){
1718 1718
 				            
1719
-    				        // on remplit le tableau de tva pour substituer les lignes cachées
1720
-    				        $TTvas[$line->tva_tx]['total_tva'] += $line->total_tva;
1721
-    				        $TTvas[$line->tva_tx]['total_ht'] += $line->total_ht;
1722
-    				        $TTvas[$line->tva_tx]['total_ttc'] += $line->total_ttc; 
1723
-    				    }
1724
-    					if($line->product_type==9 && $line->rowid>0)
1725
-    					{
1726
-    					    //Cas où je doit cacher les produits et afficher uniquement les sous-totaux avec les titres
1727
-    					    // génère des lignes d'affichage des montants HT soumis à tva
1728
-    					    $nbtva = count($TTvas);
1729
-    					    if(!empty($nbtva)){
1730
-    					        foreach ($TTvas as $tx =>$val){
1731
-    					            $l = clone $line;
1732
-    					            $l->product_type = 1;
1733
-    					            $l->special_code = '';
1734
-    					            $l->qty = 1;
1735
-    					            $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx));
1736
-    					            $l->tva_tx = $tx;
1737
-    					            $l->total_ht = $val['total_ht'];
1738
-    					            $l->total_tva = $val['total_tva'];
1739
-    					            $l->total = $line->total_ht;
1740
-    					            $l->total_ttc = $val['total_ttc'];
1741
-    					            $TLines[] = $l;
1742
-    					            array_shift($TTvas);
1743
-    					       }
1744
-    					    }
1719
+							// on remplit le tableau de tva pour substituer les lignes cachées
1720
+							$TTvas[$line->tva_tx]['total_tva'] += $line->total_tva;
1721
+							$TTvas[$line->tva_tx]['total_ht'] += $line->total_ht;
1722
+							$TTvas[$line->tva_tx]['total_ttc'] += $line->total_ttc; 
1723
+						}
1724
+						if($line->product_type==9 && $line->rowid>0)
1725
+						{
1726
+							//Cas où je doit cacher les produits et afficher uniquement les sous-totaux avec les titres
1727
+							// génère des lignes d'affichage des montants HT soumis à tva
1728
+							$nbtva = count($TTvas);
1729
+							if(!empty($nbtva)){
1730
+								foreach ($TTvas as $tx =>$val){
1731
+									$l = clone $line;
1732
+									$l->product_type = 1;
1733
+									$l->special_code = '';
1734
+									$l->qty = 1;
1735
+									$l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx));
1736
+									$l->tva_tx = $tx;
1737
+									$l->total_ht = $val['total_ht'];
1738
+									$l->total_tva = $val['total_tva'];
1739
+									$l->total = $line->total_ht;
1740
+									$l->total_ttc = $val['total_ttc'];
1741
+									$TLines[] = $l;
1742
+									array_shift($TTvas);
1743
+							   }
1744
+							}
1745 1745
     					    
1746
-    					    // ajoute la ligne de sous-total
1747
-    					    $TLines[] = $line; 
1748
-    					}
1749
-				    } else {
1746
+							// ajoute la ligne de sous-total
1747
+							$TLines[] = $line; 
1748
+						}
1749
+					} else {
1750 1750
 				        
1751
-				        if($line->product_type==9 && $line->rowid>0)
1752
-				        {
1753
-				            // ajoute la ligne de sous-total
1754
-				            $TLines[] = $line; 
1755
-				        }
1756
-				    }
1751
+						if($line->product_type==9 && $line->rowid>0)
1752
+						{
1753
+							// ajoute la ligne de sous-total
1754
+							$TLines[] = $line; 
1755
+						}
1756
+					}
1757 1757
 				    
1758 1758
 					
1759 1759
 				}
@@ -1778,20 +1778,20 @@  discard block
 block discarded – undo
1778 1778
 			$nbtva = count($TTvas);
1779 1779
 			if(!empty($nbtva) && $hideInnerLines && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES))
1780 1780
 			{
1781
-			    foreach ($TTvas as $tx =>$val){
1782
-			        $l = clone $line;
1783
-			        $l->product_type = 1;
1784
-			        $l->special_code = '';
1785
-			        $l->qty = 1;
1786
-			        $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx));
1787
-			        $l->tva_tx = $tx;
1788
-			        $l->total_ht = $val['total_ht'];
1789
-			        $l->total_tva = $val['total_tva'];
1790
-			        $l->total = $line->total_ht;
1791
-			        $l->total_ttc = $val['total_ttc'];
1792
-			        $TLines[] = $l;
1793
-			        array_shift($TTvas);
1794
-			    }
1781
+				foreach ($TTvas as $tx =>$val){
1782
+					$l = clone $line;
1783
+					$l->product_type = 1;
1784
+					$l->special_code = '';
1785
+					$l->qty = 1;
1786
+					$l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx));
1787
+					$l->tva_tx = $tx;
1788
+					$l->total_ht = $val['total_ht'];
1789
+					$l->total_tva = $val['total_tva'];
1790
+					$l->total = $line->total_ht;
1791
+					$l->total_ttc = $val['total_ttc'];
1792
+					$TLines[] = $l;
1793
+					array_shift($TTvas);
1794
+				}
1795 1795
 			}
1796 1796
 			
1797 1797
 			global $nblignes;
@@ -1803,7 +1803,7 @@  discard block
 block discarded – undo
1803 1803
 				$this->resprints = '';
1804 1804
 				return 0;
1805 1805
 			}
1806
-	    }
1806
+		}
1807 1807
 		
1808 1808
 		return 0;
1809 1809
 	}
@@ -1995,11 +1995,11 @@  discard block
 block discarded – undo
1995 1995
 		}
1996 1996
 		elseif($object->element == 'order_supplier' )
1997 1997
 		{
1998
-		    $createRight = $user->rights->fournisseur->commande->creer;
1998
+			$createRight = $user->rights->fournisseur->commande->creer;
1999 1999
 		}
2000 2000
 		elseif($object->element == 'invoice_supplier' )
2001 2001
 		{
2002
-		    $createRight = $user->rights->fournisseur->facture->creer;
2002
+			$createRight = $user->rights->fournisseur->facture->creer;
2003 2003
 		}
2004 2004
 		elseif($object->element == 'commande' && in_array('ordershipmentcard', $contexts))
2005 2005
 		{
@@ -2028,27 +2028,27 @@  discard block
 block discarded – undo
2028 2028
 			$line = $originline;
2029 2029
 		}
2030 2030
  		if($object->element=='facture')$idvar = 'facid';
2031
-        else $idvar='id';
2031
+		else $idvar='id';
2032 2032
 		if($line->special_code!=$this->module_number || $line->product_type!=9) {
2033 2033
 			if ($object->statut == 0  && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_LINE) && $object->element !== 'invoice_supplier')
2034
-            {
2035
-                if(!(TSubtotal::isModSubtotalLine($line)) && ( $line->fk_prev_id === null ) && !($action == "editline" && GETPOST('lineid') == $line->id)) {
2036
-                    echo '<a name="duplicate-'.$line->id.'" href="' . $_SERVER['PHP_SELF'] . '?' . $idvar . '=' . $object->id . '&action=duplicate&lineid=' . $line->id . '"><i class="fa fa-clone" aria-hidden="true"></i></a>';
2034
+			{
2035
+				if(!(TSubtotal::isModSubtotalLine($line)) && ( $line->fk_prev_id === null ) && !($action == "editline" && GETPOST('lineid') == $line->id)) {
2036
+					echo '<a name="duplicate-'.$line->id.'" href="' . $_SERVER['PHP_SELF'] . '?' . $idvar . '=' . $object->id . '&action=duplicate&lineid=' . $line->id . '"><i class="fa fa-clone" aria-hidden="true"></i></a>';
2037 2037
 
2038
-                    ?>
2038
+					?>
2039 2039
                         <script type="text/javascript">
2040 2040
                             $(document).ready(function() {
2041 2041
                                 $("a[name='duplicate-<?php echo $line->id; ?>']").prependTo($('#row-<?php echo $line->id; ?>').find('.linecoledit'));
2042 2042
                             });
2043 2043
                         </script>
2044 2044
                     <?php
2045
-                }
2045
+				}
2046 2046
 
2047
-            }
2047
+			}
2048 2048
 			return 0;
2049 2049
 		}
2050 2050
 		else if (in_array('invoicecard',$contexts) || in_array('invoicesuppliercard',$contexts) || in_array('propalcard',$contexts) || in_array('supplier_proposalcard',$contexts) || in_array('ordercard',$contexts) || in_array('ordersuppliercard',$contexts) || in_array('invoicereccard',$contexts)) 
2051
-        {
2051
+		{
2052 2052
 
2053 2053
 
2054 2054
 			if((float)DOL_VERSION <= 3.4)
@@ -2096,7 +2096,7 @@  discard block
 block discarded – undo
2096 2096
 			//var_dump($line);
2097 2097
             
2098 2098
 			// HTML 5 data for js
2099
-            $data = $this->_getHtmlData($parameters, $object, $action, $hookmanager);
2099
+			$data = $this->_getHtmlData($parameters, $object, $action, $hookmanager);
2100 2100
             
2101 2101
 			
2102 2102
 			?>
@@ -2158,8 +2158,8 @@  discard block
 block discarded – undo
2158 2158
 						}
2159 2159
 						
2160 2160
 						if ($object->element == 'order_supplier' || $object->element == 'invoice_supplier') {
2161
-						    $line->label = !empty($line->description) ? $line->description : $line->desc;
2162
-						    $line->description = '';
2161
+							$line->label = !empty($line->description) ? $line->description : $line->desc;
2162
+							$line->description = '';
2163 2163
 						}
2164 2164
 						$newlabel = $line->label;
2165 2165
 						if($line->label=='' && !$isFreeText) {
@@ -2193,38 +2193,38 @@  discard block
 block discarded – undo
2193 2193
 						
2194 2194
 
2195 2195
 						echo '<div class="subtotal_underline" style="margin-left:24px; line-height: 25px;">';
2196
-                        echo '<div>';
2197
-                        echo '<input style="vertical-align:sub;"  type="checkbox" name="line-pagebreak" id="subtotal-pagebreak" value="8" '.(($line->info_bits > 0) ? 'checked="checked"' : '') .' />&nbsp;';
2198
-                        echo '<label for="subtotal-pagebreak">'.$langs->trans('AddBreakPageBefore').'</label>';
2199
-                        echo '</div>';
2200
-
2201
-                        if (TSubtotal::isTitle($line))
2202
-                        {
2203
-                            $form = new Form($db);
2204
-                            echo '<div>';
2205
-                            echo '<label for="subtotal_tva_tx">'.$form->textwithpicto($langs->trans('subtotal_apply_default_tva'), $langs->trans('subtotal_apply_default_tva_help')).'</label>';
2206
-                            echo '<select id="subtotal_tva_tx" name="subtotal_tva_tx" class="flat"><option selected="selected" value="">-</option>';
2207
-                            if (empty($readonlyForSituation)) echo str_replace('selected', '', $form->load_tva('subtotal_tva_tx', '', $parameters['seller'], $parameters['buyer'], 0, 0, '', true));
2208
-                            echo '</select>';
2209
-                            echo '</div>';
2210
-
2211
-                            if (!empty($conf->global->INVOICE_USE_SITUATION) && $object->element == 'facture' && $object->type == Facture::TYPE_SITUATION)
2212
-                            {
2213
-                                echo '<div>';
2214
-                                echo '<label for="subtotal_progress">'.$langs->trans('subtotal_apply_progress').'</label> <input id="subtotal_progress" name="subtotal_progress" value="" size="1" />%';
2215
-                                echo '</div>';
2216
-                            }
2217
-                            echo '<div>';
2218
-                            echo '<input style="vertical-align:sub;"  type="checkbox" name="line-showTotalHT" id="subtotal-showTotalHT" value="9" '.(($line->array_options['options_show_total_ht'] > 0) ? 'checked="checked"' : '') .' />&nbsp;';
2219
-                            echo '<label for="subtotal-showTotalHT">'.$langs->trans('ShowTotalHTOnSubtotalBlock').'</label>';
2220
-                            echo '</div>';
2221
-
2222
-                            echo '<div>';
2223
-                            echo '<input style="vertical-align:sub;"  type="checkbox" name="line-showReduc" id="subtotal-showReduc" value="1" '.(($line->array_options['options_show_reduc'] > 0) ? 'checked="checked"' : '') .' />&nbsp;';
2224
-                            echo '<label for="subtotal-showReduc">'.$langs->trans('ShowReducOnSubtotalBlock').'</label>';
2225
-                            echo '</div>';
2226
-                        }
2227
-                        else if ($isFreeText) echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation);
2196
+						echo '<div>';
2197
+						echo '<input style="vertical-align:sub;"  type="checkbox" name="line-pagebreak" id="subtotal-pagebreak" value="8" '.(($line->info_bits > 0) ? 'checked="checked"' : '') .' />&nbsp;';
2198
+						echo '<label for="subtotal-pagebreak">'.$langs->trans('AddBreakPageBefore').'</label>';
2199
+						echo '</div>';
2200
+
2201
+						if (TSubtotal::isTitle($line))
2202
+						{
2203
+							$form = new Form($db);
2204
+							echo '<div>';
2205
+							echo '<label for="subtotal_tva_tx">'.$form->textwithpicto($langs->trans('subtotal_apply_default_tva'), $langs->trans('subtotal_apply_default_tva_help')).'</label>';
2206
+							echo '<select id="subtotal_tva_tx" name="subtotal_tva_tx" class="flat"><option selected="selected" value="">-</option>';
2207
+							if (empty($readonlyForSituation)) echo str_replace('selected', '', $form->load_tva('subtotal_tva_tx', '', $parameters['seller'], $parameters['buyer'], 0, 0, '', true));
2208
+							echo '</select>';
2209
+							echo '</div>';
2210
+
2211
+							if (!empty($conf->global->INVOICE_USE_SITUATION) && $object->element == 'facture' && $object->type == Facture::TYPE_SITUATION)
2212
+							{
2213
+								echo '<div>';
2214
+								echo '<label for="subtotal_progress">'.$langs->trans('subtotal_apply_progress').'</label> <input id="subtotal_progress" name="subtotal_progress" value="" size="1" />%';
2215
+								echo '</div>';
2216
+							}
2217
+							echo '<div>';
2218
+							echo '<input style="vertical-align:sub;"  type="checkbox" name="line-showTotalHT" id="subtotal-showTotalHT" value="9" '.(($line->array_options['options_show_total_ht'] > 0) ? 'checked="checked"' : '') .' />&nbsp;';
2219
+							echo '<label for="subtotal-showTotalHT">'.$langs->trans('ShowTotalHTOnSubtotalBlock').'</label>';
2220
+							echo '</div>';
2221
+
2222
+							echo '<div>';
2223
+							echo '<input style="vertical-align:sub;"  type="checkbox" name="line-showReduc" id="subtotal-showReduc" value="1" '.(($line->array_options['options_show_reduc'] > 0) ? 'checked="checked"' : '') .' />&nbsp;';
2224
+							echo '<label for="subtotal-showReduc">'.$langs->trans('ShowReducOnSubtotalBlock').'</label>';
2225
+							echo '</div>';
2226
+						}
2227
+						else if ($isFreeText) echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation);
2228 2228
 						echo '</div>';
2229 2229
 
2230 2230
 						if($line->qty<10) {
@@ -2741,17 +2741,17 @@  discard block
 block discarded – undo
2741 2741
 		if ($object->statut == 0 && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && $action != 'editline')
2742 2742
 		{
2743 2743
 		    
2744
-		    if($object->element == 'invoice_supplier' || $object->element == 'order_supplier')
2745
-		    {
2746
-		        foreach ($object->lines as $line)
2747
-		        {
2748
-		            // fetch optionals attributes and labels
2749
-		            require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
2750
-		            $extrafields=new ExtraFields($this->db);
2751
-		            $extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true);
2752
-		            $line->fetch_optionals($line->id,$extralabels);
2753
-		        }
2754
-		    }
2744
+			if($object->element == 'invoice_supplier' || $object->element == 'order_supplier')
2745
+			{
2746
+				foreach ($object->lines as $line)
2747
+				{
2748
+					// fetch optionals attributes and labels
2749
+					require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
2750
+					$extrafields=new ExtraFields($this->db);
2751
+					$extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true);
2752
+					$line->fetch_optionals($line->id,$extralabels);
2753
+				}
2754
+			}
2755 2755
 		    
2756 2756
 			$TSubNc = array();
2757 2757
 			foreach ($object->lines as &$l)
@@ -2842,80 +2842,80 @@  discard block
 block discarded – undo
2842 2842
 	{
2843 2843
 		dol_include_once('/subtotal/class/subtotal.class.php');
2844 2844
 
2845
-	    $line = &$parameters['line'];
2845
+		$line = &$parameters['line'];
2846 2846
 	    
2847
-	    $ThtmlData['data-id']           = $line->id;
2848
-	    $ThtmlData['data-product_type'] = $line->product_type;
2849
-	    $ThtmlData['data-qty']          = 0; //$line->qty;
2850
-	    $ThtmlData['data-level']        = TSubtotal::getNiveau($line);
2847
+		$ThtmlData['data-id']           = $line->id;
2848
+		$ThtmlData['data-product_type'] = $line->product_type;
2849
+		$ThtmlData['data-qty']          = 0; //$line->qty;
2850
+		$ThtmlData['data-level']        = TSubtotal::getNiveau($line);
2851 2851
 	    
2852
-	    if(TSubtotal::isTitle($line)){
2853
-	        $ThtmlData['data-issubtotal'] = 'title';
2854
-	    }elseif(TSubtotal::isSubtotal($line)){
2855
-	        $ThtmlData['data-issubtotal'] = 'subtotal';
2856
-	    }
2857
-	    else{
2858
-	        $ThtmlData['data-issubtotal'] = 'freetext';
2859
-	    }
2852
+		if(TSubtotal::isTitle($line)){
2853
+			$ThtmlData['data-issubtotal'] = 'title';
2854
+		}elseif(TSubtotal::isSubtotal($line)){
2855
+			$ThtmlData['data-issubtotal'] = 'subtotal';
2856
+		}
2857
+		else{
2858
+			$ThtmlData['data-issubtotal'] = 'freetext';
2859
+		}
2860 2860
 	    
2861 2861
 	    
2862
-	    // Change or add data  from hooks
2863
-	    $parameters = array_replace($parameters , array(  'ThtmlData' => $ThtmlData )  );
2862
+		// Change or add data  from hooks
2863
+		$parameters = array_replace($parameters , array(  'ThtmlData' => $ThtmlData )  );
2864 2864
 	    
2865
-	    // hook 
2866
-	    $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
2867
-	    if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
2868
-	    if ($reshook>0)
2869
-	    {
2870
-	        $ThtmlData = $hookmanager->resArray;
2871
-	    }
2872
-
2873
-	    return $this->implodeHtmlData($ThtmlData);
2865
+		// hook 
2866
+		$reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
2867
+		if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
2868
+		if ($reshook>0)
2869
+		{
2870
+			$ThtmlData = $hookmanager->resArray;
2871
+		}
2872
+
2873
+		return $this->implodeHtmlData($ThtmlData);
2874 2874
 	
2875 2875
 	}
2876 2876
 	
2877 2877
 	
2878 2878
 	function implodeHtmlData($ThtmlData = array())
2879 2879
 	{
2880
-	    $data = '';
2881
-	    foreach($ThtmlData as $k => $h )
2882
-	    {
2883
-	        if(is_array($h))
2884
-	        {
2885
-	            $h = json_encode($h);
2886
-	        }
2880
+		$data = '';
2881
+		foreach($ThtmlData as $k => $h )
2882
+		{
2883
+			if(is_array($h))
2884
+			{
2885
+				$h = json_encode($h);
2886
+			}
2887 2887
 	        
2888
-	        $data .= $k . '="'.dol_htmlentities($h, ENT_QUOTES).'" ';
2889
-	    }
2888
+			$data .= $k . '="'.dol_htmlentities($h, ENT_QUOTES).'" ';
2889
+		}
2890 2890
 	    
2891
-	    return $data;
2891
+		return $data;
2892 2892
 	}
2893 2893
 	
2894 2894
 	function _ajax_block_order_js($object)
2895 2895
 	{
2896
-	    global $conf,$tagidfortablednd,$filepath,$langs;
2896
+		global $conf,$tagidfortablednd,$filepath,$langs;
2897 2897
 	    
2898
-	    /*
2898
+		/*
2899 2899
 	     * this part of js is base on dolibarr htdocs/core/tpl/ajaxrow.tpl.php 
2900 2900
 	     * for compatibility reasons we don't use tableDnD but jquery sortable
2901 2901
 	     */
2902 2902
 	    
2903
-	    $id=$object->id;
2904
-	    $nboflines=(isset($object->lines)?count($object->lines):0);
2905
-	    $forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1;
2903
+		$id=$object->id;
2904
+		$nboflines=(isset($object->lines)?count($object->lines):0);
2905
+		$forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1;
2906 2906
 	    
2907
-	    $id=$object->id;
2908
-	    $fk_element=$object->fk_element;
2909
-	    $table_element_line=$object->table_element_line;
2910
-	    $nboflines=(isset($object->lines)?count($object->lines):(empty($nboflines)?0:$nboflines));
2911
-	    $tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd);
2912
-	    $filepath=(empty($filepath)?'':$filepath);
2907
+		$id=$object->id;
2908
+		$fk_element=$object->fk_element;
2909
+		$table_element_line=$object->table_element_line;
2910
+		$nboflines=(isset($object->lines)?count($object->lines):(empty($nboflines)?0:$nboflines));
2911
+		$tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd);
2912
+		$filepath=(empty($filepath)?'':$filepath);
2913 2913
 	    
2914 2914
 	    
2915
-	    if (GETPOST('action','aZ09') != 'editline' && $nboflines > 1)
2916
-	    {
2915
+		if (GETPOST('action','aZ09') != 'editline' && $nboflines > 1)
2916
+		{
2917 2917
 	        
2918
-	        ?>
2918
+			?>
2919 2919
 		
2920 2920
 		
2921 2921
 			<script type="text/javascript">
Please login to merge, or discard this patch.