Passed
Pull Request — master (#114)
by
unknown
02:04
created
script/interface.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,8 +10,8 @@  discard block
 block discarded – undo
10 10
 	dol_include_once('/supplier_proposal/class/supplier_proposal.class.php');
11 11
 	dol_include_once('/fourn/class/fournisseur.facture.class.php');
12 12
 	
13
-	$get=GETPOST('get');
14
-	$set=GETPOST('set');
13
+	$get = GETPOST('get');
14
+	$set = GETPOST('set');
15 15
 	
16 16
 	switch ($get) {
17 17
 		default:
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 	
21 21
 	switch ($set) {
22 22
 		case 'updateLineNC': // Gestion du Compris/Non Compris via les titres et/ou lignes
23
-			echo json_encode( _updateLineNC(GETPOST('element'), GETPOST('elementid'), GETPOST('lineid'), GETPOST('subtotal_nc')) );
23
+			echo json_encode(_updateLineNC(GETPOST('element'), GETPOST('elementid'), GETPOST('lineid'), GETPOST('subtotal_nc')));
24 24
 			
25 25
 			break;
26 26
 		default:
Please login to merge, or discard this patch.
core/triggers/interface_90_modSubtotal_subtotaltrigger.class.php 3 patches
Indentation   +520 added lines, -520 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' && $object->special_code != TSubtotal::$module_number)
202
+		if ($action == 'LINEBILL_INSERT' && $object->special_code != TSubtotal::$module_number)
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))
@@ -307,173 +307,173 @@  discard block
 block discarded – undo
307 307
 		}
308 308
 		
309 309
         
310
-        if ($action == 'USER_LOGIN') {
311
-            dol_syslog(
312
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
313
-            );
314
-        } elseif ($action == 'USER_UPDATE_SESSION') {
315
-            // Warning: To increase performances, this action is triggered only if
316
-            // constant MAIN_ACTIVATE_UPDATESESSIONTRIGGER is set to 1.
317
-            dol_syslog(
318
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
319
-            );
320
-        } elseif ($action == 'USER_CREATE') {
321
-            dol_syslog(
322
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
323
-            );
324
-        } elseif ($action == 'USER_CREATE_FROM_CONTACT') {
325
-            dol_syslog(
326
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
327
-            );
328
-        } elseif ($action == 'USER_MODIFY') {
329
-            dol_syslog(
330
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
331
-            );
332
-        } elseif ($action == 'USER_NEW_PASSWORD') {
333
-            dol_syslog(
334
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
335
-            );
336
-        } elseif ($action == 'USER_ENABLEDISABLE') {
337
-            dol_syslog(
338
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
339
-            );
340
-        } elseif ($action == 'USER_DELETE') {
341
-            dol_syslog(
342
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
343
-            );
344
-        } elseif ($action == 'USER_LOGOUT') {
345
-            dol_syslog(
346
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
347
-            );
348
-        } elseif ($action == 'USER_SETINGROUP') {
349
-            dol_syslog(
350
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
351
-            );
352
-        } elseif ($action == 'USER_REMOVEFROMGROUP') {
353
-            dol_syslog(
354
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
355
-            );
356
-        }
357
-
358
-        // Groups
359
-        elseif ($action == 'GROUP_CREATE') {
360
-            dol_syslog(
361
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
362
-            );
363
-        } elseif ($action == 'GROUP_MODIFY') {
364
-            dol_syslog(
365
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
366
-            );
367
-        } elseif ($action == 'GROUP_DELETE') {
368
-            dol_syslog(
369
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
370
-            );
371
-        }
372
-
373
-        // Companies
374
-        elseif ($action == 'COMPANY_CREATE') {
375
-            dol_syslog(
376
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
377
-            );
378
-        } elseif ($action == 'COMPANY_MODIFY') {
379
-            dol_syslog(
380
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
381
-            );
382
-        } elseif ($action == 'COMPANY_DELETE') {
383
-            dol_syslog(
384
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
385
-            );
386
-        }
387
-
388
-        // Contacts
389
-        elseif ($action == 'CONTACT_CREATE') {
390
-            dol_syslog(
391
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
392
-            );
393
-        } elseif ($action == 'CONTACT_MODIFY') {
394
-            dol_syslog(
395
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
396
-            );
397
-        } elseif ($action == 'CONTACT_DELETE') {
398
-            dol_syslog(
399
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
400
-            );
401
-        }
402
-
403
-        // Products
404
-        elseif ($action == 'PRODUCT_CREATE') {
405
-            dol_syslog(
406
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
407
-            );
408
-        } elseif ($action == 'PRODUCT_MODIFY') {
409
-            dol_syslog(
410
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
411
-            );
412
-        } elseif ($action == 'PRODUCT_DELETE') {
413
-            dol_syslog(
414
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
415
-            );
416
-        }
417
-
418
-        // Customer orders
419
-        elseif ($action == 'ORDER_CREATE') {
420
-            dol_syslog(
421
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
422
-            );
423
-        } elseif ($action == 'ORDER_VALIDATE') {
424
-            dol_syslog(
425
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
426
-            );
427
-        } elseif ($action == 'ORDER_DELETE') {
428
-            dol_syslog(
429
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
430
-            );
431
-        } elseif ($action == 'ORDER_BUILDDOC') {
432
-            dol_syslog(
433
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
434
-            );
435
-        } elseif ($action == 'ORDER_SENTBYMAIL') {
436
-            dol_syslog(
437
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
438
-            );
439
-        } elseif ($action == 'LINEORDER_INSERT') {
440
-            dol_syslog(
441
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
442
-            );
443
-        } elseif ($action == 'LINEORDER_DELETE') {
444
-            dol_syslog(
445
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
446
-            );
447
-        }
448
-
449
-        // Supplier orders
450
-        elseif ($action == 'ORDER_SUPPLIER_CREATE') {
451
-            dol_syslog(
452
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
453
-            );
454
-        } elseif ($action == 'ORDER_SUPPLIER_VALIDATE') {
455
-            dol_syslog(
456
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
457
-            );
458
-        } elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') {
459
-            dol_syslog(
460
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
461
-            );
462
-        } elseif ($action == 'SUPPLIER_ORDER_BUILDDOC') {
463
-            dol_syslog(
464
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
465
-            );
466
-        }
467
-
468
-        // Proposals
469
-        elseif ($action == 'PROPAL_CREATE') {
470
-            dol_syslog(
471
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
472
-            );
473
-        } elseif (in_array($action, array('PROPAL_CLONE', 'ORDER_CLONE', 'BILL_CLONE'))) {
474
-            dol_syslog(
475
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
476
-            );
310
+		if ($action == 'USER_LOGIN') {
311
+			dol_syslog(
312
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
313
+			);
314
+		} elseif ($action == 'USER_UPDATE_SESSION') {
315
+			// Warning: To increase performances, this action is triggered only if
316
+			// constant MAIN_ACTIVATE_UPDATESESSIONTRIGGER is set to 1.
317
+			dol_syslog(
318
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
319
+			);
320
+		} elseif ($action == 'USER_CREATE') {
321
+			dol_syslog(
322
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
323
+			);
324
+		} elseif ($action == 'USER_CREATE_FROM_CONTACT') {
325
+			dol_syslog(
326
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
327
+			);
328
+		} elseif ($action == 'USER_MODIFY') {
329
+			dol_syslog(
330
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
331
+			);
332
+		} elseif ($action == 'USER_NEW_PASSWORD') {
333
+			dol_syslog(
334
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
335
+			);
336
+		} elseif ($action == 'USER_ENABLEDISABLE') {
337
+			dol_syslog(
338
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
339
+			);
340
+		} elseif ($action == 'USER_DELETE') {
341
+			dol_syslog(
342
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
343
+			);
344
+		} elseif ($action == 'USER_LOGOUT') {
345
+			dol_syslog(
346
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
347
+			);
348
+		} elseif ($action == 'USER_SETINGROUP') {
349
+			dol_syslog(
350
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
351
+			);
352
+		} elseif ($action == 'USER_REMOVEFROMGROUP') {
353
+			dol_syslog(
354
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
355
+			);
356
+		}
357
+
358
+		// Groups
359
+		elseif ($action == 'GROUP_CREATE') {
360
+			dol_syslog(
361
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
362
+			);
363
+		} elseif ($action == 'GROUP_MODIFY') {
364
+			dol_syslog(
365
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
366
+			);
367
+		} elseif ($action == 'GROUP_DELETE') {
368
+			dol_syslog(
369
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
370
+			);
371
+		}
372
+
373
+		// Companies
374
+		elseif ($action == 'COMPANY_CREATE') {
375
+			dol_syslog(
376
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
377
+			);
378
+		} elseif ($action == 'COMPANY_MODIFY') {
379
+			dol_syslog(
380
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
381
+			);
382
+		} elseif ($action == 'COMPANY_DELETE') {
383
+			dol_syslog(
384
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
385
+			);
386
+		}
387
+
388
+		// Contacts
389
+		elseif ($action == 'CONTACT_CREATE') {
390
+			dol_syslog(
391
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
392
+			);
393
+		} elseif ($action == 'CONTACT_MODIFY') {
394
+			dol_syslog(
395
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
396
+			);
397
+		} elseif ($action == 'CONTACT_DELETE') {
398
+			dol_syslog(
399
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
400
+			);
401
+		}
402
+
403
+		// Products
404
+		elseif ($action == 'PRODUCT_CREATE') {
405
+			dol_syslog(
406
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
407
+			);
408
+		} elseif ($action == 'PRODUCT_MODIFY') {
409
+			dol_syslog(
410
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
411
+			);
412
+		} elseif ($action == 'PRODUCT_DELETE') {
413
+			dol_syslog(
414
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
415
+			);
416
+		}
417
+
418
+		// Customer orders
419
+		elseif ($action == 'ORDER_CREATE') {
420
+			dol_syslog(
421
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
422
+			);
423
+		} elseif ($action == 'ORDER_VALIDATE') {
424
+			dol_syslog(
425
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
426
+			);
427
+		} elseif ($action == 'ORDER_DELETE') {
428
+			dol_syslog(
429
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
430
+			);
431
+		} elseif ($action == 'ORDER_BUILDDOC') {
432
+			dol_syslog(
433
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
434
+			);
435
+		} elseif ($action == 'ORDER_SENTBYMAIL') {
436
+			dol_syslog(
437
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
438
+			);
439
+		} elseif ($action == 'LINEORDER_INSERT') {
440
+			dol_syslog(
441
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
442
+			);
443
+		} elseif ($action == 'LINEORDER_DELETE') {
444
+			dol_syslog(
445
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
446
+			);
447
+		}
448
+
449
+		// Supplier orders
450
+		elseif ($action == 'ORDER_SUPPLIER_CREATE') {
451
+			dol_syslog(
452
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
453
+			);
454
+		} elseif ($action == 'ORDER_SUPPLIER_VALIDATE') {
455
+			dol_syslog(
456
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
457
+			);
458
+		} elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') {
459
+			dol_syslog(
460
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
461
+			);
462
+		} elseif ($action == 'SUPPLIER_ORDER_BUILDDOC') {
463
+			dol_syslog(
464
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
465
+			);
466
+		}
467
+
468
+		// Proposals
469
+		elseif ($action == 'PROPAL_CREATE') {
470
+			dol_syslog(
471
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
472
+			);
473
+		} elseif (in_array($action, array('PROPAL_CLONE', 'ORDER_CLONE', 'BILL_CLONE'))) {
474
+			dol_syslog(
475
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
476
+			);
477 477
 			
478 478
 			$doli_action = GETPOST('action');
479 479
 
@@ -506,277 +506,277 @@  discard block
 block discarded – undo
506 506
 				if (!empty($line)) $object->update_price(1);
507 507
 			}
508 508
 			
509
-        } elseif ($action == 'PROPAL_MODIFY') {
510
-            dol_syslog(
511
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
512
-            );
513
-        } elseif ($action == 'PROPAL_VALIDATE') {
514
-            dol_syslog(
515
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
516
-            );
517
-        } elseif ($action == 'PROPAL_BUILDDOC') {
518
-            dol_syslog(
519
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
520
-            );
521
-        } elseif ($action == 'PROPAL_SENTBYMAIL') {
522
-            dol_syslog(
523
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
524
-            );
525
-        } elseif ($action == 'PROPAL_CLOSE_SIGNED') {
526
-            dol_syslog(
527
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
528
-            );
529
-        } elseif ($action == 'PROPAL_CLOSE_REFUSED') {
530
-            dol_syslog(
531
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
532
-            );
533
-        } elseif ($action == 'PROPAL_DELETE') {
534
-            dol_syslog(
535
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
536
-            );
537
-        } elseif ($action == 'LINEPROPAL_INSERT') {
538
-            dol_syslog(
539
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
540
-            );
541
-        } elseif ($action == 'LINEPROPAL_MODIFY') {
542
-            dol_syslog(
543
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
544
-            );
545
-        } elseif ($action == 'LINEPROPAL_DELETE') {
546
-            dol_syslog(
547
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
548
-            );
549
-        }
550
-
551
-        // Contracts
552
-        elseif ($action == 'CONTRACT_CREATE') {
553
-            dol_syslog(
554
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
555
-            );
556
-        } elseif ($action == 'CONTRACT_MODIFY') {
557
-            dol_syslog(
558
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
559
-            );
560
-        } elseif ($action == 'CONTRACT_ACTIVATE') {
561
-            dol_syslog(
562
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
563
-            );
564
-        } elseif ($action == 'CONTRACT_CANCEL') {
565
-            dol_syslog(
566
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
567
-            );
568
-        } elseif ($action == 'CONTRACT_CLOSE') {
569
-            dol_syslog(
570
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
571
-            );
572
-        } elseif ($action == 'CONTRACT_DELETE') {
573
-            dol_syslog(
574
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
575
-            );
576
-        }
509
+		} elseif ($action == 'PROPAL_MODIFY') {
510
+			dol_syslog(
511
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
512
+			);
513
+		} elseif ($action == 'PROPAL_VALIDATE') {
514
+			dol_syslog(
515
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
516
+			);
517
+		} elseif ($action == 'PROPAL_BUILDDOC') {
518
+			dol_syslog(
519
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
520
+			);
521
+		} elseif ($action == 'PROPAL_SENTBYMAIL') {
522
+			dol_syslog(
523
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
524
+			);
525
+		} elseif ($action == 'PROPAL_CLOSE_SIGNED') {
526
+			dol_syslog(
527
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
528
+			);
529
+		} elseif ($action == 'PROPAL_CLOSE_REFUSED') {
530
+			dol_syslog(
531
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
532
+			);
533
+		} elseif ($action == 'PROPAL_DELETE') {
534
+			dol_syslog(
535
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
536
+			);
537
+		} elseif ($action == 'LINEPROPAL_INSERT') {
538
+			dol_syslog(
539
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
540
+			);
541
+		} elseif ($action == 'LINEPROPAL_MODIFY') {
542
+			dol_syslog(
543
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
544
+			);
545
+		} elseif ($action == 'LINEPROPAL_DELETE') {
546
+			dol_syslog(
547
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
548
+			);
549
+		}
550
+
551
+		// Contracts
552
+		elseif ($action == 'CONTRACT_CREATE') {
553
+			dol_syslog(
554
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
555
+			);
556
+		} elseif ($action == 'CONTRACT_MODIFY') {
557
+			dol_syslog(
558
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
559
+			);
560
+		} elseif ($action == 'CONTRACT_ACTIVATE') {
561
+			dol_syslog(
562
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
563
+			);
564
+		} elseif ($action == 'CONTRACT_CANCEL') {
565
+			dol_syslog(
566
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
567
+			);
568
+		} elseif ($action == 'CONTRACT_CLOSE') {
569
+			dol_syslog(
570
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
571
+			);
572
+		} elseif ($action == 'CONTRACT_DELETE') {
573
+			dol_syslog(
574
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
575
+			);
576
+		}
577 577
 
578 578
 		elseif ($action == 'BILL_MODIFY') {
579
-            dol_syslog(
580
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
581
-            );
582
-        } elseif ($action == 'BILL_VALIDATE') {
583
-            dol_syslog(
584
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
585
-            );
586
-        } elseif ($action == 'BILL_BUILDDOC') {
587
-            dol_syslog(
588
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
589
-            );
590
-        } elseif ($action == 'BILL_SENTBYMAIL') {
591
-            dol_syslog(
592
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
593
-            );
594
-        } elseif ($action == 'BILL_CANCEL') {
595
-            dol_syslog(
596
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
597
-            );
598
-        } elseif ($action == 'BILL_DELETE') {
599
-            dol_syslog(
600
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
601
-            );
602
-        } elseif ($action == 'LINEBILL_INSERT') {
579
+			dol_syslog(
580
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
581
+			);
582
+		} elseif ($action == 'BILL_VALIDATE') {
583
+			dol_syslog(
584
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
585
+			);
586
+		} elseif ($action == 'BILL_BUILDDOC') {
587
+			dol_syslog(
588
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
589
+			);
590
+		} elseif ($action == 'BILL_SENTBYMAIL') {
591
+			dol_syslog(
592
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
593
+			);
594
+		} elseif ($action == 'BILL_CANCEL') {
595
+			dol_syslog(
596
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
597
+			);
598
+		} elseif ($action == 'BILL_DELETE') {
599
+			dol_syslog(
600
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
601
+			);
602
+		} elseif ($action == 'LINEBILL_INSERT') {
603 603
 				
604
-        	dol_syslog(
605
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
606
-            );
607
-        } elseif ($action == 'LINEBILL_DELETE') {
608
-            dol_syslog(
609
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
610
-            );
611
-        }
612
-
613
-        // Payments
614
-        elseif ($action == 'PAYMENT_CUSTOMER_CREATE') {
615
-            dol_syslog(
616
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
617
-            );
618
-        } elseif ($action == 'PAYMENT_SUPPLIER_CREATE') {
619
-            dol_syslog(
620
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
621
-            );
622
-        } elseif ($action == 'PAYMENT_ADD_TO_BANK') {
623
-            dol_syslog(
624
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
625
-            );
626
-        } elseif ($action == 'PAYMENT_DELETE') {
627
-            dol_syslog(
628
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
629
-            );
630
-        }
631
-
632
-        // Interventions
633
-        elseif ($action == 'FICHEINTER_CREATE') {
634
-            dol_syslog(
635
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
636
-            );
637
-        } elseif ($action == 'FICHEINTER_MODIFY') {
638
-            dol_syslog(
639
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
640
-            );
641
-        } elseif ($action == 'FICHEINTER_VALIDATE') {
642
-            dol_syslog(
643
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
644
-            );
645
-        } elseif ($action == 'FICHEINTER_DELETE') {
646
-            dol_syslog(
647
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
648
-            );
649
-        }
650
-
651
-        // Members
652
-        elseif ($action == 'MEMBER_CREATE') {
653
-            dol_syslog(
654
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
655
-            );
656
-        } elseif ($action == 'MEMBER_VALIDATE') {
657
-            dol_syslog(
658
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
659
-            );
660
-        } elseif ($action == 'MEMBER_SUBSCRIPTION') {
661
-            dol_syslog(
662
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
663
-            );
664
-        } elseif ($action == 'MEMBER_MODIFY') {
665
-            dol_syslog(
666
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
667
-            );
668
-        } elseif ($action == 'MEMBER_NEW_PASSWORD') {
669
-            dol_syslog(
670
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
671
-            );
672
-        } elseif ($action == 'MEMBER_RESILIATE') {
673
-            dol_syslog(
674
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
675
-            );
676
-        } elseif ($action == 'MEMBER_DELETE') {
677
-            dol_syslog(
678
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
679
-            );
680
-        }
681
-
682
-        // Categories
683
-        elseif ($action == 'CATEGORY_CREATE') {
684
-            dol_syslog(
685
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
686
-            );
687
-        } elseif ($action == 'CATEGORY_MODIFY') {
688
-            dol_syslog(
689
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
690
-            );
691
-        } elseif ($action == 'CATEGORY_DELETE') {
692
-            dol_syslog(
693
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
694
-            );
695
-        }
696
-
697
-        // Projects
698
-        elseif ($action == 'PROJECT_CREATE') {
699
-            dol_syslog(
700
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
701
-            );
702
-        } elseif ($action == 'PROJECT_MODIFY') {
703
-            dol_syslog(
704
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
705
-            );
706
-        } elseif ($action == 'PROJECT_DELETE') {
707
-            dol_syslog(
708
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
709
-            );
710
-        }
711
-
712
-        // Project tasks
713
-        elseif ($action == 'TASK_CREATE') {
714
-            dol_syslog(
715
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
716
-            );
717
-        } elseif ($action == 'TASK_MODIFY') {
718
-            dol_syslog(
719
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
720
-            );
721
-        } elseif ($action == 'TASK_DELETE') {
722
-            dol_syslog(
723
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
724
-            );
725
-        }
726
-
727
-        // Task time spent
728
-        elseif ($action == 'TASK_TIMESPENT_CREATE') {
729
-            dol_syslog(
730
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
731
-            );
732
-        } elseif ($action == 'TASK_TIMESPENT_MODIFY') {
733
-            dol_syslog(
734
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
735
-            );
736
-        } elseif ($action == 'TASK_TIMESPENT_DELETE') {
737
-            dol_syslog(
738
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
739
-            );
740
-        }
741
-
742
-        // Shipping
743
-        elseif ($action == 'SHIPPING_CREATE') {
744
-            dol_syslog(
745
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
746
-            );
747
-        } elseif ($action == 'SHIPPING_MODIFY') {
748
-            dol_syslog(
749
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
750
-            );
751
-        } elseif ($action == 'SHIPPING_VALIDATE') {
752
-            dol_syslog(
753
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
754
-            );
755
-        } elseif ($action == 'SHIPPING_SENTBYMAIL') {
756
-            dol_syslog(
757
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
758
-            );
759
-        } elseif ($action == 'SHIPPING_DELETE') {
760
-            dol_syslog(
761
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
762
-            );
763
-        } elseif ($action == 'SHIPPING_BUILDDOC') {
764
-            dol_syslog(
765
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
766
-            );
767
-        }
768
-
769
-        // File
770
-        elseif ($action == 'FILE_UPLOAD') {
771
-            dol_syslog(
772
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
773
-            );
774
-        } elseif ($action == 'FILE_DELETE') {
775
-            dol_syslog(
776
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
777
-            );
778
-        }
779
-
780
-        return 0;
781
-    }
604
+			dol_syslog(
605
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
606
+			);
607
+		} elseif ($action == 'LINEBILL_DELETE') {
608
+			dol_syslog(
609
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
610
+			);
611
+		}
612
+
613
+		// Payments
614
+		elseif ($action == 'PAYMENT_CUSTOMER_CREATE') {
615
+			dol_syslog(
616
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
617
+			);
618
+		} elseif ($action == 'PAYMENT_SUPPLIER_CREATE') {
619
+			dol_syslog(
620
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
621
+			);
622
+		} elseif ($action == 'PAYMENT_ADD_TO_BANK') {
623
+			dol_syslog(
624
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
625
+			);
626
+		} elseif ($action == 'PAYMENT_DELETE') {
627
+			dol_syslog(
628
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
629
+			);
630
+		}
631
+
632
+		// Interventions
633
+		elseif ($action == 'FICHEINTER_CREATE') {
634
+			dol_syslog(
635
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
636
+			);
637
+		} elseif ($action == 'FICHEINTER_MODIFY') {
638
+			dol_syslog(
639
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
640
+			);
641
+		} elseif ($action == 'FICHEINTER_VALIDATE') {
642
+			dol_syslog(
643
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
644
+			);
645
+		} elseif ($action == 'FICHEINTER_DELETE') {
646
+			dol_syslog(
647
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
648
+			);
649
+		}
650
+
651
+		// Members
652
+		elseif ($action == 'MEMBER_CREATE') {
653
+			dol_syslog(
654
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
655
+			);
656
+		} elseif ($action == 'MEMBER_VALIDATE') {
657
+			dol_syslog(
658
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
659
+			);
660
+		} elseif ($action == 'MEMBER_SUBSCRIPTION') {
661
+			dol_syslog(
662
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
663
+			);
664
+		} elseif ($action == 'MEMBER_MODIFY') {
665
+			dol_syslog(
666
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
667
+			);
668
+		} elseif ($action == 'MEMBER_NEW_PASSWORD') {
669
+			dol_syslog(
670
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
671
+			);
672
+		} elseif ($action == 'MEMBER_RESILIATE') {
673
+			dol_syslog(
674
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
675
+			);
676
+		} elseif ($action == 'MEMBER_DELETE') {
677
+			dol_syslog(
678
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
679
+			);
680
+		}
681
+
682
+		// Categories
683
+		elseif ($action == 'CATEGORY_CREATE') {
684
+			dol_syslog(
685
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
686
+			);
687
+		} elseif ($action == 'CATEGORY_MODIFY') {
688
+			dol_syslog(
689
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
690
+			);
691
+		} elseif ($action == 'CATEGORY_DELETE') {
692
+			dol_syslog(
693
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
694
+			);
695
+		}
696
+
697
+		// Projects
698
+		elseif ($action == 'PROJECT_CREATE') {
699
+			dol_syslog(
700
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
701
+			);
702
+		} elseif ($action == 'PROJECT_MODIFY') {
703
+			dol_syslog(
704
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
705
+			);
706
+		} elseif ($action == 'PROJECT_DELETE') {
707
+			dol_syslog(
708
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
709
+			);
710
+		}
711
+
712
+		// Project tasks
713
+		elseif ($action == 'TASK_CREATE') {
714
+			dol_syslog(
715
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
716
+			);
717
+		} elseif ($action == 'TASK_MODIFY') {
718
+			dol_syslog(
719
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
720
+			);
721
+		} elseif ($action == 'TASK_DELETE') {
722
+			dol_syslog(
723
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
724
+			);
725
+		}
726
+
727
+		// Task time spent
728
+		elseif ($action == 'TASK_TIMESPENT_CREATE') {
729
+			dol_syslog(
730
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
731
+			);
732
+		} elseif ($action == 'TASK_TIMESPENT_MODIFY') {
733
+			dol_syslog(
734
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
735
+			);
736
+		} elseif ($action == 'TASK_TIMESPENT_DELETE') {
737
+			dol_syslog(
738
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
739
+			);
740
+		}
741
+
742
+		// Shipping
743
+		elseif ($action == 'SHIPPING_CREATE') {
744
+			dol_syslog(
745
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
746
+			);
747
+		} elseif ($action == 'SHIPPING_MODIFY') {
748
+			dol_syslog(
749
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
750
+			);
751
+		} elseif ($action == 'SHIPPING_VALIDATE') {
752
+			dol_syslog(
753
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
754
+			);
755
+		} elseif ($action == 'SHIPPING_SENTBYMAIL') {
756
+			dol_syslog(
757
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
758
+			);
759
+		} elseif ($action == 'SHIPPING_DELETE') {
760
+			dol_syslog(
761
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
762
+			);
763
+		} elseif ($action == 'SHIPPING_BUILDDOC') {
764
+			dol_syslog(
765
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
766
+			);
767
+		}
768
+
769
+		// File
770
+		elseif ($action == 'FILE_UPLOAD') {
771
+			dol_syslog(
772
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
773
+			);
774
+		} elseif ($action == 'FILE_DELETE') {
775
+			dol_syslog(
776
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
777
+			);
778
+		}
779
+
780
+		return 0;
781
+	}
782 782
 }
783 783
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +106 added lines, -106 removed lines patch added patch discarded remove patch
@@ -107,13 +107,13 @@  discard block
 block discarded – undo
107 107
 			if ($object->id != $line->id && $line->rang > $rang)
108 108
 			{
109 109
 				// Update du rang de toutes les lignes suivant mon titre
110
-				$parent->updateRangOfLine($line->id, $line->rang+1);
110
+				$parent->updateRangOfLine($line->id, $line->rang + 1);
111 111
 			}
112 112
 		}
113 113
 		
114 114
 		// Update du rang de la ligne fraichement ajouté pour la déplacer sous mon titre
115
-		$parent->updateRangOfLine($object->id, $rang+1);
116
-		$object->rang = $rang+1;
115
+		$parent->updateRangOfLine($object->id, $rang + 1);
116
+		$object->rang = $rang + 1;
117 117
 	}
118 118
 	
119 119
 	public function addToEnd(&$parent, &$object, $rang)
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 			
137 137
 			if ($subtotal_line_found)
138 138
 			{
139
-				$parent->updateRangOfLine($line->id, $line->rang+1);
139
+				$parent->updateRangOfLine($line->id, $line->rang + 1);
140 140
 			}
141 141
 		}
142 142
 		
@@ -257,10 +257,10 @@  discard block
 block discarded – undo
257 257
 		{
258 258
 			$doli_action = GETPOST('action');
259 259
 			$set = GETPOST('set');
260
-			if ( (in_array($doli_action, array('updateligne', 'updateline', 'addline', 'add')) || $set == 'defaultTVA') && !TSubtotal::isTitle($object) && !TSubtotal::isSubtotal($object) && in_array($object->element, array('propaldet', 'commandedet', 'facturedet')))
260
+			if ((in_array($doli_action, array('updateligne', 'updateline', 'addline', 'add')) || $set == 'defaultTVA') && !TSubtotal::isTitle($object) && !TSubtotal::isSubtotal($object) && in_array($object->element, array('propaldet', 'commandedet', 'facturedet')))
261 261
 			{
262 262
 				 dol_syslog(
263
-					"[SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS] Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". object=".$object->element." id=" . $object->id
263
+					"[SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS] Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". object=".$object->element." id=".$object->id
264 264
 				);
265 265
 				 
266 266
 				$TTitle = TSubtotal::getAllTitleFromLine($object);
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 				}
281 281
 
282 282
 				// $object correspond à la ligne ajoutée
283
-				if(! empty($object->array_options['options_subtotal_nc'])) {
283
+				if (!empty($object->array_options['options_subtotal_nc'])) {
284 284
 					$object->total_ht = $object->total_tva = $object->total_ttc = $object->total_localtax1 = $object->total_localtax2 = 
285 285
 							$object->multicurrency_total_ht = $object->multicurrency_total_tva = $object->multicurrency_total_ttc = 0;
286 286
 
@@ -294,12 +294,12 @@  discard block
 block discarded – undo
294 294
 		
295 295
 		// Les lignes libres (y compris les sous-totaux) créées à partir d'une facture modèle n'ont pas la TVA de la ligne du modèle mais la TVA par défaut
296 296
 		if ($action == 'BILL_CREATE' && $object->fac_rec > 0) {
297
-			dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id);
297
+			dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
298 298
 
299 299
 			$object->fetch_lines(); // Lignes pas rajoutées à $object->lines par les appels à addline();
300 300
 
301
-			foreach($object->lines as &$line) {
302
-				if(TSubtotal::isSubtotal($line) && ! empty($line->tva_tx)) {
301
+			foreach ($object->lines as &$line) {
302
+				if (TSubtotal::isSubtotal($line) && !empty($line->tva_tx)) {
303 303
 					$line->tva_tx = 0;
304 304
 					$line->update();
305 305
 				}
@@ -309,170 +309,170 @@  discard block
 block discarded – undo
309 309
         
310 310
         if ($action == 'USER_LOGIN') {
311 311
             dol_syslog(
312
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
312
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
313 313
             );
314 314
         } elseif ($action == 'USER_UPDATE_SESSION') {
315 315
             // Warning: To increase performances, this action is triggered only if
316 316
             // constant MAIN_ACTIVATE_UPDATESESSIONTRIGGER is set to 1.
317 317
             dol_syslog(
318
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
318
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
319 319
             );
320 320
         } elseif ($action == 'USER_CREATE') {
321 321
             dol_syslog(
322
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
322
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
323 323
             );
324 324
         } elseif ($action == 'USER_CREATE_FROM_CONTACT') {
325 325
             dol_syslog(
326
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
326
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
327 327
             );
328 328
         } elseif ($action == 'USER_MODIFY') {
329 329
             dol_syslog(
330
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
330
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
331 331
             );
332 332
         } elseif ($action == 'USER_NEW_PASSWORD') {
333 333
             dol_syslog(
334
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
334
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
335 335
             );
336 336
         } elseif ($action == 'USER_ENABLEDISABLE') {
337 337
             dol_syslog(
338
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
338
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
339 339
             );
340 340
         } elseif ($action == 'USER_DELETE') {
341 341
             dol_syslog(
342
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
342
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
343 343
             );
344 344
         } elseif ($action == 'USER_LOGOUT') {
345 345
             dol_syslog(
346
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
346
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
347 347
             );
348 348
         } elseif ($action == 'USER_SETINGROUP') {
349 349
             dol_syslog(
350
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
350
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
351 351
             );
352 352
         } elseif ($action == 'USER_REMOVEFROMGROUP') {
353 353
             dol_syslog(
354
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
354
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
355 355
             );
356 356
         }
357 357
 
358 358
         // Groups
359 359
         elseif ($action == 'GROUP_CREATE') {
360 360
             dol_syslog(
361
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
361
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
362 362
             );
363 363
         } elseif ($action == 'GROUP_MODIFY') {
364 364
             dol_syslog(
365
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
365
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
366 366
             );
367 367
         } elseif ($action == 'GROUP_DELETE') {
368 368
             dol_syslog(
369
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
369
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
370 370
             );
371 371
         }
372 372
 
373 373
         // Companies
374 374
         elseif ($action == 'COMPANY_CREATE') {
375 375
             dol_syslog(
376
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
376
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
377 377
             );
378 378
         } elseif ($action == 'COMPANY_MODIFY') {
379 379
             dol_syslog(
380
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
380
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
381 381
             );
382 382
         } elseif ($action == 'COMPANY_DELETE') {
383 383
             dol_syslog(
384
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
384
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
385 385
             );
386 386
         }
387 387
 
388 388
         // Contacts
389 389
         elseif ($action == 'CONTACT_CREATE') {
390 390
             dol_syslog(
391
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
391
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
392 392
             );
393 393
         } elseif ($action == 'CONTACT_MODIFY') {
394 394
             dol_syslog(
395
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
395
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
396 396
             );
397 397
         } elseif ($action == 'CONTACT_DELETE') {
398 398
             dol_syslog(
399
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
399
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
400 400
             );
401 401
         }
402 402
 
403 403
         // Products
404 404
         elseif ($action == 'PRODUCT_CREATE') {
405 405
             dol_syslog(
406
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
406
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
407 407
             );
408 408
         } elseif ($action == 'PRODUCT_MODIFY') {
409 409
             dol_syslog(
410
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
410
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
411 411
             );
412 412
         } elseif ($action == 'PRODUCT_DELETE') {
413 413
             dol_syslog(
414
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
414
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
415 415
             );
416 416
         }
417 417
 
418 418
         // Customer orders
419 419
         elseif ($action == 'ORDER_CREATE') {
420 420
             dol_syslog(
421
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
421
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
422 422
             );
423 423
         } elseif ($action == 'ORDER_VALIDATE') {
424 424
             dol_syslog(
425
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
425
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
426 426
             );
427 427
         } elseif ($action == 'ORDER_DELETE') {
428 428
             dol_syslog(
429
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
429
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
430 430
             );
431 431
         } elseif ($action == 'ORDER_BUILDDOC') {
432 432
             dol_syslog(
433
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
433
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
434 434
             );
435 435
         } elseif ($action == 'ORDER_SENTBYMAIL') {
436 436
             dol_syslog(
437
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
437
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
438 438
             );
439 439
         } elseif ($action == 'LINEORDER_INSERT') {
440 440
             dol_syslog(
441
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
441
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
442 442
             );
443 443
         } elseif ($action == 'LINEORDER_DELETE') {
444 444
             dol_syslog(
445
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
445
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
446 446
             );
447 447
         }
448 448
 
449 449
         // Supplier orders
450 450
         elseif ($action == 'ORDER_SUPPLIER_CREATE') {
451 451
             dol_syslog(
452
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
452
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
453 453
             );
454 454
         } elseif ($action == 'ORDER_SUPPLIER_VALIDATE') {
455 455
             dol_syslog(
456
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
456
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
457 457
             );
458 458
         } elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') {
459 459
             dol_syslog(
460
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
460
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
461 461
             );
462 462
         } elseif ($action == 'SUPPLIER_ORDER_BUILDDOC') {
463 463
             dol_syslog(
464
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
464
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
465 465
             );
466 466
         }
467 467
 
468 468
         // Proposals
469 469
         elseif ($action == 'PROPAL_CREATE') {
470 470
             dol_syslog(
471
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
471
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
472 472
             );
473 473
         } elseif (in_array($action, array('PROPAL_CLONE', 'ORDER_CLONE', 'BILL_CLONE'))) {
474 474
             dol_syslog(
475
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
475
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
476 476
             );
477 477
 			
478 478
 			$doli_action = GETPOST('action');
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
 			if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && in_array($doli_action, array('confirm_clone')))
481 481
 			{
482 482
 				dol_syslog(
483
-					"[SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS] Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". object=".$object->element." id=" . $object->id
483
+					"[SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS] Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". object=".$object->element." id=".$object->id
484 484
 				);
485 485
 				
486 486
 				// En fonction de l'objet et de la version, les lignes conservent l'id de l'objet d'origine
@@ -508,272 +508,272 @@  discard block
 block discarded – undo
508 508
 			
509 509
         } elseif ($action == 'PROPAL_MODIFY') {
510 510
             dol_syslog(
511
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
511
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
512 512
             );
513 513
         } elseif ($action == 'PROPAL_VALIDATE') {
514 514
             dol_syslog(
515
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
515
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
516 516
             );
517 517
         } elseif ($action == 'PROPAL_BUILDDOC') {
518 518
             dol_syslog(
519
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
519
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
520 520
             );
521 521
         } elseif ($action == 'PROPAL_SENTBYMAIL') {
522 522
             dol_syslog(
523
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
523
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
524 524
             );
525 525
         } elseif ($action == 'PROPAL_CLOSE_SIGNED') {
526 526
             dol_syslog(
527
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
527
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
528 528
             );
529 529
         } elseif ($action == 'PROPAL_CLOSE_REFUSED') {
530 530
             dol_syslog(
531
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
531
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
532 532
             );
533 533
         } elseif ($action == 'PROPAL_DELETE') {
534 534
             dol_syslog(
535
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
535
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
536 536
             );
537 537
         } elseif ($action == 'LINEPROPAL_INSERT') {
538 538
             dol_syslog(
539
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
539
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
540 540
             );
541 541
         } elseif ($action == 'LINEPROPAL_MODIFY') {
542 542
             dol_syslog(
543
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
543
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
544 544
             );
545 545
         } elseif ($action == 'LINEPROPAL_DELETE') {
546 546
             dol_syslog(
547
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
547
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
548 548
             );
549 549
         }
550 550
 
551 551
         // Contracts
552 552
         elseif ($action == 'CONTRACT_CREATE') {
553 553
             dol_syslog(
554
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
554
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
555 555
             );
556 556
         } elseif ($action == 'CONTRACT_MODIFY') {
557 557
             dol_syslog(
558
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
558
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
559 559
             );
560 560
         } elseif ($action == 'CONTRACT_ACTIVATE') {
561 561
             dol_syslog(
562
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
562
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
563 563
             );
564 564
         } elseif ($action == 'CONTRACT_CANCEL') {
565 565
             dol_syslog(
566
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
566
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
567 567
             );
568 568
         } elseif ($action == 'CONTRACT_CLOSE') {
569 569
             dol_syslog(
570
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
570
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
571 571
             );
572 572
         } elseif ($action == 'CONTRACT_DELETE') {
573 573
             dol_syslog(
574
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
574
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
575 575
             );
576 576
         }
577 577
 
578 578
 		elseif ($action == 'BILL_MODIFY') {
579 579
             dol_syslog(
580
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
580
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
581 581
             );
582 582
         } elseif ($action == 'BILL_VALIDATE') {
583 583
             dol_syslog(
584
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
584
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
585 585
             );
586 586
         } elseif ($action == 'BILL_BUILDDOC') {
587 587
             dol_syslog(
588
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
588
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
589 589
             );
590 590
         } elseif ($action == 'BILL_SENTBYMAIL') {
591 591
             dol_syslog(
592
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
592
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
593 593
             );
594 594
         } elseif ($action == 'BILL_CANCEL') {
595 595
             dol_syslog(
596
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
596
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
597 597
             );
598 598
         } elseif ($action == 'BILL_DELETE') {
599 599
             dol_syslog(
600
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
600
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
601 601
             );
602 602
         } elseif ($action == 'LINEBILL_INSERT') {
603 603
 				
604 604
         	dol_syslog(
605
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
605
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
606 606
             );
607 607
         } elseif ($action == 'LINEBILL_DELETE') {
608 608
             dol_syslog(
609
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
609
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
610 610
             );
611 611
         }
612 612
 
613 613
         // Payments
614 614
         elseif ($action == 'PAYMENT_CUSTOMER_CREATE') {
615 615
             dol_syslog(
616
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
616
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
617 617
             );
618 618
         } elseif ($action == 'PAYMENT_SUPPLIER_CREATE') {
619 619
             dol_syslog(
620
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
620
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
621 621
             );
622 622
         } elseif ($action == 'PAYMENT_ADD_TO_BANK') {
623 623
             dol_syslog(
624
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
624
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
625 625
             );
626 626
         } elseif ($action == 'PAYMENT_DELETE') {
627 627
             dol_syslog(
628
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
628
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
629 629
             );
630 630
         }
631 631
 
632 632
         // Interventions
633 633
         elseif ($action == 'FICHEINTER_CREATE') {
634 634
             dol_syslog(
635
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
635
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
636 636
             );
637 637
         } elseif ($action == 'FICHEINTER_MODIFY') {
638 638
             dol_syslog(
639
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
639
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
640 640
             );
641 641
         } elseif ($action == 'FICHEINTER_VALIDATE') {
642 642
             dol_syslog(
643
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
643
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
644 644
             );
645 645
         } elseif ($action == 'FICHEINTER_DELETE') {
646 646
             dol_syslog(
647
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
647
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
648 648
             );
649 649
         }
650 650
 
651 651
         // Members
652 652
         elseif ($action == 'MEMBER_CREATE') {
653 653
             dol_syslog(
654
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
654
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
655 655
             );
656 656
         } elseif ($action == 'MEMBER_VALIDATE') {
657 657
             dol_syslog(
658
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
658
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
659 659
             );
660 660
         } elseif ($action == 'MEMBER_SUBSCRIPTION') {
661 661
             dol_syslog(
662
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
662
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
663 663
             );
664 664
         } elseif ($action == 'MEMBER_MODIFY') {
665 665
             dol_syslog(
666
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
666
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
667 667
             );
668 668
         } elseif ($action == 'MEMBER_NEW_PASSWORD') {
669 669
             dol_syslog(
670
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
670
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
671 671
             );
672 672
         } elseif ($action == 'MEMBER_RESILIATE') {
673 673
             dol_syslog(
674
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
674
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
675 675
             );
676 676
         } elseif ($action == 'MEMBER_DELETE') {
677 677
             dol_syslog(
678
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
678
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
679 679
             );
680 680
         }
681 681
 
682 682
         // Categories
683 683
         elseif ($action == 'CATEGORY_CREATE') {
684 684
             dol_syslog(
685
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
685
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
686 686
             );
687 687
         } elseif ($action == 'CATEGORY_MODIFY') {
688 688
             dol_syslog(
689
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
689
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
690 690
             );
691 691
         } elseif ($action == 'CATEGORY_DELETE') {
692 692
             dol_syslog(
693
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
693
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
694 694
             );
695 695
         }
696 696
 
697 697
         // Projects
698 698
         elseif ($action == 'PROJECT_CREATE') {
699 699
             dol_syslog(
700
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
700
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
701 701
             );
702 702
         } elseif ($action == 'PROJECT_MODIFY') {
703 703
             dol_syslog(
704
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
704
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
705 705
             );
706 706
         } elseif ($action == 'PROJECT_DELETE') {
707 707
             dol_syslog(
708
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
708
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
709 709
             );
710 710
         }
711 711
 
712 712
         // Project tasks
713 713
         elseif ($action == 'TASK_CREATE') {
714 714
             dol_syslog(
715
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
715
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
716 716
             );
717 717
         } elseif ($action == 'TASK_MODIFY') {
718 718
             dol_syslog(
719
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
719
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
720 720
             );
721 721
         } elseif ($action == 'TASK_DELETE') {
722 722
             dol_syslog(
723
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
723
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
724 724
             );
725 725
         }
726 726
 
727 727
         // Task time spent
728 728
         elseif ($action == 'TASK_TIMESPENT_CREATE') {
729 729
             dol_syslog(
730
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
730
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
731 731
             );
732 732
         } elseif ($action == 'TASK_TIMESPENT_MODIFY') {
733 733
             dol_syslog(
734
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
734
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
735 735
             );
736 736
         } elseif ($action == 'TASK_TIMESPENT_DELETE') {
737 737
             dol_syslog(
738
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
738
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
739 739
             );
740 740
         }
741 741
 
742 742
         // Shipping
743 743
         elseif ($action == 'SHIPPING_CREATE') {
744 744
             dol_syslog(
745
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
745
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
746 746
             );
747 747
         } elseif ($action == 'SHIPPING_MODIFY') {
748 748
             dol_syslog(
749
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
749
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
750 750
             );
751 751
         } elseif ($action == 'SHIPPING_VALIDATE') {
752 752
             dol_syslog(
753
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
753
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
754 754
             );
755 755
         } elseif ($action == 'SHIPPING_SENTBYMAIL') {
756 756
             dol_syslog(
757
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
757
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
758 758
             );
759 759
         } elseif ($action == 'SHIPPING_DELETE') {
760 760
             dol_syslog(
761
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
761
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
762 762
             );
763 763
         } elseif ($action == 'SHIPPING_BUILDDOC') {
764 764
             dol_syslog(
765
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
765
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
766 766
             );
767 767
         }
768 768
 
769 769
         // File
770 770
         elseif ($action == 'FILE_UPLOAD') {
771 771
             dol_syslog(
772
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
772
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
773 773
             );
774 774
         } elseif ($action == 'FILE_DELETE') {
775 775
             dol_syslog(
776
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
776
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
777 777
             );
778 778
         }
779 779
 
Please login to merge, or discard this patch.
Braces   +58 added lines, -27 removed lines patch added patch discarded remove patch
@@ -89,12 +89,14 @@  discard block
 block discarded – undo
89 89
 
90 90
         if ($this->version == 'development') {
91 91
             return $langs->trans("Development");
92
-        } elseif ($this->version == 'experimental')
93
-
92
+        } elseif ($this->version == 'experimental') {
93
+        
94 94
                 return $langs->trans("Experimental");
95
-        elseif ($this->version == 'dolibarr') return DOL_VERSION;
96
-        elseif ($this->version) return $this->version;
97
-        else {
95
+        } elseif ($this->version == 'dolibarr') {
96
+        	return DOL_VERSION;
97
+        } elseif ($this->version) {
98
+        	return $this->version;
99
+        } else {
98 100
             return $langs->trans("Unknown");
99 101
         }
100 102
     }
@@ -122,14 +124,18 @@  discard block
 block discarded – undo
122 124
 		$subtotal_line_found = false;
123 125
 		foreach ($parent->lines as $k => &$line)
124 126
 		{
125
-			if ($line->rang < $rang) continue;
126
-			elseif ($line->rang == $rang) // Je suis sur la ligne de titre où je souhaite ajouter ma nouvelle ligne en fin de bloc
127
+			if ($line->rang < $rang) {
128
+				continue;
129
+			} elseif ($line->rang == $rang) {
130
+				// Je suis sur la ligne de titre où je souhaite ajouter ma nouvelle ligne en fin de bloc
127 131
 			{
128 132
 				$title_level = $line->qty;
129 133
 			}
130
-			elseif (!$subtotal_line_found && $title_level > -1 && ($line->qty == 100 - $title_level)) // Le level de mon titre a été trouvé avant, donc maintenant je vais m'arrêter jusqu'à trouver un sous-total
134
+			} elseif (!$subtotal_line_found && $title_level > -1 && ($line->qty == 100 - $title_level)) {
135
+				// Le level de mon titre a été trouvé avant, donc maintenant je vais m'arrêter jusqu'à trouver un sous-total
131 136
 			{
132 137
 				$subtotal_line_found = true;
138
+			}
133 139
 				$rang = $line->rang;
134 140
 			}
135 141
 			
@@ -191,8 +197,11 @@  discard block
 block discarded – undo
191 197
 						break;
192 198
 				}
193 199
 				
194
-				if (!empty($conf->global->SUBTOTAL_ADD_LINE_UNDER_TITLE_AT_END_BLOCK)) $this->addToEnd($parent, $object, $rang);
195
-				else $this->addToBegin($parent, $object, $rang);
200
+				if (!empty($conf->global->SUBTOTAL_ADD_LINE_UNDER_TITLE_AT_END_BLOCK)) {
201
+					$this->addToEnd($parent, $object, $rang);
202
+				} else {
203
+					$this->addToBegin($parent, $object, $rang);
204
+				}
196 205
 				
197 206
 			}
198 207
 			
@@ -220,7 +229,9 @@  discard block
 block discarded – undo
220 229
 						$commande->fetch($current_fk_commande);
221 230
 						
222 231
 						$label = $conf->global->SUBTOTAL_TEXT_FOR_TITLE_ORDETSTOINVOICE;
223
-						if (empty($label)) $label = 'Commande [__REFORDER__] - Référence client : [__REFCUSTOMER__]';
232
+						if (empty($label)) {
233
+							$label = 'Commande [__REFORDER__] - Référence client : [__REFCUSTOMER__]';
234
+						}
224 235
 						$label = str_replace(array('__REFORDER__', '__REFCUSTOMER__'), array($commande->ref, $commande->ref_client), $label);
225 236
 						
226 237
 						TSubtotal::addTitle($facture, $label, 1, $rang);
@@ -271,10 +282,15 @@  discard block
 block discarded – undo
271 282
 						$object->total_ht = $object->total_tva = $object->total_ttc = $object->total_localtax1 = $object->total_localtax2 = 
272 283
 							$object->multicurrency_total_ht = $object->multicurrency_total_tva = $object->multicurrency_total_ttc = 0;
273 284
 
274
-						if ($object->element == 'propal') $res = $object->update(1);
275
-						else $res = $object->update($user, 1);
285
+						if ($object->element == 'propal') {
286
+							$res = $object->update(1);
287
+						} else {
288
+							$res = $object->update($user, 1);
289
+						}
276 290
 						
277
-						if ($res > 0) setEventMessage($langs->trans('subtotal_update_nc_success'));
291
+						if ($res > 0) {
292
+							setEventMessage($langs->trans('subtotal_update_nc_success'));
293
+						}
278 294
 						break;
279 295
 					}
280 296
 				}
@@ -284,10 +300,15 @@  discard block
 block discarded – undo
284 300
 					$object->total_ht = $object->total_tva = $object->total_ttc = $object->total_localtax1 = $object->total_localtax2 = 
285 301
 							$object->multicurrency_total_ht = $object->multicurrency_total_tva = $object->multicurrency_total_ttc = 0;
286 302
 
287
-					if ($object->element == 'propaldet') $res = $object->update(1);
288
-					else $res = $object->update($user, 1);
303
+					if ($object->element == 'propaldet') {
304
+						$res = $object->update(1);
305
+					} else {
306
+						$res = $object->update($user, 1);
307
+					}
289 308
 
290
-					if ($res > 0) setEventMessage($langs->trans('subtotal_update_nc_success'));
309
+					if ($res > 0) {
310
+						setEventMessage($langs->trans('subtotal_update_nc_success'));
311
+					}
291 312
 				}
292 313
 			}
293 314
 		}
@@ -484,26 +505,38 @@  discard block
 block discarded – undo
484 505
 				);
485 506
 				
486 507
 				// En fonction de l'objet et de la version, les lignes conservent l'id de l'objet d'origine
487
-				if (method_exists($object, 'fetch_lines')) $object->fetch_lines();
488
-				else $object->fetch($object->id);
508
+				if (method_exists($object, 'fetch_lines')) {
509
+					$object->fetch_lines();
510
+				} else {
511
+					$object->fetch($object->id);
512
+				}
489 513
 			
490 514
 				foreach ($object->lines as &$line)
491 515
 				{
492
-					if (empty($line->array_options)) $line->fetch_optionals();
516
+					if (empty($line->array_options)) {
517
+						$line->fetch_optionals();
518
+					}
493 519
 					
494 520
 					if (!TSubtotal::isModSubtotalLine($line) && !empty($line->array_options['options_subtotal_nc']))
495 521
 					{
496 522
 						$line->total_ht = $line->total_tva = $line->total_ttc = $line->total_localtax1 = $line->total_localtax2 = 
497 523
 							$line->multicurrency_total_ht = $line->multicurrency_total_tva = $line->multicurrency_total_ttc = 0;
498 524
 
499
-						if ($line->element == 'propaldet') $res = $line->update(1);
500
-						else $res = $line->update($user, 1);
525
+						if ($line->element == 'propaldet') {
526
+							$res = $line->update(1);
527
+						} else {
528
+							$res = $line->update($user, 1);
529
+						}
501 530
 						
502
-						if ($res > 0) setEventMessage($langs->trans('subtotal_update_nc_success'));
531
+						if ($res > 0) {
532
+							setEventMessage($langs->trans('subtotal_update_nc_success'));
533
+						}
503 534
 					}
504 535
 				}
505 536
 				
506
-				if (!empty($line)) $object->update_price(1);
537
+				if (!empty($line)) {
538
+					$object->update_price(1);
539
+				}
507 540
 			}
508 541
 			
509 542
         } elseif ($action == 'PROPAL_MODIFY') {
@@ -573,9 +606,7 @@  discard block
 block discarded – undo
573 606
             dol_syslog(
574 607
                 "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
575 608
             );
576
-        }
577
-
578
-		elseif ($action == 'BILL_MODIFY') {
609
+        } elseif ($action == 'BILL_MODIFY') {
579 610
             dol_syslog(
580 611
                 "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
581 612
             );
Please login to merge, or discard this patch.
lib/subtotal.lib.php 3 patches
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -25,25 +25,25 @@  discard block
 block discarded – undo
25 25
 
26 26
 function subtotalAdminPrepareHead()
27 27
 {
28
-    global $langs, $conf;
28
+	global $langs, $conf;
29 29
 
30
-    $langs->load("subtotal@subtotal");
30
+	$langs->load("subtotal@subtotal");
31 31
 
32
-    $h = 0;
33
-    $head = array();
32
+	$h = 0;
33
+	$head = array();
34 34
 
35
-    $head[$h][0] = dol_buildpath("/subtotal/admin/subtotal_setup.php", 1);
36
-    $head[$h][1] = $langs->trans("Parameters");
37
-    $head[$h][2] = 'settings';
38
-    $h++;
39
-    $head[$h][0] = dol_buildpath("/subtotal/admin/subtotal_about.php", 1);
40
-    $head[$h][1] = $langs->trans("About");
41
-    $head[$h][2] = 'about';
42
-    $h++;
35
+	$head[$h][0] = dol_buildpath("/subtotal/admin/subtotal_setup.php", 1);
36
+	$head[$h][1] = $langs->trans("Parameters");
37
+	$head[$h][2] = 'settings';
38
+	$h++;
39
+	$head[$h][0] = dol_buildpath("/subtotal/admin/subtotal_about.php", 1);
40
+	$head[$h][1] = $langs->trans("About");
41
+	$head[$h][2] = 'about';
42
+	$h++;
43 43
 
44
-    complete_head_from_modules($conf, $langs, $object, $head, $h, 'subtotal', $showLabel=false);
44
+	complete_head_from_modules($conf, $langs, $object, $head, $h, 'subtotal', $showLabel=false);
45 45
 
46
-    return $head;
46
+	return $head;
47 47
 }
48 48
 
49 49
 function getHtmlSelectTitle(&$object, $showLabel=false)
@@ -242,17 +242,17 @@  discard block
 block discarded – undo
242 242
 			$classname = ucfirst($element);
243 243
 			
244 244
 			switch ($element) {
245
-			    case 'supplier_proposal':
246
-			        $classname = 'SupplierProposal';
247
-			        break;
245
+				case 'supplier_proposal':
246
+					$classname = 'SupplierProposal';
247
+					break;
248 248
 			        
249
-			    case 'order_supplier':
250
-			        $classname = 'CommandeFournisseur';
251
-			        break;
249
+				case 'order_supplier':
250
+					$classname = 'CommandeFournisseur';
251
+					break;
252 252
 			        
253
-			    case 'invoice_supplier':
254
-			        $classname = 'FactureFournisseur';
255
-			        break;
253
+				case 'invoice_supplier':
254
+					$classname = 'FactureFournisseur';
255
+					break;
256 256
 			}
257 257
 			
258 258
 			$object = new $classname($db); // Propal | Commande | Facture
@@ -325,14 +325,14 @@  discard block
 block discarded – undo
325 325
 		else $res = $line->update($user);
326 326
 	}
327 327
 	else {
328
-	    if(in_array($object->element, array('invoice_supplier', 'order_supplier', 'supplier_proposal'))) {
329
-	        if(empty($line->label)) $line->label = $line->description; // supplier lines don't have the field label
328
+		if(in_array($object->element, array('invoice_supplier', 'order_supplier', 'supplier_proposal'))) {
329
+			if(empty($line->label)) $line->label = $line->description; // supplier lines don't have the field label
330 330
 	        
331
-	        require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
332
-	        $extrafields=new ExtraFields($object->db);
333
-	        $extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true);
334
-	        $line->fetch_optionals($line->id,$extralabels);
335
-	    }
331
+			require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
332
+			$extrafields=new ExtraFields($object->db);
333
+			$extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true);
334
+			$line->fetch_optionals($line->id,$extralabels);
335
+		}
336 336
 		$line->array_options['options_subtotal_nc'] = 0;
337 337
 		if($object->element == 'order_supplier') $line->update($user);
338 338
 		$res = TSubtotal::doUpdateLine($object, $line->id, $line->desc, $line->subprice, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->product_type, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->fk_parent_line, $line->skip_update_total, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit);
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -41,21 +41,21 @@  discard block
 block discarded – undo
41 41
     $head[$h][2] = 'about';
42 42
     $h++;
43 43
 
44
-    complete_head_from_modules($conf, $langs, $object, $head, $h, 'subtotal', $showLabel=false);
44
+    complete_head_from_modules($conf, $langs, $object, $head, $h, 'subtotal', $showLabel = false);
45 45
 
46 46
     return $head;
47 47
 }
48 48
 
49
-function getHtmlSelectTitle(&$object, $showLabel=false)
49
+function getHtmlSelectTitle(&$object, $showLabel = false)
50 50
 {
51 51
 	global $langs;
52 52
 	
53
-	require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php';
53
+	require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
54 54
 	dol_include_once('/subtotal/class/subtotal.class.php');
55 55
 	$TTitle = TSubtotal::getAllTitleFromDocument($object);
56 56
 	$html = '';
57
-	if ($showLabel) $html.= '<label for="under_title">'.$langs->trans('subtotalLabelForUnderTitle').'</label>';
58
-	$html.= '<select onChange="$(\'select[name=under_title]\').val(this.value);" name="under_title" class="under_title minwidth200"><option value="-1"></option>';
57
+	if ($showLabel) $html .= '<label for="under_title">'.$langs->trans('subtotalLabelForUnderTitle').'</label>';
58
+	$html .= '<select onChange="$(\'select[name=under_title]\').val(this.value);" name="under_title" class="under_title minwidth200"><option value="-1"></option>';
59 59
 	
60 60
 	$nbsp = '&nbsp;';
61 61
 	foreach ($TTitle as &$line)
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 
71 71
 function getTFreeText()
72 72
 {
73
-	global $db,$conf;
73
+	global $db, $conf;
74 74
 	
75 75
 	$TFreeText = array();
76 76
 	
@@ -88,19 +88,19 @@  discard block
 block discarded – undo
88 88
 	return $TFreeText;
89 89
 }
90 90
 
91
-function getHtmlSelectFreeText($withEmpty=true)
91
+function getHtmlSelectFreeText($withEmpty = true)
92 92
 {
93 93
 	global $langs;
94 94
 	
95 95
 	$TFreeText = getTFreeText();
96 96
 	$html = '<label for="free_text">'.$langs->trans('subtotalLabelForFreeText').'</label>';
97
-	$html.= '<select onChange="getTFreeText($(this));" name="free_text" class="minwidth200">';
98
-	if ($withEmpty) $html.= '<option value=""></option>';
97
+	$html .= '<select onChange="getTFreeText($(this));" name="free_text" class="minwidth200">';
98
+	if ($withEmpty) $html .= '<option value=""></option>';
99 99
 
100 100
 	$TFreeTextContents = array();
101 101
 	foreach ($TFreeText as $id => $tab)
102 102
 	{
103
-		$html.= '<option value="'.$id.'">'.$tab->label.'</option>';
103
+		$html .= '<option value="'.$id.'">'.$tab->label.'</option>';
104 104
 		$TFreeTextContents[$id] = $tab->content;
105 105
 	}
106 106
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 function _updateSubtotalLine(&$object, &$line)
129 129
 {
130 130
 	$label = GETPOST('line-title');
131
-	$description = ($line->qty>90) ? '' : GETPOST('line-description');
131
+	$description = ($line->qty > 90) ? '' : GETPOST('line-description');
132 132
 	$pagebreak = (int) GETPOST('line-pagebreak');
133 133
 
134 134
 	$level = GETPOST('subtotal_level', 'int');
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 
146 146
 function _updateSubtotalBloc($object, $line)
147 147
 {
148
-	global $conf,$langs;
148
+	global $conf, $langs;
149 149
 	
150 150
 	$subtotal_tva_tx = $subtotal_tva_tx_init = GETPOST('subtotal_tva_tx', 'int');
151 151
 	$subtotal_progress = $subtotal_progress_init = GETPOST('subtotal_progress', 'int');
@@ -224,9 +224,9 @@  discard block
 block discarded – undo
224 224
  * @param	$lineid			= title lineid
225 225
  * @param	$subtotal_nc	0 = "Compris" prise en compte des totaux des lignes; 1 = "Non compris" non prise en compte des totaux du bloc; null = update de toutes les lignes 
226 226
  */
227
-function _updateLineNC($element, $elementid, $lineid, $subtotal_nc=null)
227
+function _updateLineNC($element, $elementid, $lineid, $subtotal_nc = null)
228 228
 {
229
-	global $db,$langs,$tmp_object_nc;
229
+	global $db, $langs, $tmp_object_nc;
230 230
 	
231 231
 	$error = 0;
232 232
 	if (empty($element)) $error++;
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 	{
267 267
 		foreach ($object->lines as &$l)
268 268
 		{
269
-			if($l->id == $lineid) {
269
+			if ($l->id == $lineid) {
270 270
 				$line = $l;
271 271
 				break;
272 272
 			}
@@ -276,12 +276,12 @@  discard block
 block discarded – undo
276 276
 		{
277 277
 			$db->begin();
278 278
 			
279
-			if(TSubtotal::isModSubtotalLine($line))
279
+			if (TSubtotal::isModSubtotalLine($line))
280 280
 			{
281
-				if(TSubtotal::isTitle($line)) {
281
+				if (TSubtotal::isTitle($line)) {
282 282
 					// Update le contenu du titre (ainsi que le titre lui même)
283 283
 					$TTitleBlock = TSubtotal::getLinesFromTitleId($object, $lineid, true);
284
-					foreach($TTitleBlock as &$line_block)
284
+					foreach ($TTitleBlock as &$line_block)
285 285
 					{
286 286
 						$res = doUpdate($object, $line_block, $subtotal_nc);
287 287
 					}
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 	
316 316
 	if (TSubtotal::isFreeText($line) || TSubtotal::isSubtotal($line)) return 1;
317 317
 	// Update extrafield et total
318
-	if(! empty($subtotal_nc)) {
318
+	if (!empty($subtotal_nc)) {
319 319
 		$line->total_ht = $line->total_tva = $line->total_ttc = $line->total_localtax1 = $line->total_localtax2 = 
320 320
 			$line->multicurrency_total_ht = $line->multicurrency_total_tva = $line->multicurrency_total_ttc = 0;
321 321
 
@@ -325,16 +325,16 @@  discard block
 block discarded – undo
325 325
 		else $res = $line->update($user);
326 326
 	}
327 327
 	else {
328
-	    if(in_array($object->element, array('invoice_supplier', 'order_supplier', 'supplier_proposal'))) {
329
-	        if(empty($line->label)) $line->label = $line->description; // supplier lines don't have the field label
328
+	    if (in_array($object->element, array('invoice_supplier', 'order_supplier', 'supplier_proposal'))) {
329
+	        if (empty($line->label)) $line->label = $line->description; // supplier lines don't have the field label
330 330
 	        
331 331
 	        require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
332
-	        $extrafields=new ExtraFields($object->db);
333
-	        $extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true);
334
-	        $line->fetch_optionals($line->id,$extralabels);
332
+	        $extrafields = new ExtraFields($object->db);
333
+	        $extralabels = $extrafields->fetch_name_optionals_label($object->table_element_line, true);
334
+	        $line->fetch_optionals($line->id, $extralabels);
335 335
 	    }
336 336
 		$line->array_options['options_subtotal_nc'] = 0;
337
-		if($object->element == 'order_supplier') $line->update($user);
337
+		if ($object->element == 'order_supplier') $line->update($user);
338 338
 		$res = TSubtotal::doUpdateLine($object, $line->id, $line->desc, $line->subprice, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->product_type, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->fk_parent_line, $line->skip_update_total, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit);
339 339
 	}
340 340
 	
Please login to merge, or discard this patch.
Braces   +63 added lines, -29 removed lines patch added patch discarded remove patch
@@ -54,7 +54,9 @@  discard block
 block discarded – undo
54 54
 	dol_include_once('/subtotal/class/subtotal.class.php');
55 55
 	$TTitle = TSubtotal::getAllTitleFromDocument($object);
56 56
 	$html = '';
57
-	if ($showLabel) $html.= '<label for="under_title">'.$langs->trans('subtotalLabelForUnderTitle').'</label>';
57
+	if ($showLabel) {
58
+		$html.= '<label for="under_title">'.$langs->trans('subtotalLabelForUnderTitle').'</label>';
59
+	}
58 60
 	$html.= '<select onChange="$(\'select[name=under_title]\').val(this.value);" name="under_title" class="under_title minwidth200"><option value="-1"></option>';
59 61
 	
60 62
 	$nbsp = '&nbsp;';
@@ -95,7 +97,9 @@  discard block
 block discarded – undo
95 97
 	$TFreeText = getTFreeText();
96 98
 	$html = '<label for="free_text">'.$langs->trans('subtotalLabelForFreeText').'</label>';
97 99
 	$html.= '<select onChange="getTFreeText($(this));" name="free_text" class="minwidth200">';
98
-	if ($withEmpty) $html.= '<option value=""></option>';
100
+	if ($withEmpty) {
101
+		$html.= '<option value=""></option>';
102
+	}
99 103
 
100 104
 	$TFreeTextContents = array();
101 105
 	foreach ($TFreeText as $id => $tab)
@@ -134,8 +138,13 @@  discard block
 block discarded – undo
134 138
 	$level = GETPOST('subtotal_level', 'int');
135 139
 	if (!empty($level))
136 140
 	{
137
-		if ($line->qty > 90) $line->qty = 100 - $level; // Si on edit une ligne sous-total
138
-		else $line->qty = $level;
141
+		if ($line->qty > 90) {
142
+			$line->qty = 100 - $level;
143
+		}
144
+		// Si on edit une ligne sous-total
145
+		else {
146
+			$line->qty = $level;
147
+		}
139 148
 	}
140 149
 	
141 150
 	$res = TSubtotal::doUpdateLine($object, $line->id, $description, 0, $line->qty, 0, '', '', 0, 9, 0, 0, 'HT', $pagebreak, 0, 1, null, 0, $label, TSubtotal::$module_number, $line->array_options);
@@ -162,13 +171,18 @@  discard block
 block discarded – undo
162 171
 			{
163 172
 				$subtotal_tva_tx = $subtotal_tva_tx_init; // ré-init car la variable peut évoluer
164 173
 					
165
-				if (!empty($showBlockExtrafields)) $line->array_options = $array_options;
166
-				if ($subtotal_tva_tx == '') $subtotal_tva_tx = $line->tva_tx;
174
+				if (!empty($showBlockExtrafields)) {
175
+					$line->array_options = $array_options;
176
+				}
177
+				if ($subtotal_tva_tx == '') {
178
+					$subtotal_tva_tx = $line->tva_tx;
179
+				}
167 180
 				if ($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION)
168 181
 				{
169 182
 					$subtotal_progress = $subtotal_progress_init;
170
-					if ($subtotal_progress == '') $subtotal_progress = $line->situation_percent;
171
-					else
183
+					if ($subtotal_progress == '') {
184
+						$subtotal_progress = $line->situation_percent;
185
+					} else
172 186
 					{
173 187
 						$prev_percent = $line->get_prev_progress($object->id);
174 188
 						if ($subtotal_progress < $prev_percent)
@@ -181,14 +195,21 @@  discard block
 block discarded – undo
181 195
 				
182 196
 				$res = TSubtotal::doUpdateLine($object, $line->id, $line->desc, $line->subprice, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $subtotal_tva_tx, $line->product_type, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->fk_parent_line, $line->skip_update_total, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $subtotal_progress, $line->fk_unit);
183 197
 
184
-				if ($res > 0) $success_updated_line++;
185
-				else $error_updated_line++;
198
+				if ($res > 0) {
199
+					$success_updated_line++;
200
+				} else {
201
+					$error_updated_line++;
202
+				}
186 203
 			}
187 204
 		}
188 205
 
189
-		if ($nb_progress_not_updated > 0) setEventMessage($langs->trans('subtotal_nb_progress_not_updated', $nb_progress_not_updated), 'warnings');
206
+		if ($nb_progress_not_updated > 0) {
207
+			setEventMessage($langs->trans('subtotal_nb_progress_not_updated', $nb_progress_not_updated), 'warnings');
208
+		}
190 209
 		
191
-		if ($success_updated_line > 0) setEventMessage($langs->trans('subtotal_success_updated_line', $success_updated_line));
210
+		if ($success_updated_line > 0) {
211
+			setEventMessage($langs->trans('subtotal_success_updated_line', $success_updated_line));
212
+		}
192 213
 		if ($error_updated_line > 0)
193 214
 		{
194 215
 			setEventMessage($langs->trans('subtotal_error_updated_line', $error_updated_line), 'errors');
@@ -229,15 +250,16 @@  discard block
 block discarded – undo
229 250
 	global $db,$langs,$tmp_object_nc;
230 251
 	
231 252
 	$error = 0;
232
-	if (empty($element)) $error++;
253
+	if (empty($element)) {
254
+		$error++;
255
+	}
233 256
 	
234 257
 	if (!$error)
235 258
 	{
236 259
 		if (!empty($tmp_object_nc) && $tmp_object_nc->element == $element && $tmp_object_nc->id == $elementid)
237 260
 		{
238 261
 			$object = $tmp_object_nc;
239
-		}
240
-		else
262
+		} else
241 263
 		{
242 264
 			$classname = ucfirst($element);
243 265
 			
@@ -257,8 +279,11 @@  discard block
 block discarded – undo
257 279
 			
258 280
 			$object = new $classname($db); // Propal | Commande | Facture
259 281
 			$res = $object->fetch($elementid);
260
-			if ($res < 0) $error++;
261
-			else $tmp_object_nc = $object;
282
+			if ($res < 0) {
283
+				$error++;
284
+			} else {
285
+				$tmp_object_nc = $object;
286
+			}
262 287
 		}
263 288
 	}
264 289
 	
@@ -286,21 +311,21 @@  discard block
 block discarded – undo
286 311
 						$res = doUpdate($object, $line_block, $subtotal_nc);
287 312
 					}
288 313
 				}
289
-			}
290
-			else
314
+			} else
291 315
 			{
292 316
 				$res = doUpdate($object, $line, $subtotal_nc);
293 317
 			}
294 318
 			
295 319
 			$res = $object->update_price(1);
296
-			if ($res <= 0) $error++;
320
+			if ($res <= 0) {
321
+				$error++;
322
+			}
297 323
 			
298 324
 			if (!$error)
299 325
 			{
300 326
 				setEventMessage($langs->trans('subtotal_update_nc_success'));
301 327
 				$db->commit();
302
-			}
303
-			else
328
+			} else
304 329
 			{
305 330
 				setEventMessage($langs->trans('subtotal_update_nc_error'), 'errors');
306 331
 				$db->rollback();
@@ -313,7 +338,9 @@  discard block
 block discarded – undo
313 338
 {
314 339
 	global $user;
315 340
 	
316
-	if (TSubtotal::isFreeText($line) || TSubtotal::isSubtotal($line)) return 1;
341
+	if (TSubtotal::isFreeText($line) || TSubtotal::isSubtotal($line)) {
342
+		return 1;
343
+	}
317 344
 	// Update extrafield et total
318 345
 	if(! empty($subtotal_nc)) {
319 346
 		$line->total_ht = $line->total_tva = $line->total_ttc = $line->total_localtax1 = $line->total_localtax2 = 
@@ -321,12 +348,17 @@  discard block
 block discarded – undo
321 348
 
322 349
 		$line->array_options['options_subtotal_nc'] = 1;
323 350
 
324
-		if ($line->element == 'propaldet') $res = $line->update();
325
-		else $res = $line->update($user);
326
-	}
327
-	else {
351
+		if ($line->element == 'propaldet') {
352
+			$res = $line->update();
353
+		} else {
354
+			$res = $line->update($user);
355
+		}
356
+	} else {
328 357
 	    if(in_array($object->element, array('invoice_supplier', 'order_supplier', 'supplier_proposal'))) {
329
-	        if(empty($line->label)) $line->label = $line->description; // supplier lines don't have the field label
358
+	        if(empty($line->label)) {
359
+	        	$line->label = $line->description;
360
+	        }
361
+	        // supplier lines don't have the field label
330 362
 	        
331 363
 	        require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
332 364
 	        $extrafields=new ExtraFields($object->db);
@@ -334,7 +366,9 @@  discard block
 block discarded – undo
334 366
 	        $line->fetch_optionals($line->id,$extralabels);
335 367
 	    }
336 368
 		$line->array_options['options_subtotal_nc'] = 0;
337
-		if($object->element == 'order_supplier') $line->update($user);
369
+		if($object->element == 'order_supplier') {
370
+			$line->update($user);
371
+		}
338 372
 		$res = TSubtotal::doUpdateLine($object, $line->id, $line->desc, $line->subprice, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->product_type, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->fk_parent_line, $line->skip_update_total, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit);
339 373
 	}
340 374
 	
Please login to merge, or discard this patch.
class/actions_subtotal.class.php 3 patches
Indentation   +188 added lines, -188 removed lines patch added patch discarded remove patch
@@ -81,11 +81,11 @@  discard block
 block discarded – undo
81 81
 	 * @return     void
82 82
 	 */
83 83
     
84
-    var $module_number = 104777;
84
+	var $module_number = 104777;
85 85
     
86
-    function formObjectOptions($parameters, &$object, &$action, $hookmanager) 
87
-    {
88
-      	global $langs,$db,$user, $conf;
86
+	function formObjectOptions($parameters, &$object, &$action, $hookmanager) 
87
+	{
88
+	  	global $langs,$db,$user, $conf;
89 89
 		
90 90
 		$langs->load('subtotal@subtotal');
91 91
 		
@@ -100,10 +100,10 @@  discard block
 block discarded – undo
100 100
 				$createRight = $user->rights->facture->creer;
101 101
 			} elseif($object->element == 'order_supplier' )
102 102
 			{
103
-			    $createRight = $user->rights->fournisseur->commande->creer;
103
+				$createRight = $user->rights->fournisseur->commande->creer;
104 104
 			} elseif($object->element == 'invoice_supplier' )
105 105
 			{
106
-			    $createRight = $user->rights->fournisseur->facture->creer;
106
+				$createRight = $user->rights->fournisseur->facture->creer;
107 107
 			}
108 108
 			
109 109
 			if ($object->statut == 0  && $createRight) {
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 					
154 154
 					if (!empty($conf->global->SUBTOTAL_AUTO_ADD_SUBTOTAL_ON_ADDING_NEW_TITLE) && $qty < 10) TSubtotal::addSubtotalMissing($object, $qty);
155 155
 					
156
-	    			TSubtotal::addSubTotalLine($object, $title, $qty);
156
+					TSubtotal::addSubTotalLine($object, $title, $qty);
157 157
 				}
158 158
 				else if($action==='ask_deleteallline') {
159 159
 						$form=new Form($db);
@@ -375,36 +375,36 @@  discard block
 block discarded – undo
375 375
 		$TContext = explode(':',$parameters['context']);
376 376
 		if (
377 377
 				in_array('invoicecard',$TContext)
378
-		        || in_array('invoicesuppliercard',$TContext)
378
+				|| in_array('invoicesuppliercard',$TContext)
379 379
 				|| in_array('propalcard',$TContext)
380 380
 				|| in_array('ordercard',$TContext)
381
-		        || in_array('ordersuppliercard',$TContext)
381
+				|| in_array('ordersuppliercard',$TContext)
382 382
 				|| in_array('invoicereccard',$TContext)
383 383
 			)
384
-	        {	
384
+			{	
385 385
 				$hideInnerLines	= isset( $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']] ) ?  $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']] : 0;
386 386
 				$hidedetails	= isset( $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']] ) ?  $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']] : 0;
387 387
 				$hidepricesDefaultConf = !empty($conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED)?$conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED:0;
388 388
 				$hideprices= isset( $_SESSION['subtotal_hideprices_'.$parameters['modulepart']] ) ?  $_SESSION['subtotal_hideprices_'.$parameters['modulepart']] : $hidepricesDefaultConf;
389 389
 				
390 390
 				$var=false;
391
-		     	$out.= '<tr '.$bc[$var].'>
391
+			 	$out.= '<tr '.$bc[$var].'>
392 392
 		     			<td colspan="4" align="right">
393 393
 		     				<label for="hideInnerLines">'.$langs->trans('HideInnerLines').'</label>
394 394
 		     				<input type="checkbox" onclick="if($(this).is(\':checked\')) { $(\'#hidedetails\').prop(\'checked\', \'checked\')  }" id="hideInnerLines" name="hideInnerLines" value="1" '.(( $hideInnerLines ) ? 'checked="checked"' : '' ).' />
395 395
 		     			</td>
396 396
 		     			</tr>';
397 397
 				
398
-		     	$var=!$var;
399
-		     	$out.= '<tr '.$bc[$var].'>
398
+			 	$var=!$var;
399
+			 	$out.= '<tr '.$bc[$var].'>
400 400
 		     			<td colspan="4" align="right">
401 401
 		     				<label for="hidedetails">'.$langs->trans('SubTotalhidedetails').'</label>
402 402
 		     				<input type="checkbox" id="hidedetails" name="hidedetails" value="1" '.(( $hidedetails ) ? 'checked="checked"' : '' ).' />
403 403
 		     			</td>
404 404
 		     			</tr>';
405 405
 		     	
406
-		     	$var=!$var;
407
-		     	$out.= '<tr '.$bc[$var].'>
406
+			 	$var=!$var;
407
+			 	$out.= '<tr '.$bc[$var].'>
408 408
 		     			<td colspan="4" align="right">
409 409
 		     				<label for="hidedetails">'.$langs->trans('SubTotalhidePrice').'</label>
410 410
 		     				<input type="checkbox" id="hideprices" name="hideprices" value="1" '.(( $hideprices ) ? 'checked="checked"' : '' ).' />
@@ -416,9 +416,9 @@  discard block
 block discarded – undo
416 416
 				if ( 
417 417
 					(in_array('propalcard',$TContext) && !empty($conf->global->SUBTOTAL_PROPAL_ADD_RECAP))
418 418
 					|| (in_array('ordercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP))
419
-				    || (in_array('ordersuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP))
419
+					|| (in_array('ordersuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP))
420 420
 					|| (in_array('invoicecard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP))
421
-				    || (in_array('invoicesuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP))
421
+					|| (in_array('invoicesuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP))
422 422
 					|| (in_array('invoicereccard',$TContext)  && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP ))
423 423
 				)
424 424
 				{
@@ -437,19 +437,19 @@  discard block
 block discarded – undo
437 437
 			}
438 438
 			
439 439
 		
440
-        return 1;
440
+		return 1;
441 441
 	} 
442 442
 	 
443
-    function formEditProductOptions($parameters, &$object, &$action, $hookmanager) 
444
-    {
443
+	function formEditProductOptions($parameters, &$object, &$action, $hookmanager) 
444
+	{
445 445
 		
446
-    	if (in_array('invoicecard',explode(':',$parameters['context'])))
447
-        {
446
+		if (in_array('invoicecard',explode(':',$parameters['context'])))
447
+		{
448 448
         	
449
-        }
449
+		}
450 450
 		
451
-        return 0;
452
-    }
451
+		return 0;
452
+	}
453 453
 	
454 454
 	function ODTSubstitutionLine(&$parameters, &$object, $action, $hookmanager) {
455 455
 		global $conf;
@@ -498,11 +498,11 @@  discard block
 block discarded – undo
498 498
 	
499 499
 		if (
500 500
 				in_array('invoicecard',explode(':',$parameters['context']))
501
-		        || in_array('invoicesuppliercard',explode(':',$parameters['context']))
501
+				|| in_array('invoicesuppliercard',explode(':',$parameters['context']))
502 502
 				|| in_array('propalcard',explode(':',$parameters['context']))
503
-		        || in_array('supplier_proposalcard',explode(':',$parameters['context']))
503
+				|| in_array('supplier_proposalcard',explode(':',$parameters['context']))
504 504
 				|| in_array('ordercard',explode(':',$parameters['context']))
505
-		        || in_array('ordersuppliercard',explode(':',$parameters['context']))
505
+				|| in_array('ordersuppliercard',explode(':',$parameters['context']))
506 506
 				|| in_array('invoicereccard',explode(':',$parameters['context']))
507 507
 		) {
508 508
 			
@@ -581,20 +581,20 @@  discard block
 block discarded – undo
581 581
 				in_array('invoicecard',explode(':',$parameters['context']))
582 582
 				|| in_array('propalcard',explode(':',$parameters['context']))
583 583
 				|| in_array('ordercard',explode(':',$parameters['context']))
584
-			    || in_array('ordersuppliercard',explode(':',$parameters['context']))
585
-			    || in_array('invoicesuppliercard',explode(':',$parameters['context']))
586
-			    || in_array('supplier_proposalcard',explode(':',$parameters['context']))
584
+				|| in_array('ordersuppliercard',explode(':',$parameters['context']))
585
+				|| in_array('invoicesuppliercard',explode(':',$parameters['context']))
586
+				|| in_array('supplier_proposalcard',explode(':',$parameters['context']))
587 587
 			)
588
-	        {								
588
+			{								
589 589
 				if(in_array('invoicecard',explode(':',$parameters['context']))) {
590 590
 					$sessname = 'subtotal_hideInnerLines_facture';	
591 591
 					$sessname2 = 'subtotal_hidedetails_facture';
592 592
 					$sessname3 = 'subtotal_hideprices_facture';
593 593
 				}
594 594
 				elseif(in_array('invoicesuppliercard',explode(':',$parameters['context']))) {
595
-				    $sessname = 'subtotal_hideInnerLines_facture_fournisseur';
596
-				    $sessname2 = 'subtotal_hidedetails_facture_fournisseur';
597
-				    $sessname3 = 'subtotal_hideprices_facture_fournisseur';
595
+					$sessname = 'subtotal_hideInnerLines_facture_fournisseur';
596
+					$sessname2 = 'subtotal_hidedetails_facture_fournisseur';
597
+					$sessname3 = 'subtotal_hideprices_facture_fournisseur';
598 598
 				}
599 599
 				elseif(in_array('propalcard',explode(':',$parameters['context']))) {
600 600
 					$sessname = 'subtotal_hideInnerLines_propal';
@@ -602,9 +602,9 @@  discard block
 block discarded – undo
602 602
 					$sessname3 = 'subtotal_hideprices_propal';
603 603
 				}
604 604
 				elseif(in_array('supplier_proposalcard',explode(':',$parameters['context']))) {
605
-				    $sessname = 'subtotal_hideInnerLines_supplier_proposal';
606
-				    $sessname2 = 'subtotal_hidedetails_supplier_proposal';
607
-				    $sessname3 = 'subtotal_hideprices_supplier_proposal';
605
+					$sessname = 'subtotal_hideInnerLines_supplier_proposal';
606
+					$sessname2 = 'subtotal_hidedetails_supplier_proposal';
607
+					$sessname3 = 'subtotal_hideprices_supplier_proposal';
608 608
 				}
609 609
 				elseif(in_array('ordercard',explode(':',$parameters['context']))) {
610 610
 					$sessname = 'subtotal_hideInnerLines_commande';
@@ -612,9 +612,9 @@  discard block
 block discarded – undo
612 612
 					$sessname3 = 'subtotal_hideprices_commande';
613 613
 				}
614 614
 				elseif(in_array('ordersuppliercard',explode(':',$parameters['context']))) {
615
-				    $sessname = 'subtotal_hideInnerLines_commande_fournisseur';
616
-				    $sessname2 = 'subtotal_hidedetails_commande_fournisseur';
617
-				    $sessname3 = 'subtotal_hideprices_commande_fournisseur';
615
+					$sessname = 'subtotal_hideInnerLines_commande_fournisseur';
616
+					$sessname2 = 'subtotal_hidedetails_commande_fournisseur';
617
+					$sessname3 = 'subtotal_hideprices_commande_fournisseur';
618 618
 				}
619 619
 				else {
620 620
 					$sessname = 'subtotal_hideInnerLines_unknown';
@@ -636,17 +636,17 @@  discard block
 block discarded – undo
636 636
 				foreach($object->lines as &$line) {
637 637
 					if ($line->product_type == 9 && $line->special_code == $this->module_number) {
638 638
 					    
639
-                        if($line->qty>=90) {
640
-                            $line->modsubtotal_total = 1;
641
-                        }
642
-                        else{
643
-                            $line->modsubtotal_title = 1;
644
-                        }
639
+						if($line->qty>=90) {
640
+							$line->modsubtotal_total = 1;
641
+						}
642
+						else{
643
+							$line->modsubtotal_title = 1;
644
+						}
645 645
                         
646 646
 						$line->total_ht = $this->getTotalLineFromObject($object, $line, '');
647 647
 					}
648
-	        	}
649
-	        }
648
+				}
649
+			}
650 650
 			
651 651
 		}
652 652
 		else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') {
@@ -663,7 +663,7 @@  discard block
 block discarded – undo
663 663
 				 */
664 664
 				else if($object->element=='invoice_supplier')
665 665
 				{
666
-				    $object->deleteline($idLine);
666
+					$object->deleteline($idLine);
667 667
 				}
668 668
 				/**
669 669
 				 * @var $object Propal
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
 				 */
687 687
 				else if($object->element=='order_supplier')
688 688
 				{
689
-				    $object->deleteline($idLine);
689
+					$object->deleteline($idLine);
690 690
 				}
691 691
 				/**
692 692
 				 * @var $object Facturerec
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
 		
731 731
 		foreach($object->lines as $l) {
732 732
 		
733
-		    $lid = (!empty($l->rowid) ? $l->rowid : $l->id);
733
+			$lid = (!empty($l->rowid) ? $l->rowid : $l->id);
734 734
 			if($lid == $lineid) {
735 735
 
736 736
 				$found = true;
@@ -739,7 +739,7 @@  discard block
 block discarded – undo
739 739
 			
740 740
 			if($found) {
741 741
 				
742
-			    $Tab[] = (!empty($l->rowid) ? $l->rowid : $l->id);
742
+				$Tab[] = (!empty($l->rowid) ? $l->rowid : $l->id);
743 743
 				
744 744
 				if($l->special_code==$this->module_number && (($l->qty==99 && $qty_line==1) || ($l->qty==98 && $qty_line==2))   ) {
745 745
 					break; // end of story
@@ -818,17 +818,17 @@  discard block
 block discarded – undo
818 818
 			if($l->rang>=$rang) {
819 819
 				return price($total);
820 820
 			}
821
-                        if (TSubtotal::isSubtotal($l)){
822
-                            $total = 0;
823
-                        } else  if ($l->situation_percent > 0 ){
821
+						if (TSubtotal::isSubtotal($l)){
822
+							$total = 0;
823
+						} else  if ($l->situation_percent > 0 ){
824 824
                            
825 825
         	
826 826
 		 	$prev_progress = $l->get_prev_progress($object->id);
827 827
 		 	$progress = ($l->situation_percent - $prev_progress) /100;
828
-                        $total += ($l->total_ht/($l->situation_percent/100)) * $progress;
828
+						$total += ($l->total_ht/($l->situation_percent/100)) * $progress;
829 829
                         
830
-                    }
831
-                }
830
+					}
831
+				}
832 832
                 
833 833
 		return price($total);
834 834
 	}
@@ -860,7 +860,7 @@  discard block
 block discarded – undo
860 860
 		if(method_exists('Closure','bind')) {
861 861
 			$pageBreakOriginalValue = $pdf->AcceptPageBreak();
862 862
 			$sweetsThief = function ($pdf) {
863
-		    		return $pdf->bMargin ;
863
+					return $pdf->bMargin ;
864 864
 			};
865 865
 			$sweetsThief = Closure::bind($sweetsThief, null, $pdf);
866 866
 	
@@ -923,11 +923,11 @@  discard block
 block discarded – undo
923 923
 				else
924 924
 				{
925 925
 					list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1);
926
-                                        if(get_class($object) == 'Facture' && $object->type==Facture::TYPE_SITUATION){//Facture de situation
927
-                                                $total_to_print = $this->getTotalToPrintSituation($object, $line);
928
-                                        } else {
929
-                                            	$total_to_print = price($total);
930
-                                        }
926
+										if(get_class($object) == 'Facture' && $object->type==Facture::TYPE_SITUATION){//Facture de situation
927
+												$total_to_print = $this->getTotalToPrintSituation($object, $line);
928
+										} else {
929
+												$total_to_print = price($total);
930
+										}
931 931
                                             
932 932
 					$line->total_ht = $total;
933 933
 					$line->total = $total;
@@ -1078,7 +1078,7 @@  discard block
 block discarded – undo
1078 1078
 	}
1079 1079
 	
1080 1080
 	function pdf_getlinetotalexcltax($parameters=array(), &$object, &$action='') {
1081
-	    global $conf, $hideprices, $hookmanager;
1081
+		global $conf, $hideprices, $hookmanager;
1082 1082
 		
1083 1083
 		if(is_array($parameters)) $i = & $parameters['i'];
1084 1084
 		else $i = (int)$parameters;
@@ -1117,7 +1117,7 @@  discard block
 block discarded – undo
1117 1117
 			}
1118 1118
 		}
1119 1119
 		if ((int)GETPOST('hideInnerLines') && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)){
1120
-		    $this->resprints = price($object->lines[$i]->total_ht);
1120
+			$this->resprints = price($object->lines[$i]->total_ht);
1121 1121
 		}
1122 1122
 		
1123 1123
 		// Si la gestion C/NC est active et que je suis sur un ligne dont l'extrafield est coché
@@ -1460,11 +1460,11 @@  discard block
 block discarded – undo
1460 1460
 		$hidedetails = (int)GETPOST('hidedetails');
1461 1461
 		
1462 1462
 		if ($hideInnerLines) { // si c une ligne de titre
1463
-	    	$fk_parent_line=0;
1463
+			$fk_parent_line=0;
1464 1464
 			$TLines =array();
1465 1465
 		
1466 1466
 			$original_count=count($object->lines);
1467
-		    $TTvas = array(); // tableau de tva
1467
+			$TTvas = array(); // tableau de tva
1468 1468
 		    
1469 1469
 			foreach($object->lines as $k=>&$line) 
1470 1470
 			{
@@ -1494,48 +1494,48 @@  discard block
 block discarded – undo
1494 1494
 			
1495 1495
 				if ($hideInnerLines)
1496 1496
 				{
1497
-				    if(!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES))
1498
-				    {
1499
-				        if($line->tva_tx != '0.000' && $line->product_type!=9){
1497
+					if(!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES))
1498
+					{
1499
+						if($line->tva_tx != '0.000' && $line->product_type!=9){
1500 1500
 				            
1501
-    				        // on remplit le tableau de tva pour substituer les lignes cachées
1502
-    				        $TTvas[$line->tva_tx]['total_tva'] += $line->total_tva;
1503
-    				        $TTvas[$line->tva_tx]['total_ht'] += $line->total_ht;
1504
-    				        $TTvas[$line->tva_tx]['total_ttc'] += $line->total_ttc; 
1505
-    				    }
1506
-    					if($line->product_type==9 && $line->rowid>0)
1507
-    					{
1508
-    					    //Cas où je doit cacher les produits et afficher uniquement les sous-totaux avec les titres
1509
-    					    // génère des lignes d'affichage des montants HT soumis à tva
1510
-    					    $nbtva = count($TTvas);
1511
-    					    if(!empty($nbtva)){
1512
-    					        foreach ($TTvas as $tx =>$val){
1513
-    					            $l = clone $line;
1514
-    					            $l->product_type = 1;
1515
-    					            $l->special_code = '';
1516
-    					            $l->qty = 1;
1517
-    					            $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx));
1518
-    					            $l->tva_tx = $tx;
1519
-    					            $l->total_ht = $val['total_ht'];
1520
-    					            $l->total_tva = $val['total_tva'];
1521
-    					            $l->total = $line->total_ht;
1522
-    					            $l->total_ttc = $val['total_ttc'];
1523
-    					            $TLines[] = $l;
1524
-    					            array_shift($TTvas);
1525
-    					       }
1526
-    					    }
1501
+							// on remplit le tableau de tva pour substituer les lignes cachées
1502
+							$TTvas[$line->tva_tx]['total_tva'] += $line->total_tva;
1503
+							$TTvas[$line->tva_tx]['total_ht'] += $line->total_ht;
1504
+							$TTvas[$line->tva_tx]['total_ttc'] += $line->total_ttc; 
1505
+						}
1506
+						if($line->product_type==9 && $line->rowid>0)
1507
+						{
1508
+							//Cas où je doit cacher les produits et afficher uniquement les sous-totaux avec les titres
1509
+							// génère des lignes d'affichage des montants HT soumis à tva
1510
+							$nbtva = count($TTvas);
1511
+							if(!empty($nbtva)){
1512
+								foreach ($TTvas as $tx =>$val){
1513
+									$l = clone $line;
1514
+									$l->product_type = 1;
1515
+									$l->special_code = '';
1516
+									$l->qty = 1;
1517
+									$l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx));
1518
+									$l->tva_tx = $tx;
1519
+									$l->total_ht = $val['total_ht'];
1520
+									$l->total_tva = $val['total_tva'];
1521
+									$l->total = $line->total_ht;
1522
+									$l->total_ttc = $val['total_ttc'];
1523
+									$TLines[] = $l;
1524
+									array_shift($TTvas);
1525
+							   }
1526
+							}
1527 1527
     					    
1528
-    					    // ajoute la ligne de sous-total
1529
-    					    $TLines[] = $line; 
1530
-    					}
1531
-				    } else {
1528
+							// ajoute la ligne de sous-total
1529
+							$TLines[] = $line; 
1530
+						}
1531
+					} else {
1532 1532
 				        
1533
-				        if($line->product_type==9 && $line->rowid>0)
1534
-				        {
1535
-				            // ajoute la ligne de sous-total
1536
-				            $TLines[] = $line; 
1537
-				        }
1538
-				    }
1533
+						if($line->product_type==9 && $line->rowid>0)
1534
+						{
1535
+							// ajoute la ligne de sous-total
1536
+							$TLines[] = $line; 
1537
+						}
1538
+					}
1539 1539
 				    
1540 1540
 					
1541 1541
 				}
@@ -1560,20 +1560,20 @@  discard block
 block discarded – undo
1560 1560
 			$nbtva = count($TTvas);
1561 1561
 			if(!empty($nbtva) && $hideInnerLines && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES))
1562 1562
 			{
1563
-			    foreach ($TTvas as $tx =>$val){
1564
-			        $l = clone $line;
1565
-			        $l->product_type = 1;
1566
-			        $l->special_code = '';
1567
-			        $l->qty = 1;
1568
-			        $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx));
1569
-			        $l->tva_tx = $tx;
1570
-			        $l->total_ht = $val['total_ht'];
1571
-			        $l->total_tva = $val['total_tva'];
1572
-			        $l->total = $line->total_ht;
1573
-			        $l->total_ttc = $val['total_ttc'];
1574
-			        $TLines[] = $l;
1575
-			        array_shift($TTvas);
1576
-			    }
1563
+				foreach ($TTvas as $tx =>$val){
1564
+					$l = clone $line;
1565
+					$l->product_type = 1;
1566
+					$l->special_code = '';
1567
+					$l->qty = 1;
1568
+					$l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx));
1569
+					$l->tva_tx = $tx;
1570
+					$l->total_ht = $val['total_ht'];
1571
+					$l->total_tva = $val['total_tva'];
1572
+					$l->total = $line->total_ht;
1573
+					$l->total_ttc = $val['total_ttc'];
1574
+					$TLines[] = $l;
1575
+					array_shift($TTvas);
1576
+				}
1577 1577
 			}
1578 1578
 			
1579 1579
 			global $nblignes;
@@ -1585,7 +1585,7 @@  discard block
 block discarded – undo
1585 1585
 				$this->resprints = '';
1586 1586
 				return 0;
1587 1587
 			}
1588
-	    }
1588
+		}
1589 1589
 		
1590 1590
 		return 0;
1591 1591
 	}
@@ -1748,18 +1748,18 @@  discard block
 block discarded – undo
1748 1748
 		}
1749 1749
 		elseif($object->element == 'order_supplier' )
1750 1750
 		{
1751
-		    $createRight = $user->rights->fournisseur->commande->creer;
1751
+			$createRight = $user->rights->fournisseur->commande->creer;
1752 1752
 		}
1753 1753
 		elseif($object->element == 'invoice_supplier' )
1754 1754
 		{
1755
-		    $createRight = $user->rights->fournisseur->facture->creer;
1755
+			$createRight = $user->rights->fournisseur->facture->creer;
1756 1756
 		}
1757 1757
 		
1758 1758
 		if($line->special_code!=$this->module_number || $line->product_type!=9) {
1759 1759
 			null;
1760 1760
 		}	
1761 1761
 		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)) 
1762
-        {
1762
+		{
1763 1763
 			if($object->element=='facture')$idvar = 'facid';
1764 1764
 			else $idvar='id';
1765 1765
 			
@@ -1806,7 +1806,7 @@  discard block
 block discarded – undo
1806 1806
 			//var_dump($line);
1807 1807
             
1808 1808
 			// HTML 5 data for js
1809
-            $data = $this->_getHtmlData($parameters, $object, $action, $hookmanager);
1809
+			$data = $this->_getHtmlData($parameters, $object, $action, $hookmanager);
1810 1810
             
1811 1811
 			
1812 1812
 			?>
@@ -1864,8 +1864,8 @@  discard block
 block discarded – undo
1864 1864
 						}
1865 1865
 						
1866 1866
 						if ($object->element == 'order_supplier' || $object->element == 'invoice_supplier') {
1867
-						    $line->label = !empty($line->description) ? $line->description : $line->desc;
1868
-						    $line->description = '';
1867
+							$line->label = !empty($line->description) ? $line->description : $line->desc;
1868
+							$line->description = '';
1869 1869
 						}
1870 1870
 						$newlabel = $line->label;
1871 1871
 						if($line->label=='' && !$isFreeText) {
@@ -2156,17 +2156,17 @@  discard block
 block discarded – undo
2156 2156
 		if ($object->statut == 0 && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && $action != 'editline')
2157 2157
 		{
2158 2158
 		    
2159
-		    if($object->element == 'invoice_supplier' || $object->element == 'order_supplier')
2160
-		    {
2161
-		        foreach ($object->lines as $line)
2162
-		        {
2163
-		            // fetch optionals attributes and labels
2164
-		            require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
2165
-		            $extrafields=new ExtraFields($this->db);
2166
-		            $extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true);
2167
-		            $line->fetch_optionals($line->id,$extralabels);
2168
-		        }
2169
-		    }
2159
+			if($object->element == 'invoice_supplier' || $object->element == 'order_supplier')
2160
+			{
2161
+				foreach ($object->lines as $line)
2162
+				{
2163
+					// fetch optionals attributes and labels
2164
+					require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
2165
+					$extrafields=new ExtraFields($this->db);
2166
+					$extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true);
2167
+					$line->fetch_optionals($line->id,$extralabels);
2168
+				}
2169
+			}
2170 2170
 		    
2171 2171
 			$TSubNc = array();
2172 2172
 			foreach ($object->lines as &$l)
@@ -2257,80 +2257,80 @@  discard block
 block discarded – undo
2257 2257
 	{
2258 2258
 		dol_include_once('/subtotal/class/subtotal.class.php');
2259 2259
 
2260
-	    $line = &$parameters['line'];
2260
+		$line = &$parameters['line'];
2261 2261
 	    
2262
-	    $ThtmlData['data-id']           = $line->id;
2263
-	    $ThtmlData['data-product_type'] = $line->product_type;
2264
-	    $ThtmlData['data-qty']          = 0; //$line->qty;
2265
-	    $ThtmlData['data-level']        = TSubtotal::getNiveau($line);
2262
+		$ThtmlData['data-id']           = $line->id;
2263
+		$ThtmlData['data-product_type'] = $line->product_type;
2264
+		$ThtmlData['data-qty']          = 0; //$line->qty;
2265
+		$ThtmlData['data-level']        = TSubtotal::getNiveau($line);
2266 2266
 	    
2267
-	    if(TSubtotal::isTitle($line)){
2268
-	        $ThtmlData['data-issubtotal'] = 'title';
2269
-	    }elseif(TSubtotal::isSubtotal($line)){
2270
-	        $ThtmlData['data-issubtotal'] = 'subtotal';
2271
-	    }
2272
-	    else{
2273
-	        $ThtmlData['data-issubtotal'] = 'freetext';
2274
-	    }
2267
+		if(TSubtotal::isTitle($line)){
2268
+			$ThtmlData['data-issubtotal'] = 'title';
2269
+		}elseif(TSubtotal::isSubtotal($line)){
2270
+			$ThtmlData['data-issubtotal'] = 'subtotal';
2271
+		}
2272
+		else{
2273
+			$ThtmlData['data-issubtotal'] = 'freetext';
2274
+		}
2275 2275
 	    
2276 2276
 	    
2277
-	    // Change or add data  from hooks
2278
-	    $parameters = array_replace($parameters , array(  'ThtmlData' => $ThtmlData )  );
2277
+		// Change or add data  from hooks
2278
+		$parameters = array_replace($parameters , array(  'ThtmlData' => $ThtmlData )  );
2279 2279
 	    
2280
-	    // hook 
2281
-	    $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
2282
-	    if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
2283
-	    if ($reshook>0)
2284
-	    {
2285
-	        $ThtmlData = $hookmanager->resArray;
2286
-	    }
2287
-
2288
-	    return $this->implodeHtmlData($ThtmlData);
2280
+		// hook 
2281
+		$reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
2282
+		if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
2283
+		if ($reshook>0)
2284
+		{
2285
+			$ThtmlData = $hookmanager->resArray;
2286
+		}
2287
+
2288
+		return $this->implodeHtmlData($ThtmlData);
2289 2289
 	
2290 2290
 	}
2291 2291
 	
2292 2292
 	
2293 2293
 	function implodeHtmlData($ThtmlData = array())
2294 2294
 	{
2295
-	    $data = '';
2296
-	    foreach($ThtmlData as $k => $h )
2297
-	    {
2298
-	        if(is_array($h))
2299
-	        {
2300
-	            $h = json_encode($h);
2301
-	        }
2295
+		$data = '';
2296
+		foreach($ThtmlData as $k => $h )
2297
+		{
2298
+			if(is_array($h))
2299
+			{
2300
+				$h = json_encode($h);
2301
+			}
2302 2302
 	        
2303
-	        $data .= $k . '="'.dol_htmlentities($h, ENT_QUOTES).'" ';
2304
-	    }
2303
+			$data .= $k . '="'.dol_htmlentities($h, ENT_QUOTES).'" ';
2304
+		}
2305 2305
 	    
2306
-	    return $data;
2306
+		return $data;
2307 2307
 	}
2308 2308
 	
2309 2309
 	function _ajax_block_order_js($object)
2310 2310
 	{
2311
-	    global $conf,$tagidfortablednd,$filepath,$langs;
2311
+		global $conf,$tagidfortablednd,$filepath,$langs;
2312 2312
 	    
2313
-	    /*
2313
+		/*
2314 2314
 	     * this part of js is base on dolibarr htdocs/core/tpl/ajaxrow.tpl.php 
2315 2315
 	     * for compatibility reasons we don't use tableDnD but jquery sortable
2316 2316
 	     */
2317 2317
 	    
2318
-	    $id=$object->id;
2319
-	    $nboflines=(isset($object->lines)?count($object->lines):0);
2320
-	    $forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1;
2318
+		$id=$object->id;
2319
+		$nboflines=(isset($object->lines)?count($object->lines):0);
2320
+		$forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1;
2321 2321
 	    
2322
-	    $id=$object->id;
2323
-	    $fk_element=$object->fk_element;
2324
-	    $table_element_line=$object->table_element_line;
2325
-	    $nboflines=(isset($object->lines)?count($object->lines):(empty($nboflines)?0:$nboflines));
2326
-	    $tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd);
2327
-	    $filepath=(empty($filepath)?'':$filepath);
2322
+		$id=$object->id;
2323
+		$fk_element=$object->fk_element;
2324
+		$table_element_line=$object->table_element_line;
2325
+		$nboflines=(isset($object->lines)?count($object->lines):(empty($nboflines)?0:$nboflines));
2326
+		$tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd);
2327
+		$filepath=(empty($filepath)?'':$filepath);
2328 2328
 	    
2329 2329
 	    
2330
-	    if (GETPOST('action','aZ09') != 'editline' && $nboflines > 1)
2331
-	    {
2330
+		if (GETPOST('action','aZ09') != 'editline' && $nboflines > 1)
2331
+		{
2332 2332
 	        
2333
-	        ?>
2333
+			?>
2334 2334
 		
2335 2335
 		
2336 2336
 			<script type="text/javascript">
Please login to merge, or discard this patch.
Spacing   +381 added lines, -381 removed lines patch added patch discarded remove patch
@@ -85,43 +85,43 @@  discard block
 block discarded – undo
85 85
     
86 86
     function formObjectOptions($parameters, &$object, &$action, $hookmanager) 
87 87
     {
88
-      	global $langs,$db,$user, $conf;
88
+      	global $langs, $db, $user, $conf;
89 89
 		
90 90
 		$langs->load('subtotal@subtotal');
91 91
 		
92
-		$contexts = explode(':',$parameters['context']);
92
+		$contexts = explode(':', $parameters['context']);
93 93
 		
94
-		if(in_array('ordercard',$contexts) || in_array('ordersuppliercard',$contexts) || in_array('propalcard',$contexts) || in_array('supplier_proposalcard',$contexts) || in_array('invoicecard',$contexts) || in_array('invoicesuppliercard',$contexts) || in_array('invoicereccard',$contexts)) {
94
+		if (in_array('ordercard', $contexts) || in_array('ordersuppliercard', $contexts) || in_array('propalcard', $contexts) || in_array('supplier_proposalcard', $contexts) || in_array('invoicecard', $contexts) || in_array('invoicesuppliercard', $contexts) || in_array('invoicereccard', $contexts)) {
95 95
 			
96 96
 			$createRight = $user->rights->{$object->element}->creer;
97
-			if($object->element == 'facturerec' )
97
+			if ($object->element == 'facturerec')
98 98
 			{
99 99
 				$object->statut = 0; // hack for facture rec
100 100
 				$createRight = $user->rights->facture->creer;
101
-			} elseif($object->element == 'order_supplier' )
101
+			} elseif ($object->element == 'order_supplier')
102 102
 			{
103 103
 			    $createRight = $user->rights->fournisseur->commande->creer;
104
-			} elseif($object->element == 'invoice_supplier' )
104
+			} elseif ($object->element == 'invoice_supplier')
105 105
 			{
106 106
 			    $createRight = $user->rights->fournisseur->facture->creer;
107 107
 			}
108 108
 			
109
-			if ($object->statut == 0  && $createRight) {
109
+			if ($object->statut == 0 && $createRight) {
110 110
 			
111 111
 
112
-				if($object->element=='facture')$idvar = 'facid';
113
-				else $idvar='id';
112
+				if ($object->element == 'facture')$idvar = 'facid';
113
+				else $idvar = 'id';
114 114
 				
115
-				if(in_array($action, array('add_title_line', 'add_total_line', 'add_subtitle_line', 'add_subtotal_line', 'add_free_text')) )
115
+				if (in_array($action, array('add_title_line', 'add_total_line', 'add_subtitle_line', 'add_subtotal_line', 'add_free_text')))
116 116
 				{
117 117
 					$level = GETPOST('level', 'int'); //New avec SUBTOTAL_USE_NEW_FORMAT
118 118
 					
119
-					if($action=='add_title_line') {
119
+					if ($action == 'add_title_line') {
120 120
 						$title = GETPOST('title');
121
-						if(empty($title)) $title = $langs->trans('title');
122
-						$qty = $level<1 ? 1 : $level ;
121
+						if (empty($title)) $title = $langs->trans('title');
122
+						$qty = $level < 1 ? 1 : $level;
123 123
 					}
124
-					else if($action=='add_free_text') {
124
+					else if ($action == 'add_free_text') {
125 125
 						$title = GETPOST('title');
126 126
 
127 127
 						if (empty($title)) {
@@ -133,21 +133,21 @@  discard block
 block discarded – undo
133 133
 								}
134 134
 							}
135 135
 						}
136
-						if(empty($title)) $title = $langs->trans('subtotalAddLineDescription');
136
+						if (empty($title)) $title = $langs->trans('subtotalAddLineDescription');
137 137
 						$qty = 50;
138 138
 					}
139
-					else if($action=='add_subtitle_line') {
139
+					else if ($action == 'add_subtitle_line') {
140 140
 						$title = GETPOST('title');
141
-						if(empty($title)) $title = $langs->trans('subtitle');
141
+						if (empty($title)) $title = $langs->trans('subtitle');
142 142
 						$qty = 2;
143 143
 					}
144
-					else if($action=='add_subtotal_line') {
144
+					else if ($action == 'add_subtotal_line') {
145 145
 						$title = $langs->trans('SubSubTotal');
146 146
 						$qty = 98;
147 147
 					}
148 148
 					else {
149 149
 						$title = GETPOST('title') ? GETPOST('title') : $langs->trans('SubTotal');
150
-						$qty = $level ? 100-$level : 99;
150
+						$qty = $level ? 100 - $level : 99;
151 151
 					}
152 152
 					dol_include_once('/subtotal/class/subtotal.class.php');
153 153
 					
@@ -155,15 +155,15 @@  discard block
 block discarded – undo
155 155
 					
156 156
 	    			TSubtotal::addSubTotalLine($object, $title, $qty);
157 157
 				}
158
-				else if($action==='ask_deleteallline') {
159
-						$form=new Form($db);
158
+				else if ($action === 'ask_deleteallline') {
159
+						$form = new Form($db);
160 160
 						
161
-						$lineid = GETPOST('lineid','integer');
161
+						$lineid = GETPOST('lineid', 'integer');
162 162
 						$TIdForGroup = $this->getArrayOfLineForAGroup($object, $lineid);
163 163
 					
164 164
 						$nbLines = count($TIdForGroup);
165 165
 					
166
-						$formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('deleteWithAllLines'), $langs->trans('ConfirmDeleteAllThisLines',$nbLines), 'confirm_delete_all_lines','',0,1);
166
+						$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('deleteWithAllLines'), $langs->trans('ConfirmDeleteAllThisLines', $nbLines), 'confirm_delete_all_lines', '', 0, 1);
167 167
 						print $formconfirm;
168 168
 				}
169 169
 
@@ -173,13 +173,13 @@  discard block
 block discarded – undo
173 173
 				}
174 174
 
175 175
 				
176
-				if($action!='editline') {
176
+				if ($action != 'editline') {
177 177
 					// New format is for 3.8
178 178
 					$this->printNewFormat($object, $conf, $langs, $idvar);
179 179
 				}
180 180
 			}
181 181
 		}
182
-		elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice',$contexts))
182
+		elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice', $contexts))
183 183
 		{
184 184
 			?>
185 185
 			<script type="text/javascript">
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 				$(document).ready(function() {
205 205
 					$('div.fiche div.tabsAction').append('<br />');
206 206
 					
207
-					$('div.fiche div.tabsAction').append('<div class="inline-block divButAction"><a id="add_title_line" rel="add_title_line" href="javascript:;" class="butAction"><?php echo  $langs->trans('AddTitle' )?></a></div>');
207
+					$('div.fiche div.tabsAction').append('<div class="inline-block divButAction"><a id="add_title_line" rel="add_title_line" href="javascript:;" class="butAction"><?php echo  $langs->trans('AddTitle')?></a></div>');
208 208
 					$('div.fiche div.tabsAction').append('<div class="inline-block divButAction"><a id="add_total_line" rel="add_total_line" href="javascript:;" class="butAction"><?php echo  $langs->trans('AddSubTotal')?></a></div>');
209 209
 					$('div.fiche div.tabsAction').append('<div class="inline-block divButAction"><a id="add_free_text" rel="add_free_text" href="javascript:;" class="butAction"><?php echo  $langs->trans('AddFreeText')?></a></div>');
210 210
 
@@ -255,9 +255,9 @@  discard block
 block discarded – undo
255 255
 						$('body').append(dialog_html);
256 256
 
257 257
 						<?php 
258
-						$editorTool = empty($conf->global->FCKEDITOR_EDITORNAME)?'ckeditor':$conf->global->FCKEDITOR_EDITORNAME;
259
-						$editorConf = empty($conf->global->FCKEDITOR_ENABLE_DETAILS)?false:$conf->global->FCKEDITOR_ENABLE_DETAILS;
260
-						if($editorConf && in_array($editorTool,array('textarea','ckeditor'))){ 
258
+						$editorTool = empty($conf->global->FCKEDITOR_EDITORNAME) ? 'ckeditor' : $conf->global->FCKEDITOR_EDITORNAME;
259
+						$editorConf = empty($conf->global->FCKEDITOR_ENABLE_DETAILS) ?false:$conf->global->FCKEDITOR_ENABLE_DETAILS;
260
+						if ($editorConf && in_array($editorTool, array('textarea', 'ckeditor'))) { 
261 261
 						?>
262 262
 						if (action == 'addTitle' || action == 'addFreeTxt')
263 263
 						{
@@ -372,62 +372,62 @@  discard block
 block discarded – undo
372 372
 		global $conf, $langs, $bc;
373 373
 			
374 374
 		$action = GETPOST('action');	
375
-		$TContext = explode(':',$parameters['context']);
375
+		$TContext = explode(':', $parameters['context']);
376 376
 		if (
377
-				in_array('invoicecard',$TContext)
378
-		        || in_array('invoicesuppliercard',$TContext)
379
-				|| in_array('propalcard',$TContext)
380
-				|| in_array('ordercard',$TContext)
381
-		        || in_array('ordersuppliercard',$TContext)
382
-				|| in_array('invoicereccard',$TContext)
377
+				in_array('invoicecard', $TContext)
378
+		        || in_array('invoicesuppliercard', $TContext)
379
+				|| in_array('propalcard', $TContext)
380
+				|| in_array('ordercard', $TContext)
381
+		        || in_array('ordersuppliercard', $TContext)
382
+				|| in_array('invoicereccard', $TContext)
383 383
 			)
384 384
 	        {	
385
-				$hideInnerLines	= isset( $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']] ) ?  $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']] : 0;
386
-				$hidedetails	= isset( $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']] ) ?  $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']] : 0;
387
-				$hidepricesDefaultConf = !empty($conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED)?$conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED:0;
388
-				$hideprices= isset( $_SESSION['subtotal_hideprices_'.$parameters['modulepart']] ) ?  $_SESSION['subtotal_hideprices_'.$parameters['modulepart']] : $hidepricesDefaultConf;
385
+				$hideInnerLines = isset($_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']]) ? $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']] : 0;
386
+				$hidedetails = isset($_SESSION['subtotal_hidedetails_'.$parameters['modulepart']]) ? $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']] : 0;
387
+				$hidepricesDefaultConf = !empty($conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED) ? $conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED : 0;
388
+				$hideprices = isset($_SESSION['subtotal_hideprices_'.$parameters['modulepart']]) ? $_SESSION['subtotal_hideprices_'.$parameters['modulepart']] : $hidepricesDefaultConf;
389 389
 				
390
-				$var=false;
391
-		     	$out.= '<tr '.$bc[$var].'>
390
+				$var = false;
391
+		     	$out .= '<tr '.$bc[$var].'>
392 392
 		     			<td colspan="4" align="right">
393 393
 		     				<label for="hideInnerLines">'.$langs->trans('HideInnerLines').'</label>
394
-		     				<input type="checkbox" onclick="if($(this).is(\':checked\')) { $(\'#hidedetails\').prop(\'checked\', \'checked\')  }" id="hideInnerLines" name="hideInnerLines" value="1" '.(( $hideInnerLines ) ? 'checked="checked"' : '' ).' />
394
+		     				<input type="checkbox" onclick="if($(this).is(\':checked\')) { $(\'#hidedetails\').prop(\'checked\', \'checked\')  }" id="hideInnerLines" name="hideInnerLines" value="1" '.(($hideInnerLines) ? 'checked="checked"' : '').' />
395 395
 		     			</td>
396 396
 		     			</tr>';
397 397
 				
398
-		     	$var=!$var;
399
-		     	$out.= '<tr '.$bc[$var].'>
398
+		     	$var = !$var;
399
+		     	$out .= '<tr '.$bc[$var].'>
400 400
 		     			<td colspan="4" align="right">
401 401
 		     				<label for="hidedetails">'.$langs->trans('SubTotalhidedetails').'</label>
402
-		     				<input type="checkbox" id="hidedetails" name="hidedetails" value="1" '.(( $hidedetails ) ? 'checked="checked"' : '' ).' />
402
+		     				<input type="checkbox" id="hidedetails" name="hidedetails" value="1" '.(($hidedetails) ? 'checked="checked"' : '').' />
403 403
 		     			</td>
404 404
 		     			</tr>';
405 405
 		     	
406
-		     	$var=!$var;
407
-		     	$out.= '<tr '.$bc[$var].'>
406
+		     	$var = !$var;
407
+		     	$out .= '<tr '.$bc[$var].'>
408 408
 		     			<td colspan="4" align="right">
409 409
 		     				<label for="hidedetails">'.$langs->trans('SubTotalhidePrice').'</label>
410
-		     				<input type="checkbox" id="hideprices" name="hideprices" value="1" '.(( $hideprices ) ? 'checked="checked"' : '' ).' />
410
+		     				<input type="checkbox" id="hideprices" name="hideprices" value="1" '.(($hideprices) ? 'checked="checked"' : '').' />
411 411
 		     			</td>
412 412
 		     			</tr>';
413 413
 		     	
414 414
 		     	
415 415
 				 
416 416
 				if ( 
417
-					(in_array('propalcard',$TContext) && !empty($conf->global->SUBTOTAL_PROPAL_ADD_RECAP))
418
-					|| (in_array('ordercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP))
419
-				    || (in_array('ordersuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP))
420
-					|| (in_array('invoicecard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP))
421
-				    || (in_array('invoicesuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP))
422
-					|| (in_array('invoicereccard',$TContext)  && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP ))
417
+					(in_array('propalcard', $TContext) && !empty($conf->global->SUBTOTAL_PROPAL_ADD_RECAP))
418
+					|| (in_array('ordercard', $TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP))
419
+				    || (in_array('ordersuppliercard', $TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP))
420
+					|| (in_array('invoicecard', $TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP))
421
+				    || (in_array('invoicesuppliercard', $TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP))
422
+					|| (in_array('invoicereccard', $TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP))
423 423
 				)
424 424
 				{
425
-					$var=!$var;
426
-					$out.= '
425
+					$var = !$var;
426
+					$out .= '
427 427
 						<tr '.$bc[$var].'>
428 428
 							<td colspan="4" align="right">
429 429
 								<label for="subtotal_add_recap">'.$langs->trans('subtotal_add_recap').'</label>
430
-								<input type="checkbox" id="subtotal_add_recap" name="subtotal_add_recap" value="1" '.( GETPOST('subtotal_add_recap') ? 'checked="checked"' : '' ).' />
430
+								<input type="checkbox" id="subtotal_add_recap" name="subtotal_add_recap" value="1" '.(GETPOST('subtotal_add_recap') ? 'checked="checked"' : '').' />
431 431
 							</td>
432 432
 						</tr>';
433 433
 				}
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
     function formEditProductOptions($parameters, &$object, &$action, $hookmanager) 
444 444
     {
445 445
 		
446
-    	if (in_array('invoicecard',explode(':',$parameters['context'])))
446
+    	if (in_array('invoicecard', explode(':', $parameters['context'])))
447 447
         {
448 448
         	
449 449
         }
@@ -454,13 +454,13 @@  discard block
 block discarded – undo
454 454
 	function ODTSubstitutionLine(&$parameters, &$object, $action, $hookmanager) {
455 455
 		global $conf;
456 456
 		
457
-		if($action === 'builddoc') {
457
+		if ($action === 'builddoc') {
458 458
 			
459 459
 			$line = &$parameters['line'];
460 460
 			$object = &$parameters['object'];
461 461
 			$substitutionarray = &$parameters['substitutionarray'];
462 462
 			
463
-			if($line->product_type == 9 && $line->special_code == $this->module_number) {
463
+			if ($line->product_type == 9 && $line->special_code == $this->module_number) {
464 464
 				$substitutionarray['line_modsubtotal'] = 1;	
465 465
 				
466 466
 				$substitutionarray['line_price_ht']
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
 					 = $substitutionarray['line_up'] 
472 472
 					 = '';
473 473
 				
474
-				if($line->qty>90) {
474
+				if ($line->qty > 90) {
475 475
 					$substitutionarray['line_modsubtotal_total'] = true;
476 476
 					
477 477
 					list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1);
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
 				
486 486
 				
487 487
 			}	
488
-			else{
488
+			else {
489 489
 				$substitutionarray['line_not_modsubtotal'] = true;
490 490
 				$substitutionarray['line_modsubtotal'] = 0;
491 491
 			}
@@ -497,29 +497,29 @@  discard block
 block discarded – undo
497 497
 	function createFrom($parameters, &$object, $action, $hookmanager) {
498 498
 	
499 499
 		if (
500
-				in_array('invoicecard',explode(':',$parameters['context']))
501
-		        || in_array('invoicesuppliercard',explode(':',$parameters['context']))
502
-				|| in_array('propalcard',explode(':',$parameters['context']))
503
-		        || in_array('supplier_proposalcard',explode(':',$parameters['context']))
504
-				|| in_array('ordercard',explode(':',$parameters['context']))
505
-		        || in_array('ordersuppliercard',explode(':',$parameters['context']))
506
-				|| in_array('invoicereccard',explode(':',$parameters['context']))
500
+				in_array('invoicecard', explode(':', $parameters['context']))
501
+		        || in_array('invoicesuppliercard', explode(':', $parameters['context']))
502
+				|| in_array('propalcard', explode(':', $parameters['context']))
503
+		        || in_array('supplier_proposalcard', explode(':', $parameters['context']))
504
+				|| in_array('ordercard', explode(':', $parameters['context']))
505
+		        || in_array('ordersuppliercard', explode(':', $parameters['context']))
506
+				|| in_array('invoicereccard', explode(':', $parameters['context']))
507 507
 		) {
508 508
 			
509 509
 			global $db;
510 510
 			
511 511
 			$objFrom = $parameters['objFrom'];
512 512
 			
513
-			foreach($objFrom->lines as $k=> &$lineOld) {
513
+			foreach ($objFrom->lines as $k=> &$lineOld) {
514 514
 				
515
-					if($lineOld->product_type == 9 && $lineOld->info_bits > 0 ) {
515
+					if ($lineOld->product_type == 9 && $lineOld->info_bits > 0) {
516 516
 							
517 517
 							$line = & $object->lines[$k];
518 518
 				
519 519
 							$idLine = (int) ($line->id ? $line->id : $line->rowid); 
520 520
 				
521 521
 							$db->query("UPDATE ".MAIN_DB_PREFIX.$line->table_element."
522
-							SET info_bits=".(int)$lineOld->info_bits."
522
+							SET info_bits=".(int) $lineOld->info_bits."
523 523
 							WHERE rowid = ".$idLine."
524 524
 							");
525 525
 						
@@ -535,15 +535,15 @@  discard block
 block discarded – undo
535 535
 	
536 536
 	function doActions($parameters, &$object, $action, $hookmanager)
537 537
 	{
538
-		global $db, $conf, $langs,$user;
538
+		global $db, $conf, $langs, $user;
539 539
 		
540 540
 		dol_include_once('/subtotal/class/subtotal.class.php');
541 541
 		dol_include_once('/subtotal/lib/subtotal.lib.php');
542
-		require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
542
+		require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
543 543
 		
544 544
 		$showBlockExtrafields = GETPOST('showBlockExtrafields');
545 545
 		
546
-		if($object->element=='facture') $idvar = 'facid';
546
+		if ($object->element == 'facture') $idvar = 'facid';
547 547
 		else $idvar = 'id';
548 548
 			
549 549
 		if ($action == 'updateligne' || $action == 'updateline')
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
 				if ($line->id == $lineid && TSubtotal::isModSubtotalLine($line))
557 557
 				{
558 558
 					$found = true;
559
-					if(TSubtotal::isTitle($line) && !empty($showBlockExtrafields)) {
559
+					if (TSubtotal::isTitle($line) && !empty($showBlockExtrafields)) {
560 560
 						$extrafieldsline = new ExtraFields($db);
561 561
 						$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
562 562
 						$extrafieldsline->setOptionalsFromPost($extralabelsline, $line);
@@ -575,43 +575,43 @@  discard block
 block discarded – undo
575 575
 				exit; // Surtout ne pas laisser Dolibarr faire du traitement sur le updateligne sinon ça plante les données de la ligne
576 576
 			}
577 577
 		}
578
-		else if($action === 'builddoc') {
578
+		else if ($action === 'builddoc') {
579 579
 			
580 580
 			if (
581
-				in_array('invoicecard',explode(':',$parameters['context']))
582
-				|| in_array('propalcard',explode(':',$parameters['context']))
583
-				|| in_array('ordercard',explode(':',$parameters['context']))
584
-			    || in_array('ordersuppliercard',explode(':',$parameters['context']))
585
-			    || in_array('invoicesuppliercard',explode(':',$parameters['context']))
586
-			    || in_array('supplier_proposalcard',explode(':',$parameters['context']))
581
+				in_array('invoicecard', explode(':', $parameters['context']))
582
+				|| in_array('propalcard', explode(':', $parameters['context']))
583
+				|| in_array('ordercard', explode(':', $parameters['context']))
584
+			    || in_array('ordersuppliercard', explode(':', $parameters['context']))
585
+			    || in_array('invoicesuppliercard', explode(':', $parameters['context']))
586
+			    || in_array('supplier_proposalcard', explode(':', $parameters['context']))
587 587
 			)
588 588
 	        {								
589
-				if(in_array('invoicecard',explode(':',$parameters['context']))) {
589
+				if (in_array('invoicecard', explode(':', $parameters['context']))) {
590 590
 					$sessname = 'subtotal_hideInnerLines_facture';	
591 591
 					$sessname2 = 'subtotal_hidedetails_facture';
592 592
 					$sessname3 = 'subtotal_hideprices_facture';
593 593
 				}
594
-				elseif(in_array('invoicesuppliercard',explode(':',$parameters['context']))) {
594
+				elseif (in_array('invoicesuppliercard', explode(':', $parameters['context']))) {
595 595
 				    $sessname = 'subtotal_hideInnerLines_facture_fournisseur';
596 596
 				    $sessname2 = 'subtotal_hidedetails_facture_fournisseur';
597 597
 				    $sessname3 = 'subtotal_hideprices_facture_fournisseur';
598 598
 				}
599
-				elseif(in_array('propalcard',explode(':',$parameters['context']))) {
599
+				elseif (in_array('propalcard', explode(':', $parameters['context']))) {
600 600
 					$sessname = 'subtotal_hideInnerLines_propal';
601 601
 					$sessname2 = 'subtotal_hidedetails_propal';	
602 602
 					$sessname3 = 'subtotal_hideprices_propal';
603 603
 				}
604
-				elseif(in_array('supplier_proposalcard',explode(':',$parameters['context']))) {
604
+				elseif (in_array('supplier_proposalcard', explode(':', $parameters['context']))) {
605 605
 				    $sessname = 'subtotal_hideInnerLines_supplier_proposal';
606 606
 				    $sessname2 = 'subtotal_hidedetails_supplier_proposal';
607 607
 				    $sessname3 = 'subtotal_hideprices_supplier_proposal';
608 608
 				}
609
-				elseif(in_array('ordercard',explode(':',$parameters['context']))) {
609
+				elseif (in_array('ordercard', explode(':', $parameters['context']))) {
610 610
 					$sessname = 'subtotal_hideInnerLines_commande';
611 611
 					$sessname2 = 'subtotal_hidedetails_commande';	
612 612
 					$sessname3 = 'subtotal_hideprices_commande';
613 613
 				}
614
-				elseif(in_array('ordersuppliercard',explode(':',$parameters['context']))) {
614
+				elseif (in_array('ordersuppliercard', explode(':', $parameters['context']))) {
615 615
 				    $sessname = 'subtotal_hideInnerLines_commande_fournisseur';
616 616
 				    $sessname2 = 'subtotal_hidedetails_commande_fournisseur';
617 617
 				    $sessname3 = 'subtotal_hideprices_commande_fournisseur';
@@ -624,22 +624,22 @@  discard block
 block discarded – undo
624 624
 					
625 625
 				global $hideprices;
626 626
 				
627
-				$hideInnerLines = (int)GETPOST('hideInnerLines');
627
+				$hideInnerLines = (int) GETPOST('hideInnerLines');
628 628
 				$_SESSION[$sessname] = $hideInnerLines;		
629 629
 				
630
-				$hidedetails= (int)GETPOST('hidedetails');
630
+				$hidedetails = (int) GETPOST('hidedetails');
631 631
 				$_SESSION[$sessname2] = $hidedetails;
632 632
 				
633
-				$hideprices= (int)GETPOST('hideprices');
633
+				$hideprices = (int) GETPOST('hideprices');
634 634
 				$_SESSION[$sessname3] = $hideprices;
635 635
 				
636
-				foreach($object->lines as &$line) {
636
+				foreach ($object->lines as &$line) {
637 637
 					if ($line->product_type == 9 && $line->special_code == $this->module_number) {
638 638
 					    
639
-                        if($line->qty>=90) {
639
+                        if ($line->qty >= 90) {
640 640
                             $line->modsubtotal_total = 1;
641 641
                         }
642
-                        else{
642
+                        else {
643 643
                             $line->modsubtotal_title = 1;
644 644
                         }
645 645
                         
@@ -649,34 +649,34 @@  discard block
 block discarded – undo
649 649
 	        }
650 650
 			
651 651
 		}
652
-		else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') {
652
+		else if ($action === 'confirm_delete_all_lines' && GETPOST('confirm') == 'yes') {
653 653
 			
654 654
 			$Tab = $this->getArrayOfLineForAGroup($object, GETPOST('lineid'));
655 655
 			
656
-			foreach($Tab as $idLine) {
656
+			foreach ($Tab as $idLine) {
657 657
 				/**
658 658
 				 * @var $object Facture
659 659
 				 */
660
-				if($object->element=='facture') $object->deleteline($idLine);
660
+				if ($object->element == 'facture') $object->deleteline($idLine);
661 661
 				/**
662 662
 				 * @var $object Facture fournisseur
663 663
 				 */
664
-				else if($object->element=='invoice_supplier')
664
+				else if ($object->element == 'invoice_supplier')
665 665
 				{
666 666
 				    $object->deleteline($idLine);
667 667
 				}
668 668
 				/**
669 669
 				 * @var $object Propal
670 670
 				 */
671
-				else if($object->element=='propal') $object->deleteline($idLine);
671
+				else if ($object->element == 'propal') $object->deleteline($idLine);
672 672
 				/**
673 673
 				 * @var $object Propal Fournisseur
674 674
 				 */
675
-				else if($object->element=='supplier_proposal') $object->deleteline($idLine);
675
+				else if ($object->element == 'supplier_proposal') $object->deleteline($idLine);
676 676
 				/**
677 677
 				 * @var $object Commande
678 678
 				 */
679
-				else if($object->element=='commande') 
679
+				else if ($object->element == 'commande') 
680 680
 				{
681 681
 					if ((float) DOL_VERSION >= 5.0) $object->deleteline($user, $idLine);
682 682
 					else $object->deleteline($idLine);
@@ -684,14 +684,14 @@  discard block
 block discarded – undo
684 684
 				/**
685 685
 				 * @var $object Commande fournisseur
686 686
 				 */
687
-				else if($object->element=='order_supplier')
687
+				else if ($object->element == 'order_supplier')
688 688
 				{
689 689
 				    $object->deleteline($idLine);
690 690
 				}
691 691
 				/**
692 692
 				 * @var $object Facturerec
693 693
 				 */
694
-				else if($object->element=='facturerec') $object->deleteline($idLine);
694
+				else if ($object->element == 'facturerec') $object->deleteline($idLine);
695 695
 			}
696 696
 			
697 697
 			header('location:?id='.$object->id);
@@ -714,7 +714,7 @@  discard block
 block discarded – undo
714 714
 		return 0;
715 715
 	}
716 716
 	
717
-	function formAddObjectLine ($parameters, &$object, &$action, $hookmanager) {
717
+	function formAddObjectLine($parameters, &$object, &$action, $hookmanager) {
718 718
 		return 0;
719 719
 	}
720 720
 
@@ -726,22 +726,22 @@  discard block
 block discarded – undo
726 726
 		
727 727
 		$found = false;
728 728
 
729
-		$Tab= array();
729
+		$Tab = array();
730 730
 		
731
-		foreach($object->lines as $l) {
731
+		foreach ($object->lines as $l) {
732 732
 		
733 733
 		    $lid = (!empty($l->rowid) ? $l->rowid : $l->id);
734
-			if($lid == $lineid) {
734
+			if ($lid == $lineid) {
735 735
 
736 736
 				$found = true;
737 737
 				$qty_line = $l->qty;
738 738
 			}
739 739
 			
740
-			if($found) {
740
+			if ($found) {
741 741
 				
742 742
 			    $Tab[] = (!empty($l->rowid) ? $l->rowid : $l->id);
743 743
 				
744
-				if($l->special_code==$this->module_number && (($l->qty==99 && $qty_line==1) || ($l->qty==98 && $qty_line==2))   ) {
744
+				if ($l->special_code == $this->module_number && (($l->qty == 99 && $qty_line == 1) || ($l->qty == 98 && $qty_line == 2))) {
745 745
 					break; // end of story
746 746
 				}
747 747
 			}
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
 	 * 
771 771
 	 * @param	$use_level		isn't used anymore
772 772
 	 */
773
-	function getTotalLineFromObject(&$object, &$line, $use_level=false, $return_all=0) {
773
+	function getTotalLineFromObject(&$object, &$line, $use_level = false, $return_all = 0) {
774 774
 		
775 775
 		$rang = $line->rang;
776 776
 		$qty_line = $line->qty;
@@ -781,21 +781,21 @@  discard block
 block discarded – undo
781 781
 		$TTotal_tva = array();
782 782
 		
783 783
 		dol_include_once('/subtotal/class/subtotal.class.php');
784
-		foreach($object->lines as $l) {
784
+		foreach ($object->lines as $l) {
785 785
 			//print $l->rang.'>='.$rang.' '.$total.'<br/>';
786
-			if($l->rang>=$rang) {
786
+			if ($l->rang >= $rang) {
787 787
 				//echo 'return!<br>';
788 788
 				if (!$return_all) return $total;
789 789
 				else return array($total, $total_tva, $total_ttc, $TTotal_tva);
790 790
 			}
791
-			else if(TSubtotal::isTitle($l, 100 - $qty_line)) 
791
+			else if (TSubtotal::isTitle($l, 100 - $qty_line)) 
792 792
 		  	{
793 793
 				$total = 0;
794 794
 				$total_tva = 0;
795 795
 				$total_ttc = 0;
796 796
 				$TTotal_tva = array();
797 797
 			}
798
-			elseif(!TSubtotal::isTitle($l) && !TSubtotal::isSubtotal($l)) {
798
+			elseif (!TSubtotal::isTitle($l) && !TSubtotal::isSubtotal($l)) {
799 799
 				$total += $l->total_ht;
800 800
 				$total_tva += $l->total_tva;
801 801
 				$TTotal_tva[$l->tva_tx] += $l->total_tva;
@@ -814,18 +814,18 @@  discard block
 block discarded – undo
814 814
 		
815 815
 		$rang = $line->rang;
816 816
 		$total = 0;
817
-		foreach($object->lines as $l) {
818
-			if($l->rang>=$rang) {
817
+		foreach ($object->lines as $l) {
818
+			if ($l->rang >= $rang) {
819 819
 				return price($total);
820 820
 			}
821
-                        if (TSubtotal::isSubtotal($l)){
821
+                        if (TSubtotal::isSubtotal($l)) {
822 822
                             $total = 0;
823
-                        } else  if ($l->situation_percent > 0 ){
823
+                        } else  if ($l->situation_percent > 0) {
824 824
                            
825 825
         	
826 826
 		 	$prev_progress = $l->get_prev_progress($object->id);
827
-		 	$progress = ($l->situation_percent - $prev_progress) /100;
828
-                        $total += ($l->total_ht/($l->situation_percent/100)) * $progress;
827
+		 	$progress = ($l->situation_percent - $prev_progress) / 100;
828
+                        $total += ($l->total_ht / ($l->situation_percent / 100)) * $progress;
829 829
                         
830 830
                     }
831 831
                 }
@@ -844,10 +844,10 @@  discard block
 block discarded – undo
844 844
 	 * @param $w            float               width
845 845
 	 * @param $h            float               height
846 846
 	 */
847
-	function pdf_add_total(&$pdf,&$object, &$line, $label, $description,$posx, $posy, $w, $h) {
848
-		global $conf,$subtotal_last_title_posy;
847
+	function pdf_add_total(&$pdf, &$object, &$line, $label, $description, $posx, $posy, $w, $h) {
848
+		global $conf, $subtotal_last_title_posy;
849 849
 		
850
-		$hideInnerLines = (int)GETPOST('hideInnerLines');
850
+		$hideInnerLines = (int) GETPOST('hideInnerLines');
851 851
 		if (!empty($conf->global->SUBTOTAL_ONE_LINE_IF_HIDE_INNERLINES) && $hideInnerLines && !empty($subtotal_last_title_posy))
852 852
 		{
853 853
 			$posy = $subtotal_last_title_posy;
@@ -857,34 +857,34 @@  discard block
 block discarded – undo
857 857
 		$hidePriceOnSubtotalLines = (int) GETPOST('hide_price_on_subtotal_lines');
858 858
 		
859 859
 		$set_pagebreak_margin = false;
860
-		if(method_exists('Closure','bind')) {
860
+		if (method_exists('Closure', 'bind')) {
861 861
 			$pageBreakOriginalValue = $pdf->AcceptPageBreak();
862
-			$sweetsThief = function ($pdf) {
863
-		    		return $pdf->bMargin ;
862
+			$sweetsThief = function($pdf) {
863
+		    		return $pdf->bMargin;
864 864
 			};
865 865
 			$sweetsThief = Closure::bind($sweetsThief, null, $pdf);
866 866
 	
867
-			$bMargin  = $sweetsThief($pdf);
867
+			$bMargin = $sweetsThief($pdf);
868 868
 	
869
-			$pdf->SetAutoPageBreak( false );
869
+			$pdf->SetAutoPageBreak(false);
870 870
 
871 871
 			$set_pagebreak_margin = true;			
872 872
 		}
873 873
 		
874 874
 			
875
-		if($line->qty==99)
876
-			$pdf->SetFillColor(220,220,220);
877
-		elseif ($line->qty==98)
878
-			$pdf->SetFillColor(230,230,230);
875
+		if ($line->qty == 99)
876
+			$pdf->SetFillColor(220, 220, 220);
877
+		elseif ($line->qty == 98)
878
+			$pdf->SetFillColor(230, 230, 230);
879 879
 		else
880
-			$pdf->SetFillColor(240,240,240);
880
+			$pdf->SetFillColor(240, 240, 240);
881 881
 		
882 882
 		$style = 'B';
883 883
 		if (!empty($conf->global->SUBTOTAL_SUBTOTAL_STYLE)) $style = $conf->global->SUBTOTAL_SUBTOTAL_STYLE;
884 884
 		
885 885
 		$pdf->SetFont('', $style, 9);
886 886
 		
887
-		$pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'R',true);
887
+		$pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'R', true);
888 888
 //		var_dump($bMargin);
889 889
 		$pageAfter = $pdf->getPage();
890 890
 		
@@ -909,7 +909,7 @@  discard block
 block discarded – undo
909 909
 				}
910 910
 			}
911 911
 			
912
-			if($total_to_print) {
912
+			if ($total_to_print) {
913 913
 				
914 914
 				if (GETPOST('hideInnerLines'))
915 915
 				{
@@ -923,7 +923,7 @@  discard block
 block discarded – undo
923 923
 				else
924 924
 				{
925 925
 					list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1);
926
-                                        if(get_class($object) == 'Facture' && $object->type==Facture::TYPE_SITUATION){//Facture de situation
926
+                                        if (get_class($object) == 'Facture' && $object->type == Facture::TYPE_SITUATION) {//Facture de situation
927 927
                                                 $total_to_print = $this->getTotalToPrintSituation($object, $line);
928 928
                                         } else {
929 929
                                             	$total_to_print = price($total);
@@ -937,11 +937,11 @@  discard block
 block discarded – undo
937 937
 			}
938 938
 
939 939
 			$pdf->SetXY($pdf->postotalht, $posy);
940
-			if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin);
941
-			$pdf->MultiCell($pdf->page_largeur-$pdf->marge_droite-$pdf->postotalht, 3, $total_to_print, 0, 'R', 0);
940
+			if ($set_pagebreak_margin) $pdf->SetAutoPageBreak($pageBreakOriginalValue, $bMargin);
941
+			$pdf->MultiCell($pdf->page_largeur - $pdf->marge_droite - $pdf->postotalht, 3, $total_to_print, 0, 'R', 0);
942 942
 		}
943
-		else{
944
-			if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin);
943
+		else {
944
+			if ($set_pagebreak_margin) $pdf->SetAutoPageBreak($pageBreakOriginalValue, $bMargin);
945 945
 		}
946 946
 		
947 947
 		$posy = $posy + $cell_height;
@@ -961,22 +961,22 @@  discard block
 block discarded – undo
961 961
 	 * @param $w            float               width
962 962
 	 * @param $h            float               height
963 963
 	 */
964
-	function pdf_add_title(&$pdf,&$object, &$line, $label, $description,$posx, $posy, $w, $h) {
964
+	function pdf_add_title(&$pdf, &$object, &$line, $label, $description, $posx, $posy, $w, $h) {
965 965
 		
966
-		global $db,$conf,$subtotal_last_title_posy;
966
+		global $db, $conf, $subtotal_last_title_posy;
967 967
 		
968 968
 		$subtotal_last_title_posy = $posy;
969
-		$pdf->SetXY ($posx, $posy);
969
+		$pdf->SetXY($posx, $posy);
970 970
 		
971
-		$hideInnerLines = (int)GETPOST('hideInnerLines');
971
+		$hideInnerLines = (int) GETPOST('hideInnerLines');
972 972
 		
973 973
 		
974 974
  
975
-		$style = ($line->qty==1) ? 'BU' : 'BUI';
975
+		$style = ($line->qty == 1) ? 'BU' : 'BUI';
976 976
 		if (!empty($conf->global->SUBTOTAL_TITLE_STYLE)) $style = $conf->global->SUBTOTAL_TITLE_STYLE;
977 977
 		
978
-		if($hideInnerLines) {
979
-			if($line->qty==1)$pdf->SetFont('', $style, 9);
978
+		if ($hideInnerLines) {
979
+			if ($line->qty == 1)$pdf->SetFont('', $style, 9);
980 980
 			else 
981 981
 			{
982 982
 				if (!empty($conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES)) $style = $conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES;
@@ -985,43 +985,43 @@  discard block
 block discarded – undo
985 985
 		}
986 986
 		else {
987 987
 
988
-			if($line->qty==1)$pdf->SetFont('', $style, 9); //TODO if super utile
988
+			if ($line->qty == 1)$pdf->SetFont('', $style, 9); //TODO if super utile
989 989
 			else $pdf->SetFont('', $style, 9);
990 990
 			
991 991
 		}
992 992
 		
993 993
 		if ($label === strip_tags($label) && $label === dol_html_entity_decode($label, ENT_QUOTES)) $pdf->MultiCell($w, $h, $label, 0, 'L'); // Pas de HTML dans la chaine
994
-		else $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J',true); // et maintenant avec du HTML
994
+		else $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J', true); // et maintenant avec du HTML
995 995
 		
996
-		if($description && !$hidedesc) {
996
+		if ($description && !$hidedesc) {
997 997
 			$posy = $pdf->GetY();
998 998
 			
999 999
 			$pdf->SetFont('', '', 8);
1000 1000
 			
1001
-			$pdf->writeHTMLCell($w, $h, $posx, $posy, $description, 0, 1, false, true, 'J',true);
1001
+			$pdf->writeHTMLCell($w, $h, $posx, $posy, $description, 0, 1, false, true, 'J', true);
1002 1002
 
1003 1003
 		}
1004 1004
 		
1005 1005
 	}
1006 1006
 
1007
-	function pdf_writelinedesc_ref($parameters=array(), &$object, &$action='') {
1007
+	function pdf_writelinedesc_ref($parameters = array(), &$object, &$action = '') {
1008 1008
 	// ultimate PDF hook O_o
1009 1009
 		
1010
-		return $this->pdf_writelinedesc($parameters,$object,$action);
1010
+		return $this->pdf_writelinedesc($parameters, $object, $action);
1011 1011
 		
1012 1012
 	}
1013 1013
 
1014 1014
 	function isModSubtotalLine(&$parameters, &$object) {
1015 1015
 		
1016
-		if(is_array($parameters)) {
1016
+		if (is_array($parameters)) {
1017 1017
 			$i = & $parameters['i'];	
1018 1018
 		}
1019 1019
 		else {
1020
-			$i = (int)$parameters;
1020
+			$i = (int) $parameters;
1021 1021
 		}
1022 1022
 		
1023 1023
 		
1024
-		if($object->lines[$i]->special_code == $this->module_number && $object->lines[$i]->product_type == 9) {
1024
+		if ($object->lines[$i]->special_code == $this->module_number && $object->lines[$i]->product_type == 9) {
1025 1025
 			return true;
1026 1026
 		}
1027 1027
 		
@@ -1029,43 +1029,43 @@  discard block
 block discarded – undo
1029 1029
 		
1030 1030
 	}
1031 1031
 
1032
-	function pdf_getlineqty($parameters=array(), &$object, &$action='') {
1033
-		global $conf,$hideprices;
1032
+	function pdf_getlineqty($parameters = array(), &$object, &$action = '') {
1033
+		global $conf, $hideprices;
1034 1034
 		
1035
-		if($this->isModSubtotalLine($parameters,$object) ){
1035
+		if ($this->isModSubtotalLine($parameters, $object)) {
1036 1036
 			
1037 1037
 			$this->resprints = ' ';
1038 1038
 			
1039
-			if((float)DOL_VERSION<=3.6) {
1039
+			if ((float) DOL_VERSION <= 3.6) {
1040 1040
 				return '';
1041 1041
 			}
1042
-			else if((float)DOL_VERSION>=3.8) {
1042
+			else if ((float) DOL_VERSION >= 3.8) {
1043 1043
 				return 1;
1044 1044
 			}
1045 1045
 			
1046 1046
 		}
1047
-		elseif(!empty($hideprices)) {
1047
+		elseif (!empty($hideprices)) {
1048 1048
 			$this->resprints = $object->lines[$parameters['i']]->qty;
1049 1049
 			return 1;
1050 1050
 		}
1051 1051
 		elseif (!empty($conf->global->SUBTOTAL_IF_HIDE_PRICES_SHOW_QTY))
1052 1052
 		{
1053
-			$hideInnerLines = (int)GETPOST('hideInnerLines');
1054
-			$hidedetails = (int)GETPOST('hidedetails');
1053
+			$hideInnerLines = (int) GETPOST('hideInnerLines');
1054
+			$hidedetails = (int) GETPOST('hidedetails');
1055 1055
 			if (empty($hideInnerLines) && !empty($hidedetails))
1056 1056
 			{
1057 1057
 				$this->resprints = $object->lines[$parameters['i']]->qty;
1058 1058
 			}
1059 1059
 		}
1060 1060
 		
1061
-		if(is_array($parameters)) $i = & $parameters['i'];
1062
-		else $i = (int)$parameters;
1061
+		if (is_array($parameters)) $i = & $parameters['i'];
1062
+		else $i = (int) $parameters;
1063 1063
 
1064 1064
 		if (empty($object->lines[$i])) return 0; // hideInnerLines => override $object->lines et Dolibarr ne nous permet pas de mettre à jour la variable qui conditionne la boucle sur les lignes (PR faite pour 6.0)
1065 1065
 		
1066
-		if(empty($object->lines[$i]->array_options)) $object->lines[$i]->fetch_optionals();
1066
+		if (empty($object->lines[$i]->array_options)) $object->lines[$i]->fetch_optionals();
1067 1067
 
1068
-		if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) )
1068
+		if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])))
1069 1069
 		{
1070 1070
 			if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC)))
1071 1071
 			{
@@ -1077,20 +1077,20 @@  discard block
 block discarded – undo
1077 1077
 		return 0;
1078 1078
 	}
1079 1079
 	
1080
-	function pdf_getlinetotalexcltax($parameters=array(), &$object, &$action='') {
1080
+	function pdf_getlinetotalexcltax($parameters = array(), &$object, &$action = '') {
1081 1081
 	    global $conf, $hideprices, $hookmanager;
1082 1082
 		
1083
-		if(is_array($parameters)) $i = & $parameters['i'];
1084
-		else $i = (int)$parameters;
1083
+		if (is_array($parameters)) $i = & $parameters['i'];
1084
+		else $i = (int) $parameters;
1085 1085
 			
1086
-		if($this->isModSubtotalLine($parameters,$object) ){
1086
+		if ($this->isModSubtotalLine($parameters, $object)) {
1087 1087
 			
1088 1088
 			$this->resprints = ' ';
1089 1089
 			
1090
-			if((float)DOL_VERSION<=3.6) {
1090
+			if ((float) DOL_VERSION <= 3.6) {
1091 1091
 				return '';
1092 1092
 			}
1093
-			else if((float)DOL_VERSION>=3.8) {
1093
+			else if ((float) DOL_VERSION >= 3.8) {
1094 1094
 				return 1;
1095 1095
 			}
1096 1096
 			
@@ -1116,7 +1116,7 @@  discard block
 block discarded – undo
1116 1116
 				}
1117 1117
 			}
1118 1118
 		}
1119
-		if ((int)GETPOST('hideInnerLines') && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)){
1119
+		if ((int) GETPOST('hideInnerLines') && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) {
1120 1120
 		    $this->resprints = price($object->lines[$i]->total_ht);
1121 1121
 		}
1122 1122
 		
@@ -1141,7 +1141,7 @@  discard block
 block discarded – undo
1141 1141
 		{
1142 1142
 			// Check if a title exist for this line && if the title have subtotal
1143 1143
 			$lineTitle = TSubtotal::getParentTitleOfLine($object, $i);
1144
-			if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true))
1144
+			if (TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true))
1145 1145
 			{
1146 1146
 
1147 1147
 				$this->resprints = ' ';
@@ -1161,7 +1161,7 @@  discard block
 block discarded – undo
1161 1161
 	 */
1162 1162
 	private function callHook(&$object, &$hookmanager, $action, $params)
1163 1163
 	{
1164
-		$reshook=$hookmanager->executeHooks('subtotalHidePrices',$params, $object, $action);
1164
+		$reshook = $hookmanager->executeHooks('subtotalHidePrices', $params, $object, $action);
1165 1165
 		if ($reshook < 0)
1166 1166
 		{
1167 1167
 			$this->error = $hookmanager->error;
@@ -1177,7 +1177,7 @@  discard block
 block discarded – undo
1177 1177
 			$this->resprints = $hookmanager->resprints;
1178 1178
 
1179 1179
 			// override return (use  $this->results['overrideReturn'] or $this->resArray['overrideReturn'] in other module action_xxxx.class.php )
1180
-			if(isset($hookmanager->resArray['overrideReturn']))
1180
+			if (isset($hookmanager->resArray['overrideReturn']))
1181 1181
 			{
1182 1182
 				return $hookmanager->resArray['overrideReturn'];
1183 1183
 			}
@@ -1186,25 +1186,25 @@  discard block
 block discarded – undo
1186 1186
 		return 1;
1187 1187
 	}
1188 1188
 	
1189
-	function pdf_getlinetotalwithtax($parameters=array(), &$object, &$action='') {
1189
+	function pdf_getlinetotalwithtax($parameters = array(), &$object, &$action = '') {
1190 1190
 		global $conf;
1191 1191
 		
1192
-		if($this->isModSubtotalLine($parameters,$object) ){
1192
+		if ($this->isModSubtotalLine($parameters, $object)) {
1193 1193
 			
1194 1194
 			$this->resprints = ' ';
1195 1195
 		
1196
-			if((float)DOL_VERSION<=3.6) {
1196
+			if ((float) DOL_VERSION <= 3.6) {
1197 1197
 				return '';
1198 1198
 			}
1199
-			else if((float)DOL_VERSION>=3.8) {
1199
+			else if ((float) DOL_VERSION >= 3.8) {
1200 1200
 				return 1;
1201 1201
 			}
1202 1202
 		}
1203 1203
 		
1204
-		if(is_array($parameters)) $i = & $parameters['i'];
1205
-		else $i = (int)$parameters;
1204
+		if (is_array($parameters)) $i = & $parameters['i'];
1205
+		else $i = (int) $parameters;
1206 1206
 		
1207
-		if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) 
1207
+		if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) 
1208 1208
 		{
1209 1209
 			if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC)))
1210 1210
 			{
@@ -1216,24 +1216,24 @@  discard block
 block discarded – undo
1216 1216
 		return 0;
1217 1217
 	}
1218 1218
 	
1219
-	function pdf_getlineunit($parameters=array(), &$object, &$action='') {
1219
+	function pdf_getlineunit($parameters = array(), &$object, &$action = '') {
1220 1220
 		global $conf;
1221 1221
 		
1222
-		if($this->isModSubtotalLine($parameters,$object) ){
1222
+		if ($this->isModSubtotalLine($parameters, $object)) {
1223 1223
 			$this->resprints = ' ';
1224 1224
 		
1225
-			if((float)DOL_VERSION<=3.6) {
1225
+			if ((float) DOL_VERSION <= 3.6) {
1226 1226
 				return '';
1227 1227
 			}
1228
-			else if((float)DOL_VERSION>=3.8) {
1228
+			else if ((float) DOL_VERSION >= 3.8) {
1229 1229
 				return 1;
1230 1230
 			}
1231 1231
 		}
1232 1232
 		
1233
-		if(is_array($parameters)) $i = & $parameters['i'];
1234
-		else $i = (int)$parameters;
1233
+		if (is_array($parameters)) $i = & $parameters['i'];
1234
+		else $i = (int) $parameters;
1235 1235
 			
1236
-		if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) )
1236
+		if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])))
1237 1237
 		{
1238 1238
 			if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC)))
1239 1239
 			{
@@ -1245,24 +1245,24 @@  discard block
 block discarded – undo
1245 1245
 		return 0;
1246 1246
 	}
1247 1247
 	
1248
-	function pdf_getlineupexcltax($parameters=array(), &$object, &$action='') {
1249
-		global $conf,$hideprices;
1248
+	function pdf_getlineupexcltax($parameters = array(), &$object, &$action = '') {
1249
+		global $conf, $hideprices;
1250 1250
 
1251
-		if($this->isModSubtotalLine($parameters,$object) ){
1251
+		if ($this->isModSubtotalLine($parameters, $object)) {
1252 1252
 			$this->resprints = ' ';
1253 1253
 		
1254
-			if((float)DOL_VERSION<=3.6) {
1254
+			if ((float) DOL_VERSION <= 3.6) {
1255 1255
 				return '';
1256 1256
 			}
1257
-			else if((float)DOL_VERSION>=3.8) {
1257
+			else if ((float) DOL_VERSION >= 3.8) {
1258 1258
 				return 1;
1259 1259
 			}
1260 1260
 		}
1261
-		if(is_array($parameters)) $i = & $parameters['i'];
1262
-		else $i = (int)$parameters;
1261
+		if (is_array($parameters)) $i = & $parameters['i'];
1262
+		else $i = (int) $parameters;
1263 1263
 		
1264 1264
 		if (!empty($hideprices) 
1265
-				|| (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) )
1265
+				|| (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])))
1266 1266
 		)
1267 1267
 		{
1268 1268
 			if (!empty($hideprices) || !in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC)))
@@ -1275,24 +1275,24 @@  discard block
 block discarded – undo
1275 1275
 		return 0;
1276 1276
 	}
1277 1277
 	
1278
-	function pdf_getlineupwithtax($parameters=array(), &$object, &$action='') {
1279
-		global $conf,$hideprices;
1278
+	function pdf_getlineupwithtax($parameters = array(), &$object, &$action = '') {
1279
+		global $conf, $hideprices;
1280 1280
 		
1281
-		if($this->isModSubtotalLine($parameters,$object) ){
1281
+		if ($this->isModSubtotalLine($parameters, $object)) {
1282 1282
 			$this->resprints = ' ';
1283
-			if((float)DOL_VERSION<=3.6) {
1283
+			if ((float) DOL_VERSION <= 3.6) {
1284 1284
 				return '';
1285 1285
 			}
1286
-			else if((float)DOL_VERSION>=3.8) {
1286
+			else if ((float) DOL_VERSION >= 3.8) {
1287 1287
 				return 1;
1288 1288
 			}
1289 1289
 		}
1290 1290
 		
1291
-		if(is_array($parameters)) $i = & $parameters['i'];
1292
-		else $i = (int)$parameters;
1291
+		if (is_array($parameters)) $i = & $parameters['i'];
1292
+		else $i = (int) $parameters;
1293 1293
 			
1294 1294
 		if (!empty($hideprices)
1295
-				|| (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) )
1295
+				|| (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])))
1296 1296
 		)
1297 1297
 		{
1298 1298
 			if (!empty($hideprices) || !in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC)))
@@ -1305,27 +1305,27 @@  discard block
 block discarded – undo
1305 1305
 		return 0;
1306 1306
 	}
1307 1307
 	
1308
-	function pdf_getlinevatrate($parameters=array(), &$object, &$action='') {
1308
+	function pdf_getlinevatrate($parameters = array(), &$object, &$action = '') {
1309 1309
 		global $conf;
1310 1310
 		
1311
-		if($this->isModSubtotalLine($parameters,$object) ){
1311
+		if ($this->isModSubtotalLine($parameters, $object)) {
1312 1312
 			$this->resprints = ' ';
1313 1313
 			
1314
-			if((float)DOL_VERSION<=3.6) {
1314
+			if ((float) DOL_VERSION <= 3.6) {
1315 1315
 				return '';
1316 1316
 			}
1317
-			else if((float)DOL_VERSION>=3.8) {
1317
+			else if ((float) DOL_VERSION >= 3.8) {
1318 1318
 				return 1;
1319 1319
 			}
1320 1320
 		}
1321 1321
 		
1322
-		if(is_array($parameters)) $i = & $parameters['i'];
1323
-		else $i = (int)$parameters;
1322
+		if (is_array($parameters)) $i = & $parameters['i'];
1323
+		else $i = (int) $parameters;
1324 1324
 		
1325 1325
 		if (empty($object->lines[$i])) return 0; // hideInnerLines => override $object->lines et Dolibarr ne nous permet pas de mettre à jour la variable qui conditionne la boucle sur les lignes (PR faite pour 6.0)
1326 1326
 
1327 1327
 		$object->lines[$i]->fetch_optionals();
1328
-		if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) )
1328
+		if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])))
1329 1329
 		{
1330 1330
 			if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC)))
1331 1331
 			{
@@ -1337,23 +1337,23 @@  discard block
 block discarded – undo
1337 1337
 		return 0;
1338 1338
 	}
1339 1339
 		
1340
-	function pdf_getlineprogress($parameters=array(), &$object, &$action) {
1340
+	function pdf_getlineprogress($parameters = array(), &$object, &$action) {
1341 1341
 		global $conf;
1342 1342
 		
1343
-		if($this->isModSubtotalLine($parameters,$object) ){
1343
+		if ($this->isModSubtotalLine($parameters, $object)) {
1344 1344
 			$this->resprints = ' ';
1345
-			if((float)DOL_VERSION<=3.6) {
1345
+			if ((float) DOL_VERSION <= 3.6) {
1346 1346
 				return '';
1347 1347
 			}
1348
-			else if((float)DOL_VERSION>=3.8) {
1348
+			else if ((float) DOL_VERSION >= 3.8) {
1349 1349
 				return 1;
1350 1350
 			}
1351 1351
 		}
1352 1352
 		
1353
-		if(is_array($parameters)) $i = & $parameters['i'];
1354
-		else $i = (int)$parameters;
1353
+		if (is_array($parameters)) $i = & $parameters['i'];
1354
+		else $i = (int) $parameters;
1355 1355
 			
1356
-		if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) )
1356
+		if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])))
1357 1357
 		{
1358 1358
 			if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC)))
1359 1359
 			{
@@ -1368,12 +1368,12 @@  discard block
 block discarded – undo
1368 1368
 	function add_numerotation(&$object) {
1369 1369
 		global $conf;
1370 1370
 		
1371
-		if(!empty($conf->global->SUBTOTAL_USE_NUMEROTATION)) {
1371
+		if (!empty($conf->global->SUBTOTAL_USE_NUMEROTATION)) {
1372 1372
 		
1373 1373
 			$TLevelTitre = array();
1374 1374
 			$prevlevel = 0;
1375 1375
 		
1376
-			foreach($object->lines as $k=>&$line) 
1376
+			foreach ($object->lines as $k=>&$line) 
1377 1377
 			{
1378 1378
 				if ($line->id > 0 && $this->isModSubtotalLine($k, $object) && $line->qty <= 10)
1379 1379
 				{
@@ -1387,12 +1387,12 @@  discard block
 block discarded – undo
1387 1387
 	}
1388 1388
 
1389 1389
 	// TODO ne gère pas encore la numération des lignes "Totaux"
1390
-	private function formatNumerotation(&$TLineTitle, $line_reference='', $level=1, $prefix_num=0)
1390
+	private function formatNumerotation(&$TLineTitle, $line_reference = '', $level = 1, $prefix_num = 0)
1391 1391
 	{
1392 1392
 		$TTitle = array();
1393 1393
 		
1394
-		$i=1;
1395
-		$j=0;
1394
+		$i = 1;
1395
+		$j = 0;
1396 1396
 		foreach ($TLineTitle as $k => &$line)
1397 1397
 		{
1398 1398
 			if (!empty($line_reference) && $line->rang <= $line_reference->rang) continue;
@@ -1402,7 +1402,7 @@  discard block
 block discarded – undo
1402 1402
 			{
1403 1403
 				$TTitle[$j]['numerotation'] = ($prefix_num == 0) ? $i : $prefix_num.'.'.$i;
1404 1404
 				//var_dump('Prefix == '.$prefix_num.' // '.$line->desc.' ==> numerotation == '.$TTitle[$j]['numerotation'].'   ###    '.$line->qty .'=='. $level);
1405
-				if (empty($line->label) && (float)DOL_VERSION < 6)
1405
+				if (empty($line->label) && (float) DOL_VERSION < 6)
1406 1406
 				{
1407 1407
 					$line->label = !empty($line->desc) ? $line->desc : $line->description;
1408 1408
 					$line->desc = $line->description = '';
@@ -1428,26 +1428,26 @@  discard block
 block discarded – undo
1428 1428
 	
1429 1429
 	function setDocTVA(&$pdf, &$object) {
1430 1430
 		
1431
-		$hidedetails = (int)GETPOST('hidedetails');
1431
+		$hidedetails = (int) GETPOST('hidedetails');
1432 1432
 		
1433
-		if(empty($hidedetails)) return false;
1433
+		if (empty($hidedetails)) return false;
1434 1434
 		
1435 1435
 		// TODO can't add VAT to document without lines... :-/
1436 1436
 		
1437 1437
 		return true;
1438 1438
 	}
1439 1439
 	
1440
-	function beforePDFCreation($parameters=array(), &$object, &$action)
1440
+	function beforePDFCreation($parameters = array(), &$object, &$action)
1441 1441
 	{
1442 1442
 		/**
1443 1443
 		 * @var $pdf    TCPDF
1444 1444
 		 */
1445
-		global $pdf,$conf, $langs;
1445
+		global $pdf, $conf, $langs;
1446 1446
 
1447 1447
 		// var_dump($object->lines);
1448 1448
 		dol_include_once('/subtotal/class/subtotal.class.php');
1449 1449
 
1450
-		foreach($parameters as $key=>$value) {
1450
+		foreach ($parameters as $key=>$value) {
1451 1451
 			${$key} = $value;
1452 1452
 		}
1453 1453
 		
@@ -1456,25 +1456,25 @@  discard block
 block discarded – undo
1456 1456
 		$this->add_numerotation($object);	
1457 1457
 		
1458 1458
 		
1459
-		$hideInnerLines = (int)GETPOST('hideInnerLines');
1460
-		$hidedetails = (int)GETPOST('hidedetails');
1459
+		$hideInnerLines = (int) GETPOST('hideInnerLines');
1460
+		$hidedetails = (int) GETPOST('hidedetails');
1461 1461
 		
1462 1462
 		if ($hideInnerLines) { // si c une ligne de titre
1463
-	    	$fk_parent_line=0;
1464
-			$TLines =array();
1463
+	    	$fk_parent_line = 0;
1464
+			$TLines = array();
1465 1465
 		
1466
-			$original_count=count($object->lines);
1466
+			$original_count = count($object->lines);
1467 1467
 		    $TTvas = array(); // tableau de tva
1468 1468
 		    
1469
-			foreach($object->lines as $k=>&$line) 
1469
+			foreach ($object->lines as $k=>&$line) 
1470 1470
 			{
1471 1471
 			    
1472
-				if($line->product_type==9 && $line->rowid>0) 
1472
+				if ($line->product_type == 9 && $line->rowid > 0) 
1473 1473
 				{
1474 1474
 					$fk_parent_line = $line->rowid;
1475 1475
 					
1476 1476
 					// Fix tk7201 - si on cache le détail, la TVA est renseigné au niveau du sous-total, l'erreur c'est s'il y a plusieurs sous-totaux pour les même lignes, ça va faire la somme
1477
-					if(TSubtotal::isSubtotal($line)) 
1477
+					if (TSubtotal::isSubtotal($line)) 
1478 1478
 					{
1479 1479
 						/*$total = $this->getTotalLineFromObject($object, $line, '');
1480 1480
 						
@@ -1494,22 +1494,22 @@  discard block
 block discarded – undo
1494 1494
 			
1495 1495
 				if ($hideInnerLines)
1496 1496
 				{
1497
-				    if(!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES))
1497
+				    if (!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES))
1498 1498
 				    {
1499
-				        if($line->tva_tx != '0.000' && $line->product_type!=9){
1499
+				        if ($line->tva_tx != '0.000' && $line->product_type != 9) {
1500 1500
 				            
1501 1501
     				        // on remplit le tableau de tva pour substituer les lignes cachées
1502 1502
     				        $TTvas[$line->tva_tx]['total_tva'] += $line->total_tva;
1503 1503
     				        $TTvas[$line->tva_tx]['total_ht'] += $line->total_ht;
1504 1504
     				        $TTvas[$line->tva_tx]['total_ttc'] += $line->total_ttc; 
1505 1505
     				    }
1506
-    					if($line->product_type==9 && $line->rowid>0)
1506
+    					if ($line->product_type == 9 && $line->rowid > 0)
1507 1507
     					{
1508 1508
     					    //Cas où je doit cacher les produits et afficher uniquement les sous-totaux avec les titres
1509 1509
     					    // génère des lignes d'affichage des montants HT soumis à tva
1510 1510
     					    $nbtva = count($TTvas);
1511
-    					    if(!empty($nbtva)){
1512
-    					        foreach ($TTvas as $tx =>$val){
1511
+    					    if (!empty($nbtva)) {
1512
+    					        foreach ($TTvas as $tx =>$val) {
1513 1513
     					            $l = clone $line;
1514 1514
     					            $l->product_type = 1;
1515 1515
     					            $l->special_code = '';
@@ -1530,7 +1530,7 @@  discard block
 block discarded – undo
1530 1530
     					}
1531 1531
 				    } else {
1532 1532
 				        
1533
-				        if($line->product_type==9 && $line->rowid>0)
1533
+				        if ($line->product_type == 9 && $line->rowid > 0)
1534 1534
 				        {
1535 1535
 				            // ajoute la ligne de sous-total
1536 1536
 				            $TLines[] = $line; 
@@ -1558,9 +1558,9 @@  discard block
 block discarded – undo
1558 1558
 			
1559 1559
 			// cas incongru où il y aurait des produits en dessous du dernier sous-total
1560 1560
 			$nbtva = count($TTvas);
1561
-			if(!empty($nbtva) && $hideInnerLines && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES))
1561
+			if (!empty($nbtva) && $hideInnerLines && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES))
1562 1562
 			{
1563
-			    foreach ($TTvas as $tx =>$val){
1563
+			    foreach ($TTvas as $tx =>$val) {
1564 1564
 			        $l = clone $line;
1565 1565
 			        $l->product_type = 1;
1566 1566
 			        $l->special_code = '';
@@ -1577,11 +1577,11 @@  discard block
 block discarded – undo
1577 1577
 			}
1578 1578
 			
1579 1579
 			global $nblignes;
1580
-			$nblignes=count($TLines);
1580
+			$nblignes = count($TLines);
1581 1581
 
1582 1582
 			$object->lines = $TLines;
1583 1583
 			
1584
-			if($i>count($object->lines)) {
1584
+			if ($i > count($object->lines)) {
1585 1585
 				$this->resprints = '';
1586 1586
 				return 0;
1587 1587
 			}
@@ -1590,59 +1590,59 @@  discard block
 block discarded – undo
1590 1590
 		return 0;
1591 1591
 	}
1592 1592
 
1593
-	function pdf_writelinedesc($parameters=array(), &$object, &$action)
1593
+	function pdf_writelinedesc($parameters = array(), &$object, &$action)
1594 1594
 	{
1595 1595
 		/**
1596 1596
 		 * @var $pdf    TCPDF
1597 1597
 		 */
1598
-		global $pdf,$conf;
1598
+		global $pdf, $conf;
1599 1599
 
1600
-		foreach($parameters as $key=>$value) {
1600
+		foreach ($parameters as $key=>$value) {
1601 1601
 			${$key} = $value;
1602 1602
 		}
1603 1603
 		
1604
-		$hideInnerLines = (int)GETPOST('hideInnerLines');
1605
-		$hidedetails = (int)GETPOST('hidedetails');
1604
+		$hideInnerLines = (int) GETPOST('hideInnerLines');
1605
+		$hidedetails = (int) GETPOST('hidedetails');
1606 1606
 		
1607
-		if($this->isModSubtotalLine($parameters,$object) ){			
1607
+		if ($this->isModSubtotalLine($parameters, $object)) {			
1608 1608
 		
1609 1609
 				global $hideprices;
1610 1610
 				
1611
-				if(!empty($hideprices)) {
1612
-					foreach($object->lines as &$line) {
1613
-						if($line->fk_product_type!=9) $line->fk_parent_line = -1;	
1611
+				if (!empty($hideprices)) {
1612
+					foreach ($object->lines as &$line) {
1613
+						if ($line->fk_product_type != 9) $line->fk_parent_line = -1;	
1614 1614
 					}
1615 1615
 				}
1616 1616
 			
1617 1617
 				$line = &$object->lines[$i];
1618 1618
 				
1619
-				if($line->info_bits>0) { // PAGE BREAK
1619
+				if ($line->info_bits > 0) { // PAGE BREAK
1620 1620
 					$pdf->addPage();
1621 1621
 					$posy = $pdf->GetY();
1622 1622
 				}
1623 1623
 				
1624 1624
 				$label = $line->label;
1625
-				$description= !empty($line->desc) ? $outputlangs->convToOutputCharset($line->desc) : $outputlangs->convToOutputCharset($line->description);
1625
+				$description = !empty($line->desc) ? $outputlangs->convToOutputCharset($line->desc) : $outputlangs->convToOutputCharset($line->description);
1626 1626
 				
1627
-				if(empty($label)) {
1627
+				if (empty($label)) {
1628 1628
 					$label = $description;
1629
-					$description='';
1629
+					$description = '';
1630 1630
 				}
1631 1631
 				
1632
-				if($line->qty>90) {
1632
+				if ($line->qty > 90) {
1633 1633
 					
1634 1634
 					if ($conf->global->SUBTOTAL_USE_NEW_FORMAT)	$label .= ' '.$this->getTitle($object, $line);
1635 1635
 					
1636 1636
 					$pageBefore = $pdf->getPage();
1637
-					$this->pdf_add_total($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h);
1637
+					$this->pdf_add_total($pdf, $object, $line, $label, $description, $posx, $posy, $w, $h);
1638 1638
 					$pageAfter = $pdf->getPage();	
1639 1639
 
1640
-					if($pageAfter>$pageBefore) {
1640
+					if ($pageAfter > $pageBefore) {
1641 1641
 						//print "ST $pageAfter>$pageBefore<br>";
1642 1642
 						$pdf->rollbackTransaction(true);	
1643
-						$pdf->addPage('','', true);
1643
+						$pdf->addPage('', '', true);
1644 1644
 						$posy = $pdf->GetY();
1645
-						$this->pdf_add_total($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h);
1645
+						$this->pdf_add_total($pdf, $object, $line, $label, $description, $posx, $posy, $w, $h);
1646 1646
 						$posy = $pdf->GetY();
1647 1647
 						//print 'add ST'.$pdf->getPage().'<br />';
1648 1648
 					}
@@ -1653,7 +1653,7 @@  discard block
 block discarded – undo
1653 1653
 				else if ($line->qty < 10) {
1654 1654
 					$pageBefore = $pdf->getPage();
1655 1655
 
1656
-					$this->pdf_add_title($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); 
1656
+					$this->pdf_add_title($pdf, $object, $line, $label, $description, $posx, $posy, $w, $h); 
1657 1657
 					$pageAfter = $pdf->getPage();	
1658 1658
 
1659 1659
 					
@@ -1728,9 +1728,9 @@  discard block
 block discarded – undo
1728 1728
 	 * @param $hookmanager  HookManager
1729 1729
 	 * @return int
1730 1730
 	 */
1731
-	function printObjectLine ($parameters, &$object, &$action, $hookmanager){
1731
+	function printObjectLine($parameters, &$object, &$action, $hookmanager) {
1732 1732
 		
1733
-		global $conf,$langs,$user,$db,$bc;
1733
+		global $conf, $langs, $user, $db, $bc;
1734 1734
 		
1735 1735
 		$num = &$parameters['num'];
1736 1736
 		$line = &$parameters['line'];
@@ -1738,32 +1738,32 @@  discard block
 block discarded – undo
1738 1738
 		
1739 1739
 		$var = &$parameters['var'];
1740 1740
 
1741
-		$contexts = explode(':',$parameters['context']);
1741
+		$contexts = explode(':', $parameters['context']);
1742 1742
 
1743 1743
 		$createRight = $user->rights->{$object->element}->creer;
1744
-		if($object->element == 'facturerec' )
1744
+		if ($object->element == 'facturerec')
1745 1745
 		{
1746 1746
 			$object->statut = 0; // hack for facture rec
1747 1747
 			$createRight = $user->rights->facture->creer;
1748 1748
 		}
1749
-		elseif($object->element == 'order_supplier' )
1749
+		elseif ($object->element == 'order_supplier')
1750 1750
 		{
1751 1751
 		    $createRight = $user->rights->fournisseur->commande->creer;
1752 1752
 		}
1753
-		elseif($object->element == 'invoice_supplier' )
1753
+		elseif ($object->element == 'invoice_supplier')
1754 1754
 		{
1755 1755
 		    $createRight = $user->rights->fournisseur->facture->creer;
1756 1756
 		}
1757 1757
 		
1758
-		if($line->special_code!=$this->module_number || $line->product_type!=9) {
1758
+		if ($line->special_code != $this->module_number || $line->product_type != 9) {
1759 1759
 			null;
1760 1760
 		}	
1761
-		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)) 
1761
+		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)) 
1762 1762
         {
1763
-			if($object->element=='facture')$idvar = 'facid';
1764
-			else $idvar='id';
1763
+			if ($object->element == 'facture')$idvar = 'facid';
1764
+			else $idvar = 'id';
1765 1765
 			
1766
-			if((float)DOL_VERSION <= 3.4)
1766
+			if ((float) DOL_VERSION <= 3.4)
1767 1767
 			{
1768 1768
 				?>
1769 1769
 				<script type="text/javascript">
@@ -1787,20 +1787,20 @@  discard block
 block discarded – undo
1787 1787
 				<?php
1788 1788
 			}
1789 1789
 			
1790
-			if(empty($line->description)) $line->description = $line->desc;
1790
+			if (empty($line->description)) $line->description = $line->desc;
1791 1791
 			
1792 1792
 			$colspan = 5;
1793
-			if($object->element == 'facturerec' ) $colspan = 3;
1794
-			if($object->element == 'order_supplier') $colspan = 3;
1795
-			if($object->element == 'invoice_supplier') $colspan = 4;
1796
-			if($object->element == 'supplier_proposal') $colspan = 4;
1797
-			if(!empty($conf->multicurrency->enabled)) $colspan+=2;
1798
-			if($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) $colspan++;
1799
-			if(!empty($conf->margin->enabled)) $colspan++;
1800
-			if(!empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++;
1801
-			if(!empty($conf->global->DISPLAY_MARK_RATES)) $colspan++;
1802
-			if($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) $colspan++;
1803
-			if(!empty($conf->global->PRODUCT_USE_UNITS)) $colspan++;
1793
+			if ($object->element == 'facturerec') $colspan = 3;
1794
+			if ($object->element == 'order_supplier') $colspan = 3;
1795
+			if ($object->element == 'invoice_supplier') $colspan = 4;
1796
+			if ($object->element == 'supplier_proposal') $colspan = 4;
1797
+			if (!empty($conf->multicurrency->enabled)) $colspan += 2;
1798
+			if ($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) $colspan++;
1799
+			if (!empty($conf->margin->enabled)) $colspan++;
1800
+			if (!empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++;
1801
+			if (!empty($conf->global->DISPLAY_MARK_RATES)) $colspan++;
1802
+			if ($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) $colspan++;
1803
+			if (!empty($conf->global->PRODUCT_USE_UNITS)) $colspan++;
1804 1804
 					
1805 1805
 			/* Titre */
1806 1806
 			//var_dump($line);
@@ -1810,35 +1810,35 @@  discard block
 block discarded – undo
1810 1810
             
1811 1811
 			
1812 1812
 			?>
1813
-			<tr <?php echo $bc[$var]; $var=!$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php
1813
+			<tr <?php echo $bc[$var]; $var = !$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php
1814 1814
 					if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT))
1815 1815
 					{
1816
-						if($line->qty==99) print 'background:#adadcf';
1817
-						else if($line->qty==98) print 'background:#ddddff;';
1818
-						else if($line->qty<=97 && $line->qty>=91) print 'background:#eeeeff;';
1819
-						else if($line->qty==1) print 'background:#adadcf;';
1820
-						else if($line->qty==2) print 'background:#ddddff;';
1821
-						else if($line->qty==50) print '';
1816
+						if ($line->qty == 99) print 'background:#adadcf';
1817
+						else if ($line->qty == 98) print 'background:#ddddff;';
1818
+						else if ($line->qty <= 97 && $line->qty >= 91) print 'background:#eeeeff;';
1819
+						else if ($line->qty == 1) print 'background:#adadcf;';
1820
+						else if ($line->qty == 2) print 'background:#ddddff;';
1821
+						else if ($line->qty == 50) print '';
1822 1822
 						else print 'background:#eeeeff;';
1823 1823
 
1824 1824
 						//A compléter si on veux plus de nuances de couleurs avec les niveau 4,5,6,7,8 et 9
1825 1825
 					}
1826 1826
 					else 
1827 1827
 					{
1828
-						if($line->qty==99) print 'background:#ddffdd';
1829
-						else if($line->qty==98) print 'background:#ddddff;';
1830
-						else if($line->qty==2) print 'background:#eeeeff; ';
1831
-						else if($line->qty==50) print '';
1832
-						else print 'background:#eeffee;' ;
1828
+						if ($line->qty == 99) print 'background:#ddffdd';
1829
+						else if ($line->qty == 98) print 'background:#ddddff;';
1830
+						else if ($line->qty == 2) print 'background:#eeeeff; ';
1831
+						else if ($line->qty == 50) print '';
1832
+						else print 'background:#eeffee;';
1833 1833
 					}
1834 1834
 
1835 1835
 			?>;">
1836 1836
 			
1837
-				<td colspan="<?php echo $colspan; ?>" style="<?php TSubtotal::isFreeText($line) ? '' : 'font-weight:bold;'; ?>  <?php echo ($line->qty>90)?'text-align:right':'' ?> "><?php
1838
-					if($action=='editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line) ) {
1837
+				<td colspan="<?php echo $colspan; ?>" style="<?php TSubtotal::isFreeText($line) ? '' : 'font-weight:bold;'; ?>  <?php echo ($line->qty > 90) ? 'text-align:right' : '' ?> "><?php
1838
+					if ($action == 'editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line)) {
1839 1839
 
1840
-						$params=array('line'=>$line);
1841
-						$reshook=$hookmanager->executeHooks('formEditProductOptions',$params,$object,$action);
1840
+						$params = array('line'=>$line);
1841
+						$reshook = $hookmanager->executeHooks('formEditProductOptions', $params, $object, $action);
1842 1842
 						
1843 1843
 						echo '<div id="line_'.$line->id.'"></div>'; // Imitation Dolibarr
1844 1844
 						echo '<input type="hidden" value="'.$line->id.'" name="lineid">';
@@ -1846,7 +1846,7 @@  discard block
 block discarded – undo
1846 1846
 						echo '<input id="product_id" type="hidden" value="'.$line->fk_product.'" name="type">';
1847 1847
 						echo '<input id="special_code" type="hidden" value="'.$line->special_code.'" name="type">';
1848 1848
 
1849
-						$isFreeText=false;
1849
+						$isFreeText = false;
1850 1850
 						if (TSubtotal::isTitle($line))
1851 1851
 						{
1852 1852
 							$qty_displayed = $line->qty;
@@ -1868,13 +1868,13 @@  discard block
 block discarded – undo
1868 1868
 						    $line->description = '';
1869 1869
 						}
1870 1870
 						$newlabel = $line->label;
1871
-						if($line->label=='' && !$isFreeText) {
1872
-							if(TSubtotal::isSubtotal($line)) {
1871
+						if ($line->label == '' && !$isFreeText) {
1872
+							if (TSubtotal::isSubtotal($line)) {
1873 1873
 								$newlabel = $line->description.' '.$this->getTitle($object, $line);
1874
-								$line->description='';
1875
-							} elseif( (float)DOL_VERSION < 6 ) {
1876
-								$newlabel= $line->description;
1877
-								$line->description='';
1874
+								$line->description = '';
1875
+							} elseif ((float) DOL_VERSION < 6) {
1876
+								$newlabel = $line->description;
1877
+								$line->description = '';
1878 1878
 							}
1879 1879
 						}
1880 1880
 
@@ -1883,10 +1883,10 @@  discard block
 block discarded – undo
1883 1883
 						
1884 1884
 						if (!$isFreeText) echo '<input type="text" name="line-title" id-line="'.$line->id.'" value="'.$newlabel.'" size="80" '.$readonlyForSituation.'/>&nbsp;';
1885 1885
 						
1886
-						if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT) && (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) )
1886
+						if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT) && (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)))
1887 1887
 						{
1888 1888
 							$select = '<select name="subtotal_level">';
1889
-							for ($j=1; $j<10; $j++)
1889
+							for ($j = 1; $j < 10; $j++)
1890 1890
 							{
1891 1891
 								if (!empty($readonlyForSituation)) {
1892 1892
 									if ($qty_displayed == $j) $select .= '<option selected="selected" value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>';
@@ -1899,7 +1899,7 @@  discard block
 block discarded – undo
1899 1899
 						
1900 1900
 
1901 1901
 						echo '<div class="subtotal_underline" style="margin-left:24px;">';
1902
-							echo '<label for="subtotal-pagebreak">'.$langs->trans('AddBreakPageBefore').'</label> <input style="vertical-align:sub;"  type="checkbox" name="line-pagebreak" id="subtotal-pagebreak" value="8" '.(($line->info_bits > 0) ? 'checked="checked"' : '') .' />&nbsp;&nbsp;';
1902
+							echo '<label for="subtotal-pagebreak">'.$langs->trans('AddBreakPageBefore').'</label> <input style="vertical-align:sub;"  type="checkbox" name="line-pagebreak" id="subtotal-pagebreak" value="8" '.(($line->info_bits > 0) ? 'checked="checked"' : '').' />&nbsp;&nbsp;';
1903 1903
 
1904 1904
 							if (TSubtotal::isTitle($line))
1905 1905
 							{
@@ -1917,9 +1917,9 @@  discard block
 block discarded – undo
1917 1917
 							else if ($isFreeText) echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation);
1918 1918
 						echo '</div>';
1919 1919
 
1920
-						if($line->qty<10) {
1920
+						if ($line->qty < 10) {
1921 1921
 							// WYSIWYG editor
1922
-							require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
1922
+							require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
1923 1923
 							$nbrows = ROWS_2;
1924 1924
 							$cked_enabled = (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS) ? $conf->global->FCKEDITOR_ENABLE_DETAILS : 0);
1925 1925
 							if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) {
@@ -1939,25 +1939,25 @@  discard block
 block discarded – undo
1939 1939
 
1940 1940
 						 if ($conf->global->SUBTOTAL_USE_NEW_FORMAT)
1941 1941
 						 {
1942
-							if(TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) 
1942
+							if (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) 
1943 1943
 							{
1944
-								echo str_repeat('&nbsp;&nbsp;&nbsp;', $line->qty-1);
1944
+								echo str_repeat('&nbsp;&nbsp;&nbsp;', $line->qty - 1);
1945 1945
 								
1946 1946
 								if (TSubtotal::isTitle($line)) print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span>&nbsp;&nbsp;';
1947
-								else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span>&nbsp;&nbsp;';
1947
+								else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100 - $line->qty).'</span>&nbsp;&nbsp;';
1948 1948
 							}
1949 1949
 						 }
1950 1950
 						 else 
1951 1951
 						 {
1952
-							if($line->qty<=1) print img_picto('', 'subtotal@subtotal');
1953
-							else if($line->qty==2) print img_picto('', 'subsubtotal@subtotal').'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'; 
1952
+							if ($line->qty <= 1) print img_picto('', 'subtotal@subtotal');
1953
+							else if ($line->qty == 2) print img_picto('', 'subsubtotal@subtotal').'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'; 
1954 1954
 						 }
1955 1955
 						 
1956 1956
 						 
1957 1957
 						 // Get display styles and apply them
1958 1958
 						 $titleStyleItalic = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'I') === false ? '' : ' font-style: italic;';
1959
-						 $titleStyleBold =  strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'B') === false ? '' : ' font-weight:bold;';
1960
-						 $titleStyleUnderline =  strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;';
1959
+						 $titleStyleBold = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'B') === false ? '' : ' font-weight:bold;';
1960
+						 $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;';
1961 1961
 						 
1962 1962
 						 if (empty($line->label)) {
1963 1963
 							if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) print  $line->description.' '.$this->getTitle($object, $line);
@@ -1965,16 +1965,16 @@  discard block
 block discarded – undo
1965 1965
 						 } 
1966 1966
 						 else {
1967 1967
 
1968
-							if (! empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) {
1968
+							if (!empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) {
1969 1969
 								print '<span class="subtotal_label" style="'.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" >'.$line->label.'</span><br><div class="subtotal_desc">'.dol_htmlentitiesbr($line->description).'</div>';
1970 1970
 							}
1971
-							else{
1971
+							else {
1972 1972
 								print '<span class="subtotal_label classfortooltip '.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" title="'.$line->description.'">'.$line->label.'</span>';    
1973 1973
 							}
1974 1974
 
1975 1975
 						 } 
1976
-						if($line->qty>90) print ' : ';
1977
-						if($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal');
1976
+						if ($line->qty > 90) print ' : ';
1977
+						if ($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal');
1978 1978
 
1979 1979
 						 
1980 1980
 
@@ -1983,7 +1983,7 @@  discard block
 block discarded – undo
1983 1983
 			?></td>
1984 1984
 					 
1985 1985
 			<?php
1986
-				if($line->qty>90) {
1986
+				if ($line->qty > 90) {
1987 1987
 					/* Total */
1988 1988
 					$total_line = $this->getTotalLineFromObject($object, $line, '');
1989 1989
 					echo '<td class="nowrap liencolht" align="right" style="font-weight:bold;" rel="subtotal_total">'.price($total_line).'</td>';
@@ -1996,7 +1996,7 @@  discard block
 block discarded – undo
1996 1996
 				<?php
1997 1997
 				if ($action != 'selectlines') {
1998 1998
 				
1999
-					if($action=='editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line) ) {
1999
+					if ($action == 'editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line)) {
2000 2000
 						?>
2001 2001
 						<input id="savelinebutton" class="button" type="submit" name="save" value="<?php echo $langs->trans('Save') ?>" />
2002 2002
 						<br />
@@ -2012,13 +2012,13 @@  discard block
 block discarded – undo
2012 2012
 						<?php
2013 2013
 						
2014 2014
 					}
2015
-					else{
2016
-						if ($object->statut == 0  && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK) && $object->element !== 'invoice_supplier')
2015
+					else {
2016
+						if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK) && $object->element !== 'invoice_supplier')
2017 2017
 						{
2018
-							if(TSubtotal::isTitle($line) && ($object->situation_counter == 1 || !$object->situation_cycle_ref) ) echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=duplicate&lineid='.$line->id.'">'. img_picto($langs->trans('Duplicate'), 'duplicate@subtotal').'</a>';
2018
+							if (TSubtotal::isTitle($line) && ($object->situation_counter == 1 || !$object->situation_cycle_ref)) echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=duplicate&lineid='.$line->id.'">'.img_picto($langs->trans('Duplicate'), 'duplicate@subtotal').'</a>';
2019 2019
 						}
2020 2020
 
2021
-						if ($object->statut == 0  && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_EDIT_BLOCK)) 
2021
+						if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_EDIT_BLOCK)) 
2022 2022
 						{
2023 2023
 							echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=editline&lineid='.$line->id.'">'.img_edit().'</a>';
2024 2024
 						}								
@@ -2033,7 +2033,7 @@  discard block
 block discarded – undo
2033 2033
 				<?php
2034 2034
 
2035 2035
 				if ($action != 'editline' && $action != 'selectlines') {
2036
-						if ($object->statut == 0  && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK))
2036
+						if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK))
2037 2037
 						{
2038 2038
 
2039 2039
 							if ($object->situation_counter == 1 || !$object->situation_cycle_ref)
@@ -2041,7 +2041,7 @@  discard block
 block discarded – undo
2041 2041
 								echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=ask_deleteline&lineid='.$line->id.'">'.img_delete().'</a>';
2042 2042
 							}
2043 2043
 
2044
-							if(TSubtotal::isTitle($line) && ($object->situation_counter == 1 || !$object->situation_cycle_ref) )
2044
+							if (TSubtotal::isTitle($line) && ($object->situation_counter == 1 || !$object->situation_cycle_ref))
2045 2045
 							{
2046 2046
 								$img_delete = ((float) DOL_VERSION >= 3.8) ? img_picto($langs->trans('deleteWithAllLines'), 'delete_all.3.8@subtotal') : img_picto($langs->trans('deleteWithAllLines'), 'delete_all@subtotal');
2047 2047
 								echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=ask_deleteallline&lineid='.$line->id.'">'.$img_delete.'</a>';
@@ -2052,7 +2052,7 @@  discard block
 block discarded – undo
2052 2052
 			</td>
2053 2053
 			
2054 2054
 			<?php 
2055
-			if ($object->statut == 0  && $createRight && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && TSubtotal::isTitle($line) && $action != 'editline')
2055
+			if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && TSubtotal::isTitle($line) && $action != 'editline')
2056 2056
 			{
2057 2057
 				echo '<td class="subtotal_nc">';
2058 2058
 				echo '<input id="subtotal_nc-'.$line->id.'" class="subtotal_nc_chkbx" data-lineid="'.$line->id.'" type="checkbox" name="subtotal_nc" value="1" '.(!empty($line->array_options['options_subtotal_nc']) ? 'checked="checked"' : '').' />';
@@ -2063,11 +2063,11 @@  discard block
 block discarded – undo
2063 2063
 			<td align="center" class="tdlineupdown">
2064 2064
 			</td>
2065 2065
 			<?php } else { ?>
2066
-			<td align="center"<?php echo ((empty($conf->browser->phone) && ($object->statut == 0  && $createRight ))?' class="tdlineupdown"':''); ?>></td>
2066
+			<td align="center"<?php echo ((empty($conf->browser->phone) && ($object->statut == 0 && $createRight)) ? ' class="tdlineupdown"' : ''); ?>></td>
2067 2067
 			<?php } ?>
2068 2068
 
2069
-			<?php  if($action == 'selectlines'){ // dolibarr 8 ?>
2070
-			<td class="linecolcheck" align="center"><input type="checkbox" class="linecheckbox" name="line_checkbox[<?php echo $i+1; ?>]" value="<?php echo $line->id; ?>" ></td>
2069
+			<?php  if ($action == 'selectlines') { // dolibarr 8 ?>
2070
+			<td class="linecolcheck" align="center"><input type="checkbox" class="linecheckbox" name="line_checkbox[<?php echo $i + 1; ?>]" value="<?php echo $line->id; ?>" ></td>
2071 2071
 			<?php } ?>
2072 2072
 
2073 2073
 			</tr>
@@ -2075,29 +2075,29 @@  discard block
 block discarded – undo
2075 2075
 			
2076 2076
 			
2077 2077
 			// Affichage des extrafields à la Dolibarr (car sinon non affiché sur les titres)
2078
-			if(TSubtotal::isTitle($line) && !empty($conf->global->SUBTOTAL_ALLOW_EXTRAFIELDS_ON_TITLE)) {
2078
+			if (TSubtotal::isTitle($line) && !empty($conf->global->SUBTOTAL_ALLOW_EXTRAFIELDS_ON_TITLE)) {
2079 2079
 				
2080
-				require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
2080
+				require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
2081 2081
 				
2082 2082
 				// Extrafields
2083 2083
 				$extrafieldsline = new ExtraFields($db);
2084 2084
 				$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
2085 2085
 				
2086
-				$colspan+=3; $mode = 'view';
2087
-				if($action === 'editline' && $line->rowid == GETPOST('lineid')) $mode = 'edit';
2086
+				$colspan += 3; $mode = 'view';
2087
+				if ($action === 'editline' && $line->rowid == GETPOST('lineid')) $mode = 'edit';
2088 2088
 				
2089 2089
 				$ex_element = $line->element;
2090 2090
 				$line->element = 'tr_extrafield_title '.$line->element; // Pour pouvoir manipuler ces tr
2091
-				print $line->showOptionals($extrafieldsline, $mode, array('style'=>' style="background:#eeffee;" ','colspan'=>$colspan));
2091
+				print $line->showOptionals($extrafieldsline, $mode, array('style'=>' style="background:#eeffee;" ', 'colspan'=>$colspan));
2092 2092
 				$isExtraSelected = false;
2093
-				foreach($line->array_options as $option) {
2094
-					if(!empty($option) && $option != "-1") {
2093
+				foreach ($line->array_options as $option) {
2094
+					if (!empty($option) && $option != "-1") {
2095 2095
 						$isExtraSelected = true;
2096 2096
 						break;
2097 2097
 					}
2098 2098
 				}
2099 2099
 				
2100
-				if($mode === 'edit') {
2100
+				if ($mode === 'edit') {
2101 2101
 					?>
2102 2102
 					<script>
2103 2103
 						$(document).ready(function(){
@@ -2105,7 +2105,7 @@  discard block
 block discarded – undo
2105 2105
 							var all_tr_extrafields = $("tr.tr_extrafield_title");
2106 2106
 							<?php 
2107 2107
 							// Si un extrafield est rempli alors on affiche directement les extrafields
2108
-							if(!$isExtraSelected) {
2108
+							if (!$isExtraSelected) {
2109 2109
 								echo 'all_tr_extrafields.hide();';
2110 2110
 								echo 'var trad = "'.$langs->trans('showExtrafields').'";';
2111 2111
 								echo 'var extra = 0;';
@@ -2151,20 +2151,20 @@  discard block
 block discarded – undo
2151 2151
 
2152 2152
 	
2153 2153
 	function addMoreActionsButtons($parameters, &$object, &$action, $hookmanager) {
2154
-		global $conf,$langs;
2154
+		global $conf, $langs;
2155 2155
 		 
2156 2156
 		if ($object->statut == 0 && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && $action != 'editline')
2157 2157
 		{
2158 2158
 		    
2159
-		    if($object->element == 'invoice_supplier' || $object->element == 'order_supplier')
2159
+		    if ($object->element == 'invoice_supplier' || $object->element == 'order_supplier')
2160 2160
 		    {
2161 2161
 		        foreach ($object->lines as $line)
2162 2162
 		        {
2163 2163
 		            // fetch optionals attributes and labels
2164 2164
 		            require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
2165
-		            $extrafields=new ExtraFields($this->db);
2166
-		            $extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true);
2167
-		            $line->fetch_optionals($line->id,$extralabels);
2165
+		            $extrafields = new ExtraFields($this->db);
2166
+		            $extralabels = $extrafields->fetch_name_optionals_label($object->table_element_line, true);
2167
+		            $line->fetch_optionals($line->id, $extralabels);
2168 2168
 		        }
2169 2169
 		    }
2170 2170
 		    
@@ -2264,23 +2264,23 @@  discard block
 block discarded – undo
2264 2264
 	    $ThtmlData['data-qty']          = 0; //$line->qty;
2265 2265
 	    $ThtmlData['data-level']        = TSubtotal::getNiveau($line);
2266 2266
 	    
2267
-	    if(TSubtotal::isTitle($line)){
2267
+	    if (TSubtotal::isTitle($line)) {
2268 2268
 	        $ThtmlData['data-issubtotal'] = 'title';
2269
-	    }elseif(TSubtotal::isSubtotal($line)){
2269
+	    }elseif (TSubtotal::isSubtotal($line)) {
2270 2270
 	        $ThtmlData['data-issubtotal'] = 'subtotal';
2271 2271
 	    }
2272
-	    else{
2272
+	    else {
2273 2273
 	        $ThtmlData['data-issubtotal'] = 'freetext';
2274 2274
 	    }
2275 2275
 	    
2276 2276
 	    
2277 2277
 	    // Change or add data  from hooks
2278
-	    $parameters = array_replace($parameters , array(  'ThtmlData' => $ThtmlData )  );
2278
+	    $parameters = array_replace($parameters, array('ThtmlData' => $ThtmlData));
2279 2279
 	    
2280 2280
 	    // hook 
2281
-	    $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
2281
+	    $reshook = $hookmanager->executeHooks('subtotalLineHtmlData', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
2282 2282
 	    if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
2283
-	    if ($reshook>0)
2283
+	    if ($reshook > 0)
2284 2284
 	    {
2285 2285
 	        $ThtmlData = $hookmanager->resArray;
2286 2286
 	    }
@@ -2293,14 +2293,14 @@  discard block
 block discarded – undo
2293 2293
 	function implodeHtmlData($ThtmlData = array())
2294 2294
 	{
2295 2295
 	    $data = '';
2296
-	    foreach($ThtmlData as $k => $h )
2296
+	    foreach ($ThtmlData as $k => $h)
2297 2297
 	    {
2298
-	        if(is_array($h))
2298
+	        if (is_array($h))
2299 2299
 	        {
2300 2300
 	            $h = json_encode($h);
2301 2301
 	        }
2302 2302
 	        
2303
-	        $data .= $k . '="'.dol_htmlentities($h, ENT_QUOTES).'" ';
2303
+	        $data .= $k.'="'.dol_htmlentities($h, ENT_QUOTES).'" ';
2304 2304
 	    }
2305 2305
 	    
2306 2306
 	    return $data;
@@ -2308,26 +2308,26 @@  discard block
 block discarded – undo
2308 2308
 	
2309 2309
 	function _ajax_block_order_js($object)
2310 2310
 	{
2311
-	    global $conf,$tagidfortablednd,$filepath,$langs;
2311
+	    global $conf, $tagidfortablednd, $filepath, $langs;
2312 2312
 	    
2313 2313
 	    /*
2314 2314
 	     * this part of js is base on dolibarr htdocs/core/tpl/ajaxrow.tpl.php 
2315 2315
 	     * for compatibility reasons we don't use tableDnD but jquery sortable
2316 2316
 	     */
2317 2317
 	    
2318
-	    $id=$object->id;
2319
-	    $nboflines=(isset($object->lines)?count($object->lines):0);
2320
-	    $forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1;
2318
+	    $id = $object->id;
2319
+	    $nboflines = (isset($object->lines) ?count($object->lines) : 0);
2320
+	    $forcereloadpage = empty($conf->global->MAIN_FORCE_RELOAD_PAGE) ? 0 : 1;
2321 2321
 	    
2322
-	    $id=$object->id;
2323
-	    $fk_element=$object->fk_element;
2324
-	    $table_element_line=$object->table_element_line;
2325
-	    $nboflines=(isset($object->lines)?count($object->lines):(empty($nboflines)?0:$nboflines));
2326
-	    $tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd);
2327
-	    $filepath=(empty($filepath)?'':$filepath);
2322
+	    $id = $object->id;
2323
+	    $fk_element = $object->fk_element;
2324
+	    $table_element_line = $object->table_element_line;
2325
+	    $nboflines = (isset($object->lines) ?count($object->lines) : (empty($nboflines) ? 0 : $nboflines));
2326
+	    $tagidfortablednd = (empty($tagidfortablednd) ? 'tablelines' : $tagidfortablednd);
2327
+	    $filepath = (empty($filepath) ? '' : $filepath);
2328 2328
 	    
2329 2329
 	    
2330
-	    if (GETPOST('action','aZ09') != 'editline' && $nboflines > 1)
2330
+	    if (GETPOST('action', 'aZ09') != 'editline' && $nboflines > 1)
2331 2331
 	    {
2332 2332
 	        
2333 2333
 	        ?>
@@ -2345,7 +2345,7 @@  discard block
 block discarded – undo
2345 2345
 				moveBlockCol.disableSelection(); // prevent selection
2346 2346
 <?php if ($object->statut == 0) { ?>
2347 2347
 				// apply some graphical stuff
2348
-				moveBlockCol.css("background-image",'url(<?php echo dol_buildpath('subtotal/img/grip_all.png',2);  ?>)');
2348
+				moveBlockCol.css("background-image",'url(<?php echo dol_buildpath('subtotal/img/grip_all.png', 2); ?>)');
2349 2349
 				moveBlockCol.css("background-repeat","no-repeat");
2350 2350
 				moveBlockCol.css("background-position","center center");
2351 2351
 				moveBlockCol.css("cursor","move");
Please login to merge, or discard this patch.
Braces   +347 added lines, -214 removed lines patch added patch discarded remove patch
@@ -25,7 +25,9 @@  discard block
 block discarded – undo
25 25
 				$value = '';
26 26
 				$sql = 'SELECT content FROM '.MAIN_DB_PREFIX.'c_subtotal_free_text WHERE rowid = '.GETPOST('rowid');
27 27
 				$resql = $this->db->query($sql);
28
-				if ($resql && ($obj = $this->db->fetch_object($resql))) $value = $obj->content;
28
+				if ($resql && ($obj = $this->db->fetch_object($resql))) {
29
+					$value = $obj->content;
30
+				}
29 31
 			}
30 32
 			
31 33
 			?>
@@ -109,8 +111,11 @@  discard block
 block discarded – undo
109 111
 			if ($object->statut == 0  && $createRight) {
110 112
 			
111 113
 
112
-				if($object->element=='facture')$idvar = 'facid';
113
-				else $idvar='id';
114
+				if($object->element=='facture') {
115
+					$idvar = 'facid';
116
+				} else {
117
+					$idvar='id';
118
+				}
114 119
 				
115 120
 				if(in_array($action, array('add_title_line', 'add_total_line', 'add_subtitle_line', 'add_subtotal_line', 'add_free_text')) )
116 121
 				{
@@ -118,10 +123,11 @@  discard block
 block discarded – undo
118 123
 					
119 124
 					if($action=='add_title_line') {
120 125
 						$title = GETPOST('title');
121
-						if(empty($title)) $title = $langs->trans('title');
126
+						if(empty($title)) {
127
+							$title = $langs->trans('title');
128
+						}
122 129
 						$qty = $level<1 ? 1 : $level ;
123
-					}
124
-					else if($action=='add_free_text') {
130
+					} else if($action=='add_free_text') {
125 131
 						$title = GETPOST('title');
126 132
 
127 133
 						if (empty($title)) {
@@ -133,29 +139,31 @@  discard block
 block discarded – undo
133 139
 								}
134 140
 							}
135 141
 						}
136
-						if(empty($title)) $title = $langs->trans('subtotalAddLineDescription');
142
+						if(empty($title)) {
143
+							$title = $langs->trans('subtotalAddLineDescription');
144
+						}
137 145
 						$qty = 50;
138
-					}
139
-					else if($action=='add_subtitle_line') {
146
+					} else if($action=='add_subtitle_line') {
140 147
 						$title = GETPOST('title');
141
-						if(empty($title)) $title = $langs->trans('subtitle');
148
+						if(empty($title)) {
149
+							$title = $langs->trans('subtitle');
150
+						}
142 151
 						$qty = 2;
143
-					}
144
-					else if($action=='add_subtotal_line') {
152
+					} else if($action=='add_subtotal_line') {
145 153
 						$title = $langs->trans('SubSubTotal');
146 154
 						$qty = 98;
147
-					}
148
-					else {
155
+					} else {
149 156
 						$title = GETPOST('title') ? GETPOST('title') : $langs->trans('SubTotal');
150 157
 						$qty = $level ? 100-$level : 99;
151 158
 					}
152 159
 					dol_include_once('/subtotal/class/subtotal.class.php');
153 160
 					
154
-					if (!empty($conf->global->SUBTOTAL_AUTO_ADD_SUBTOTAL_ON_ADDING_NEW_TITLE) && $qty < 10) TSubtotal::addSubtotalMissing($object, $qty);
161
+					if (!empty($conf->global->SUBTOTAL_AUTO_ADD_SUBTOTAL_ON_ADDING_NEW_TITLE) && $qty < 10) {
162
+						TSubtotal::addSubtotalMissing($object, $qty);
163
+					}
155 164
 					
156 165
 	    			TSubtotal::addSubTotalLine($object, $title, $qty);
157
-				}
158
-				else if($action==='ask_deleteallline') {
166
+				} else if($action==='ask_deleteallline') {
159 167
 						$form=new Form($db);
160 168
 						
161 169
 						$lineid = GETPOST('lineid','integer');
@@ -178,8 +186,7 @@  discard block
 block discarded – undo
178 186
 					$this->printNewFormat($object, $conf, $langs, $idvar);
179 187
 				}
180 188
 			}
181
-		}
182
-		elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice',$contexts))
189
+		} elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice',$contexts))
183 190
 		{
184 191
 			?>
185 192
 			<script type="text/javascript">
@@ -197,8 +204,13 @@  discard block
 block discarded – undo
197 204
      
198 205
 	function printNewFormat(&$object, &$conf, &$langs, $idvar)
199 206
 	{
200
-		if (empty($conf->global->SUBTOTAL_ALLOW_ADD_BLOCK)) return false;
201
-		if (!empty($object->situation_cycle_ref) && $object->situation_counter > 1) return false; // Si facture de situation
207
+		if (empty($conf->global->SUBTOTAL_ALLOW_ADD_BLOCK)) {
208
+			return false;
209
+		}
210
+		if (!empty($object->situation_cycle_ref) && $object->situation_counter > 1) {
211
+			return false;
212
+		}
213
+		// Si facture de situation
202 214
 		?>
203 215
 		 	<script type="text/javascript">
204 216
 				$(document).ready(function() {
@@ -484,8 +496,7 @@  discard block
 block discarded – undo
484 496
 				}
485 497
 				
486 498
 				
487
-			}	
488
-			else{
499
+			} else{
489 500
 				$substitutionarray['line_not_modsubtotal'] = true;
490 501
 				$substitutionarray['line_modsubtotal'] = 0;
491 502
 			}
@@ -543,8 +554,11 @@  discard block
 block discarded – undo
543 554
 		
544 555
 		$showBlockExtrafields = GETPOST('showBlockExtrafields');
545 556
 		
546
-		if($object->element=='facture') $idvar = 'facid';
547
-		else $idvar = 'id';
557
+		if($object->element=='facture') {
558
+			$idvar = 'facid';
559
+		} else {
560
+			$idvar = 'id';
561
+		}
548 562
 			
549 563
 		if ($action == 'updateligne' || $action == 'updateline')
550 564
 		{
@@ -574,8 +588,7 @@  discard block
 block discarded – undo
574 588
 				header('Location: '.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id);
575 589
 				exit; // Surtout ne pas laisser Dolibarr faire du traitement sur le updateligne sinon ça plante les données de la ligne
576 590
 			}
577
-		}
578
-		else if($action === 'builddoc') {
591
+		} else if($action === 'builddoc') {
579 592
 			
580 593
 			if (
581 594
 				in_array('invoicecard',explode(':',$parameters['context']))
@@ -590,33 +603,27 @@  discard block
 block discarded – undo
590 603
 					$sessname = 'subtotal_hideInnerLines_facture';	
591 604
 					$sessname2 = 'subtotal_hidedetails_facture';
592 605
 					$sessname3 = 'subtotal_hideprices_facture';
593
-				}
594
-				elseif(in_array('invoicesuppliercard',explode(':',$parameters['context']))) {
606
+				} elseif(in_array('invoicesuppliercard',explode(':',$parameters['context']))) {
595 607
 				    $sessname = 'subtotal_hideInnerLines_facture_fournisseur';
596 608
 				    $sessname2 = 'subtotal_hidedetails_facture_fournisseur';
597 609
 				    $sessname3 = 'subtotal_hideprices_facture_fournisseur';
598
-				}
599
-				elseif(in_array('propalcard',explode(':',$parameters['context']))) {
610
+				} elseif(in_array('propalcard',explode(':',$parameters['context']))) {
600 611
 					$sessname = 'subtotal_hideInnerLines_propal';
601 612
 					$sessname2 = 'subtotal_hidedetails_propal';	
602 613
 					$sessname3 = 'subtotal_hideprices_propal';
603
-				}
604
-				elseif(in_array('supplier_proposalcard',explode(':',$parameters['context']))) {
614
+				} elseif(in_array('supplier_proposalcard',explode(':',$parameters['context']))) {
605 615
 				    $sessname = 'subtotal_hideInnerLines_supplier_proposal';
606 616
 				    $sessname2 = 'subtotal_hidedetails_supplier_proposal';
607 617
 				    $sessname3 = 'subtotal_hideprices_supplier_proposal';
608
-				}
609
-				elseif(in_array('ordercard',explode(':',$parameters['context']))) {
618
+				} elseif(in_array('ordercard',explode(':',$parameters['context']))) {
610 619
 					$sessname = 'subtotal_hideInnerLines_commande';
611 620
 					$sessname2 = 'subtotal_hidedetails_commande';	
612 621
 					$sessname3 = 'subtotal_hideprices_commande';
613
-				}
614
-				elseif(in_array('ordersuppliercard',explode(':',$parameters['context']))) {
622
+				} elseif(in_array('ordersuppliercard',explode(':',$parameters['context']))) {
615 623
 				    $sessname = 'subtotal_hideInnerLines_commande_fournisseur';
616 624
 				    $sessname2 = 'subtotal_hidedetails_commande_fournisseur';
617 625
 				    $sessname3 = 'subtotal_hideprices_commande_fournisseur';
618
-				}
619
-				else {
626
+				} else {
620 627
 					$sessname = 'subtotal_hideInnerLines_unknown';
621 628
 					$sessname2 = 'subtotal_hidedetails_unknown';
622 629
 					$sessname3 = 'subtotal_hideprices_unknown';
@@ -638,8 +645,7 @@  discard block
 block discarded – undo
638 645
 					    
639 646
                         if($line->qty>=90) {
640 647
                             $line->modsubtotal_total = 1;
641
-                        }
642
-                        else{
648
+                        } else{
643 649
                             $line->modsubtotal_title = 1;
644 650
                         }
645 651
                         
@@ -648,8 +654,7 @@  discard block
 block discarded – undo
648 654
 	        	}
649 655
 	        }
650 656
 			
651
-		}
652
-		else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') {
657
+		} else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') {
653 658
 			
654 659
 			$Tab = $this->getArrayOfLineForAGroup($object, GETPOST('lineid'));
655 660
 			
@@ -657,7 +662,9 @@  discard block
 block discarded – undo
657 662
 				/**
658 663
 				 * @var $object Facture
659 664
 				 */
660
-				if($object->element=='facture') $object->deleteline($idLine);
665
+				if($object->element=='facture') {
666
+					$object->deleteline($idLine);
667
+				}
661 668
 				/**
662 669
 				 * @var $object Facture fournisseur
663 670
 				 */
@@ -668,18 +675,25 @@  discard block
 block discarded – undo
668 675
 				/**
669 676
 				 * @var $object Propal
670 677
 				 */
671
-				else if($object->element=='propal') $object->deleteline($idLine);
678
+				else if($object->element=='propal') {
679
+					$object->deleteline($idLine);
680
+				}
672 681
 				/**
673 682
 				 * @var $object Propal Fournisseur
674 683
 				 */
675
-				else if($object->element=='supplier_proposal') $object->deleteline($idLine);
684
+				else if($object->element=='supplier_proposal') {
685
+					$object->deleteline($idLine);
686
+				}
676 687
 				/**
677 688
 				 * @var $object Commande
678 689
 				 */
679 690
 				else if($object->element=='commande') 
680 691
 				{
681
-					if ((float) DOL_VERSION >= 5.0) $object->deleteline($user, $idLine);
682
-					else $object->deleteline($idLine);
692
+					if ((float) DOL_VERSION >= 5.0) {
693
+						$object->deleteline($user, $idLine);
694
+					} else {
695
+						$object->deleteline($idLine);
696
+					}
683 697
 				}
684 698
 				/**
685 699
 				 * @var $object Commande fournisseur
@@ -691,21 +705,26 @@  discard block
 block discarded – undo
691 705
 				/**
692 706
 				 * @var $object Facturerec
693 707
 				 */
694
-				else if($object->element=='facturerec') $object->deleteline($idLine);
708
+				else if($object->element=='facturerec') {
709
+					$object->deleteline($idLine);
710
+				}
695 711
 			}
696 712
 			
697 713
 			header('location:?id='.$object->id);
698 714
 			exit;
699 715
 			
700
-		}
701
-		else if ($action == 'duplicate')
716
+		} else if ($action == 'duplicate')
702 717
 		{
703 718
 			$lineid = GETPOST('lineid', 'int');
704 719
 			$nbDuplicate = TSubtotal::duplicateLines($object, $lineid, true);
705 720
 			
706
-			if ($nbDuplicate > 0) setEventMessage($langs->trans('subtotal_duplicate_success', $nbDuplicate));
707
-			elseif ($nbDuplicate == 0) setEventMessage($langs->trans('subtotal_duplicate_lineid_not_found'), 'warnings');
708
-			else setEventMessage($langs->trans('subtotal_duplicate_error'), 'errors');
721
+			if ($nbDuplicate > 0) {
722
+				setEventMessage($langs->trans('subtotal_duplicate_success', $nbDuplicate));
723
+			} elseif ($nbDuplicate == 0) {
724
+				setEventMessage($langs->trans('subtotal_duplicate_lineid_not_found'), 'warnings');
725
+			} else {
726
+				setEventMessage($langs->trans('subtotal_duplicate_error'), 'errors');
727
+			}
709 728
 			
710 729
 			header('Location: ?id='.$object->id);
711 730
 			exit;
@@ -785,17 +804,18 @@  discard block
 block discarded – undo
785 804
 			//print $l->rang.'>='.$rang.' '.$total.'<br/>';
786 805
 			if($l->rang>=$rang) {
787 806
 				//echo 'return!<br>';
788
-				if (!$return_all) return $total;
789
-				else return array($total, $total_tva, $total_ttc, $TTotal_tva);
790
-			}
791
-			else if(TSubtotal::isTitle($l, 100 - $qty_line)) 
807
+				if (!$return_all) {
808
+					return $total;
809
+				} else {
810
+					return array($total, $total_tva, $total_ttc, $TTotal_tva);
811
+				}
812
+			} else if(TSubtotal::isTitle($l, 100 - $qty_line)) 
792 813
 		  	{
793 814
 				$total = 0;
794 815
 				$total_tva = 0;
795 816
 				$total_ttc = 0;
796 817
 				$TTotal_tva = array();
797
-			}
798
-			elseif(!TSubtotal::isTitle($l) && !TSubtotal::isSubtotal($l)) {
818
+			} elseif(!TSubtotal::isTitle($l) && !TSubtotal::isSubtotal($l)) {
799 819
 				$total += $l->total_ht;
800 820
 				$total_tva += $l->total_tva;
801 821
 				$TTotal_tva[$l->tva_tx] += $l->total_tva;
@@ -803,8 +823,11 @@  discard block
 block discarded – undo
803 823
 			}
804 824
 			
805 825
 		}
806
-		if (!$return_all) return $total;
807
-		else return array($total, $total_tva, $total_ttc, $TTotal_tva);
826
+		if (!$return_all) {
827
+			return $total;
828
+		} else {
829
+			return array($total, $total_tva, $total_ttc, $TTotal_tva);
830
+		}
808 831
 	}
809 832
 
810 833
 	/*
@@ -872,15 +895,18 @@  discard block
 block discarded – undo
872 895
 		}
873 896
 		
874 897
 			
875
-		if($line->qty==99)
876
-			$pdf->SetFillColor(220,220,220);
877
-		elseif ($line->qty==98)
878
-			$pdf->SetFillColor(230,230,230);
879
-		else
880
-			$pdf->SetFillColor(240,240,240);
898
+		if($line->qty==99) {
899
+					$pdf->SetFillColor(220,220,220);
900
+		} elseif ($line->qty==98) {
901
+					$pdf->SetFillColor(230,230,230);
902
+		} else {
903
+					$pdf->SetFillColor(240,240,240);
904
+		}
881 905
 		
882 906
 		$style = 'B';
883
-		if (!empty($conf->global->SUBTOTAL_SUBTOTAL_STYLE)) $style = $conf->global->SUBTOTAL_SUBTOTAL_STYLE;
907
+		if (!empty($conf->global->SUBTOTAL_SUBTOTAL_STYLE)) {
908
+			$style = $conf->global->SUBTOTAL_SUBTOTAL_STYLE;
909
+		}
884 910
 		
885 911
 		$pdf->SetFont('', $style, 9);
886 912
 		
@@ -919,8 +945,7 @@  discard block
 block discarded – undo
919 945
 //					$line->total_tva
920 946
 //					$line->total
921 947
 //					$line->total_ttc
922
-				}
923
-				else
948
+				} else
924 949
 				{
925 950
 					list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1);
926 951
                                         if(get_class($object) == 'Facture' && $object->type==Facture::TYPE_SITUATION){//Facture de situation
@@ -937,11 +962,14 @@  discard block
 block discarded – undo
937 962
 			}
938 963
 
939 964
 			$pdf->SetXY($pdf->postotalht, $posy);
940
-			if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin);
965
+			if($set_pagebreak_margin) {
966
+				$pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin);
967
+			}
941 968
 			$pdf->MultiCell($pdf->page_largeur-$pdf->marge_droite-$pdf->postotalht, 3, $total_to_print, 0, 'R', 0);
942
-		}
943
-		else{
944
-			if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin);
969
+		} else{
970
+			if($set_pagebreak_margin) {
971
+				$pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin);
972
+			}
945 973
 		}
946 974
 		
947 975
 		$posy = $posy + $cell_height;
@@ -973,25 +1001,40 @@  discard block
 block discarded – undo
973 1001
 		
974 1002
  
975 1003
 		$style = ($line->qty==1) ? 'BU' : 'BUI';
976
-		if (!empty($conf->global->SUBTOTAL_TITLE_STYLE)) $style = $conf->global->SUBTOTAL_TITLE_STYLE;
1004
+		if (!empty($conf->global->SUBTOTAL_TITLE_STYLE)) {
1005
+			$style = $conf->global->SUBTOTAL_TITLE_STYLE;
1006
+		}
977 1007
 		
978 1008
 		if($hideInnerLines) {
979
-			if($line->qty==1)$pdf->SetFont('', $style, 9);
980
-			else 
1009
+			if($line->qty==1) {
1010
+				$pdf->SetFont('', $style, 9);
1011
+			} else 
981 1012
 			{
982
-				if (!empty($conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES)) $style = $conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES;
1013
+				if (!empty($conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES)) {
1014
+					$style = $conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES;
1015
+				}
983 1016
 				$pdf->SetFont('', $style, 9);
984 1017
 			}
985
-		}
986
-		else {
1018
+		} else {
987 1019
 
988
-			if($line->qty==1)$pdf->SetFont('', $style, 9); //TODO if super utile
989
-			else $pdf->SetFont('', $style, 9);
1020
+			if($line->qty==1) {
1021
+				$pdf->SetFont('', $style, 9);
1022
+			}
1023
+			//TODO if super utile
1024
+			else {
1025
+				$pdf->SetFont('', $style, 9);
1026
+			}
990 1027
 			
991 1028
 		}
992 1029
 		
993
-		if ($label === strip_tags($label) && $label === dol_html_entity_decode($label, ENT_QUOTES)) $pdf->MultiCell($w, $h, $label, 0, 'L'); // Pas de HTML dans la chaine
994
-		else $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J',true); // et maintenant avec du HTML
1030
+		if ($label === strip_tags($label) && $label === dol_html_entity_decode($label, ENT_QUOTES)) {
1031
+			$pdf->MultiCell($w, $h, $label, 0, 'L');
1032
+		}
1033
+		// Pas de HTML dans la chaine
1034
+		else {
1035
+			$pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J',true);
1036
+		}
1037
+		// et maintenant avec du HTML
995 1038
 		
996 1039
 		if($description && !$hidedesc) {
997 1040
 			$posy = $pdf->GetY();
@@ -1015,8 +1058,7 @@  discard block
 block discarded – undo
1015 1058
 		
1016 1059
 		if(is_array($parameters)) {
1017 1060
 			$i = & $parameters['i'];	
1018
-		}
1019
-		else {
1061
+		} else {
1020 1062
 			$i = (int)$parameters;
1021 1063
 		}
1022 1064
 		
@@ -1038,17 +1080,14 @@  discard block
 block discarded – undo
1038 1080
 			
1039 1081
 			if((float)DOL_VERSION<=3.6) {
1040 1082
 				return '';
1041
-			}
1042
-			else if((float)DOL_VERSION>=3.8) {
1083
+			} else if((float)DOL_VERSION>=3.8) {
1043 1084
 				return 1;
1044 1085
 			}
1045 1086
 			
1046
-		}
1047
-		elseif(!empty($hideprices)) {
1087
+		} elseif(!empty($hideprices)) {
1048 1088
 			$this->resprints = $object->lines[$parameters['i']]->qty;
1049 1089
 			return 1;
1050
-		}
1051
-		elseif (!empty($conf->global->SUBTOTAL_IF_HIDE_PRICES_SHOW_QTY))
1090
+		} elseif (!empty($conf->global->SUBTOTAL_IF_HIDE_PRICES_SHOW_QTY))
1052 1091
 		{
1053 1092
 			$hideInnerLines = (int)GETPOST('hideInnerLines');
1054 1093
 			$hidedetails = (int)GETPOST('hidedetails');
@@ -1058,12 +1097,20 @@  discard block
 block discarded – undo
1058 1097
 			}
1059 1098
 		}
1060 1099
 		
1061
-		if(is_array($parameters)) $i = & $parameters['i'];
1062
-		else $i = (int)$parameters;
1100
+		if(is_array($parameters)) {
1101
+			$i = & $parameters['i'];
1102
+		} else {
1103
+			$i = (int)$parameters;
1104
+		}
1063 1105
 
1064
-		if (empty($object->lines[$i])) return 0; // hideInnerLines => override $object->lines et Dolibarr ne nous permet pas de mettre à jour la variable qui conditionne la boucle sur les lignes (PR faite pour 6.0)
1106
+		if (empty($object->lines[$i])) {
1107
+			return 0;
1108
+		}
1109
+		// hideInnerLines => override $object->lines et Dolibarr ne nous permet pas de mettre à jour la variable qui conditionne la boucle sur les lignes (PR faite pour 6.0)
1065 1110
 		
1066
-		if(empty($object->lines[$i]->array_options)) $object->lines[$i]->fetch_optionals();
1111
+		if(empty($object->lines[$i]->array_options)) {
1112
+			$object->lines[$i]->fetch_optionals();
1113
+		}
1067 1114
 
1068 1115
 		if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) )
1069 1116
 		{
@@ -1080,8 +1127,11 @@  discard block
 block discarded – undo
1080 1127
 	function pdf_getlinetotalexcltax($parameters=array(), &$object, &$action='') {
1081 1128
 	    global $conf, $hideprices, $hookmanager;
1082 1129
 		
1083
-		if(is_array($parameters)) $i = & $parameters['i'];
1084
-		else $i = (int)$parameters;
1130
+		if(is_array($parameters)) {
1131
+			$i = & $parameters['i'];
1132
+		} else {
1133
+			$i = (int)$parameters;
1134
+		}
1085 1135
 			
1086 1136
 		if($this->isModSubtotalLine($parameters,$object) ){
1087 1137
 			
@@ -1089,13 +1139,11 @@  discard block
 block discarded – undo
1089 1139
 			
1090 1140
 			if((float)DOL_VERSION<=3.6) {
1091 1141
 				return '';
1092
-			}
1093
-			else if((float)DOL_VERSION>=3.8) {
1142
+			} else if((float)DOL_VERSION>=3.8) {
1094 1143
 				return 1;
1095 1144
 			}
1096 1145
 			
1097
-		}
1098
-		elseif (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS))
1146
+		} elseif (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS))
1099 1147
 		{
1100 1148
 			if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC)))
1101 1149
 			{
@@ -1167,12 +1215,10 @@  discard block
 block discarded – undo
1167 1215
 			$this->error = $hookmanager->error;
1168 1216
 			$this->errors = $hookmanager->errors;
1169 1217
 			return -1;
1170
-		}
1171
-		elseif (empty($reshook))
1218
+		} elseif (empty($reshook))
1172 1219
 		{
1173 1220
 			$this->resprints .= $hookmanager->resprints;
1174
-		}
1175
-		else
1221
+		} else
1176 1222
 		{
1177 1223
 			$this->resprints = $hookmanager->resprints;
1178 1224
 
@@ -1195,14 +1241,16 @@  discard block
 block discarded – undo
1195 1241
 		
1196 1242
 			if((float)DOL_VERSION<=3.6) {
1197 1243
 				return '';
1198
-			}
1199
-			else if((float)DOL_VERSION>=3.8) {
1244
+			} else if((float)DOL_VERSION>=3.8) {
1200 1245
 				return 1;
1201 1246
 			}
1202 1247
 		}
1203 1248
 		
1204
-		if(is_array($parameters)) $i = & $parameters['i'];
1205
-		else $i = (int)$parameters;
1249
+		if(is_array($parameters)) {
1250
+			$i = & $parameters['i'];
1251
+		} else {
1252
+			$i = (int)$parameters;
1253
+		}
1206 1254
 		
1207 1255
 		if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) 
1208 1256
 		{
@@ -1224,14 +1272,16 @@  discard block
 block discarded – undo
1224 1272
 		
1225 1273
 			if((float)DOL_VERSION<=3.6) {
1226 1274
 				return '';
1227
-			}
1228
-			else if((float)DOL_VERSION>=3.8) {
1275
+			} else if((float)DOL_VERSION>=3.8) {
1229 1276
 				return 1;
1230 1277
 			}
1231 1278
 		}
1232 1279
 		
1233
-		if(is_array($parameters)) $i = & $parameters['i'];
1234
-		else $i = (int)$parameters;
1280
+		if(is_array($parameters)) {
1281
+			$i = & $parameters['i'];
1282
+		} else {
1283
+			$i = (int)$parameters;
1284
+		}
1235 1285
 			
1236 1286
 		if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) )
1237 1287
 		{
@@ -1253,13 +1303,15 @@  discard block
 block discarded – undo
1253 1303
 		
1254 1304
 			if((float)DOL_VERSION<=3.6) {
1255 1305
 				return '';
1256
-			}
1257
-			else if((float)DOL_VERSION>=3.8) {
1306
+			} else if((float)DOL_VERSION>=3.8) {
1258 1307
 				return 1;
1259 1308
 			}
1260 1309
 		}
1261
-		if(is_array($parameters)) $i = & $parameters['i'];
1262
-		else $i = (int)$parameters;
1310
+		if(is_array($parameters)) {
1311
+			$i = & $parameters['i'];
1312
+		} else {
1313
+			$i = (int)$parameters;
1314
+		}
1263 1315
 		
1264 1316
 		if (!empty($hideprices) 
1265 1317
 				|| (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) )
@@ -1282,14 +1334,16 @@  discard block
 block discarded – undo
1282 1334
 			$this->resprints = ' ';
1283 1335
 			if((float)DOL_VERSION<=3.6) {
1284 1336
 				return '';
1285
-			}
1286
-			else if((float)DOL_VERSION>=3.8) {
1337
+			} else if((float)DOL_VERSION>=3.8) {
1287 1338
 				return 1;
1288 1339
 			}
1289 1340
 		}
1290 1341
 		
1291
-		if(is_array($parameters)) $i = & $parameters['i'];
1292
-		else $i = (int)$parameters;
1342
+		if(is_array($parameters)) {
1343
+			$i = & $parameters['i'];
1344
+		} else {
1345
+			$i = (int)$parameters;
1346
+		}
1293 1347
 			
1294 1348
 		if (!empty($hideprices)
1295 1349
 				|| (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) )
@@ -1313,16 +1367,21 @@  discard block
 block discarded – undo
1313 1367
 			
1314 1368
 			if((float)DOL_VERSION<=3.6) {
1315 1369
 				return '';
1316
-			}
1317
-			else if((float)DOL_VERSION>=3.8) {
1370
+			} else if((float)DOL_VERSION>=3.8) {
1318 1371
 				return 1;
1319 1372
 			}
1320 1373
 		}
1321 1374
 		
1322
-		if(is_array($parameters)) $i = & $parameters['i'];
1323
-		else $i = (int)$parameters;
1375
+		if(is_array($parameters)) {
1376
+			$i = & $parameters['i'];
1377
+		} else {
1378
+			$i = (int)$parameters;
1379
+		}
1324 1380
 		
1325
-		if (empty($object->lines[$i])) return 0; // hideInnerLines => override $object->lines et Dolibarr ne nous permet pas de mettre à jour la variable qui conditionne la boucle sur les lignes (PR faite pour 6.0)
1381
+		if (empty($object->lines[$i])) {
1382
+			return 0;
1383
+		}
1384
+		// hideInnerLines => override $object->lines et Dolibarr ne nous permet pas de mettre à jour la variable qui conditionne la boucle sur les lignes (PR faite pour 6.0)
1326 1385
 
1327 1386
 		$object->lines[$i]->fetch_optionals();
1328 1387
 		if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) )
@@ -1344,14 +1403,16 @@  discard block
 block discarded – undo
1344 1403
 			$this->resprints = ' ';
1345 1404
 			if((float)DOL_VERSION<=3.6) {
1346 1405
 				return '';
1347
-			}
1348
-			else if((float)DOL_VERSION>=3.8) {
1406
+			} else if((float)DOL_VERSION>=3.8) {
1349 1407
 				return 1;
1350 1408
 			}
1351 1409
 		}
1352 1410
 		
1353
-		if(is_array($parameters)) $i = & $parameters['i'];
1354
-		else $i = (int)$parameters;
1411
+		if(is_array($parameters)) {
1412
+			$i = & $parameters['i'];
1413
+		} else {
1414
+			$i = (int)$parameters;
1415
+		}
1355 1416
 			
1356 1417
 		if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) )
1357 1418
 		{
@@ -1381,7 +1442,9 @@  discard block
 block discarded – undo
1381 1442
 				}
1382 1443
 			}
1383 1444
 			
1384
-			if (!empty($TLineTitle)) $TTitleNumeroted = $this->formatNumerotation($TLineTitle);
1445
+			if (!empty($TLineTitle)) {
1446
+				$TTitleNumeroted = $this->formatNumerotation($TLineTitle);
1447
+			}
1385 1448
 		}
1386 1449
 		
1387 1450
 	}
@@ -1395,8 +1458,12 @@  discard block
 block discarded – undo
1395 1458
 		$j=0;
1396 1459
 		foreach ($TLineTitle as $k => &$line)
1397 1460
 		{
1398
-			if (!empty($line_reference) && $line->rang <= $line_reference->rang) continue;
1399
-			if (!empty($line_reference) && $line->qty <= $line_reference->qty) break;
1461
+			if (!empty($line_reference) && $line->rang <= $line_reference->rang) {
1462
+				continue;
1463
+			}
1464
+			if (!empty($line_reference) && $line->qty <= $line_reference->qty) {
1465
+				break;
1466
+			}
1400 1467
 			
1401 1468
 			if ($line->qty == $level)
1402 1469
 			{
@@ -1430,7 +1497,9 @@  discard block
 block discarded – undo
1430 1497
 		
1431 1498
 		$hidedetails = (int)GETPOST('hidedetails');
1432 1499
 		
1433
-		if(empty($hidedetails)) return false;
1500
+		if(empty($hidedetails)) {
1501
+			return false;
1502
+		}
1434 1503
 		
1435 1504
 		// TODO can't add VAT to document without lines... :-/
1436 1505
 		
@@ -1483,7 +1552,9 @@  discard block
 block discarded – undo
1483 1552
 						*/
1484 1553
 						list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1);
1485 1554
 						
1486
-						if (TSubtotal::getNiveau($line) == 1) $line->TTotal_tva = $TTotal_tva;
1555
+						if (TSubtotal::getNiveau($line) == 1) {
1556
+							$line->TTotal_tva = $TTotal_tva;
1557
+						}
1487 1558
 						$line->total_ht = $total;
1488 1559
 						$line->total_tva = $total_tva;
1489 1560
 						$line->total = $line->total_ht;
@@ -1538,8 +1609,7 @@  discard block
 block discarded – undo
1538 1609
 				    }
1539 1610
 				    
1540 1611
 					
1541
-				}
1542
-				elseif ($hidedetails)
1612
+				} elseif ($hidedetails)
1543 1613
 				{
1544 1614
 					$TLines[] = $line; //Cas où je cache uniquement les prix des produits	
1545 1615
 				}
@@ -1610,7 +1680,9 @@  discard block
 block discarded – undo
1610 1680
 				
1611 1681
 				if(!empty($hideprices)) {
1612 1682
 					foreach($object->lines as &$line) {
1613
-						if($line->fk_product_type!=9) $line->fk_parent_line = -1;	
1683
+						if($line->fk_product_type!=9) {
1684
+							$line->fk_parent_line = -1;
1685
+						}
1614 1686
 					}
1615 1687
 				}
1616 1688
 			
@@ -1631,7 +1703,9 @@  discard block
 block discarded – undo
1631 1703
 				
1632 1704
 				if($line->qty>90) {
1633 1705
 					
1634
-					if ($conf->global->SUBTOTAL_USE_NEW_FORMAT)	$label .= ' '.$this->getTitle($object, $line);
1706
+					if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) {
1707
+						$label .= ' '.$this->getTitle($object, $line);
1708
+					}
1635 1709
 					
1636 1710
 					$pageBefore = $pdf->getPage();
1637 1711
 					$this->pdf_add_total($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h);
@@ -1649,8 +1723,7 @@  discard block
 block discarded – undo
1649 1723
 				
1650 1724
 					$posy = $pdf->GetY();
1651 1725
 					return 1;
1652
-				}	
1653
-				else if ($line->qty < 10) {
1726
+				} else if ($line->qty < 10) {
1654 1727
 					$pageBefore = $pdf->getPage();
1655 1728
 
1656 1729
 					$this->pdf_add_title($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); 
@@ -1674,8 +1747,7 @@  discard block
 block discarded – undo
1674 1747
 //	if($line->rowid==47) exit;
1675 1748
 			
1676 1749
 			return 0;
1677
-		}
1678
-		elseif (empty($object->lines[$parameters['i']]))
1750
+		} elseif (empty($object->lines[$parameters['i']]))
1679 1751
 		{
1680 1752
 			$this->resprints = -1;
1681 1753
 		}
@@ -1708,7 +1780,9 @@  discard block
 block discarded – undo
1708 1780
 		
1709 1781
 		foreach ($object->lines as $line)
1710 1782
 		{
1711
-			if ($line->id == $currentLine->id) break;
1783
+			if ($line->id == $currentLine->id) {
1784
+				break;
1785
+			}
1712 1786
 			
1713 1787
 			$qty_search = 100 - $currentLine->qty;
1714 1788
 			
@@ -1745,23 +1819,23 @@  discard block
 block discarded – undo
1745 1819
 		{
1746 1820
 			$object->statut = 0; // hack for facture rec
1747 1821
 			$createRight = $user->rights->facture->creer;
1748
-		}
1749
-		elseif($object->element == 'order_supplier' )
1822
+		} elseif($object->element == 'order_supplier' )
1750 1823
 		{
1751 1824
 		    $createRight = $user->rights->fournisseur->commande->creer;
1752
-		}
1753
-		elseif($object->element == 'invoice_supplier' )
1825
+		} elseif($object->element == 'invoice_supplier' )
1754 1826
 		{
1755 1827
 		    $createRight = $user->rights->fournisseur->facture->creer;
1756 1828
 		}
1757 1829
 		
1758 1830
 		if($line->special_code!=$this->module_number || $line->product_type!=9) {
1759 1831
 			null;
1760
-		}	
1761
-		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)) 
1832
+		} 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)) 
1762 1833
         {
1763
-			if($object->element=='facture')$idvar = 'facid';
1764
-			else $idvar='id';
1834
+			if($object->element=='facture') {
1835
+				$idvar = 'facid';
1836
+			} else {
1837
+				$idvar='id';
1838
+			}
1765 1839
 			
1766 1840
 			if((float)DOL_VERSION <= 3.4)
1767 1841
 			{
@@ -1787,20 +1861,44 @@  discard block
 block discarded – undo
1787 1861
 				<?php
1788 1862
 			}
1789 1863
 			
1790
-			if(empty($line->description)) $line->description = $line->desc;
1864
+			if(empty($line->description)) {
1865
+				$line->description = $line->desc;
1866
+			}
1791 1867
 			
1792 1868
 			$colspan = 5;
1793
-			if($object->element == 'facturerec' ) $colspan = 3;
1794
-			if($object->element == 'order_supplier') $colspan = 3;
1795
-			if($object->element == 'invoice_supplier') $colspan = 4;
1796
-			if($object->element == 'supplier_proposal') $colspan = 4;
1797
-			if(!empty($conf->multicurrency->enabled)) $colspan+=2;
1798
-			if($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) $colspan++;
1799
-			if(!empty($conf->margin->enabled)) $colspan++;
1800
-			if(!empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++;
1801
-			if(!empty($conf->global->DISPLAY_MARK_RATES)) $colspan++;
1802
-			if($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) $colspan++;
1803
-			if(!empty($conf->global->PRODUCT_USE_UNITS)) $colspan++;
1869
+			if($object->element == 'facturerec' ) {
1870
+				$colspan = 3;
1871
+			}
1872
+			if($object->element == 'order_supplier') {
1873
+				$colspan = 3;
1874
+			}
1875
+			if($object->element == 'invoice_supplier') {
1876
+				$colspan = 4;
1877
+			}
1878
+			if($object->element == 'supplier_proposal') {
1879
+				$colspan = 4;
1880
+			}
1881
+			if(!empty($conf->multicurrency->enabled)) {
1882
+				$colspan+=2;
1883
+			}
1884
+			if($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) {
1885
+				$colspan++;
1886
+			}
1887
+			if(!empty($conf->margin->enabled)) {
1888
+				$colspan++;
1889
+			}
1890
+			if(!empty($conf->global->DISPLAY_MARGIN_RATES)) {
1891
+				$colspan++;
1892
+			}
1893
+			if(!empty($conf->global->DISPLAY_MARK_RATES)) {
1894
+				$colspan++;
1895
+			}
1896
+			if($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) {
1897
+				$colspan++;
1898
+			}
1899
+			if(!empty($conf->global->PRODUCT_USE_UNITS)) {
1900
+				$colspan++;
1901
+			}
1804 1902
 					
1805 1903
 			/* Titre */
1806 1904
 			//var_dump($line);
@@ -1813,23 +1911,36 @@  discard block
 block discarded – undo
1813 1911
 			<tr <?php echo $bc[$var]; $var=!$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php
1814 1912
 					if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT))
1815 1913
 					{
1816
-						if($line->qty==99) print 'background:#adadcf';
1817
-						else if($line->qty==98) print 'background:#ddddff;';
1818
-						else if($line->qty<=97 && $line->qty>=91) print 'background:#eeeeff;';
1819
-						else if($line->qty==1) print 'background:#adadcf;';
1820
-						else if($line->qty==2) print 'background:#ddddff;';
1821
-						else if($line->qty==50) print '';
1822
-						else print 'background:#eeeeff;';
1914
+						if($line->qty==99) {
1915
+							print 'background:#adadcf';
1916
+						} else if($line->qty==98) {
1917
+							print 'background:#ddddff;';
1918
+						} else if($line->qty<=97 && $line->qty>=91) {
1919
+							print 'background:#eeeeff;';
1920
+						} else if($line->qty==1) {
1921
+							print 'background:#adadcf;';
1922
+						} else if($line->qty==2) {
1923
+							print 'background:#ddddff;';
1924
+						} else if($line->qty==50) {
1925
+							print '';
1926
+						} else {
1927
+							print 'background:#eeeeff;';
1928
+						}
1823 1929
 
1824 1930
 						//A compléter si on veux plus de nuances de couleurs avec les niveau 4,5,6,7,8 et 9
1825
-					}
1826
-					else 
1931
+					} else 
1827 1932
 					{
1828
-						if($line->qty==99) print 'background:#ddffdd';
1829
-						else if($line->qty==98) print 'background:#ddddff;';
1830
-						else if($line->qty==2) print 'background:#eeeeff; ';
1831
-						else if($line->qty==50) print '';
1832
-						else print 'background:#eeffee;' ;
1933
+						if($line->qty==99) {
1934
+							print 'background:#ddffdd';
1935
+						} else if($line->qty==98) {
1936
+							print 'background:#ddddff;';
1937
+						} else if($line->qty==2) {
1938
+							print 'background:#eeeeff; ';
1939
+						} else if($line->qty==50) {
1940
+							print '';
1941
+						} else {
1942
+							print 'background:#eeffee;' ;
1943
+						}
1833 1944
 					}
1834 1945
 
1835 1946
 			?>;">
@@ -1852,13 +1963,11 @@  discard block
 block discarded – undo
1852 1963
 							$qty_displayed = $line->qty;
1853 1964
 							print img_picto('', 'subsubtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;color:#0075DE;">'.$qty_displayed.'</span>&nbsp;&nbsp;';
1854 1965
 							
1855
-						}
1856
-						else if (TSubtotal::isSubtotal($line))
1966
+						} else if (TSubtotal::isSubtotal($line))
1857 1967
 						{
1858 1968
 							$qty_displayed = 100 - $line->qty;
1859 1969
 							print img_picto('', 'subsubtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;color:#0075DE;">'.$qty_displayed.'</span>&nbsp;&nbsp;';
1860
-						}
1861
-						else
1970
+						} else
1862 1971
 						{
1863 1972
 							$isFreeText = true;
1864 1973
 						}
@@ -1879,9 +1988,13 @@  discard block
 block discarded – undo
1879 1988
 						}
1880 1989
 
1881 1990
 						$readonlyForSituation = '';
1882
-						if (!empty($object->situation_cycle_ref) && $object->situation_counter > 1) $readonlyForSituation = 'readonly';
1991
+						if (!empty($object->situation_cycle_ref) && $object->situation_counter > 1) {
1992
+							$readonlyForSituation = 'readonly';
1993
+						}
1883 1994
 						
1884
-						if (!$isFreeText) echo '<input type="text" name="line-title" id-line="'.$line->id.'" value="'.$newlabel.'" size="80" '.$readonlyForSituation.'/>&nbsp;';
1995
+						if (!$isFreeText) {
1996
+							echo '<input type="text" name="line-title" id-line="'.$line->id.'" value="'.$newlabel.'" size="80" '.$readonlyForSituation.'/>&nbsp;';
1997
+						}
1885 1998
 						
1886 1999
 						if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT) && (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) )
1887 2000
 						{
@@ -1889,8 +2002,12 @@  discard block
 block discarded – undo
1889 2002
 							for ($j=1; $j<10; $j++)
1890 2003
 							{
1891 2004
 								if (!empty($readonlyForSituation)) {
1892
-									if ($qty_displayed == $j) $select .= '<option selected="selected" value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>';
1893
-								} else $select .= '<option '.($qty_displayed == $j ? 'selected="selected"' : '').' value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>';
2005
+									if ($qty_displayed == $j) {
2006
+										$select .= '<option selected="selected" value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>';
2007
+									}
2008
+								} else {
2009
+									$select .= '<option '.($qty_displayed == $j ? 'selected="selected"' : '').' value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>';
2010
+								}
1894 2011
 							}
1895 2012
 							$select .= '</select>&nbsp;';
1896 2013
 
@@ -1906,15 +2023,18 @@  discard block
 block discarded – undo
1906 2023
 								$form = new Form($db);
1907 2024
 								echo '<label for="subtotal_tva_tx">'.$form->textwithpicto($langs->trans('subtotal_apply_default_tva'), $langs->trans('subtotal_apply_default_tva_help')).'</label>';
1908 2025
 								echo '<select id="subtotal_tva_tx" name="subtotal_tva_tx" class="flat"><option selected="selected" value="">-</option>';
1909
-								if (empty($readonlyForSituation)) echo str_replace('selected', '', $form->load_tva('subtotal_tva_tx', '', $parameters['seller'], $parameters['buyer'], 0, 0, '', true));
2026
+								if (empty($readonlyForSituation)) {
2027
+									echo str_replace('selected', '', $form->load_tva('subtotal_tva_tx', '', $parameters['seller'], $parameters['buyer'], 0, 0, '', true));
2028
+								}
1910 2029
 								echo '</select>&nbsp;&nbsp;';
1911 2030
 								
1912 2031
 								if (!empty($conf->global->INVOICE_USE_SITUATION) && $object->element == 'facture' && $object->type == Facture::TYPE_SITUATION)
1913 2032
 								{
1914 2033
 									echo '<label for="subtotal_progress">'.$langs->trans('subtotal_apply_progress').'</label> <input id="subtotal_progress" name="subtotal_progress" value="" size="1" />%';
1915 2034
 								}
2035
+							} else if ($isFreeText) {
2036
+								echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation);
1916 2037
 							}
1917
-							else if ($isFreeText) echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation);
1918 2038
 						echo '</div>';
1919 2039
 
1920 2040
 						if($line->qty<10) {
@@ -1934,8 +2054,7 @@  discard block
 block discarded – undo
1934 2054
 							$doleditor->Create();
1935 2055
 						}
1936 2056
 						
1937
-					}
1938
-					else {
2057
+					} else {
1939 2058
 
1940 2059
 						 if ($conf->global->SUBTOTAL_USE_NEW_FORMAT)
1941 2060
 						 {
@@ -1943,14 +2062,19 @@  discard block
 block discarded – undo
1943 2062
 							{
1944 2063
 								echo str_repeat('&nbsp;&nbsp;&nbsp;', $line->qty-1);
1945 2064
 								
1946
-								if (TSubtotal::isTitle($line)) print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span>&nbsp;&nbsp;';
1947
-								else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span>&nbsp;&nbsp;';
2065
+								if (TSubtotal::isTitle($line)) {
2066
+									print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span>&nbsp;&nbsp;';
2067
+								} else {
2068
+									print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span>&nbsp;&nbsp;';
2069
+								}
1948 2070
 							}
1949
-						 }
1950
-						 else 
2071
+						 } else 
1951 2072
 						 {
1952
-							if($line->qty<=1) print img_picto('', 'subtotal@subtotal');
1953
-							else if($line->qty==2) print img_picto('', 'subsubtotal@subtotal').'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'; 
2073
+							if($line->qty<=1) {
2074
+								print img_picto('', 'subtotal@subtotal');
2075
+							} else if($line->qty==2) {
2076
+								print img_picto('', 'subsubtotal@subtotal').'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
2077
+							}
1954 2078
 						 }
1955 2079
 						 
1956 2080
 						 
@@ -1960,21 +2084,26 @@  discard block
 block discarded – undo
1960 2084
 						 $titleStyleUnderline =  strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;';
1961 2085
 						 
1962 2086
 						 if (empty($line->label)) {
1963
-							if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) print  $line->description.' '.$this->getTitle($object, $line);
1964
-							else print  $line->description;
1965
-						 } 
1966
-						 else {
2087
+							if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) {
2088
+								print  $line->description.' '.$this->getTitle($object, $line);
2089
+							} else {
2090
+								print  $line->description;
2091
+							}
2092
+						 } else {
1967 2093
 
1968 2094
 							if (! empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) {
1969 2095
 								print '<span class="subtotal_label" style="'.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" >'.$line->label.'</span><br><div class="subtotal_desc">'.dol_htmlentitiesbr($line->description).'</div>';
1970
-							}
1971
-							else{
2096
+							} else{
1972 2097
 								print '<span class="subtotal_label classfortooltip '.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" title="'.$line->description.'">'.$line->label.'</span>';    
1973 2098
 							}
1974 2099
 
1975 2100
 						 } 
1976
-						if($line->qty>90) print ' : ';
1977
-						if($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal');
2101
+						if($line->qty>90) {
2102
+							print ' : ';
2103
+						}
2104
+						if($line->info_bits > 0) {
2105
+							echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal');
2106
+						}
1978 2107
 
1979 2108
 						 
1980 2109
 
@@ -2011,11 +2140,12 @@  discard block
 block discarded – undo
2011 2140
 						</script>
2012 2141
 						<?php
2013 2142
 						
2014
-					}
2015
-					else{
2143
+					} else{
2016 2144
 						if ($object->statut == 0  && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK) && $object->element !== 'invoice_supplier')
2017 2145
 						{
2018
-							if(TSubtotal::isTitle($line) && ($object->situation_counter == 1 || !$object->situation_cycle_ref) ) echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=duplicate&lineid='.$line->id.'">'. img_picto($langs->trans('Duplicate'), 'duplicate@subtotal').'</a>';
2146
+							if(TSubtotal::isTitle($line) && ($object->situation_counter == 1 || !$object->situation_cycle_ref) ) {
2147
+								echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=duplicate&lineid='.$line->id.'">'. img_picto($langs->trans('Duplicate'), 'duplicate@subtotal').'</a>';
2148
+							}
2019 2149
 						}
2020 2150
 
2021 2151
 						if ($object->statut == 0  && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_EDIT_BLOCK)) 
@@ -2084,7 +2214,9 @@  discard block
 block discarded – undo
2084 2214
 				$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
2085 2215
 				
2086 2216
 				$colspan+=3; $mode = 'view';
2087
-				if($action === 'editline' && $line->rowid == GETPOST('lineid')) $mode = 'edit';
2217
+				if($action === 'editline' && $line->rowid == GETPOST('lineid')) {
2218
+					$mode = 'edit';
2219
+				}
2088 2220
 				
2089 2221
 				$ex_element = $line->element;
2090 2222
 				$line->element = 'tr_extrafield_title '.$line->element; // Pour pouvoir manipuler ces tr
@@ -2266,10 +2398,9 @@  discard block
 block discarded – undo
2266 2398
 	    
2267 2399
 	    if(TSubtotal::isTitle($line)){
2268 2400
 	        $ThtmlData['data-issubtotal'] = 'title';
2269
-	    }elseif(TSubtotal::isSubtotal($line)){
2401
+	    } elseif(TSubtotal::isSubtotal($line)){
2270 2402
 	        $ThtmlData['data-issubtotal'] = 'subtotal';
2271
-	    }
2272
-	    else{
2403
+	    } else{
2273 2404
 	        $ThtmlData['data-issubtotal'] = 'freetext';
2274 2405
 	    }
2275 2406
 	    
@@ -2279,7 +2410,9 @@  discard block
 block discarded – undo
2279 2410
 	    
2280 2411
 	    // hook 
2281 2412
 	    $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
2282
-	    if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
2413
+	    if ($reshook < 0) {
2414
+	    	setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
2415
+	    }
2283 2416
 	    if ($reshook>0)
2284 2417
 	    {
2285 2418
 	        $ThtmlData = $hookmanager->resArray;
Please login to merge, or discard this patch.