Completed
Push — master ( eaa3b6...17deb1 )
by
unknown
11s queued 10s
created
script/migrate_titles_to_7.0.php 1 patch
Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -6,73 +6,73 @@
 block discarded – undo
6 6
 
7 7
 if((float)DOL_VERSION >= 7)
8 8
 {
9
-    print "Début de conversion des lignes de propale<br>";
10
-    $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."propaldet WHERE special_code = 104777 AND qty != 50 AND product_type = 9 AND (label = '' OR label IS NULL)";
11
-    $res = $db->query($sql);
12
-    if($res)
13
-    {
14
-        print $db->num_rows($res)." lignes à convertir<br>";
15
-        $i = 0;
16
-        while ($obj = $db->fetch_object($res))
17
-        {
18
-            $prop = new PropaleLigne($db);
19
-            $prop->fetch($obj->rowid);
20
-            $prop->fetch_optionals();
21
-            if (empty($prop->label)){
22
-                $prop->label = strip_tags($prop->desc);
23
-                $prop->desc = '';
24
-            }
25
-            $ret = $prop->update(1);
26
-            if($ret>0) $i++;
27
-        }
28
-        print $i." lignes converties<br>";
29
-    }
9
+	print "Début de conversion des lignes de propale<br>";
10
+	$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."propaldet WHERE special_code = 104777 AND qty != 50 AND product_type = 9 AND (label = '' OR label IS NULL)";
11
+	$res = $db->query($sql);
12
+	if($res)
13
+	{
14
+		print $db->num_rows($res)." lignes à convertir<br>";
15
+		$i = 0;
16
+		while ($obj = $db->fetch_object($res))
17
+		{
18
+			$prop = new PropaleLigne($db);
19
+			$prop->fetch($obj->rowid);
20
+			$prop->fetch_optionals();
21
+			if (empty($prop->label)){
22
+				$prop->label = strip_tags($prop->desc);
23
+				$prop->desc = '';
24
+			}
25
+			$ret = $prop->update(1);
26
+			if($ret>0) $i++;
27
+		}
28
+		print $i." lignes converties<br>";
29
+	}
30 30
     
31
-    print "Début de conversion des lignes de commande<br>";
32
-    $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."commandedet WHERE special_code = 104777 AND qty != 50 AND product_type = 9 AND (label = '' OR label IS NULL)";
33
-    $res = $db->query($sql);
34
-    if($res)
35
-    {
36
-        print $db->num_rows($res)." lignes à convertir<br>";
37
-        $i = 0;
38
-        while ($obj = $db->fetch_object($res))
39
-        {
40
-            $cdeline = new OrderLine($db);
41
-            $cdeline->fetch($obj->rowid);
42
-            $cdeline->fetch_optionals($obj->rowid);
43
-            if (empty($cdeline->label)){
44
-                $cdeline->label = strip_tags($cdeline->desc);
45
-                $cdeline->desc = '';
46
-            }
47
-            $ret = $cdeline->update($user, 1);
48
-            if($ret>0) $i++;
49
-        }
31
+	print "Début de conversion des lignes de commande<br>";
32
+	$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."commandedet WHERE special_code = 104777 AND qty != 50 AND product_type = 9 AND (label = '' OR label IS NULL)";
33
+	$res = $db->query($sql);
34
+	if($res)
35
+	{
36
+		print $db->num_rows($res)." lignes à convertir<br>";
37
+		$i = 0;
38
+		while ($obj = $db->fetch_object($res))
39
+		{
40
+			$cdeline = new OrderLine($db);
41
+			$cdeline->fetch($obj->rowid);
42
+			$cdeline->fetch_optionals($obj->rowid);
43
+			if (empty($cdeline->label)){
44
+				$cdeline->label = strip_tags($cdeline->desc);
45
+				$cdeline->desc = '';
46
+			}
47
+			$ret = $cdeline->update($user, 1);
48
+			if($ret>0) $i++;
49
+		}
50 50
         
51
-        print $i." lignes converties<br>";
52
-    }
51
+		print $i." lignes converties<br>";
52
+	}
53 53
     
54
-    print "Début de conversion des lignes de facture<br>";
55
-    $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facturedet WHERE special_code = 104777 AND qty != 50 AND product_type = 9 AND (label = '' OR label IS NULL)";
54
+	print "Début de conversion des lignes de facture<br>";
55
+	$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facturedet WHERE special_code = 104777 AND qty != 50 AND product_type = 9 AND (label = '' OR label IS NULL)";
56 56
     
57
-    $res = $db->query($sql);
58
-    if($res)
59
-    {
60
-        print $db->num_rows($res)." lignes à convertir<br>";
61
-        $i = 0;
62
-        while ($obj = $db->fetch_object($res))
63
-        {
64
-            $facline = new FactureLigne($db);
65
-            $facline->fetch($obj->rowid);
66
-            $facline->fetch_optionals($obj->rowid);
67
-            if (empty($facline->label)){
68
-                $facline->label = strip_tags($facline->desc);
69
-                $facline->desc = '';
70
-            }
71
-            $ret = $facline->update($user, 1);
72
-            if($ret>0) $i++;
73
-        }
57
+	$res = $db->query($sql);
58
+	if($res)
59
+	{
60
+		print $db->num_rows($res)." lignes à convertir<br>";
61
+		$i = 0;
62
+		while ($obj = $db->fetch_object($res))
63
+		{
64
+			$facline = new FactureLigne($db);
65
+			$facline->fetch($obj->rowid);
66
+			$facline->fetch_optionals($obj->rowid);
67
+			if (empty($facline->label)){
68
+				$facline->label = strip_tags($facline->desc);
69
+				$facline->desc = '';
70
+			}
71
+			$ret = $facline->update($user, 1);
72
+			if($ret>0) $i++;
73
+		}
74 74
         
75
-        print $i." lignes converties<br>";
76
-    }
75
+		print $i." lignes converties<br>";
76
+	}
77 77
     
78 78
 }
79 79
\ No newline at end of file
Please login to merge, or discard this patch.
class/subtotal.class.php 1 patch
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -39,10 +39,10 @@  discard block
 block discarded – undo
39 39
 			 * @var $object Facture fournisseur
40 40
 			 */
41 41
 			else if($object->element=='invoice_supplier') {
42
-			    $object->special_code = TSubtotal::$module_number;
43
-			    $rang = $object->line_max() + 1;
44
-			    if($qty==50) $res = $object->addline($desc,0,0,0,0,$qty,0,0,'','',0,0,'HT',9,$rang);
45
-			    else $res = $object->addline($label,0,0,0,0,$qty,0,0,'','',0,0,'HT',9,$rang);
42
+				$object->special_code = TSubtotal::$module_number;
43
+				$rang = $object->line_max() + 1;
44
+				if($qty==50) $res = $object->addline($desc,0,0,0,0,$qty,0,0,'','',0,0,'HT',9,$rang);
45
+				else $res = $object->addline($label,0,0,0,0,$qty,0,0,'','',0,0,'HT',9,$rang);
46 46
 			}
47 47
 			/**
48 48
 			 * @var $object Propal
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
 			 * @var $object Commande fournisseur
62 62
 			 */
63 63
 			else if($object->element=='order_supplier') {
64
-			    $object->special_code = TSubtotal::$module_number;
65
-			    $res = $object->addline($label, 0,$qty,0,0,0,0,0,'',0,'HT', 0, 9);
64
+				$object->special_code = TSubtotal::$module_number;
65
+				$res = $object->addline($label, 0,$qty,0,0,0,0,0,'',0,'HT', 0, 9);
66 66
 			}
67 67
 			/**
68 68
 			 * @var $object Facturerec
@@ -404,16 +404,16 @@  discard block
 block discarded – undo
404 404
 		$createRight = $user->rights->{$object->element}->creer;
405 405
 		if($object->element == 'facturerec' )
406 406
 		{
407
-		    $object->statut = 0; // hack for facture rec
408
-		    $createRight = $user->rights->facture->creer;
407
+			$object->statut = 0; // hack for facture rec
408
+			$createRight = $user->rights->facture->creer;
409 409
 		}
410 410
 		elseif($object->element == 'order_supplier' )
411 411
 		{
412
-		    $createRight = $user->rights->fournisseur->commande->creer;
412
+			$createRight = $user->rights->fournisseur->commande->creer;
413 413
 		}
414 414
 		elseif($object->element == 'invoice_supplier' )
415 415
 		{
416
-		    $createRight = $user->rights->fournisseur->facture->creer;
416
+			$createRight = $user->rights->fournisseur->facture->creer;
417 417
 		}
418 418
 		
419 419
 		if ($object->statut == 0  && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK))
@@ -438,8 +438,8 @@  discard block
 block discarded – undo
438 438
 							break;
439 439
 							
440 440
 						case 'supplier_proposal':
441
-						    $res = $object->addline($line->desc, $line->subprice, $line->qty, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->fk_product, $line->remise_percent, 'HT', 0, $line->info_bits, $line->product_type, -1, $line->special_code, 0, 0, $line->pa_ht, $line->label, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->origin, $line->origin_id);
442
-						    break;
441
+							$res = $object->addline($line->desc, $line->subprice, $line->qty, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->fk_product, $line->remise_percent, 'HT', 0, $line->info_bits, $line->product_type, -1, $line->special_code, 0, 0, $line->pa_ht, $line->label, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->origin, $line->origin_id);
442
+							break;
443 443
 							
444 444
 						case 'commande':
445 445
 							//$desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $info_bits=0, $fk_remise_except=0, $price_base_type='HT', $pu_ttc=0, $date_start='', $date_end='', $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht=0, $label='',$array_options=0, $fk_unit=null, $origin='', $origin_id=0)
@@ -447,10 +447,10 @@  discard block
 block discarded – undo
447 447
 							break;
448 448
 							
449 449
 						case 'order_supplier':
450
-						    $object->line = $line;
451
-						    $object->line->fk_commande = $object->id;
452
-						    $object->line->rang = $object->line_max() +1;
453
-						    $res = $object->line->insert(1);
450
+							$object->line = $line;
451
+							$object->line->fk_commande = $object->id;
452
+							$object->line->rang = $object->line_max() +1;
453
+							$res = $object->line->insert(1);
454 454
 							break;
455 455
 							
456 456
 						case 'facture':
@@ -503,8 +503,8 @@  discard block
 block discarded – undo
503 503
 					$object->db->commit();
504 504
 					foreach ($TLineAdded as &$line)
505 505
 					{
506
-					    // ça peut paraitre non optimisé de déclancher la fonction sur toutes les lignes mais ceci est nécessaire pour réappliquer l'état exact de chaque ligne
507
-					    _updateLineNC($object->element, $object->id, $line->id, $line->array_options['options_subtotal_nc']);
506
+						// ça peut paraitre non optimisé de déclancher la fonction sur toutes les lignes mais ceci est nécessaire pour réappliquer l'état exact de chaque ligne
507
+						_updateLineNC($object->element, $object->id, $line->id, $line->array_options['options_subtotal_nc']);
508 508
 					}
509 509
 					return count($TLineAdded);
510 510
 				}
@@ -578,33 +578,33 @@  discard block
 block discarded – undo
578 578
 		
579 579
 		switch ($object->element) 
580 580
 		{
581
-		    case 'propal':
582
-		        $res = $object->updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $desc, $price_base_type, $info_bits, $special_code, $fk_parent_line, $skip_update_total, $fk_fournprice, $pa_ht, $label, $type, $date_start, $date_end, $array_options, $fk_unit);
583
-		        break;
581
+			case 'propal':
582
+				$res = $object->updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $desc, $price_base_type, $info_bits, $special_code, $fk_parent_line, $skip_update_total, $fk_fournprice, $pa_ht, $label, $type, $date_start, $date_end, $array_options, $fk_unit);
583
+				break;
584 584
 		        
585
-		    case 'supplier_proposal':
586
-		        $res = $object->updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $desc, $price_base_type, $info_bits, $special_code, $fk_parent_line, $skip_update_total, $fk_fournprice, $pa_ht, $label, $type, $array_options,'', $fk_unit);
587
-		        break;
585
+			case 'supplier_proposal':
586
+				$res = $object->updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $desc, $price_base_type, $info_bits, $special_code, $fk_parent_line, $skip_update_total, $fk_fournprice, $pa_ht, $label, $type, $array_options,'', $fk_unit);
587
+				break;
588 588
 		        
589 589
 			case 'commande':
590 590
 				$res = $object->updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $price_base_type, $info_bits, $date_start, $date_end, $type, $fk_parent_line, $skip_update_total, $fk_fournprice, $pa_ht, $label, $special_code, $array_options, $fk_unit);
591 591
 				break;
592 592
 				
593 593
 			case 'order_supplier':
594
-			    $object->special_code = SELF::$module_number;
595
-			    if (empty($desc)) $desc = $label;
596
-			    $res = $object->updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $price_base_type, $info_bits, $type, 0, $date_start, $date_end, $array_options, $fk_unit);
597
-			    break;
594
+				$object->special_code = SELF::$module_number;
595
+				if (empty($desc)) $desc = $label;
596
+				$res = $object->updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $price_base_type, $info_bits, $type, 0, $date_start, $date_end, $array_options, $fk_unit);
597
+				break;
598 598
 			
599 599
 			case 'facture':
600 600
 				$res = $object->updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1, $txlocaltax2, $price_base_type, $info_bits, $type, $fk_parent_line, $skip_update_total, $fk_fournprice, $pa_ht, $label, $special_code, $array_options, $situation_percent, $fk_unit);
601 601
 				break;
602 602
 				
603 603
 			case 'invoice_supplier':
604
-			    $object->special_code = SELF::$module_number;
605
-			    if (empty($desc)) $desc = $label;
606
-			    $res = $object->updateline($rowid, $desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, 0, $price_base_type, $info_bits, $type, $remise_percent, 0, $date_start, $date_end, $array_options, $fk_unit);
607
-			    break;
604
+				$object->special_code = SELF::$module_number;
605
+				if (empty($desc)) $desc = $label;
606
+				$res = $object->updateline($rowid, $desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, 0, $price_base_type, $info_bits, $type, $remise_percent, 0, $date_start, $date_end, $array_options, $fk_unit);
607
+				break;
608 608
 				
609 609
 			case 'facturerec':
610 610
 				// Add extrafields and get rang
@@ -995,8 +995,8 @@  discard block
 block discarded – undo
995 995
 		{
996 996
 			if (is_readable($logo))
997 997
 			{
998
-			    $height=pdf_getHeightForLogo($logo);
999
-			    $pdf->Image($logo, $objmarge->marge_gauche, $posy, 0, $height);	// width=0 (auto)
998
+				$height=pdf_getHeightForLogo($logo);
999
+				$pdf->Image($logo, $objmarge->marge_gauche, $posy, 0, $height);	// width=0 (auto)
1000 1000
 			}
1001 1001
 			else
1002 1002
 			{
@@ -1187,13 +1187,13 @@  discard block
 block discarded – undo
1187 1187
 	 * @param	int		$hidebottom		Hide bottom
1188 1188
 	 * @return	void
1189 1189
 	 */
1190
-    private static function printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0)
1191
-    {
1192
-	    if (empty($hidetop) || $hidetop==-1) $pdf->line($x, $y, $x+$l, $y);
1193
-	    $pdf->line($x+$l, $y, $x+$l, $y+$h);
1194
-	    if (empty($hidebottom)) $pdf->line($x+$l, $y+$h, $x, $y+$h);
1195
-	    $pdf->line($x, $y+$h, $x, $y);
1196
-    }
1190
+	private static function printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0)
1191
+	{
1192
+		if (empty($hidetop) || $hidetop==-1) $pdf->line($x, $y, $x+$l, $y);
1193
+		$pdf->line($x+$l, $y, $x+$l, $y+$h);
1194
+		if (empty($hidebottom)) $pdf->line($x+$l, $y+$h, $x, $y+$h);
1195
+		$pdf->line($x, $y+$h, $x, $y);
1196
+	}
1197 1197
 	
1198 1198
 	
1199 1199
 	public static function concat(&$outputlangs, $files, $fileoutput='')
@@ -1203,14 +1203,14 @@  discard block
 block discarded – undo
1203 1203
 		if (empty($fileoutput)) $fileoutput = $file[0];
1204 1204
 		
1205 1205
 		$pdf=pdf_getInstance();
1206
-        if (class_exists('TCPDF'))
1207
-        {
1208
-            $pdf->setPrintHeader(false);
1209
-            $pdf->setPrintFooter(false);
1210
-        }
1211
-        $pdf->SetFont(pdf_getPDFFont($outputlangs));
1206
+		if (class_exists('TCPDF'))
1207
+		{
1208
+			$pdf->setPrintHeader(false);
1209
+			$pdf->setPrintFooter(false);
1210
+		}
1211
+		$pdf->SetFont(pdf_getPDFFont($outputlangs));
1212 1212
 
1213
-        if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
1213
+		if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
1214 1214
 
1215 1215
 		
1216 1216
 		foreach($files as $file)
Please login to merge, or discard this patch.
core/modules/modSubtotal.class.php 1 patch
Indentation   +380 added lines, -380 removed lines patch added patch discarded remove patch
@@ -31,170 +31,170 @@  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.1.0';
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('invoicecard', 'invoicesuppliercard','propalcard', 'supplier_proposalcard', 'ordercard', 'ordersuppliercard','odtgeneration','orderstoinvoice','admin','invoicereccard')
100
-            // Set here all workflow context managed by module
101
-            //'workflow' => array('order' => array('WORKFLOW_ORDER_AUTOCREATE_INVOICE'))
102
-        );
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.1.0';
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('invoicecard', 'invoicesuppliercard','propalcard', 'supplier_proposalcard', 'ordercard', 'ordersuppliercard','odtgeneration','orderstoinvoice','admin','invoicereccard')
100
+			// Set here all workflow context managed by module
101
+			//'workflow' => array('order' => array('WORKFLOW_ORDER_AUTOCREATE_INVOICE'))
102
+		);
103 103
 
104
-        // Data directories to create when module is enabled.
105
-        // Example: this->dirs = array("/titre/temp");
106
-        $this->dirs = array();
104
+		// Data directories to create when module is enabled.
105
+		// Example: this->dirs = array("/titre/temp");
106
+		$this->dirs = array();
107 107
 
108
-        // Config pages. Put here list of php pages
109
-        // stored into titre/admin directory, used to setup module.
110
-        $this->config_page_url = array("subtotal_setup.php@subtotal");
108
+		// Config pages. Put here list of php pages
109
+		// stored into titre/admin directory, used to setup module.
110
+		$this->config_page_url = array("subtotal_setup.php@subtotal");
111 111
 
112
-        // Dependencies
113
-        // List of modules id that must be enabled if this module is enabled
114
-        $this->depends = array();
112
+		// Dependencies
113
+		// List of modules id that must be enabled if this module is enabled
114
+		$this->depends = array();
115 115
 
116 116
 		$this->conflictwith=array('modMilestone');
117
-        // List of modules id to disable if this one is disabled
118
-        $this->requiredby = array();
119
-        // Minimum version of PHP required by module
120
-        $this->phpmin = array(5, 3);
121
-        // Minimum version of Dolibarr required by module
122
-        $this->need_dolibarr_version = array(3, 2);
123
-        $this->langfiles = array("subtotal@subtotal"); // langfiles@titre
124
-        // Constants
125
-        // List of particular constants to add when module is enabled
126
-        // (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
127
-        // Example:
128
-        $this->const = array(
129
-            	0=>array(
130
-            		'SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES',
131
-            		'chaine',
132
-            		'I',
133
-            		'Définit le style (B : gras, I : Italique, U : Souligné) des sous titres lorsque le détail des lignes et des ensembles est caché',
134
-            		1
135
-            	)
117
+		// List of modules id to disable if this one is disabled
118
+		$this->requiredby = array();
119
+		// Minimum version of PHP required by module
120
+		$this->phpmin = array(5, 3);
121
+		// Minimum version of Dolibarr required by module
122
+		$this->need_dolibarr_version = array(3, 2);
123
+		$this->langfiles = array("subtotal@subtotal"); // langfiles@titre
124
+		// Constants
125
+		// List of particular constants to add when module is enabled
126
+		// (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
127
+		// Example:
128
+		$this->const = array(
129
+				0=>array(
130
+					'SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES',
131
+					'chaine',
132
+					'I',
133
+					'Définit le style (B : gras, I : Italique, U : Souligné) des sous titres lorsque le détail des lignes et des ensembles est caché',
134
+					1
135
+				)
136 136
 				,1=>array('SUBTOTAL_ALLOW_ADD_BLOCK', 'chaine', '1', 'Permet l\'ajout de titres et sous-totaux')
137 137
 				,2=>array('SUBTOTAL_ALLOW_EDIT_BLOCK', 'chaine', '1', 'Permet de modifier titres et sous-totaux')
138 138
 				,3=>array('SUBTOTAL_ALLOW_REMOVE_BLOCK', 'chaine', '1', 'Permet de supprimer les titres et sous-totaux')
139 139
 				,4=>array('SUBTOTAL_TITLE_STYLE', 'chaine', 'BU')
140 140
 				,5=>array('SUBTOTAL_SUBTOTAL_STYLE', 'chaine', 'B')
141
-            //	1=>array(
142
-            //		'MYMODULE_MYNEWCONST2',
143
-            //		'chaine',
144
-            //		'myvalue',
145
-            //		'This is another constant to add',
146
-            //		0
147
-            //	)
148
-        );
141
+			//	1=>array(
142
+			//		'MYMODULE_MYNEWCONST2',
143
+			//		'chaine',
144
+			//		'myvalue',
145
+			//		'This is another constant to add',
146
+			//		0
147
+			//	)
148
+		);
149 149
 		
150 150
 
151 151
 
152 152
 
153
-        // Array to add new pages in new tabs
154
-        // Example:
155
-        $this->tabs = array(
156
-            //	// To add a new tab identified by code tabname1
157
-            //	'objecttype:+tabname1:Title1:langfile@titre:$user->rights->titre->read:/titre/mynewtab1.php?id=__ID__',
158
-            //	// To add another new tab identified by code tabname2
159
-            //	'objecttype:+tabname2:Title2:langfile@titre:$user->rights->othermodule->read:/titre/mynewtab2.php?id=__ID__',
160
-            //	// To remove an existing tab identified by code tabname
161
-            //	'objecttype:-tabname'
162
-        );
163
-        // where objecttype can be
164
-        // 'thirdparty'			to add a tab in third party view
165
-        // 'intervention'		to add a tab in intervention view
166
-        // 'order_supplier'		to add a tab in supplier order view
167
-        // 'invoice_supplier'	to add a tab in supplier invoice view
168
-        // 'invoice'			to add a tab in customer invoice view
169
-        // 'order'				to add a tab in customer order view
170
-        // 'product'			to add a tab in product view
171
-        // 'stock'				to add a tab in stock view
172
-        // 'propal'				to add a tab in propal view
173
-        // 'member'				to add a tab in fundation member view
174
-        // 'contract'			to add a tab in contract view
175
-        // 'user'				to add a tab in user view
176
-        // 'group'				to add a tab in group view
177
-        // 'contact'			to add a tab in contact view
178
-        // 'categories_x'		to add a tab in category view
179
-        // (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member)
180
-        // Dictionnaries
181
-        if (! isset($conf->subtotal->enabled)) {
182
-            $conf->subtotal=new stdClass();
183
-            $conf->subtotal->enabled = 0;
184
-        }
185
-        $this->dictionaries = array(
153
+		// Array to add new pages in new tabs
154
+		// Example:
155
+		$this->tabs = array(
156
+			//	// To add a new tab identified by code tabname1
157
+			//	'objecttype:+tabname1:Title1:langfile@titre:$user->rights->titre->read:/titre/mynewtab1.php?id=__ID__',
158
+			//	// To add another new tab identified by code tabname2
159
+			//	'objecttype:+tabname2:Title2:langfile@titre:$user->rights->othermodule->read:/titre/mynewtab2.php?id=__ID__',
160
+			//	// To remove an existing tab identified by code tabname
161
+			//	'objecttype:-tabname'
162
+		);
163
+		// where objecttype can be
164
+		// 'thirdparty'			to add a tab in third party view
165
+		// 'intervention'		to add a tab in intervention view
166
+		// 'order_supplier'		to add a tab in supplier order view
167
+		// 'invoice_supplier'	to add a tab in supplier invoice view
168
+		// 'invoice'			to add a tab in customer invoice view
169
+		// 'order'				to add a tab in customer order view
170
+		// 'product'			to add a tab in product view
171
+		// 'stock'				to add a tab in stock view
172
+		// 'propal'				to add a tab in propal view
173
+		// 'member'				to add a tab in fundation member view
174
+		// 'contract'			to add a tab in contract view
175
+		// 'user'				to add a tab in user view
176
+		// 'group'				to add a tab in group view
177
+		// 'contact'			to add a tab in contact view
178
+		// 'categories_x'		to add a tab in category view
179
+		// (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member)
180
+		// Dictionnaries
181
+		if (! isset($conf->subtotal->enabled)) {
182
+			$conf->subtotal=new stdClass();
183
+			$conf->subtotal->enabled = 0;
184
+		}
185
+		$this->dictionaries = array(
186 186
 			'langs'=>'subtotal@subtotal',
187
-            'tabname'=>array(MAIN_DB_PREFIX.'c_subtotal_free_text'),		// List of tables we want to see into dictonnary editor
188
-            'tablib'=>array($langs->trans('subtotalFreeLineDictionary')),													// Label of tables
189
-            '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
190
-            'tabsqlsort'=>array('label ASC'),																					// Sort order
191
-            'tabfield'=>array('label,content'),							// List of fields (result of select to show dictionary)
192
-            'tabfieldvalue'=>array('label,content'),						// List of fields (list of fields to edit a record)
193
-            'tabfieldinsert'=>array('label,content,entity'),					// List of fields (list of fields for insert)
194
-            'tabrowid'=>array('rowid'),											// Name of columns with primary key (try to always name it 'rowid')
195
-            'tabcond'=>array($conf->subtotal->enabled)	
187
+			'tabname'=>array(MAIN_DB_PREFIX.'c_subtotal_free_text'),		// List of tables we want to see into dictonnary editor
188
+			'tablib'=>array($langs->trans('subtotalFreeLineDictionary')),													// Label of tables
189
+			'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
190
+			'tabsqlsort'=>array('label ASC'),																					// Sort order
191
+			'tabfield'=>array('label,content'),							// List of fields (result of select to show dictionary)
192
+			'tabfieldvalue'=>array('label,content'),						// List of fields (list of fields to edit a record)
193
+			'tabfieldinsert'=>array('label,content,entity'),					// List of fields (list of fields for insert)
194
+			'tabrowid'=>array('rowid'),											// Name of columns with primary key (try to always name it 'rowid')
195
+			'tabcond'=>array($conf->subtotal->enabled)	
196 196
 		);
197
-        /* Example:
197
+		/* Example:
198 198
           // This is to avoid warnings
199 199
           if (! isset($conf->titre->enabled)) $conf->titre->enabled=0;
200 200
           $this->dictionnaries=array(
@@ -235,223 +235,223 @@  discard block
 block discarded – undo
235 235
           );
236 236
          */
237 237
 
238
-        // Boxes
239
-        // Add here list of php file(s) stored in core/boxes that contains class to show a box.
240
-        $this->boxes = array(); // Boxes list
238
+		// Boxes
239
+		// Add here list of php file(s) stored in core/boxes that contains class to show a box.
240
+		$this->boxes = array(); // Boxes list
241 241
        
242
-        /*
242
+		/*
243 243
           $this->boxes[$r][1] = "myboxb.php";
244 244
           $r++;
245 245
          */
246 246
 
247
-        // Permissions
248
-        $this->rights = array(); // Permission array used by this module
249
-        $r = 0;
247
+		// Permissions
248
+		$this->rights = array(); // Permission array used by this module
249
+		$r = 0;
250 250
 
251
-        // Add here list of permission defined by
252
-        // an id, a label, a boolean and two constant strings.
253
-        // Example:
254
-        //// Permission id (must not be already used)
255
-        //$this->rights[$r][0] = 2000;
256
-        //// Permission label
257
-        //$this->rights[$r][1] = 'Permision label';
258
-        //// Permission by default for new user (0/1)
259
-        //$this->rights[$r][3] = 1;
260
-        //// In php code, permission will be checked by test
261
-        //// if ($user->rights->permkey->level1->level2)
262
-        //$this->rights[$r][4] = 'level1';
263
-        //// In php code, permission will be checked by test
264
-        //// if ($user->rights->permkey->level1->level2)
265
-        //$this->rights[$r][5] = 'level2';
266
-        //$r++;
267
-        // Main menu entries
268
-        $this->menus = array(); // List of menus to add
269
-        $r = 0;
251
+		// Add here list of permission defined by
252
+		// an id, a label, a boolean and two constant strings.
253
+		// Example:
254
+		//// Permission id (must not be already used)
255
+		//$this->rights[$r][0] = 2000;
256
+		//// Permission label
257
+		//$this->rights[$r][1] = 'Permision label';
258
+		//// Permission by default for new user (0/1)
259
+		//$this->rights[$r][3] = 1;
260
+		//// In php code, permission will be checked by test
261
+		//// if ($user->rights->permkey->level1->level2)
262
+		//$this->rights[$r][4] = 'level1';
263
+		//// In php code, permission will be checked by test
264
+		//// if ($user->rights->permkey->level1->level2)
265
+		//$this->rights[$r][5] = 'level2';
266
+		//$r++;
267
+		// Main menu entries
268
+		$this->menus = array(); // List of menus to add
269
+		$r = 0;
270 270
 
271
-        // Add here entries to declare new menus
272
-        //
273
-        // Example to declare a new Top Menu entry and its Left menu entry:
274
-        //$this->menu[$r]=array(
275
-        //	// Put 0 if this is a top menu
276
-        //	'fk_menu'=>0,
277
-        //	// This is a Top menu entry
278
-        //	'type'=>'top',
279
-        //	'titre'=>'titre top menu',
280
-        //	'mainmenu'=>'titre',
281
-        //	'leftmenu'=>'titre',
282
-        //	'url'=>'/titre/pagetop.php',
283
-        //	// Lang file to use (without .lang) by module.
284
-        //	// File must be in langs/code_CODE/ directory.
285
-        //	'langs'=>'mylangfile',
286
-        //	'position'=>100,
287
-        //	// Define condition to show or hide menu entry.
288
-        //	// Use '$conf->titre->enabled' if entry must be visible if module is enabled.
289
-        //	'enabled'=>'$conf->titre->enabled',
290
-        //	// Use 'perms'=>'$user->rights->titre->level1->level2'
291
-        //	// if you want your menu with a permission rules
292
-        //	'perms'=>'1',
293
-        //	'target'=>'',
294
-        //	// 0=Menu for internal users, 1=external users, 2=both
295
-        //	'user'=>2
296
-        //);
297
-        //$r++;
298
-        //$this->menu[$r]=array(
299
-        //	// Use r=value where r is index key used for the parent menu entry
300
-        //	// (higher parent must be a top menu entry)
301
-        //	'fk_menu'=>'r=0',
302
-        //	// This is a Left menu entry
303
-        //	'type'=>'left',
304
-        //	'titre'=>'titre left menu',
305
-        //	'mainmenu'=>'titre',
306
-        //	'leftmenu'=>'titre',
307
-        //	'url'=>'/titre/pagelevel1.php',
308
-        //	// Lang file to use (without .lang) by module.
309
-        //	// File must be in langs/code_CODE/ directory.
310
-        //	'langs'=>'mylangfile',
311
-        //	'position'=>100,
312
-        //	// Define condition to show or hide menu entry.
313
-        //	// Use '$conf->titre->enabled' if entry must be visible if module is enabled.
314
-        //	'enabled'=>'$conf->titre->enabled',
315
-        //	// Use 'perms'=>'$user->rights->titre->level1->level2'
316
-        //	// if you want your menu with a permission rules
317
-        //	'perms'=>'1',
318
-        //	'target'=>'',
319
-        //	// 0=Menu for internal users, 1=external users, 2=both
320
-        //	'user'=>2
321
-        //);
322
-        //$r++;
323
-        //
324
-        // Example to declare a Left Menu entry into an existing Top menu entry:
325
-        //$this->menu[$r]=array(
326
-        //	// Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy'
327
-        //	'fk_menu'=>'fk_mainmenu=mainmenucode',
328
-        //	// This is a Left menu entry
329
-        //	'type'=>'left',
330
-        //	'titre'=>'titre left menu',
331
-        //	'mainmenu'=>'mainmenucode',
332
-        //	'leftmenu'=>'titre',
333
-        //	'url'=>'/titre/pagelevel2.php',
334
-        //	// Lang file to use (without .lang) by module.
335
-        //	// File must be in langs/code_CODE/ directory.
336
-        //	'langs'=>'mylangfile',
337
-        //	'position'=>100,
338
-        //	// Define condition to show or hide menu entry.
339
-        //	// Use '$conf->titre->enabled' if entry must be visible if module is enabled.
340
-        //	// Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
341
-        //	'enabled'=>'$conf->titre->enabled',
342
-        //	// Use 'perms'=>'$user->rights->titre->level1->level2'
343
-        //	// if you want your menu with a permission rules
344
-        //	'perms'=>'1',
345
-        //	'target'=>'',
346
-        //	// 0=Menu for internal users, 1=external users, 2=both
347
-        //	'user'=>2
348
-        //);
349
-        //$r++;
350
-        // Exports
351
-        $r = 1;
271
+		// Add here entries to declare new menus
272
+		//
273
+		// Example to declare a new Top Menu entry and its Left menu entry:
274
+		//$this->menu[$r]=array(
275
+		//	// Put 0 if this is a top menu
276
+		//	'fk_menu'=>0,
277
+		//	// This is a Top menu entry
278
+		//	'type'=>'top',
279
+		//	'titre'=>'titre top menu',
280
+		//	'mainmenu'=>'titre',
281
+		//	'leftmenu'=>'titre',
282
+		//	'url'=>'/titre/pagetop.php',
283
+		//	// Lang file to use (without .lang) by module.
284
+		//	// File must be in langs/code_CODE/ directory.
285
+		//	'langs'=>'mylangfile',
286
+		//	'position'=>100,
287
+		//	// Define condition to show or hide menu entry.
288
+		//	// Use '$conf->titre->enabled' if entry must be visible if module is enabled.
289
+		//	'enabled'=>'$conf->titre->enabled',
290
+		//	// Use 'perms'=>'$user->rights->titre->level1->level2'
291
+		//	// if you want your menu with a permission rules
292
+		//	'perms'=>'1',
293
+		//	'target'=>'',
294
+		//	// 0=Menu for internal users, 1=external users, 2=both
295
+		//	'user'=>2
296
+		//);
297
+		//$r++;
298
+		//$this->menu[$r]=array(
299
+		//	// Use r=value where r is index key used for the parent menu entry
300
+		//	// (higher parent must be a top menu entry)
301
+		//	'fk_menu'=>'r=0',
302
+		//	// This is a Left menu entry
303
+		//	'type'=>'left',
304
+		//	'titre'=>'titre left menu',
305
+		//	'mainmenu'=>'titre',
306
+		//	'leftmenu'=>'titre',
307
+		//	'url'=>'/titre/pagelevel1.php',
308
+		//	// Lang file to use (without .lang) by module.
309
+		//	// File must be in langs/code_CODE/ directory.
310
+		//	'langs'=>'mylangfile',
311
+		//	'position'=>100,
312
+		//	// Define condition to show or hide menu entry.
313
+		//	// Use '$conf->titre->enabled' if entry must be visible if module is enabled.
314
+		//	'enabled'=>'$conf->titre->enabled',
315
+		//	// Use 'perms'=>'$user->rights->titre->level1->level2'
316
+		//	// if you want your menu with a permission rules
317
+		//	'perms'=>'1',
318
+		//	'target'=>'',
319
+		//	// 0=Menu for internal users, 1=external users, 2=both
320
+		//	'user'=>2
321
+		//);
322
+		//$r++;
323
+		//
324
+		// Example to declare a Left Menu entry into an existing Top menu entry:
325
+		//$this->menu[$r]=array(
326
+		//	// Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy'
327
+		//	'fk_menu'=>'fk_mainmenu=mainmenucode',
328
+		//	// This is a Left menu entry
329
+		//	'type'=>'left',
330
+		//	'titre'=>'titre left menu',
331
+		//	'mainmenu'=>'mainmenucode',
332
+		//	'leftmenu'=>'titre',
333
+		//	'url'=>'/titre/pagelevel2.php',
334
+		//	// Lang file to use (without .lang) by module.
335
+		//	// File must be in langs/code_CODE/ directory.
336
+		//	'langs'=>'mylangfile',
337
+		//	'position'=>100,
338
+		//	// Define condition to show or hide menu entry.
339
+		//	// Use '$conf->titre->enabled' if entry must be visible if module is enabled.
340
+		//	// Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
341
+		//	'enabled'=>'$conf->titre->enabled',
342
+		//	// Use 'perms'=>'$user->rights->titre->level1->level2'
343
+		//	// if you want your menu with a permission rules
344
+		//	'perms'=>'1',
345
+		//	'target'=>'',
346
+		//	// 0=Menu for internal users, 1=external users, 2=both
347
+		//	'user'=>2
348
+		//);
349
+		//$r++;
350
+		// Exports
351
+		$r = 1;
352 352
 
353
-        // Example:
354
-        //$this->export_code[$r]=$this->rights_class.'_'.$r;
355
-        //// Translation key (used only if key ExportDataset_xxx_z not found)
356
-        //$this->export_label[$r]='CustomersInvoicesAndInvoiceLines';
357
-        //// Condition to show export in list (ie: '$user->id==3').
358
-        //// Set to 1 to always show when module is enabled.
359
-        //$this->export_enabled[$r]='1';
360
-        //$this->export_permission[$r]=array(array("facture","facture","export"));
361
-        //$this->export_fields_array[$r]=array(
362
-        //	's.rowid'=>"IdCompany",
363
-        //	's.nom'=>'CompanyName',
364
-        //	's.address'=>'Address',
365
-        //	's.cp'=>'Zip',
366
-        //	's.ville'=>'Town',
367
-        //	's.fk_pays'=>'Country',
368
-        //	's.tel'=>'Phone',
369
-        //	's.siren'=>'ProfId1',
370
-        //	's.siret'=>'ProfId2',
371
-        //	's.ape'=>'ProfId3',
372
-        //	's.idprof4'=>'ProfId4',
373
-        //	's.code_compta'=>'CustomerAccountancyCode',
374
-        //	's.code_compta_fournisseur'=>'SupplierAccountancyCode',
375
-        //	'f.rowid'=>"InvoiceId",
376
-        //	'f.facnumber'=>"InvoiceRef",
377
-        //	'f.datec'=>"InvoiceDateCreation",
378
-        //	'f.datef'=>"DateInvoice",
379
-        //	'f.total'=>"TotalHT",
380
-        //	'f.total_ttc'=>"TotalTTC",
381
-        //	'f.tva'=>"TotalVAT",
382
-        //	'f.paye'=>"InvoicePaid",
383
-        //	'f.fk_statut'=>'InvoiceStatus',
384
-        //	'f.note'=>"InvoiceNote",
385
-        //	'fd.rowid'=>'LineId',
386
-        //	'fd.description'=>"LineDescription",
387
-        //	'fd.price'=>"LineUnitPrice",
388
-        //	'fd.tva_tx'=>"LineVATRate",
389
-        //	'fd.qty'=>"LineQty",
390
-        //	'fd.total_ht'=>"LineTotalHT",
391
-        //	'fd.total_tva'=>"LineTotalTVA",
392
-        //	'fd.total_ttc'=>"LineTotalTTC",
393
-        //	'fd.date_start'=>"DateStart",
394
-        //	'fd.date_end'=>"DateEnd",
395
-        //	'fd.fk_product'=>'ProductId',
396
-        //	'p.ref'=>'ProductRef'
397
-        //);
398
-        //$this->export_entities_array[$r]=array('s.rowid'=>"company",
399
-        //	's.nom'=>'company',
400
-        //	's.address'=>'company',
401
-        //	's.cp'=>'company',
402
-        //	's.ville'=>'company',
403
-        //	's.fk_pays'=>'company',
404
-        //	's.tel'=>'company',
405
-        //	's.siren'=>'company',
406
-        //	's.siret'=>'company',
407
-        //	's.ape'=>'company',
408
-        //	's.idprof4'=>'company',
409
-        //	's.code_compta'=>'company',
410
-        //	's.code_compta_fournisseur'=>'company',
411
-        //	'f.rowid'=>"invoice",
412
-        //	'f.facnumber'=>"invoice",
413
-        //	'f.datec'=>"invoice",
414
-        //	'f.datef'=>"invoice",
415
-        //	'f.total'=>"invoice",
416
-        //	'f.total_ttc'=>"invoice",
417
-        //	'f.tva'=>"invoice",
418
-        //	'f.paye'=>"invoice",
419
-        //	'f.fk_statut'=>'invoice',
420
-        //	'f.note'=>"invoice",
421
-        //	'fd.rowid'=>'invoice_line',
422
-        //	'fd.description'=>"invoice_line",
423
-        //	'fd.price'=>"invoice_line",
424
-        //	'fd.total_ht'=>"invoice_line",
425
-        //	'fd.total_tva'=>"invoice_line",
426
-        //	'fd.total_ttc'=>"invoice_line",
427
-        //	'fd.tva_tx'=>"invoice_line",
428
-        //	'fd.qty'=>"invoice_line",
429
-        //	'fd.date_start'=>"invoice_line",
430
-        //	'fd.date_end'=>"invoice_line",
431
-        //	'fd.fk_product'=>'product',
432
-        //	'p.ref'=>'product'
433
-        //);
434
-        //$this->export_sql_start[$r] = 'SELECT DISTINCT ';
435
-        //$this->export_sql_end[$r] = ' FROM (' . MAIN_DB_PREFIX . 'facture as f, '
436
-        //	. MAIN_DB_PREFIX . 'facturedet as fd, ' . MAIN_DB_PREFIX . 'societe as s)';
437
-        //$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX
438
-        //	. 'product as p on (fd.fk_product = p.rowid)';
439
-        //$this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid '
440
-        //	. 'AND f.rowid = fd.fk_facture';
441
-        //$r++;
442
-    }
353
+		// Example:
354
+		//$this->export_code[$r]=$this->rights_class.'_'.$r;
355
+		//// Translation key (used only if key ExportDataset_xxx_z not found)
356
+		//$this->export_label[$r]='CustomersInvoicesAndInvoiceLines';
357
+		//// Condition to show export in list (ie: '$user->id==3').
358
+		//// Set to 1 to always show when module is enabled.
359
+		//$this->export_enabled[$r]='1';
360
+		//$this->export_permission[$r]=array(array("facture","facture","export"));
361
+		//$this->export_fields_array[$r]=array(
362
+		//	's.rowid'=>"IdCompany",
363
+		//	's.nom'=>'CompanyName',
364
+		//	's.address'=>'Address',
365
+		//	's.cp'=>'Zip',
366
+		//	's.ville'=>'Town',
367
+		//	's.fk_pays'=>'Country',
368
+		//	's.tel'=>'Phone',
369
+		//	's.siren'=>'ProfId1',
370
+		//	's.siret'=>'ProfId2',
371
+		//	's.ape'=>'ProfId3',
372
+		//	's.idprof4'=>'ProfId4',
373
+		//	's.code_compta'=>'CustomerAccountancyCode',
374
+		//	's.code_compta_fournisseur'=>'SupplierAccountancyCode',
375
+		//	'f.rowid'=>"InvoiceId",
376
+		//	'f.facnumber'=>"InvoiceRef",
377
+		//	'f.datec'=>"InvoiceDateCreation",
378
+		//	'f.datef'=>"DateInvoice",
379
+		//	'f.total'=>"TotalHT",
380
+		//	'f.total_ttc'=>"TotalTTC",
381
+		//	'f.tva'=>"TotalVAT",
382
+		//	'f.paye'=>"InvoicePaid",
383
+		//	'f.fk_statut'=>'InvoiceStatus',
384
+		//	'f.note'=>"InvoiceNote",
385
+		//	'fd.rowid'=>'LineId',
386
+		//	'fd.description'=>"LineDescription",
387
+		//	'fd.price'=>"LineUnitPrice",
388
+		//	'fd.tva_tx'=>"LineVATRate",
389
+		//	'fd.qty'=>"LineQty",
390
+		//	'fd.total_ht'=>"LineTotalHT",
391
+		//	'fd.total_tva'=>"LineTotalTVA",
392
+		//	'fd.total_ttc'=>"LineTotalTTC",
393
+		//	'fd.date_start'=>"DateStart",
394
+		//	'fd.date_end'=>"DateEnd",
395
+		//	'fd.fk_product'=>'ProductId',
396
+		//	'p.ref'=>'ProductRef'
397
+		//);
398
+		//$this->export_entities_array[$r]=array('s.rowid'=>"company",
399
+		//	's.nom'=>'company',
400
+		//	's.address'=>'company',
401
+		//	's.cp'=>'company',
402
+		//	's.ville'=>'company',
403
+		//	's.fk_pays'=>'company',
404
+		//	's.tel'=>'company',
405
+		//	's.siren'=>'company',
406
+		//	's.siret'=>'company',
407
+		//	's.ape'=>'company',
408
+		//	's.idprof4'=>'company',
409
+		//	's.code_compta'=>'company',
410
+		//	's.code_compta_fournisseur'=>'company',
411
+		//	'f.rowid'=>"invoice",
412
+		//	'f.facnumber'=>"invoice",
413
+		//	'f.datec'=>"invoice",
414
+		//	'f.datef'=>"invoice",
415
+		//	'f.total'=>"invoice",
416
+		//	'f.total_ttc'=>"invoice",
417
+		//	'f.tva'=>"invoice",
418
+		//	'f.paye'=>"invoice",
419
+		//	'f.fk_statut'=>'invoice',
420
+		//	'f.note'=>"invoice",
421
+		//	'fd.rowid'=>'invoice_line',
422
+		//	'fd.description'=>"invoice_line",
423
+		//	'fd.price'=>"invoice_line",
424
+		//	'fd.total_ht'=>"invoice_line",
425
+		//	'fd.total_tva'=>"invoice_line",
426
+		//	'fd.total_ttc'=>"invoice_line",
427
+		//	'fd.tva_tx'=>"invoice_line",
428
+		//	'fd.qty'=>"invoice_line",
429
+		//	'fd.date_start'=>"invoice_line",
430
+		//	'fd.date_end'=>"invoice_line",
431
+		//	'fd.fk_product'=>'product',
432
+		//	'p.ref'=>'product'
433
+		//);
434
+		//$this->export_sql_start[$r] = 'SELECT DISTINCT ';
435
+		//$this->export_sql_end[$r] = ' FROM (' . MAIN_DB_PREFIX . 'facture as f, '
436
+		//	. MAIN_DB_PREFIX . 'facturedet as fd, ' . MAIN_DB_PREFIX . 'societe as s)';
437
+		//$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX
438
+		//	. 'product as p on (fd.fk_product = p.rowid)';
439
+		//$this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid '
440
+		//	. 'AND f.rowid = fd.fk_facture';
441
+		//$r++;
442
+	}
443 443
 
444
-    /**
445
-     * Function called when module is enabled.
446
-     * The init function add constants, boxes, permissions and menus
447
-     * (defined in constructor) into Dolibarr database.
448
-     * It also creates data directories
449
-     *
450
-     * 	@param		string	$options	Options when enabling module ('', 'noboxes')
451
-     * 	@return		int					1 if OK, 0 if KO
452
-     */
453
-    public function init($options = '')
454
-    {
444
+	/**
445
+	 * Function called when module is enabled.
446
+	 * The init function add constants, boxes, permissions and menus
447
+	 * (defined in constructor) into Dolibarr database.
448
+	 * It also creates data directories
449
+	 *
450
+	 * 	@param		string	$options	Options when enabling module ('', 'noboxes')
451
+	 * 	@return		int					1 if OK, 0 if KO
452
+	 */
453
+	public function init($options = '')
454
+	{
455 455
 	  	global $conf;
456 456
 		
457 457
 		
@@ -459,39 +459,39 @@  discard block
 block discarded – undo
459 459
 			exit("Attention, ce module rentre ne conflit avec le module Jalon/Milestones. Merci de le désactiver auparavant.");
460 460
 		}
461 461
       */
462
-	    $sql = array();
462
+		$sql = array();
463 463
 
464
-        $result = $this->loadTables();
464
+		$result = $this->loadTables();
465 465
 
466 466
 		
467
-        return $this->_init($sql, $options);
468
-    }
467
+		return $this->_init($sql, $options);
468
+	}
469 469
 
470
-    /**
471
-     * Function called when module is disabled.
472
-     * Remove from database constants, boxes and permissions from Dolibarr database.
473
-     * Data directories are not deleted
474
-     *
475
-     * 	@param		string	$options	Options when enabling module ('', 'noboxes')
476
-     * 	@return		int					1 if OK, 0 if KO
477
-     */
478
-    public function remove($options = '')
479
-    {
480
-        $sql = array();
470
+	/**
471
+	 * Function called when module is disabled.
472
+	 * Remove from database constants, boxes and permissions from Dolibarr database.
473
+	 * Data directories are not deleted
474
+	 *
475
+	 * 	@param		string	$options	Options when enabling module ('', 'noboxes')
476
+	 * 	@return		int					1 if OK, 0 if KO
477
+	 */
478
+	public function remove($options = '')
479
+	{
480
+		$sql = array();
481 481
 
482
-        return $this->_remove($sql, $options);
483
-    }
482
+		return $this->_remove($sql, $options);
483
+	}
484 484
 
485
-    /**
486
-     * Create tables, keys and data required by module
487
-     * Files llx_table1.sql, llx_table1.key.sql llx_data.sql with create table, create keys
488
-     * and create data commands must be stored in directory /titre/sql/
489
-     * This function is called by this->init
490
-     *
491
-     * 	@return		int		<=0 if KO, >0 if OK
492
-     */
493
-    private function loadTables()
494
-    {
495
-        return $this->_load_tables('/subtotal/sql/');
496
-    }
485
+	/**
486
+	 * Create tables, keys and data required by module
487
+	 * Files llx_table1.sql, llx_table1.key.sql llx_data.sql with create table, create keys
488
+	 * and create data commands must be stored in directory /titre/sql/
489
+	 * This function is called by this->init
490
+	 *
491
+	 * 	@return		int		<=0 if KO, >0 if OK
492
+	 */
493
+	private function loadTables()
494
+	{
495
+		return $this->_load_tables('/subtotal/sql/');
496
+	}
497 497
 }
Please login to merge, or discard this patch.
class/actions_subtotal.class.php 1 patch
Indentation   +226 added lines, -226 removed lines patch added patch discarded remove patch
@@ -81,11 +81,11 @@  discard block
 block discarded – undo
81 81
 	 * @return     void
82 82
 	 */
83 83
     
84
-    var $module_number = 104777;
84
+	var $module_number = 104777;
85 85
     
86
-    function formObjectOptions($parameters, &$object, &$action, $hookmanager) 
87
-    {
88
-      	global $langs,$db,$user, $conf;
86
+	function formObjectOptions($parameters, &$object, &$action, $hookmanager) 
87
+	{
88
+	  	global $langs,$db,$user, $conf;
89 89
 		
90 90
 		$langs->load('subtotal@subtotal');
91 91
 		
@@ -100,10 +100,10 @@  discard block
 block discarded – undo
100 100
 				$createRight = $user->rights->facture->creer;
101 101
 			} elseif($object->element == 'order_supplier' )
102 102
 			{
103
-			    $createRight = $user->rights->fournisseur->commande->creer;
103
+				$createRight = $user->rights->fournisseur->commande->creer;
104 104
 			} elseif($object->element == 'invoice_supplier' )
105 105
 			{
106
-			    $createRight = $user->rights->fournisseur->facture->creer;
106
+				$createRight = $user->rights->fournisseur->facture->creer;
107 107
 			}
108 108
 			
109 109
 			if ($object->statut == 0  && $createRight) {
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 					
154 154
 					if (!empty($conf->global->SUBTOTAL_AUTO_ADD_SUBTOTAL_ON_ADDING_NEW_TITLE) && $qty < 10) TSubtotal::addSubtotalMissing($object, $qty);
155 155
 					
156
-	    			TSubtotal::addSubTotalLine($object, $title, $qty);
156
+					TSubtotal::addSubTotalLine($object, $title, $qty);
157 157
 				}
158 158
 				else if($action==='ask_deleteallline') {
159 159
 						$form=new Form($db);
@@ -375,36 +375,36 @@  discard block
 block discarded – undo
375 375
 		$TContext = explode(':',$parameters['context']);
376 376
 		if (
377 377
 				in_array('invoicecard',$TContext)
378
-		        || in_array('invoicesuppliercard',$TContext)
378
+				|| in_array('invoicesuppliercard',$TContext)
379 379
 				|| in_array('propalcard',$TContext)
380 380
 				|| in_array('ordercard',$TContext)
381
-		        || in_array('ordersuppliercard',$TContext)
381
+				|| in_array('ordersuppliercard',$TContext)
382 382
 				|| in_array('invoicereccard',$TContext)
383 383
 			)
384
-	        {	
385
-	            $hideInnerLines	= isset( $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] ) ?  $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] : 0;
386
-	            $hidedetails	= isset( $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] ) ?  $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] : 0;
384
+			{	
385
+				$hideInnerLines	= isset( $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] ) ?  $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] : 0;
386
+				$hidedetails	= isset( $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] ) ?  $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] : 0;
387 387
 				$hidepricesDefaultConf = !empty($conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED)?$conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED:0;
388 388
 				$hideprices= isset( $_SESSION['subtotal_hideprices_'.$parameters['modulepart']][$object->id] ) ?  $_SESSION['subtotal_hideprices_'.$parameters['modulepart']][$object->id] : $hidepricesDefaultConf;
389 389
 				
390 390
 				$var=false;
391
-		     	$out.= '<tr '.$bc[$var].'>
391
+			 	$out.= '<tr '.$bc[$var].'>
392 392
 		     			<td colspan="4" align="right">
393 393
 		     				<label for="hideInnerLines">'.$langs->trans('HideInnerLines').'</label>
394 394
 		     				<input type="checkbox" onclick="if($(this).is(\':checked\')) { $(\'#hidedetails\').prop(\'checked\', \'checked\')  }" id="hideInnerLines" name="hideInnerLines" value="1" '.(( $hideInnerLines ) ? 'checked="checked"' : '' ).' />
395 395
 		     			</td>
396 396
 		     			</tr>';
397 397
 				
398
-		     	$var=!$var;
399
-		     	$out.= '<tr '.$bc[$var].'>
398
+			 	$var=!$var;
399
+			 	$out.= '<tr '.$bc[$var].'>
400 400
 		     			<td colspan="4" align="right">
401 401
 		     				<label for="hidedetails">'.$langs->trans('SubTotalhidedetails').'</label>
402 402
 		     				<input type="checkbox" id="hidedetails" name="hidedetails" value="1" '.(( $hidedetails ) ? 'checked="checked"' : '' ).' />
403 403
 		     			</td>
404 404
 		     			</tr>';
405 405
 		     	
406
-		     	$var=!$var;
407
-		     	$out.= '<tr '.$bc[$var].'>
406
+			 	$var=!$var;
407
+			 	$out.= '<tr '.$bc[$var].'>
408 408
 		     			<td colspan="4" align="right">
409 409
 		     				<label for="hideprices">'.$langs->trans('SubTotalhidePrice').'</label>
410 410
 		     				<input type="checkbox" id="hideprices" name="hideprices" value="1" '.(( $hideprices ) ? 'checked="checked"' : '' ).' />
@@ -416,9 +416,9 @@  discard block
 block discarded – undo
416 416
 				if ( 
417 417
 					(in_array('propalcard',$TContext) && !empty($conf->global->SUBTOTAL_PROPAL_ADD_RECAP))
418 418
 					|| (in_array('ordercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP))
419
-				    || (in_array('ordersuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP))
419
+					|| (in_array('ordersuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP))
420 420
 					|| (in_array('invoicecard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP))
421
-				    || (in_array('invoicesuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP))
421
+					|| (in_array('invoicesuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP))
422 422
 					|| (in_array('invoicereccard',$TContext)  && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP ))
423 423
 				)
424 424
 				{
@@ -437,19 +437,19 @@  discard block
 block discarded – undo
437 437
 			}
438 438
 			
439 439
 		
440
-        return 1;
440
+		return 1;
441 441
 	} 
442 442
 	 
443
-    function formEditProductOptions($parameters, &$object, &$action, $hookmanager) 
444
-    {
443
+	function formEditProductOptions($parameters, &$object, &$action, $hookmanager) 
444
+	{
445 445
 		
446
-    	if (in_array('invoicecard',explode(':',$parameters['context'])))
447
-        {
446
+		if (in_array('invoicecard',explode(':',$parameters['context'])))
447
+		{
448 448
         	
449
-        }
449
+		}
450 450
 		
451
-        return 0;
452
-    }
451
+		return 0;
452
+	}
453 453
 	
454 454
 	function ODTSubstitutionLine(&$parameters, &$object, $action, $hookmanager) {
455 455
 		global $conf;
@@ -498,11 +498,11 @@  discard block
 block discarded – undo
498 498
 	
499 499
 		if (
500 500
 				in_array('invoicecard',explode(':',$parameters['context']))
501
-		        || in_array('invoicesuppliercard',explode(':',$parameters['context']))
501
+				|| in_array('invoicesuppliercard',explode(':',$parameters['context']))
502 502
 				|| in_array('propalcard',explode(':',$parameters['context']))
503
-		        || in_array('supplier_proposalcard',explode(':',$parameters['context']))
503
+				|| in_array('supplier_proposalcard',explode(':',$parameters['context']))
504 504
 				|| in_array('ordercard',explode(':',$parameters['context']))
505
-		        || in_array('ordersuppliercard',explode(':',$parameters['context']))
505
+				|| in_array('ordersuppliercard',explode(':',$parameters['context']))
506 506
 				|| in_array('invoicereccard',explode(':',$parameters['context']))
507 507
 		) {
508 508
 			
@@ -581,20 +581,20 @@  discard block
 block discarded – undo
581 581
 				in_array('invoicecard',explode(':',$parameters['context']))
582 582
 				|| in_array('propalcard',explode(':',$parameters['context']))
583 583
 				|| in_array('ordercard',explode(':',$parameters['context']))
584
-			    || in_array('ordersuppliercard',explode(':',$parameters['context']))
585
-			    || in_array('invoicesuppliercard',explode(':',$parameters['context']))
586
-			    || in_array('supplier_proposalcard',explode(':',$parameters['context']))
584
+				|| in_array('ordersuppliercard',explode(':',$parameters['context']))
585
+				|| in_array('invoicesuppliercard',explode(':',$parameters['context']))
586
+				|| in_array('supplier_proposalcard',explode(':',$parameters['context']))
587 587
 			)
588
-	        {								
588
+			{								
589 589
 				if(in_array('invoicecard',explode(':',$parameters['context']))) {
590 590
 					$sessname = 'subtotal_hideInnerLines_facture';	
591 591
 					$sessname2 = 'subtotal_hidedetails_facture';
592 592
 					$sessname3 = 'subtotal_hideprices_facture';
593 593
 				}
594 594
 				elseif(in_array('invoicesuppliercard',explode(':',$parameters['context']))) {
595
-				    $sessname = 'subtotal_hideInnerLines_facture_fournisseur';
596
-				    $sessname2 = 'subtotal_hidedetails_facture_fournisseur';
597
-				    $sessname3 = 'subtotal_hideprices_facture_fournisseur';
595
+					$sessname = 'subtotal_hideInnerLines_facture_fournisseur';
596
+					$sessname2 = 'subtotal_hidedetails_facture_fournisseur';
597
+					$sessname3 = 'subtotal_hideprices_facture_fournisseur';
598 598
 				}
599 599
 				elseif(in_array('propalcard',explode(':',$parameters['context']))) {
600 600
 					$sessname = 'subtotal_hideInnerLines_propal';
@@ -602,9 +602,9 @@  discard block
 block discarded – undo
602 602
 					$sessname3 = 'subtotal_hideprices_propal';
603 603
 				}
604 604
 				elseif(in_array('supplier_proposalcard',explode(':',$parameters['context']))) {
605
-				    $sessname = 'subtotal_hideInnerLines_supplier_proposal';
606
-				    $sessname2 = 'subtotal_hidedetails_supplier_proposal';
607
-				    $sessname3 = 'subtotal_hideprices_supplier_proposal';
605
+					$sessname = 'subtotal_hideInnerLines_supplier_proposal';
606
+					$sessname2 = 'subtotal_hidedetails_supplier_proposal';
607
+					$sessname3 = 'subtotal_hideprices_supplier_proposal';
608 608
 				}
609 609
 				elseif(in_array('ordercard',explode(':',$parameters['context']))) {
610 610
 					$sessname = 'subtotal_hideInnerLines_commande';
@@ -612,9 +612,9 @@  discard block
 block discarded – undo
612 612
 					$sessname3 = 'subtotal_hideprices_commande';
613 613
 				}
614 614
 				elseif(in_array('ordersuppliercard',explode(':',$parameters['context']))) {
615
-				    $sessname = 'subtotal_hideInnerLines_commande_fournisseur';
616
-				    $sessname2 = 'subtotal_hidedetails_commande_fournisseur';
617
-				    $sessname3 = 'subtotal_hideprices_commande_fournisseur';
615
+					$sessname = 'subtotal_hideInnerLines_commande_fournisseur';
616
+					$sessname2 = 'subtotal_hidedetails_commande_fournisseur';
617
+					$sessname3 = 'subtotal_hideprices_commande_fournisseur';
618 618
 				}
619 619
 				else {
620 620
 					$sessname = 'subtotal_hideInnerLines_unknown';
@@ -639,17 +639,17 @@  discard block
 block discarded – undo
639 639
 				foreach($object->lines as &$line) {
640 640
 					if ($line->product_type == 9 && $line->special_code == $this->module_number) {
641 641
 					    
642
-                        if($line->qty>=90) {
643
-                            $line->modsubtotal_total = 1;
644
-                        }
645
-                        else{
646
-                            $line->modsubtotal_title = 1;
647
-                        }
642
+						if($line->qty>=90) {
643
+							$line->modsubtotal_total = 1;
644
+						}
645
+						else{
646
+							$line->modsubtotal_title = 1;
647
+						}
648 648
                         
649 649
 						$line->total_ht = $this->getTotalLineFromObject($object, $line, '');
650 650
 					}
651
-	        	}
652
-	        }
651
+				}
652
+			}
653 653
 			
654 654
 		}
655 655
 		else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') {
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
 				 */
667 667
 				else if($object->element=='invoice_supplier')
668 668
 				{
669
-				    $object->deleteline($idLine);
669
+					$object->deleteline($idLine);
670 670
 				}
671 671
 				/**
672 672
 				 * @var $object Propal
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
 				 */
690 690
 				else if($object->element=='order_supplier')
691 691
 				{
692
-				    $object->deleteline($idLine);
692
+					$object->deleteline($idLine);
693 693
 				}
694 694
 				/**
695 695
 				 * @var $object Facturerec
@@ -733,7 +733,7 @@  discard block
 block discarded – undo
733 733
 		
734 734
 		foreach($object->lines as $l) {
735 735
 		
736
-		    $lid = (!empty($l->rowid) ? $l->rowid : $l->id);
736
+			$lid = (!empty($l->rowid) ? $l->rowid : $l->id);
737 737
 			if($lid == $lineid) {
738 738
 
739 739
 				$found = true;
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
 			
743 743
 			if($found) {
744 744
 				
745
-			    $Tab[] = (!empty($l->rowid) ? $l->rowid : $l->id);
745
+				$Tab[] = (!empty($l->rowid) ? $l->rowid : $l->id);
746 746
 				
747 747
 				if($l->special_code==$this->module_number && (($l->qty==99 && $qty_line==1) || ($l->qty==98 && $qty_line==2))   ) {
748 748
 					break; // end of story
@@ -821,17 +821,17 @@  discard block
 block discarded – undo
821 821
 			if($l->rang>=$rang) {
822 822
 				return price($total);
823 823
 			}
824
-                        if (TSubtotal::isSubtotal($l)){
825
-                            $total = 0;
826
-                        } else  if ($l->situation_percent > 0 ){
824
+						if (TSubtotal::isSubtotal($l)){
825
+							$total = 0;
826
+						} else  if ($l->situation_percent > 0 ){
827 827
                            
828 828
         	
829 829
 		 	$prev_progress = $l->get_prev_progress($object->id);
830 830
 		 	$progress = ($l->situation_percent - $prev_progress) /100;
831
-                        $total += ($l->total_ht/($l->situation_percent/100)) * $progress;
831
+						$total += ($l->total_ht/($l->situation_percent/100)) * $progress;
832 832
                         
833
-                    }
834
-                }
833
+					}
834
+				}
835 835
                 
836 836
 		return price($total);
837 837
 	}
@@ -863,7 +863,7 @@  discard block
 block discarded – undo
863 863
 		if(method_exists('Closure','bind')) {
864 864
 			$pageBreakOriginalValue = $pdf->AcceptPageBreak();
865 865
 			$sweetsThief = function ($pdf) {
866
-		    		return $pdf->bMargin ;
866
+					return $pdf->bMargin ;
867 867
 			};
868 868
 			$sweetsThief = Closure::bind($sweetsThief, null, $pdf);
869 869
 	
@@ -926,11 +926,11 @@  discard block
 block discarded – undo
926 926
 				else
927 927
 				{
928 928
 					list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1);
929
-                                        if(get_class($object) == 'Facture' && $object->type==Facture::TYPE_SITUATION){//Facture de situation
930
-                                                $total_to_print = $this->getTotalToPrintSituation($object, $line);
931
-                                        } else {
932
-                                            	$total_to_print = price($total);
933
-                                        }
929
+										if(get_class($object) == 'Facture' && $object->type==Facture::TYPE_SITUATION){//Facture de situation
930
+												$total_to_print = $this->getTotalToPrintSituation($object, $line);
931
+										} else {
932
+												$total_to_print = price($total);
933
+										}
934 934
                                             
935 935
 					$line->total_ht = $total;
936 936
 					$line->total = $total;
@@ -1081,7 +1081,7 @@  discard block
 block discarded – undo
1081 1081
 	}
1082 1082
 	
1083 1083
 	function pdf_getlinetotalexcltax($parameters=array(), &$object, &$action='') {
1084
-	    global $conf, $hideprices, $hookmanager;
1084
+		global $conf, $hideprices, $hookmanager;
1085 1085
 		
1086 1086
 		if(is_array($parameters)) $i = & $parameters['i'];
1087 1087
 		else $i = (int)$parameters;
@@ -1120,7 +1120,7 @@  discard block
 block discarded – undo
1120 1120
 			}
1121 1121
 		}
1122 1122
 		if ((int)GETPOST('hideInnerLines') && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)){
1123
-		    $this->resprints = price($object->lines[$i]->total_ht);
1123
+			$this->resprints = price($object->lines[$i]->total_ht);
1124 1124
 		}
1125 1125
 		
1126 1126
 		// Si la gestion C/NC est active et que je suis sur un ligne dont l'extrafield est coché
@@ -1249,7 +1249,7 @@  discard block
 block discarded – undo
1249 1249
 	}
1250 1250
 	
1251 1251
 	function pdf_getlineupexcltax($parameters=array(), &$object, &$action='') {
1252
-	    global $conf,$hideprices,$hookmanager;
1252
+		global $conf,$hideprices,$hookmanager;
1253 1253
 
1254 1254
 		if($this->isModSubtotalLine($parameters,$object) ){
1255 1255
 			$this->resprints = ' ';
@@ -1271,32 +1271,32 @@  discard block
 block discarded – undo
1271 1271
 		(!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))
1272 1272
 		)
1273 1273
 		{
1274
-		    // alors je dois vérifier si la méthode fait partie de la conf qui l'exclue
1275
-		    if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC)))
1276
-		    {
1277
-		        $this->resprints = ' ';
1274
+			// alors je dois vérifier si la méthode fait partie de la conf qui l'exclue
1275
+			if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC)))
1276
+			{
1277
+				$this->resprints = ' ';
1278 1278
 		        
1279
-		        // currentcontext à modifier celon l'appel
1280
-		        $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i);
1281
-		        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)
1279
+				// currentcontext à modifier celon l'appel
1280
+				$params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i);
1281
+				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)
1282 1282
 		        
1283
-		    }
1283
+			}
1284 1284
 		}
1285 1285
 		// Cache le prix pour les lignes standards dolibarr qui sont dans un ensemble
1286 1286
 		else if (!empty($hideprices))
1287 1287
 		{
1288 1288
 		    
1289
-		    // Check if a title exist for this line && if the title have subtotal
1290
-		    $lineTitle = TSubtotal::getParentTitleOfLine($object, $i);
1291
-		    if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true))
1292
-		    {
1289
+			// Check if a title exist for this line && if the title have subtotal
1290
+			$lineTitle = TSubtotal::getParentTitleOfLine($object, $i);
1291
+			if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true))
1292
+			{
1293 1293
 		        
1294
-		        $this->resprints = ' ';
1294
+				$this->resprints = ' ';
1295 1295
 		        
1296
-		        // currentcontext à modifier celon l'appel
1297
-		        $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hideprices', 'i' => $i);
1298
-		        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)
1299
-		    }
1296
+				// currentcontext à modifier celon l'appel
1297
+				$params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hideprices', 'i' => $i);
1298
+				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)
1299
+			}
1300 1300
 		}
1301 1301
 		
1302 1302
 		return 0;
@@ -1333,7 +1333,7 @@  discard block
 block discarded – undo
1333 1333
 	}
1334 1334
 	
1335 1335
 	function pdf_getlinevatrate($parameters=array(), &$object, &$action='') {
1336
-	    global $conf,$hideprices,$hookmanager;
1336
+		global $conf,$hideprices,$hookmanager;
1337 1337
 	    
1338 1338
 		if($this->isModSubtotalLine($parameters,$object) ){
1339 1339
 			$this->resprints = ' ';
@@ -1358,31 +1358,31 @@  discard block
 block discarded – undo
1358 1358
 		(!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))
1359 1359
 		)
1360 1360
 		{
1361
-		    // alors je dois vérifier si la méthode fait partie de la conf qui l'exclue
1362
-		    if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC)))
1363
-		    {
1364
-		        $this->resprints = ' ';
1361
+			// alors je dois vérifier si la méthode fait partie de la conf qui l'exclue
1362
+			if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC)))
1363
+			{
1364
+				$this->resprints = ' ';
1365 1365
 		        
1366
-		        // currentcontext à modifier celon l'appel
1367
-		        $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i);
1368
-		        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)
1369
-		    }
1366
+				// currentcontext à modifier celon l'appel
1367
+				$params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i);
1368
+				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)
1369
+			}
1370 1370
 		}
1371 1371
 		// Cache le prix pour les lignes standards dolibarr qui sont dans un ensemble
1372 1372
 		else if (!empty($hideprices))
1373 1373
 		{
1374 1374
 		    
1375
-		    // Check if a title exist for this line && if the title have subtotal
1376
-		    $lineTitle = TSubtotal::getParentTitleOfLine($object, $i);
1377
-		    if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true))
1378
-		    {
1375
+			// Check if a title exist for this line && if the title have subtotal
1376
+			$lineTitle = TSubtotal::getParentTitleOfLine($object, $i);
1377
+			if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true))
1378
+			{
1379 1379
 		        
1380
-		        $this->resprints = ' ';
1380
+				$this->resprints = ' ';
1381 1381
 		        
1382
-		        // currentcontext à modifier celon l'appel
1383
-		        $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hideprices', 'i' => $i);
1384
-		        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)
1385
-		    }
1382
+				// currentcontext à modifier celon l'appel
1383
+				$params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hideprices', 'i' => $i);
1384
+				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)
1385
+			}
1386 1386
 		}
1387 1387
 		
1388 1388
 		return 0;
@@ -1511,11 +1511,11 @@  discard block
 block discarded – undo
1511 1511
 		$hidedetails = (int)GETPOST('hidedetails');
1512 1512
 		
1513 1513
 		if ($hideInnerLines) { // si c une ligne de titre
1514
-	    	$fk_parent_line=0;
1514
+			$fk_parent_line=0;
1515 1515
 			$TLines =array();
1516 1516
 		
1517 1517
 			$original_count=count($object->lines);
1518
-		    $TTvas = array(); // tableau de tva
1518
+			$TTvas = array(); // tableau de tva
1519 1519
 		    
1520 1520
 			foreach($object->lines as $k=>&$line) 
1521 1521
 			{
@@ -1545,48 +1545,48 @@  discard block
 block discarded – undo
1545 1545
 			
1546 1546
 				if ($hideInnerLines)
1547 1547
 				{
1548
-				    if(!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES))
1549
-				    {
1550
-				        if($line->tva_tx != '0.000' && $line->product_type!=9){
1548
+					if(!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES))
1549
+					{
1550
+						if($line->tva_tx != '0.000' && $line->product_type!=9){
1551 1551
 				            
1552
-    				        // on remplit le tableau de tva pour substituer les lignes cachées
1553
-    				        $TTvas[$line->tva_tx]['total_tva'] += $line->total_tva;
1554
-    				        $TTvas[$line->tva_tx]['total_ht'] += $line->total_ht;
1555
-    				        $TTvas[$line->tva_tx]['total_ttc'] += $line->total_ttc; 
1556
-    				    }
1557
-    					if($line->product_type==9 && $line->rowid>0)
1558
-    					{
1559
-    					    //Cas où je doit cacher les produits et afficher uniquement les sous-totaux avec les titres
1560
-    					    // génère des lignes d'affichage des montants HT soumis à tva
1561
-    					    $nbtva = count($TTvas);
1562
-    					    if(!empty($nbtva)){
1563
-    					        foreach ($TTvas as $tx =>$val){
1564
-    					            $l = clone $line;
1565
-    					            $l->product_type = 1;
1566
-    					            $l->special_code = '';
1567
-    					            $l->qty = 1;
1568
-    					            $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx));
1569
-    					            $l->tva_tx = $tx;
1570
-    					            $l->total_ht = $val['total_ht'];
1571
-    					            $l->total_tva = $val['total_tva'];
1572
-    					            $l->total = $line->total_ht;
1573
-    					            $l->total_ttc = $val['total_ttc'];
1574
-    					            $TLines[] = $l;
1575
-    					            array_shift($TTvas);
1576
-    					       }
1577
-    					    }
1552
+							// on remplit le tableau de tva pour substituer les lignes cachées
1553
+							$TTvas[$line->tva_tx]['total_tva'] += $line->total_tva;
1554
+							$TTvas[$line->tva_tx]['total_ht'] += $line->total_ht;
1555
+							$TTvas[$line->tva_tx]['total_ttc'] += $line->total_ttc; 
1556
+						}
1557
+						if($line->product_type==9 && $line->rowid>0)
1558
+						{
1559
+							//Cas où je doit cacher les produits et afficher uniquement les sous-totaux avec les titres
1560
+							// génère des lignes d'affichage des montants HT soumis à tva
1561
+							$nbtva = count($TTvas);
1562
+							if(!empty($nbtva)){
1563
+								foreach ($TTvas as $tx =>$val){
1564
+									$l = clone $line;
1565
+									$l->product_type = 1;
1566
+									$l->special_code = '';
1567
+									$l->qty = 1;
1568
+									$l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx));
1569
+									$l->tva_tx = $tx;
1570
+									$l->total_ht = $val['total_ht'];
1571
+									$l->total_tva = $val['total_tva'];
1572
+									$l->total = $line->total_ht;
1573
+									$l->total_ttc = $val['total_ttc'];
1574
+									$TLines[] = $l;
1575
+									array_shift($TTvas);
1576
+							   }
1577
+							}
1578 1578
     					    
1579
-    					    // ajoute la ligne de sous-total
1580
-    					    $TLines[] = $line; 
1581
-    					}
1582
-				    } else {
1579
+							// ajoute la ligne de sous-total
1580
+							$TLines[] = $line; 
1581
+						}
1582
+					} else {
1583 1583
 				        
1584
-				        if($line->product_type==9 && $line->rowid>0)
1585
-				        {
1586
-				            // ajoute la ligne de sous-total
1587
-				            $TLines[] = $line; 
1588
-				        }
1589
-				    }
1584
+						if($line->product_type==9 && $line->rowid>0)
1585
+						{
1586
+							// ajoute la ligne de sous-total
1587
+							$TLines[] = $line; 
1588
+						}
1589
+					}
1590 1590
 				    
1591 1591
 					
1592 1592
 				}
@@ -1611,20 +1611,20 @@  discard block
 block discarded – undo
1611 1611
 			$nbtva = count($TTvas);
1612 1612
 			if(!empty($nbtva) && $hideInnerLines && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES))
1613 1613
 			{
1614
-			    foreach ($TTvas as $tx =>$val){
1615
-			        $l = clone $line;
1616
-			        $l->product_type = 1;
1617
-			        $l->special_code = '';
1618
-			        $l->qty = 1;
1619
-			        $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx));
1620
-			        $l->tva_tx = $tx;
1621
-			        $l->total_ht = $val['total_ht'];
1622
-			        $l->total_tva = $val['total_tva'];
1623
-			        $l->total = $line->total_ht;
1624
-			        $l->total_ttc = $val['total_ttc'];
1625
-			        $TLines[] = $l;
1626
-			        array_shift($TTvas);
1627
-			    }
1614
+				foreach ($TTvas as $tx =>$val){
1615
+					$l = clone $line;
1616
+					$l->product_type = 1;
1617
+					$l->special_code = '';
1618
+					$l->qty = 1;
1619
+					$l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx));
1620
+					$l->tva_tx = $tx;
1621
+					$l->total_ht = $val['total_ht'];
1622
+					$l->total_tva = $val['total_tva'];
1623
+					$l->total = $line->total_ht;
1624
+					$l->total_ttc = $val['total_ttc'];
1625
+					$TLines[] = $l;
1626
+					array_shift($TTvas);
1627
+				}
1628 1628
 			}
1629 1629
 			
1630 1630
 			global $nblignes;
@@ -1636,7 +1636,7 @@  discard block
 block discarded – undo
1636 1636
 				$this->resprints = '';
1637 1637
 				return 0;
1638 1638
 			}
1639
-	    }
1639
+		}
1640 1640
 		
1641 1641
 		return 0;
1642 1642
 	}
@@ -1799,18 +1799,18 @@  discard block
 block discarded – undo
1799 1799
 		}
1800 1800
 		elseif($object->element == 'order_supplier' )
1801 1801
 		{
1802
-		    $createRight = $user->rights->fournisseur->commande->creer;
1802
+			$createRight = $user->rights->fournisseur->commande->creer;
1803 1803
 		}
1804 1804
 		elseif($object->element == 'invoice_supplier' )
1805 1805
 		{
1806
-		    $createRight = $user->rights->fournisseur->facture->creer;
1806
+			$createRight = $user->rights->fournisseur->facture->creer;
1807 1807
 		}
1808 1808
 		
1809 1809
 		if($line->special_code!=$this->module_number || $line->product_type!=9) {
1810 1810
 			null;
1811 1811
 		}	
1812 1812
 		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)) 
1813
-        {
1813
+		{
1814 1814
 			if($object->element=='facture')$idvar = 'facid';
1815 1815
 			else $idvar='id';
1816 1816
 			
@@ -1857,7 +1857,7 @@  discard block
 block discarded – undo
1857 1857
 			//var_dump($line);
1858 1858
             
1859 1859
 			// HTML 5 data for js
1860
-            $data = $this->_getHtmlData($parameters, $object, $action, $hookmanager);
1860
+			$data = $this->_getHtmlData($parameters, $object, $action, $hookmanager);
1861 1861
             
1862 1862
 			
1863 1863
 			?>
@@ -1915,8 +1915,8 @@  discard block
 block discarded – undo
1915 1915
 						}
1916 1916
 						
1917 1917
 						if ($object->element == 'order_supplier' || $object->element == 'invoice_supplier') {
1918
-						    $line->label = !empty($line->description) ? $line->description : $line->desc;
1919
-						    $line->description = '';
1918
+							$line->label = !empty($line->description) ? $line->description : $line->desc;
1919
+							$line->description = '';
1920 1920
 						}
1921 1921
 						$newlabel = $line->label;
1922 1922
 						if($line->label=='' && !$isFreeText) {
@@ -2207,17 +2207,17 @@  discard block
 block discarded – undo
2207 2207
 		if ($object->statut == 0 && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && $action != 'editline')
2208 2208
 		{
2209 2209
 		    
2210
-		    if($object->element == 'invoice_supplier' || $object->element == 'order_supplier')
2211
-		    {
2212
-		        foreach ($object->lines as $line)
2213
-		        {
2214
-		            // fetch optionals attributes and labels
2215
-		            require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
2216
-		            $extrafields=new ExtraFields($this->db);
2217
-		            $extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true);
2218
-		            $line->fetch_optionals($line->id,$extralabels);
2219
-		        }
2220
-		    }
2210
+			if($object->element == 'invoice_supplier' || $object->element == 'order_supplier')
2211
+			{
2212
+				foreach ($object->lines as $line)
2213
+				{
2214
+					// fetch optionals attributes and labels
2215
+					require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
2216
+					$extrafields=new ExtraFields($this->db);
2217
+					$extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true);
2218
+					$line->fetch_optionals($line->id,$extralabels);
2219
+				}
2220
+			}
2221 2221
 		    
2222 2222
 			$TSubNc = array();
2223 2223
 			foreach ($object->lines as &$l)
@@ -2308,80 +2308,80 @@  discard block
 block discarded – undo
2308 2308
 	{
2309 2309
 		dol_include_once('/subtotal/class/subtotal.class.php');
2310 2310
 
2311
-	    $line = &$parameters['line'];
2311
+		$line = &$parameters['line'];
2312 2312
 	    
2313
-	    $ThtmlData['data-id']           = $line->id;
2314
-	    $ThtmlData['data-product_type'] = $line->product_type;
2315
-	    $ThtmlData['data-qty']          = 0; //$line->qty;
2316
-	    $ThtmlData['data-level']        = TSubtotal::getNiveau($line);
2313
+		$ThtmlData['data-id']           = $line->id;
2314
+		$ThtmlData['data-product_type'] = $line->product_type;
2315
+		$ThtmlData['data-qty']          = 0; //$line->qty;
2316
+		$ThtmlData['data-level']        = TSubtotal::getNiveau($line);
2317 2317
 	    
2318
-	    if(TSubtotal::isTitle($line)){
2319
-	        $ThtmlData['data-issubtotal'] = 'title';
2320
-	    }elseif(TSubtotal::isSubtotal($line)){
2321
-	        $ThtmlData['data-issubtotal'] = 'subtotal';
2322
-	    }
2323
-	    else{
2324
-	        $ThtmlData['data-issubtotal'] = 'freetext';
2325
-	    }
2318
+		if(TSubtotal::isTitle($line)){
2319
+			$ThtmlData['data-issubtotal'] = 'title';
2320
+		}elseif(TSubtotal::isSubtotal($line)){
2321
+			$ThtmlData['data-issubtotal'] = 'subtotal';
2322
+		}
2323
+		else{
2324
+			$ThtmlData['data-issubtotal'] = 'freetext';
2325
+		}
2326 2326
 	    
2327 2327
 	    
2328
-	    // Change or add data  from hooks
2329
-	    $parameters = array_replace($parameters , array(  'ThtmlData' => $ThtmlData )  );
2328
+		// Change or add data  from hooks
2329
+		$parameters = array_replace($parameters , array(  'ThtmlData' => $ThtmlData )  );
2330 2330
 	    
2331
-	    // hook 
2332
-	    $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
2333
-	    if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
2334
-	    if ($reshook>0)
2335
-	    {
2336
-	        $ThtmlData = $hookmanager->resArray;
2337
-	    }
2338
-
2339
-	    return $this->implodeHtmlData($ThtmlData);
2331
+		// hook 
2332
+		$reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
2333
+		if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
2334
+		if ($reshook>0)
2335
+		{
2336
+			$ThtmlData = $hookmanager->resArray;
2337
+		}
2338
+
2339
+		return $this->implodeHtmlData($ThtmlData);
2340 2340
 	
2341 2341
 	}
2342 2342
 	
2343 2343
 	
2344 2344
 	function implodeHtmlData($ThtmlData = array())
2345 2345
 	{
2346
-	    $data = '';
2347
-	    foreach($ThtmlData as $k => $h )
2348
-	    {
2349
-	        if(is_array($h))
2350
-	        {
2351
-	            $h = json_encode($h);
2352
-	        }
2346
+		$data = '';
2347
+		foreach($ThtmlData as $k => $h )
2348
+		{
2349
+			if(is_array($h))
2350
+			{
2351
+				$h = json_encode($h);
2352
+			}
2353 2353
 	        
2354
-	        $data .= $k . '="'.dol_htmlentities($h, ENT_QUOTES).'" ';
2355
-	    }
2354
+			$data .= $k . '="'.dol_htmlentities($h, ENT_QUOTES).'" ';
2355
+		}
2356 2356
 	    
2357
-	    return $data;
2357
+		return $data;
2358 2358
 	}
2359 2359
 	
2360 2360
 	function _ajax_block_order_js($object)
2361 2361
 	{
2362
-	    global $conf,$tagidfortablednd,$filepath,$langs;
2362
+		global $conf,$tagidfortablednd,$filepath,$langs;
2363 2363
 	    
2364
-	    /*
2364
+		/*
2365 2365
 	     * this part of js is base on dolibarr htdocs/core/tpl/ajaxrow.tpl.php 
2366 2366
 	     * for compatibility reasons we don't use tableDnD but jquery sortable
2367 2367
 	     */
2368 2368
 	    
2369
-	    $id=$object->id;
2370
-	    $nboflines=(isset($object->lines)?count($object->lines):0);
2371
-	    $forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1;
2369
+		$id=$object->id;
2370
+		$nboflines=(isset($object->lines)?count($object->lines):0);
2371
+		$forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1;
2372 2372
 	    
2373
-	    $id=$object->id;
2374
-	    $fk_element=$object->fk_element;
2375
-	    $table_element_line=$object->table_element_line;
2376
-	    $nboflines=(isset($object->lines)?count($object->lines):(empty($nboflines)?0:$nboflines));
2377
-	    $tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd);
2378
-	    $filepath=(empty($filepath)?'':$filepath);
2373
+		$id=$object->id;
2374
+		$fk_element=$object->fk_element;
2375
+		$table_element_line=$object->table_element_line;
2376
+		$nboflines=(isset($object->lines)?count($object->lines):(empty($nboflines)?0:$nboflines));
2377
+		$tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd);
2378
+		$filepath=(empty($filepath)?'':$filepath);
2379 2379
 	    
2380 2380
 	    
2381
-	    if (GETPOST('action','aZ09') != 'editline' && $nboflines > 1)
2382
-	    {
2381
+		if (GETPOST('action','aZ09') != 'editline' && $nboflines > 1)
2382
+		{
2383 2383
 	        
2384
-	        ?>
2384
+			?>
2385 2385
 		
2386 2386
 		
2387 2387
 			<script type="text/javascript">
Please login to merge, or discard this patch.