Passed
Push — master ( 77ae4e...036d63 )
by
unknown
03:05
created
core/triggers/interface_90_modSubtotal_subtotaltrigger.class.php 3 patches
Indentation   +544 added lines, -544 removed lines patch added patch discarded remove patch
@@ -36,68 +36,68 @@  discard block
 block discarded – undo
36 36
 class Interfacesubtotaltrigger
37 37
 {
38 38
 
39
-    private $db;
40
-
41
-    /**
42
-     * Constructor
43
-     *
44
-     * 	@param		DoliDB		$db		Database handler
45
-     */
46
-    public function __construct($db)
47
-    {
48
-        $this->db = $db;
49
-
50
-        $this->name = preg_replace('/^Interface/i', '', get_class($this));
51
-        $this->family = "demo";
52
-        $this->description = "Triggers of this module are empty functions."
53
-            . "They have no effect."
54
-            . "They are provided for tutorial purpose only.";
55
-        // 'development', 'experimental', 'dolibarr' or version
56
-        $this->version = 'development';
57
-        $this->picto = 'titre@titre';
58
-    }
59
-
60
-    /**
61
-     * Trigger name
62
-     *
63
-     * 	@return		string	Name of trigger file
64
-     */
65
-    public function getName()
66
-    {
67
-        return $this->name;
68
-    }
69
-
70
-    /**
71
-     * Trigger description
72
-     *
73
-     * 	@return		string	Description of trigger file
74
-     */
75
-    public function getDesc()
76
-    {
77
-        return $this->description;
78
-    }
79
-
80
-    /**
81
-     * Trigger version
82
-     *
83
-     * 	@return		string	Version of trigger file
84
-     */
85
-    public function getVersion()
86
-    {
87
-        global $langs;
88
-        $langs->load("admin");
89
-
90
-        if ($this->version == 'development') {
91
-            return $langs->trans("Development");
92
-        } elseif ($this->version == 'experimental')
93
-
94
-                return $langs->trans("Experimental");
95
-        elseif ($this->version == 'dolibarr') return DOL_VERSION;
96
-        elseif ($this->version) return $this->version;
97
-        else {
98
-            return $langs->trans("Unknown");
99
-        }
100
-    }
39
+	private $db;
40
+
41
+	/**
42
+	 * Constructor
43
+	 *
44
+	 * 	@param		DoliDB		$db		Database handler
45
+	 */
46
+	public function __construct($db)
47
+	{
48
+		$this->db = $db;
49
+
50
+		$this->name = preg_replace('/^Interface/i', '', get_class($this));
51
+		$this->family = "demo";
52
+		$this->description = "Triggers of this module are empty functions."
53
+			. "They have no effect."
54
+			. "They are provided for tutorial purpose only.";
55
+		// 'development', 'experimental', 'dolibarr' or version
56
+		$this->version = 'development';
57
+		$this->picto = 'titre@titre';
58
+	}
59
+
60
+	/**
61
+	 * Trigger name
62
+	 *
63
+	 * 	@return		string	Name of trigger file
64
+	 */
65
+	public function getName()
66
+	{
67
+		return $this->name;
68
+	}
69
+
70
+	/**
71
+	 * Trigger description
72
+	 *
73
+	 * 	@return		string	Description of trigger file
74
+	 */
75
+	public function getDesc()
76
+	{
77
+		return $this->description;
78
+	}
79
+
80
+	/**
81
+	 * Trigger version
82
+	 *
83
+	 * 	@return		string	Version of trigger file
84
+	 */
85
+	public function getVersion()
86
+	{
87
+		global $langs;
88
+		$langs->load("admin");
89
+
90
+		if ($this->version == 'development') {
91
+			return $langs->trans("Development");
92
+		} elseif ($this->version == 'experimental')
93
+
94
+				return $langs->trans("Experimental");
95
+		elseif ($this->version == 'dolibarr') return DOL_VERSION;
96
+		elseif ($this->version) return $this->version;
97
+		else {
98
+			return $langs->trans("Unknown");
99
+		}
100
+	}
101 101
 	
102 102
 	public function addToBegin(&$parent, &$object, $rang)
103 103
 	{
@@ -147,27 +147,27 @@  discard block
 block discarded – undo
147 147
 		}
148 148
 	}
149 149
 	
150
-    /**
151
-     * Function called when a Dolibarrr business event is done.
152
-     * All functions "run_trigger" are triggered if file
153
-     * is inside directory core/triggers
154
-     *
155
-     * 	@param		string		$action		Event action code
156
-     * 	@param		Object		$object		Object
157
-     * 	@param		User		$user		Object user
158
-     * 	@param		Translate	$langs		Object langs
159
-     * 	@param		conf		$conf		Object conf
160
-     * 	@return		int						<0 if KO, 0 if no triggered ran, >0 if OK
161
-     */
162
-    public function run_trigger($action, $object, $user, $langs, $conf)
163
-    {
164
-        // Put here code you want to execute when a Dolibarr business events occurs.
165
-        // Data and type of action are stored into $object and $action
166
-        // Users
167
-        dol_include_once('/subtotal/class/subtotal.class.php');
168
-        $langs->load('subtotal@subtotal');
150
+	/**
151
+	 * Function called when a Dolibarrr business event is done.
152
+	 * All functions "run_trigger" are triggered if file
153
+	 * is inside directory core/triggers
154
+	 *
155
+	 * 	@param		string		$action		Event action code
156
+	 * 	@param		Object		$object		Object
157
+	 * 	@param		User		$user		Object user
158
+	 * 	@param		Translate	$langs		Object langs
159
+	 * 	@param		conf		$conf		Object conf
160
+	 * 	@return		int						<0 if KO, 0 if no triggered ran, >0 if OK
161
+	 */
162
+	public function run_trigger($action, $object, $user, $langs, $conf)
163
+	{
164
+		// Put here code you want to execute when a Dolibarr business events occurs.
165
+		// Data and type of action are stored into $object and $action
166
+		// Users
167
+		dol_include_once('/subtotal/class/subtotal.class.php');
168
+		$langs->load('subtotal@subtotal');
169 169
    
170
-        if (!empty($conf->global->SUBTOTAL_ALLOW_ADD_LINE_UNDER_TITLE) && in_array($action, array('LINEPROPAL_INSERT', 'LINEORDER_INSERT', 'LINEBILL_INSERT')))
170
+		if (!empty($conf->global->SUBTOTAL_ALLOW_ADD_LINE_UNDER_TITLE) && in_array($action, array('LINEPROPAL_INSERT', 'LINEORDER_INSERT', 'LINEBILL_INSERT')))
171 171
 		{
172 172
 			
173 173
 			$rang = GETPOST('under_title', 'int'); // Rang du titre
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 		}
200 200
         
201 201
 		
202
-        if ($action == 'LINEBILL_INSERT' )
202
+		if ($action == 'LINEBILL_INSERT' )
203 203
 		{
204 204
 			$subtotal_add_title_bloc_from_orderstoinvoice = GETPOST('subtotal_add_title_bloc_from_orderstoinvoice');
205 205
 			if (!empty($subtotal_add_title_bloc_from_orderstoinvoice))
@@ -223,10 +223,10 @@  discard block
 block discarded – undo
223 223
 						if (empty($label)) $label = 'Commande [__REFORDER__] - Référence client : [__REFCUSTOMER__]';
224 224
 						$label = str_replace(array('__REFORDER__', '__REFCUSTOMER__'), array($commande->ref, $commande->ref_client), $label);
225 225
 
226
-                        if(!empty($current_fk_commande)) {
227
-                            TSubtotal::addTitle($facture, $label, 1, $rang);
228
-                            $rang++;
229
-                        }
226
+						if(!empty($current_fk_commande)) {
227
+							TSubtotal::addTitle($facture, $label, 1, $rang);
228
+							$rang++;
229
+						}
230 230
 					}
231 231
 					
232 232
 					$object->rang = $rang;
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 		
258 258
 		if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && in_array($action, array('LINEPROPAL_INSERT', 'LINEPROPAL_UPDATE', 'LINEORDER_INSERT', 'LINEORDER_UPDATE', 'LINEBILL_INSERT', 'LINEBILL_UPDATE')))
259 259
 		{
260
-            if(! function_exists('_updateLineNC')) dol_include_once('/subtotal/lib/subtotal.lib.php');
260
+			if(! function_exists('_updateLineNC')) dol_include_once('/subtotal/lib/subtotal.lib.php');
261 261
 
262 262
 			$doli_action = GETPOST('action');
263 263
 			$set = GETPOST('set');
@@ -323,173 +323,173 @@  discard block
 block discarded – undo
323 323
 		}
324 324
 		
325 325
         
326
-        if ($action == 'USER_LOGIN') {
327
-            dol_syslog(
328
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
329
-            );
330
-        } elseif ($action == 'USER_UPDATE_SESSION') {
331
-            // Warning: To increase performances, this action is triggered only if
332
-            // constant MAIN_ACTIVATE_UPDATESESSIONTRIGGER is set to 1.
333
-            dol_syslog(
334
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
335
-            );
336
-        } elseif ($action == 'USER_CREATE') {
337
-            dol_syslog(
338
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
339
-            );
340
-        } elseif ($action == 'USER_CREATE_FROM_CONTACT') {
341
-            dol_syslog(
342
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
343
-            );
344
-        } elseif ($action == 'USER_MODIFY') {
345
-            dol_syslog(
346
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
347
-            );
348
-        } elseif ($action == 'USER_NEW_PASSWORD') {
349
-            dol_syslog(
350
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
351
-            );
352
-        } elseif ($action == 'USER_ENABLEDISABLE') {
353
-            dol_syslog(
354
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
355
-            );
356
-        } elseif ($action == 'USER_DELETE') {
357
-            dol_syslog(
358
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
359
-            );
360
-        } elseif ($action == 'USER_LOGOUT') {
361
-            dol_syslog(
362
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
363
-            );
364
-        } elseif ($action == 'USER_SETINGROUP') {
365
-            dol_syslog(
366
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
367
-            );
368
-        } elseif ($action == 'USER_REMOVEFROMGROUP') {
369
-            dol_syslog(
370
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
371
-            );
372
-        }
373
-
374
-        // Groups
375
-        elseif ($action == 'GROUP_CREATE') {
376
-            dol_syslog(
377
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
378
-            );
379
-        } elseif ($action == 'GROUP_MODIFY') {
380
-            dol_syslog(
381
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
382
-            );
383
-        } elseif ($action == 'GROUP_DELETE') {
384
-            dol_syslog(
385
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
386
-            );
387
-        }
388
-
389
-        // Companies
390
-        elseif ($action == 'COMPANY_CREATE') {
391
-            dol_syslog(
392
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
393
-            );
394
-        } elseif ($action == 'COMPANY_MODIFY') {
395
-            dol_syslog(
396
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
397
-            );
398
-        } elseif ($action == 'COMPANY_DELETE') {
399
-            dol_syslog(
400
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
401
-            );
402
-        }
403
-
404
-        // Contacts
405
-        elseif ($action == 'CONTACT_CREATE') {
406
-            dol_syslog(
407
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
408
-            );
409
-        } elseif ($action == 'CONTACT_MODIFY') {
410
-            dol_syslog(
411
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
412
-            );
413
-        } elseif ($action == 'CONTACT_DELETE') {
414
-            dol_syslog(
415
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
416
-            );
417
-        }
418
-
419
-        // Products
420
-        elseif ($action == 'PRODUCT_CREATE') {
421
-            dol_syslog(
422
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
423
-            );
424
-        } elseif ($action == 'PRODUCT_MODIFY') {
425
-            dol_syslog(
426
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
427
-            );
428
-        } elseif ($action == 'PRODUCT_DELETE') {
429
-            dol_syslog(
430
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
431
-            );
432
-        }
433
-
434
-        // Customer orders
435
-        elseif ($action == 'ORDER_CREATE') {
436
-            dol_syslog(
437
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
438
-            );
439
-        } elseif ($action == 'ORDER_VALIDATE') {
440
-            dol_syslog(
441
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
442
-            );
443
-        } elseif ($action == 'ORDER_DELETE') {
444
-            dol_syslog(
445
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
446
-            );
447
-        } elseif ($action == 'ORDER_BUILDDOC') {
448
-            dol_syslog(
449
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
450
-            );
451
-        } elseif ($action == 'ORDER_SENTBYMAIL') {
452
-            dol_syslog(
453
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
454
-            );
455
-        } elseif ($action == 'LINEORDER_INSERT') {
456
-            dol_syslog(
457
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
458
-            );
459
-        } elseif ($action == 'LINEORDER_DELETE') {
460
-            dol_syslog(
461
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
462
-            );
463
-        }
464
-
465
-        // Supplier orders
466
-        elseif ($action == 'ORDER_SUPPLIER_CREATE') {
467
-            dol_syslog(
468
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
469
-            );
470
-        } elseif ($action == 'ORDER_SUPPLIER_VALIDATE') {
471
-            dol_syslog(
472
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
473
-            );
474
-        } elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') {
475
-            dol_syslog(
476
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
477
-            );
478
-        } elseif ($action == 'SUPPLIER_ORDER_BUILDDOC') {
479
-            dol_syslog(
480
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
481
-            );
482
-        }
483
-
484
-        // Proposals
485
-        elseif ($action == 'PROPAL_CREATE') {
486
-            dol_syslog(
487
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
488
-            );
489
-        } elseif (in_array($action, array('PROPAL_CLONE', 'ORDER_CLONE', 'BILL_CLONE'))) {
490
-            dol_syslog(
491
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
492
-            );
326
+		if ($action == 'USER_LOGIN') {
327
+			dol_syslog(
328
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
329
+			);
330
+		} elseif ($action == 'USER_UPDATE_SESSION') {
331
+			// Warning: To increase performances, this action is triggered only if
332
+			// constant MAIN_ACTIVATE_UPDATESESSIONTRIGGER is set to 1.
333
+			dol_syslog(
334
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
335
+			);
336
+		} elseif ($action == 'USER_CREATE') {
337
+			dol_syslog(
338
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
339
+			);
340
+		} elseif ($action == 'USER_CREATE_FROM_CONTACT') {
341
+			dol_syslog(
342
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
343
+			);
344
+		} elseif ($action == 'USER_MODIFY') {
345
+			dol_syslog(
346
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
347
+			);
348
+		} elseif ($action == 'USER_NEW_PASSWORD') {
349
+			dol_syslog(
350
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
351
+			);
352
+		} elseif ($action == 'USER_ENABLEDISABLE') {
353
+			dol_syslog(
354
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
355
+			);
356
+		} elseif ($action == 'USER_DELETE') {
357
+			dol_syslog(
358
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
359
+			);
360
+		} elseif ($action == 'USER_LOGOUT') {
361
+			dol_syslog(
362
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
363
+			);
364
+		} elseif ($action == 'USER_SETINGROUP') {
365
+			dol_syslog(
366
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
367
+			);
368
+		} elseif ($action == 'USER_REMOVEFROMGROUP') {
369
+			dol_syslog(
370
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
371
+			);
372
+		}
373
+
374
+		// Groups
375
+		elseif ($action == 'GROUP_CREATE') {
376
+			dol_syslog(
377
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
378
+			);
379
+		} elseif ($action == 'GROUP_MODIFY') {
380
+			dol_syslog(
381
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
382
+			);
383
+		} elseif ($action == 'GROUP_DELETE') {
384
+			dol_syslog(
385
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
386
+			);
387
+		}
388
+
389
+		// Companies
390
+		elseif ($action == 'COMPANY_CREATE') {
391
+			dol_syslog(
392
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
393
+			);
394
+		} elseif ($action == 'COMPANY_MODIFY') {
395
+			dol_syslog(
396
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
397
+			);
398
+		} elseif ($action == 'COMPANY_DELETE') {
399
+			dol_syslog(
400
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
401
+			);
402
+		}
403
+
404
+		// Contacts
405
+		elseif ($action == 'CONTACT_CREATE') {
406
+			dol_syslog(
407
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
408
+			);
409
+		} elseif ($action == 'CONTACT_MODIFY') {
410
+			dol_syslog(
411
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
412
+			);
413
+		} elseif ($action == 'CONTACT_DELETE') {
414
+			dol_syslog(
415
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
416
+			);
417
+		}
418
+
419
+		// Products
420
+		elseif ($action == 'PRODUCT_CREATE') {
421
+			dol_syslog(
422
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
423
+			);
424
+		} elseif ($action == 'PRODUCT_MODIFY') {
425
+			dol_syslog(
426
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
427
+			);
428
+		} elseif ($action == 'PRODUCT_DELETE') {
429
+			dol_syslog(
430
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
431
+			);
432
+		}
433
+
434
+		// Customer orders
435
+		elseif ($action == 'ORDER_CREATE') {
436
+			dol_syslog(
437
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
438
+			);
439
+		} elseif ($action == 'ORDER_VALIDATE') {
440
+			dol_syslog(
441
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
442
+			);
443
+		} elseif ($action == 'ORDER_DELETE') {
444
+			dol_syslog(
445
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
446
+			);
447
+		} elseif ($action == 'ORDER_BUILDDOC') {
448
+			dol_syslog(
449
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
450
+			);
451
+		} elseif ($action == 'ORDER_SENTBYMAIL') {
452
+			dol_syslog(
453
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
454
+			);
455
+		} elseif ($action == 'LINEORDER_INSERT') {
456
+			dol_syslog(
457
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
458
+			);
459
+		} elseif ($action == 'LINEORDER_DELETE') {
460
+			dol_syslog(
461
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
462
+			);
463
+		}
464
+
465
+		// Supplier orders
466
+		elseif ($action == 'ORDER_SUPPLIER_CREATE') {
467
+			dol_syslog(
468
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
469
+			);
470
+		} elseif ($action == 'ORDER_SUPPLIER_VALIDATE') {
471
+			dol_syslog(
472
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
473
+			);
474
+		} elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') {
475
+			dol_syslog(
476
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
477
+			);
478
+		} elseif ($action == 'SUPPLIER_ORDER_BUILDDOC') {
479
+			dol_syslog(
480
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
481
+			);
482
+		}
483
+
484
+		// Proposals
485
+		elseif ($action == 'PROPAL_CREATE') {
486
+			dol_syslog(
487
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
488
+			);
489
+		} elseif (in_array($action, array('PROPAL_CLONE', 'ORDER_CLONE', 'BILL_CLONE'))) {
490
+			dol_syslog(
491
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
492
+			);
493 493
 			
494 494
 			$doli_action = GETPOST('action');
495 495
 
@@ -522,296 +522,296 @@  discard block
 block discarded – undo
522 522
 				if (!empty($line)) $object->update_price(1);
523 523
 			}
524 524
 			
525
-        } elseif ($action == 'PROPAL_MODIFY') {
526
-            dol_syslog(
527
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
528
-            );
529
-        } elseif ($action == 'PROPAL_VALIDATE') {
530
-            dol_syslog(
531
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
532
-            );
533
-        } elseif ($action == 'PROPAL_BUILDDOC') {
534
-            dol_syslog(
535
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
536
-            );
537
-        } elseif ($action == 'PROPAL_SENTBYMAIL') {
538
-            dol_syslog(
539
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
540
-            );
541
-        } elseif ($action == 'PROPAL_CLOSE_SIGNED') {
542
-            dol_syslog(
543
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
544
-            );
545
-        } elseif ($action == 'PROPAL_CLOSE_REFUSED') {
546
-            dol_syslog(
547
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
548
-            );
549
-        } elseif ($action == 'PROPAL_DELETE') {
550
-            dol_syslog(
551
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
552
-            );
553
-        } elseif ($action == 'LINEPROPAL_INSERT') {
554
-            dol_syslog(
555
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
556
-            );
557
-        } elseif ($action == 'LINEPROPAL_MODIFY') {
558
-            dol_syslog(
559
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
560
-            );
561
-        } elseif ($action == 'LINEPROPAL_DELETE') {
562
-            dol_syslog(
563
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
564
-            );
565
-        }
566
-
567
-        // Contracts
568
-        elseif ($action == 'CONTRACT_CREATE') {
569
-            dol_syslog(
570
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
571
-            );
572
-        } elseif ($action == 'CONTRACT_MODIFY') {
573
-            dol_syslog(
574
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
575
-            );
576
-        } elseif ($action == 'CONTRACT_ACTIVATE') {
577
-            dol_syslog(
578
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
579
-            );
580
-        } elseif ($action == 'CONTRACT_CANCEL') {
581
-            dol_syslog(
582
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
583
-            );
584
-        } elseif ($action == 'CONTRACT_CLOSE') {
585
-            dol_syslog(
586
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
587
-            );
588
-        } elseif ($action == 'CONTRACT_DELETE') {
589
-            dol_syslog(
590
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
591
-            );
592
-        }
525
+		} elseif ($action == 'PROPAL_MODIFY') {
526
+			dol_syslog(
527
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
528
+			);
529
+		} elseif ($action == 'PROPAL_VALIDATE') {
530
+			dol_syslog(
531
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
532
+			);
533
+		} elseif ($action == 'PROPAL_BUILDDOC') {
534
+			dol_syslog(
535
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
536
+			);
537
+		} elseif ($action == 'PROPAL_SENTBYMAIL') {
538
+			dol_syslog(
539
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
540
+			);
541
+		} elseif ($action == 'PROPAL_CLOSE_SIGNED') {
542
+			dol_syslog(
543
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
544
+			);
545
+		} elseif ($action == 'PROPAL_CLOSE_REFUSED') {
546
+			dol_syslog(
547
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
548
+			);
549
+		} elseif ($action == 'PROPAL_DELETE') {
550
+			dol_syslog(
551
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
552
+			);
553
+		} elseif ($action == 'LINEPROPAL_INSERT') {
554
+			dol_syslog(
555
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
556
+			);
557
+		} elseif ($action == 'LINEPROPAL_MODIFY') {
558
+			dol_syslog(
559
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
560
+			);
561
+		} elseif ($action == 'LINEPROPAL_DELETE') {
562
+			dol_syslog(
563
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
564
+			);
565
+		}
566
+
567
+		// Contracts
568
+		elseif ($action == 'CONTRACT_CREATE') {
569
+			dol_syslog(
570
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
571
+			);
572
+		} elseif ($action == 'CONTRACT_MODIFY') {
573
+			dol_syslog(
574
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
575
+			);
576
+		} elseif ($action == 'CONTRACT_ACTIVATE') {
577
+			dol_syslog(
578
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
579
+			);
580
+		} elseif ($action == 'CONTRACT_CANCEL') {
581
+			dol_syslog(
582
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
583
+			);
584
+		} elseif ($action == 'CONTRACT_CLOSE') {
585
+			dol_syslog(
586
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
587
+			);
588
+		} elseif ($action == 'CONTRACT_DELETE') {
589
+			dol_syslog(
590
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
591
+			);
592
+		}
593 593
 
594 594
 		elseif ($action == 'BILL_MODIFY') {
595
-            dol_syslog(
596
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
597
-            );
598
-
599
-
600
-            global $conf;
601
-
602
-            if (!empty($conf->global->INVOICE_USE_SITUATION) && $object->element == 'facture' && $object->type == Facture::TYPE_SITUATION)
603
-            {
604
-                $object->situation_final = 1;
605
-                foreach($object->lines as $i => $line) {
606
-                    if(!TSubtotal::isModSubtotalLine($line) && $line->situation_percent != 100){
607
-                        $object->situation_final = 0;
608
-                        break;
609
-                    }
610
-                }
611
-                // ne pas utiliser $object->setFinal ne peut pas marcher
612
-                $sql = 'UPDATE ' . MAIN_DB_PREFIX . 'facture SET situation_final = ' . $object->situation_final . ' where rowid = ' . $object->id;
613
-                $resql=$object->db->query($sql);
614
-            }
615
-
616
-
617
-        } elseif ($action == 'BILL_VALIDATE') {
618
-            dol_syslog(
619
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
620
-            );
621
-        } elseif ($action == 'BILL_BUILDDOC') {
622
-            dol_syslog(
623
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
624
-            );
625
-        } elseif ($action == 'BILL_SENTBYMAIL') {
626
-            dol_syslog(
627
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
628
-            );
629
-        } elseif ($action == 'BILL_CANCEL') {
630
-            dol_syslog(
631
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
632
-            );
633
-        } elseif ($action == 'BILL_DELETE') {
634
-            dol_syslog(
635
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
636
-            );
637
-        } elseif ($action == 'LINEBILL_INSERT') {
595
+			dol_syslog(
596
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
597
+			);
598
+
599
+
600
+			global $conf;
601
+
602
+			if (!empty($conf->global->INVOICE_USE_SITUATION) && $object->element == 'facture' && $object->type == Facture::TYPE_SITUATION)
603
+			{
604
+				$object->situation_final = 1;
605
+				foreach($object->lines as $i => $line) {
606
+					if(!TSubtotal::isModSubtotalLine($line) && $line->situation_percent != 100){
607
+						$object->situation_final = 0;
608
+						break;
609
+					}
610
+				}
611
+				// ne pas utiliser $object->setFinal ne peut pas marcher
612
+				$sql = 'UPDATE ' . MAIN_DB_PREFIX . 'facture SET situation_final = ' . $object->situation_final . ' where rowid = ' . $object->id;
613
+				$resql=$object->db->query($sql);
614
+			}
615
+
616
+
617
+		} elseif ($action == 'BILL_VALIDATE') {
618
+			dol_syslog(
619
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
620
+			);
621
+		} elseif ($action == 'BILL_BUILDDOC') {
622
+			dol_syslog(
623
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
624
+			);
625
+		} elseif ($action == 'BILL_SENTBYMAIL') {
626
+			dol_syslog(
627
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
628
+			);
629
+		} elseif ($action == 'BILL_CANCEL') {
630
+			dol_syslog(
631
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
632
+			);
633
+		} elseif ($action == 'BILL_DELETE') {
634
+			dol_syslog(
635
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
636
+			);
637
+		} elseif ($action == 'LINEBILL_INSERT') {
638 638
 				
639
-        	dol_syslog(
640
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
641
-            );
642
-        } elseif ($action == 'LINEBILL_DELETE') {
643
-            dol_syslog(
644
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
645
-            );
646
-        }
647
-
648
-        // Payments
649
-        elseif ($action == 'PAYMENT_CUSTOMER_CREATE') {
650
-            dol_syslog(
651
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
652
-            );
653
-        } elseif ($action == 'PAYMENT_SUPPLIER_CREATE') {
654
-            dol_syslog(
655
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
656
-            );
657
-        } elseif ($action == 'PAYMENT_ADD_TO_BANK') {
658
-            dol_syslog(
659
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
660
-            );
661
-        } elseif ($action == 'PAYMENT_DELETE') {
662
-            dol_syslog(
663
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
664
-            );
665
-        }
666
-
667
-        // Interventions
668
-        elseif ($action == 'FICHEINTER_CREATE') {
669
-            dol_syslog(
670
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
671
-            );
672
-        } elseif ($action == 'FICHEINTER_MODIFY') {
673
-            dol_syslog(
674
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
675
-            );
676
-        } elseif ($action == 'FICHEINTER_VALIDATE') {
677
-            dol_syslog(
678
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
679
-            );
680
-        } elseif ($action == 'FICHEINTER_DELETE') {
681
-            dol_syslog(
682
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
683
-            );
684
-        }
685
-
686
-        // Members
687
-        elseif ($action == 'MEMBER_CREATE') {
688
-            dol_syslog(
689
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
690
-            );
691
-        } elseif ($action == 'MEMBER_VALIDATE') {
692
-            dol_syslog(
693
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
694
-            );
695
-        } elseif ($action == 'MEMBER_SUBSCRIPTION') {
696
-            dol_syslog(
697
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
698
-            );
699
-        } elseif ($action == 'MEMBER_MODIFY') {
700
-            dol_syslog(
701
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
702
-            );
703
-        } elseif ($action == 'MEMBER_NEW_PASSWORD') {
704
-            dol_syslog(
705
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
706
-            );
707
-        } elseif ($action == 'MEMBER_RESILIATE') {
708
-            dol_syslog(
709
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
710
-            );
711
-        } elseif ($action == 'MEMBER_DELETE') {
712
-            dol_syslog(
713
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
714
-            );
715
-        }
716
-
717
-        // Categories
718
-        elseif ($action == 'CATEGORY_CREATE') {
719
-            dol_syslog(
720
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
721
-            );
722
-        } elseif ($action == 'CATEGORY_MODIFY') {
723
-            dol_syslog(
724
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
725
-            );
726
-        } elseif ($action == 'CATEGORY_DELETE') {
727
-            dol_syslog(
728
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
729
-            );
730
-        }
731
-
732
-        // Projects
733
-        elseif ($action == 'PROJECT_CREATE') {
734
-            dol_syslog(
735
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
736
-            );
737
-        } elseif ($action == 'PROJECT_MODIFY') {
738
-            dol_syslog(
739
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
740
-            );
741
-        } elseif ($action == 'PROJECT_DELETE') {
742
-            dol_syslog(
743
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
744
-            );
745
-        }
746
-
747
-        // Project tasks
748
-        elseif ($action == 'TASK_CREATE') {
749
-            dol_syslog(
750
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
751
-            );
752
-        } elseif ($action == 'TASK_MODIFY') {
753
-            dol_syslog(
754
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
755
-            );
756
-        } elseif ($action == 'TASK_DELETE') {
757
-            dol_syslog(
758
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
759
-            );
760
-        }
761
-
762
-        // Task time spent
763
-        elseif ($action == 'TASK_TIMESPENT_CREATE') {
764
-            dol_syslog(
765
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
766
-            );
767
-        } elseif ($action == 'TASK_TIMESPENT_MODIFY') {
768
-            dol_syslog(
769
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
770
-            );
771
-        } elseif ($action == 'TASK_TIMESPENT_DELETE') {
772
-            dol_syslog(
773
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
774
-            );
775
-        }
776
-
777
-        // Shipping
778
-        elseif ($action == 'SHIPPING_CREATE') {
779
-            dol_syslog(
780
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
781
-            );
782
-        } elseif ($action == 'SHIPPING_MODIFY') {
783
-            dol_syslog(
784
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
785
-            );
786
-        } elseif ($action == 'SHIPPING_VALIDATE') {
787
-            dol_syslog(
788
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
789
-            );
790
-        } elseif ($action == 'SHIPPING_SENTBYMAIL') {
791
-            dol_syslog(
792
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
793
-            );
794
-        } elseif ($action == 'SHIPPING_DELETE') {
795
-            dol_syslog(
796
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
797
-            );
798
-        } elseif ($action == 'SHIPPING_BUILDDOC') {
799
-            dol_syslog(
800
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
801
-            );
802
-        }
803
-
804
-        // File
805
-        elseif ($action == 'FILE_UPLOAD') {
806
-            dol_syslog(
807
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
808
-            );
809
-        } elseif ($action == 'FILE_DELETE') {
810
-            dol_syslog(
811
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
812
-            );
813
-        }
814
-
815
-        return 0;
816
-    }
639
+			dol_syslog(
640
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
641
+			);
642
+		} elseif ($action == 'LINEBILL_DELETE') {
643
+			dol_syslog(
644
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
645
+			);
646
+		}
647
+
648
+		// Payments
649
+		elseif ($action == 'PAYMENT_CUSTOMER_CREATE') {
650
+			dol_syslog(
651
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
652
+			);
653
+		} elseif ($action == 'PAYMENT_SUPPLIER_CREATE') {
654
+			dol_syslog(
655
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
656
+			);
657
+		} elseif ($action == 'PAYMENT_ADD_TO_BANK') {
658
+			dol_syslog(
659
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
660
+			);
661
+		} elseif ($action == 'PAYMENT_DELETE') {
662
+			dol_syslog(
663
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
664
+			);
665
+		}
666
+
667
+		// Interventions
668
+		elseif ($action == 'FICHEINTER_CREATE') {
669
+			dol_syslog(
670
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
671
+			);
672
+		} elseif ($action == 'FICHEINTER_MODIFY') {
673
+			dol_syslog(
674
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
675
+			);
676
+		} elseif ($action == 'FICHEINTER_VALIDATE') {
677
+			dol_syslog(
678
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
679
+			);
680
+		} elseif ($action == 'FICHEINTER_DELETE') {
681
+			dol_syslog(
682
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
683
+			);
684
+		}
685
+
686
+		// Members
687
+		elseif ($action == 'MEMBER_CREATE') {
688
+			dol_syslog(
689
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
690
+			);
691
+		} elseif ($action == 'MEMBER_VALIDATE') {
692
+			dol_syslog(
693
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
694
+			);
695
+		} elseif ($action == 'MEMBER_SUBSCRIPTION') {
696
+			dol_syslog(
697
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
698
+			);
699
+		} elseif ($action == 'MEMBER_MODIFY') {
700
+			dol_syslog(
701
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
702
+			);
703
+		} elseif ($action == 'MEMBER_NEW_PASSWORD') {
704
+			dol_syslog(
705
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
706
+			);
707
+		} elseif ($action == 'MEMBER_RESILIATE') {
708
+			dol_syslog(
709
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
710
+			);
711
+		} elseif ($action == 'MEMBER_DELETE') {
712
+			dol_syslog(
713
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
714
+			);
715
+		}
716
+
717
+		// Categories
718
+		elseif ($action == 'CATEGORY_CREATE') {
719
+			dol_syslog(
720
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
721
+			);
722
+		} elseif ($action == 'CATEGORY_MODIFY') {
723
+			dol_syslog(
724
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
725
+			);
726
+		} elseif ($action == 'CATEGORY_DELETE') {
727
+			dol_syslog(
728
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
729
+			);
730
+		}
731
+
732
+		// Projects
733
+		elseif ($action == 'PROJECT_CREATE') {
734
+			dol_syslog(
735
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
736
+			);
737
+		} elseif ($action == 'PROJECT_MODIFY') {
738
+			dol_syslog(
739
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
740
+			);
741
+		} elseif ($action == 'PROJECT_DELETE') {
742
+			dol_syslog(
743
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
744
+			);
745
+		}
746
+
747
+		// Project tasks
748
+		elseif ($action == 'TASK_CREATE') {
749
+			dol_syslog(
750
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
751
+			);
752
+		} elseif ($action == 'TASK_MODIFY') {
753
+			dol_syslog(
754
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
755
+			);
756
+		} elseif ($action == 'TASK_DELETE') {
757
+			dol_syslog(
758
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
759
+			);
760
+		}
761
+
762
+		// Task time spent
763
+		elseif ($action == 'TASK_TIMESPENT_CREATE') {
764
+			dol_syslog(
765
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
766
+			);
767
+		} elseif ($action == 'TASK_TIMESPENT_MODIFY') {
768
+			dol_syslog(
769
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
770
+			);
771
+		} elseif ($action == 'TASK_TIMESPENT_DELETE') {
772
+			dol_syslog(
773
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
774
+			);
775
+		}
776
+
777
+		// Shipping
778
+		elseif ($action == 'SHIPPING_CREATE') {
779
+			dol_syslog(
780
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
781
+			);
782
+		} elseif ($action == 'SHIPPING_MODIFY') {
783
+			dol_syslog(
784
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
785
+			);
786
+		} elseif ($action == 'SHIPPING_VALIDATE') {
787
+			dol_syslog(
788
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
789
+			);
790
+		} elseif ($action == 'SHIPPING_SENTBYMAIL') {
791
+			dol_syslog(
792
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
793
+			);
794
+		} elseif ($action == 'SHIPPING_DELETE') {
795
+			dol_syslog(
796
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
797
+			);
798
+		} elseif ($action == 'SHIPPING_BUILDDOC') {
799
+			dol_syslog(
800
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
801
+			);
802
+		}
803
+
804
+		// File
805
+		elseif ($action == 'FILE_UPLOAD') {
806
+			dol_syslog(
807
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
808
+			);
809
+		} elseif ($action == 'FILE_DELETE') {
810
+			dol_syslog(
811
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
812
+			);
813
+		}
814
+
815
+		return 0;
816
+	}
817 817
 }
818 818
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +119 added lines, -119 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
 		
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 		}
200 200
         
201 201
 		
202
-        if ($action == 'LINEBILL_INSERT' )
202
+        if ($action == 'LINEBILL_INSERT')
203 203
 		{
204 204
 			$subtotal_add_title_bloc_from_orderstoinvoice = GETPOST('subtotal_add_title_bloc_from_orderstoinvoice');
205 205
 			if (!empty($subtotal_add_title_bloc_from_orderstoinvoice))
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 				{
215 215
 					$rang = !empty($subtotal_current_rang) ? $subtotal_current_rang : $object->rang;
216 216
 					// Si le fk_commande courrant est différent alors on change de commande => ajout d'un titre
217
-					if ($current_fk_commande != $subtotal_bloc_previous_fk_commande )
217
+					if ($current_fk_commande != $subtotal_bloc_previous_fk_commande)
218 218
 					{
219 219
 						$commande = new Commande($this->db);
220 220
 						$commande->fetch($current_fk_commande);
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 						if (empty($label)) $label = 'Commande [__REFORDER__] - Référence client : [__REFCUSTOMER__]';
224 224
 						$label = str_replace(array('__REFORDER__', '__REFCUSTOMER__'), array($commande->ref, $commande->ref_client), $label);
225 225
 
226
-                        if(!empty($current_fk_commande)) {
226
+                        if (!empty($current_fk_commande)) {
227 227
                             TSubtotal::addTitle($facture, $label, 1, $rang);
228 228
                             $rang++;
229 229
                         }
@@ -257,14 +257,14 @@  discard block
 block discarded – undo
257 257
 		
258 258
 		if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && in_array($action, array('LINEPROPAL_INSERT', 'LINEPROPAL_UPDATE', 'LINEORDER_INSERT', 'LINEORDER_UPDATE', 'LINEBILL_INSERT', 'LINEBILL_UPDATE')))
259 259
 		{
260
-            if(! function_exists('_updateLineNC')) dol_include_once('/subtotal/lib/subtotal.lib.php');
260
+            if (!function_exists('_updateLineNC')) dol_include_once('/subtotal/lib/subtotal.lib.php');
261 261
 
262 262
 			$doli_action = GETPOST('action');
263 263
 			$set = GETPOST('set');
264
-			if ( (in_array($doli_action, array('updateligne', 'updateline', 'addline', 'add', 'create', 'setstatut')) || $set == 'defaultTVA') && !TSubtotal::isTitle($object) && !TSubtotal::isSubtotal($object) && in_array($object->element, array('propaldet', 'commandedet', 'facturedet')))
264
+			if ((in_array($doli_action, array('updateligne', 'updateline', 'addline', 'add', 'create', 'setstatut')) || $set == 'defaultTVA') && !TSubtotal::isTitle($object) && !TSubtotal::isSubtotal($object) && in_array($object->element, array('propaldet', 'commandedet', 'facturedet')))
265 265
 			{
266 266
 				 dol_syslog(
267
-					"[SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS] Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". object=".$object->element." id=" . $object->id
267
+					"[SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS] Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". object=".$object->element." id=".$object->id
268 268
 				);
269 269
 				 
270 270
 				$TTitle = TSubtotal::getAllTitleFromLine($object);
@@ -284,9 +284,9 @@  discard block
 block discarded – undo
284 284
 				}
285 285
 
286 286
 				// $object correspond à la ligne ajoutée
287
-				if(empty($object->array_options)) $object->fetch_optionals();
287
+				if (empty($object->array_options)) $object->fetch_optionals();
288 288
 
289
-				if(! empty($object->array_options['options_subtotal_nc'])) {
289
+				if (!empty($object->array_options['options_subtotal_nc'])) {
290 290
 					$object->total_ht = $object->total_tva = $object->total_ttc = $object->total_localtax1 = $object->total_localtax2 = 
291 291
 							$object->multicurrency_total_ht = $object->multicurrency_total_tva = $object->multicurrency_total_ttc = 0;
292 292
 
@@ -298,11 +298,11 @@  discard block
 block discarded – undo
298 298
 
299 299
 				// Correction d'un bug lors de la création d'une commande depuis une propale qui a, au moins, une ligne NC
300 300
 				$parent_element = '';
301
-				if($object->element == 'propaldet') $parent_element = 'propal';
302
-				if($object->element == 'commandedet') $parent_element = 'commande';
303
-				if($object->element == 'facturedet') $parent_element = 'facture';
301
+				if ($object->element == 'propaldet') $parent_element = 'propal';
302
+				if ($object->element == 'commandedet') $parent_element = 'commande';
303
+				if ($object->element == 'facturedet') $parent_element = 'facture';
304 304
 
305
-				if(! empty($parent_element) && ! empty($object->array_options['options_subtotal_nc'])) {
305
+				if (!empty($parent_element) && !empty($object->array_options['options_subtotal_nc'])) {
306 306
 					_updateLineNC($parent_element, $object->{'fk_'.$parent_element}, $object->id, $object->array_options['options_subtotal_nc'], 1);
307 307
 				}
308 308
 			}
@@ -310,12 +310,12 @@  discard block
 block discarded – undo
310 310
 		
311 311
 		// 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
312 312
 		if ($action == 'BILL_CREATE' && $object->fac_rec > 0) {
313
-			dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id);
313
+			dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
314 314
 
315 315
 			$object->fetch_lines(); // Lignes pas rajoutées à $object->lines par les appels à addline();
316 316
 
317
-			foreach($object->lines as &$line) {
318
-				if(TSubtotal::isSubtotal($line) && ! empty($line->tva_tx)) {
317
+			foreach ($object->lines as &$line) {
318
+				if (TSubtotal::isSubtotal($line) && !empty($line->tva_tx)) {
319 319
 					$line->tva_tx = 0;
320 320
 					$line->update();
321 321
 				}
@@ -325,170 +325,170 @@  discard block
 block discarded – undo
325 325
         
326 326
         if ($action == 'USER_LOGIN') {
327 327
             dol_syslog(
328
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
328
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
329 329
             );
330 330
         } elseif ($action == 'USER_UPDATE_SESSION') {
331 331
             // Warning: To increase performances, this action is triggered only if
332 332
             // constant MAIN_ACTIVATE_UPDATESESSIONTRIGGER is set to 1.
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_CREATE') {
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_CREATE_FROM_CONTACT') {
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_MODIFY') {
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_NEW_PASSWORD') {
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_ENABLEDISABLE') {
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
         } elseif ($action == 'USER_DELETE') {
357 357
             dol_syslog(
358
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
358
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
359 359
             );
360 360
         } elseif ($action == 'USER_LOGOUT') {
361 361
             dol_syslog(
362
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
362
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
363 363
             );
364 364
         } elseif ($action == 'USER_SETINGROUP') {
365 365
             dol_syslog(
366
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
366
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
367 367
             );
368 368
         } elseif ($action == 'USER_REMOVEFROMGROUP') {
369 369
             dol_syslog(
370
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
370
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
371 371
             );
372 372
         }
373 373
 
374 374
         // Groups
375 375
         elseif ($action == 'GROUP_CREATE') {
376 376
             dol_syslog(
377
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
377
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
378 378
             );
379 379
         } elseif ($action == 'GROUP_MODIFY') {
380 380
             dol_syslog(
381
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
381
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
382 382
             );
383 383
         } elseif ($action == 'GROUP_DELETE') {
384 384
             dol_syslog(
385
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
385
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
386 386
             );
387 387
         }
388 388
 
389 389
         // Companies
390 390
         elseif ($action == 'COMPANY_CREATE') {
391 391
             dol_syslog(
392
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
392
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
393 393
             );
394 394
         } elseif ($action == 'COMPANY_MODIFY') {
395 395
             dol_syslog(
396
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
396
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
397 397
             );
398 398
         } elseif ($action == 'COMPANY_DELETE') {
399 399
             dol_syslog(
400
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
400
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
401 401
             );
402 402
         }
403 403
 
404 404
         // Contacts
405 405
         elseif ($action == 'CONTACT_CREATE') {
406 406
             dol_syslog(
407
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
407
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
408 408
             );
409 409
         } elseif ($action == 'CONTACT_MODIFY') {
410 410
             dol_syslog(
411
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
411
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
412 412
             );
413 413
         } elseif ($action == 'CONTACT_DELETE') {
414 414
             dol_syslog(
415
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
415
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
416 416
             );
417 417
         }
418 418
 
419 419
         // Products
420 420
         elseif ($action == 'PRODUCT_CREATE') {
421 421
             dol_syslog(
422
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
422
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
423 423
             );
424 424
         } elseif ($action == 'PRODUCT_MODIFY') {
425 425
             dol_syslog(
426
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
426
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
427 427
             );
428 428
         } elseif ($action == 'PRODUCT_DELETE') {
429 429
             dol_syslog(
430
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
430
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
431 431
             );
432 432
         }
433 433
 
434 434
         // Customer orders
435 435
         elseif ($action == 'ORDER_CREATE') {
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 == 'ORDER_VALIDATE') {
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 == 'ORDER_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
         } elseif ($action == 'ORDER_BUILDDOC') {
448 448
             dol_syslog(
449
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
449
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
450 450
             );
451 451
         } elseif ($action == 'ORDER_SENTBYMAIL') {
452 452
             dol_syslog(
453
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
453
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
454 454
             );
455 455
         } elseif ($action == 'LINEORDER_INSERT') {
456 456
             dol_syslog(
457
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
457
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
458 458
             );
459 459
         } elseif ($action == 'LINEORDER_DELETE') {
460 460
             dol_syslog(
461
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
461
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
462 462
             );
463 463
         }
464 464
 
465 465
         // Supplier orders
466 466
         elseif ($action == 'ORDER_SUPPLIER_CREATE') {
467 467
             dol_syslog(
468
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
468
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
469 469
             );
470 470
         } elseif ($action == 'ORDER_SUPPLIER_VALIDATE') {
471 471
             dol_syslog(
472
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
472
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
473 473
             );
474 474
         } elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') {
475 475
             dol_syslog(
476
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
476
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
477 477
             );
478 478
         } elseif ($action == 'SUPPLIER_ORDER_BUILDDOC') {
479 479
             dol_syslog(
480
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
480
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
481 481
             );
482 482
         }
483 483
 
484 484
         // Proposals
485 485
         elseif ($action == 'PROPAL_CREATE') {
486 486
             dol_syslog(
487
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
487
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
488 488
             );
489 489
         } elseif (in_array($action, array('PROPAL_CLONE', 'ORDER_CLONE', 'BILL_CLONE'))) {
490 490
             dol_syslog(
491
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
491
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
492 492
             );
493 493
 			
494 494
 			$doli_action = GETPOST('action');
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
 			if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && in_array($doli_action, array('confirm_clone')))
497 497
 			{
498 498
 				dol_syslog(
499
-					"[SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS] Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". object=".$object->element." id=" . $object->id
499
+					"[SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS] Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". object=".$object->element." id=".$object->id
500 500
 				);
501 501
 				
502 502
 				// En fonction de l'objet et de la version, les lignes conservent l'id de l'objet d'origine
@@ -524,76 +524,76 @@  discard block
 block discarded – undo
524 524
 			
525 525
         } elseif ($action == 'PROPAL_MODIFY') {
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_VALIDATE') {
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_BUILDDOC') {
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 == 'PROPAL_SENTBYMAIL') {
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 == 'PROPAL_CLOSE_SIGNED') {
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 == 'PROPAL_CLOSE_REFUSED') {
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
         } elseif ($action == 'PROPAL_DELETE') {
550 550
             dol_syslog(
551
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
551
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
552 552
             );
553 553
         } elseif ($action == 'LINEPROPAL_INSERT') {
554 554
             dol_syslog(
555
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
555
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
556 556
             );
557 557
         } elseif ($action == 'LINEPROPAL_MODIFY') {
558 558
             dol_syslog(
559
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
559
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
560 560
             );
561 561
         } elseif ($action == 'LINEPROPAL_DELETE') {
562 562
             dol_syslog(
563
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
563
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
564 564
             );
565 565
         }
566 566
 
567 567
         // Contracts
568 568
         elseif ($action == 'CONTRACT_CREATE') {
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_MODIFY') {
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
         } elseif ($action == 'CONTRACT_ACTIVATE') {
577 577
             dol_syslog(
578
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
578
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
579 579
             );
580 580
         } elseif ($action == 'CONTRACT_CANCEL') {
581 581
             dol_syslog(
582
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
582
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
583 583
             );
584 584
         } elseif ($action == 'CONTRACT_CLOSE') {
585 585
             dol_syslog(
586
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
586
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
587 587
             );
588 588
         } elseif ($action == 'CONTRACT_DELETE') {
589 589
             dol_syslog(
590
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
590
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
591 591
             );
592 592
         }
593 593
 
594 594
 		elseif ($action == 'BILL_MODIFY') {
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
 
599 599
 
@@ -602,213 +602,213 @@  discard block
 block discarded – undo
602 602
             if (!empty($conf->global->INVOICE_USE_SITUATION) && $object->element == 'facture' && $object->type == Facture::TYPE_SITUATION)
603 603
             {
604 604
                 $object->situation_final = 1;
605
-                foreach($object->lines as $i => $line) {
606
-                    if(!TSubtotal::isModSubtotalLine($line) && $line->situation_percent != 100){
605
+                foreach ($object->lines as $i => $line) {
606
+                    if (!TSubtotal::isModSubtotalLine($line) && $line->situation_percent != 100) {
607 607
                         $object->situation_final = 0;
608 608
                         break;
609 609
                     }
610 610
                 }
611 611
                 // ne pas utiliser $object->setFinal ne peut pas marcher
612
-                $sql = 'UPDATE ' . MAIN_DB_PREFIX . 'facture SET situation_final = ' . $object->situation_final . ' where rowid = ' . $object->id;
613
-                $resql=$object->db->query($sql);
612
+                $sql = 'UPDATE '.MAIN_DB_PREFIX.'facture SET situation_final = '.$object->situation_final.' where rowid = '.$object->id;
613
+                $resql = $object->db->query($sql);
614 614
             }
615 615
 
616 616
 
617 617
         } elseif ($action == 'BILL_VALIDATE') {
618 618
             dol_syslog(
619
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
619
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
620 620
             );
621 621
         } elseif ($action == 'BILL_BUILDDOC') {
622 622
             dol_syslog(
623
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
623
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
624 624
             );
625 625
         } elseif ($action == 'BILL_SENTBYMAIL') {
626 626
             dol_syslog(
627
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
627
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
628 628
             );
629 629
         } elseif ($action == 'BILL_CANCEL') {
630 630
             dol_syslog(
631
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
631
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
632 632
             );
633 633
         } elseif ($action == 'BILL_DELETE') {
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 == 'LINEBILL_INSERT') {
638 638
 				
639 639
         	dol_syslog(
640
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
640
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
641 641
             );
642 642
         } elseif ($action == 'LINEBILL_DELETE') {
643 643
             dol_syslog(
644
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
644
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
645 645
             );
646 646
         }
647 647
 
648 648
         // Payments
649 649
         elseif ($action == 'PAYMENT_CUSTOMER_CREATE') {
650 650
             dol_syslog(
651
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
651
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
652 652
             );
653 653
         } elseif ($action == 'PAYMENT_SUPPLIER_CREATE') {
654 654
             dol_syslog(
655
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
655
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
656 656
             );
657 657
         } elseif ($action == 'PAYMENT_ADD_TO_BANK') {
658 658
             dol_syslog(
659
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
659
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
660 660
             );
661 661
         } elseif ($action == 'PAYMENT_DELETE') {
662 662
             dol_syslog(
663
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
663
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
664 664
             );
665 665
         }
666 666
 
667 667
         // Interventions
668 668
         elseif ($action == 'FICHEINTER_CREATE') {
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 == 'FICHEINTER_MODIFY') {
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 == 'FICHEINTER_VALIDATE') {
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
         } elseif ($action == 'FICHEINTER_DELETE') {
681 681
             dol_syslog(
682
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
682
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
683 683
             );
684 684
         }
685 685
 
686 686
         // Members
687 687
         elseif ($action == 'MEMBER_CREATE') {
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 == 'MEMBER_VALIDATE') {
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
         } elseif ($action == 'MEMBER_SUBSCRIPTION') {
696 696
             dol_syslog(
697
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
697
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
698 698
             );
699 699
         } elseif ($action == 'MEMBER_MODIFY') {
700 700
             dol_syslog(
701
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
701
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
702 702
             );
703 703
         } elseif ($action == 'MEMBER_NEW_PASSWORD') {
704 704
             dol_syslog(
705
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
705
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
706 706
             );
707 707
         } elseif ($action == 'MEMBER_RESILIATE') {
708 708
             dol_syslog(
709
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
709
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
710 710
             );
711 711
         } elseif ($action == 'MEMBER_DELETE') {
712 712
             dol_syslog(
713
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
713
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
714 714
             );
715 715
         }
716 716
 
717 717
         // Categories
718 718
         elseif ($action == 'CATEGORY_CREATE') {
719 719
             dol_syslog(
720
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
720
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
721 721
             );
722 722
         } elseif ($action == 'CATEGORY_MODIFY') {
723 723
             dol_syslog(
724
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
724
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
725 725
             );
726 726
         } elseif ($action == 'CATEGORY_DELETE') {
727 727
             dol_syslog(
728
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
728
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
729 729
             );
730 730
         }
731 731
 
732 732
         // Projects
733 733
         elseif ($action == 'PROJECT_CREATE') {
734 734
             dol_syslog(
735
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
735
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
736 736
             );
737 737
         } elseif ($action == 'PROJECT_MODIFY') {
738 738
             dol_syslog(
739
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
739
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
740 740
             );
741 741
         } elseif ($action == 'PROJECT_DELETE') {
742 742
             dol_syslog(
743
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
743
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
744 744
             );
745 745
         }
746 746
 
747 747
         // Project tasks
748 748
         elseif ($action == 'TASK_CREATE') {
749 749
             dol_syslog(
750
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
750
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
751 751
             );
752 752
         } elseif ($action == 'TASK_MODIFY') {
753 753
             dol_syslog(
754
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
754
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
755 755
             );
756 756
         } elseif ($action == 'TASK_DELETE') {
757 757
             dol_syslog(
758
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
758
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
759 759
             );
760 760
         }
761 761
 
762 762
         // Task time spent
763 763
         elseif ($action == 'TASK_TIMESPENT_CREATE') {
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
         } elseif ($action == 'TASK_TIMESPENT_MODIFY') {
768 768
             dol_syslog(
769
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
769
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
770 770
             );
771 771
         } elseif ($action == 'TASK_TIMESPENT_DELETE') {
772 772
             dol_syslog(
773
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
773
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
774 774
             );
775 775
         }
776 776
 
777 777
         // Shipping
778 778
         elseif ($action == 'SHIPPING_CREATE') {
779 779
             dol_syslog(
780
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
780
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
781 781
             );
782 782
         } elseif ($action == 'SHIPPING_MODIFY') {
783 783
             dol_syslog(
784
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
784
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
785 785
             );
786 786
         } elseif ($action == 'SHIPPING_VALIDATE') {
787 787
             dol_syslog(
788
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
788
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
789 789
             );
790 790
         } elseif ($action == 'SHIPPING_SENTBYMAIL') {
791 791
             dol_syslog(
792
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
792
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
793 793
             );
794 794
         } elseif ($action == 'SHIPPING_DELETE') {
795 795
             dol_syslog(
796
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
796
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
797 797
             );
798 798
         } elseif ($action == 'SHIPPING_BUILDDOC') {
799 799
             dol_syslog(
800
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
800
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
801 801
             );
802 802
         }
803 803
 
804 804
         // File
805 805
         elseif ($action == 'FILE_UPLOAD') {
806 806
             dol_syslog(
807
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
807
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
808 808
             );
809 809
         } elseif ($action == 'FILE_DELETE') {
810 810
             dol_syslog(
811
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
811
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
812 812
             );
813 813
         }
814 814
 
Please login to merge, or discard this patch.
Braces   +73 added lines, -32 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
                         if(!empty($current_fk_commande)) {
@@ -257,7 +268,9 @@  discard block
 block discarded – undo
257 268
 		
258 269
 		if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && in_array($action, array('LINEPROPAL_INSERT', 'LINEPROPAL_UPDATE', 'LINEORDER_INSERT', 'LINEORDER_UPDATE', 'LINEBILL_INSERT', 'LINEBILL_UPDATE')))
259 270
 		{
260
-            if(! function_exists('_updateLineNC')) dol_include_once('/subtotal/lib/subtotal.lib.php');
271
+            if(! function_exists('_updateLineNC')) {
272
+            	dol_include_once('/subtotal/lib/subtotal.lib.php');
273
+            }
261 274
 
262 275
 			$doli_action = GETPOST('action');
263 276
 			$set = GETPOST('set');
@@ -275,32 +288,50 @@  discard block
 block discarded – undo
275 288
 						$object->total_ht = $object->total_tva = $object->total_ttc = $object->total_localtax1 = $object->total_localtax2 = 
276 289
 							$object->multicurrency_total_ht = $object->multicurrency_total_tva = $object->multicurrency_total_ttc = 0;
277 290
 
278
-						if ($object->element == 'propal') $res = $object->update(1);
279
-						else $res = $object->update($user, 1);
291
+						if ($object->element == 'propal') {
292
+							$res = $object->update(1);
293
+						} else {
294
+							$res = $object->update($user, 1);
295
+						}
280 296
 						
281
-						if ($res > 0) setEventMessage($langs->trans('subtotal_update_nc_success'));
297
+						if ($res > 0) {
298
+							setEventMessage($langs->trans('subtotal_update_nc_success'));
299
+						}
282 300
 						break;
283 301
 					}
284 302
 				}
285 303
 
286 304
 				// $object correspond à la ligne ajoutée
287
-				if(empty($object->array_options)) $object->fetch_optionals();
305
+				if(empty($object->array_options)) {
306
+					$object->fetch_optionals();
307
+				}
288 308
 
289 309
 				if(! empty($object->array_options['options_subtotal_nc'])) {
290 310
 					$object->total_ht = $object->total_tva = $object->total_ttc = $object->total_localtax1 = $object->total_localtax2 = 
291 311
 							$object->multicurrency_total_ht = $object->multicurrency_total_tva = $object->multicurrency_total_ttc = 0;
292 312
 
293
-					if ($object->element == 'propaldet') $res = $object->update(1);
294
-					else $res = $object->update($user, 1);
313
+					if ($object->element == 'propaldet') {
314
+						$res = $object->update(1);
315
+					} else {
316
+						$res = $object->update($user, 1);
317
+					}
295 318
 
296
-					if ($res > 0) setEventMessage($langs->trans('subtotal_update_nc_success'));
319
+					if ($res > 0) {
320
+						setEventMessage($langs->trans('subtotal_update_nc_success'));
321
+					}
297 322
 				}
298 323
 
299 324
 				// Correction d'un bug lors de la création d'une commande depuis une propale qui a, au moins, une ligne NC
300 325
 				$parent_element = '';
301
-				if($object->element == 'propaldet') $parent_element = 'propal';
302
-				if($object->element == 'commandedet') $parent_element = 'commande';
303
-				if($object->element == 'facturedet') $parent_element = 'facture';
326
+				if($object->element == 'propaldet') {
327
+					$parent_element = 'propal';
328
+				}
329
+				if($object->element == 'commandedet') {
330
+					$parent_element = 'commande';
331
+				}
332
+				if($object->element == 'facturedet') {
333
+					$parent_element = 'facture';
334
+				}
304 335
 
305 336
 				if(! empty($parent_element) && ! empty($object->array_options['options_subtotal_nc'])) {
306 337
 					_updateLineNC($parent_element, $object->{'fk_'.$parent_element}, $object->id, $object->array_options['options_subtotal_nc'], 1);
@@ -500,26 +531,38 @@  discard block
 block discarded – undo
500 531
 				);
501 532
 				
502 533
 				// En fonction de l'objet et de la version, les lignes conservent l'id de l'objet d'origine
503
-				if (method_exists($object, 'fetch_lines')) $object->fetch_lines();
504
-				else $object->fetch($object->id);
534
+				if (method_exists($object, 'fetch_lines')) {
535
+					$object->fetch_lines();
536
+				} else {
537
+					$object->fetch($object->id);
538
+				}
505 539
 			
506 540
 				foreach ($object->lines as &$line)
507 541
 				{
508
-					if (empty($line->array_options)) $line->fetch_optionals();
542
+					if (empty($line->array_options)) {
543
+						$line->fetch_optionals();
544
+					}
509 545
 					
510 546
 					if (!TSubtotal::isModSubtotalLine($line) && !empty($line->array_options['options_subtotal_nc']))
511 547
 					{
512 548
 						$line->total_ht = $line->total_tva = $line->total_ttc = $line->total_localtax1 = $line->total_localtax2 = 
513 549
 							$line->multicurrency_total_ht = $line->multicurrency_total_tva = $line->multicurrency_total_ttc = 0;
514 550
 
515
-						if ($line->element == 'propaldet') $res = $line->update(1);
516
-						else $res = $line->update($user, 1);
551
+						if ($line->element == 'propaldet') {
552
+							$res = $line->update(1);
553
+						} else {
554
+							$res = $line->update($user, 1);
555
+						}
517 556
 						
518
-						if ($res > 0) setEventMessage($langs->trans('subtotal_update_nc_success'));
557
+						if ($res > 0) {
558
+							setEventMessage($langs->trans('subtotal_update_nc_success'));
559
+						}
519 560
 					}
520 561
 				}
521 562
 				
522
-				if (!empty($line)) $object->update_price(1);
563
+				if (!empty($line)) {
564
+					$object->update_price(1);
565
+				}
523 566
 			}
524 567
 			
525 568
         } elseif ($action == 'PROPAL_MODIFY') {
@@ -589,9 +632,7 @@  discard block
 block discarded – undo
589 632
             dol_syslog(
590 633
                 "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
591 634
             );
592
-        }
593
-
594
-		elseif ($action == 'BILL_MODIFY') {
635
+        } elseif ($action == 'BILL_MODIFY') {
595 636
             dol_syslog(
596 637
                 "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
597 638
             );
Please login to merge, or discard this patch.
core/modules/modSubtotal.class.php 2 patches
Indentation   +401 added lines, -401 removed lines patch added patch discarded remove patch
@@ -31,186 +31,186 @@  discard block
 block discarded – undo
31 31
 class modSubtotal extends DolibarrModules
32 32
 {
33 33
 
34
-    /**
35
-     * 	Constructor. Define names, constants, directories, boxes, permissions
36
-     *
37
-     * 	@param	DoliDB		$db	Database handler
38
-     */
34
+	/**
35
+	 * 	Constructor. Define names, constants, directories, boxes, permissions
36
+	 *
37
+	 * 	@param	DoliDB		$db	Database handler
38
+	 */
39 39
      
40
-    public function __construct($db)
41
-    {
42
-        global $langs, $conf;
40
+	public function __construct($db)
41
+	{
42
+		global $langs, $conf;
43 43
 
44
-        $this->db = $db;
44
+		$this->db = $db;
45 45
 
46 46
 		$this->editor_name = 'ATM-Consulting';
47
-        // Id for module (must be unique).
48
-        // Use a free id here
49
-        // (See in Home -> System information -> Dolibarr for list of used modules id).
50
-        $this->numero = 104777; // 104000 to 104999 for ATM CONSULTING
51
-        // Key text used to identify module (for permissions, menus, etc...)
52
-        $this->rights_class = 'subtotal';
47
+		// Id for module (must be unique).
48
+		// Use a free id here
49
+		// (See in Home -> System information -> Dolibarr for list of used modules id).
50
+		$this->numero = 104777; // 104000 to 104999 for ATM CONSULTING
51
+		// Key text used to identify module (for permissions, menus, etc...)
52
+		$this->rights_class = 'subtotal';
53 53
 
54
-        // Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
55
-        // It is used to group modules in module setup page
56
-        $this->family = "technic";
57
-        // Module label (no space allowed)
58
-        // used if translation string 'ModuleXXXName' not found
59
-        // (where XXX is value of numeric property 'numero' of module)
60
-        $this->name = preg_replace('/^mod/i', '', get_class($this));
61
-        // Module description
62
-        // used if translation string 'ModuleXXXDesc' not found
63
-        // (where XXX is value of numeric property 'numero' of module)
64
-        $this->description = "Module permettant l'ajout de sous-totaux et sous-totaux intermédiaires et le déplacement d'une ligne aisée de l'un dans l'autre";
65
-        // Possible values for version are: 'development', 'experimental' or version
66
-        $this->version = '3.2.1';
67
-        // Key used in llx_const table to save module status enabled/disabled
68
-        // (where MYMODULE is value of property name of module in uppercase)
69
-        $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name);
70
-        // Where to store the module in setup page
71
-        // (0=common,1=interface,2=others,3=very specific)
72
-        $this->special = 2;
73
-        // Name of image file used for this module.
74
-        // If file is in theme/yourtheme/img directory under name object_pictovalue.png
75
-        // use this->picto='pictovalue'
76
-        // If file is in module/img directory under name object_pictovalue.png
77
-        // use this->picto='pictovalue@module'
78
-        $this->picto = 'subtotal@subtotal'; // mypicto@titre
79
-        // Defined all module parts (triggers, login, substitutions, menus, css, etc...)
80
-        // for default path (eg: /titre/core/xxxxx) (0=disable, 1=enable)
81
-        // for specific path of parts (eg: /titre/core/modules/barcode)
82
-        // for specific css file (eg: /titre/css/titre.css.php)
83
-        $this->module_parts = array(
84
-            // Set this to 1 if module has its own trigger directory
85
-            'triggers' => 1,
86
-            // Set this to 1 if module has its own login method directory
87
-            //'login' => 0,
88
-            // Set this to 1 if module has its own substitution function file
89
-            //'substitutions' => 0,
90
-            // Set this to 1 if module has its own menus handler directory
91
-            //'menus' => 0,
92
-            // Set this to 1 if module has its own barcode directory
93
-            //'barcode' => 0,
94
-            // Set this to 1 if module has its own models directory
95
-            'models' => 1,
96
-            // Set this to relative path of css if module has its own css file
97
-            //'css' => '/titre/css/mycss.css.php',
98
-            // Set here all hooks context managed by module
99
-            'hooks' => array(
100
-                'invoicecard'
101
-                ,'invoicesuppliercard'
102
-                ,'propalcard'
103
-                ,'supplier_proposalcard'
104
-                ,'ordercard'
105
-                ,'ordersuppliercard'
106
-                ,'odtgeneration'
107
-                ,'orderstoinvoice'
108
-                ,'admin'
109
-                ,'invoicereccard'
110
-                ,'consumptionthirdparty'
111
-            	,'ordershipmentcard'
112
-            	,'expeditioncard'
54
+		// Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
55
+		// It is used to group modules in module setup page
56
+		$this->family = "technic";
57
+		// Module label (no space allowed)
58
+		// used if translation string 'ModuleXXXName' not found
59
+		// (where XXX is value of numeric property 'numero' of module)
60
+		$this->name = preg_replace('/^mod/i', '', get_class($this));
61
+		// Module description
62
+		// used if translation string 'ModuleXXXDesc' not found
63
+		// (where XXX is value of numeric property 'numero' of module)
64
+		$this->description = "Module permettant l'ajout de sous-totaux et sous-totaux intermédiaires et le déplacement d'une ligne aisée de l'un dans l'autre";
65
+		// Possible values for version are: 'development', 'experimental' or version
66
+		$this->version = '3.2.1';
67
+		// Key used in llx_const table to save module status enabled/disabled
68
+		// (where MYMODULE is value of property name of module in uppercase)
69
+		$this->const_name = 'MAIN_MODULE_' . strtoupper($this->name);
70
+		// Where to store the module in setup page
71
+		// (0=common,1=interface,2=others,3=very specific)
72
+		$this->special = 2;
73
+		// Name of image file used for this module.
74
+		// If file is in theme/yourtheme/img directory under name object_pictovalue.png
75
+		// use this->picto='pictovalue'
76
+		// If file is in module/img directory under name object_pictovalue.png
77
+		// use this->picto='pictovalue@module'
78
+		$this->picto = 'subtotal@subtotal'; // mypicto@titre
79
+		// Defined all module parts (triggers, login, substitutions, menus, css, etc...)
80
+		// for default path (eg: /titre/core/xxxxx) (0=disable, 1=enable)
81
+		// for specific path of parts (eg: /titre/core/modules/barcode)
82
+		// for specific css file (eg: /titre/css/titre.css.php)
83
+		$this->module_parts = array(
84
+			// Set this to 1 if module has its own trigger directory
85
+			'triggers' => 1,
86
+			// Set this to 1 if module has its own login method directory
87
+			//'login' => 0,
88
+			// Set this to 1 if module has its own substitution function file
89
+			//'substitutions' => 0,
90
+			// Set this to 1 if module has its own menus handler directory
91
+			//'menus' => 0,
92
+			// Set this to 1 if module has its own barcode directory
93
+			//'barcode' => 0,
94
+			// Set this to 1 if module has its own models directory
95
+			'models' => 1,
96
+			// Set this to relative path of css if module has its own css file
97
+			//'css' => '/titre/css/mycss.css.php',
98
+			// Set here all hooks context managed by module
99
+			'hooks' => array(
100
+				'invoicecard'
101
+				,'invoicesuppliercard'
102
+				,'propalcard'
103
+				,'supplier_proposalcard'
104
+				,'ordercard'
105
+				,'ordersuppliercard'
106
+				,'odtgeneration'
107
+				,'orderstoinvoice'
108
+				,'admin'
109
+				,'invoicereccard'
110
+				,'consumptionthirdparty'
111
+				,'ordershipmentcard'
112
+				,'expeditioncard'
113 113
 				,'deliverycard'
114 114
 				,'paiementcard'
115
-            )
116
-            // Set here all workflow context managed by module
117
-            //'workflow' => array('order' => array('WORKFLOW_ORDER_AUTOCREATE_INVOICE'))
118
-        );
115
+			)
116
+			// Set here all workflow context managed by module
117
+			//'workflow' => array('order' => array('WORKFLOW_ORDER_AUTOCREATE_INVOICE'))
118
+		);
119 119
 
120
-        // Data directories to create when module is enabled.
121
-        // Example: this->dirs = array("/titre/temp");
122
-        $this->dirs = array();
120
+		// Data directories to create when module is enabled.
121
+		// Example: this->dirs = array("/titre/temp");
122
+		$this->dirs = array();
123 123
 
124
-        // Config pages. Put here list of php pages
125
-        // stored into titre/admin directory, used to setup module.
126
-        $this->config_page_url = array("subtotal_setup.php@subtotal");
124
+		// Config pages. Put here list of php pages
125
+		// stored into titre/admin directory, used to setup module.
126
+		$this->config_page_url = array("subtotal_setup.php@subtotal");
127 127
 
128
-        // Dependencies
129
-        // List of modules id that must be enabled if this module is enabled
130
-        $this->depends = array();
128
+		// Dependencies
129
+		// List of modules id that must be enabled if this module is enabled
130
+		$this->depends = array();
131 131
 
132 132
 		$this->conflictwith=array('modMilestone');
133
-        // List of modules id to disable if this one is disabled
134
-        $this->requiredby = array();
135
-        // Minimum version of PHP required by module
136
-        $this->phpmin = array(5, 3);
137
-        // Minimum version of Dolibarr required by module
138
-        $this->need_dolibarr_version = array(3, 2);
139
-        $this->langfiles = array("subtotal@subtotal"); // langfiles@titre
140
-        // Constants
141
-        // List of particular constants to add when module is enabled
142
-        // (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
143
-        // Example:
144
-        $this->const = array(
145
-            	0=>array(
146
-            		'SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES',
147
-            		'chaine',
148
-            		'I',
149
-            		'Définit le style (B : gras, I : Italique, U : Souligné) des sous titres lorsque le détail des lignes et des ensembles est caché',
150
-            		1
151
-            	)
133
+		// List of modules id to disable if this one is disabled
134
+		$this->requiredby = array();
135
+		// Minimum version of PHP required by module
136
+		$this->phpmin = array(5, 3);
137
+		// Minimum version of Dolibarr required by module
138
+		$this->need_dolibarr_version = array(3, 2);
139
+		$this->langfiles = array("subtotal@subtotal"); // langfiles@titre
140
+		// Constants
141
+		// List of particular constants to add when module is enabled
142
+		// (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
143
+		// Example:
144
+		$this->const = array(
145
+				0=>array(
146
+					'SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES',
147
+					'chaine',
148
+					'I',
149
+					'Définit le style (B : gras, I : Italique, U : Souligné) des sous titres lorsque le détail des lignes et des ensembles est caché',
150
+					1
151
+				)
152 152
 				,1=>array('SUBTOTAL_ALLOW_ADD_BLOCK', 'chaine', '1', 'Permet l\'ajout de titres et sous-totaux')
153 153
 				,2=>array('SUBTOTAL_ALLOW_EDIT_BLOCK', 'chaine', '1', 'Permet de modifier titres et sous-totaux')
154 154
 				,3=>array('SUBTOTAL_ALLOW_REMOVE_BLOCK', 'chaine', '1', 'Permet de supprimer les titres et sous-totaux')
155 155
 				,4=>array('SUBTOTAL_TITLE_STYLE', 'chaine', 'BU')
156 156
 				,5=>array('SUBTOTAL_SUBTOTAL_STYLE', 'chaine', 'B')
157
-            //	1=>array(
158
-            //		'MYMODULE_MYNEWCONST2',
159
-            //		'chaine',
160
-            //		'myvalue',
161
-            //		'This is another constant to add',
162
-            //		0
163
-            //	)
164
-        );
157
+			//	1=>array(
158
+			//		'MYMODULE_MYNEWCONST2',
159
+			//		'chaine',
160
+			//		'myvalue',
161
+			//		'This is another constant to add',
162
+			//		0
163
+			//	)
164
+		);
165 165
 		
166 166
 
167 167
 
168 168
 
169
-        // Array to add new pages in new tabs
170
-        // Example:
171
-        $this->tabs = array(
172
-            //	// To add a new tab identified by code tabname1
173
-            //	'objecttype:+tabname1:Title1:langfile@titre:$user->rights->titre->read:/titre/mynewtab1.php?id=__ID__',
174
-            //	// To add another new tab identified by code tabname2
175
-            //	'objecttype:+tabname2:Title2:langfile@titre:$user->rights->othermodule->read:/titre/mynewtab2.php?id=__ID__',
176
-            //	// To remove an existing tab identified by code tabname
177
-            //	'objecttype:-tabname'
178
-        );
179
-        // where objecttype can be
180
-        // 'thirdparty'			to add a tab in third party view
181
-        // 'intervention'		to add a tab in intervention view
182
-        // 'order_supplier'		to add a tab in supplier order view
183
-        // 'invoice_supplier'	to add a tab in supplier invoice view
184
-        // 'invoice'			to add a tab in customer invoice view
185
-        // 'order'				to add a tab in customer order view
186
-        // 'product'			to add a tab in product view
187
-        // 'stock'				to add a tab in stock view
188
-        // 'propal'				to add a tab in propal view
189
-        // 'member'				to add a tab in fundation member view
190
-        // 'contract'			to add a tab in contract view
191
-        // 'user'				to add a tab in user view
192
-        // 'group'				to add a tab in group view
193
-        // 'contact'			to add a tab in contact view
194
-        // 'categories_x'		to add a tab in category view
195
-        // (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member)
196
-        // Dictionnaries
197
-        if (! isset($conf->subtotal->enabled)) {
198
-            $conf->subtotal=new stdClass();
199
-            $conf->subtotal->enabled = 0;
200
-        }
201
-        $this->dictionaries = array(
169
+		// Array to add new pages in new tabs
170
+		// Example:
171
+		$this->tabs = array(
172
+			//	// To add a new tab identified by code tabname1
173
+			//	'objecttype:+tabname1:Title1:langfile@titre:$user->rights->titre->read:/titre/mynewtab1.php?id=__ID__',
174
+			//	// To add another new tab identified by code tabname2
175
+			//	'objecttype:+tabname2:Title2:langfile@titre:$user->rights->othermodule->read:/titre/mynewtab2.php?id=__ID__',
176
+			//	// To remove an existing tab identified by code tabname
177
+			//	'objecttype:-tabname'
178
+		);
179
+		// where objecttype can be
180
+		// 'thirdparty'			to add a tab in third party view
181
+		// 'intervention'		to add a tab in intervention view
182
+		// 'order_supplier'		to add a tab in supplier order view
183
+		// 'invoice_supplier'	to add a tab in supplier invoice view
184
+		// 'invoice'			to add a tab in customer invoice view
185
+		// 'order'				to add a tab in customer order view
186
+		// 'product'			to add a tab in product view
187
+		// 'stock'				to add a tab in stock view
188
+		// 'propal'				to add a tab in propal view
189
+		// 'member'				to add a tab in fundation member view
190
+		// 'contract'			to add a tab in contract view
191
+		// 'user'				to add a tab in user view
192
+		// 'group'				to add a tab in group view
193
+		// 'contact'			to add a tab in contact view
194
+		// 'categories_x'		to add a tab in category view
195
+		// (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member)
196
+		// Dictionnaries
197
+		if (! isset($conf->subtotal->enabled)) {
198
+			$conf->subtotal=new stdClass();
199
+			$conf->subtotal->enabled = 0;
200
+		}
201
+		$this->dictionaries = array(
202 202
 			'langs'=>'subtotal@subtotal',
203
-            'tabname'=>array(MAIN_DB_PREFIX.'c_subtotal_free_text'),		// List of tables we want to see into dictonnary editor
204
-            'tablib'=>array($langs->trans('subtotalFreeLineDictionary')),													// Label of tables
205
-            'tabsql'=>array('SELECT f.rowid as rowid, f.label, f.content, f.entity, f.active FROM '.MAIN_DB_PREFIX.'c_subtotal_free_text as f WHERE f.entity='.$conf->entity),	// Request to select fields
206
-            'tabsqlsort'=>array('label ASC'),																					// Sort order
207
-            'tabfield'=>array('label,content'),							// List of fields (result of select to show dictionary)
208
-            'tabfieldvalue'=>array('label,content'),						// List of fields (list of fields to edit a record)
209
-            'tabfieldinsert'=>array('label,content,entity'),					// List of fields (list of fields for insert)
210
-            'tabrowid'=>array('rowid'),											// Name of columns with primary key (try to always name it 'rowid')
211
-            'tabcond'=>array($conf->subtotal->enabled)	
203
+			'tabname'=>array(MAIN_DB_PREFIX.'c_subtotal_free_text'),		// List of tables we want to see into dictonnary editor
204
+			'tablib'=>array($langs->trans('subtotalFreeLineDictionary')),													// Label of tables
205
+			'tabsql'=>array('SELECT f.rowid as rowid, f.label, f.content, f.entity, f.active FROM '.MAIN_DB_PREFIX.'c_subtotal_free_text as f WHERE f.entity='.$conf->entity),	// Request to select fields
206
+			'tabsqlsort'=>array('label ASC'),																					// Sort order
207
+			'tabfield'=>array('label,content'),							// List of fields (result of select to show dictionary)
208
+			'tabfieldvalue'=>array('label,content'),						// List of fields (list of fields to edit a record)
209
+			'tabfieldinsert'=>array('label,content,entity'),					// List of fields (list of fields for insert)
210
+			'tabrowid'=>array('rowid'),											// Name of columns with primary key (try to always name it 'rowid')
211
+			'tabcond'=>array($conf->subtotal->enabled)	
212 212
 		);
213
-        /* Example:
213
+		/* Example:
214 214
           // This is to avoid warnings
215 215
           if (! isset($conf->titre->enabled)) $conf->titre->enabled=0;
216 216
           $this->dictionnaries=array(
@@ -251,223 +251,223 @@  discard block
 block discarded – undo
251 251
           );
252 252
          */
253 253
 
254
-        // Boxes
255
-        // Add here list of php file(s) stored in core/boxes that contains class to show a box.
256
-        $this->boxes = array(); // Boxes list
254
+		// Boxes
255
+		// Add here list of php file(s) stored in core/boxes that contains class to show a box.
256
+		$this->boxes = array(); // Boxes list
257 257
        
258
-        /*
258
+		/*
259 259
           $this->boxes[$r][1] = "myboxb.php";
260 260
           $r++;
261 261
          */
262 262
 
263
-        // Permissions
264
-        $this->rights = array(); // Permission array used by this module
265
-        $r = 0;
263
+		// Permissions
264
+		$this->rights = array(); // Permission array used by this module
265
+		$r = 0;
266 266
 
267
-        // Add here list of permission defined by
268
-        // an id, a label, a boolean and two constant strings.
269
-        // Example:
270
-        //// Permission id (must not be already used)
271
-        //$this->rights[$r][0] = 2000;
272
-        //// Permission label
273
-        //$this->rights[$r][1] = 'Permision label';
274
-        //// Permission by default for new user (0/1)
275
-        //$this->rights[$r][3] = 1;
276
-        //// In php code, permission will be checked by test
277
-        //// if ($user->rights->permkey->level1->level2)
278
-        //$this->rights[$r][4] = 'level1';
279
-        //// In php code, permission will be checked by test
280
-        //// if ($user->rights->permkey->level1->level2)
281
-        //$this->rights[$r][5] = 'level2';
282
-        //$r++;
283
-        // Main menu entries
284
-        $this->menus = array(); // List of menus to add
285
-        $r = 0;
267
+		// Add here list of permission defined by
268
+		// an id, a label, a boolean and two constant strings.
269
+		// Example:
270
+		//// Permission id (must not be already used)
271
+		//$this->rights[$r][0] = 2000;
272
+		//// Permission label
273
+		//$this->rights[$r][1] = 'Permision label';
274
+		//// Permission by default for new user (0/1)
275
+		//$this->rights[$r][3] = 1;
276
+		//// In php code, permission will be checked by test
277
+		//// if ($user->rights->permkey->level1->level2)
278
+		//$this->rights[$r][4] = 'level1';
279
+		//// In php code, permission will be checked by test
280
+		//// if ($user->rights->permkey->level1->level2)
281
+		//$this->rights[$r][5] = 'level2';
282
+		//$r++;
283
+		// Main menu entries
284
+		$this->menus = array(); // List of menus to add
285
+		$r = 0;
286 286
 
287
-        // Add here entries to declare new menus
288
-        //
289
-        // Example to declare a new Top Menu entry and its Left menu entry:
290
-        //$this->menu[$r]=array(
291
-        //	// Put 0 if this is a top menu
292
-        //	'fk_menu'=>0,
293
-        //	// This is a Top menu entry
294
-        //	'type'=>'top',
295
-        //	'titre'=>'titre top menu',
296
-        //	'mainmenu'=>'titre',
297
-        //	'leftmenu'=>'titre',
298
-        //	'url'=>'/titre/pagetop.php',
299
-        //	// Lang file to use (without .lang) by module.
300
-        //	// File must be in langs/code_CODE/ directory.
301
-        //	'langs'=>'mylangfile',
302
-        //	'position'=>100,
303
-        //	// Define condition to show or hide menu entry.
304
-        //	// Use '$conf->titre->enabled' if entry must be visible if module is enabled.
305
-        //	'enabled'=>'$conf->titre->enabled',
306
-        //	// Use 'perms'=>'$user->rights->titre->level1->level2'
307
-        //	// if you want your menu with a permission rules
308
-        //	'perms'=>'1',
309
-        //	'target'=>'',
310
-        //	// 0=Menu for internal users, 1=external users, 2=both
311
-        //	'user'=>2
312
-        //);
313
-        //$r++;
314
-        //$this->menu[$r]=array(
315
-        //	// Use r=value where r is index key used for the parent menu entry
316
-        //	// (higher parent must be a top menu entry)
317
-        //	'fk_menu'=>'r=0',
318
-        //	// This is a Left menu entry
319
-        //	'type'=>'left',
320
-        //	'titre'=>'titre left menu',
321
-        //	'mainmenu'=>'titre',
322
-        //	'leftmenu'=>'titre',
323
-        //	'url'=>'/titre/pagelevel1.php',
324
-        //	// Lang file to use (without .lang) by module.
325
-        //	// File must be in langs/code_CODE/ directory.
326
-        //	'langs'=>'mylangfile',
327
-        //	'position'=>100,
328
-        //	// Define condition to show or hide menu entry.
329
-        //	// Use '$conf->titre->enabled' if entry must be visible if module is enabled.
330
-        //	'enabled'=>'$conf->titre->enabled',
331
-        //	// Use 'perms'=>'$user->rights->titre->level1->level2'
332
-        //	// if you want your menu with a permission rules
333
-        //	'perms'=>'1',
334
-        //	'target'=>'',
335
-        //	// 0=Menu for internal users, 1=external users, 2=both
336
-        //	'user'=>2
337
-        //);
338
-        //$r++;
339
-        //
340
-        // Example to declare a Left Menu entry into an existing Top menu entry:
341
-        //$this->menu[$r]=array(
342
-        //	// Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy'
343
-        //	'fk_menu'=>'fk_mainmenu=mainmenucode',
344
-        //	// This is a Left menu entry
345
-        //	'type'=>'left',
346
-        //	'titre'=>'titre left menu',
347
-        //	'mainmenu'=>'mainmenucode',
348
-        //	'leftmenu'=>'titre',
349
-        //	'url'=>'/titre/pagelevel2.php',
350
-        //	// Lang file to use (without .lang) by module.
351
-        //	// File must be in langs/code_CODE/ directory.
352
-        //	'langs'=>'mylangfile',
353
-        //	'position'=>100,
354
-        //	// Define condition to show or hide menu entry.
355
-        //	// Use '$conf->titre->enabled' if entry must be visible if module is enabled.
356
-        //	// Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
357
-        //	'enabled'=>'$conf->titre->enabled',
358
-        //	// Use 'perms'=>'$user->rights->titre->level1->level2'
359
-        //	// if you want your menu with a permission rules
360
-        //	'perms'=>'1',
361
-        //	'target'=>'',
362
-        //	// 0=Menu for internal users, 1=external users, 2=both
363
-        //	'user'=>2
364
-        //);
365
-        //$r++;
366
-        // Exports
367
-        $r = 1;
287
+		// Add here entries to declare new menus
288
+		//
289
+		// Example to declare a new Top Menu entry and its Left menu entry:
290
+		//$this->menu[$r]=array(
291
+		//	// Put 0 if this is a top menu
292
+		//	'fk_menu'=>0,
293
+		//	// This is a Top menu entry
294
+		//	'type'=>'top',
295
+		//	'titre'=>'titre top menu',
296
+		//	'mainmenu'=>'titre',
297
+		//	'leftmenu'=>'titre',
298
+		//	'url'=>'/titre/pagetop.php',
299
+		//	// Lang file to use (without .lang) by module.
300
+		//	// File must be in langs/code_CODE/ directory.
301
+		//	'langs'=>'mylangfile',
302
+		//	'position'=>100,
303
+		//	// Define condition to show or hide menu entry.
304
+		//	// Use '$conf->titre->enabled' if entry must be visible if module is enabled.
305
+		//	'enabled'=>'$conf->titre->enabled',
306
+		//	// Use 'perms'=>'$user->rights->titre->level1->level2'
307
+		//	// if you want your menu with a permission rules
308
+		//	'perms'=>'1',
309
+		//	'target'=>'',
310
+		//	// 0=Menu for internal users, 1=external users, 2=both
311
+		//	'user'=>2
312
+		//);
313
+		//$r++;
314
+		//$this->menu[$r]=array(
315
+		//	// Use r=value where r is index key used for the parent menu entry
316
+		//	// (higher parent must be a top menu entry)
317
+		//	'fk_menu'=>'r=0',
318
+		//	// This is a Left menu entry
319
+		//	'type'=>'left',
320
+		//	'titre'=>'titre left menu',
321
+		//	'mainmenu'=>'titre',
322
+		//	'leftmenu'=>'titre',
323
+		//	'url'=>'/titre/pagelevel1.php',
324
+		//	// Lang file to use (without .lang) by module.
325
+		//	// File must be in langs/code_CODE/ directory.
326
+		//	'langs'=>'mylangfile',
327
+		//	'position'=>100,
328
+		//	// Define condition to show or hide menu entry.
329
+		//	// Use '$conf->titre->enabled' if entry must be visible if module is enabled.
330
+		//	'enabled'=>'$conf->titre->enabled',
331
+		//	// Use 'perms'=>'$user->rights->titre->level1->level2'
332
+		//	// if you want your menu with a permission rules
333
+		//	'perms'=>'1',
334
+		//	'target'=>'',
335
+		//	// 0=Menu for internal users, 1=external users, 2=both
336
+		//	'user'=>2
337
+		//);
338
+		//$r++;
339
+		//
340
+		// Example to declare a Left Menu entry into an existing Top menu entry:
341
+		//$this->menu[$r]=array(
342
+		//	// Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy'
343
+		//	'fk_menu'=>'fk_mainmenu=mainmenucode',
344
+		//	// This is a Left menu entry
345
+		//	'type'=>'left',
346
+		//	'titre'=>'titre left menu',
347
+		//	'mainmenu'=>'mainmenucode',
348
+		//	'leftmenu'=>'titre',
349
+		//	'url'=>'/titre/pagelevel2.php',
350
+		//	// Lang file to use (without .lang) by module.
351
+		//	// File must be in langs/code_CODE/ directory.
352
+		//	'langs'=>'mylangfile',
353
+		//	'position'=>100,
354
+		//	// Define condition to show or hide menu entry.
355
+		//	// Use '$conf->titre->enabled' if entry must be visible if module is enabled.
356
+		//	// Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
357
+		//	'enabled'=>'$conf->titre->enabled',
358
+		//	// Use 'perms'=>'$user->rights->titre->level1->level2'
359
+		//	// if you want your menu with a permission rules
360
+		//	'perms'=>'1',
361
+		//	'target'=>'',
362
+		//	// 0=Menu for internal users, 1=external users, 2=both
363
+		//	'user'=>2
364
+		//);
365
+		//$r++;
366
+		// Exports
367
+		$r = 1;
368 368
 
369
-        // Example:
370
-        //$this->export_code[$r]=$this->rights_class.'_'.$r;
371
-        //// Translation key (used only if key ExportDataset_xxx_z not found)
372
-        //$this->export_label[$r]='CustomersInvoicesAndInvoiceLines';
373
-        //// Condition to show export in list (ie: '$user->id==3').
374
-        //// Set to 1 to always show when module is enabled.
375
-        //$this->export_enabled[$r]='1';
376
-        //$this->export_permission[$r]=array(array("facture","facture","export"));
377
-        //$this->export_fields_array[$r]=array(
378
-        //	's.rowid'=>"IdCompany",
379
-        //	's.nom'=>'CompanyName',
380
-        //	's.address'=>'Address',
381
-        //	's.cp'=>'Zip',
382
-        //	's.ville'=>'Town',
383
-        //	's.fk_pays'=>'Country',
384
-        //	's.tel'=>'Phone',
385
-        //	's.siren'=>'ProfId1',
386
-        //	's.siret'=>'ProfId2',
387
-        //	's.ape'=>'ProfId3',
388
-        //	's.idprof4'=>'ProfId4',
389
-        //	's.code_compta'=>'CustomerAccountancyCode',
390
-        //	's.code_compta_fournisseur'=>'SupplierAccountancyCode',
391
-        //	'f.rowid'=>"InvoiceId",
392
-        //	'f.facnumber'=>"InvoiceRef",
393
-        //	'f.datec'=>"InvoiceDateCreation",
394
-        //	'f.datef'=>"DateInvoice",
395
-        //	'f.total'=>"TotalHT",
396
-        //	'f.total_ttc'=>"TotalTTC",
397
-        //	'f.tva'=>"TotalVAT",
398
-        //	'f.paye'=>"InvoicePaid",
399
-        //	'f.fk_statut'=>'InvoiceStatus',
400
-        //	'f.note'=>"InvoiceNote",
401
-        //	'fd.rowid'=>'LineId',
402
-        //	'fd.description'=>"LineDescription",
403
-        //	'fd.price'=>"LineUnitPrice",
404
-        //	'fd.tva_tx'=>"LineVATRate",
405
-        //	'fd.qty'=>"LineQty",
406
-        //	'fd.total_ht'=>"LineTotalHT",
407
-        //	'fd.total_tva'=>"LineTotalTVA",
408
-        //	'fd.total_ttc'=>"LineTotalTTC",
409
-        //	'fd.date_start'=>"DateStart",
410
-        //	'fd.date_end'=>"DateEnd",
411
-        //	'fd.fk_product'=>'ProductId',
412
-        //	'p.ref'=>'ProductRef'
413
-        //);
414
-        //$this->export_entities_array[$r]=array('s.rowid'=>"company",
415
-        //	's.nom'=>'company',
416
-        //	's.address'=>'company',
417
-        //	's.cp'=>'company',
418
-        //	's.ville'=>'company',
419
-        //	's.fk_pays'=>'company',
420
-        //	's.tel'=>'company',
421
-        //	's.siren'=>'company',
422
-        //	's.siret'=>'company',
423
-        //	's.ape'=>'company',
424
-        //	's.idprof4'=>'company',
425
-        //	's.code_compta'=>'company',
426
-        //	's.code_compta_fournisseur'=>'company',
427
-        //	'f.rowid'=>"invoice",
428
-        //	'f.facnumber'=>"invoice",
429
-        //	'f.datec'=>"invoice",
430
-        //	'f.datef'=>"invoice",
431
-        //	'f.total'=>"invoice",
432
-        //	'f.total_ttc'=>"invoice",
433
-        //	'f.tva'=>"invoice",
434
-        //	'f.paye'=>"invoice",
435
-        //	'f.fk_statut'=>'invoice',
436
-        //	'f.note'=>"invoice",
437
-        //	'fd.rowid'=>'invoice_line',
438
-        //	'fd.description'=>"invoice_line",
439
-        //	'fd.price'=>"invoice_line",
440
-        //	'fd.total_ht'=>"invoice_line",
441
-        //	'fd.total_tva'=>"invoice_line",
442
-        //	'fd.total_ttc'=>"invoice_line",
443
-        //	'fd.tva_tx'=>"invoice_line",
444
-        //	'fd.qty'=>"invoice_line",
445
-        //	'fd.date_start'=>"invoice_line",
446
-        //	'fd.date_end'=>"invoice_line",
447
-        //	'fd.fk_product'=>'product',
448
-        //	'p.ref'=>'product'
449
-        //);
450
-        //$this->export_sql_start[$r] = 'SELECT DISTINCT ';
451
-        //$this->export_sql_end[$r] = ' FROM (' . MAIN_DB_PREFIX . 'facture as f, '
452
-        //	. MAIN_DB_PREFIX . 'facturedet as fd, ' . MAIN_DB_PREFIX . 'societe as s)';
453
-        //$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX
454
-        //	. 'product as p on (fd.fk_product = p.rowid)';
455
-        //$this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid '
456
-        //	. 'AND f.rowid = fd.fk_facture';
457
-        //$r++;
458
-    }
369
+		// Example:
370
+		//$this->export_code[$r]=$this->rights_class.'_'.$r;
371
+		//// Translation key (used only if key ExportDataset_xxx_z not found)
372
+		//$this->export_label[$r]='CustomersInvoicesAndInvoiceLines';
373
+		//// Condition to show export in list (ie: '$user->id==3').
374
+		//// Set to 1 to always show when module is enabled.
375
+		//$this->export_enabled[$r]='1';
376
+		//$this->export_permission[$r]=array(array("facture","facture","export"));
377
+		//$this->export_fields_array[$r]=array(
378
+		//	's.rowid'=>"IdCompany",
379
+		//	's.nom'=>'CompanyName',
380
+		//	's.address'=>'Address',
381
+		//	's.cp'=>'Zip',
382
+		//	's.ville'=>'Town',
383
+		//	's.fk_pays'=>'Country',
384
+		//	's.tel'=>'Phone',
385
+		//	's.siren'=>'ProfId1',
386
+		//	's.siret'=>'ProfId2',
387
+		//	's.ape'=>'ProfId3',
388
+		//	's.idprof4'=>'ProfId4',
389
+		//	's.code_compta'=>'CustomerAccountancyCode',
390
+		//	's.code_compta_fournisseur'=>'SupplierAccountancyCode',
391
+		//	'f.rowid'=>"InvoiceId",
392
+		//	'f.facnumber'=>"InvoiceRef",
393
+		//	'f.datec'=>"InvoiceDateCreation",
394
+		//	'f.datef'=>"DateInvoice",
395
+		//	'f.total'=>"TotalHT",
396
+		//	'f.total_ttc'=>"TotalTTC",
397
+		//	'f.tva'=>"TotalVAT",
398
+		//	'f.paye'=>"InvoicePaid",
399
+		//	'f.fk_statut'=>'InvoiceStatus',
400
+		//	'f.note'=>"InvoiceNote",
401
+		//	'fd.rowid'=>'LineId',
402
+		//	'fd.description'=>"LineDescription",
403
+		//	'fd.price'=>"LineUnitPrice",
404
+		//	'fd.tva_tx'=>"LineVATRate",
405
+		//	'fd.qty'=>"LineQty",
406
+		//	'fd.total_ht'=>"LineTotalHT",
407
+		//	'fd.total_tva'=>"LineTotalTVA",
408
+		//	'fd.total_ttc'=>"LineTotalTTC",
409
+		//	'fd.date_start'=>"DateStart",
410
+		//	'fd.date_end'=>"DateEnd",
411
+		//	'fd.fk_product'=>'ProductId',
412
+		//	'p.ref'=>'ProductRef'
413
+		//);
414
+		//$this->export_entities_array[$r]=array('s.rowid'=>"company",
415
+		//	's.nom'=>'company',
416
+		//	's.address'=>'company',
417
+		//	's.cp'=>'company',
418
+		//	's.ville'=>'company',
419
+		//	's.fk_pays'=>'company',
420
+		//	's.tel'=>'company',
421
+		//	's.siren'=>'company',
422
+		//	's.siret'=>'company',
423
+		//	's.ape'=>'company',
424
+		//	's.idprof4'=>'company',
425
+		//	's.code_compta'=>'company',
426
+		//	's.code_compta_fournisseur'=>'company',
427
+		//	'f.rowid'=>"invoice",
428
+		//	'f.facnumber'=>"invoice",
429
+		//	'f.datec'=>"invoice",
430
+		//	'f.datef'=>"invoice",
431
+		//	'f.total'=>"invoice",
432
+		//	'f.total_ttc'=>"invoice",
433
+		//	'f.tva'=>"invoice",
434
+		//	'f.paye'=>"invoice",
435
+		//	'f.fk_statut'=>'invoice',
436
+		//	'f.note'=>"invoice",
437
+		//	'fd.rowid'=>'invoice_line',
438
+		//	'fd.description'=>"invoice_line",
439
+		//	'fd.price'=>"invoice_line",
440
+		//	'fd.total_ht'=>"invoice_line",
441
+		//	'fd.total_tva'=>"invoice_line",
442
+		//	'fd.total_ttc'=>"invoice_line",
443
+		//	'fd.tva_tx'=>"invoice_line",
444
+		//	'fd.qty'=>"invoice_line",
445
+		//	'fd.date_start'=>"invoice_line",
446
+		//	'fd.date_end'=>"invoice_line",
447
+		//	'fd.fk_product'=>'product',
448
+		//	'p.ref'=>'product'
449
+		//);
450
+		//$this->export_sql_start[$r] = 'SELECT DISTINCT ';
451
+		//$this->export_sql_end[$r] = ' FROM (' . MAIN_DB_PREFIX . 'facture as f, '
452
+		//	. MAIN_DB_PREFIX . 'facturedet as fd, ' . MAIN_DB_PREFIX . 'societe as s)';
453
+		//$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX
454
+		//	. 'product as p on (fd.fk_product = p.rowid)';
455
+		//$this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid '
456
+		//	. 'AND f.rowid = fd.fk_facture';
457
+		//$r++;
458
+	}
459 459
 
460
-    /**
461
-     * Function called when module is enabled.
462
-     * The init function add constants, boxes, permissions and menus
463
-     * (defined in constructor) into Dolibarr database.
464
-     * It also creates data directories
465
-     *
466
-     * 	@param		string	$options	Options when enabling module ('', 'noboxes')
467
-     * 	@return		int					1 if OK, 0 if KO
468
-     */
469
-    public function init($options = '')
470
-    {
460
+	/**
461
+	 * Function called when module is enabled.
462
+	 * The init function add constants, boxes, permissions and menus
463
+	 * (defined in constructor) into Dolibarr database.
464
+	 * It also creates data directories
465
+	 *
466
+	 * 	@param		string	$options	Options when enabling module ('', 'noboxes')
467
+	 * 	@return		int					1 if OK, 0 if KO
468
+	 */
469
+	public function init($options = '')
470
+	{
471 471
 	  	global $conf, $db;
472 472
 		
473 473
 		
@@ -475,46 +475,46 @@  discard block
 block discarded – undo
475 475
 			exit("Attention, ce module rentre ne conflit avec le module Jalon/Milestones. Merci de le désactiver auparavant.");
476 476
 		}
477 477
       */
478
-	    $sql = array();
478
+		$sql = array();
479 479
 
480
-        $result = $this->loadTables();
481
-        dol_include_once('/core/class/extrafields.class.php');
480
+		$result = $this->loadTables();
481
+		dol_include_once('/core/class/extrafields.class.php');
482 482
 	
483
-        $extra = new ExtraFields($db); // propaldet, commandedet, facturedet
484
-        $TElementType = array('propaldet', 'commandedet', 'facturedet', 'supplier_proposaldet', 'commande_fournisseurdet', 'facture_fourn_det');
485
-        foreach($TElementType as $element_type) {
486
-            $extra->addExtraField('show_total_ht', 'Afficher le Total HT sur le sous-total', 'int', 0, 10, $element_type, 0, 0, '', unserialize('a:1:{s:7:"options";a:1:{s:0:"";N;}}'), 0, '', 0, 1);
487
-            $extra->addExtraField('show_reduc', 'Afficher la réduction sur le sous-total', 'int', 0, 10, $element_type, 0, 0, '', unserialize('a:1:{s:7:"options";a:1:{s:0:"";N;}}'), 0, '', 0, 1);
488
-        }
483
+		$extra = new ExtraFields($db); // propaldet, commandedet, facturedet
484
+		$TElementType = array('propaldet', 'commandedet', 'facturedet', 'supplier_proposaldet', 'commande_fournisseurdet', 'facture_fourn_det');
485
+		foreach($TElementType as $element_type) {
486
+			$extra->addExtraField('show_total_ht', 'Afficher le Total HT sur le sous-total', 'int', 0, 10, $element_type, 0, 0, '', unserialize('a:1:{s:7:"options";a:1:{s:0:"";N;}}'), 0, '', 0, 1);
487
+			$extra->addExtraField('show_reduc', 'Afficher la réduction sur le sous-total', 'int', 0, 10, $element_type, 0, 0, '', unserialize('a:1:{s:7:"options";a:1:{s:0:"";N;}}'), 0, '', 0, 1);
488
+		}
489 489
 		
490
-        return $this->_init($sql, $options);
491
-    }
490
+		return $this->_init($sql, $options);
491
+	}
492 492
 
493
-    /**
494
-     * Function called when module is disabled.
495
-     * Remove from database constants, boxes and permissions from Dolibarr database.
496
-     * Data directories are not deleted
497
-     *
498
-     * 	@param		string	$options	Options when enabling module ('', 'noboxes')
499
-     * 	@return		int					1 if OK, 0 if KO
500
-     */
501
-    public function remove($options = '')
502
-    {
503
-        $sql = array();
493
+	/**
494
+	 * Function called when module is disabled.
495
+	 * Remove from database constants, boxes and permissions from Dolibarr database.
496
+	 * Data directories are not deleted
497
+	 *
498
+	 * 	@param		string	$options	Options when enabling module ('', 'noboxes')
499
+	 * 	@return		int					1 if OK, 0 if KO
500
+	 */
501
+	public function remove($options = '')
502
+	{
503
+		$sql = array();
504 504
 
505
-        return $this->_remove($sql, $options);
506
-    }
505
+		return $this->_remove($sql, $options);
506
+	}
507 507
 
508
-    /**
509
-     * Create tables, keys and data required by module
510
-     * Files llx_table1.sql, llx_table1.key.sql llx_data.sql with create table, create keys
511
-     * and create data commands must be stored in directory /titre/sql/
512
-     * This function is called by this->init
513
-     *
514
-     * 	@return		int		<=0 if KO, >0 if OK
515
-     */
516
-    private function loadTables()
517
-    {
518
-        return $this->_load_tables('/subtotal/sql/');
519
-    }
508
+	/**
509
+	 * Create tables, keys and data required by module
510
+	 * Files llx_table1.sql, llx_table1.key.sql llx_data.sql with create table, create keys
511
+	 * and create data commands must be stored in directory /titre/sql/
512
+	 * This function is called by this->init
513
+	 *
514
+	 * 	@return		int		<=0 if KO, >0 if OK
515
+	 */
516
+	private function loadTables()
517
+	{
518
+		return $this->_load_tables('/subtotal/sql/');
519
+	}
520 520
 }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  * 	\ingroup	titre
24 24
  * 	\brief		Description and activation file for module titre
25 25
  */
26
-include_once DOL_DOCUMENT_ROOT . "/core/modules/DolibarrModules.class.php";
26
+include_once DOL_DOCUMENT_ROOT."/core/modules/DolibarrModules.class.php";
27 27
 
28 28
 /**
29 29
  * Description and activation class for module titre
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
         $this->version = '3.2.1';
67 67
         // Key used in llx_const table to save module status enabled/disabled
68 68
         // (where MYMODULE is value of property name of module in uppercase)
69
-        $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name);
69
+        $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
70 70
         // Where to store the module in setup page
71 71
         // (0=common,1=interface,2=others,3=very specific)
72 72
         $this->special = 2;
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
         // List of modules id that must be enabled if this module is enabled
130 130
         $this->depends = array();
131 131
 
132
-		$this->conflictwith=array('modMilestone');
132
+		$this->conflictwith = array('modMilestone');
133 133
         // List of modules id to disable if this one is disabled
134 134
         $this->requiredby = array();
135 135
         // Minimum version of PHP required by module
@@ -194,20 +194,20 @@  discard block
 block discarded – undo
194 194
         // 'categories_x'		to add a tab in category view
195 195
         // (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member)
196 196
         // Dictionnaries
197
-        if (! isset($conf->subtotal->enabled)) {
198
-            $conf->subtotal=new stdClass();
197
+        if (!isset($conf->subtotal->enabled)) {
198
+            $conf->subtotal = new stdClass();
199 199
             $conf->subtotal->enabled = 0;
200 200
         }
201 201
         $this->dictionaries = array(
202 202
 			'langs'=>'subtotal@subtotal',
203
-            'tabname'=>array(MAIN_DB_PREFIX.'c_subtotal_free_text'),		// List of tables we want to see into dictonnary editor
204
-            'tablib'=>array($langs->trans('subtotalFreeLineDictionary')),													// Label of tables
205
-            'tabsql'=>array('SELECT f.rowid as rowid, f.label, f.content, f.entity, f.active FROM '.MAIN_DB_PREFIX.'c_subtotal_free_text as f WHERE f.entity='.$conf->entity),	// Request to select fields
206
-            'tabsqlsort'=>array('label ASC'),																					// Sort order
207
-            'tabfield'=>array('label,content'),							// List of fields (result of select to show dictionary)
208
-            'tabfieldvalue'=>array('label,content'),						// List of fields (list of fields to edit a record)
209
-            'tabfieldinsert'=>array('label,content,entity'),					// List of fields (list of fields for insert)
210
-            'tabrowid'=>array('rowid'),											// Name of columns with primary key (try to always name it 'rowid')
203
+            'tabname'=>array(MAIN_DB_PREFIX.'c_subtotal_free_text'), // List of tables we want to see into dictonnary editor
204
+            'tablib'=>array($langs->trans('subtotalFreeLineDictionary')), // Label of tables
205
+            'tabsql'=>array('SELECT f.rowid as rowid, f.label, f.content, f.entity, f.active FROM '.MAIN_DB_PREFIX.'c_subtotal_free_text as f WHERE f.entity='.$conf->entity), // Request to select fields
206
+            'tabsqlsort'=>array('label ASC'), // Sort order
207
+            'tabfield'=>array('label,content'), // List of fields (result of select to show dictionary)
208
+            'tabfieldvalue'=>array('label,content'), // List of fields (list of fields to edit a record)
209
+            'tabfieldinsert'=>array('label,content,entity'), // List of fields (list of fields for insert)
210
+            'tabrowid'=>array('rowid'), // Name of columns with primary key (try to always name it 'rowid')
211 211
             'tabcond'=>array($conf->subtotal->enabled)	
212 212
 		);
213 213
         /* Example:
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
 	
483 483
         $extra = new ExtraFields($db); // propaldet, commandedet, facturedet
484 484
         $TElementType = array('propaldet', 'commandedet', 'facturedet', 'supplier_proposaldet', 'commande_fournisseurdet', 'facture_fourn_det');
485
-        foreach($TElementType as $element_type) {
485
+        foreach ($TElementType as $element_type) {
486 486
             $extra->addExtraField('show_total_ht', 'Afficher le Total HT sur le sous-total', 'int', 0, 10, $element_type, 0, 0, '', unserialize('a:1:{s:7:"options";a:1:{s:0:"";N;}}'), 0, '', 0, 1);
487 487
             $extra->addExtraField('show_reduc', 'Afficher la réduction sur le sous-total', 'int', 0, 10, $element_type, 0, 0, '', unserialize('a:1:{s:7:"options";a:1:{s:0:"";N;}}'), 0, '', 0, 1);
488 488
         }
Please login to merge, or discard this patch.
class/actions_subtotal.class.php 3 patches
Indentation   +304 added lines, -304 removed lines patch added patch discarded remove patch
@@ -101,11 +101,11 @@  discard block
 block discarded – undo
101 101
 	 * @return     void
102 102
 	 */
103 103
     
104
-    var $module_number = 104777;
104
+	var $module_number = 104777;
105 105
     
106
-    function formObjectOptions($parameters, &$object, &$action, $hookmanager) 
107
-    {
108
-      	global $langs,$db,$user, $conf;
106
+	function formObjectOptions($parameters, &$object, &$action, $hookmanager) 
107
+	{
108
+	  	global $langs,$db,$user, $conf;
109 109
 		
110 110
 		$langs->load('subtotal@subtotal');
111 111
 		
@@ -120,10 +120,10 @@  discard block
 block discarded – undo
120 120
 				$createRight = $user->rights->facture->creer;
121 121
 			} elseif($object->element == 'order_supplier' )
122 122
 			{
123
-			    $createRight = $user->rights->fournisseur->commande->creer;
123
+				$createRight = $user->rights->fournisseur->commande->creer;
124 124
 			} elseif($object->element == 'invoice_supplier' )
125 125
 			{
126
-			    $createRight = $user->rights->fournisseur->facture->creer;
126
+				$createRight = $user->rights->fournisseur->facture->creer;
127 127
 			}
128 128
 			elseif($object->element == 'shipping')
129 129
 			{
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 					
178 178
 					if (!empty($conf->global->SUBTOTAL_AUTO_ADD_SUBTOTAL_ON_ADDING_NEW_TITLE) && $qty < 10) TSubtotal::addSubtotalMissing($object, $qty);
179 179
 					
180
-	    			TSubtotal::addSubTotalLine($object, $title, $qty);
180
+					TSubtotal::addSubTotalLine($object, $title, $qty);
181 181
 				}
182 182
 				else if($action==='ask_deleteallline') {
183 183
 						$form=new Form($db);
@@ -399,36 +399,36 @@  discard block
 block discarded – undo
399 399
 		$TContext = explode(':',$parameters['context']);
400 400
 		if (
401 401
 				in_array('invoicecard',$TContext)
402
-		        || in_array('invoicesuppliercard',$TContext)
402
+				|| in_array('invoicesuppliercard',$TContext)
403 403
 				|| in_array('propalcard',$TContext)
404 404
 				|| in_array('ordercard',$TContext)
405
-		        || in_array('ordersuppliercard',$TContext)
405
+				|| in_array('ordersuppliercard',$TContext)
406 406
 				|| in_array('invoicereccard',$TContext)
407 407
 			)
408
-	        {	
409
-	            $hideInnerLines	= isset( $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] ) ?  $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] : 0;
410
-	            $hidedetails	= isset( $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] ) ?  $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] : 0;
408
+			{	
409
+				$hideInnerLines	= isset( $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] ) ?  $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] : 0;
410
+				$hidedetails	= isset( $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] ) ?  $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] : 0;
411 411
 				$hidepricesDefaultConf = !empty($conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED)?$conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED:0;
412 412
 				$hideprices= isset( $_SESSION['subtotal_hideprices_'.$parameters['modulepart']][$object->id] ) ?  $_SESSION['subtotal_hideprices_'.$parameters['modulepart']][$object->id] : $hidepricesDefaultConf;
413 413
 				
414 414
 				$var=false;
415
-		     	$out.= '<tr '.$bc[$var].'>
415
+			 	$out.= '<tr '.$bc[$var].'>
416 416
 		     			<td colspan="4" align="right">
417 417
 		     				<label for="hideInnerLines">'.$langs->trans('HideInnerLines').'</label>
418 418
 		     				<input type="checkbox" onclick="if($(this).is(\':checked\')) { $(\'#hidedetails\').prop(\'checked\', \'checked\')  }" id="hideInnerLines" name="hideInnerLines" value="1" '.(( $hideInnerLines ) ? 'checked="checked"' : '' ).' />
419 419
 		     			</td>
420 420
 		     			</tr>';
421 421
 				
422
-		     	$var=!$var;
423
-		     	$out.= '<tr '.$bc[$var].'>
422
+			 	$var=!$var;
423
+			 	$out.= '<tr '.$bc[$var].'>
424 424
 		     			<td colspan="4" align="right">
425 425
 		     				<label for="hidedetails">'.$langs->trans('SubTotalhidedetails').'</label>
426 426
 		     				<input type="checkbox" id="hidedetails" name="hidedetails" value="1" '.(( $hidedetails ) ? 'checked="checked"' : '' ).' />
427 427
 		     			</td>
428 428
 		     			</tr>';
429 429
 		     	
430
-		     	$var=!$var;
431
-		     	$out.= '<tr '.$bc[$var].'>
430
+			 	$var=!$var;
431
+			 	$out.= '<tr '.$bc[$var].'>
432 432
 		     			<td colspan="4" align="right">
433 433
 		     				<label for="hideprices">'.$langs->trans('SubTotalhidePrice').'</label>
434 434
 		     				<input type="checkbox" id="hideprices" name="hideprices" value="1" '.(( $hideprices ) ? 'checked="checked"' : '' ).' />
@@ -440,9 +440,9 @@  discard block
 block discarded – undo
440 440
 				if ( 
441 441
 					(in_array('propalcard',$TContext) && !empty($conf->global->SUBTOTAL_PROPAL_ADD_RECAP))
442 442
 					|| (in_array('ordercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP))
443
-				    || (in_array('ordersuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP))
443
+					|| (in_array('ordersuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP))
444 444
 					|| (in_array('invoicecard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP))
445
-				    || (in_array('invoicesuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP))
445
+					|| (in_array('invoicesuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP))
446 446
 					|| (in_array('invoicereccard',$TContext)  && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP ))
447 447
 				)
448 448
 				{
@@ -461,19 +461,19 @@  discard block
 block discarded – undo
461 461
 			}
462 462
 			
463 463
 		
464
-        return 1;
464
+		return 1;
465 465
 	} 
466 466
 	 
467
-    function formEditProductOptions($parameters, &$object, &$action, $hookmanager) 
468
-    {
467
+	function formEditProductOptions($parameters, &$object, &$action, $hookmanager) 
468
+	{
469 469
 		
470
-    	if (in_array('invoicecard',explode(':',$parameters['context'])))
471
-        {
470
+		if (in_array('invoicecard',explode(':',$parameters['context'])))
471
+		{
472 472
         	
473
-        }
473
+		}
474 474
 		
475
-        return 0;
476
-    }
475
+		return 0;
476
+	}
477 477
 	
478 478
 	function ODTSubstitutionLine(&$parameters, &$object, $action, $hookmanager) {
479 479
 		global $conf;
@@ -484,14 +484,14 @@  discard block
 block discarded – undo
484 484
 			$object = &$parameters['object'];
485 485
 			$substitutionarray = &$parameters['substitutionarray'];
486 486
 			
487
-            $substitutionarray['line_not_modsubtotal'] = true;
488
-            $substitutionarray['line_modsubtotal'] = false;
489
-            $substitutionarray['line_modsubtotal_total'] = false;
490
-            $substitutionarray['line_modsubtotal_title'] = false;
487
+			$substitutionarray['line_not_modsubtotal'] = true;
488
+			$substitutionarray['line_modsubtotal'] = false;
489
+			$substitutionarray['line_modsubtotal_total'] = false;
490
+			$substitutionarray['line_modsubtotal_title'] = false;
491 491
 
492 492
 			if($line->product_type == 9 && $line->special_code == $this->module_number) {
493 493
 				$substitutionarray['line_modsubtotal'] = 1;	
494
-                $substitutionarray['line_not_modsubtotal'] = false;
494
+				$substitutionarray['line_not_modsubtotal'] = false;
495 495
 				
496 496
 				$substitutionarray['line_price_ht']
497 497
 					 = $substitutionarray['line_price_vat'] 
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
 					$substitutionarray['line_modsubtotal_total'] = true;
506 506
 					
507 507
 					//list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1);
508
-                    $TInfo = $this->getTotalLineFromObject($object, $line, '', 1);
508
+					$TInfo = $this->getTotalLineFromObject($object, $line, '', 1);
509 509
 
510 510
 					$substitutionarray['line_price_ht'] = price($TInfo[0]);
511 511
 					$substitutionarray['line_price_vat'] = price($TInfo[1]);
@@ -529,11 +529,11 @@  discard block
 block discarded – undo
529 529
 	
530 530
 		if (
531 531
 				in_array('invoicecard',explode(':',$parameters['context']))
532
-		        || in_array('invoicesuppliercard',explode(':',$parameters['context']))
532
+				|| in_array('invoicesuppliercard',explode(':',$parameters['context']))
533 533
 				|| in_array('propalcard',explode(':',$parameters['context']))
534
-		        || in_array('supplier_proposalcard',explode(':',$parameters['context']))
534
+				|| in_array('supplier_proposalcard',explode(':',$parameters['context']))
535 535
 				|| in_array('ordercard',explode(':',$parameters['context']))
536
-		        || in_array('ordersuppliercard',explode(':',$parameters['context']))
536
+				|| in_array('ordersuppliercard',explode(':',$parameters['context']))
537 537
 				|| in_array('invoicereccard',explode(':',$parameters['context']))
538 538
 		) {
539 539
 			
@@ -612,20 +612,20 @@  discard block
 block discarded – undo
612 612
 				in_array('invoicecard',explode(':',$parameters['context']))
613 613
 				|| in_array('propalcard',explode(':',$parameters['context']))
614 614
 				|| in_array('ordercard',explode(':',$parameters['context']))
615
-			    || in_array('ordersuppliercard',explode(':',$parameters['context']))
616
-			    || in_array('invoicesuppliercard',explode(':',$parameters['context']))
617
-			    || in_array('supplier_proposalcard',explode(':',$parameters['context']))
615
+				|| in_array('ordersuppliercard',explode(':',$parameters['context']))
616
+				|| in_array('invoicesuppliercard',explode(':',$parameters['context']))
617
+				|| in_array('supplier_proposalcard',explode(':',$parameters['context']))
618 618
 			)
619
-	        {								
619
+			{								
620 620
 				if(in_array('invoicecard',explode(':',$parameters['context']))) {
621 621
 					$sessname = 'subtotal_hideInnerLines_facture';	
622 622
 					$sessname2 = 'subtotal_hidedetails_facture';
623 623
 					$sessname3 = 'subtotal_hideprices_facture';
624 624
 				}
625 625
 				elseif(in_array('invoicesuppliercard',explode(':',$parameters['context']))) {
626
-				    $sessname = 'subtotal_hideInnerLines_facture_fournisseur';
627
-				    $sessname2 = 'subtotal_hidedetails_facture_fournisseur';
628
-				    $sessname3 = 'subtotal_hideprices_facture_fournisseur';
626
+					$sessname = 'subtotal_hideInnerLines_facture_fournisseur';
627
+					$sessname2 = 'subtotal_hidedetails_facture_fournisseur';
628
+					$sessname3 = 'subtotal_hideprices_facture_fournisseur';
629 629
 				}
630 630
 				elseif(in_array('propalcard',explode(':',$parameters['context']))) {
631 631
 					$sessname = 'subtotal_hideInnerLines_propal';
@@ -633,9 +633,9 @@  discard block
 block discarded – undo
633 633
 					$sessname3 = 'subtotal_hideprices_propal';
634 634
 				}
635 635
 				elseif(in_array('supplier_proposalcard',explode(':',$parameters['context']))) {
636
-				    $sessname = 'subtotal_hideInnerLines_supplier_proposal';
637
-				    $sessname2 = 'subtotal_hidedetails_supplier_proposal';
638
-				    $sessname3 = 'subtotal_hideprices_supplier_proposal';
636
+					$sessname = 'subtotal_hideInnerLines_supplier_proposal';
637
+					$sessname2 = 'subtotal_hidedetails_supplier_proposal';
638
+					$sessname3 = 'subtotal_hideprices_supplier_proposal';
639 639
 				}
640 640
 				elseif(in_array('ordercard',explode(':',$parameters['context']))) {
641 641
 					$sessname = 'subtotal_hideInnerLines_commande';
@@ -643,9 +643,9 @@  discard block
 block discarded – undo
643 643
 					$sessname3 = 'subtotal_hideprices_commande';
644 644
 				}
645 645
 				elseif(in_array('ordersuppliercard',explode(':',$parameters['context']))) {
646
-				    $sessname = 'subtotal_hideInnerLines_commande_fournisseur';
647
-				    $sessname2 = 'subtotal_hidedetails_commande_fournisseur';
648
-				    $sessname3 = 'subtotal_hideprices_commande_fournisseur';
646
+					$sessname = 'subtotal_hideInnerLines_commande_fournisseur';
647
+					$sessname2 = 'subtotal_hidedetails_commande_fournisseur';
648
+					$sessname3 = 'subtotal_hideprices_commande_fournisseur';
649 649
 				}
650 650
 				else {
651 651
 					$sessname = 'subtotal_hideInnerLines_unknown';
@@ -670,17 +670,17 @@  discard block
 block discarded – undo
670 670
 				foreach($object->lines as &$line) {
671 671
 					if ($line->product_type == 9 && $line->special_code == $this->module_number) {
672 672
 					    
673
-                        if($line->qty>=90) {
674
-                            $line->modsubtotal_total = 1;
675
-                        }
676
-                        else{
677
-                            $line->modsubtotal_title = 1;
678
-                        }
673
+						if($line->qty>=90) {
674
+							$line->modsubtotal_total = 1;
675
+						}
676
+						else{
677
+							$line->modsubtotal_title = 1;
678
+						}
679 679
                         
680 680
 						$line->total_ht = $this->getTotalLineFromObject($object, $line, '');
681 681
 					}
682
-	        	}
683
-	        }
682
+				}
683
+			}
684 684
 			
685 685
 		}
686 686
 		else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') {
@@ -697,7 +697,7 @@  discard block
 block discarded – undo
697 697
 				 */
698 698
 				else if($object->element=='invoice_supplier')
699 699
 				{
700
-				    $object->deleteline($idLine);
700
+					$object->deleteline($idLine);
701 701
 				}
702 702
 				/**
703 703
 				 * @var $object Propal
@@ -720,7 +720,7 @@  discard block
 block discarded – undo
720 720
 				 */
721 721
 				else if($object->element=='order_supplier')
722 722
 				{
723
-				    $object->deleteline($idLine);
723
+					$object->deleteline($idLine);
724 724
 				}
725 725
 				/**
726 726
 				 * @var $object Facturerec
@@ -795,7 +795,7 @@  discard block
 block discarded – undo
795 795
 		
796 796
 		foreach($object->lines as $l) {
797 797
 		
798
-		    $lid = (!empty($l->rowid) ? $l->rowid : $l->id);
798
+			$lid = (!empty($l->rowid) ? $l->rowid : $l->id);
799 799
 			if($lid == $lineid) {
800 800
 
801 801
 				$found = true;
@@ -804,7 +804,7 @@  discard block
 block discarded – undo
804 804
 			
805 805
 			if($found) {
806 806
 				
807
-			    $Tab[] = (!empty($l->rowid) ? $l->rowid : $l->id);
807
+				$Tab[] = (!empty($l->rowid) ? $l->rowid : $l->id);
808 808
 				
809 809
 				if($l->special_code==$this->module_number && (($l->qty==99 && $qty_line==1) || ($l->qty==98 && $qty_line==2))   ) {
810 810
 					break; // end of story
@@ -936,7 +936,7 @@  discard block
 block discarded – undo
936 936
 		if(method_exists('Closure','bind')) {
937 937
 			$pageBreakOriginalValue = $pdf->AcceptPageBreak();
938 938
 			$sweetsThief = function ($pdf) {
939
-		    		return $pdf->bMargin ;
939
+					return $pdf->bMargin ;
940 940
 			};
941 941
 			$sweetsThief = Closure::bind($sweetsThief, null, $pdf);
942 942
 	
@@ -1007,7 +1007,7 @@  discard block
 block discarded – undo
1007 1007
 					$TTotal_tva = $TInfo[3];
1008 1008
 					$total_to_print = price($TInfo[0]);
1009 1009
 
1010
-                    $line->total_ht = $TInfo[0];
1010
+					$line->total_ht = $TInfo[0];
1011 1011
 					$line->total = $TInfo[0];
1012 1012
 					if (!TSubtotal::isModSubtotalLine($line)) $line->total_tva = $TInfo[1];
1013 1013
 					$line->total_ttc = $TInfo[2];
@@ -1164,7 +1164,7 @@  discard block
 block discarded – undo
1164 1164
 	}
1165 1165
 	
1166 1166
 	function pdf_getlinetotalexcltax($parameters=array(), &$object, &$action='') {
1167
-	    global $conf, $hideprices, $hookmanager;
1167
+		global $conf, $hideprices, $hookmanager;
1168 1168
 		
1169 1169
 		if(is_array($parameters)) $i = & $parameters['i'];
1170 1170
 		else $i = (int)$parameters;
@@ -1203,7 +1203,7 @@  discard block
 block discarded – undo
1203 1203
 			}
1204 1204
 		}
1205 1205
 		if ((int)GETPOST('hideInnerLines') && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)){
1206
-		    $this->resprints = price($object->lines[$i]->total_ht);
1206
+			$this->resprints = price($object->lines[$i]->total_ht);
1207 1207
 		}
1208 1208
 		
1209 1209
 		// Si la gestion C/NC est active et que je suis sur un ligne dont l'extrafield est coché
@@ -1332,7 +1332,7 @@  discard block
 block discarded – undo
1332 1332
 	}
1333 1333
 	
1334 1334
 	function pdf_getlineupexcltax($parameters=array(), &$object, &$action='') {
1335
-	    global $conf,$hideprices,$hookmanager;
1335
+		global $conf,$hideprices,$hookmanager;
1336 1336
 
1337 1337
 		if(is_array($parameters)) $i = & $parameters['i'];
1338 1338
 		else $i = (int)$parameters;
@@ -1340,18 +1340,18 @@  discard block
 block discarded – undo
1340 1340
 		if($this->isModSubtotalLine($parameters,$object) ) {
1341 1341
 			$this->resprints = ' ';
1342 1342
 
1343
-            $line = $object->lines[$i];
1343
+			$line = $object->lines[$i];
1344 1344
 
1345
-            // On récupère les montants du bloc pour les afficher dans la ligne de sous-total
1346
-            if(TSubtotal::isSubtotal($line)) {
1347
-                $parentTitle = TSubtotal::getParentTitleOfLine($object, $i);
1345
+			// On récupère les montants du bloc pour les afficher dans la ligne de sous-total
1346
+			if(TSubtotal::isSubtotal($line)) {
1347
+				$parentTitle = TSubtotal::getParentTitleOfLine($object, $i);
1348 1348
 
1349
-                if(is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals();
1350
-                if(! empty($parentTitle->array_options['options_show_total_ht'])) {
1351
-                    $TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle);
1352
-                    $this->resprints = price($TTotal['total_unit_subprice']);
1353
-                }
1354
-            }
1349
+				if(is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals();
1350
+				if(! empty($parentTitle->array_options['options_show_total_ht'])) {
1351
+					$TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle);
1352
+					$this->resprints = price($TTotal['total_unit_subprice']);
1353
+				}
1354
+			}
1355 1355
 		
1356 1356
 			if((float)DOL_VERSION<=3.6) {
1357 1357
 				return '';
@@ -1367,58 +1367,58 @@  discard block
 block discarded – undo
1367 1367
 		(!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))
1368 1368
 		)
1369 1369
 		{
1370
-		    // alors je dois vérifier si la méthode fait partie de la conf qui l'exclue
1371
-		    if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC)))
1372
-		    {
1373
-		        $this->resprints = ' ';
1370
+			// alors je dois vérifier si la méthode fait partie de la conf qui l'exclue
1371
+			if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC)))
1372
+			{
1373
+				$this->resprints = ' ';
1374 1374
 		        
1375
-		        // currentcontext à modifier celon l'appel
1376
-		        $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i);
1377
-		        return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1)
1375
+				// currentcontext à modifier celon l'appel
1376
+				$params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i);
1377
+				return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1)
1378 1378
 		        
1379
-		    }
1379
+			}
1380 1380
 		}
1381 1381
 		// Cache le prix pour les lignes standards dolibarr qui sont dans un ensemble
1382 1382
 		else if (!empty($hideprices))
1383 1383
 		{
1384 1384
 		    
1385
-		    // Check if a title exist for this line && if the title have subtotal
1386
-		    $lineTitle = TSubtotal::getParentTitleOfLine($object, $i);
1387
-		    if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true))
1388
-		    {
1385
+			// Check if a title exist for this line && if the title have subtotal
1386
+			$lineTitle = TSubtotal::getParentTitleOfLine($object, $i);
1387
+			if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true))
1388
+			{
1389 1389
 		        
1390
-		        $this->resprints = ' ';
1390
+				$this->resprints = ' ';
1391 1391
 		        
1392
-		        // currentcontext à modifier celon l'appel
1393
-		        $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hideprices', 'i' => $i);
1394
-		        return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1)
1395
-		    }
1392
+				// currentcontext à modifier celon l'appel
1393
+				$params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hideprices', 'i' => $i);
1394
+				return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1)
1395
+			}
1396 1396
 		}
1397 1397
 		
1398 1398
 		return 0;
1399 1399
 	}
1400 1400
 	
1401 1401
 	function pdf_getlineremisepercent($parameters=array(), &$object, &$action='') {
1402
-	    global $conf,$hideprices,$hookmanager;
1402
+		global $conf,$hideprices,$hookmanager;
1403 1403
 
1404
-        if(is_array($parameters)) $i = & $parameters['i'];
1405
-        else $i = (int) $parameters;
1404
+		if(is_array($parameters)) $i = & $parameters['i'];
1405
+		else $i = (int) $parameters;
1406 1406
 
1407 1407
 		if($this->isModSubtotalLine($parameters,$object) ) {
1408 1408
 			$this->resprints = ' ';
1409 1409
 
1410
-            $line = $object->lines[$i];
1410
+			$line = $object->lines[$i];
1411 1411
 
1412
-            // Affichage de la remise 
1413
-            if(TSubtotal::isSubtotal($line)) {
1414
-                $parentTitle = TSubtotal::getParentTitleOfLine($object, $i);
1412
+			// Affichage de la remise 
1413
+			if(TSubtotal::isSubtotal($line)) {
1414
+				$parentTitle = TSubtotal::getParentTitleOfLine($object, $i);
1415 1415
 
1416
-                if(empty($parentTitle->array_options)) $parentTitle->fetch_optionals();
1417
-                if(! empty($parentTitle->array_options['options_show_reduc'])) {
1418
-                    $TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle);
1419
-                    $this->resprints = price((1-$TTotal['total_ht'] / $TTotal['total_subprice'])*100, 0, '', 1, 2, 2).'%';
1420
-                }
1421
-            }
1416
+				if(empty($parentTitle->array_options)) $parentTitle->fetch_optionals();
1417
+				if(! empty($parentTitle->array_options['options_show_reduc'])) {
1418
+					$TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle);
1419
+					$this->resprints = price((1-$TTotal['total_ht'] / $TTotal['total_subprice'])*100, 0, '', 1, 2, 2).'%';
1420
+				}
1421
+			}
1422 1422
 		
1423 1423
 			if((float)DOL_VERSION<=3.6) {
1424 1424
 				return '';
@@ -1428,15 +1428,15 @@  discard block
 block discarded – undo
1428 1428
 			}
1429 1429
 		}
1430 1430
 		elseif (!empty($hideprices)
1431
-		        || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) )
1432
-		        )
1433
-		    {
1434
-		        if (!empty($hideprices) || !in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC)))
1435
-		        {
1436
-		            $this->resprints = ' ';
1437
-		            return 1;
1438
-		        }
1439
-		    }
1431
+				|| (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) )
1432
+				)
1433
+			{
1434
+				if (!empty($hideprices) || !in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC)))
1435
+				{
1436
+					$this->resprints = ' ';
1437
+					return 1;
1438
+				}
1439
+			}
1440 1440
 		
1441 1441
 		return 0;
1442 1442
 	}
@@ -1472,7 +1472,7 @@  discard block
 block discarded – undo
1472 1472
 	}
1473 1473
 	
1474 1474
 	function pdf_getlinevatrate($parameters=array(), &$object, &$action='') {
1475
-	    global $conf,$hideprices,$hookmanager;
1475
+		global $conf,$hideprices,$hookmanager;
1476 1476
 	    
1477 1477
 		if($this->isModSubtotalLine($parameters,$object) ){
1478 1478
 			$this->resprints = ' ';
@@ -1497,31 +1497,31 @@  discard block
 block discarded – undo
1497 1497
 		(!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))
1498 1498
 		)
1499 1499
 		{
1500
-		    // alors je dois vérifier si la méthode fait partie de la conf qui l'exclue
1501
-		    if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC)))
1502
-		    {
1503
-		        $this->resprints = ' ';
1500
+			// alors je dois vérifier si la méthode fait partie de la conf qui l'exclue
1501
+			if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC)))
1502
+			{
1503
+				$this->resprints = ' ';
1504 1504
 		        
1505
-		        // currentcontext à modifier celon l'appel
1506
-		        $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i);
1507
-		        return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1)
1508
-		    }
1505
+				// currentcontext à modifier celon l'appel
1506
+				$params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i);
1507
+				return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1)
1508
+			}
1509 1509
 		}
1510 1510
 		// Cache le prix pour les lignes standards dolibarr qui sont dans un ensemble
1511 1511
 		else if (!empty($hideprices))
1512 1512
 		{
1513 1513
 		    
1514
-		    // Check if a title exist for this line && if the title have subtotal
1515
-		    $lineTitle = TSubtotal::getParentTitleOfLine($object, $i);
1516
-		    if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true))
1517
-		    {
1514
+			// Check if a title exist for this line && if the title have subtotal
1515
+			$lineTitle = TSubtotal::getParentTitleOfLine($object, $i);
1516
+			if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true))
1517
+			{
1518 1518
 		        
1519
-		        $this->resprints = ' ';
1519
+				$this->resprints = ' ';
1520 1520
 		        
1521
-		        // currentcontext à modifier celon l'appel
1522
-		        $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hideprices', 'i' => $i);
1523
-		        return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1)
1524
-		    }
1521
+				// currentcontext à modifier celon l'appel
1522
+				$params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hideprices', 'i' => $i);
1523
+				return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1)
1524
+			}
1525 1525
 		}
1526 1526
 		
1527 1527
 		return 0;
@@ -1645,33 +1645,33 @@  discard block
 block discarded – undo
1645 1645
 		
1646 1646
 		$this->add_numerotation($object);	
1647 1647
 		
1648
-        foreach($object->lines as $k => &$l) {
1649
-            if(TSubtotal::isSubtotal($l)) {
1650
-                $parentTitle = TSubtotal::getParentTitleOfLine($object, $k);
1651
-                if(is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals();
1652
-                if(! empty($parentTitle->id) && ! empty($parentTitle->array_options['options_show_reduc'])) {
1653
-                    $l->remise_percent = 100;    // Affichage de la réduction sur la ligne de sous-total
1654
-                }
1655
-            }
1648
+		foreach($object->lines as $k => &$l) {
1649
+			if(TSubtotal::isSubtotal($l)) {
1650
+				$parentTitle = TSubtotal::getParentTitleOfLine($object, $k);
1651
+				if(is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals();
1652
+				if(! empty($parentTitle->id) && ! empty($parentTitle->array_options['options_show_reduc'])) {
1653
+					$l->remise_percent = 100;    // Affichage de la réduction sur la ligne de sous-total
1654
+				}
1655
+			}
1656 1656
 
1657 1657
 
1658
-            // Pas de hook sur les colonnes du PDF expédition, on unset les bonnes variables
1659
-            if(($object->element == 'shipping' || $object->element == 'delivery') && $this->isModSubtotalLine($k, $object))
1658
+			// Pas de hook sur les colonnes du PDF expédition, on unset les bonnes variables
1659
+			if(($object->element == 'shipping' || $object->element == 'delivery') && $this->isModSubtotalLine($k, $object))
1660 1660
 			{
1661 1661
 				$l->qty = $l->qty_asked;
1662 1662
 				unset($l->qty_asked, $l->qty_shipped, $l->volume, $l->weight);
1663 1663
 			}
1664
-        }
1664
+		}
1665 1665
 
1666 1666
 		$hideInnerLines = (int)GETPOST('hideInnerLines');
1667 1667
 		$hidedetails = (int)GETPOST('hidedetails');
1668 1668
 
1669 1669
 		if ($hideInnerLines) { // si c une ligne de titre
1670
-	    	$fk_parent_line=0;
1670
+			$fk_parent_line=0;
1671 1671
 			$TLines =array();
1672 1672
 		
1673 1673
 			$original_count=count($object->lines);
1674
-		    $TTvas = array(); // tableau de tva
1674
+			$TTvas = array(); // tableau de tva
1675 1675
 		    
1676 1676
 			foreach($object->lines as $k=>&$line) 
1677 1677
 			{
@@ -1712,48 +1712,48 @@  discard block
 block discarded – undo
1712 1712
 			
1713 1713
 				if ($hideInnerLines)
1714 1714
 				{
1715
-				    if(!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES))
1716
-				    {
1717
-				        if($line->tva_tx != '0.000' && $line->product_type!=9){
1715
+					if(!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES))
1716
+					{
1717
+						if($line->tva_tx != '0.000' && $line->product_type!=9){
1718 1718
 				            
1719
-    				        // on remplit le tableau de tva pour substituer les lignes cachées
1720
-    				        $TTvas[$line->tva_tx]['total_tva'] += $line->total_tva;
1721
-    				        $TTvas[$line->tva_tx]['total_ht'] += $line->total_ht;
1722
-    				        $TTvas[$line->tva_tx]['total_ttc'] += $line->total_ttc; 
1723
-    				    }
1724
-    					if($line->product_type==9 && $line->rowid>0)
1725
-    					{
1726
-    					    //Cas où je doit cacher les produits et afficher uniquement les sous-totaux avec les titres
1727
-    					    // génère des lignes d'affichage des montants HT soumis à tva
1728
-    					    $nbtva = count($TTvas);
1729
-    					    if(!empty($nbtva)){
1730
-    					        foreach ($TTvas as $tx =>$val){
1731
-    					            $l = clone $line;
1732
-    					            $l->product_type = 1;
1733
-    					            $l->special_code = '';
1734
-    					            $l->qty = 1;
1735
-    					            $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx));
1736
-    					            $l->tva_tx = $tx;
1737
-    					            $l->total_ht = $val['total_ht'];
1738
-    					            $l->total_tva = $val['total_tva'];
1739
-    					            $l->total = $line->total_ht;
1740
-    					            $l->total_ttc = $val['total_ttc'];
1741
-    					            $TLines[] = $l;
1742
-    					            array_shift($TTvas);
1743
-    					       }
1744
-    					    }
1719
+							// on remplit le tableau de tva pour substituer les lignes cachées
1720
+							$TTvas[$line->tva_tx]['total_tva'] += $line->total_tva;
1721
+							$TTvas[$line->tva_tx]['total_ht'] += $line->total_ht;
1722
+							$TTvas[$line->tva_tx]['total_ttc'] += $line->total_ttc; 
1723
+						}
1724
+						if($line->product_type==9 && $line->rowid>0)
1725
+						{
1726
+							//Cas où je doit cacher les produits et afficher uniquement les sous-totaux avec les titres
1727
+							// génère des lignes d'affichage des montants HT soumis à tva
1728
+							$nbtva = count($TTvas);
1729
+							if(!empty($nbtva)){
1730
+								foreach ($TTvas as $tx =>$val){
1731
+									$l = clone $line;
1732
+									$l->product_type = 1;
1733
+									$l->special_code = '';
1734
+									$l->qty = 1;
1735
+									$l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx));
1736
+									$l->tva_tx = $tx;
1737
+									$l->total_ht = $val['total_ht'];
1738
+									$l->total_tva = $val['total_tva'];
1739
+									$l->total = $line->total_ht;
1740
+									$l->total_ttc = $val['total_ttc'];
1741
+									$TLines[] = $l;
1742
+									array_shift($TTvas);
1743
+							   }
1744
+							}
1745 1745
     					    
1746
-    					    // ajoute la ligne de sous-total
1747
-    					    $TLines[] = $line; 
1748
-    					}
1749
-				    } else {
1746
+							// ajoute la ligne de sous-total
1747
+							$TLines[] = $line; 
1748
+						}
1749
+					} else {
1750 1750
 				        
1751
-				        if($line->product_type==9 && $line->rowid>0)
1752
-				        {
1753
-				            // ajoute la ligne de sous-total
1754
-				            $TLines[] = $line; 
1755
-				        }
1756
-				    }
1751
+						if($line->product_type==9 && $line->rowid>0)
1752
+						{
1753
+							// ajoute la ligne de sous-total
1754
+							$TLines[] = $line; 
1755
+						}
1756
+					}
1757 1757
 				    
1758 1758
 					
1759 1759
 				}
@@ -1778,20 +1778,20 @@  discard block
 block discarded – undo
1778 1778
 			$nbtva = count($TTvas);
1779 1779
 			if(!empty($nbtva) && $hideInnerLines && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES))
1780 1780
 			{
1781
-			    foreach ($TTvas as $tx =>$val){
1782
-			        $l = clone $line;
1783
-			        $l->product_type = 1;
1784
-			        $l->special_code = '';
1785
-			        $l->qty = 1;
1786
-			        $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx));
1787
-			        $l->tva_tx = $tx;
1788
-			        $l->total_ht = $val['total_ht'];
1789
-			        $l->total_tva = $val['total_tva'];
1790
-			        $l->total = $line->total_ht;
1791
-			        $l->total_ttc = $val['total_ttc'];
1792
-			        $TLines[] = $l;
1793
-			        array_shift($TTvas);
1794
-			    }
1781
+				foreach ($TTvas as $tx =>$val){
1782
+					$l = clone $line;
1783
+					$l->product_type = 1;
1784
+					$l->special_code = '';
1785
+					$l->qty = 1;
1786
+					$l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx));
1787
+					$l->tva_tx = $tx;
1788
+					$l->total_ht = $val['total_ht'];
1789
+					$l->total_tva = $val['total_tva'];
1790
+					$l->total = $line->total_ht;
1791
+					$l->total_ttc = $val['total_ttc'];
1792
+					$TLines[] = $l;
1793
+					array_shift($TTvas);
1794
+				}
1795 1795
 			}
1796 1796
 			
1797 1797
 			global $nblignes;
@@ -1803,7 +1803,7 @@  discard block
 block discarded – undo
1803 1803
 				$this->resprints = '';
1804 1804
 				return 0;
1805 1805
 			}
1806
-	    }
1806
+		}
1807 1807
 		
1808 1808
 		return 0;
1809 1809
 	}
@@ -1995,11 +1995,11 @@  discard block
 block discarded – undo
1995 1995
 		}
1996 1996
 		elseif($object->element == 'order_supplier' )
1997 1997
 		{
1998
-		    $createRight = $user->rights->fournisseur->commande->creer;
1998
+			$createRight = $user->rights->fournisseur->commande->creer;
1999 1999
 		}
2000 2000
 		elseif($object->element == 'invoice_supplier' )
2001 2001
 		{
2002
-		    $createRight = $user->rights->fournisseur->facture->creer;
2002
+			$createRight = $user->rights->fournisseur->facture->creer;
2003 2003
 		}
2004 2004
 		elseif($object->element == 'commande' && in_array('ordershipmentcard', $contexts))
2005 2005
 		{
@@ -2028,27 +2028,27 @@  discard block
 block discarded – undo
2028 2028
 			$line = $originline;
2029 2029
 		}
2030 2030
  		if($object->element=='facture')$idvar = 'facid';
2031
-        else $idvar='id';
2031
+		else $idvar='id';
2032 2032
 		if($line->special_code!=$this->module_number || $line->product_type!=9) {
2033 2033
 			if ($object->statut == 0  && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_LINE) && $object->element !== 'invoice_supplier')
2034
-            {
2035
-                if(!(TSubtotal::isModSubtotalLine($line)) && ( $line->fk_prev_id === null ) && !($action == "editline" && GETPOST('lineid') == $line->id)) {
2036
-                    echo '<a name="duplicate-'.$line->id.'" href="' . $_SERVER['PHP_SELF'] . '?' . $idvar . '=' . $object->id . '&action=duplicate&lineid=' . $line->id . '"><i class="fa fa-clone" aria-hidden="true"></i></a>';
2034
+			{
2035
+				if(!(TSubtotal::isModSubtotalLine($line)) && ( $line->fk_prev_id === null ) && !($action == "editline" && GETPOST('lineid') == $line->id)) {
2036
+					echo '<a name="duplicate-'.$line->id.'" href="' . $_SERVER['PHP_SELF'] . '?' . $idvar . '=' . $object->id . '&action=duplicate&lineid=' . $line->id . '"><i class="fa fa-clone" aria-hidden="true"></i></a>';
2037 2037
 
2038
-                    ?>
2038
+					?>
2039 2039
                         <script type="text/javascript">
2040 2040
                             $(document).ready(function() {
2041 2041
                                 $("a[name='duplicate-<?php echo $line->id; ?>']").prependTo($('#row-<?php echo $line->id; ?>').find('.linecoledit'));
2042 2042
                             });
2043 2043
                         </script>
2044 2044
                     <?php
2045
-                }
2045
+				}
2046 2046
 
2047
-            }
2047
+			}
2048 2048
 			return 0;
2049 2049
 		}
2050 2050
 		else if (in_array('invoicecard',$contexts) || in_array('invoicesuppliercard',$contexts) || in_array('propalcard',$contexts) || in_array('supplier_proposalcard',$contexts) || in_array('ordercard',$contexts) || in_array('ordersuppliercard',$contexts) || in_array('invoicereccard',$contexts)) 
2051
-        {
2051
+		{
2052 2052
 
2053 2053
 
2054 2054
 			if((float)DOL_VERSION <= 3.4)
@@ -2096,7 +2096,7 @@  discard block
 block discarded – undo
2096 2096
 			//var_dump($line);
2097 2097
             
2098 2098
 			// HTML 5 data for js
2099
-            $data = $this->_getHtmlData($parameters, $object, $action, $hookmanager);
2099
+			$data = $this->_getHtmlData($parameters, $object, $action, $hookmanager);
2100 2100
             
2101 2101
 			
2102 2102
 			?>
@@ -2158,8 +2158,8 @@  discard block
 block discarded – undo
2158 2158
 						}
2159 2159
 						
2160 2160
 						if ($object->element == 'order_supplier' || $object->element == 'invoice_supplier') {
2161
-						    $line->label = !empty($line->description) ? $line->description : $line->desc;
2162
-						    $line->description = '';
2161
+							$line->label = !empty($line->description) ? $line->description : $line->desc;
2162
+							$line->description = '';
2163 2163
 						}
2164 2164
 						$newlabel = $line->label;
2165 2165
 						if($line->label=='' && !$isFreeText) {
@@ -2193,38 +2193,38 @@  discard block
 block discarded – undo
2193 2193
 						
2194 2194
 
2195 2195
 						echo '<div class="subtotal_underline" style="margin-left:24px; line-height: 25px;">';
2196
-                        echo '<div>';
2197
-                        echo '<input style="vertical-align:sub;"  type="checkbox" name="line-pagebreak" id="subtotal-pagebreak" value="8" '.(($line->info_bits > 0) ? 'checked="checked"' : '') .' />&nbsp;';
2198
-                        echo '<label for="subtotal-pagebreak">'.$langs->trans('AddBreakPageBefore').'</label>';
2199
-                        echo '</div>';
2200
-
2201
-                        if (TSubtotal::isTitle($line))
2202
-                        {
2203
-                            $form = new Form($db);
2204
-                            echo '<div>';
2205
-                            echo '<label for="subtotal_tva_tx">'.$form->textwithpicto($langs->trans('subtotal_apply_default_tva'), $langs->trans('subtotal_apply_default_tva_help')).'</label>';
2206
-                            echo '<select id="subtotal_tva_tx" name="subtotal_tva_tx" class="flat"><option selected="selected" value="">-</option>';
2207
-                            if (empty($readonlyForSituation)) echo str_replace('selected', '', $form->load_tva('subtotal_tva_tx', '', $parameters['seller'], $parameters['buyer'], 0, 0, '', true));
2208
-                            echo '</select>';
2209
-                            echo '</div>';
2210
-
2211
-                            if (!empty($conf->global->INVOICE_USE_SITUATION) && $object->element == 'facture' && $object->type == Facture::TYPE_SITUATION)
2212
-                            {
2213
-                                echo '<div>';
2214
-                                echo '<label for="subtotal_progress">'.$langs->trans('subtotal_apply_progress').'</label> <input id="subtotal_progress" name="subtotal_progress" value="" size="1" />%';
2215
-                                echo '</div>';
2216
-                            }
2217
-                            echo '<div>';
2218
-                            echo '<input style="vertical-align:sub;"  type="checkbox" name="line-showTotalHT" id="subtotal-showTotalHT" value="9" '.(($line->array_options['options_show_total_ht'] > 0) ? 'checked="checked"' : '') .' />&nbsp;';
2219
-                            echo '<label for="subtotal-showTotalHT">'.$langs->trans('ShowTotalHTOnSubtotalBlock').'</label>';
2220
-                            echo '</div>';
2221
-
2222
-                            echo '<div>';
2223
-                            echo '<input style="vertical-align:sub;"  type="checkbox" name="line-showReduc" id="subtotal-showReduc" value="1" '.(($line->array_options['options_show_reduc'] > 0) ? 'checked="checked"' : '') .' />&nbsp;';
2224
-                            echo '<label for="subtotal-showReduc">'.$langs->trans('ShowReducOnSubtotalBlock').'</label>';
2225
-                            echo '</div>';
2226
-                        }
2227
-                        else if ($isFreeText) echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation);
2196
+						echo '<div>';
2197
+						echo '<input style="vertical-align:sub;"  type="checkbox" name="line-pagebreak" id="subtotal-pagebreak" value="8" '.(($line->info_bits > 0) ? 'checked="checked"' : '') .' />&nbsp;';
2198
+						echo '<label for="subtotal-pagebreak">'.$langs->trans('AddBreakPageBefore').'</label>';
2199
+						echo '</div>';
2200
+
2201
+						if (TSubtotal::isTitle($line))
2202
+						{
2203
+							$form = new Form($db);
2204
+							echo '<div>';
2205
+							echo '<label for="subtotal_tva_tx">'.$form->textwithpicto($langs->trans('subtotal_apply_default_tva'), $langs->trans('subtotal_apply_default_tva_help')).'</label>';
2206
+							echo '<select id="subtotal_tva_tx" name="subtotal_tva_tx" class="flat"><option selected="selected" value="">-</option>';
2207
+							if (empty($readonlyForSituation)) echo str_replace('selected', '', $form->load_tva('subtotal_tva_tx', '', $parameters['seller'], $parameters['buyer'], 0, 0, '', true));
2208
+							echo '</select>';
2209
+							echo '</div>';
2210
+
2211
+							if (!empty($conf->global->INVOICE_USE_SITUATION) && $object->element == 'facture' && $object->type == Facture::TYPE_SITUATION)
2212
+							{
2213
+								echo '<div>';
2214
+								echo '<label for="subtotal_progress">'.$langs->trans('subtotal_apply_progress').'</label> <input id="subtotal_progress" name="subtotal_progress" value="" size="1" />%';
2215
+								echo '</div>';
2216
+							}
2217
+							echo '<div>';
2218
+							echo '<input style="vertical-align:sub;"  type="checkbox" name="line-showTotalHT" id="subtotal-showTotalHT" value="9" '.(($line->array_options['options_show_total_ht'] > 0) ? 'checked="checked"' : '') .' />&nbsp;';
2219
+							echo '<label for="subtotal-showTotalHT">'.$langs->trans('ShowTotalHTOnSubtotalBlock').'</label>';
2220
+							echo '</div>';
2221
+
2222
+							echo '<div>';
2223
+							echo '<input style="vertical-align:sub;"  type="checkbox" name="line-showReduc" id="subtotal-showReduc" value="1" '.(($line->array_options['options_show_reduc'] > 0) ? 'checked="checked"' : '') .' />&nbsp;';
2224
+							echo '<label for="subtotal-showReduc">'.$langs->trans('ShowReducOnSubtotalBlock').'</label>';
2225
+							echo '</div>';
2226
+						}
2227
+						else if ($isFreeText) echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation);
2228 2228
 						echo '</div>';
2229 2229
 
2230 2230
 						if($line->qty<10) {
@@ -2741,17 +2741,17 @@  discard block
 block discarded – undo
2741 2741
 		if ($object->statut == 0 && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && $action != 'editline')
2742 2742
 		{
2743 2743
 		    
2744
-		    if($object->element == 'invoice_supplier' || $object->element == 'order_supplier')
2745
-		    {
2746
-		        foreach ($object->lines as $line)
2747
-		        {
2748
-		            // fetch optionals attributes and labels
2749
-		            require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
2750
-		            $extrafields=new ExtraFields($this->db);
2751
-		            $extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true);
2752
-		            $line->fetch_optionals($line->id,$extralabels);
2753
-		        }
2754
-		    }
2744
+			if($object->element == 'invoice_supplier' || $object->element == 'order_supplier')
2745
+			{
2746
+				foreach ($object->lines as $line)
2747
+				{
2748
+					// fetch optionals attributes and labels
2749
+					require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
2750
+					$extrafields=new ExtraFields($this->db);
2751
+					$extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true);
2752
+					$line->fetch_optionals($line->id,$extralabels);
2753
+				}
2754
+			}
2755 2755
 		    
2756 2756
 			$TSubNc = array();
2757 2757
 			foreach ($object->lines as &$l)
@@ -2842,80 +2842,80 @@  discard block
 block discarded – undo
2842 2842
 	{
2843 2843
 		dol_include_once('/subtotal/class/subtotal.class.php');
2844 2844
 
2845
-	    $line = &$parameters['line'];
2845
+		$line = &$parameters['line'];
2846 2846
 	    
2847
-	    $ThtmlData['data-id']           = $line->id;
2848
-	    $ThtmlData['data-product_type'] = $line->product_type;
2849
-	    $ThtmlData['data-qty']          = 0; //$line->qty;
2850
-	    $ThtmlData['data-level']        = TSubtotal::getNiveau($line);
2847
+		$ThtmlData['data-id']           = $line->id;
2848
+		$ThtmlData['data-product_type'] = $line->product_type;
2849
+		$ThtmlData['data-qty']          = 0; //$line->qty;
2850
+		$ThtmlData['data-level']        = TSubtotal::getNiveau($line);
2851 2851
 	    
2852
-	    if(TSubtotal::isTitle($line)){
2853
-	        $ThtmlData['data-issubtotal'] = 'title';
2854
-	    }elseif(TSubtotal::isSubtotal($line)){
2855
-	        $ThtmlData['data-issubtotal'] = 'subtotal';
2856
-	    }
2857
-	    else{
2858
-	        $ThtmlData['data-issubtotal'] = 'freetext';
2859
-	    }
2852
+		if(TSubtotal::isTitle($line)){
2853
+			$ThtmlData['data-issubtotal'] = 'title';
2854
+		}elseif(TSubtotal::isSubtotal($line)){
2855
+			$ThtmlData['data-issubtotal'] = 'subtotal';
2856
+		}
2857
+		else{
2858
+			$ThtmlData['data-issubtotal'] = 'freetext';
2859
+		}
2860 2860
 	    
2861 2861
 	    
2862
-	    // Change or add data  from hooks
2863
-	    $parameters = array_replace($parameters , array(  'ThtmlData' => $ThtmlData )  );
2862
+		// Change or add data  from hooks
2863
+		$parameters = array_replace($parameters , array(  'ThtmlData' => $ThtmlData )  );
2864 2864
 	    
2865
-	    // hook 
2866
-	    $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
2867
-	    if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
2868
-	    if ($reshook>0)
2869
-	    {
2870
-	        $ThtmlData = $hookmanager->resArray;
2871
-	    }
2872
-
2873
-	    return $this->implodeHtmlData($ThtmlData);
2865
+		// hook 
2866
+		$reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
2867
+		if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
2868
+		if ($reshook>0)
2869
+		{
2870
+			$ThtmlData = $hookmanager->resArray;
2871
+		}
2872
+
2873
+		return $this->implodeHtmlData($ThtmlData);
2874 2874
 	
2875 2875
 	}
2876 2876
 	
2877 2877
 	
2878 2878
 	function implodeHtmlData($ThtmlData = array())
2879 2879
 	{
2880
-	    $data = '';
2881
-	    foreach($ThtmlData as $k => $h )
2882
-	    {
2883
-	        if(is_array($h))
2884
-	        {
2885
-	            $h = json_encode($h);
2886
-	        }
2880
+		$data = '';
2881
+		foreach($ThtmlData as $k => $h )
2882
+		{
2883
+			if(is_array($h))
2884
+			{
2885
+				$h = json_encode($h);
2886
+			}
2887 2887
 	        
2888
-	        $data .= $k . '="'.dol_htmlentities($h, ENT_QUOTES).'" ';
2889
-	    }
2888
+			$data .= $k . '="'.dol_htmlentities($h, ENT_QUOTES).'" ';
2889
+		}
2890 2890
 	    
2891
-	    return $data;
2891
+		return $data;
2892 2892
 	}
2893 2893
 	
2894 2894
 	function _ajax_block_order_js($object)
2895 2895
 	{
2896
-	    global $conf,$tagidfortablednd,$filepath,$langs;
2896
+		global $conf,$tagidfortablednd,$filepath,$langs;
2897 2897
 	    
2898
-	    /*
2898
+		/*
2899 2899
 	     * this part of js is base on dolibarr htdocs/core/tpl/ajaxrow.tpl.php 
2900 2900
 	     * for compatibility reasons we don't use tableDnD but jquery sortable
2901 2901
 	     */
2902 2902
 	    
2903
-	    $id=$object->id;
2904
-	    $nboflines=(isset($object->lines)?count($object->lines):0);
2905
-	    $forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1;
2903
+		$id=$object->id;
2904
+		$nboflines=(isset($object->lines)?count($object->lines):0);
2905
+		$forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1;
2906 2906
 	    
2907
-	    $id=$object->id;
2908
-	    $fk_element=$object->fk_element;
2909
-	    $table_element_line=$object->table_element_line;
2910
-	    $nboflines=(isset($object->lines)?count($object->lines):(empty($nboflines)?0:$nboflines));
2911
-	    $tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd);
2912
-	    $filepath=(empty($filepath)?'':$filepath);
2907
+		$id=$object->id;
2908
+		$fk_element=$object->fk_element;
2909
+		$table_element_line=$object->table_element_line;
2910
+		$nboflines=(isset($object->lines)?count($object->lines):(empty($nboflines)?0:$nboflines));
2911
+		$tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd);
2912
+		$filepath=(empty($filepath)?'':$filepath);
2913 2913
 	    
2914 2914
 	    
2915
-	    if (GETPOST('action','aZ09') != 'editline' && $nboflines > 1)
2916
-	    {
2915
+		if (GETPOST('action','aZ09') != 'editline' && $nboflines > 1)
2916
+		{
2917 2917
 	        
2918
-	        ?>
2918
+			?>
2919 2919
 		
2920 2920
 		
2921 2921
 			<script type="text/javascript">
Please login to merge, or discard this patch.
Spacing   +493 added lines, -493 removed lines patch added patch discarded remove patch
@@ -16,17 +16,17 @@  discard block
 block discarded – undo
16 16
 		
17 17
 		global $type_element, $where;
18 18
 		
19
-		$contexts = explode(':',$parameters['context']);
19
+		$contexts = explode(':', $parameters['context']);
20 20
 		
21
-		if(in_array('consumptionthirdparty',$contexts) && in_array($type_element, array('propal', 'order', 'invoice', 'supplier_order', 'supplier_invoice', 'supplier_proposal'))) {
21
+		if (in_array('consumptionthirdparty', $contexts) && in_array($type_element, array('propal', 'order', 'invoice', 'supplier_order', 'supplier_invoice', 'supplier_proposal'))) {
22 22
 			$mod_num = TSubtotal::$module_number;
23 23
 			
24 24
 			// Not a title (can't use TSubtotal class methods in sql)
25
-			$where.= ' AND (d.special_code != '.$mod_num.' OR d.product_type != 9 OR d.qty > 9)';
25
+			$where .= ' AND (d.special_code != '.$mod_num.' OR d.product_type != 9 OR d.qty > 9)';
26 26
 			// Not a subtotal (can't use TSubtotal class methods in sql)
27
-			$where.= ' AND (d.special_code != '.$mod_num.' OR d.product_type != 9 OR d.qty < 90)';
27
+			$where .= ' AND (d.special_code != '.$mod_num.' OR d.product_type != 9 OR d.qty < 90)';
28 28
 			// Not a free line text (can't use TSubtotal class methods in sql)
29
-			$where.= ' AND (d.special_code != '.$mod_num.' OR d.product_type != 9 OR d.qty != 50)';
29
+			$where .= ' AND (d.special_code != '.$mod_num.' OR d.product_type != 9 OR d.qty != 50)';
30 30
 			
31 31
 		}
32 32
 		
@@ -105,47 +105,47 @@  discard block
 block discarded – undo
105 105
     
106 106
     function formObjectOptions($parameters, &$object, &$action, $hookmanager) 
107 107
     {
108
-      	global $langs,$db,$user, $conf;
108
+      	global $langs, $db, $user, $conf;
109 109
 		
110 110
 		$langs->load('subtotal@subtotal');
111 111
 		
112
-		$contexts = explode(':',$parameters['context']);
112
+		$contexts = explode(':', $parameters['context']);
113 113
 		
114
-		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) || in_array('expeditioncard',$contexts)) {
114
+		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) || in_array('expeditioncard', $contexts)) {
115 115
 			
116 116
 			$createRight = $user->rights->{$object->element}->creer;
117
-			if($object->element == 'facturerec' )
117
+			if ($object->element == 'facturerec')
118 118
 			{
119 119
 				$object->statut = 0; // hack for facture rec
120 120
 				$createRight = $user->rights->facture->creer;
121
-			} elseif($object->element == 'order_supplier' )
121
+			} elseif ($object->element == 'order_supplier')
122 122
 			{
123 123
 			    $createRight = $user->rights->fournisseur->commande->creer;
124
-			} elseif($object->element == 'invoice_supplier' )
124
+			} elseif ($object->element == 'invoice_supplier')
125 125
 			{
126 126
 			    $createRight = $user->rights->fournisseur->facture->creer;
127 127
 			}
128
-			elseif($object->element == 'shipping')
128
+			elseif ($object->element == 'shipping')
129 129
 			{
130 130
 				$createRight = true; // No rights management for shipments
131 131
 			}
132 132
 			
133
-			if ($object->statut == 0  && $createRight) {
133
+			if ($object->statut == 0 && $createRight) {
134 134
 			
135 135
 
136
-				if($object->element=='facture')$idvar = 'facid';
137
-				else $idvar='id';
136
+				if ($object->element == 'facture')$idvar = 'facid';
137
+				else $idvar = 'id';
138 138
 				
139
-				if(in_array($action, array('add_title_line', 'add_total_line', 'add_subtitle_line', 'add_subtotal_line', 'add_free_text')) )
139
+				if (in_array($action, array('add_title_line', 'add_total_line', 'add_subtitle_line', 'add_subtotal_line', 'add_free_text')))
140 140
 				{
141 141
 					$level = GETPOST('level', 'int'); //New avec SUBTOTAL_USE_NEW_FORMAT
142 142
 					
143
-					if($action=='add_title_line') {
143
+					if ($action == 'add_title_line') {
144 144
 						$title = GETPOST('title');
145
-						if(empty($title)) $title = $langs->trans('title');
146
-						$qty = $level<1 ? 1 : $level ;
145
+						if (empty($title)) $title = $langs->trans('title');
146
+						$qty = $level < 1 ? 1 : $level;
147 147
 					}
148
-					else if($action=='add_free_text') {
148
+					else if ($action == 'add_free_text') {
149 149
 						$title = GETPOST('title');
150 150
 
151 151
 						if (empty($title)) {
@@ -157,21 +157,21 @@  discard block
 block discarded – undo
157 157
 								}
158 158
 							}
159 159
 						}
160
-						if(empty($title)) $title = $langs->trans('subtotalAddLineDescription');
160
+						if (empty($title)) $title = $langs->trans('subtotalAddLineDescription');
161 161
 						$qty = 50;
162 162
 					}
163
-					else if($action=='add_subtitle_line') {
163
+					else if ($action == 'add_subtitle_line') {
164 164
 						$title = GETPOST('title');
165
-						if(empty($title)) $title = $langs->trans('subtitle');
165
+						if (empty($title)) $title = $langs->trans('subtitle');
166 166
 						$qty = 2;
167 167
 					}
168
-					else if($action=='add_subtotal_line') {
168
+					else if ($action == 'add_subtotal_line') {
169 169
 						$title = $langs->trans('SubSubTotal');
170 170
 						$qty = 98;
171 171
 					}
172 172
 					else {
173 173
 						$title = GETPOST('title') ? GETPOST('title') : $langs->trans('SubTotal');
174
-						$qty = $level ? 100-$level : 99;
174
+						$qty = $level ? 100 - $level : 99;
175 175
 					}
176 176
 					dol_include_once('/subtotal/class/subtotal.class.php');
177 177
 					
@@ -179,15 +179,15 @@  discard block
 block discarded – undo
179 179
 					
180 180
 	    			TSubtotal::addSubTotalLine($object, $title, $qty);
181 181
 				}
182
-				else if($action==='ask_deleteallline') {
183
-						$form=new Form($db);
182
+				else if ($action === 'ask_deleteallline') {
183
+						$form = new Form($db);
184 184
 
185
-						$lineid = GETPOST('lineid','integer');
185
+						$lineid = GETPOST('lineid', 'integer');
186 186
 						$TIdForGroup = $this->getArrayOfLineForAGroup($object, $lineid);
187 187
 					
188 188
 						$nbLines = count($TIdForGroup);
189 189
 					
190
-						$formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('deleteWithAllLines'), $langs->trans('ConfirmDeleteAllThisLines',$nbLines), 'confirm_delete_all_lines','',0,1);
190
+						$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('deleteWithAllLines'), $langs->trans('ConfirmDeleteAllThisLines', $nbLines), 'confirm_delete_all_lines', '', 0, 1);
191 191
 						print $formconfirm;
192 192
 				}
193 193
 
@@ -197,13 +197,13 @@  discard block
 block discarded – undo
197 197
 				}
198 198
 
199 199
 				
200
-				if($object->element != 'shipping' && $action!='editline') {
200
+				if ($object->element != 'shipping' && $action != 'editline') {
201 201
 					// New format is for 3.8
202 202
 					$this->printNewFormat($object, $conf, $langs, $idvar);
203 203
 				}
204 204
 			}
205 205
 		}
206
-		elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice',$contexts))
206
+		elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice', $contexts))
207 207
 		{
208 208
 			?>
209 209
 			<script type="text/javascript">
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 				$(document).ready(function() {
229 229
 					$('div.fiche div.tabsAction').append('<br />');
230 230
 					
231
-					$('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>');
231
+					$('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>');
232 232
 					$('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>');
233 233
 					$('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>');
234 234
 
@@ -279,9 +279,9 @@  discard block
 block discarded – undo
279 279
 						$('body').append(dialog_html);
280 280
 
281 281
 						<?php 
282
-						$editorTool = empty($conf->global->FCKEDITOR_EDITORNAME)?'ckeditor':$conf->global->FCKEDITOR_EDITORNAME;
283
-						$editorConf = empty($conf->global->FCKEDITOR_ENABLE_DETAILS)?false:$conf->global->FCKEDITOR_ENABLE_DETAILS;
284
-						if($editorConf && in_array($editorTool,array('textarea','ckeditor'))){ 
282
+						$editorTool = empty($conf->global->FCKEDITOR_EDITORNAME) ? 'ckeditor' : $conf->global->FCKEDITOR_EDITORNAME;
283
+						$editorConf = empty($conf->global->FCKEDITOR_ENABLE_DETAILS) ?false:$conf->global->FCKEDITOR_ENABLE_DETAILS;
284
+						if ($editorConf && in_array($editorTool, array('textarea', 'ckeditor'))) { 
285 285
 						?>
286 286
 						if (action == 'addTitle' || action == 'addFreeTxt')
287 287
 						{
@@ -396,62 +396,62 @@  discard block
 block discarded – undo
396 396
 		global $conf, $langs, $bc;
397 397
 			
398 398
 		$action = GETPOST('action');	
399
-		$TContext = explode(':',$parameters['context']);
399
+		$TContext = explode(':', $parameters['context']);
400 400
 		if (
401
-				in_array('invoicecard',$TContext)
402
-		        || in_array('invoicesuppliercard',$TContext)
403
-				|| in_array('propalcard',$TContext)
404
-				|| in_array('ordercard',$TContext)
405
-		        || in_array('ordersuppliercard',$TContext)
406
-				|| in_array('invoicereccard',$TContext)
401
+				in_array('invoicecard', $TContext)
402
+		        || in_array('invoicesuppliercard', $TContext)
403
+				|| in_array('propalcard', $TContext)
404
+				|| in_array('ordercard', $TContext)
405
+		        || in_array('ordersuppliercard', $TContext)
406
+				|| in_array('invoicereccard', $TContext)
407 407
 			)
408 408
 	        {	
409
-	            $hideInnerLines	= isset( $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] ) ?  $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] : 0;
410
-	            $hidedetails	= isset( $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] ) ?  $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] : 0;
411
-				$hidepricesDefaultConf = !empty($conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED)?$conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED:0;
412
-				$hideprices= isset( $_SESSION['subtotal_hideprices_'.$parameters['modulepart']][$object->id] ) ?  $_SESSION['subtotal_hideprices_'.$parameters['modulepart']][$object->id] : $hidepricesDefaultConf;
409
+	            $hideInnerLines = isset($_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id]) ? $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] : 0;
410
+	            $hidedetails = isset($_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id]) ? $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] : 0;
411
+				$hidepricesDefaultConf = !empty($conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED) ? $conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED : 0;
412
+				$hideprices = isset($_SESSION['subtotal_hideprices_'.$parameters['modulepart']][$object->id]) ? $_SESSION['subtotal_hideprices_'.$parameters['modulepart']][$object->id] : $hidepricesDefaultConf;
413 413
 				
414
-				$var=false;
415
-		     	$out.= '<tr '.$bc[$var].'>
414
+				$var = false;
415
+		     	$out .= '<tr '.$bc[$var].'>
416 416
 		     			<td colspan="4" align="right">
417 417
 		     				<label for="hideInnerLines">'.$langs->trans('HideInnerLines').'</label>
418
-		     				<input type="checkbox" onclick="if($(this).is(\':checked\')) { $(\'#hidedetails\').prop(\'checked\', \'checked\')  }" id="hideInnerLines" name="hideInnerLines" value="1" '.(( $hideInnerLines ) ? 'checked="checked"' : '' ).' />
418
+		     				<input type="checkbox" onclick="if($(this).is(\':checked\')) { $(\'#hidedetails\').prop(\'checked\', \'checked\')  }" id="hideInnerLines" name="hideInnerLines" value="1" '.(($hideInnerLines) ? 'checked="checked"' : '').' />
419 419
 		     			</td>
420 420
 		     			</tr>';
421 421
 				
422
-		     	$var=!$var;
423
-		     	$out.= '<tr '.$bc[$var].'>
422
+		     	$var = !$var;
423
+		     	$out .= '<tr '.$bc[$var].'>
424 424
 		     			<td colspan="4" align="right">
425 425
 		     				<label for="hidedetails">'.$langs->trans('SubTotalhidedetails').'</label>
426
-		     				<input type="checkbox" id="hidedetails" name="hidedetails" value="1" '.(( $hidedetails ) ? 'checked="checked"' : '' ).' />
426
+		     				<input type="checkbox" id="hidedetails" name="hidedetails" value="1" '.(($hidedetails) ? 'checked="checked"' : '').' />
427 427
 		     			</td>
428 428
 		     			</tr>';
429 429
 		     	
430
-		     	$var=!$var;
431
-		     	$out.= '<tr '.$bc[$var].'>
430
+		     	$var = !$var;
431
+		     	$out .= '<tr '.$bc[$var].'>
432 432
 		     			<td colspan="4" align="right">
433 433
 		     				<label for="hideprices">'.$langs->trans('SubTotalhidePrice').'</label>
434
-		     				<input type="checkbox" id="hideprices" name="hideprices" value="1" '.(( $hideprices ) ? 'checked="checked"' : '' ).' />
434
+		     				<input type="checkbox" id="hideprices" name="hideprices" value="1" '.(($hideprices) ? 'checked="checked"' : '').' />
435 435
 		     			</td>
436 436
 		     			</tr>';
437 437
 		     	
438 438
 		     	
439 439
 				 
440 440
 				if ( 
441
-					(in_array('propalcard',$TContext) && !empty($conf->global->SUBTOTAL_PROPAL_ADD_RECAP))
442
-					|| (in_array('ordercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP))
443
-				    || (in_array('ordersuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP))
444
-					|| (in_array('invoicecard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP))
445
-				    || (in_array('invoicesuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP))
446
-					|| (in_array('invoicereccard',$TContext)  && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP ))
441
+					(in_array('propalcard', $TContext) && !empty($conf->global->SUBTOTAL_PROPAL_ADD_RECAP))
442
+					|| (in_array('ordercard', $TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP))
443
+				    || (in_array('ordersuppliercard', $TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP))
444
+					|| (in_array('invoicecard', $TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP))
445
+				    || (in_array('invoicesuppliercard', $TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP))
446
+					|| (in_array('invoicereccard', $TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP))
447 447
 				)
448 448
 				{
449
-					$var=!$var;
450
-					$out.= '
449
+					$var = !$var;
450
+					$out .= '
451 451
 						<tr '.$bc[$var].'>
452 452
 							<td colspan="4" align="right">
453 453
 								<label for="subtotal_add_recap">'.$langs->trans('subtotal_add_recap').'</label>
454
-								<input type="checkbox" id="subtotal_add_recap" name="subtotal_add_recap" value="1" '.( GETPOST('subtotal_add_recap') ? 'checked="checked"' : '' ).' />
454
+								<input type="checkbox" id="subtotal_add_recap" name="subtotal_add_recap" value="1" '.(GETPOST('subtotal_add_recap') ? 'checked="checked"' : '').' />
455 455
 							</td>
456 456
 						</tr>';
457 457
 				}
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
     function formEditProductOptions($parameters, &$object, &$action, $hookmanager) 
468 468
     {
469 469
 		
470
-    	if (in_array('invoicecard',explode(':',$parameters['context'])))
470
+    	if (in_array('invoicecard', explode(':', $parameters['context'])))
471 471
         {
472 472
         	
473 473
         }
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
 	function ODTSubstitutionLine(&$parameters, &$object, $action, $hookmanager) {
479 479
 		global $conf;
480 480
 		
481
-		if($action === 'builddoc') {
481
+		if ($action === 'builddoc') {
482 482
 			
483 483
 			$line = &$parameters['line'];
484 484
 			$object = &$parameters['object'];
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
             $substitutionarray['line_modsubtotal_total'] = false;
490 490
             $substitutionarray['line_modsubtotal_title'] = false;
491 491
 
492
-			if($line->product_type == 9 && $line->special_code == $this->module_number) {
492
+			if ($line->product_type == 9 && $line->special_code == $this->module_number) {
493 493
 				$substitutionarray['line_modsubtotal'] = 1;	
494 494
                 $substitutionarray['line_not_modsubtotal'] = false;
495 495
 				
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
 					 = $substitutionarray['line_up'] 
502 502
 					 = '';
503 503
 				
504
-				if($line->qty>90) {
504
+				if ($line->qty > 90) {
505 505
 					$substitutionarray['line_modsubtotal_total'] = true;
506 506
 					
507 507
 					//list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1);
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
 				
517 517
 				
518 518
 			}	
519
-			else{
519
+			else {
520 520
 				$substitutionarray['line_not_modsubtotal'] = true;
521 521
 				$substitutionarray['line_modsubtotal'] = 0;
522 522
 			}
@@ -528,29 +528,29 @@  discard block
 block discarded – undo
528 528
 	function createFrom($parameters, &$object, $action, $hookmanager) {
529 529
 	
530 530
 		if (
531
-				in_array('invoicecard',explode(':',$parameters['context']))
532
-		        || in_array('invoicesuppliercard',explode(':',$parameters['context']))
533
-				|| in_array('propalcard',explode(':',$parameters['context']))
534
-		        || in_array('supplier_proposalcard',explode(':',$parameters['context']))
535
-				|| in_array('ordercard',explode(':',$parameters['context']))
536
-		        || in_array('ordersuppliercard',explode(':',$parameters['context']))
537
-				|| in_array('invoicereccard',explode(':',$parameters['context']))
531
+				in_array('invoicecard', explode(':', $parameters['context']))
532
+		        || in_array('invoicesuppliercard', explode(':', $parameters['context']))
533
+				|| in_array('propalcard', explode(':', $parameters['context']))
534
+		        || in_array('supplier_proposalcard', explode(':', $parameters['context']))
535
+				|| in_array('ordercard', explode(':', $parameters['context']))
536
+		        || in_array('ordersuppliercard', explode(':', $parameters['context']))
537
+				|| in_array('invoicereccard', explode(':', $parameters['context']))
538 538
 		) {
539 539
 			
540 540
 			global $db;
541 541
 			
542 542
 			$objFrom = $parameters['objFrom'];
543 543
 			
544
-			foreach($objFrom->lines as $k=> &$lineOld) {
544
+			foreach ($objFrom->lines as $k=> &$lineOld) {
545 545
 				
546
-					if($lineOld->product_type == 9 && $lineOld->info_bits > 0 ) {
546
+					if ($lineOld->product_type == 9 && $lineOld->info_bits > 0) {
547 547
 							
548 548
 							$line = & $object->lines[$k];
549 549
 				
550 550
 							$idLine = (int) ($line->id ? $line->id : $line->rowid); 
551 551
 				
552 552
 							$db->query("UPDATE ".MAIN_DB_PREFIX.$line->table_element."
553
-							SET info_bits=".(int)$lineOld->info_bits."
553
+							SET info_bits=".(int) $lineOld->info_bits."
554 554
 							WHERE rowid = ".$idLine."
555 555
 							");
556 556
 						
@@ -566,15 +566,15 @@  discard block
 block discarded – undo
566 566
 	
567 567
 	function doActions($parameters, &$object, $action, $hookmanager)
568 568
 	{
569
-		global $db, $conf, $langs,$user;
569
+		global $db, $conf, $langs, $user;
570 570
 		
571 571
 		dol_include_once('/subtotal/class/subtotal.class.php');
572 572
 		dol_include_once('/subtotal/lib/subtotal.lib.php');
573
-		require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
573
+		require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
574 574
 		
575 575
 		$showBlockExtrafields = GETPOST('showBlockExtrafields');
576 576
 		
577
-		if($object->element=='facture') $idvar = 'facid';
577
+		if ($object->element == 'facture') $idvar = 'facid';
578 578
 		else $idvar = 'id';
579 579
 			
580 580
 		if ($action == 'updateligne' || $action == 'updateline')
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
 				if ($line->id == $lineid && TSubtotal::isModSubtotalLine($line))
588 588
 				{
589 589
 					$found = true;
590
-					if(TSubtotal::isTitle($line) && !empty($showBlockExtrafields)) {
590
+					if (TSubtotal::isTitle($line) && !empty($showBlockExtrafields)) {
591 591
 						$extrafieldsline = new ExtraFields($db);
592 592
 						$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
593 593
 						$extrafieldsline->setOptionalsFromPost($extralabelsline, $line);
@@ -606,43 +606,43 @@  discard block
 block discarded – undo
606 606
 				exit; // Surtout ne pas laisser Dolibarr faire du traitement sur le updateligne sinon ça plante les données de la ligne
607 607
 			}
608 608
 		}
609
-		else if($action === 'builddoc') {
609
+		else if ($action === 'builddoc') {
610 610
 			
611 611
 			if (
612
-				in_array('invoicecard',explode(':',$parameters['context']))
613
-				|| in_array('propalcard',explode(':',$parameters['context']))
614
-				|| in_array('ordercard',explode(':',$parameters['context']))
615
-			    || in_array('ordersuppliercard',explode(':',$parameters['context']))
616
-			    || in_array('invoicesuppliercard',explode(':',$parameters['context']))
617
-			    || in_array('supplier_proposalcard',explode(':',$parameters['context']))
612
+				in_array('invoicecard', explode(':', $parameters['context']))
613
+				|| in_array('propalcard', explode(':', $parameters['context']))
614
+				|| in_array('ordercard', explode(':', $parameters['context']))
615
+			    || in_array('ordersuppliercard', explode(':', $parameters['context']))
616
+			    || in_array('invoicesuppliercard', explode(':', $parameters['context']))
617
+			    || in_array('supplier_proposalcard', explode(':', $parameters['context']))
618 618
 			)
619 619
 	        {								
620
-				if(in_array('invoicecard',explode(':',$parameters['context']))) {
620
+				if (in_array('invoicecard', explode(':', $parameters['context']))) {
621 621
 					$sessname = 'subtotal_hideInnerLines_facture';	
622 622
 					$sessname2 = 'subtotal_hidedetails_facture';
623 623
 					$sessname3 = 'subtotal_hideprices_facture';
624 624
 				}
625
-				elseif(in_array('invoicesuppliercard',explode(':',$parameters['context']))) {
625
+				elseif (in_array('invoicesuppliercard', explode(':', $parameters['context']))) {
626 626
 				    $sessname = 'subtotal_hideInnerLines_facture_fournisseur';
627 627
 				    $sessname2 = 'subtotal_hidedetails_facture_fournisseur';
628 628
 				    $sessname3 = 'subtotal_hideprices_facture_fournisseur';
629 629
 				}
630
-				elseif(in_array('propalcard',explode(':',$parameters['context']))) {
630
+				elseif (in_array('propalcard', explode(':', $parameters['context']))) {
631 631
 					$sessname = 'subtotal_hideInnerLines_propal';
632 632
 					$sessname2 = 'subtotal_hidedetails_propal';	
633 633
 					$sessname3 = 'subtotal_hideprices_propal';
634 634
 				}
635
-				elseif(in_array('supplier_proposalcard',explode(':',$parameters['context']))) {
635
+				elseif (in_array('supplier_proposalcard', explode(':', $parameters['context']))) {
636 636
 				    $sessname = 'subtotal_hideInnerLines_supplier_proposal';
637 637
 				    $sessname2 = 'subtotal_hidedetails_supplier_proposal';
638 638
 				    $sessname3 = 'subtotal_hideprices_supplier_proposal';
639 639
 				}
640
-				elseif(in_array('ordercard',explode(':',$parameters['context']))) {
640
+				elseif (in_array('ordercard', explode(':', $parameters['context']))) {
641 641
 					$sessname = 'subtotal_hideInnerLines_commande';
642 642
 					$sessname2 = 'subtotal_hidedetails_commande';	
643 643
 					$sessname3 = 'subtotal_hideprices_commande';
644 644
 				}
645
-				elseif(in_array('ordersuppliercard',explode(':',$parameters['context']))) {
645
+				elseif (in_array('ordersuppliercard', explode(':', $parameters['context']))) {
646 646
 				    $sessname = 'subtotal_hideInnerLines_commande_fournisseur';
647 647
 				    $sessname2 = 'subtotal_hidedetails_commande_fournisseur';
648 648
 				    $sessname3 = 'subtotal_hideprices_commande_fournisseur';
@@ -655,25 +655,25 @@  discard block
 block discarded – undo
655 655
 					
656 656
 				global $hideprices;
657 657
 				
658
-				$hideInnerLines = (int)GETPOST('hideInnerLines');
659
-				if(!empty($_SESSION[$sessname]) && !is_array($_SESSION[$sessname][$object->id]) ) $_SESSION[$sessname] = array(); // prevent old system
658
+				$hideInnerLines = (int) GETPOST('hideInnerLines');
659
+				if (!empty($_SESSION[$sessname]) && !is_array($_SESSION[$sessname][$object->id])) $_SESSION[$sessname] = array(); // prevent old system
660 660
 				$_SESSION[$sessname][$object->id] = $hideInnerLines;		
661 661
 				
662
-				$hidedetails= (int)GETPOST('hidedetails');
663
-				if(!empty($_SESSION[$sessname2]) && !is_array($_SESSION[$sessname2][$object->id]) ) $_SESSION[$sessname2] = array(); // prevent old system
662
+				$hidedetails = (int) GETPOST('hidedetails');
663
+				if (!empty($_SESSION[$sessname2]) && !is_array($_SESSION[$sessname2][$object->id])) $_SESSION[$sessname2] = array(); // prevent old system
664 664
 				$_SESSION[$sessname2][$object->id] = $hidedetails;
665 665
 				
666
-				$hideprices= (int)GETPOST('hideprices');
667
-				if(!empty($_SESSION[$sessname3]) && !is_array($_SESSION[$sessname3][$object->id]) ) $_SESSION[$sessname3] = array(); // prevent old system
666
+				$hideprices = (int) GETPOST('hideprices');
667
+				if (!empty($_SESSION[$sessname3]) && !is_array($_SESSION[$sessname3][$object->id])) $_SESSION[$sessname3] = array(); // prevent old system
668 668
 				$_SESSION[$sessname3][$object->id] = $hideprices;
669 669
 				
670
-				foreach($object->lines as &$line) {
670
+				foreach ($object->lines as &$line) {
671 671
 					if ($line->product_type == 9 && $line->special_code == $this->module_number) {
672 672
 					    
673
-                        if($line->qty>=90) {
673
+                        if ($line->qty >= 90) {
674 674
                             $line->modsubtotal_total = 1;
675 675
                         }
676
-                        else{
676
+                        else {
677 677
                             $line->modsubtotal_title = 1;
678 678
                         }
679 679
                         
@@ -683,34 +683,34 @@  discard block
 block discarded – undo
683 683
 	        }
684 684
 			
685 685
 		}
686
-		else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') {
686
+		else if ($action === 'confirm_delete_all_lines' && GETPOST('confirm') == 'yes') {
687 687
 			
688 688
 			$Tab = $this->getArrayOfLineForAGroup($object, GETPOST('lineid'));
689 689
 			
690
-			foreach($Tab as $idLine) {
690
+			foreach ($Tab as $idLine) {
691 691
 				/**
692 692
 				 * @var $object Facture
693 693
 				 */
694
-				if($object->element=='facture') $object->deleteline($idLine);
694
+				if ($object->element == 'facture') $object->deleteline($idLine);
695 695
 				/**
696 696
 				 * @var $object Facture fournisseur
697 697
 				 */
698
-				else if($object->element=='invoice_supplier')
698
+				else if ($object->element == 'invoice_supplier')
699 699
 				{
700 700
 				    $object->deleteline($idLine);
701 701
 				}
702 702
 				/**
703 703
 				 * @var $object Propal
704 704
 				 */
705
-				else if($object->element=='propal') $object->deleteline($idLine);
705
+				else if ($object->element == 'propal') $object->deleteline($idLine);
706 706
 				/**
707 707
 				 * @var $object Propal Fournisseur
708 708
 				 */
709
-				else if($object->element=='supplier_proposal') $object->deleteline($idLine);
709
+				else if ($object->element == 'supplier_proposal') $object->deleteline($idLine);
710 710
 				/**
711 711
 				 * @var $object Commande
712 712
 				 */
713
-				else if($object->element=='commande') 
713
+				else if ($object->element == 'commande') 
714 714
 				{
715 715
 					if ((float) DOL_VERSION >= 5.0) $object->deleteline($user, $idLine);
716 716
 					else $object->deleteline($idLine);
@@ -718,18 +718,18 @@  discard block
 block discarded – undo
718 718
 				/**
719 719
 				 * @var $object Commande fournisseur
720 720
 				 */
721
-				else if($object->element=='order_supplier')
721
+				else if ($object->element == 'order_supplier')
722 722
 				{
723 723
 				    $object->deleteline($idLine);
724 724
 				}
725 725
 				/**
726 726
 				 * @var $object Facturerec
727 727
 				 */
728
-				else if($object->element=='facturerec') $object->deleteline($idLine);
728
+				else if ($object->element == 'facturerec') $object->deleteline($idLine);
729 729
 				/**
730 730
 				 * @var $object Expedition
731 731
 				 */
732
-				else if($object->element=='shipping') $object->deleteline($user, $idLine);
732
+				else if ($object->element == 'shipping') $object->deleteline($user, $idLine);
733 733
 			}
734 734
 			
735 735
 			header('location:?id='.$object->id);
@@ -752,7 +752,7 @@  discard block
 block discarded – undo
752 752
 		return 0;
753 753
 	}
754 754
 	
755
-	function formAddObjectLine ($parameters, &$object, &$action, $hookmanager) {
755
+	function formAddObjectLine($parameters, &$object, &$action, $hookmanager) {
756 756
 		return 0;
757 757
 	}
758 758
 	
@@ -770,8 +770,8 @@  discard block
 block discarded – undo
770 770
 			if (!empty($parameters['fk_element']))
771 771
 			{
772 772
 				
773
-				if($obj->fetch($parameters['fk_element'])){
774
-					$obj->id= $obj->rowid;
773
+				if ($obj->fetch($parameters['fk_element'])) {
774
+					$obj->id = $obj->rowid;
775 775
 					if (empty($obj->array_options))
776 776
 						$obj->fetch_optionals();
777 777
 					if (!empty($obj->array_options['options_subtotal_nc']))
@@ -791,22 +791,22 @@  discard block
 block discarded – undo
791 791
 		
792 792
 		$found = false;
793 793
 
794
-		$Tab= array();
794
+		$Tab = array();
795 795
 		
796
-		foreach($object->lines as $l) {
796
+		foreach ($object->lines as $l) {
797 797
 		
798 798
 		    $lid = (!empty($l->rowid) ? $l->rowid : $l->id);
799
-			if($lid == $lineid) {
799
+			if ($lid == $lineid) {
800 800
 
801 801
 				$found = true;
802 802
 				$qty_line = $l->qty;
803 803
 			}
804 804
 			
805
-			if($found) {
805
+			if ($found) {
806 806
 				
807 807
 			    $Tab[] = (!empty($l->rowid) ? $l->rowid : $l->id);
808 808
 				
809
-				if($l->special_code==$this->module_number && (($l->qty==99 && $qty_line==1) || ($l->qty==98 && $qty_line==2))   ) {
809
+				if ($l->special_code == $this->module_number && (($l->qty == 99 && $qty_line == 1) || ($l->qty == 98 && $qty_line == 2))) {
810 810
 					break; // end of story
811 811
 				}
812 812
 			}
@@ -835,7 +835,7 @@  discard block
 block discarded – undo
835 835
 	 * 
836 836
 	 * @param	$use_level		isn't used anymore
837 837
 	 */
838
-	function getTotalLineFromObject(&$object, &$line, $use_level=false, $return_all=0) {
838
+	function getTotalLineFromObject(&$object, &$line, $use_level = false, $return_all = 0) {
839 839
 		global $conf;
840 840
 		
841 841
 		$rang = $line->rang;
@@ -846,31 +846,31 @@  discard block
 block discarded – undo
846 846
 		$total_ttc = 0;
847 847
 		$TTotal_tva = array();
848 848
 		
849
-		$sign=1;
850
-		if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1;
849
+		$sign = 1;
850
+		if (isset($object->type) && $object->type == 2 && !empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign = -1;
851 851
 		
852 852
 		if (GETPOST('action') == 'builddoc') $builddoc = true;
853 853
 		else $builddoc = false;
854 854
 		
855 855
 		dol_include_once('/subtotal/class/subtotal.class.php');
856
-		foreach($object->lines as $l) {
856
+		foreach ($object->lines as $l) {
857 857
 			//print $l->rang.'>='.$rang.' '.$total.'<br/>';
858
-			if($l->rang>=$rang) {
858
+			if ($l->rang >= $rang) {
859 859
 				//echo 'return!<br>';
860 860
 				if (!$return_all) return $total;
861 861
 				else return array($total, $total_tva, $total_ttc, $TTotal_tva);
862 862
 			}
863
-			else if(TSubtotal::isTitle($l, 100 - $qty_line)) 
863
+			else if (TSubtotal::isTitle($l, 100 - $qty_line)) 
864 864
 		  	{
865 865
 				$total = 0;
866 866
 				$total_tva = 0;
867 867
 				$total_ttc = 0;
868 868
 				$TTotal_tva = array();
869 869
 			}
870
-			elseif(!TSubtotal::isTitle($l) && !TSubtotal::isSubtotal($l)) {
870
+			elseif (!TSubtotal::isTitle($l) && !TSubtotal::isSubtotal($l)) {
871 871
 				
872 872
 				// TODO retirer le test avec $builddoc quand Dolibarr affichera le total progression sur la card et pas seulement dans le PDF
873
-				if ($builddoc && $object->element == 'facture' && $object->type==Facture::TYPE_SITUATION)
873
+				if ($builddoc && $object->element == 'facture' && $object->type == Facture::TYPE_SITUATION)
874 874
 				{
875 875
 					if ($l->situation_percent > 0)
876 876
 					{
@@ -883,7 +883,7 @@  discard block
 block discarded – undo
883 883
 						}
884 884
 						
885 885
 						$result = $sign * ($l->total_ht / ($l->situation_percent / 100)) * $progress;
886
-						$total+= $result;
886
+						$total += $result;
887 887
 						// TODO check si les 3 lignes du dessous sont corrects
888 888
 						$total_tva += $sign * ($l->total_tva / ($l->situation_percent / 100)) * $progress;
889 889
 						$TTotal_tva[$l->tva_tx] += $sign * ($l->total_tva / ($l->situation_percent / 100)) * $progress;
@@ -915,10 +915,10 @@  discard block
 block discarded – undo
915 915
 	 * @param $w            float               width
916 916
 	 * @param $h            float               height
917 917
 	 */
918
-	function pdf_add_total(&$pdf,&$object, &$line, $label, $description,$posx, $posy, $w, $h) {
919
-		global $conf,$subtotal_last_title_posy;
918
+	function pdf_add_total(&$pdf, &$object, &$line, $label, $description, $posx, $posy, $w, $h) {
919
+		global $conf, $subtotal_last_title_posy;
920 920
 
921
-		$hideInnerLines = (int)GETPOST('hideInnerLines');
921
+		$hideInnerLines = (int) GETPOST('hideInnerLines');
922 922
 		if (!empty($conf->global->SUBTOTAL_ONE_LINE_IF_HIDE_INNERLINES) && $hideInnerLines && !empty($subtotal_last_title_posy))
923 923
 		{
924 924
 			$posy = $subtotal_last_title_posy;
@@ -927,40 +927,40 @@  discard block
 block discarded – undo
927 927
 		
928 928
 		$hidePriceOnSubtotalLines = (int) GETPOST('hide_price_on_subtotal_lines');
929 929
 
930
-		if($object->element == 'shipping' || $object->element == 'delivery')
930
+		if ($object->element == 'shipping' || $object->element == 'delivery')
931 931
 		{
932 932
 			$hidePriceOnSubtotalLines = 1;
933 933
 		}
934 934
 		
935 935
 		$set_pagebreak_margin = false;
936
-		if(method_exists('Closure','bind')) {
936
+		if (method_exists('Closure', 'bind')) {
937 937
 			$pageBreakOriginalValue = $pdf->AcceptPageBreak();
938
-			$sweetsThief = function ($pdf) {
939
-		    		return $pdf->bMargin ;
938
+			$sweetsThief = function($pdf) {
939
+		    		return $pdf->bMargin;
940 940
 			};
941 941
 			$sweetsThief = Closure::bind($sweetsThief, null, $pdf);
942 942
 	
943
-			$bMargin  = $sweetsThief($pdf);
943
+			$bMargin = $sweetsThief($pdf);
944 944
 	
945
-			$pdf->SetAutoPageBreak( false );
945
+			$pdf->SetAutoPageBreak(false);
946 946
 
947 947
 			$set_pagebreak_margin = true;			
948 948
 		}
949 949
 		
950 950
 			
951
-		if($line->qty==99)
952
-			$pdf->SetFillColor(220,220,220);
953
-		elseif ($line->qty==98)
954
-			$pdf->SetFillColor(230,230,230);
951
+		if ($line->qty == 99)
952
+			$pdf->SetFillColor(220, 220, 220);
953
+		elseif ($line->qty == 98)
954
+			$pdf->SetFillColor(230, 230, 230);
955 955
 		else
956
-			$pdf->SetFillColor(240,240,240);
956
+			$pdf->SetFillColor(240, 240, 240);
957 957
 		
958 958
 		$style = 'B';
959 959
 		if (!empty($conf->global->SUBTOTAL_SUBTOTAL_STYLE)) $style = $conf->global->SUBTOTAL_SUBTOTAL_STYLE;
960 960
 		
961 961
 		$pdf->SetFont('', $style, 9);
962 962
 		
963
-		$pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'R',true);
963
+		$pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'R', true);
964 964
 //		var_dump($bMargin);
965 965
 		$pageAfter = $pdf->getPage();
966 966
 		
@@ -988,7 +988,7 @@  discard block
 block discarded – undo
988 988
 			
989 989
 			
990 990
 			
991
-			if($total_to_print !== '') {
991
+			if ($total_to_print !== '') {
992 992
 				
993 993
 				if (GETPOST('hideInnerLines'))
994 994
 				{
@@ -1015,11 +1015,11 @@  discard block
 block discarded – undo
1015 1015
 			}
1016 1016
 
1017 1017
 			$pdf->SetXY($pdf->postotalht, $posy);
1018
-			if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin);
1019
-			$pdf->MultiCell($pdf->page_largeur-$pdf->marge_droite-$pdf->postotalht, 3, $total_to_print, 0, 'R', 0);
1018
+			if ($set_pagebreak_margin) $pdf->SetAutoPageBreak($pageBreakOriginalValue, $bMargin);
1019
+			$pdf->MultiCell($pdf->page_largeur - $pdf->marge_droite - $pdf->postotalht, 3, $total_to_print, 0, 'R', 0);
1020 1020
 		}
1021
-		else{
1022
-			if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin);
1021
+		else {
1022
+			if ($set_pagebreak_margin) $pdf->SetAutoPageBreak($pageBreakOriginalValue, $bMargin);
1023 1023
 		}
1024 1024
 		
1025 1025
 		$posy = $posy + $cell_height;
@@ -1039,22 +1039,22 @@  discard block
 block discarded – undo
1039 1039
 	 * @param $w            float               width
1040 1040
 	 * @param $h            float               height
1041 1041
 	 */
1042
-	function pdf_add_title(&$pdf,&$object, &$line, $label, $description,$posx, $posy, $w, $h) {
1042
+	function pdf_add_title(&$pdf, &$object, &$line, $label, $description, $posx, $posy, $w, $h) {
1043 1043
 		
1044
-		global $db,$conf,$subtotal_last_title_posy;
1044
+		global $db, $conf, $subtotal_last_title_posy;
1045 1045
 		
1046 1046
 		$subtotal_last_title_posy = $posy;
1047
-		$pdf->SetXY ($posx, $posy);
1047
+		$pdf->SetXY($posx, $posy);
1048 1048
 		
1049
-		$hideInnerLines = (int)GETPOST('hideInnerLines');
1049
+		$hideInnerLines = (int) GETPOST('hideInnerLines');
1050 1050
 		
1051 1051
 		
1052 1052
  
1053
-		$style = ($line->qty==1) ? 'BU' : 'BUI';
1053
+		$style = ($line->qty == 1) ? 'BU' : 'BUI';
1054 1054
 		if (!empty($conf->global->SUBTOTAL_TITLE_STYLE)) $style = $conf->global->SUBTOTAL_TITLE_STYLE;
1055 1055
 		
1056
-		if($hideInnerLines) {
1057
-			if($line->qty==1)$pdf->SetFont('', $style, 9);
1056
+		if ($hideInnerLines) {
1057
+			if ($line->qty == 1)$pdf->SetFont('', $style, 9);
1058 1058
 			else 
1059 1059
 			{
1060 1060
 				if (!empty($conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES)) $style = $conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES;
@@ -1063,44 +1063,44 @@  discard block
 block discarded – undo
1063 1063
 		}
1064 1064
 		else {
1065 1065
 
1066
-			if($line->qty==1)$pdf->SetFont('', $style, 9); //TODO if super utile
1066
+			if ($line->qty == 1)$pdf->SetFont('', $style, 9); //TODO if super utile
1067 1067
 			else $pdf->SetFont('', $style, 9);
1068 1068
 			
1069 1069
 		}
1070 1070
 		
1071 1071
 		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
1072
-		else $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J',true); // et maintenant avec du HTML
1072
+		else $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J', true); // et maintenant avec du HTML
1073 1073
 		
1074
-		if($description && !$hidedesc) {
1074
+		if ($description && !$hidedesc) {
1075 1075
 			$posy = $pdf->GetY();
1076 1076
 			
1077 1077
 			$pdf->SetFont('', '', 8);
1078 1078
 			
1079
-			$pdf->writeHTMLCell($w, $h, $posx, $posy, $description, 0, 1, false, true, 'J',true);
1079
+			$pdf->writeHTMLCell($w, $h, $posx, $posy, $description, 0, 1, false, true, 'J', true);
1080 1080
 
1081 1081
 		}
1082 1082
 		
1083 1083
 	}
1084 1084
 
1085
-	function pdf_writelinedesc_ref($parameters=array(), &$object, &$action='') {
1085
+	function pdf_writelinedesc_ref($parameters = array(), &$object, &$action = '') {
1086 1086
 	// ultimate PDF hook O_o
1087 1087
 		
1088
-		return $this->pdf_writelinedesc($parameters,$object,$action);
1088
+		return $this->pdf_writelinedesc($parameters, $object, $action);
1089 1089
 		
1090 1090
 	}
1091 1091
 
1092 1092
 	function isModSubtotalLine(&$parameters, &$object) {
1093 1093
 		
1094
-		if(is_array($parameters)) {
1094
+		if (is_array($parameters)) {
1095 1095
 			$i = & $parameters['i'];	
1096 1096
 		}
1097 1097
 		else {
1098
-			$i = (int)$parameters;
1098
+			$i = (int) $parameters;
1099 1099
 		}
1100 1100
 
1101 1101
 		$line = $object->lines[$i];
1102 1102
 
1103
-		if($object->element == 'shipping' || $object->element == 'delivery')
1103
+		if ($object->element == 'shipping' || $object->element == 'delivery')
1104 1104
 		{
1105 1105
 			dol_include_once('/commande/class/commande.class.php');
1106 1106
 			$line = new OrderLine($object->db);
@@ -1108,7 +1108,7 @@  discard block
 block discarded – undo
1108 1108
 		}
1109 1109
 		
1110 1110
 
1111
-		if($line->special_code == $this->module_number && $line->product_type == 9) {
1111
+		if ($line->special_code == $this->module_number && $line->product_type == 9) {
1112 1112
 			return true;
1113 1113
 		}
1114 1114
 		
@@ -1116,42 +1116,42 @@  discard block
 block discarded – undo
1116 1116
 		
1117 1117
 	}
1118 1118
 
1119
-	function pdf_getlineqty($parameters=array(), &$object, &$action='') {
1120
-		global $conf,$hideprices;
1119
+	function pdf_getlineqty($parameters = array(), &$object, &$action = '') {
1120
+		global $conf, $hideprices;
1121 1121
 
1122
-		if($this->isModSubtotalLine($parameters,$object) ){
1122
+		if ($this->isModSubtotalLine($parameters, $object)) {
1123 1123
 			$this->resprints = ' ';
1124 1124
 			
1125
-			if((float)DOL_VERSION<=3.6) {
1125
+			if ((float) DOL_VERSION <= 3.6) {
1126 1126
 				return '';
1127 1127
 			}
1128
-			else if((float)DOL_VERSION>=3.8) {
1128
+			else if ((float) DOL_VERSION >= 3.8) {
1129 1129
 				return 1;
1130 1130
 			}
1131 1131
 			
1132 1132
 		}
1133
-		elseif(!empty($hideprices)) {
1133
+		elseif (!empty($hideprices)) {
1134 1134
 			$this->resprints = $object->lines[$parameters['i']]->qty;
1135 1135
 			return 1;
1136 1136
 		}
1137 1137
 		elseif (!empty($conf->global->SUBTOTAL_IF_HIDE_PRICES_SHOW_QTY))
1138 1138
 		{
1139
-			$hideInnerLines = (int)GETPOST('hideInnerLines');
1140
-			$hidedetails = (int)GETPOST('hidedetails');
1139
+			$hideInnerLines = (int) GETPOST('hideInnerLines');
1140
+			$hidedetails = (int) GETPOST('hidedetails');
1141 1141
 			if (empty($hideInnerLines) && !empty($hidedetails))
1142 1142
 			{
1143 1143
 				$this->resprints = $object->lines[$parameters['i']]->qty;
1144 1144
 			}
1145 1145
 		}
1146 1146
 		
1147
-		if(is_array($parameters)) $i = & $parameters['i'];
1148
-		else $i = (int)$parameters;
1147
+		if (is_array($parameters)) $i = & $parameters['i'];
1148
+		else $i = (int) $parameters;
1149 1149
 
1150 1150
 		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)
1151 1151
 		
1152
-		if(empty($object->lines[$i]->array_options)) $object->lines[$i]->fetch_optionals();
1152
+		if (empty($object->lines[$i]->array_options)) $object->lines[$i]->fetch_optionals();
1153 1153
 
1154
-		if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) )
1154
+		if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])))
1155 1155
 		{
1156 1156
 			if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC)))
1157 1157
 			{
@@ -1163,20 +1163,20 @@  discard block
 block discarded – undo
1163 1163
 		return 0;
1164 1164
 	}
1165 1165
 	
1166
-	function pdf_getlinetotalexcltax($parameters=array(), &$object, &$action='') {
1166
+	function pdf_getlinetotalexcltax($parameters = array(), &$object, &$action = '') {
1167 1167
 	    global $conf, $hideprices, $hookmanager;
1168 1168
 		
1169
-		if(is_array($parameters)) $i = & $parameters['i'];
1170
-		else $i = (int)$parameters;
1169
+		if (is_array($parameters)) $i = & $parameters['i'];
1170
+		else $i = (int) $parameters;
1171 1171
 			
1172
-		if($this->isModSubtotalLine($parameters,$object) ){
1172
+		if ($this->isModSubtotalLine($parameters, $object)) {
1173 1173
 			
1174 1174
 			$this->resprints = ' ';
1175 1175
 			
1176
-			if((float)DOL_VERSION<=3.6) {
1176
+			if ((float) DOL_VERSION <= 3.6) {
1177 1177
 				return '';
1178 1178
 			}
1179
-			else if((float)DOL_VERSION>=3.8) {
1179
+			else if ((float) DOL_VERSION >= 3.8) {
1180 1180
 				return 1;
1181 1181
 			}
1182 1182
 			
@@ -1202,7 +1202,7 @@  discard block
 block discarded – undo
1202 1202
 				}
1203 1203
 			}
1204 1204
 		}
1205
-		if ((int)GETPOST('hideInnerLines') && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)){
1205
+		if ((int) GETPOST('hideInnerLines') && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) {
1206 1206
 		    $this->resprints = price($object->lines[$i]->total_ht);
1207 1207
 		}
1208 1208
 		
@@ -1227,7 +1227,7 @@  discard block
 block discarded – undo
1227 1227
 		{
1228 1228
 			// Check if a title exist for this line && if the title have subtotal
1229 1229
 			$lineTitle = TSubtotal::getParentTitleOfLine($object, $i);
1230
-			if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true))
1230
+			if (TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true))
1231 1231
 			{
1232 1232
 
1233 1233
 				$this->resprints = ' ';
@@ -1247,7 +1247,7 @@  discard block
 block discarded – undo
1247 1247
 	 */
1248 1248
 	private function callHook(&$object, &$hookmanager, $action, $params, $defaultReturn = 1)
1249 1249
 	{
1250
-		$reshook=$hookmanager->executeHooks('subtotalHidePrices',$params, $object, $action);
1250
+		$reshook = $hookmanager->executeHooks('subtotalHidePrices', $params, $object, $action);
1251 1251
 		if ($reshook < 0)
1252 1252
 		{
1253 1253
 			$this->error = $hookmanager->error;
@@ -1263,7 +1263,7 @@  discard block
 block discarded – undo
1263 1263
 			$this->resprints = $hookmanager->resprints;
1264 1264
 
1265 1265
 			// override return (use  $this->results['overrideReturn'] or $this->resArray['overrideReturn'] in other module action_xxxx.class.php )
1266
-			if(isset($hookmanager->resArray['overrideReturn']))
1266
+			if (isset($hookmanager->resArray['overrideReturn']))
1267 1267
 			{
1268 1268
 				return $hookmanager->resArray['overrideReturn'];
1269 1269
 			}
@@ -1272,25 +1272,25 @@  discard block
 block discarded – undo
1272 1272
 		return $defaultReturn;
1273 1273
 	}
1274 1274
 	
1275
-	function pdf_getlinetotalwithtax($parameters=array(), &$object, &$action='') {
1275
+	function pdf_getlinetotalwithtax($parameters = array(), &$object, &$action = '') {
1276 1276
 		global $conf;
1277 1277
 		
1278
-		if($this->isModSubtotalLine($parameters,$object) ){
1278
+		if ($this->isModSubtotalLine($parameters, $object)) {
1279 1279
 			
1280 1280
 			$this->resprints = ' ';
1281 1281
 		
1282
-			if((float)DOL_VERSION<=3.6) {
1282
+			if ((float) DOL_VERSION <= 3.6) {
1283 1283
 				return '';
1284 1284
 			}
1285
-			else if((float)DOL_VERSION>=3.8) {
1285
+			else if ((float) DOL_VERSION >= 3.8) {
1286 1286
 				return 1;
1287 1287
 			}
1288 1288
 		}
1289 1289
 		
1290
-		if(is_array($parameters)) $i = & $parameters['i'];
1291
-		else $i = (int)$parameters;
1290
+		if (is_array($parameters)) $i = & $parameters['i'];
1291
+		else $i = (int) $parameters;
1292 1292
 		
1293
-		if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) 
1293
+		if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) 
1294 1294
 		{
1295 1295
 			if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC)))
1296 1296
 			{
@@ -1302,24 +1302,24 @@  discard block
 block discarded – undo
1302 1302
 		return 0;
1303 1303
 	}
1304 1304
 	
1305
-	function pdf_getlineunit($parameters=array(), &$object, &$action='') {
1305
+	function pdf_getlineunit($parameters = array(), &$object, &$action = '') {
1306 1306
 		global $conf;
1307 1307
 		
1308
-		if($this->isModSubtotalLine($parameters,$object) ){
1308
+		if ($this->isModSubtotalLine($parameters, $object)) {
1309 1309
 			$this->resprints = ' ';
1310 1310
 		
1311
-			if((float)DOL_VERSION<=3.6) {
1311
+			if ((float) DOL_VERSION <= 3.6) {
1312 1312
 				return '';
1313 1313
 			}
1314
-			else if((float)DOL_VERSION>=3.8) {
1314
+			else if ((float) DOL_VERSION >= 3.8) {
1315 1315
 				return 1;
1316 1316
 			}
1317 1317
 		}
1318 1318
 		
1319
-		if(is_array($parameters)) $i = & $parameters['i'];
1320
-		else $i = (int)$parameters;
1319
+		if (is_array($parameters)) $i = & $parameters['i'];
1320
+		else $i = (int) $parameters;
1321 1321
 			
1322
-		if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) )
1322
+		if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])))
1323 1323
 		{
1324 1324
 			if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC)))
1325 1325
 			{
@@ -1331,32 +1331,32 @@  discard block
 block discarded – undo
1331 1331
 		return 0;
1332 1332
 	}
1333 1333
 	
1334
-	function pdf_getlineupexcltax($parameters=array(), &$object, &$action='') {
1335
-	    global $conf,$hideprices,$hookmanager;
1334
+	function pdf_getlineupexcltax($parameters = array(), &$object, &$action = '') {
1335
+	    global $conf, $hideprices, $hookmanager;
1336 1336
 
1337
-		if(is_array($parameters)) $i = & $parameters['i'];
1338
-		else $i = (int)$parameters;
1337
+		if (is_array($parameters)) $i = & $parameters['i'];
1338
+		else $i = (int) $parameters;
1339 1339
 
1340
-		if($this->isModSubtotalLine($parameters,$object) ) {
1340
+		if ($this->isModSubtotalLine($parameters, $object)) {
1341 1341
 			$this->resprints = ' ';
1342 1342
 
1343 1343
             $line = $object->lines[$i];
1344 1344
 
1345 1345
             // On récupère les montants du bloc pour les afficher dans la ligne de sous-total
1346
-            if(TSubtotal::isSubtotal($line)) {
1346
+            if (TSubtotal::isSubtotal($line)) {
1347 1347
                 $parentTitle = TSubtotal::getParentTitleOfLine($object, $i);
1348 1348
 
1349
-                if(is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals();
1350
-                if(! empty($parentTitle->array_options['options_show_total_ht'])) {
1349
+                if (is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals();
1350
+                if (!empty($parentTitle->array_options['options_show_total_ht'])) {
1351 1351
                     $TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle);
1352 1352
                     $this->resprints = price($TTotal['total_unit_subprice']);
1353 1353
                 }
1354 1354
             }
1355 1355
 		
1356
-			if((float)DOL_VERSION<=3.6) {
1356
+			if ((float) DOL_VERSION <= 3.6) {
1357 1357
 				return '';
1358 1358
 			}
1359
-			else if((float)DOL_VERSION>=3.8) {
1359
+			else if ((float) DOL_VERSION >= 3.8) {
1360 1360
 				return 1;
1361 1361
 			}
1362 1362
 		}
@@ -1384,7 +1384,7 @@  discard block
 block discarded – undo
1384 1384
 		    
1385 1385
 		    // Check if a title exist for this line && if the title have subtotal
1386 1386
 		    $lineTitle = TSubtotal::getParentTitleOfLine($object, $i);
1387
-		    if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true))
1387
+		    if (TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true))
1388 1388
 		    {
1389 1389
 		        
1390 1390
 		        $this->resprints = ' ';
@@ -1398,37 +1398,37 @@  discard block
 block discarded – undo
1398 1398
 		return 0;
1399 1399
 	}
1400 1400
 	
1401
-	function pdf_getlineremisepercent($parameters=array(), &$object, &$action='') {
1402
-	    global $conf,$hideprices,$hookmanager;
1401
+	function pdf_getlineremisepercent($parameters = array(), &$object, &$action = '') {
1402
+	    global $conf, $hideprices, $hookmanager;
1403 1403
 
1404
-        if(is_array($parameters)) $i = & $parameters['i'];
1404
+        if (is_array($parameters)) $i = & $parameters['i'];
1405 1405
         else $i = (int) $parameters;
1406 1406
 
1407
-		if($this->isModSubtotalLine($parameters,$object) ) {
1407
+		if ($this->isModSubtotalLine($parameters, $object)) {
1408 1408
 			$this->resprints = ' ';
1409 1409
 
1410 1410
             $line = $object->lines[$i];
1411 1411
 
1412 1412
             // Affichage de la remise 
1413
-            if(TSubtotal::isSubtotal($line)) {
1413
+            if (TSubtotal::isSubtotal($line)) {
1414 1414
                 $parentTitle = TSubtotal::getParentTitleOfLine($object, $i);
1415 1415
 
1416
-                if(empty($parentTitle->array_options)) $parentTitle->fetch_optionals();
1417
-                if(! empty($parentTitle->array_options['options_show_reduc'])) {
1416
+                if (empty($parentTitle->array_options)) $parentTitle->fetch_optionals();
1417
+                if (!empty($parentTitle->array_options['options_show_reduc'])) {
1418 1418
                     $TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle);
1419
-                    $this->resprints = price((1-$TTotal['total_ht'] / $TTotal['total_subprice'])*100, 0, '', 1, 2, 2).'%';
1419
+                    $this->resprints = price((1 - $TTotal['total_ht'] / $TTotal['total_subprice']) * 100, 0, '', 1, 2, 2).'%';
1420 1420
                 }
1421 1421
             }
1422 1422
 		
1423
-			if((float)DOL_VERSION<=3.6) {
1423
+			if ((float) DOL_VERSION <= 3.6) {
1424 1424
 				return '';
1425 1425
 			}
1426
-			else if((float)DOL_VERSION>=3.8) {
1426
+			else if ((float) DOL_VERSION >= 3.8) {
1427 1427
 				return 1;
1428 1428
 			}
1429 1429
 		}
1430 1430
 		elseif (!empty($hideprices)
1431
-		        || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) )
1431
+		        || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])))
1432 1432
 		        )
1433 1433
 		    {
1434 1434
 		        if (!empty($hideprices) || !in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC)))
@@ -1441,24 +1441,24 @@  discard block
 block discarded – undo
1441 1441
 		return 0;
1442 1442
 	}
1443 1443
 	
1444
-	function pdf_getlineupwithtax($parameters=array(), &$object, &$action='') {
1445
-		global $conf,$hideprices;
1444
+	function pdf_getlineupwithtax($parameters = array(), &$object, &$action = '') {
1445
+		global $conf, $hideprices;
1446 1446
 		
1447
-		if($this->isModSubtotalLine($parameters,$object) ){
1447
+		if ($this->isModSubtotalLine($parameters, $object)) {
1448 1448
 			$this->resprints = ' ';
1449
-			if((float)DOL_VERSION<=3.6) {
1449
+			if ((float) DOL_VERSION <= 3.6) {
1450 1450
 				return '';
1451 1451
 			}
1452
-			else if((float)DOL_VERSION>=3.8) {
1452
+			else if ((float) DOL_VERSION >= 3.8) {
1453 1453
 				return 1;
1454 1454
 			}
1455 1455
 		}
1456 1456
 		
1457
-		if(is_array($parameters)) $i = & $parameters['i'];
1458
-		else $i = (int)$parameters;
1457
+		if (is_array($parameters)) $i = & $parameters['i'];
1458
+		else $i = (int) $parameters;
1459 1459
 			
1460 1460
 		if (!empty($hideprices)
1461
-				|| (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) )
1461
+				|| (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])))
1462 1462
 		)
1463 1463
 		{
1464 1464
 			if (!empty($hideprices) || !in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC)))
@@ -1471,22 +1471,22 @@  discard block
 block discarded – undo
1471 1471
 		return 0;
1472 1472
 	}
1473 1473
 	
1474
-	function pdf_getlinevatrate($parameters=array(), &$object, &$action='') {
1475
-	    global $conf,$hideprices,$hookmanager;
1474
+	function pdf_getlinevatrate($parameters = array(), &$object, &$action = '') {
1475
+	    global $conf, $hideprices, $hookmanager;
1476 1476
 	    
1477
-		if($this->isModSubtotalLine($parameters,$object) ){
1477
+		if ($this->isModSubtotalLine($parameters, $object)) {
1478 1478
 			$this->resprints = ' ';
1479 1479
 			
1480
-			if((float)DOL_VERSION<=3.6) {
1480
+			if ((float) DOL_VERSION <= 3.6) {
1481 1481
 				return '';
1482 1482
 			}
1483
-			else if((float)DOL_VERSION>=3.8) {
1483
+			else if ((float) DOL_VERSION >= 3.8) {
1484 1484
 				return 1;
1485 1485
 			}
1486 1486
 		}
1487 1487
 		
1488
-		if(is_array($parameters)) $i = & $parameters['i'];
1489
-		else $i = (int)$parameters;
1488
+		if (is_array($parameters)) $i = & $parameters['i'];
1489
+		else $i = (int) $parameters;
1490 1490
 		
1491 1491
 		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)
1492 1492
 
@@ -1513,7 +1513,7 @@  discard block
 block discarded – undo
1513 1513
 		    
1514 1514
 		    // Check if a title exist for this line && if the title have subtotal
1515 1515
 		    $lineTitle = TSubtotal::getParentTitleOfLine($object, $i);
1516
-		    if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true))
1516
+		    if (TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true))
1517 1517
 		    {
1518 1518
 		        
1519 1519
 		        $this->resprints = ' ';
@@ -1527,23 +1527,23 @@  discard block
 block discarded – undo
1527 1527
 		return 0;
1528 1528
 	}
1529 1529
 		
1530
-	function pdf_getlineprogress($parameters=array(), &$object, &$action) {
1530
+	function pdf_getlineprogress($parameters = array(), &$object, &$action) {
1531 1531
 		global $conf;
1532 1532
 		
1533
-		if($this->isModSubtotalLine($parameters,$object) ){
1533
+		if ($this->isModSubtotalLine($parameters, $object)) {
1534 1534
 			$this->resprints = ' ';
1535
-			if((float)DOL_VERSION<=3.6) {
1535
+			if ((float) DOL_VERSION <= 3.6) {
1536 1536
 				return '';
1537 1537
 			}
1538
-			else if((float)DOL_VERSION>=3.8) {
1538
+			else if ((float) DOL_VERSION >= 3.8) {
1539 1539
 				return 1;
1540 1540
 			}
1541 1541
 		}
1542 1542
 		
1543
-		if(is_array($parameters)) $i = & $parameters['i'];
1544
-		else $i = (int)$parameters;
1543
+		if (is_array($parameters)) $i = & $parameters['i'];
1544
+		else $i = (int) $parameters;
1545 1545
 			
1546
-		if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) )
1546
+		if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])))
1547 1547
 		{
1548 1548
 			if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC)))
1549 1549
 			{
@@ -1558,12 +1558,12 @@  discard block
 block discarded – undo
1558 1558
 	function add_numerotation(&$object) {
1559 1559
 		global $conf;
1560 1560
 		
1561
-		if(!empty($conf->global->SUBTOTAL_USE_NUMEROTATION)) {
1561
+		if (!empty($conf->global->SUBTOTAL_USE_NUMEROTATION)) {
1562 1562
 		
1563 1563
 			$TLevelTitre = array();
1564 1564
 			$prevlevel = 0;
1565 1565
 		
1566
-			foreach($object->lines as $k=>&$line) 
1566
+			foreach ($object->lines as $k=>&$line) 
1567 1567
 			{
1568 1568
 				if ($line->id > 0 && $this->isModSubtotalLine($k, $object) && $line->qty <= 10)
1569 1569
 				{
@@ -1577,12 +1577,12 @@  discard block
 block discarded – undo
1577 1577
 	}
1578 1578
 
1579 1579
 	// TODO ne gère pas encore la numération des lignes "Totaux"
1580
-	private function formatNumerotation(&$TLineTitle, $line_reference='', $level=1, $prefix_num=0)
1580
+	private function formatNumerotation(&$TLineTitle, $line_reference = '', $level = 1, $prefix_num = 0)
1581 1581
 	{
1582 1582
 		$TTitle = array();
1583 1583
 		
1584
-		$i=1;
1585
-		$j=0;
1584
+		$i = 1;
1585
+		$j = 0;
1586 1586
 		foreach ($TLineTitle as $k => &$line)
1587 1587
 		{
1588 1588
 			if (!empty($line_reference) && $line->rang <= $line_reference->rang) continue;
@@ -1592,7 +1592,7 @@  discard block
 block discarded – undo
1592 1592
 			{
1593 1593
 				$TTitle[$j]['numerotation'] = ($prefix_num == 0) ? $i : $prefix_num.'.'.$i;
1594 1594
 				//var_dump('Prefix == '.$prefix_num.' // '.$line->desc.' ==> numerotation == '.$TTitle[$j]['numerotation'].'   ###    '.$line->qty .'=='. $level);
1595
-				if (empty($line->label) && (float)DOL_VERSION < 6)
1595
+				if (empty($line->label) && (float) DOL_VERSION < 6)
1596 1596
 				{
1597 1597
 					$line->label = !empty($line->desc) ? $line->desc : $line->description;
1598 1598
 					$line->desc = $line->description = '';
@@ -1618,26 +1618,26 @@  discard block
 block discarded – undo
1618 1618
 	
1619 1619
 	function setDocTVA(&$pdf, &$object) {
1620 1620
 		
1621
-		$hidedetails = (int)GETPOST('hidedetails');
1621
+		$hidedetails = (int) GETPOST('hidedetails');
1622 1622
 		
1623
-		if(empty($hidedetails)) return false;
1623
+		if (empty($hidedetails)) return false;
1624 1624
 		
1625 1625
 		// TODO can't add VAT to document without lines... :-/
1626 1626
 		
1627 1627
 		return true;
1628 1628
 	}
1629 1629
 	
1630
-	function beforePDFCreation($parameters=array(), &$object, &$action)
1630
+	function beforePDFCreation($parameters = array(), &$object, &$action)
1631 1631
 	{
1632 1632
 		/**
1633 1633
 		 * @var $pdf    TCPDF
1634 1634
 		 */
1635
-		global $pdf,$conf, $langs;
1635
+		global $pdf, $conf, $langs;
1636 1636
 
1637 1637
 		// var_dump($object->lines);
1638 1638
 		dol_include_once('/subtotal/class/subtotal.class.php');
1639 1639
 
1640
-		foreach($parameters as $key=>$value) {
1640
+		foreach ($parameters as $key=>$value) {
1641 1641
 			${$key} = $value;
1642 1642
 		}
1643 1643
 		
@@ -1645,43 +1645,43 @@  discard block
 block discarded – undo
1645 1645
 		
1646 1646
 		$this->add_numerotation($object);	
1647 1647
 		
1648
-        foreach($object->lines as $k => &$l) {
1649
-            if(TSubtotal::isSubtotal($l)) {
1648
+        foreach ($object->lines as $k => &$l) {
1649
+            if (TSubtotal::isSubtotal($l)) {
1650 1650
                 $parentTitle = TSubtotal::getParentTitleOfLine($object, $k);
1651
-                if(is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals();
1652
-                if(! empty($parentTitle->id) && ! empty($parentTitle->array_options['options_show_reduc'])) {
1653
-                    $l->remise_percent = 100;    // Affichage de la réduction sur la ligne de sous-total
1651
+                if (is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals();
1652
+                if (!empty($parentTitle->id) && !empty($parentTitle->array_options['options_show_reduc'])) {
1653
+                    $l->remise_percent = 100; // Affichage de la réduction sur la ligne de sous-total
1654 1654
                 }
1655 1655
             }
1656 1656
 
1657 1657
 
1658 1658
             // Pas de hook sur les colonnes du PDF expédition, on unset les bonnes variables
1659
-            if(($object->element == 'shipping' || $object->element == 'delivery') && $this->isModSubtotalLine($k, $object))
1659
+            if (($object->element == 'shipping' || $object->element == 'delivery') && $this->isModSubtotalLine($k, $object))
1660 1660
 			{
1661 1661
 				$l->qty = $l->qty_asked;
1662 1662
 				unset($l->qty_asked, $l->qty_shipped, $l->volume, $l->weight);
1663 1663
 			}
1664 1664
         }
1665 1665
 
1666
-		$hideInnerLines = (int)GETPOST('hideInnerLines');
1667
-		$hidedetails = (int)GETPOST('hidedetails');
1666
+		$hideInnerLines = (int) GETPOST('hideInnerLines');
1667
+		$hidedetails = (int) GETPOST('hidedetails');
1668 1668
 
1669 1669
 		if ($hideInnerLines) { // si c une ligne de titre
1670
-	    	$fk_parent_line=0;
1671
-			$TLines =array();
1670
+	    	$fk_parent_line = 0;
1671
+			$TLines = array();
1672 1672
 		
1673
-			$original_count=count($object->lines);
1673
+			$original_count = count($object->lines);
1674 1674
 		    $TTvas = array(); // tableau de tva
1675 1675
 		    
1676
-			foreach($object->lines as $k=>&$line) 
1676
+			foreach ($object->lines as $k=>&$line) 
1677 1677
 			{
1678 1678
 			    
1679
-				if($line->product_type==9 && $line->rowid>0) 
1679
+				if ($line->product_type == 9 && $line->rowid > 0) 
1680 1680
 				{
1681 1681
 					$fk_parent_line = $line->rowid;
1682 1682
 					
1683 1683
 					// 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
1684
-					if(TSubtotal::isSubtotal($line)) 
1684
+					if (TSubtotal::isSubtotal($line)) 
1685 1685
 					{
1686 1686
 						/*$total = $this->getTotalLineFromObject($object, $line, '');
1687 1687
 						
@@ -1712,22 +1712,22 @@  discard block
 block discarded – undo
1712 1712
 			
1713 1713
 				if ($hideInnerLines)
1714 1714
 				{
1715
-				    if(!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES))
1715
+				    if (!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES))
1716 1716
 				    {
1717
-				        if($line->tva_tx != '0.000' && $line->product_type!=9){
1717
+				        if ($line->tva_tx != '0.000' && $line->product_type != 9) {
1718 1718
 				            
1719 1719
     				        // on remplit le tableau de tva pour substituer les lignes cachées
1720 1720
     				        $TTvas[$line->tva_tx]['total_tva'] += $line->total_tva;
1721 1721
     				        $TTvas[$line->tva_tx]['total_ht'] += $line->total_ht;
1722 1722
     				        $TTvas[$line->tva_tx]['total_ttc'] += $line->total_ttc; 
1723 1723
     				    }
1724
-    					if($line->product_type==9 && $line->rowid>0)
1724
+    					if ($line->product_type == 9 && $line->rowid > 0)
1725 1725
     					{
1726 1726
     					    //Cas où je doit cacher les produits et afficher uniquement les sous-totaux avec les titres
1727 1727
     					    // génère des lignes d'affichage des montants HT soumis à tva
1728 1728
     					    $nbtva = count($TTvas);
1729
-    					    if(!empty($nbtva)){
1730
-    					        foreach ($TTvas as $tx =>$val){
1729
+    					    if (!empty($nbtva)) {
1730
+    					        foreach ($TTvas as $tx =>$val) {
1731 1731
     					            $l = clone $line;
1732 1732
     					            $l->product_type = 1;
1733 1733
     					            $l->special_code = '';
@@ -1748,7 +1748,7 @@  discard block
 block discarded – undo
1748 1748
     					}
1749 1749
 				    } else {
1750 1750
 				        
1751
-				        if($line->product_type==9 && $line->rowid>0)
1751
+				        if ($line->product_type == 9 && $line->rowid > 0)
1752 1752
 				        {
1753 1753
 				            // ajoute la ligne de sous-total
1754 1754
 				            $TLines[] = $line; 
@@ -1776,9 +1776,9 @@  discard block
 block discarded – undo
1776 1776
 			
1777 1777
 			// cas incongru où il y aurait des produits en dessous du dernier sous-total
1778 1778
 			$nbtva = count($TTvas);
1779
-			if(!empty($nbtva) && $hideInnerLines && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES))
1779
+			if (!empty($nbtva) && $hideInnerLines && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES))
1780 1780
 			{
1781
-			    foreach ($TTvas as $tx =>$val){
1781
+			    foreach ($TTvas as $tx =>$val) {
1782 1782
 			        $l = clone $line;
1783 1783
 			        $l->product_type = 1;
1784 1784
 			        $l->special_code = '';
@@ -1795,11 +1795,11 @@  discard block
 block discarded – undo
1795 1795
 			}
1796 1796
 			
1797 1797
 			global $nblignes;
1798
-			$nblignes=count($TLines);
1798
+			$nblignes = count($TLines);
1799 1799
 
1800 1800
 			$object->lines = $TLines;
1801 1801
 			
1802
-			if($i>count($object->lines)) {
1802
+			if ($i > count($object->lines)) {
1803 1803
 				$this->resprints = '';
1804 1804
 				return 0;
1805 1805
 			}
@@ -1808,55 +1808,55 @@  discard block
 block discarded – undo
1808 1808
 		return 0;
1809 1809
 	}
1810 1810
 
1811
-	function pdf_writelinedesc($parameters=array(), &$object, &$action)
1811
+	function pdf_writelinedesc($parameters = array(), &$object, &$action)
1812 1812
 	{
1813 1813
 		/**
1814 1814
 		 * @var $pdf    TCPDF
1815 1815
 		 */
1816
-		global $pdf,$conf;
1816
+		global $pdf, $conf;
1817 1817
 
1818
-		foreach($parameters as $key=>$value) {
1818
+		foreach ($parameters as $key=>$value) {
1819 1819
 			${$key} = $value;
1820 1820
 		}
1821 1821
 		
1822
-		$hideInnerLines = (int)GETPOST('hideInnerLines');
1823
-		$hidedetails = (int)GETPOST('hidedetails');
1822
+		$hideInnerLines = (int) GETPOST('hideInnerLines');
1823
+		$hidedetails = (int) GETPOST('hidedetails');
1824 1824
 		
1825
-		if($this->isModSubtotalLine($parameters,$object) ){			
1825
+		if ($this->isModSubtotalLine($parameters, $object)) {			
1826 1826
 		
1827 1827
 				global $hideprices;
1828 1828
 				
1829
-				if(!empty($hideprices)) {
1830
-					foreach($object->lines as &$line) {
1831
-						if($line->fk_product_type!=9) $line->fk_parent_line = -1;	
1829
+				if (!empty($hideprices)) {
1830
+					foreach ($object->lines as &$line) {
1831
+						if ($line->fk_product_type != 9) $line->fk_parent_line = -1;	
1832 1832
 					}
1833 1833
 				}
1834 1834
 			
1835 1835
 				$line = &$object->lines[$i];
1836 1836
 
1837
-				if($object->element == 'delivery' && ! empty($object->commande->expeditions[$line->fk_origin_line])) unset($object->commande->expeditions[$line->fk_origin_line]);
1837
+				if ($object->element == 'delivery' && !empty($object->commande->expeditions[$line->fk_origin_line])) unset($object->commande->expeditions[$line->fk_origin_line]);
1838 1838
 
1839
-				if($line->info_bits>0) { // PAGE BREAK
1839
+				if ($line->info_bits > 0) { // PAGE BREAK
1840 1840
 					$pdf->addPage();
1841 1841
 					$posy = $pdf->GetY();
1842 1842
 				}
1843 1843
 				
1844 1844
 				$label = $line->label;
1845
-				$description= !empty($line->desc) ? $outputlangs->convToOutputCharset($line->desc) : $outputlangs->convToOutputCharset($line->description);
1845
+				$description = !empty($line->desc) ? $outputlangs->convToOutputCharset($line->desc) : $outputlangs->convToOutputCharset($line->description);
1846 1846
 				
1847
-				if(empty($label)) {
1847
+				if (empty($label)) {
1848 1848
 					$label = $description;
1849
-					$description='';
1849
+					$description = '';
1850 1850
 				}
1851 1851
 
1852
-				if($line->qty>90) {
1852
+				if ($line->qty > 90) {
1853 1853
 					if ($conf->global->SUBTOTAL_USE_NEW_FORMAT)	$label .= ' '.$this->getTitle($object, $line);
1854 1854
 					
1855 1855
 					$pageBefore = $pdf->getPage();
1856
-					$this->pdf_add_total($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h);
1856
+					$this->pdf_add_total($pdf, $object, $line, $label, $description, $posx, $posy, $w, $h);
1857 1857
 					$pageAfter = $pdf->getPage();	
1858 1858
 
1859
-					if($pageAfter>$pageBefore) {
1859
+					if ($pageAfter > $pageBefore) {
1860 1860
 						//print "ST $pageAfter>$pageBefore<br>";
1861 1861
 						$pdf->rollbackTransaction(true);
1862 1862
 						$pdf->addPage('', '', true);
@@ -1867,9 +1867,9 @@  discard block
 block discarded – undo
1867 1867
 					}
1868 1868
 
1869 1869
 					// On delivery PDF, we don't want quantities to appear and there are no hooks => setting text color to background color;
1870
-					if($object->element == 'delivery')
1870
+					if ($object->element == 'delivery')
1871 1871
 					{
1872
-						switch($line->qty)
1872
+						switch ($line->qty)
1873 1873
 						{
1874 1874
 							case 99:
1875 1875
 								$grey = 220;
@@ -1892,7 +1892,7 @@  discard block
 block discarded – undo
1892 1892
 				else if ($line->qty < 10) {
1893 1893
 					$pageBefore = $pdf->getPage();
1894 1894
 
1895
-					$this->pdf_add_title($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); 
1895
+					$this->pdf_add_title($pdf, $object, $line, $label, $description, $posx, $posy, $w, $h); 
1896 1896
 					$pageAfter = $pdf->getPage();	
1897 1897
 
1898 1898
 					
@@ -1908,9 +1908,9 @@  discard block
 block discarded – undo
1908 1908
 					}
1909 1909
 				*/
1910 1910
 
1911
-					if($object->element == 'delivery')
1911
+					if ($object->element == 'delivery')
1912 1912
 					{
1913
-						$pdf->SetTextColor(255,255,255);
1913
+						$pdf->SetTextColor(255, 255, 255);
1914 1914
 					}
1915 1915
 
1916 1916
 					$posy = $pdf->GetY();
@@ -1973,9 +1973,9 @@  discard block
 block discarded – undo
1973 1973
 	 * @param $hookmanager  HookManager
1974 1974
 	 * @return int
1975 1975
 	 */
1976
-	function printObjectLine ($parameters, &$object, &$action, $hookmanager){
1976
+	function printObjectLine($parameters, &$object, &$action, $hookmanager) {
1977 1977
 		
1978
-		global $conf,$langs,$user,$db,$bc;
1978
+		global $conf, $langs, $user, $db, $bc;
1979 1979
 		
1980 1980
 		$num = &$parameters['num'];
1981 1981
 		$line = &$parameters['line'];
@@ -1983,33 +1983,33 @@  discard block
 block discarded – undo
1983 1983
 		
1984 1984
 		$var = &$parameters['var'];
1985 1985
 
1986
-		$contexts = explode(':',$parameters['context']);
1987
-		if($parameters['currentcontext'] === 'paiementcard') return 0;
1986
+		$contexts = explode(':', $parameters['context']);
1987
+		if ($parameters['currentcontext'] === 'paiementcard') return 0;
1988 1988
 		$originline = null;
1989 1989
 
1990 1990
 		$createRight = $user->rights->{$object->element}->creer;
1991
-		if($object->element == 'facturerec' )
1991
+		if ($object->element == 'facturerec')
1992 1992
 		{
1993 1993
 			$object->statut = 0; // hack for facture rec
1994 1994
 			$createRight = $user->rights->facture->creer;
1995 1995
 		}
1996
-		elseif($object->element == 'order_supplier' )
1996
+		elseif ($object->element == 'order_supplier')
1997 1997
 		{
1998 1998
 		    $createRight = $user->rights->fournisseur->commande->creer;
1999 1999
 		}
2000
-		elseif($object->element == 'invoice_supplier' )
2000
+		elseif ($object->element == 'invoice_supplier')
2001 2001
 		{
2002 2002
 		    $createRight = $user->rights->fournisseur->facture->creer;
2003 2003
 		}
2004
-		elseif($object->element == 'commande' && in_array('ordershipmentcard', $contexts))
2004
+		elseif ($object->element == 'commande' && in_array('ordershipmentcard', $contexts))
2005 2005
 		{
2006 2006
 			// H4cK 4n0nYm0u$-style : $line n'est pas un objet instancié mais provient d'un fetch_object d'une requête SQL
2007 2007
 			$line->id = $line->rowid;
2008 2008
 			$line->product_type = $line->type;
2009 2009
 		}
2010
-		elseif($object->element == 'shipping' || $object->element == 'delivery')
2010
+		elseif ($object->element == 'shipping' || $object->element == 'delivery')
2011 2011
 		{
2012
-			if(empty($line->origin_line_id) && ! empty($line->fk_origin_line))
2012
+			if (empty($line->origin_line_id) && !empty($line->fk_origin_line))
2013 2013
 			{
2014 2014
 				$line->origin_line_id = $line->fk_origin_line;
2015 2015
 			}
@@ -2017,9 +2017,9 @@  discard block
 block discarded – undo
2017 2017
 			$originline = new OrderLine($db);
2018 2018
 			$originline->fetch($line->fk_origin_line);
2019 2019
 
2020
-			foreach(get_object_vars($line) as $property => $value)
2020
+			foreach (get_object_vars($line) as $property => $value)
2021 2021
 			{
2022
-				if(empty($originline->{ $property }))
2022
+				if (empty($originline->{ $property }))
2023 2023
 				{
2024 2024
 					$originline->{ $property } = $value;
2025 2025
 				}
@@ -2027,13 +2027,13 @@  discard block
 block discarded – undo
2027 2027
 
2028 2028
 			$line = $originline;
2029 2029
 		}
2030
- 		if($object->element=='facture')$idvar = 'facid';
2031
-        else $idvar='id';
2032
-		if($line->special_code!=$this->module_number || $line->product_type!=9) {
2033
-			if ($object->statut == 0  && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_LINE) && $object->element !== 'invoice_supplier')
2030
+ 		if ($object->element == 'facture')$idvar = 'facid';
2031
+        else $idvar = 'id';
2032
+		if ($line->special_code != $this->module_number || $line->product_type != 9) {
2033
+			if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_LINE) && $object->element !== 'invoice_supplier')
2034 2034
             {
2035
-                if(!(TSubtotal::isModSubtotalLine($line)) && ( $line->fk_prev_id === null ) && !($action == "editline" && GETPOST('lineid') == $line->id)) {
2036
-                    echo '<a name="duplicate-'.$line->id.'" href="' . $_SERVER['PHP_SELF'] . '?' . $idvar . '=' . $object->id . '&action=duplicate&lineid=' . $line->id . '"><i class="fa fa-clone" aria-hidden="true"></i></a>';
2035
+                if (!(TSubtotal::isModSubtotalLine($line)) && ($line->fk_prev_id === null) && !($action == "editline" && GETPOST('lineid') == $line->id)) {
2036
+                    echo '<a name="duplicate-'.$line->id.'" href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=duplicate&lineid='.$line->id.'"><i class="fa fa-clone" aria-hidden="true"></i></a>';
2037 2037
 
2038 2038
                     ?>
2039 2039
                         <script type="text/javascript">
@@ -2047,11 +2047,11 @@  discard block
 block discarded – undo
2047 2047
             }
2048 2048
 			return 0;
2049 2049
 		}
2050
-		else if (in_array('invoicecard',$contexts) || in_array('invoicesuppliercard',$contexts) || in_array('propalcard',$contexts) || in_array('supplier_proposalcard',$contexts) || in_array('ordercard',$contexts) || in_array('ordersuppliercard',$contexts) || in_array('invoicereccard',$contexts)) 
2050
+		else if (in_array('invoicecard', $contexts) || in_array('invoicesuppliercard', $contexts) || in_array('propalcard', $contexts) || in_array('supplier_proposalcard', $contexts) || in_array('ordercard', $contexts) || in_array('ordersuppliercard', $contexts) || in_array('invoicereccard', $contexts)) 
2051 2051
         {
2052 2052
 
2053 2053
 
2054
-			if((float)DOL_VERSION <= 3.4)
2054
+			if ((float) DOL_VERSION <= 3.4)
2055 2055
 			{
2056 2056
 				?>
2057 2057
 				<script type="text/javascript">
@@ -2075,22 +2075,22 @@  discard block
 block discarded – undo
2075 2075
 				<?php
2076 2076
 			}
2077 2077
 			
2078
-			if(empty($line->description)) $line->description = $line->desc;
2078
+			if (empty($line->description)) $line->description = $line->desc;
2079 2079
 			
2080 2080
 			$colspan = 5;
2081
-			if($object->element == 'facturerec' ) $colspan = 3;
2082
-			if($object->element == 'order_supplier') (float) DOL_VERSION < 7.0 ? $colspan = 3 : $colspan = 6;
2083
-			if($object->element == 'invoice_supplier') (float) DOL_VERSION < 7.0 ? $colspan = 4: $colspan = 7;
2084
-			if($object->element == 'supplier_proposal') (float) DOL_VERSION < 6.0 ? $colspan = 4 : $colspan = 3;
2085
-			if(!empty($conf->multicurrency->enabled) && ((float) DOL_VERSION < 8.0 || $object->multicurrency_code != $conf->currency)) {
2081
+			if ($object->element == 'facturerec') $colspan = 3;
2082
+			if ($object->element == 'order_supplier') (float) DOL_VERSION < 7.0 ? $colspan = 3 : $colspan = 6;
2083
+			if ($object->element == 'invoice_supplier') (float) DOL_VERSION < 7.0 ? $colspan = 4 : $colspan = 7;
2084
+			if ($object->element == 'supplier_proposal') (float) DOL_VERSION < 6.0 ? $colspan = 4 : $colspan = 3;
2085
+			if (!empty($conf->multicurrency->enabled) && ((float) DOL_VERSION < 8.0 || $object->multicurrency_code != $conf->currency)) {
2086 2086
 				$colspan++; // Colonne PU Devise
2087 2087
 			}
2088
-			if($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) $colspan++;
2089
-			if(!empty($conf->margin->enabled)) $colspan++;
2090
-			if(!empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++;
2091
-			if(!empty($conf->global->DISPLAY_MARK_RATES)) $colspan++;
2092
-			if($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) $colspan++;
2093
-			if(!empty($conf->global->PRODUCT_USE_UNITS)) $colspan++;
2088
+			if ($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) $colspan++;
2089
+			if (!empty($conf->margin->enabled)) $colspan++;
2090
+			if (!empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++;
2091
+			if (!empty($conf->global->DISPLAY_MARK_RATES)) $colspan++;
2092
+			if ($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) $colspan++;
2093
+			if (!empty($conf->global->PRODUCT_USE_UNITS)) $colspan++;
2094 2094
 					
2095 2095
 			/* Titre */
2096 2096
 			//var_dump($line);
@@ -2100,39 +2100,39 @@  discard block
 block discarded – undo
2100 2100
             
2101 2101
 			
2102 2102
 			?>
2103
-			<tr <?php echo $bc[$var]; $var=!$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php
2103
+			<tr <?php echo $bc[$var]; $var = !$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php
2104 2104
 					if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT))
2105 2105
 					{
2106
-						if($line->qty==99) print 'background:#adadcf';
2107
-						else if($line->qty==98) print 'background:#ddddff;';
2108
-						else if($line->qty<=97 && $line->qty>=91) print 'background:#eeeeff;';
2109
-						else if($line->qty==1) print 'background:#adadcf;';
2110
-						else if($line->qty==2) print 'background:#ddddff;';
2111
-						else if($line->qty==50) print '';
2106
+						if ($line->qty == 99) print 'background:#adadcf';
2107
+						else if ($line->qty == 98) print 'background:#ddddff;';
2108
+						else if ($line->qty <= 97 && $line->qty >= 91) print 'background:#eeeeff;';
2109
+						else if ($line->qty == 1) print 'background:#adadcf;';
2110
+						else if ($line->qty == 2) print 'background:#ddddff;';
2111
+						else if ($line->qty == 50) print '';
2112 2112
 						else print 'background:#eeeeff;';
2113 2113
 
2114 2114
 						//A compléter si on veux plus de nuances de couleurs avec les niveau 4,5,6,7,8 et 9
2115 2115
 					}
2116 2116
 					else 
2117 2117
 					{
2118
-						if($line->qty==99) print 'background:#ddffdd';
2119
-						else if($line->qty==98) print 'background:#ddddff;';
2120
-						else if($line->qty==2) print 'background:#eeeeff; ';
2121
-						else if($line->qty==50) print '';
2122
-						else print 'background:#eeffee;' ;
2118
+						if ($line->qty == 99) print 'background:#ddffdd';
2119
+						else if ($line->qty == 98) print 'background:#ddddff;';
2120
+						else if ($line->qty == 2) print 'background:#eeeeff; ';
2121
+						else if ($line->qty == 50) print '';
2122
+						else print 'background:#eeffee;';
2123 2123
 					}
2124 2124
 
2125 2125
 			?>;">
2126 2126
 
2127
-				<?php if(! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?>
2127
+				<?php if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?>
2128 2128
 				<td class="linecolnum"><?php echo $i + 1; ?></td>
2129 2129
 				<?php } ?>
2130 2130
 
2131
-				<td colspan="<?php echo $colspan; ?>" style="<?php TSubtotal::isFreeText($line) ? '' : 'font-weight:bold;'; ?>  <?php echo ($line->qty>90)?'text-align:right':'' ?> "><?php
2132
-					if($action=='editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line) ) {
2131
+				<td colspan="<?php echo $colspan; ?>" style="<?php TSubtotal::isFreeText($line) ? '' : 'font-weight:bold;'; ?>  <?php echo ($line->qty > 90) ? 'text-align:right' : '' ?> "><?php
2132
+					if ($action == 'editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line)) {
2133 2133
 
2134
-						$params=array('line'=>$line);
2135
-						$reshook=$hookmanager->executeHooks('formEditProductOptions',$params,$object,$action);
2134
+						$params = array('line'=>$line);
2135
+						$reshook = $hookmanager->executeHooks('formEditProductOptions', $params, $object, $action);
2136 2136
 						
2137 2137
 						echo '<div id="line_'.$line->id.'"></div>'; // Imitation Dolibarr
2138 2138
 						echo '<input type="hidden" value="'.$line->id.'" name="lineid">';
@@ -2140,7 +2140,7 @@  discard block
 block discarded – undo
2140 2140
 						echo '<input id="product_id" type="hidden" value="'.$line->fk_product.'" name="type">';
2141 2141
 						echo '<input id="special_code" type="hidden" value="'.$line->special_code.'" name="type">';
2142 2142
 
2143
-						$isFreeText=false;
2143
+						$isFreeText = false;
2144 2144
 						if (TSubtotal::isTitle($line))
2145 2145
 						{
2146 2146
 							$qty_displayed = $line->qty;
@@ -2162,13 +2162,13 @@  discard block
 block discarded – undo
2162 2162
 						    $line->description = '';
2163 2163
 						}
2164 2164
 						$newlabel = $line->label;
2165
-						if($line->label=='' && !$isFreeText) {
2166
-							if(TSubtotal::isSubtotal($line)) {
2165
+						if ($line->label == '' && !$isFreeText) {
2166
+							if (TSubtotal::isSubtotal($line)) {
2167 2167
 								$newlabel = $line->description.' '.$this->getTitle($object, $line);
2168
-								$line->description='';
2169
-							} elseif( (float)DOL_VERSION < 6 ) {
2170
-								$newlabel= $line->description;
2171
-								$line->description='';
2168
+								$line->description = '';
2169
+							} elseif ((float) DOL_VERSION < 6) {
2170
+								$newlabel = $line->description;
2171
+								$line->description = '';
2172 2172
 							}
2173 2173
 						}
2174 2174
 
@@ -2177,10 +2177,10 @@  discard block
 block discarded – undo
2177 2177
 						
2178 2178
 						if (!$isFreeText) echo '<input type="text" name="line-title" id-line="'.$line->id.'" value="'.$newlabel.'" size="80" '.$readonlyForSituation.'/>&nbsp;';
2179 2179
 						
2180
-						if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT) && (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) )
2180
+						if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT) && (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)))
2181 2181
 						{
2182 2182
 							$select = '<select name="subtotal_level">';
2183
-							for ($j=1; $j<10; $j++)
2183
+							for ($j = 1; $j < 10; $j++)
2184 2184
 							{
2185 2185
 								if (!empty($readonlyForSituation)) {
2186 2186
 									if ($qty_displayed == $j) $select .= '<option selected="selected" value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>';
@@ -2194,7 +2194,7 @@  discard block
 block discarded – undo
2194 2194
 
2195 2195
 						echo '<div class="subtotal_underline" style="margin-left:24px; line-height: 25px;">';
2196 2196
                         echo '<div>';
2197
-                        echo '<input style="vertical-align:sub;"  type="checkbox" name="line-pagebreak" id="subtotal-pagebreak" value="8" '.(($line->info_bits > 0) ? 'checked="checked"' : '') .' />&nbsp;';
2197
+                        echo '<input style="vertical-align:sub;"  type="checkbox" name="line-pagebreak" id="subtotal-pagebreak" value="8" '.(($line->info_bits > 0) ? 'checked="checked"' : '').' />&nbsp;';
2198 2198
                         echo '<label for="subtotal-pagebreak">'.$langs->trans('AddBreakPageBefore').'</label>';
2199 2199
                         echo '</div>';
2200 2200
 
@@ -2215,21 +2215,21 @@  discard block
 block discarded – undo
2215 2215
                                 echo '</div>';
2216 2216
                             }
2217 2217
                             echo '<div>';
2218
-                            echo '<input style="vertical-align:sub;"  type="checkbox" name="line-showTotalHT" id="subtotal-showTotalHT" value="9" '.(($line->array_options['options_show_total_ht'] > 0) ? 'checked="checked"' : '') .' />&nbsp;';
2218
+                            echo '<input style="vertical-align:sub;"  type="checkbox" name="line-showTotalHT" id="subtotal-showTotalHT" value="9" '.(($line->array_options['options_show_total_ht'] > 0) ? 'checked="checked"' : '').' />&nbsp;';
2219 2219
                             echo '<label for="subtotal-showTotalHT">'.$langs->trans('ShowTotalHTOnSubtotalBlock').'</label>';
2220 2220
                             echo '</div>';
2221 2221
 
2222 2222
                             echo '<div>';
2223
-                            echo '<input style="vertical-align:sub;"  type="checkbox" name="line-showReduc" id="subtotal-showReduc" value="1" '.(($line->array_options['options_show_reduc'] > 0) ? 'checked="checked"' : '') .' />&nbsp;';
2223
+                            echo '<input style="vertical-align:sub;"  type="checkbox" name="line-showReduc" id="subtotal-showReduc" value="1" '.(($line->array_options['options_show_reduc'] > 0) ? 'checked="checked"' : '').' />&nbsp;';
2224 2224
                             echo '<label for="subtotal-showReduc">'.$langs->trans('ShowReducOnSubtotalBlock').'</label>';
2225 2225
                             echo '</div>';
2226 2226
                         }
2227 2227
                         else if ($isFreeText) echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation);
2228 2228
 						echo '</div>';
2229 2229
 
2230
-						if($line->qty<10) {
2230
+						if ($line->qty < 10) {
2231 2231
 							// WYSIWYG editor
2232
-							require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
2232
+							require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
2233 2233
 							$nbrows = ROWS_2;
2234 2234
 							$cked_enabled = (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS) ? $conf->global->FCKEDITOR_ENABLE_DETAILS : 0);
2235 2235
 							if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) {
@@ -2249,25 +2249,25 @@  discard block
 block discarded – undo
2249 2249
 
2250 2250
 						 if ($conf->global->SUBTOTAL_USE_NEW_FORMAT)
2251 2251
 						 {
2252
-							if(TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) 
2252
+							if (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) 
2253 2253
 							{
2254
-								echo str_repeat('&nbsp;&nbsp;&nbsp;', $line->qty-1);
2254
+								echo str_repeat('&nbsp;&nbsp;&nbsp;', $line->qty - 1);
2255 2255
 								
2256 2256
 								if (TSubtotal::isTitle($line)) print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span>&nbsp;&nbsp;';
2257
-								else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span>&nbsp;&nbsp;';
2257
+								else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100 - $line->qty).'</span>&nbsp;&nbsp;';
2258 2258
 							}
2259 2259
 						 }
2260 2260
 						 else 
2261 2261
 						 {
2262
-							if($line->qty<=1) print img_picto('', 'subtotal@subtotal');
2263
-							else if($line->qty==2) print img_picto('', 'subsubtotal@subtotal').'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'; 
2262
+							if ($line->qty <= 1) print img_picto('', 'subtotal@subtotal');
2263
+							else if ($line->qty == 2) print img_picto('', 'subsubtotal@subtotal').'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'; 
2264 2264
 						 }
2265 2265
 						 
2266 2266
 						 
2267 2267
 						 // Get display styles and apply them
2268 2268
 						 $titleStyleItalic = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'I') === false ? '' : ' font-style: italic;';
2269
-						 $titleStyleBold =  strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'B') === false ? '' : ' font-weight:bold;';
2270
-						 $titleStyleUnderline =  strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;';
2269
+						 $titleStyleBold = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'B') === false ? '' : ' font-weight:bold;';
2270
+						 $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;';
2271 2271
 						 
2272 2272
 						 if (empty($line->label)) {
2273 2273
 							if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) print  $line->description.' '.$this->getTitle($object, $line);
@@ -2275,16 +2275,16 @@  discard block
 block discarded – undo
2275 2275
 						 } 
2276 2276
 						 else {
2277 2277
 
2278
-							if (! empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) {
2278
+							if (!empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) {
2279 2279
 								print '<span class="subtotal_label" style="'.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" >'.$line->label.'</span><br><div class="subtotal_desc">'.dol_htmlentitiesbr($line->description).'</div>';
2280 2280
 							}
2281
-							else{
2281
+							else {
2282 2282
 								print '<span class="subtotal_label classfortooltip '.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" title="'.$line->description.'">'.$line->label.'</span>';    
2283 2283
 							}
2284 2284
 
2285 2285
 						 } 
2286
-						if($line->qty>90) print ' : ';
2287
-						if($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal');
2286
+						if ($line->qty > 90) print ' : ';
2287
+						if ($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal');
2288 2288
 
2289 2289
 						 
2290 2290
 
@@ -2293,7 +2293,7 @@  discard block
 block discarded – undo
2293 2293
 			?></td>
2294 2294
 					 
2295 2295
 			<?php
2296
-				if($line->qty>90) {
2296
+				if ($line->qty > 90) {
2297 2297
 					/* Total */
2298 2298
 					$total_line = $this->getTotalLineFromObject($object, $line, '');
2299 2299
 					echo '<td class="linecolht nowrap" align="right" style="font-weight:bold;" rel="subtotal_total">'.price($total_line).'</td>';
@@ -2312,7 +2312,7 @@  discard block
 block discarded – undo
2312 2312
 				<?php
2313 2313
 				if ($action != 'selectlines') {
2314 2314
 				
2315
-					if($action=='editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line) ) {
2315
+					if ($action == 'editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line)) {
2316 2316
 						?>
2317 2317
 						<input id="savelinebutton" class="button" type="submit" name="save" value="<?php echo $langs->trans('Save') ?>" />
2318 2318
 						<br />
@@ -2328,13 +2328,13 @@  discard block
 block discarded – undo
2328 2328
 						<?php
2329 2329
 						
2330 2330
 					}
2331
-					else{
2332
-						if ($object->statut == 0  && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK) && $object->element !== 'invoice_supplier')
2331
+					else {
2332
+						if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK) && $object->element !== 'invoice_supplier')
2333 2333
 						{
2334
-							if(TSubtotal::isTitle($line) && ( $line->fk_prev_id === null )) echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=duplicate&lineid='.$line->id.'">'. img_picto($langs->trans('Duplicate'), 'duplicate@subtotal').'</a>';
2334
+							if (TSubtotal::isTitle($line) && ($line->fk_prev_id === null)) echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=duplicate&lineid='.$line->id.'">'.img_picto($langs->trans('Duplicate'), 'duplicate@subtotal').'</a>';
2335 2335
 						}
2336 2336
 
2337
-						if ($object->statut == 0  && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_EDIT_BLOCK)) 
2337
+						if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_EDIT_BLOCK)) 
2338 2338
 						{
2339 2339
 							echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=editline&lineid='.$line->id.'">'.img_edit().'</a>';
2340 2340
 						}								
@@ -2349,7 +2349,7 @@  discard block
 block discarded – undo
2349 2349
 				<?php
2350 2350
 
2351 2351
 				if ($action != 'editline' && $action != 'selectlines') {
2352
-						if ($object->statut == 0  && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK))
2352
+						if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK))
2353 2353
 						{
2354 2354
 
2355 2355
 							if ($line->fk_prev_id === null)
@@ -2357,12 +2357,12 @@  discard block
 block discarded – undo
2357 2357
 								echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=ask_deleteline&lineid='.$line->id.'">'.img_delete().'</a>';
2358 2358
 							}
2359 2359
 
2360
-							if(TSubtotal::isTitle($line) && ($line->fk_prev_id === null) )
2360
+							if (TSubtotal::isTitle($line) && ($line->fk_prev_id === null))
2361 2361
 							{
2362 2362
 								if ((float) DOL_VERSION >= 8.0) {
2363 2363
 									$img_delete = img_delete($langs->trans('deleteWithAllLines'), ' class="pictodelete pictodeleteallline"');
2364 2364
 								} elseif ((float) DOL_VERSION >= 3.8) {
2365
-									$img_delete = img_picto($langs->trans('deleteWithAllLines'), 'delete_all.3.8@subtotal',' class="pictodelete" ');
2365
+									$img_delete = img_picto($langs->trans('deleteWithAllLines'), 'delete_all.3.8@subtotal', ' class="pictodelete" ');
2366 2366
 								} else {
2367 2367
 									$img_delete = img_picto($langs->trans('deleteWithAllLines'), 'delete_all@subtotal');
2368 2368
 								}
@@ -2372,7 +2372,7 @@  discard block
 block discarded – undo
2372 2372
 								/* Depuis la 8.0, les icônes "standard" utilisent FontAwesome et sont préconfigurées selon la clé de l'image
2373 2373
 								 * Impossible d'en customiser par exemple la couleur, même en utilisant img_picto() directement
2374 2374
 								 */
2375
-								if((float) DOL_VERSION >= 8.0) {
2375
+								if ((float) DOL_VERSION >= 8.0) {
2376 2376
 								?>
2377 2377
 								<script>
2378 2378
 									$(document).ready(function () {
@@ -2388,7 +2388,7 @@  discard block
 block discarded – undo
2388 2388
 			</td>
2389 2389
 			
2390 2390
 			<?php 
2391
-			if ($object->statut == 0  && $createRight && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && TSubtotal::isTitle($line) && $action != 'editline')
2391
+			if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && TSubtotal::isTitle($line) && $action != 'editline')
2392 2392
 			{
2393 2393
 				echo '<td class="subtotal_nc">';
2394 2394
 				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"' : '').' />';
@@ -2399,12 +2399,12 @@  discard block
 block discarded – undo
2399 2399
 			<td align="center" class="linecolmove tdlineupdown">
2400 2400
 			</td>
2401 2401
 			<?php } else { ?>
2402
-			<td align="center"<?php echo ((empty($conf->browser->phone) && ($object->statut == 0  && $createRight ))?' class="tdlineupdown"':''); ?>></td>
2402
+			<td align="center"<?php echo ((empty($conf->browser->phone) && ($object->statut == 0 && $createRight)) ? ' class="tdlineupdown"' : ''); ?>></td>
2403 2403
 			<?php } ?>
2404 2404
 
2405 2405
 
2406
-			<?php  if($action == 'selectlines'){ // dolibarr 8 ?>
2407
-			<td class="linecolcheck" align="center"><input type="checkbox" class="linecheckbox" name="line_checkbox[<?php echo $i+1; ?>]" value="<?php echo $line->id; ?>" ></td>
2406
+			<?php  if ($action == 'selectlines') { // dolibarr 8 ?>
2407
+			<td class="linecolcheck" align="center"><input type="checkbox" class="linecheckbox" name="line_checkbox[<?php echo $i + 1; ?>]" value="<?php echo $line->id; ?>" ></td>
2408 2408
 			<?php } ?>
2409 2409
 
2410 2410
 			</tr>
@@ -2412,29 +2412,29 @@  discard block
 block discarded – undo
2412 2412
 			
2413 2413
 			
2414 2414
 			// Affichage des extrafields à la Dolibarr (car sinon non affiché sur les titres)
2415
-			if(TSubtotal::isTitle($line) && !empty($conf->global->SUBTOTAL_ALLOW_EXTRAFIELDS_ON_TITLE)) {
2415
+			if (TSubtotal::isTitle($line) && !empty($conf->global->SUBTOTAL_ALLOW_EXTRAFIELDS_ON_TITLE)) {
2416 2416
 				
2417
-				require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
2417
+				require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
2418 2418
 				
2419 2419
 				// Extrafields
2420 2420
 				$extrafieldsline = new ExtraFields($db);
2421 2421
 				$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
2422 2422
 				
2423
-				$colspan+=3; $mode = 'view';
2424
-				if($action === 'editline' && $line->rowid == GETPOST('lineid')) $mode = 'edit';
2423
+				$colspan += 3; $mode = 'view';
2424
+				if ($action === 'editline' && $line->rowid == GETPOST('lineid')) $mode = 'edit';
2425 2425
 				
2426 2426
 				$ex_element = $line->element;
2427 2427
 				$line->element = 'tr_extrafield_title '.$line->element; // Pour pouvoir manipuler ces tr
2428
-				print $line->showOptionals($extrafieldsline, $mode, array('style'=>' style="background:#eeffee;" ','colspan'=>$colspan));
2428
+				print $line->showOptionals($extrafieldsline, $mode, array('style'=>' style="background:#eeffee;" ', 'colspan'=>$colspan));
2429 2429
 				$isExtraSelected = false;
2430
-				foreach($line->array_options as $option) {
2431
-					if(!empty($option) && $option != "-1") {
2430
+				foreach ($line->array_options as $option) {
2431
+					if (!empty($option) && $option != "-1") {
2432 2432
 						$isExtraSelected = true;
2433 2433
 						break;
2434 2434
 					}
2435 2435
 				}
2436 2436
 				
2437
-				if($mode === 'edit') {
2437
+				if ($mode === 'edit') {
2438 2438
 					?>
2439 2439
 					<script>
2440 2440
 						$(document).ready(function(){
@@ -2442,7 +2442,7 @@  discard block
 block discarded – undo
2442 2442
 							var all_tr_extrafields = $("tr.tr_extrafield_title");
2443 2443
 							<?php 
2444 2444
 							// Si un extrafield est rempli alors on affiche directement les extrafields
2445
-							if(!$isExtraSelected) {
2445
+							if (!$isExtraSelected) {
2446 2446
 								echo 'all_tr_extrafields.hide();';
2447 2447
 								echo 'var trad = "'.$langs->trans('showExtrafields').'";';
2448 2448
 								echo 'var extra = 0;';
@@ -2481,61 +2481,61 @@  discard block
 block discarded – undo
2481 2481
 			return 1;	
2482 2482
 			
2483 2483
 		}
2484
-		elseif(($object->element == 'commande' && in_array('ordershipmentcard', $contexts)) || (in_array('expeditioncard', $contexts) && $action == 'create'))
2484
+		elseif (($object->element == 'commande' && in_array('ordershipmentcard', $contexts)) || (in_array('expeditioncard', $contexts) && $action == 'create'))
2485 2485
 		{
2486 2486
 			$colspan = 4;
2487 2487
 
2488 2488
 			// HTML 5 data for js
2489 2489
 			$data = $this->_getHtmlData($parameters, $object, $action, $hookmanager);
2490 2490
 ?>
2491
-			<tr <?php echo $bc[$var]; $var=!$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php
2491
+			<tr <?php echo $bc[$var]; $var = !$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php
2492 2492
 					if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT))
2493 2493
 					{
2494
-						if($line->qty==99) print 'background:#adadcf';
2495
-						else if($line->qty==98) print 'background:#ddddff;';
2496
-						else if($line->qty<=97 && $line->qty>=91) print 'background:#eeeeff;';
2497
-						else if($line->qty==1) print 'background:#adadcf;';
2498
-						else if($line->qty==2) print 'background:#ddddff;';
2499
-						else if($line->qty==50) print '';
2494
+						if ($line->qty == 99) print 'background:#adadcf';
2495
+						else if ($line->qty == 98) print 'background:#ddddff;';
2496
+						else if ($line->qty <= 97 && $line->qty >= 91) print 'background:#eeeeff;';
2497
+						else if ($line->qty == 1) print 'background:#adadcf;';
2498
+						else if ($line->qty == 2) print 'background:#ddddff;';
2499
+						else if ($line->qty == 50) print '';
2500 2500
 						else print 'background:#eeeeff;';
2501 2501
 
2502 2502
 						//A compléter si on veux plus de nuances de couleurs avec les niveau 4,5,6,7,8 et 9
2503 2503
 					}
2504 2504
 					else
2505 2505
 					{
2506
-						if($line->qty==99) print 'background:#ddffdd';
2507
-						else if($line->qty==98) print 'background:#ddddff;';
2508
-						else if($line->qty==2) print 'background:#eeeeff; ';
2509
-						else if($line->qty==50) print '';
2510
-						else print 'background:#eeffee;' ;
2506
+						if ($line->qty == 99) print 'background:#ddffdd';
2507
+						else if ($line->qty == 98) print 'background:#ddddff;';
2508
+						else if ($line->qty == 2) print 'background:#eeeeff; ';
2509
+						else if ($line->qty == 50) print '';
2510
+						else print 'background:#eeffee;';
2511 2511
 					}
2512 2512
 
2513 2513
 			?>;">
2514 2514
 
2515
-				<td style="<?php TSubtotal::isFreeText($line) ? '' : 'font-weight:bold;'; ?>  <?php echo ($line->qty>90)?'text-align:right':'' ?> "><?php
2515
+				<td style="<?php TSubtotal::isFreeText($line) ? '' : 'font-weight:bold;'; ?>  <?php echo ($line->qty > 90) ? 'text-align:right' : '' ?> "><?php
2516 2516
 
2517 2517
 
2518 2518
 						 if ($conf->global->SUBTOTAL_USE_NEW_FORMAT)
2519 2519
 						 {
2520
-							if(TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line))
2520
+							if (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line))
2521 2521
 							{
2522
-								echo str_repeat('&nbsp;&nbsp;&nbsp;', $line->qty-1);
2522
+								echo str_repeat('&nbsp;&nbsp;&nbsp;', $line->qty - 1);
2523 2523
 
2524 2524
 								if (TSubtotal::isTitle($line)) print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span>&nbsp;&nbsp;';
2525
-								else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span>&nbsp;&nbsp;';
2525
+								else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100 - $line->qty).'</span>&nbsp;&nbsp;';
2526 2526
 							}
2527 2527
 						 }
2528 2528
 						 else
2529 2529
 						 {
2530
-							if($line->qty<=1) print img_picto('', 'subtotal@subtotal');
2531
-							else if($line->qty==2) print img_picto('', 'subsubtotal@subtotal').'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
2530
+							if ($line->qty <= 1) print img_picto('', 'subtotal@subtotal');
2531
+							else if ($line->qty == 2) print img_picto('', 'subsubtotal@subtotal').'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
2532 2532
 						 }
2533 2533
 
2534 2534
 
2535 2535
 						 // Get display styles and apply them
2536 2536
 						 $titleStyleItalic = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'I') === false ? '' : ' font-style: italic;';
2537
-						 $titleStyleBold =  strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'B') === false ? '' : ' font-weight:bold;';
2538
-						 $titleStyleUnderline =  strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;';
2537
+						 $titleStyleBold = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'B') === false ? '' : ' font-weight:bold;';
2538
+						 $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;';
2539 2539
 
2540 2540
 						 if (empty($line->label)) {
2541 2541
 							if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) print  $line->description.' '.$this->getTitle($object, $line);
@@ -2543,22 +2543,22 @@  discard block
 block discarded – undo
2543 2543
 						 }
2544 2544
 						 else {
2545 2545
 
2546
-							if (! empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) {
2546
+							if (!empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) {
2547 2547
 								print '<span class="subtotal_label" style="'.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" >'.$line->label.'</span><br><div class="subtotal_desc">'.dol_htmlentitiesbr($line->description).'</div>';
2548 2548
 							}
2549
-							else{
2549
+							else {
2550 2550
 								print '<span class="subtotal_label classfortooltip '.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" title="'.$line->description.'">'.$line->label.'</span>';
2551 2551
 							}
2552 2552
 
2553 2553
 						 }
2554 2554
 						//if($line->qty>90) print ' : ';
2555
-						if($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal');
2555
+						if ($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal');
2556 2556
 
2557 2557
 			?>
2558 2558
 				</td>
2559 2559
 				 <td colspan="<?php echo $colspan; ?>">
2560 2560
 <?php
2561
-						if(in_array('expeditioncard', $contexts) && $action == 'create')
2561
+						if (in_array('expeditioncard', $contexts) && $action == 'create')
2562 2562
 						{
2563 2563
 							$fk_entrepot = GETPOST('entrepot_id', 'int');
2564 2564
 ?>
@@ -2585,100 +2585,100 @@  discard block
 block discarded – undo
2585 2585
 			$shipment_static = new Expedition($db);
2586 2586
 			$warehousestatic = new Entrepot($db);
2587 2587
 			$extrafieldsline = new ExtraFields($db);
2588
-			$extralabelslines=$extrafieldsline->fetch_name_optionals_label($object->table_element_line);
2588
+			$extralabelslines = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
2589 2589
 
2590 2590
 			$colspan = 4;
2591
-			if($object->origin && $object->origin_id > 0) $colspan++;
2592
-			if(! empty($conf->stock->enabled)) $colspan++;
2593
-			if(! empty($conf->productbatch->enabled)) $colspan++;
2594
-			if($object->statut == 0) $colspan++;
2595
-			if($object->statut == 0 && empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK)) $colspan++;
2591
+			if ($object->origin && $object->origin_id > 0) $colspan++;
2592
+			if (!empty($conf->stock->enabled)) $colspan++;
2593
+			if (!empty($conf->productbatch->enabled)) $colspan++;
2594
+			if ($object->statut == 0) $colspan++;
2595
+			if ($object->statut == 0 && empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK)) $colspan++;
2596 2596
 
2597
-			if($object->element == 'delivery') $colspan = 2;
2597
+			if ($object->element == 'delivery') $colspan = 2;
2598 2598
 
2599 2599
 			print '<!-- origin line id = '.$line->origin_line_id.' -->'; // id of order line
2600 2600
 
2601 2601
 			// HTML 5 data for js
2602 2602
 			$data = $this->_getHtmlData($parameters, $object, $action, $hookmanager);
2603 2603
 			?>
2604
-			<tr <?php echo $bc[$var]; $var=!$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php
2604
+			<tr <?php echo $bc[$var]; $var = !$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php
2605 2605
 					if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT))
2606 2606
 					{
2607
-						if($line->qty==99) print 'background:#adadcf';
2608
-						else if($line->qty==98) print 'background:#ddddff;';
2609
-						else if($line->qty<=97 && $line->qty>=91) print 'background:#eeeeff;';
2610
-						else if($line->qty==1) print 'background:#adadcf;';
2611
-						else if($line->qty==2) print 'background:#ddddff;';
2612
-						else if($line->qty==50) print '';
2607
+						if ($line->qty == 99) print 'background:#adadcf';
2608
+						else if ($line->qty == 98) print 'background:#ddddff;';
2609
+						else if ($line->qty <= 97 && $line->qty >= 91) print 'background:#eeeeff;';
2610
+						else if ($line->qty == 1) print 'background:#adadcf;';
2611
+						else if ($line->qty == 2) print 'background:#ddddff;';
2612
+						else if ($line->qty == 50) print '';
2613 2613
 						else print 'background:#eeeeff;';
2614 2614
 
2615 2615
 						//A compléter si on veux plus de nuances de couleurs avec les niveau 4,5,6,7,8 et 9
2616 2616
 					}
2617 2617
 					else 
2618 2618
 					{
2619
-						if($line->qty==99) print 'background:#ddffdd';
2620
-						else if($line->qty==98) print 'background:#ddddff;';
2621
-						else if($line->qty==2) print 'background:#eeeeff; ';
2622
-						else if($line->qty==50) print '';
2623
-						else print 'background:#eeffee;' ;
2619
+						if ($line->qty == 99) print 'background:#ddffdd';
2620
+						else if ($line->qty == 98) print 'background:#ddddff;';
2621
+						else if ($line->qty == 2) print 'background:#eeeeff; ';
2622
+						else if ($line->qty == 50) print '';
2623
+						else print 'background:#eeffee;';
2624 2624
 					}
2625 2625
 
2626 2626
 			?>;">
2627 2627
 
2628 2628
 			<?php
2629 2629
 			// #
2630
-			if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER))
2630
+			if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER))
2631 2631
 			{
2632
-				print '<td align="center">'.($i+1).'</td>';
2632
+				print '<td align="center">'.($i + 1).'</td>';
2633 2633
 			}
2634 2634
 			?>
2635 2635
 
2636
-			<td style="<?php TSubtotal::isFreeText($line) ? '' : 'font-weight:bold;'; ?>  <?php echo ($line->qty>90)?'text-align:right':'' ?> "><?php
2636
+			<td style="<?php TSubtotal::isFreeText($line) ? '' : 'font-weight:bold;'; ?>  <?php echo ($line->qty > 90) ? 'text-align:right' : '' ?> "><?php
2637 2637
 
2638 2638
 
2639 2639
 			if ($conf->global->SUBTOTAL_USE_NEW_FORMAT)
2640 2640
 			{
2641
-				if(TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line))
2641
+				if (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line))
2642 2642
 				{
2643
-					echo str_repeat('&nbsp;&nbsp;&nbsp;', $line->qty-1);
2643
+					echo str_repeat('&nbsp;&nbsp;&nbsp;', $line->qty - 1);
2644 2644
 
2645 2645
 					if (TSubtotal::isTitle($line)) print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span>&nbsp;&nbsp;';
2646
-					else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span>&nbsp;&nbsp;';
2646
+					else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100 - $line->qty).'</span>&nbsp;&nbsp;';
2647 2647
 				}
2648 2648
 			}
2649 2649
 			else
2650 2650
 			{
2651
-				if($line->qty<=1) print img_picto('', 'subtotal@subtotal');
2652
-				else if($line->qty==2) print img_picto('', 'subsubtotal@subtotal').'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
2651
+				if ($line->qty <= 1) print img_picto('', 'subtotal@subtotal');
2652
+				else if ($line->qty == 2) print img_picto('', 'subsubtotal@subtotal').'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
2653 2653
 			}
2654 2654
 
2655 2655
 
2656 2656
 			// Get display styles and apply them
2657 2657
 			$titleStyleItalic = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'I') === false ? '' : ' font-style: italic;';
2658
-			$titleStyleBold =  strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'B') === false ? '' : ' font-weight:bold;';
2659
-			$titleStyleUnderline =  strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;';
2658
+			$titleStyleBold = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'B') === false ? '' : ' font-weight:bold;';
2659
+			$titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;';
2660 2660
 
2661 2661
 			if (empty($line->label)) {
2662 2662
 				if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) print  $line->description.' '.$this->getTitle($object, $line);
2663 2663
 				else print  $line->description;
2664 2664
 			}
2665 2665
 			else {
2666
-				if (! empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) {
2666
+				if (!empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) {
2667 2667
 					print '<span class="subtotal_label" style="'.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" >'.$line->label.'</span><br><div class="subtotal_desc">'.dol_htmlentitiesbr($line->description).'</div>';
2668 2668
 				}
2669
-				else{
2669
+				else {
2670 2670
 					print '<span class="subtotal_label classfortooltip '.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" title="'.$line->description.'">'.$line->label.'</span>';
2671 2671
 				}
2672 2672
 			}
2673 2673
 			//if($line->qty>90) print ' : ';
2674
-			if($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal');
2674
+			if ($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal');
2675 2675
 
2676 2676
 			?>
2677 2677
 				</td>
2678 2678
 				<td colspan="<?php echo $colspan; ?>">&nbsp;</td>
2679 2679
 			<?php
2680 2680
 
2681
-			if ($object->element == 'shipping' && $object->statut == 0 && ! empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK))
2681
+			if ($object->element == 'shipping' && $object->statut == 0 && !empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK))
2682 2682
 			{
2683 2683
 				print '<td class="linecoldelete nowrap" width="10">';
2684 2684
 
@@ -2687,12 +2687,12 @@  discard block
 block discarded – undo
2687 2687
 					echo '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=deleteline&amp;lineid='.$line->id.'">'.img_delete().'</a>';
2688 2688
 				}
2689 2689
 
2690
-				if(TSubtotal::isTitle($line) && ($line->fk_prev_id === null) )
2690
+				if (TSubtotal::isTitle($line) && ($line->fk_prev_id === null))
2691 2691
 				{
2692 2692
 					if ((float) DOL_VERSION >= 8.0) {
2693 2693
 						$img_delete = img_delete($langs->trans('deleteWithAllLines'), ' class="pictodelete pictodeleteallline"');
2694 2694
 					} elseif ((float) DOL_VERSION >= 3.8) {
2695
-						$img_delete = img_picto($langs->trans('deleteWithAllLines'), 'delete_all.3.8@subtotal',' class="pictodelete" ');
2695
+						$img_delete = img_picto($langs->trans('deleteWithAllLines'), 'delete_all.3.8@subtotal', ' class="pictodelete" ');
2696 2696
 					} else {
2697 2697
 						$img_delete = img_picto($langs->trans('deleteWithAllLines'), 'delete_all@subtotal');
2698 2698
 					}
@@ -2702,7 +2702,7 @@  discard block
 block discarded – undo
2702 2702
 					/* Depuis la 8.0, les icônes "standard" utilisent FontAwesome et sont préconfigurées selon la clé de l'image
2703 2703
 					 * Impossible d'en customiser par exemple la couleur, même en utilisant img_picto() directement
2704 2704
 					 */
2705
-					if((float) DOL_VERSION >= 8.0) {
2705
+					if ((float) DOL_VERSION >= 8.0) {
2706 2706
 						?>
2707 2707
 							<script>
2708 2708
 								$(document).ready(function () {
@@ -2720,11 +2720,11 @@  discard block
 block discarded – undo
2720 2720
 			print "</tr>";
2721 2721
 
2722 2722
 			// Display lines extrafields
2723
-			if ($object->element == 'shipping' && ! empty($conf->global->SUBTOTAL_ALLOW_EXTRAFIELDS_ON_TITLE) && is_array($extralabelslines) && count($extralabelslines)>0) {
2723
+			if ($object->element == 'shipping' && !empty($conf->global->SUBTOTAL_ALLOW_EXTRAFIELDS_ON_TITLE) && is_array($extralabelslines) && count($extralabelslines) > 0) {
2724 2724
 				$line = new ExpeditionLigne($db);
2725 2725
 				$line->fetch_optionals($line->id);
2726 2726
 				print '<tr class="oddeven">';
2727
-				print $line->showOptionals($extrafieldsline, 'view', array('style'=>$bc[$var], 'colspan'=>$colspan),$i);
2727
+				print $line->showOptionals($extrafieldsline, 'view', array('style'=>$bc[$var], 'colspan'=>$colspan), $i);
2728 2728
 			}
2729 2729
 
2730 2730
 			return 1;
@@ -2736,20 +2736,20 @@  discard block
 block discarded – undo
2736 2736
 
2737 2737
 	
2738 2738
 	function addMoreActionsButtons($parameters, &$object, &$action, $hookmanager) {
2739
-		global $conf,$langs;
2739
+		global $conf, $langs;
2740 2740
 		 
2741 2741
 		if ($object->statut == 0 && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && $action != 'editline')
2742 2742
 		{
2743 2743
 		    
2744
-		    if($object->element == 'invoice_supplier' || $object->element == 'order_supplier')
2744
+		    if ($object->element == 'invoice_supplier' || $object->element == 'order_supplier')
2745 2745
 		    {
2746 2746
 		        foreach ($object->lines as $line)
2747 2747
 		        {
2748 2748
 		            // fetch optionals attributes and labels
2749 2749
 		            require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
2750
-		            $extrafields=new ExtraFields($this->db);
2751
-		            $extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true);
2752
-		            $line->fetch_optionals($line->id,$extralabels);
2750
+		            $extrafields = new ExtraFields($this->db);
2751
+		            $extralabels = $extrafields->fetch_name_optionals_label($object->table_element_line, true);
2752
+		            $line->fetch_optionals($line->id, $extralabels);
2753 2753
 		        }
2754 2754
 		    }
2755 2755
 		    
@@ -2849,23 +2849,23 @@  discard block
 block discarded – undo
2849 2849
 	    $ThtmlData['data-qty']          = 0; //$line->qty;
2850 2850
 	    $ThtmlData['data-level']        = TSubtotal::getNiveau($line);
2851 2851
 	    
2852
-	    if(TSubtotal::isTitle($line)){
2852
+	    if (TSubtotal::isTitle($line)) {
2853 2853
 	        $ThtmlData['data-issubtotal'] = 'title';
2854
-	    }elseif(TSubtotal::isSubtotal($line)){
2854
+	    }elseif (TSubtotal::isSubtotal($line)) {
2855 2855
 	        $ThtmlData['data-issubtotal'] = 'subtotal';
2856 2856
 	    }
2857
-	    else{
2857
+	    else {
2858 2858
 	        $ThtmlData['data-issubtotal'] = 'freetext';
2859 2859
 	    }
2860 2860
 	    
2861 2861
 	    
2862 2862
 	    // Change or add data  from hooks
2863
-	    $parameters = array_replace($parameters , array(  'ThtmlData' => $ThtmlData )  );
2863
+	    $parameters = array_replace($parameters, array('ThtmlData' => $ThtmlData));
2864 2864
 	    
2865 2865
 	    // hook 
2866
-	    $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
2866
+	    $reshook = $hookmanager->executeHooks('subtotalLineHtmlData', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
2867 2867
 	    if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
2868
-	    if ($reshook>0)
2868
+	    if ($reshook > 0)
2869 2869
 	    {
2870 2870
 	        $ThtmlData = $hookmanager->resArray;
2871 2871
 	    }
@@ -2878,14 +2878,14 @@  discard block
 block discarded – undo
2878 2878
 	function implodeHtmlData($ThtmlData = array())
2879 2879
 	{
2880 2880
 	    $data = '';
2881
-	    foreach($ThtmlData as $k => $h )
2881
+	    foreach ($ThtmlData as $k => $h)
2882 2882
 	    {
2883
-	        if(is_array($h))
2883
+	        if (is_array($h))
2884 2884
 	        {
2885 2885
 	            $h = json_encode($h);
2886 2886
 	        }
2887 2887
 	        
2888
-	        $data .= $k . '="'.dol_htmlentities($h, ENT_QUOTES).'" ';
2888
+	        $data .= $k.'="'.dol_htmlentities($h, ENT_QUOTES).'" ';
2889 2889
 	    }
2890 2890
 	    
2891 2891
 	    return $data;
@@ -2893,26 +2893,26 @@  discard block
 block discarded – undo
2893 2893
 	
2894 2894
 	function _ajax_block_order_js($object)
2895 2895
 	{
2896
-	    global $conf,$tagidfortablednd,$filepath,$langs;
2896
+	    global $conf, $tagidfortablednd, $filepath, $langs;
2897 2897
 	    
2898 2898
 	    /*
2899 2899
 	     * this part of js is base on dolibarr htdocs/core/tpl/ajaxrow.tpl.php 
2900 2900
 	     * for compatibility reasons we don't use tableDnD but jquery sortable
2901 2901
 	     */
2902 2902
 	    
2903
-	    $id=$object->id;
2904
-	    $nboflines=(isset($object->lines)?count($object->lines):0);
2905
-	    $forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1;
2903
+	    $id = $object->id;
2904
+	    $nboflines = (isset($object->lines) ?count($object->lines) : 0);
2905
+	    $forcereloadpage = empty($conf->global->MAIN_FORCE_RELOAD_PAGE) ? 0 : 1;
2906 2906
 	    
2907
-	    $id=$object->id;
2908
-	    $fk_element=$object->fk_element;
2909
-	    $table_element_line=$object->table_element_line;
2910
-	    $nboflines=(isset($object->lines)?count($object->lines):(empty($nboflines)?0:$nboflines));
2911
-	    $tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd);
2912
-	    $filepath=(empty($filepath)?'':$filepath);
2907
+	    $id = $object->id;
2908
+	    $fk_element = $object->fk_element;
2909
+	    $table_element_line = $object->table_element_line;
2910
+	    $nboflines = (isset($object->lines) ?count($object->lines) : (empty($nboflines) ? 0 : $nboflines));
2911
+	    $tagidfortablednd = (empty($tagidfortablednd) ? 'tablelines' : $tagidfortablednd);
2912
+	    $filepath = (empty($filepath) ? '' : $filepath);
2913 2913
 	    
2914 2914
 	    
2915
-	    if (GETPOST('action','aZ09') != 'editline' && $nboflines > 1)
2915
+	    if (GETPOST('action', 'aZ09') != 'editline' && $nboflines > 1)
2916 2916
 	    {
2917 2917
 	        
2918 2918
 	        ?>
@@ -2930,7 +2930,7 @@  discard block
 block discarded – undo
2930 2930
 				moveBlockCol.disableSelection(); // prevent selection
2931 2931
 <?php if ($object->statut == 0) { ?>
2932 2932
 				// apply some graphical stuff
2933
-				moveBlockCol.css("background-image",'url(<?php echo dol_buildpath('subtotal/img/grip_all.png',2);  ?>)');
2933
+				moveBlockCol.css("background-image",'url(<?php echo dol_buildpath('subtotal/img/grip_all.png', 2); ?>)');
2934 2934
 				moveBlockCol.css("background-repeat","no-repeat");
2935 2935
 				moveBlockCol.css("background-position","center center");
2936 2936
 				moveBlockCol.css("cursor","move");
Please login to merge, or discard this patch.
Braces   +527 added lines, -314 removed lines patch added patch discarded remove patch
@@ -45,7 +45,9 @@  discard block
 block discarded – undo
45 45
 				$value = '';
46 46
 				$sql = 'SELECT content FROM '.MAIN_DB_PREFIX.'c_subtotal_free_text WHERE rowid = '.GETPOST('rowid');
47 47
 				$resql = $this->db->query($sql);
48
-				if ($resql && ($obj = $this->db->fetch_object($resql))) $value = $obj->content;
48
+				if ($resql && ($obj = $this->db->fetch_object($resql))) {
49
+					$value = $obj->content;
50
+				}
49 51
 			}
50 52
 			
51 53
 			?>
@@ -124,8 +126,7 @@  discard block
 block discarded – undo
124 126
 			} elseif($object->element == 'invoice_supplier' )
125 127
 			{
126 128
 			    $createRight = $user->rights->fournisseur->facture->creer;
127
-			}
128
-			elseif($object->element == 'shipping')
129
+			} elseif($object->element == 'shipping')
129 130
 			{
130 131
 				$createRight = true; // No rights management for shipments
131 132
 			}
@@ -133,8 +134,11 @@  discard block
 block discarded – undo
133 134
 			if ($object->statut == 0  && $createRight) {
134 135
 			
135 136
 
136
-				if($object->element=='facture')$idvar = 'facid';
137
-				else $idvar='id';
137
+				if($object->element=='facture') {
138
+					$idvar = 'facid';
139
+				} else {
140
+					$idvar='id';
141
+				}
138 142
 				
139 143
 				if(in_array($action, array('add_title_line', 'add_total_line', 'add_subtitle_line', 'add_subtotal_line', 'add_free_text')) )
140 144
 				{
@@ -142,10 +146,11 @@  discard block
 block discarded – undo
142 146
 					
143 147
 					if($action=='add_title_line') {
144 148
 						$title = GETPOST('title');
145
-						if(empty($title)) $title = $langs->trans('title');
149
+						if(empty($title)) {
150
+							$title = $langs->trans('title');
151
+						}
146 152
 						$qty = $level<1 ? 1 : $level ;
147
-					}
148
-					else if($action=='add_free_text') {
153
+					} else if($action=='add_free_text') {
149 154
 						$title = GETPOST('title');
150 155
 
151 156
 						if (empty($title)) {
@@ -157,29 +162,31 @@  discard block
 block discarded – undo
157 162
 								}
158 163
 							}
159 164
 						}
160
-						if(empty($title)) $title = $langs->trans('subtotalAddLineDescription');
165
+						if(empty($title)) {
166
+							$title = $langs->trans('subtotalAddLineDescription');
167
+						}
161 168
 						$qty = 50;
162
-					}
163
-					else if($action=='add_subtitle_line') {
169
+					} else if($action=='add_subtitle_line') {
164 170
 						$title = GETPOST('title');
165
-						if(empty($title)) $title = $langs->trans('subtitle');
171
+						if(empty($title)) {
172
+							$title = $langs->trans('subtitle');
173
+						}
166 174
 						$qty = 2;
167
-					}
168
-					else if($action=='add_subtotal_line') {
175
+					} else if($action=='add_subtotal_line') {
169 176
 						$title = $langs->trans('SubSubTotal');
170 177
 						$qty = 98;
171
-					}
172
-					else {
178
+					} else {
173 179
 						$title = GETPOST('title') ? GETPOST('title') : $langs->trans('SubTotal');
174 180
 						$qty = $level ? 100-$level : 99;
175 181
 					}
176 182
 					dol_include_once('/subtotal/class/subtotal.class.php');
177 183
 					
178
-					if (!empty($conf->global->SUBTOTAL_AUTO_ADD_SUBTOTAL_ON_ADDING_NEW_TITLE) && $qty < 10) TSubtotal::addSubtotalMissing($object, $qty);
184
+					if (!empty($conf->global->SUBTOTAL_AUTO_ADD_SUBTOTAL_ON_ADDING_NEW_TITLE) && $qty < 10) {
185
+						TSubtotal::addSubtotalMissing($object, $qty);
186
+					}
179 187
 					
180 188
 	    			TSubtotal::addSubTotalLine($object, $title, $qty);
181
-				}
182
-				else if($action==='ask_deleteallline') {
189
+				} else if($action==='ask_deleteallline') {
183 190
 						$form=new Form($db);
184 191
 
185 192
 						$lineid = GETPOST('lineid','integer');
@@ -202,8 +209,7 @@  discard block
 block discarded – undo
202 209
 					$this->printNewFormat($object, $conf, $langs, $idvar);
203 210
 				}
204 211
 			}
205
-		}
206
-		elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice',$contexts))
212
+		} elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice',$contexts))
207 213
 		{
208 214
 			?>
209 215
 			<script type="text/javascript">
@@ -221,8 +227,13 @@  discard block
 block discarded – undo
221 227
      
222 228
 	function printNewFormat(&$object, &$conf, &$langs, $idvar)
223 229
 	{
224
-		if (empty($conf->global->SUBTOTAL_ALLOW_ADD_BLOCK)) return false;
225
-		if ($line->fk_prev_id != null && !empty($line->fk_prev_id)) return false; // Si facture de situation
230
+		if (empty($conf->global->SUBTOTAL_ALLOW_ADD_BLOCK)) {
231
+			return false;
232
+		}
233
+		if ($line->fk_prev_id != null && !empty($line->fk_prev_id)) {
234
+			return false;
235
+		}
236
+		// Si facture de situation
226 237
 		?>
227 238
 		 	<script type="text/javascript">
228 239
 				$(document).ready(function() {
@@ -515,8 +526,7 @@  discard block
 block discarded – undo
515 526
 				}
516 527
 				
517 528
 				
518
-			}	
519
-			else{
529
+			} else{
520 530
 				$substitutionarray['line_not_modsubtotal'] = true;
521 531
 				$substitutionarray['line_modsubtotal'] = 0;
522 532
 			}
@@ -574,8 +584,11 @@  discard block
 block discarded – undo
574 584
 		
575 585
 		$showBlockExtrafields = GETPOST('showBlockExtrafields');
576 586
 		
577
-		if($object->element=='facture') $idvar = 'facid';
578
-		else $idvar = 'id';
587
+		if($object->element=='facture') {
588
+			$idvar = 'facid';
589
+		} else {
590
+			$idvar = 'id';
591
+		}
579 592
 			
580 593
 		if ($action == 'updateligne' || $action == 'updateline')
581 594
 		{
@@ -605,8 +618,7 @@  discard block
 block discarded – undo
605 618
 				header('Location: '.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id);
606 619
 				exit; // Surtout ne pas laisser Dolibarr faire du traitement sur le updateligne sinon ça plante les données de la ligne
607 620
 			}
608
-		}
609
-		else if($action === 'builddoc') {
621
+		} else if($action === 'builddoc') {
610 622
 			
611 623
 			if (
612 624
 				in_array('invoicecard',explode(':',$parameters['context']))
@@ -621,33 +633,27 @@  discard block
 block discarded – undo
621 633
 					$sessname = 'subtotal_hideInnerLines_facture';	
622 634
 					$sessname2 = 'subtotal_hidedetails_facture';
623 635
 					$sessname3 = 'subtotal_hideprices_facture';
624
-				}
625
-				elseif(in_array('invoicesuppliercard',explode(':',$parameters['context']))) {
636
+				} elseif(in_array('invoicesuppliercard',explode(':',$parameters['context']))) {
626 637
 				    $sessname = 'subtotal_hideInnerLines_facture_fournisseur';
627 638
 				    $sessname2 = 'subtotal_hidedetails_facture_fournisseur';
628 639
 				    $sessname3 = 'subtotal_hideprices_facture_fournisseur';
629
-				}
630
-				elseif(in_array('propalcard',explode(':',$parameters['context']))) {
640
+				} elseif(in_array('propalcard',explode(':',$parameters['context']))) {
631 641
 					$sessname = 'subtotal_hideInnerLines_propal';
632 642
 					$sessname2 = 'subtotal_hidedetails_propal';	
633 643
 					$sessname3 = 'subtotal_hideprices_propal';
634
-				}
635
-				elseif(in_array('supplier_proposalcard',explode(':',$parameters['context']))) {
644
+				} elseif(in_array('supplier_proposalcard',explode(':',$parameters['context']))) {
636 645
 				    $sessname = 'subtotal_hideInnerLines_supplier_proposal';
637 646
 				    $sessname2 = 'subtotal_hidedetails_supplier_proposal';
638 647
 				    $sessname3 = 'subtotal_hideprices_supplier_proposal';
639
-				}
640
-				elseif(in_array('ordercard',explode(':',$parameters['context']))) {
648
+				} elseif(in_array('ordercard',explode(':',$parameters['context']))) {
641 649
 					$sessname = 'subtotal_hideInnerLines_commande';
642 650
 					$sessname2 = 'subtotal_hidedetails_commande';	
643 651
 					$sessname3 = 'subtotal_hideprices_commande';
644
-				}
645
-				elseif(in_array('ordersuppliercard',explode(':',$parameters['context']))) {
652
+				} elseif(in_array('ordersuppliercard',explode(':',$parameters['context']))) {
646 653
 				    $sessname = 'subtotal_hideInnerLines_commande_fournisseur';
647 654
 				    $sessname2 = 'subtotal_hidedetails_commande_fournisseur';
648 655
 				    $sessname3 = 'subtotal_hideprices_commande_fournisseur';
649
-				}
650
-				else {
656
+				} else {
651 657
 					$sessname = 'subtotal_hideInnerLines_unknown';
652 658
 					$sessname2 = 'subtotal_hidedetails_unknown';
653 659
 					$sessname3 = 'subtotal_hideprices_unknown';
@@ -656,15 +662,24 @@  discard block
 block discarded – undo
656 662
 				global $hideprices;
657 663
 				
658 664
 				$hideInnerLines = (int)GETPOST('hideInnerLines');
659
-				if(!empty($_SESSION[$sessname]) && !is_array($_SESSION[$sessname][$object->id]) ) $_SESSION[$sessname] = array(); // prevent old system
665
+				if(!empty($_SESSION[$sessname]) && !is_array($_SESSION[$sessname][$object->id]) ) {
666
+					$_SESSION[$sessname] = array();
667
+				}
668
+				// prevent old system
660 669
 				$_SESSION[$sessname][$object->id] = $hideInnerLines;		
661 670
 				
662 671
 				$hidedetails= (int)GETPOST('hidedetails');
663
-				if(!empty($_SESSION[$sessname2]) && !is_array($_SESSION[$sessname2][$object->id]) ) $_SESSION[$sessname2] = array(); // prevent old system
672
+				if(!empty($_SESSION[$sessname2]) && !is_array($_SESSION[$sessname2][$object->id]) ) {
673
+					$_SESSION[$sessname2] = array();
674
+				}
675
+				// prevent old system
664 676
 				$_SESSION[$sessname2][$object->id] = $hidedetails;
665 677
 				
666 678
 				$hideprices= (int)GETPOST('hideprices');
667
-				if(!empty($_SESSION[$sessname3]) && !is_array($_SESSION[$sessname3][$object->id]) ) $_SESSION[$sessname3] = array(); // prevent old system
679
+				if(!empty($_SESSION[$sessname3]) && !is_array($_SESSION[$sessname3][$object->id]) ) {
680
+					$_SESSION[$sessname3] = array();
681
+				}
682
+				// prevent old system
668 683
 				$_SESSION[$sessname3][$object->id] = $hideprices;
669 684
 				
670 685
 				foreach($object->lines as &$line) {
@@ -672,8 +687,7 @@  discard block
 block discarded – undo
672 687
 					    
673 688
                         if($line->qty>=90) {
674 689
                             $line->modsubtotal_total = 1;
675
-                        }
676
-                        else{
690
+                        } else{
677 691
                             $line->modsubtotal_title = 1;
678 692
                         }
679 693
                         
@@ -682,8 +696,7 @@  discard block
 block discarded – undo
682 696
 	        	}
683 697
 	        }
684 698
 			
685
-		}
686
-		else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') {
699
+		} else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') {
687 700
 			
688 701
 			$Tab = $this->getArrayOfLineForAGroup($object, GETPOST('lineid'));
689 702
 			
@@ -691,7 +704,9 @@  discard block
 block discarded – undo
691 704
 				/**
692 705
 				 * @var $object Facture
693 706
 				 */
694
-				if($object->element=='facture') $object->deleteline($idLine);
707
+				if($object->element=='facture') {
708
+					$object->deleteline($idLine);
709
+				}
695 710
 				/**
696 711
 				 * @var $object Facture fournisseur
697 712
 				 */
@@ -702,18 +717,25 @@  discard block
 block discarded – undo
702 717
 				/**
703 718
 				 * @var $object Propal
704 719
 				 */
705
-				else if($object->element=='propal') $object->deleteline($idLine);
720
+				else if($object->element=='propal') {
721
+					$object->deleteline($idLine);
722
+				}
706 723
 				/**
707 724
 				 * @var $object Propal Fournisseur
708 725
 				 */
709
-				else if($object->element=='supplier_proposal') $object->deleteline($idLine);
726
+				else if($object->element=='supplier_proposal') {
727
+					$object->deleteline($idLine);
728
+				}
710 729
 				/**
711 730
 				 * @var $object Commande
712 731
 				 */
713 732
 				else if($object->element=='commande') 
714 733
 				{
715
-					if ((float) DOL_VERSION >= 5.0) $object->deleteline($user, $idLine);
716
-					else $object->deleteline($idLine);
734
+					if ((float) DOL_VERSION >= 5.0) {
735
+						$object->deleteline($user, $idLine);
736
+					} else {
737
+						$object->deleteline($idLine);
738
+					}
717 739
 				}
718 740
 				/**
719 741
 				 * @var $object Commande fournisseur
@@ -725,25 +747,32 @@  discard block
 block discarded – undo
725 747
 				/**
726 748
 				 * @var $object Facturerec
727 749
 				 */
728
-				else if($object->element=='facturerec') $object->deleteline($idLine);
750
+				else if($object->element=='facturerec') {
751
+					$object->deleteline($idLine);
752
+				}
729 753
 				/**
730 754
 				 * @var $object Expedition
731 755
 				 */
732
-				else if($object->element=='shipping') $object->deleteline($user, $idLine);
756
+				else if($object->element=='shipping') {
757
+					$object->deleteline($user, $idLine);
758
+				}
733 759
 			}
734 760
 			
735 761
 			header('location:?id='.$object->id);
736 762
 			exit;
737 763
 			
738
-		}
739
-		else if ($action == 'duplicate')
764
+		} else if ($action == 'duplicate')
740 765
 		{
741 766
 			$lineid = GETPOST('lineid', 'int');
742 767
 			$nbDuplicate = TSubtotal::duplicateLines($object, $lineid, true);
743 768
 			
744
-			if ($nbDuplicate > 0) setEventMessage($langs->trans('subtotal_duplicate_success', $nbDuplicate));
745
-			elseif ($nbDuplicate == 0) setEventMessage($langs->trans('subtotal_duplicate_lineid_not_found'), 'warnings');
746
-			else setEventMessage($langs->trans('subtotal_duplicate_error'), 'errors');
769
+			if ($nbDuplicate > 0) {
770
+				setEventMessage($langs->trans('subtotal_duplicate_success', $nbDuplicate));
771
+			} elseif ($nbDuplicate == 0) {
772
+				setEventMessage($langs->trans('subtotal_duplicate_lineid_not_found'), 'warnings');
773
+			} else {
774
+				setEventMessage($langs->trans('subtotal_duplicate_error'), 'errors');
775
+			}
747 776
 			
748 777
 			header('Location: ?id='.$object->id);
749 778
 			exit;
@@ -761,21 +790,26 @@  discard block
 block discarded – undo
761 790
 		global $conf;
762 791
 		if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && !empty($object->table_element_line) && in_array($object->element, array('commande', 'facture', 'propal')))
763 792
 		{
764
-			if ($object->element == 'commande')
765
-				$obj = new OrderLine($object->db);
766
-			if ($object->element == 'propal')
767
-				$obj = new PropaleLigne($object->db);
768
-			if ($object->element == 'facture')
769
-				$obj = new FactureLigne($object->db);
793
+			if ($object->element == 'commande') {
794
+							$obj = new OrderLine($object->db);
795
+			}
796
+			if ($object->element == 'propal') {
797
+							$obj = new PropaleLigne($object->db);
798
+			}
799
+			if ($object->element == 'facture') {
800
+							$obj = new FactureLigne($object->db);
801
+			}
770 802
 			if (!empty($parameters['fk_element']))
771 803
 			{
772 804
 				
773 805
 				if($obj->fetch($parameters['fk_element'])){
774 806
 					$obj->id= $obj->rowid;
775
-					if (empty($obj->array_options))
776
-						$obj->fetch_optionals();
777
-					if (!empty($obj->array_options['options_subtotal_nc']))
778
-						return 1;
807
+					if (empty($obj->array_options)) {
808
+											$obj->fetch_optionals();
809
+					}
810
+					if (!empty($obj->array_options['options_subtotal_nc'])) {
811
+											return 1;
812
+					}
779 813
 				}
780 814
 			}
781 815
 		}
@@ -847,27 +881,33 @@  discard block
 block discarded – undo
847 881
 		$TTotal_tva = array();
848 882
 		
849 883
 		$sign=1;
850
-		if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1;
884
+		if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) {
885
+			$sign=-1;
886
+		}
851 887
 		
852
-		if (GETPOST('action') == 'builddoc') $builddoc = true;
853
-		else $builddoc = false;
888
+		if (GETPOST('action') == 'builddoc') {
889
+			$builddoc = true;
890
+		} else {
891
+			$builddoc = false;
892
+		}
854 893
 		
855 894
 		dol_include_once('/subtotal/class/subtotal.class.php');
856 895
 		foreach($object->lines as $l) {
857 896
 			//print $l->rang.'>='.$rang.' '.$total.'<br/>';
858 897
 			if($l->rang>=$rang) {
859 898
 				//echo 'return!<br>';
860
-				if (!$return_all) return $total;
861
-				else return array($total, $total_tva, $total_ttc, $TTotal_tva);
862
-			}
863
-			else if(TSubtotal::isTitle($l, 100 - $qty_line)) 
899
+				if (!$return_all) {
900
+					return $total;
901
+				} else {
902
+					return array($total, $total_tva, $total_ttc, $TTotal_tva);
903
+				}
904
+			} else if(TSubtotal::isTitle($l, 100 - $qty_line)) 
864 905
 		  	{
865 906
 				$total = 0;
866 907
 				$total_tva = 0;
867 908
 				$total_ttc = 0;
868 909
 				$TTotal_tva = array();
869
-			}
870
-			elseif(!TSubtotal::isTitle($l) && !TSubtotal::isSubtotal($l)) {
910
+			} elseif(!TSubtotal::isTitle($l) && !TSubtotal::isSubtotal($l)) {
871 911
 				
872 912
 				// TODO retirer le test avec $builddoc quand Dolibarr affichera le total progression sur la card et pas seulement dans le PDF
873 913
 				if ($builddoc && $object->element == 'facture' && $object->type==Facture::TYPE_SITUATION)
@@ -889,8 +929,7 @@  discard block
 block discarded – undo
889 929
 						$TTotal_tva[$l->tva_tx] += $sign * ($l->total_tva / ($l->situation_percent / 100)) * $progress;
890 930
 						$total_ttc += $sign * ($l->total_tva / ($l->total_ttc / 100)) * $progress;
891 931
 					}
892
-				}
893
-				else
932
+				} else
894 933
 				{
895 934
 					$total += $l->total_ht;
896 935
 					$total_tva += $l->total_tva;
@@ -900,8 +939,11 @@  discard block
 block discarded – undo
900 939
 			}
901 940
 			
902 941
 		}
903
-		if (!$return_all) return $total;
904
-		else return array($total, $total_tva, $total_ttc, $TTotal_tva);
942
+		if (!$return_all) {
943
+			return $total;
944
+		} else {
945
+			return array($total, $total_tva, $total_ttc, $TTotal_tva);
946
+		}
905 947
 	}
906 948
 
907 949
 	/**
@@ -948,15 +990,18 @@  discard block
 block discarded – undo
948 990
 		}
949 991
 		
950 992
 			
951
-		if($line->qty==99)
952
-			$pdf->SetFillColor(220,220,220);
953
-		elseif ($line->qty==98)
954
-			$pdf->SetFillColor(230,230,230);
955
-		else
956
-			$pdf->SetFillColor(240,240,240);
993
+		if($line->qty==99) {
994
+					$pdf->SetFillColor(220,220,220);
995
+		} elseif ($line->qty==98) {
996
+					$pdf->SetFillColor(230,230,230);
997
+		} else {
998
+					$pdf->SetFillColor(240,240,240);
999
+		}
957 1000
 		
958 1001
 		$style = 'B';
959
-		if (!empty($conf->global->SUBTOTAL_SUBTOTAL_STYLE)) $style = $conf->global->SUBTOTAL_SUBTOTAL_STYLE;
1002
+		if (!empty($conf->global->SUBTOTAL_SUBTOTAL_STYLE)) {
1003
+			$style = $conf->global->SUBTOTAL_SUBTOTAL_STYLE;
1004
+		}
960 1005
 		
961 1006
 		$pdf->SetFont('', $style, 9);
962 1007
 		
@@ -998,8 +1043,7 @@  discard block
 block discarded – undo
998 1043
 //					$line->total_tva
999 1044
 //					$line->total
1000 1045
 //					$line->total_ttc
1001
-				}
1002
-				else
1046
+				} else
1003 1047
 				{
1004 1048
 					//					list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1);
1005 1049
 					
@@ -1009,17 +1053,22 @@  discard block
 block discarded – undo
1009 1053
 
1010 1054
                     $line->total_ht = $TInfo[0];
1011 1055
 					$line->total = $TInfo[0];
1012
-					if (!TSubtotal::isModSubtotalLine($line)) $line->total_tva = $TInfo[1];
1056
+					if (!TSubtotal::isModSubtotalLine($line)) {
1057
+						$line->total_tva = $TInfo[1];
1058
+					}
1013 1059
 					$line->total_ttc = $TInfo[2];
1014 1060
 				}
1015 1061
 			}
1016 1062
 
1017 1063
 			$pdf->SetXY($pdf->postotalht, $posy);
1018
-			if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin);
1064
+			if($set_pagebreak_margin) {
1065
+				$pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin);
1066
+			}
1019 1067
 			$pdf->MultiCell($pdf->page_largeur-$pdf->marge_droite-$pdf->postotalht, 3, $total_to_print, 0, 'R', 0);
1020
-		}
1021
-		else{
1022
-			if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin);
1068
+		} else{
1069
+			if($set_pagebreak_margin) {
1070
+				$pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin);
1071
+			}
1023 1072
 		}
1024 1073
 		
1025 1074
 		$posy = $posy + $cell_height;
@@ -1051,25 +1100,40 @@  discard block
 block discarded – undo
1051 1100
 		
1052 1101
  
1053 1102
 		$style = ($line->qty==1) ? 'BU' : 'BUI';
1054
-		if (!empty($conf->global->SUBTOTAL_TITLE_STYLE)) $style = $conf->global->SUBTOTAL_TITLE_STYLE;
1103
+		if (!empty($conf->global->SUBTOTAL_TITLE_STYLE)) {
1104
+			$style = $conf->global->SUBTOTAL_TITLE_STYLE;
1105
+		}
1055 1106
 		
1056 1107
 		if($hideInnerLines) {
1057
-			if($line->qty==1)$pdf->SetFont('', $style, 9);
1058
-			else 
1108
+			if($line->qty==1) {
1109
+				$pdf->SetFont('', $style, 9);
1110
+			} else 
1059 1111
 			{
1060
-				if (!empty($conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES)) $style = $conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES;
1112
+				if (!empty($conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES)) {
1113
+					$style = $conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES;
1114
+				}
1061 1115
 				$pdf->SetFont('', $style, 9);
1062 1116
 			}
1063
-		}
1064
-		else {
1117
+		} else {
1065 1118
 
1066
-			if($line->qty==1)$pdf->SetFont('', $style, 9); //TODO if super utile
1067
-			else $pdf->SetFont('', $style, 9);
1119
+			if($line->qty==1) {
1120
+				$pdf->SetFont('', $style, 9);
1121
+			}
1122
+			//TODO if super utile
1123
+			else {
1124
+				$pdf->SetFont('', $style, 9);
1125
+			}
1068 1126
 			
1069 1127
 		}
1070 1128
 		
1071
-		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
1072
-		else $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J',true); // et maintenant avec du HTML
1129
+		if ($label === strip_tags($label) && $label === dol_html_entity_decode($label, ENT_QUOTES)) {
1130
+			$pdf->MultiCell($w, $h, $label, 0, 'L');
1131
+		}
1132
+		// Pas de HTML dans la chaine
1133
+		else {
1134
+			$pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J',true);
1135
+		}
1136
+		// et maintenant avec du HTML
1073 1137
 		
1074 1138
 		if($description && !$hidedesc) {
1075 1139
 			$posy = $pdf->GetY();
@@ -1093,8 +1157,7 @@  discard block
 block discarded – undo
1093 1157
 		
1094 1158
 		if(is_array($parameters)) {
1095 1159
 			$i = & $parameters['i'];	
1096
-		}
1097
-		else {
1160
+		} else {
1098 1161
 			$i = (int)$parameters;
1099 1162
 		}
1100 1163
 
@@ -1124,17 +1187,14 @@  discard block
 block discarded – undo
1124 1187
 			
1125 1188
 			if((float)DOL_VERSION<=3.6) {
1126 1189
 				return '';
1127
-			}
1128
-			else if((float)DOL_VERSION>=3.8) {
1190
+			} else if((float)DOL_VERSION>=3.8) {
1129 1191
 				return 1;
1130 1192
 			}
1131 1193
 			
1132
-		}
1133
-		elseif(!empty($hideprices)) {
1194
+		} elseif(!empty($hideprices)) {
1134 1195
 			$this->resprints = $object->lines[$parameters['i']]->qty;
1135 1196
 			return 1;
1136
-		}
1137
-		elseif (!empty($conf->global->SUBTOTAL_IF_HIDE_PRICES_SHOW_QTY))
1197
+		} elseif (!empty($conf->global->SUBTOTAL_IF_HIDE_PRICES_SHOW_QTY))
1138 1198
 		{
1139 1199
 			$hideInnerLines = (int)GETPOST('hideInnerLines');
1140 1200
 			$hidedetails = (int)GETPOST('hidedetails');
@@ -1144,12 +1204,20 @@  discard block
 block discarded – undo
1144 1204
 			}
1145 1205
 		}
1146 1206
 		
1147
-		if(is_array($parameters)) $i = & $parameters['i'];
1148
-		else $i = (int)$parameters;
1207
+		if(is_array($parameters)) {
1208
+			$i = & $parameters['i'];
1209
+		} else {
1210
+			$i = (int)$parameters;
1211
+		}
1149 1212
 
1150
-		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)
1213
+		if (empty($object->lines[$i])) {
1214
+			return 0;
1215
+		}
1216
+		// 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)
1151 1217
 		
1152
-		if(empty($object->lines[$i]->array_options)) $object->lines[$i]->fetch_optionals();
1218
+		if(empty($object->lines[$i]->array_options)) {
1219
+			$object->lines[$i]->fetch_optionals();
1220
+		}
1153 1221
 
1154 1222
 		if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) )
1155 1223
 		{
@@ -1166,8 +1234,11 @@  discard block
 block discarded – undo
1166 1234
 	function pdf_getlinetotalexcltax($parameters=array(), &$object, &$action='') {
1167 1235
 	    global $conf, $hideprices, $hookmanager;
1168 1236
 		
1169
-		if(is_array($parameters)) $i = & $parameters['i'];
1170
-		else $i = (int)$parameters;
1237
+		if(is_array($parameters)) {
1238
+			$i = & $parameters['i'];
1239
+		} else {
1240
+			$i = (int)$parameters;
1241
+		}
1171 1242
 			
1172 1243
 		if($this->isModSubtotalLine($parameters,$object) ){
1173 1244
 			
@@ -1175,13 +1246,11 @@  discard block
 block discarded – undo
1175 1246
 			
1176 1247
 			if((float)DOL_VERSION<=3.6) {
1177 1248
 				return '';
1178
-			}
1179
-			else if((float)DOL_VERSION>=3.8) {
1249
+			} else if((float)DOL_VERSION>=3.8) {
1180 1250
 				return 1;
1181 1251
 			}
1182 1252
 			
1183
-		}
1184
-		elseif (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS))
1253
+		} elseif (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS))
1185 1254
 		{
1186 1255
 			if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC)))
1187 1256
 			{
@@ -1253,12 +1322,10 @@  discard block
 block discarded – undo
1253 1322
 			$this->error = $hookmanager->error;
1254 1323
 			$this->errors = $hookmanager->errors;
1255 1324
 			return -1;
1256
-		}
1257
-		elseif (empty($reshook))
1325
+		} elseif (empty($reshook))
1258 1326
 		{
1259 1327
 			$this->resprints .= $hookmanager->resprints;
1260
-		}
1261
-		else
1328
+		} else
1262 1329
 		{
1263 1330
 			$this->resprints = $hookmanager->resprints;
1264 1331
 
@@ -1281,14 +1348,16 @@  discard block
 block discarded – undo
1281 1348
 		
1282 1349
 			if((float)DOL_VERSION<=3.6) {
1283 1350
 				return '';
1284
-			}
1285
-			else if((float)DOL_VERSION>=3.8) {
1351
+			} else if((float)DOL_VERSION>=3.8) {
1286 1352
 				return 1;
1287 1353
 			}
1288 1354
 		}
1289 1355
 		
1290
-		if(is_array($parameters)) $i = & $parameters['i'];
1291
-		else $i = (int)$parameters;
1356
+		if(is_array($parameters)) {
1357
+			$i = & $parameters['i'];
1358
+		} else {
1359
+			$i = (int)$parameters;
1360
+		}
1292 1361
 		
1293 1362
 		if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) 
1294 1363
 		{
@@ -1310,14 +1379,16 @@  discard block
 block discarded – undo
1310 1379
 		
1311 1380
 			if((float)DOL_VERSION<=3.6) {
1312 1381
 				return '';
1313
-			}
1314
-			else if((float)DOL_VERSION>=3.8) {
1382
+			} else if((float)DOL_VERSION>=3.8) {
1315 1383
 				return 1;
1316 1384
 			}
1317 1385
 		}
1318 1386
 		
1319
-		if(is_array($parameters)) $i = & $parameters['i'];
1320
-		else $i = (int)$parameters;
1387
+		if(is_array($parameters)) {
1388
+			$i = & $parameters['i'];
1389
+		} else {
1390
+			$i = (int)$parameters;
1391
+		}
1321 1392
 			
1322 1393
 		if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) )
1323 1394
 		{
@@ -1334,8 +1405,11 @@  discard block
 block discarded – undo
1334 1405
 	function pdf_getlineupexcltax($parameters=array(), &$object, &$action='') {
1335 1406
 	    global $conf,$hideprices,$hookmanager;
1336 1407
 
1337
-		if(is_array($parameters)) $i = & $parameters['i'];
1338
-		else $i = (int)$parameters;
1408
+		if(is_array($parameters)) {
1409
+			$i = & $parameters['i'];
1410
+		} else {
1411
+			$i = (int)$parameters;
1412
+		}
1339 1413
 
1340 1414
 		if($this->isModSubtotalLine($parameters,$object) ) {
1341 1415
 			$this->resprints = ' ';
@@ -1346,7 +1420,9 @@  discard block
 block discarded – undo
1346 1420
             if(TSubtotal::isSubtotal($line)) {
1347 1421
                 $parentTitle = TSubtotal::getParentTitleOfLine($object, $i);
1348 1422
 
1349
-                if(is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals();
1423
+                if(is_object($parentTitle) && empty($parentTitle->array_options)) {
1424
+                	$parentTitle->fetch_optionals();
1425
+                }
1350 1426
                 if(! empty($parentTitle->array_options['options_show_total_ht'])) {
1351 1427
                     $TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle);
1352 1428
                     $this->resprints = price($TTotal['total_unit_subprice']);
@@ -1355,8 +1431,7 @@  discard block
 block discarded – undo
1355 1431
 		
1356 1432
 			if((float)DOL_VERSION<=3.6) {
1357 1433
 				return '';
1358
-			}
1359
-			else if((float)DOL_VERSION>=3.8) {
1434
+			} else if((float)DOL_VERSION>=3.8) {
1360 1435
 				return 1;
1361 1436
 			}
1362 1437
 		}
@@ -1401,8 +1476,11 @@  discard block
 block discarded – undo
1401 1476
 	function pdf_getlineremisepercent($parameters=array(), &$object, &$action='') {
1402 1477
 	    global $conf,$hideprices,$hookmanager;
1403 1478
 
1404
-        if(is_array($parameters)) $i = & $parameters['i'];
1405
-        else $i = (int) $parameters;
1479
+        if(is_array($parameters)) {
1480
+        	$i = & $parameters['i'];
1481
+        } else {
1482
+        	$i = (int) $parameters;
1483
+        }
1406 1484
 
1407 1485
 		if($this->isModSubtotalLine($parameters,$object) ) {
1408 1486
 			$this->resprints = ' ';
@@ -1413,7 +1491,9 @@  discard block
 block discarded – undo
1413 1491
             if(TSubtotal::isSubtotal($line)) {
1414 1492
                 $parentTitle = TSubtotal::getParentTitleOfLine($object, $i);
1415 1493
 
1416
-                if(empty($parentTitle->array_options)) $parentTitle->fetch_optionals();
1494
+                if(empty($parentTitle->array_options)) {
1495
+                	$parentTitle->fetch_optionals();
1496
+                }
1417 1497
                 if(! empty($parentTitle->array_options['options_show_reduc'])) {
1418 1498
                     $TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle);
1419 1499
                     $this->resprints = price((1-$TTotal['total_ht'] / $TTotal['total_subprice'])*100, 0, '', 1, 2, 2).'%';
@@ -1422,12 +1502,10 @@  discard block
 block discarded – undo
1422 1502
 		
1423 1503
 			if((float)DOL_VERSION<=3.6) {
1424 1504
 				return '';
1425
-			}
1426
-			else if((float)DOL_VERSION>=3.8) {
1505
+			} else if((float)DOL_VERSION>=3.8) {
1427 1506
 				return 1;
1428 1507
 			}
1429
-		}
1430
-		elseif (!empty($hideprices)
1508
+		} elseif (!empty($hideprices)
1431 1509
 		        || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) )
1432 1510
 		        )
1433 1511
 		    {
@@ -1448,14 +1526,16 @@  discard block
 block discarded – undo
1448 1526
 			$this->resprints = ' ';
1449 1527
 			if((float)DOL_VERSION<=3.6) {
1450 1528
 				return '';
1451
-			}
1452
-			else if((float)DOL_VERSION>=3.8) {
1529
+			} else if((float)DOL_VERSION>=3.8) {
1453 1530
 				return 1;
1454 1531
 			}
1455 1532
 		}
1456 1533
 		
1457
-		if(is_array($parameters)) $i = & $parameters['i'];
1458
-		else $i = (int)$parameters;
1534
+		if(is_array($parameters)) {
1535
+			$i = & $parameters['i'];
1536
+		} else {
1537
+			$i = (int)$parameters;
1538
+		}
1459 1539
 			
1460 1540
 		if (!empty($hideprices)
1461 1541
 				|| (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) )
@@ -1479,16 +1559,21 @@  discard block
 block discarded – undo
1479 1559
 			
1480 1560
 			if((float)DOL_VERSION<=3.6) {
1481 1561
 				return '';
1482
-			}
1483
-			else if((float)DOL_VERSION>=3.8) {
1562
+			} else if((float)DOL_VERSION>=3.8) {
1484 1563
 				return 1;
1485 1564
 			}
1486 1565
 		}
1487 1566
 		
1488
-		if(is_array($parameters)) $i = & $parameters['i'];
1489
-		else $i = (int)$parameters;
1567
+		if(is_array($parameters)) {
1568
+			$i = & $parameters['i'];
1569
+		} else {
1570
+			$i = (int)$parameters;
1571
+		}
1490 1572
 		
1491
-		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)
1573
+		if (empty($object->lines[$i])) {
1574
+			return 0;
1575
+		}
1576
+		// 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)
1492 1577
 
1493 1578
 		$object->lines[$i]->fetch_optionals();
1494 1579
 		// Si la gestion C/NC est active et que je suis sur un ligne dont l'extrafield est coché
@@ -1534,14 +1619,16 @@  discard block
 block discarded – undo
1534 1619
 			$this->resprints = ' ';
1535 1620
 			if((float)DOL_VERSION<=3.6) {
1536 1621
 				return '';
1537
-			}
1538
-			else if((float)DOL_VERSION>=3.8) {
1622
+			} else if((float)DOL_VERSION>=3.8) {
1539 1623
 				return 1;
1540 1624
 			}
1541 1625
 		}
1542 1626
 		
1543
-		if(is_array($parameters)) $i = & $parameters['i'];
1544
-		else $i = (int)$parameters;
1627
+		if(is_array($parameters)) {
1628
+			$i = & $parameters['i'];
1629
+		} else {
1630
+			$i = (int)$parameters;
1631
+		}
1545 1632
 			
1546 1633
 		if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) )
1547 1634
 		{
@@ -1571,7 +1658,9 @@  discard block
 block discarded – undo
1571 1658
 				}
1572 1659
 			}
1573 1660
 			
1574
-			if (!empty($TLineTitle)) $TTitleNumeroted = $this->formatNumerotation($TLineTitle);
1661
+			if (!empty($TLineTitle)) {
1662
+				$TTitleNumeroted = $this->formatNumerotation($TLineTitle);
1663
+			}
1575 1664
 		}
1576 1665
 		
1577 1666
 	}
@@ -1585,8 +1674,12 @@  discard block
 block discarded – undo
1585 1674
 		$j=0;
1586 1675
 		foreach ($TLineTitle as $k => &$line)
1587 1676
 		{
1588
-			if (!empty($line_reference) && $line->rang <= $line_reference->rang) continue;
1589
-			if (!empty($line_reference) && $line->qty <= $line_reference->qty) break;
1677
+			if (!empty($line_reference) && $line->rang <= $line_reference->rang) {
1678
+				continue;
1679
+			}
1680
+			if (!empty($line_reference) && $line->qty <= $line_reference->qty) {
1681
+				break;
1682
+			}
1590 1683
 			
1591 1684
 			if ($line->qty == $level)
1592 1685
 			{
@@ -1620,7 +1713,9 @@  discard block
 block discarded – undo
1620 1713
 		
1621 1714
 		$hidedetails = (int)GETPOST('hidedetails');
1622 1715
 		
1623
-		if(empty($hidedetails)) return false;
1716
+		if(empty($hidedetails)) {
1717
+			return false;
1718
+		}
1624 1719
 		
1625 1720
 		// TODO can't add VAT to document without lines... :-/
1626 1721
 		
@@ -1648,7 +1743,9 @@  discard block
 block discarded – undo
1648 1743
         foreach($object->lines as $k => &$l) {
1649 1744
             if(TSubtotal::isSubtotal($l)) {
1650 1745
                 $parentTitle = TSubtotal::getParentTitleOfLine($object, $k);
1651
-                if(is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals();
1746
+                if(is_object($parentTitle) && empty($parentTitle->array_options)) {
1747
+                	$parentTitle->fetch_optionals();
1748
+                }
1652 1749
                 if(! empty($parentTitle->id) && ! empty($parentTitle->array_options['options_show_reduc'])) {
1653 1750
                     $l->remise_percent = 100;    // Affichage de la réduction sur la ligne de sous-total
1654 1751
                 }
@@ -1692,7 +1789,9 @@  discard block
 block discarded – undo
1692 1789
 						
1693 1790
 						$TInfo = $this->getTotalLineFromObject($object, $line, '', 1);
1694 1791
 
1695
-						if (TSubtotal::getNiveau($line) == 1) $line->TTotal_tva = $TInfo[3];
1792
+						if (TSubtotal::getNiveau($line) == 1) {
1793
+							$line->TTotal_tva = $TInfo[3];
1794
+						}
1696 1795
 						$line->total_ht = $TInfo[0];
1697 1796
 						$line->total_tva = $TInfo[1];
1698 1797
 						$line->total = $line->total_ht;
@@ -1756,8 +1855,7 @@  discard block
 block discarded – undo
1756 1855
 				    }
1757 1856
 				    
1758 1857
 					
1759
-				}
1760
-				elseif ($hidedetails)
1858
+				} elseif ($hidedetails)
1761 1859
 				{
1762 1860
 					$TLines[] = $line; //Cas où je cache uniquement les prix des produits	
1763 1861
 				}
@@ -1828,13 +1926,17 @@  discard block
 block discarded – undo
1828 1926
 				
1829 1927
 				if(!empty($hideprices)) {
1830 1928
 					foreach($object->lines as &$line) {
1831
-						if($line->fk_product_type!=9) $line->fk_parent_line = -1;	
1929
+						if($line->fk_product_type!=9) {
1930
+							$line->fk_parent_line = -1;
1931
+						}
1832 1932
 					}
1833 1933
 				}
1834 1934
 			
1835 1935
 				$line = &$object->lines[$i];
1836 1936
 
1837
-				if($object->element == 'delivery' && ! empty($object->commande->expeditions[$line->fk_origin_line])) unset($object->commande->expeditions[$line->fk_origin_line]);
1937
+				if($object->element == 'delivery' && ! empty($object->commande->expeditions[$line->fk_origin_line])) {
1938
+					unset($object->commande->expeditions[$line->fk_origin_line]);
1939
+				}
1838 1940
 
1839 1941
 				if($line->info_bits>0) { // PAGE BREAK
1840 1942
 					$pdf->addPage();
@@ -1850,7 +1952,9 @@  discard block
 block discarded – undo
1850 1952
 				}
1851 1953
 
1852 1954
 				if($line->qty>90) {
1853
-					if ($conf->global->SUBTOTAL_USE_NEW_FORMAT)	$label .= ' '.$this->getTitle($object, $line);
1955
+					if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) {
1956
+						$label .= ' '.$this->getTitle($object, $line);
1957
+					}
1854 1958
 					
1855 1959
 					$pageBefore = $pdf->getPage();
1856 1960
 					$this->pdf_add_total($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h);
@@ -1888,8 +1992,7 @@  discard block
 block discarded – undo
1888 1992
 				
1889 1993
 					$posy = $pdf->GetY();
1890 1994
 					return 1;
1891
-				}	
1892
-				else if ($line->qty < 10) {
1995
+				} else if ($line->qty < 10) {
1893 1996
 					$pageBefore = $pdf->getPage();
1894 1997
 
1895 1998
 					$this->pdf_add_title($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); 
@@ -1919,8 +2022,7 @@  discard block
 block discarded – undo
1919 2022
 //	if($line->rowid==47) exit;
1920 2023
 			
1921 2024
 			return 0;
1922
-		}
1923
-		elseif (empty($object->lines[$parameters['i']]))
2025
+		} elseif (empty($object->lines[$parameters['i']]))
1924 2026
 		{
1925 2027
 			$this->resprints = -1;
1926 2028
 		}
@@ -1953,7 +2055,9 @@  discard block
 block discarded – undo
1953 2055
 		
1954 2056
 		foreach ($object->lines as $line)
1955 2057
 		{
1956
-			if ($line->id == $currentLine->id) break;
2058
+			if ($line->id == $currentLine->id) {
2059
+				break;
2060
+			}
1957 2061
 			
1958 2062
 			$qty_search = 100 - $currentLine->qty;
1959 2063
 			
@@ -1984,7 +2088,9 @@  discard block
 block discarded – undo
1984 2088
 		$var = &$parameters['var'];
1985 2089
 
1986 2090
 		$contexts = explode(':',$parameters['context']);
1987
-		if($parameters['currentcontext'] === 'paiementcard') return 0;
2091
+		if($parameters['currentcontext'] === 'paiementcard') {
2092
+			return 0;
2093
+		}
1988 2094
 		$originline = null;
1989 2095
 
1990 2096
 		$createRight = $user->rights->{$object->element}->creer;
@@ -1992,22 +2098,18 @@  discard block
 block discarded – undo
1992 2098
 		{
1993 2099
 			$object->statut = 0; // hack for facture rec
1994 2100
 			$createRight = $user->rights->facture->creer;
1995
-		}
1996
-		elseif($object->element == 'order_supplier' )
2101
+		} elseif($object->element == 'order_supplier' )
1997 2102
 		{
1998 2103
 		    $createRight = $user->rights->fournisseur->commande->creer;
1999
-		}
2000
-		elseif($object->element == 'invoice_supplier' )
2104
+		} elseif($object->element == 'invoice_supplier' )
2001 2105
 		{
2002 2106
 		    $createRight = $user->rights->fournisseur->facture->creer;
2003
-		}
2004
-		elseif($object->element == 'commande' && in_array('ordershipmentcard', $contexts))
2107
+		} elseif($object->element == 'commande' && in_array('ordershipmentcard', $contexts))
2005 2108
 		{
2006 2109
 			// H4cK 4n0nYm0u$-style : $line n'est pas un objet instancié mais provient d'un fetch_object d'une requête SQL
2007 2110
 			$line->id = $line->rowid;
2008 2111
 			$line->product_type = $line->type;
2009
-		}
2010
-		elseif($object->element == 'shipping' || $object->element == 'delivery')
2112
+		} elseif($object->element == 'shipping' || $object->element == 'delivery')
2011 2113
 		{
2012 2114
 			if(empty($line->origin_line_id) && ! empty($line->fk_origin_line))
2013 2115
 			{
@@ -2027,8 +2129,11 @@  discard block
 block discarded – undo
2027 2129
 
2028 2130
 			$line = $originline;
2029 2131
 		}
2030
- 		if($object->element=='facture')$idvar = 'facid';
2031
-        else $idvar='id';
2132
+ 		if($object->element=='facture') {
2133
+ 			$idvar = 'facid';
2134
+ 		} else {
2135
+        	$idvar='id';
2136
+        }
2032 2137
 		if($line->special_code!=$this->module_number || $line->product_type!=9) {
2033 2138
 			if ($object->statut == 0  && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_LINE) && $object->element !== 'invoice_supplier')
2034 2139
             {
@@ -2046,8 +2151,7 @@  discard block
 block discarded – undo
2046 2151
 
2047 2152
             }
2048 2153
 			return 0;
2049
-		}
2050
-		else if (in_array('invoicecard',$contexts) || in_array('invoicesuppliercard',$contexts) || in_array('propalcard',$contexts) || in_array('supplier_proposalcard',$contexts) || in_array('ordercard',$contexts) || in_array('ordersuppliercard',$contexts) || in_array('invoicereccard',$contexts)) 
2154
+		} else if (in_array('invoicecard',$contexts) || in_array('invoicesuppliercard',$contexts) || in_array('propalcard',$contexts) || in_array('supplier_proposalcard',$contexts) || in_array('ordercard',$contexts) || in_array('ordersuppliercard',$contexts) || in_array('invoicereccard',$contexts)) 
2051 2155
         {
2052 2156
 
2053 2157
 
@@ -2075,22 +2179,44 @@  discard block
 block discarded – undo
2075 2179
 				<?php
2076 2180
 			}
2077 2181
 			
2078
-			if(empty($line->description)) $line->description = $line->desc;
2182
+			if(empty($line->description)) {
2183
+				$line->description = $line->desc;
2184
+			}
2079 2185
 			
2080 2186
 			$colspan = 5;
2081
-			if($object->element == 'facturerec' ) $colspan = 3;
2082
-			if($object->element == 'order_supplier') (float) DOL_VERSION < 7.0 ? $colspan = 3 : $colspan = 6;
2083
-			if($object->element == 'invoice_supplier') (float) DOL_VERSION < 7.0 ? $colspan = 4: $colspan = 7;
2084
-			if($object->element == 'supplier_proposal') (float) DOL_VERSION < 6.0 ? $colspan = 4 : $colspan = 3;
2187
+			if($object->element == 'facturerec' ) {
2188
+				$colspan = 3;
2189
+			}
2190
+			if($object->element == 'order_supplier') {
2191
+				(float) DOL_VERSION < 7.0 ? $colspan = 3 : $colspan = 6;
2192
+			}
2193
+			if($object->element == 'invoice_supplier') {
2194
+				(float) DOL_VERSION < 7.0 ? $colspan = 4: $colspan = 7;
2195
+			}
2196
+			if($object->element == 'supplier_proposal') {
2197
+				(float) DOL_VERSION < 6.0 ? $colspan = 4 : $colspan = 3;
2198
+			}
2085 2199
 			if(!empty($conf->multicurrency->enabled) && ((float) DOL_VERSION < 8.0 || $object->multicurrency_code != $conf->currency)) {
2086 2200
 				$colspan++; // Colonne PU Devise
2087 2201
 			}
2088
-			if($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) $colspan++;
2089
-			if(!empty($conf->margin->enabled)) $colspan++;
2090
-			if(!empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++;
2091
-			if(!empty($conf->global->DISPLAY_MARK_RATES)) $colspan++;
2092
-			if($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) $colspan++;
2093
-			if(!empty($conf->global->PRODUCT_USE_UNITS)) $colspan++;
2202
+			if($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) {
2203
+				$colspan++;
2204
+			}
2205
+			if(!empty($conf->margin->enabled)) {
2206
+				$colspan++;
2207
+			}
2208
+			if(!empty($conf->global->DISPLAY_MARGIN_RATES)) {
2209
+				$colspan++;
2210
+			}
2211
+			if(!empty($conf->global->DISPLAY_MARK_RATES)) {
2212
+				$colspan++;
2213
+			}
2214
+			if($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) {
2215
+				$colspan++;
2216
+			}
2217
+			if(!empty($conf->global->PRODUCT_USE_UNITS)) {
2218
+				$colspan++;
2219
+			}
2094 2220
 					
2095 2221
 			/* Titre */
2096 2222
 			//var_dump($line);
@@ -2103,23 +2229,36 @@  discard block
 block discarded – undo
2103 2229
 			<tr <?php echo $bc[$var]; $var=!$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php
2104 2230
 					if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT))
2105 2231
 					{
2106
-						if($line->qty==99) print 'background:#adadcf';
2107
-						else if($line->qty==98) print 'background:#ddddff;';
2108
-						else if($line->qty<=97 && $line->qty>=91) print 'background:#eeeeff;';
2109
-						else if($line->qty==1) print 'background:#adadcf;';
2110
-						else if($line->qty==2) print 'background:#ddddff;';
2111
-						else if($line->qty==50) print '';
2112
-						else print 'background:#eeeeff;';
2232
+						if($line->qty==99) {
2233
+							print 'background:#adadcf';
2234
+						} else if($line->qty==98) {
2235
+							print 'background:#ddddff;';
2236
+						} else if($line->qty<=97 && $line->qty>=91) {
2237
+							print 'background:#eeeeff;';
2238
+						} else if($line->qty==1) {
2239
+							print 'background:#adadcf;';
2240
+						} else if($line->qty==2) {
2241
+							print 'background:#ddddff;';
2242
+						} else if($line->qty==50) {
2243
+							print '';
2244
+						} else {
2245
+							print 'background:#eeeeff;';
2246
+						}
2113 2247
 
2114 2248
 						//A compléter si on veux plus de nuances de couleurs avec les niveau 4,5,6,7,8 et 9
2115
-					}
2116
-					else 
2249
+					} else 
2117 2250
 					{
2118
-						if($line->qty==99) print 'background:#ddffdd';
2119
-						else if($line->qty==98) print 'background:#ddddff;';
2120
-						else if($line->qty==2) print 'background:#eeeeff; ';
2121
-						else if($line->qty==50) print '';
2122
-						else print 'background:#eeffee;' ;
2251
+						if($line->qty==99) {
2252
+							print 'background:#ddffdd';
2253
+						} else if($line->qty==98) {
2254
+							print 'background:#ddddff;';
2255
+						} else if($line->qty==2) {
2256
+							print 'background:#eeeeff; ';
2257
+						} else if($line->qty==50) {
2258
+							print '';
2259
+						} else {
2260
+							print 'background:#eeffee;' ;
2261
+						}
2123 2262
 					}
2124 2263
 
2125 2264
 			?>;">
@@ -2146,13 +2285,11 @@  discard block
 block discarded – undo
2146 2285
 							$qty_displayed = $line->qty;
2147 2286
 							print img_picto('', 'subsubtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;color:#0075DE;">'.$qty_displayed.'</span>&nbsp;&nbsp;';
2148 2287
 							
2149
-						}
2150
-						else if (TSubtotal::isSubtotal($line))
2288
+						} else if (TSubtotal::isSubtotal($line))
2151 2289
 						{
2152 2290
 							$qty_displayed = 100 - $line->qty;
2153 2291
 							print img_picto('', 'subsubtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;color:#0075DE;">'.$qty_displayed.'</span>&nbsp;&nbsp;';
2154
-						}
2155
-						else
2292
+						} else
2156 2293
 						{
2157 2294
 							$isFreeText = true;
2158 2295
 						}
@@ -2173,9 +2310,13 @@  discard block
 block discarded – undo
2173 2310
 						}
2174 2311
 
2175 2312
 						$readonlyForSituation = '';
2176
-						if (!empty($line->fk_prev_id) && $line->fk_prev_id != null) $readonlyForSituation = 'readonly';
2313
+						if (!empty($line->fk_prev_id) && $line->fk_prev_id != null) {
2314
+							$readonlyForSituation = 'readonly';
2315
+						}
2177 2316
 						
2178
-						if (!$isFreeText) echo '<input type="text" name="line-title" id-line="'.$line->id.'" value="'.$newlabel.'" size="80" '.$readonlyForSituation.'/>&nbsp;';
2317
+						if (!$isFreeText) {
2318
+							echo '<input type="text" name="line-title" id-line="'.$line->id.'" value="'.$newlabel.'" size="80" '.$readonlyForSituation.'/>&nbsp;';
2319
+						}
2179 2320
 						
2180 2321
 						if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT) && (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) )
2181 2322
 						{
@@ -2183,8 +2324,12 @@  discard block
 block discarded – undo
2183 2324
 							for ($j=1; $j<10; $j++)
2184 2325
 							{
2185 2326
 								if (!empty($readonlyForSituation)) {
2186
-									if ($qty_displayed == $j) $select .= '<option selected="selected" value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>';
2187
-								} else $select .= '<option '.($qty_displayed == $j ? 'selected="selected"' : '').' value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>';
2327
+									if ($qty_displayed == $j) {
2328
+										$select .= '<option selected="selected" value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>';
2329
+									}
2330
+								} else {
2331
+									$select .= '<option '.($qty_displayed == $j ? 'selected="selected"' : '').' value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>';
2332
+								}
2188 2333
 							}
2189 2334
 							$select .= '</select>&nbsp;';
2190 2335
 
@@ -2204,7 +2349,9 @@  discard block
 block discarded – undo
2204 2349
                             echo '<div>';
2205 2350
                             echo '<label for="subtotal_tva_tx">'.$form->textwithpicto($langs->trans('subtotal_apply_default_tva'), $langs->trans('subtotal_apply_default_tva_help')).'</label>';
2206 2351
                             echo '<select id="subtotal_tva_tx" name="subtotal_tva_tx" class="flat"><option selected="selected" value="">-</option>';
2207
-                            if (empty($readonlyForSituation)) echo str_replace('selected', '', $form->load_tva('subtotal_tva_tx', '', $parameters['seller'], $parameters['buyer'], 0, 0, '', true));
2352
+                            if (empty($readonlyForSituation)) {
2353
+                            	echo str_replace('selected', '', $form->load_tva('subtotal_tva_tx', '', $parameters['seller'], $parameters['buyer'], 0, 0, '', true));
2354
+                            }
2208 2355
                             echo '</select>';
2209 2356
                             echo '</div>';
2210 2357
 
@@ -2223,8 +2370,9 @@  discard block
 block discarded – undo
2223 2370
                             echo '<input style="vertical-align:sub;"  type="checkbox" name="line-showReduc" id="subtotal-showReduc" value="1" '.(($line->array_options['options_show_reduc'] > 0) ? 'checked="checked"' : '') .' />&nbsp;';
2224 2371
                             echo '<label for="subtotal-showReduc">'.$langs->trans('ShowReducOnSubtotalBlock').'</label>';
2225 2372
                             echo '</div>';
2373
+                        } else if ($isFreeText) {
2374
+                        	echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation);
2226 2375
                         }
2227
-                        else if ($isFreeText) echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation);
2228 2376
 						echo '</div>';
2229 2377
 
2230 2378
 						if($line->qty<10) {
@@ -2244,8 +2392,7 @@  discard block
 block discarded – undo
2244 2392
 							$doleditor->Create();
2245 2393
 						}
2246 2394
 						
2247
-					}
2248
-					else {
2395
+					} else {
2249 2396
 
2250 2397
 						 if ($conf->global->SUBTOTAL_USE_NEW_FORMAT)
2251 2398
 						 {
@@ -2253,14 +2400,19 @@  discard block
 block discarded – undo
2253 2400
 							{
2254 2401
 								echo str_repeat('&nbsp;&nbsp;&nbsp;', $line->qty-1);
2255 2402
 								
2256
-								if (TSubtotal::isTitle($line)) print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span>&nbsp;&nbsp;';
2257
-								else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span>&nbsp;&nbsp;';
2403
+								if (TSubtotal::isTitle($line)) {
2404
+									print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span>&nbsp;&nbsp;';
2405
+								} else {
2406
+									print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span>&nbsp;&nbsp;';
2407
+								}
2258 2408
 							}
2259
-						 }
2260
-						 else 
2409
+						 } else 
2261 2410
 						 {
2262
-							if($line->qty<=1) print img_picto('', 'subtotal@subtotal');
2263
-							else if($line->qty==2) print img_picto('', 'subsubtotal@subtotal').'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'; 
2411
+							if($line->qty<=1) {
2412
+								print img_picto('', 'subtotal@subtotal');
2413
+							} else if($line->qty==2) {
2414
+								print img_picto('', 'subsubtotal@subtotal').'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
2415
+							}
2264 2416
 						 }
2265 2417
 						 
2266 2418
 						 
@@ -2270,21 +2422,26 @@  discard block
 block discarded – undo
2270 2422
 						 $titleStyleUnderline =  strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;';
2271 2423
 						 
2272 2424
 						 if (empty($line->label)) {
2273
-							if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) print  $line->description.' '.$this->getTitle($object, $line);
2274
-							else print  $line->description;
2275
-						 } 
2276
-						 else {
2425
+							if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) {
2426
+								print  $line->description.' '.$this->getTitle($object, $line);
2427
+							} else {
2428
+								print  $line->description;
2429
+							}
2430
+						 } else {
2277 2431
 
2278 2432
 							if (! empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) {
2279 2433
 								print '<span class="subtotal_label" style="'.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" >'.$line->label.'</span><br><div class="subtotal_desc">'.dol_htmlentitiesbr($line->description).'</div>';
2280
-							}
2281
-							else{
2434
+							} else{
2282 2435
 								print '<span class="subtotal_label classfortooltip '.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" title="'.$line->description.'">'.$line->label.'</span>';    
2283 2436
 							}
2284 2437
 
2285 2438
 						 } 
2286
-						if($line->qty>90) print ' : ';
2287
-						if($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal');
2439
+						if($line->qty>90) {
2440
+							print ' : ';
2441
+						}
2442
+						if($line->info_bits > 0) {
2443
+							echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal');
2444
+						}
2288 2445
 
2289 2446
 						 
2290 2447
 
@@ -2327,11 +2484,12 @@  discard block
 block discarded – undo
2327 2484
 						</script>
2328 2485
 						<?php
2329 2486
 						
2330
-					}
2331
-					else{
2487
+					} else{
2332 2488
 						if ($object->statut == 0  && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK) && $object->element !== 'invoice_supplier')
2333 2489
 						{
2334
-							if(TSubtotal::isTitle($line) && ( $line->fk_prev_id === null )) echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=duplicate&lineid='.$line->id.'">'. img_picto($langs->trans('Duplicate'), 'duplicate@subtotal').'</a>';
2490
+							if(TSubtotal::isTitle($line) && ( $line->fk_prev_id === null )) {
2491
+								echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=duplicate&lineid='.$line->id.'">'. img_picto($langs->trans('Duplicate'), 'duplicate@subtotal').'</a>';
2492
+							}
2335 2493
 						}
2336 2494
 
2337 2495
 						if ($object->statut == 0  && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_EDIT_BLOCK)) 
@@ -2421,7 +2579,9 @@  discard block
 block discarded – undo
2421 2579
 				$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
2422 2580
 				
2423 2581
 				$colspan+=3; $mode = 'view';
2424
-				if($action === 'editline' && $line->rowid == GETPOST('lineid')) $mode = 'edit';
2582
+				if($action === 'editline' && $line->rowid == GETPOST('lineid')) {
2583
+					$mode = 'edit';
2584
+				}
2425 2585
 				
2426 2586
 				$ex_element = $line->element;
2427 2587
 				$line->element = 'tr_extrafield_title '.$line->element; // Pour pouvoir manipuler ces tr
@@ -2480,8 +2640,7 @@  discard block
 block discarded – undo
2480 2640
 			
2481 2641
 			return 1;	
2482 2642
 			
2483
-		}
2484
-		elseif(($object->element == 'commande' && in_array('ordershipmentcard', $contexts)) || (in_array('expeditioncard', $contexts) && $action == 'create'))
2643
+		} elseif(($object->element == 'commande' && in_array('ordershipmentcard', $contexts)) || (in_array('expeditioncard', $contexts) && $action == 'create'))
2485 2644
 		{
2486 2645
 			$colspan = 4;
2487 2646
 
@@ -2491,23 +2650,36 @@  discard block
 block discarded – undo
2491 2650
 			<tr <?php echo $bc[$var]; $var=!$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php
2492 2651
 					if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT))
2493 2652
 					{
2494
-						if($line->qty==99) print 'background:#adadcf';
2495
-						else if($line->qty==98) print 'background:#ddddff;';
2496
-						else if($line->qty<=97 && $line->qty>=91) print 'background:#eeeeff;';
2497
-						else if($line->qty==1) print 'background:#adadcf;';
2498
-						else if($line->qty==2) print 'background:#ddddff;';
2499
-						else if($line->qty==50) print '';
2500
-						else print 'background:#eeeeff;';
2653
+						if($line->qty==99) {
2654
+							print 'background:#adadcf';
2655
+						} else if($line->qty==98) {
2656
+							print 'background:#ddddff;';
2657
+						} else if($line->qty<=97 && $line->qty>=91) {
2658
+							print 'background:#eeeeff;';
2659
+						} else if($line->qty==1) {
2660
+							print 'background:#adadcf;';
2661
+						} else if($line->qty==2) {
2662
+							print 'background:#ddddff;';
2663
+						} else if($line->qty==50) {
2664
+							print '';
2665
+						} else {
2666
+							print 'background:#eeeeff;';
2667
+						}
2501 2668
 
2502 2669
 						//A compléter si on veux plus de nuances de couleurs avec les niveau 4,5,6,7,8 et 9
2503
-					}
2504
-					else
2670
+					} else
2505 2671
 					{
2506
-						if($line->qty==99) print 'background:#ddffdd';
2507
-						else if($line->qty==98) print 'background:#ddddff;';
2508
-						else if($line->qty==2) print 'background:#eeeeff; ';
2509
-						else if($line->qty==50) print '';
2510
-						else print 'background:#eeffee;' ;
2672
+						if($line->qty==99) {
2673
+							print 'background:#ddffdd';
2674
+						} else if($line->qty==98) {
2675
+							print 'background:#ddddff;';
2676
+						} else if($line->qty==2) {
2677
+							print 'background:#eeeeff; ';
2678
+						} else if($line->qty==50) {
2679
+							print '';
2680
+						} else {
2681
+							print 'background:#eeffee;' ;
2682
+						}
2511 2683
 					}
2512 2684
 
2513 2685
 			?>;">
@@ -2521,14 +2693,19 @@  discard block
 block discarded – undo
2521 2693
 							{
2522 2694
 								echo str_repeat('&nbsp;&nbsp;&nbsp;', $line->qty-1);
2523 2695
 
2524
-								if (TSubtotal::isTitle($line)) print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span>&nbsp;&nbsp;';
2525
-								else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span>&nbsp;&nbsp;';
2696
+								if (TSubtotal::isTitle($line)) {
2697
+									print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span>&nbsp;&nbsp;';
2698
+								} else {
2699
+									print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span>&nbsp;&nbsp;';
2700
+								}
2526 2701
 							}
2527
-						 }
2528
-						 else
2702
+						 } else
2529 2703
 						 {
2530
-							if($line->qty<=1) print img_picto('', 'subtotal@subtotal');
2531
-							else if($line->qty==2) print img_picto('', 'subsubtotal@subtotal').'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
2704
+							if($line->qty<=1) {
2705
+								print img_picto('', 'subtotal@subtotal');
2706
+							} else if($line->qty==2) {
2707
+								print img_picto('', 'subsubtotal@subtotal').'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
2708
+							}
2532 2709
 						 }
2533 2710
 
2534 2711
 
@@ -2538,21 +2715,24 @@  discard block
 block discarded – undo
2538 2715
 						 $titleStyleUnderline =  strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;';
2539 2716
 
2540 2717
 						 if (empty($line->label)) {
2541
-							if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) print  $line->description.' '.$this->getTitle($object, $line);
2542
-							else print  $line->description;
2543
-						 }
2544
-						 else {
2718
+							if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) {
2719
+								print  $line->description.' '.$this->getTitle($object, $line);
2720
+							} else {
2721
+								print  $line->description;
2722
+							}
2723
+						 } else {
2545 2724
 
2546 2725
 							if (! empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) {
2547 2726
 								print '<span class="subtotal_label" style="'.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" >'.$line->label.'</span><br><div class="subtotal_desc">'.dol_htmlentitiesbr($line->description).'</div>';
2548
-							}
2549
-							else{
2727
+							} else{
2550 2728
 								print '<span class="subtotal_label classfortooltip '.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" title="'.$line->description.'">'.$line->label.'</span>';
2551 2729
 							}
2552 2730
 
2553 2731
 						 }
2554 2732
 						//if($line->qty>90) print ' : ';
2555
-						if($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal');
2733
+						if($line->info_bits > 0) {
2734
+							echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal');
2735
+						}
2556 2736
 
2557 2737
 			?>
2558 2738
 				</td>
@@ -2575,8 +2755,7 @@  discard block
 block discarded – undo
2575 2755
 			</tr>
2576 2756
 <?php
2577 2757
 			return 1;
2578
-		}
2579
-		elseif ($object->element == 'shipping' || $object->element == 'delivery')
2758
+		} elseif ($object->element == 'shipping' || $object->element == 'delivery')
2580 2759
 		{
2581 2760
 			global $form;
2582 2761
 
@@ -2588,13 +2767,25 @@  discard block
 block discarded – undo
2588 2767
 			$extralabelslines=$extrafieldsline->fetch_name_optionals_label($object->table_element_line);
2589 2768
 
2590 2769
 			$colspan = 4;
2591
-			if($object->origin && $object->origin_id > 0) $colspan++;
2592
-			if(! empty($conf->stock->enabled)) $colspan++;
2593
-			if(! empty($conf->productbatch->enabled)) $colspan++;
2594
-			if($object->statut == 0) $colspan++;
2595
-			if($object->statut == 0 && empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK)) $colspan++;
2770
+			if($object->origin && $object->origin_id > 0) {
2771
+				$colspan++;
2772
+			}
2773
+			if(! empty($conf->stock->enabled)) {
2774
+				$colspan++;
2775
+			}
2776
+			if(! empty($conf->productbatch->enabled)) {
2777
+				$colspan++;
2778
+			}
2779
+			if($object->statut == 0) {
2780
+				$colspan++;
2781
+			}
2782
+			if($object->statut == 0 && empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK)) {
2783
+				$colspan++;
2784
+			}
2596 2785
 
2597
-			if($object->element == 'delivery') $colspan = 2;
2786
+			if($object->element == 'delivery') {
2787
+				$colspan = 2;
2788
+			}
2598 2789
 
2599 2790
 			print '<!-- origin line id = '.$line->origin_line_id.' -->'; // id of order line
2600 2791
 
@@ -2604,23 +2795,36 @@  discard block
 block discarded – undo
2604 2795
 			<tr <?php echo $bc[$var]; $var=!$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php
2605 2796
 					if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT))
2606 2797
 					{
2607
-						if($line->qty==99) print 'background:#adadcf';
2608
-						else if($line->qty==98) print 'background:#ddddff;';
2609
-						else if($line->qty<=97 && $line->qty>=91) print 'background:#eeeeff;';
2610
-						else if($line->qty==1) print 'background:#adadcf;';
2611
-						else if($line->qty==2) print 'background:#ddddff;';
2612
-						else if($line->qty==50) print '';
2613
-						else print 'background:#eeeeff;';
2798
+						if($line->qty==99) {
2799
+							print 'background:#adadcf';
2800
+						} else if($line->qty==98) {
2801
+							print 'background:#ddddff;';
2802
+						} else if($line->qty<=97 && $line->qty>=91) {
2803
+							print 'background:#eeeeff;';
2804
+						} else if($line->qty==1) {
2805
+							print 'background:#adadcf;';
2806
+						} else if($line->qty==2) {
2807
+							print 'background:#ddddff;';
2808
+						} else if($line->qty==50) {
2809
+							print '';
2810
+						} else {
2811
+							print 'background:#eeeeff;';
2812
+						}
2614 2813
 
2615 2814
 						//A compléter si on veux plus de nuances de couleurs avec les niveau 4,5,6,7,8 et 9
2616
-					}
2617
-					else 
2815
+					} else 
2618 2816
 					{
2619
-						if($line->qty==99) print 'background:#ddffdd';
2620
-						else if($line->qty==98) print 'background:#ddddff;';
2621
-						else if($line->qty==2) print 'background:#eeeeff; ';
2622
-						else if($line->qty==50) print '';
2623
-						else print 'background:#eeffee;' ;
2817
+						if($line->qty==99) {
2818
+							print 'background:#ddffdd';
2819
+						} else if($line->qty==98) {
2820
+							print 'background:#ddddff;';
2821
+						} else if($line->qty==2) {
2822
+							print 'background:#eeeeff; ';
2823
+						} else if($line->qty==50) {
2824
+							print '';
2825
+						} else {
2826
+							print 'background:#eeffee;' ;
2827
+						}
2624 2828
 					}
2625 2829
 
2626 2830
 			?>;">
@@ -2642,14 +2846,19 @@  discard block
 block discarded – undo
2642 2846
 				{
2643 2847
 					echo str_repeat('&nbsp;&nbsp;&nbsp;', $line->qty-1);
2644 2848
 
2645
-					if (TSubtotal::isTitle($line)) print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span>&nbsp;&nbsp;';
2646
-					else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span>&nbsp;&nbsp;';
2849
+					if (TSubtotal::isTitle($line)) {
2850
+						print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span>&nbsp;&nbsp;';
2851
+					} else {
2852
+						print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span>&nbsp;&nbsp;';
2853
+					}
2647 2854
 				}
2648
-			}
2649
-			else
2855
+			} else
2650 2856
 			{
2651
-				if($line->qty<=1) print img_picto('', 'subtotal@subtotal');
2652
-				else if($line->qty==2) print img_picto('', 'subsubtotal@subtotal').'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
2857
+				if($line->qty<=1) {
2858
+					print img_picto('', 'subtotal@subtotal');
2859
+				} else if($line->qty==2) {
2860
+					print img_picto('', 'subsubtotal@subtotal').'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
2861
+				}
2653 2862
 			}
2654 2863
 
2655 2864
 
@@ -2659,19 +2868,22 @@  discard block
 block discarded – undo
2659 2868
 			$titleStyleUnderline =  strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;';
2660 2869
 
2661 2870
 			if (empty($line->label)) {
2662
-				if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) print  $line->description.' '.$this->getTitle($object, $line);
2663
-				else print  $line->description;
2664
-			}
2665
-			else {
2871
+				if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) {
2872
+					print  $line->description.' '.$this->getTitle($object, $line);
2873
+				} else {
2874
+					print  $line->description;
2875
+				}
2876
+			} else {
2666 2877
 				if (! empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) {
2667 2878
 					print '<span class="subtotal_label" style="'.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" >'.$line->label.'</span><br><div class="subtotal_desc">'.dol_htmlentitiesbr($line->description).'</div>';
2668
-				}
2669
-				else{
2879
+				} else{
2670 2880
 					print '<span class="subtotal_label classfortooltip '.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" title="'.$line->description.'">'.$line->label.'</span>';
2671 2881
 				}
2672 2882
 			}
2673 2883
 			//if($line->qty>90) print ' : ';
2674
-			if($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal');
2884
+			if($line->info_bits > 0) {
2885
+				echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal');
2886
+			}
2675 2887
 
2676 2888
 			?>
2677 2889
 				</td>
@@ -2851,10 +3063,9 @@  discard block
 block discarded – undo
2851 3063
 	    
2852 3064
 	    if(TSubtotal::isTitle($line)){
2853 3065
 	        $ThtmlData['data-issubtotal'] = 'title';
2854
-	    }elseif(TSubtotal::isSubtotal($line)){
3066
+	    } elseif(TSubtotal::isSubtotal($line)){
2855 3067
 	        $ThtmlData['data-issubtotal'] = 'subtotal';
2856
-	    }
2857
-	    else{
3068
+	    } else{
2858 3069
 	        $ThtmlData['data-issubtotal'] = 'freetext';
2859 3070
 	    }
2860 3071
 	    
@@ -2864,7 +3075,9 @@  discard block
 block discarded – undo
2864 3075
 	    
2865 3076
 	    // hook 
2866 3077
 	    $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
2867
-	    if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
3078
+	    if ($reshook < 0) {
3079
+	    	setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
3080
+	    }
2868 3081
 	    if ($reshook>0)
2869 3082
 	    {
2870 3083
 	        $ThtmlData = $hookmanager->resArray;
Please login to merge, or discard this patch.