Passed
Pull Request — master (#119)
by
unknown
02:29
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.
class/actions_subtotal.class.php 1 patch
Indentation   +224 added lines, -224 removed lines patch added patch discarded remove patch
@@ -81,11 +81,11 @@  discard block
 block discarded – undo
81 81
 	 * @return     void
82 82
 	 */
83 83
     
84
-    var $module_number = 104777;
84
+	var $module_number = 104777;
85 85
     
86
-    function formObjectOptions($parameters, &$object, &$action, $hookmanager) 
87
-    {
88
-      	global $langs,$db,$user, $conf;
86
+	function formObjectOptions($parameters, &$object, &$action, $hookmanager) 
87
+	{
88
+	  	global $langs,$db,$user, $conf;
89 89
 		
90 90
 		$langs->load('subtotal@subtotal');
91 91
 		
@@ -100,10 +100,10 @@  discard block
 block discarded – undo
100 100
 				$createRight = $user->rights->facture->creer;
101 101
 			} elseif($object->element == 'order_supplier' )
102 102
 			{
103
-			    $createRight = $user->rights->fournisseur->commande->creer;
103
+				$createRight = $user->rights->fournisseur->commande->creer;
104 104
 			} elseif($object->element == 'invoice_supplier' )
105 105
 			{
106
-			    $createRight = $user->rights->fournisseur->facture->creer;
106
+				$createRight = $user->rights->fournisseur->facture->creer;
107 107
 			}
108 108
 			
109 109
 			if ($object->statut == 0  && $createRight) {
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 					
154 154
 					if (!empty($conf->global->SUBTOTAL_AUTO_ADD_SUBTOTAL_ON_ADDING_NEW_TITLE) && $qty < 10) TSubtotal::addSubtotalMissing($object, $qty);
155 155
 					
156
-	    			TSubtotal::addSubTotalLine($object, $title, $qty);
156
+					TSubtotal::addSubTotalLine($object, $title, $qty);
157 157
 				}
158 158
 				else if($action==='ask_deleteallline') {
159 159
 						$form=new Form($db);
@@ -375,36 +375,36 @@  discard block
 block discarded – undo
375 375
 		$TContext = explode(':',$parameters['context']);
376 376
 		if (
377 377
 				in_array('invoicecard',$TContext)
378
-		        || in_array('invoicesuppliercard',$TContext)
378
+				|| in_array('invoicesuppliercard',$TContext)
379 379
 				|| in_array('propalcard',$TContext)
380 380
 				|| in_array('ordercard',$TContext)
381
-		        || in_array('ordersuppliercard',$TContext)
381
+				|| in_array('ordersuppliercard',$TContext)
382 382
 				|| in_array('invoicereccard',$TContext)
383 383
 			)
384
-	        {	
384
+			{	
385 385
 				$hideInnerLines	= isset( $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']] ) ?  $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']] : 0;
386 386
 				$hidedetails	= isset( $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']] ) ?  $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']] : 0;
387 387
 				$hidepricesDefaultConf = !empty($conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED)?$conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED:0;
388 388
 				$hideprices= isset( $_SESSION['subtotal_hideprices_'.$parameters['modulepart']] ) ?  $_SESSION['subtotal_hideprices_'.$parameters['modulepart']] : $hidepricesDefaultConf;
389 389
 				
390 390
 				$var=false;
391
-		     	$out.= '<tr '.$bc[$var].'>
391
+			 	$out.= '<tr '.$bc[$var].'>
392 392
 		     			<td colspan="4" align="right">
393 393
 		     				<label for="hideInnerLines">'.$langs->trans('HideInnerLines').'</label>
394 394
 		     				<input type="checkbox" onclick="if($(this).is(\':checked\')) { $(\'#hidedetails\').prop(\'checked\', \'checked\')  }" id="hideInnerLines" name="hideInnerLines" value="1" '.(( $hideInnerLines ) ? 'checked="checked"' : '' ).' />
395 395
 		     			</td>
396 396
 		     			</tr>';
397 397
 				
398
-		     	$var=!$var;
399
-		     	$out.= '<tr '.$bc[$var].'>
398
+			 	$var=!$var;
399
+			 	$out.= '<tr '.$bc[$var].'>
400 400
 		     			<td colspan="4" align="right">
401 401
 		     				<label for="hidedetails">'.$langs->trans('SubTotalhidedetails').'</label>
402 402
 		     				<input type="checkbox" id="hidedetails" name="hidedetails" value="1" '.(( $hidedetails ) ? 'checked="checked"' : '' ).' />
403 403
 		     			</td>
404 404
 		     			</tr>';
405 405
 		     	
406
-		     	$var=!$var;
407
-		     	$out.= '<tr '.$bc[$var].'>
406
+			 	$var=!$var;
407
+			 	$out.= '<tr '.$bc[$var].'>
408 408
 		     			<td colspan="4" align="right">
409 409
 		     				<label for="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';
@@ -636,17 +636,17 @@  discard block
 block discarded – undo
636 636
 				foreach($object->lines as &$line) {
637 637
 					if ($line->product_type == 9 && $line->special_code == $this->module_number) {
638 638
 					    
639
-                        if($line->qty>=90) {
640
-                            $line->modsubtotal_total = 1;
641
-                        }
642
-                        else{
643
-                            $line->modsubtotal_title = 1;
644
-                        }
639
+						if($line->qty>=90) {
640
+							$line->modsubtotal_total = 1;
641
+						}
642
+						else{
643
+							$line->modsubtotal_title = 1;
644
+						}
645 645
                         
646 646
 						$line->total_ht = $this->getTotalLineFromObject($object, $line, '');
647 647
 					}
648
-	        	}
649
-	        }
648
+				}
649
+			}
650 650
 			
651 651
 		}
652 652
 		else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') {
@@ -663,7 +663,7 @@  discard block
 block discarded – undo
663 663
 				 */
664 664
 				else if($object->element=='invoice_supplier')
665 665
 				{
666
-				    $object->deleteline($idLine);
666
+					$object->deleteline($idLine);
667 667
 				}
668 668
 				/**
669 669
 				 * @var $object Propal
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
 				 */
687 687
 				else if($object->element=='order_supplier')
688 688
 				{
689
-				    $object->deleteline($idLine);
689
+					$object->deleteline($idLine);
690 690
 				}
691 691
 				/**
692 692
 				 * @var $object Facturerec
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
 		
731 731
 		foreach($object->lines as $l) {
732 732
 		
733
-		    $lid = (!empty($l->rowid) ? $l->rowid : $l->id);
733
+			$lid = (!empty($l->rowid) ? $l->rowid : $l->id);
734 734
 			if($lid == $lineid) {
735 735
 
736 736
 				$found = true;
@@ -739,7 +739,7 @@  discard block
 block discarded – undo
739 739
 			
740 740
 			if($found) {
741 741
 				
742
-			    $Tab[] = (!empty($l->rowid) ? $l->rowid : $l->id);
742
+				$Tab[] = (!empty($l->rowid) ? $l->rowid : $l->id);
743 743
 				
744 744
 				if($l->special_code==$this->module_number && (($l->qty==99 && $qty_line==1) || ($l->qty==98 && $qty_line==2))   ) {
745 745
 					break; // end of story
@@ -818,17 +818,17 @@  discard block
 block discarded – undo
818 818
 			if($l->rang>=$rang) {
819 819
 				return price($total);
820 820
 			}
821
-                        if (TSubtotal::isSubtotal($l)){
822
-                            $total = 0;
823
-                        } else  if ($l->situation_percent > 0 ){
821
+						if (TSubtotal::isSubtotal($l)){
822
+							$total = 0;
823
+						} else  if ($l->situation_percent > 0 ){
824 824
                            
825 825
         	
826 826
 		 	$prev_progress = $l->get_prev_progress($object->id);
827 827
 		 	$progress = ($l->situation_percent - $prev_progress) /100;
828
-                        $total += ($l->total_ht/($l->situation_percent/100)) * $progress;
828
+						$total += ($l->total_ht/($l->situation_percent/100)) * $progress;
829 829
                         
830
-                    }
831
-                }
830
+					}
831
+				}
832 832
                 
833 833
 		return price($total);
834 834
 	}
@@ -860,7 +860,7 @@  discard block
 block discarded – undo
860 860
 		if(method_exists('Closure','bind')) {
861 861
 			$pageBreakOriginalValue = $pdf->AcceptPageBreak();
862 862
 			$sweetsThief = function ($pdf) {
863
-		    		return $pdf->bMargin ;
863
+					return $pdf->bMargin ;
864 864
 			};
865 865
 			$sweetsThief = Closure::bind($sweetsThief, null, $pdf);
866 866
 	
@@ -923,11 +923,11 @@  discard block
 block discarded – undo
923 923
 				else
924 924
 				{
925 925
 					list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1);
926
-                                        if(get_class($object) == 'Facture' && $object->type==Facture::TYPE_SITUATION){//Facture de situation
927
-                                                $total_to_print = $this->getTotalToPrintSituation($object, $line);
928
-                                        } else {
929
-                                            	$total_to_print = price($total);
930
-                                        }
926
+										if(get_class($object) == 'Facture' && $object->type==Facture::TYPE_SITUATION){//Facture de situation
927
+												$total_to_print = $this->getTotalToPrintSituation($object, $line);
928
+										} else {
929
+												$total_to_print = price($total);
930
+										}
931 931
                                             
932 932
 					$line->total_ht = $total;
933 933
 					$line->total = $total;
@@ -1078,7 +1078,7 @@  discard block
 block discarded – undo
1078 1078
 	}
1079 1079
 	
1080 1080
 	function pdf_getlinetotalexcltax($parameters=array(), &$object, &$action='') {
1081
-	    global $conf, $hideprices, $hookmanager;
1081
+		global $conf, $hideprices, $hookmanager;
1082 1082
 		
1083 1083
 		if(is_array($parameters)) $i = & $parameters['i'];
1084 1084
 		else $i = (int)$parameters;
@@ -1117,7 +1117,7 @@  discard block
 block discarded – undo
1117 1117
 			}
1118 1118
 		}
1119 1119
 		if ((int)GETPOST('hideInnerLines') && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)){
1120
-		    $this->resprints = price($object->lines[$i]->total_ht);
1120
+			$this->resprints = price($object->lines[$i]->total_ht);
1121 1121
 		}
1122 1122
 		
1123 1123
 		// Si la gestion C/NC est active et que je suis sur un ligne dont l'extrafield est coché
@@ -1246,7 +1246,7 @@  discard block
 block discarded – undo
1246 1246
 	}
1247 1247
 	
1248 1248
 	function pdf_getlineupexcltax($parameters=array(), &$object, &$action='') {
1249
-	    global $conf,$hideprices,$hookmanager;
1249
+		global $conf,$hideprices,$hookmanager;
1250 1250
 
1251 1251
 		if($this->isModSubtotalLine($parameters,$object) ){
1252 1252
 			$this->resprints = ' ';
@@ -1268,32 +1268,32 @@  discard block
 block discarded – undo
1268 1268
 		(!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))
1269 1269
 		)
1270 1270
 		{
1271
-		    // alors je dois vérifier si la méthode fait partie de la conf qui l'exclue
1272
-		    if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC)))
1273
-		    {
1274
-		        $this->resprints = ' ';
1271
+			// alors je dois vérifier si la méthode fait partie de la conf qui l'exclue
1272
+			if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC)))
1273
+			{
1274
+				$this->resprints = ' ';
1275 1275
 		        
1276
-		        // currentcontext à modifier celon l'appel
1277
-		        $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i);
1278
-		        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)
1276
+				// currentcontext à modifier celon l'appel
1277
+				$params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i);
1278
+				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 1279
 		        
1280
-		    }
1280
+			}
1281 1281
 		}
1282 1282
 		// Cache le prix pour les lignes standards dolibarr qui sont dans un ensemble
1283 1283
 		else if (!empty($hideprices))
1284 1284
 		{
1285 1285
 		    
1286
-		    // Check if a title exist for this line && if the title have subtotal
1287
-		    $lineTitle = TSubtotal::getParentTitleOfLine($object, $i);
1288
-		    if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true))
1289
-		    {
1286
+			// Check if a title exist for this line && if the title have subtotal
1287
+			$lineTitle = TSubtotal::getParentTitleOfLine($object, $i);
1288
+			if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true))
1289
+			{
1290 1290
 		        
1291
-		        $this->resprints = ' ';
1291
+				$this->resprints = ' ';
1292 1292
 		        
1293
-		        // currentcontext à modifier celon l'appel
1294
-		        $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hideprices', 'i' => $i);
1295
-		        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)
1296
-		    }
1293
+				// currentcontext à modifier celon l'appel
1294
+				$params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hideprices', 'i' => $i);
1295
+				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)
1296
+			}
1297 1297
 		}
1298 1298
 		
1299 1299
 		return 0;
@@ -1330,7 +1330,7 @@  discard block
 block discarded – undo
1330 1330
 	}
1331 1331
 	
1332 1332
 	function pdf_getlinevatrate($parameters=array(), &$object, &$action='') {
1333
-	    global $conf,$hideprices,$hookmanager;
1333
+		global $conf,$hideprices,$hookmanager;
1334 1334
 	    
1335 1335
 		if($this->isModSubtotalLine($parameters,$object) ){
1336 1336
 			$this->resprints = ' ';
@@ -1355,31 +1355,31 @@  discard block
 block discarded – undo
1355 1355
 		(!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))
1356 1356
 		)
1357 1357
 		{
1358
-		    // alors je dois vérifier si la méthode fait partie de la conf qui l'exclue
1359
-		    if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC)))
1360
-		    {
1361
-		        $this->resprints = ' ';
1358
+			// alors je dois vérifier si la méthode fait partie de la conf qui l'exclue
1359
+			if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC)))
1360
+			{
1361
+				$this->resprints = ' ';
1362 1362
 		        
1363
-		        // currentcontext à modifier celon l'appel
1364
-		        $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i);
1365
-		        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)
1366
-		    }
1363
+				// currentcontext à modifier celon l'appel
1364
+				$params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i);
1365
+				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)
1366
+			}
1367 1367
 		}
1368 1368
 		// Cache le prix pour les lignes standards dolibarr qui sont dans un ensemble
1369 1369
 		else if (!empty($hideprices))
1370 1370
 		{
1371 1371
 		    
1372
-		    // Check if a title exist for this line && if the title have subtotal
1373
-		    $lineTitle = TSubtotal::getParentTitleOfLine($object, $i);
1374
-		    if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true))
1375
-		    {
1372
+			// Check if a title exist for this line && if the title have subtotal
1373
+			$lineTitle = TSubtotal::getParentTitleOfLine($object, $i);
1374
+			if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true))
1375
+			{
1376 1376
 		        
1377
-		        $this->resprints = ' ';
1377
+				$this->resprints = ' ';
1378 1378
 		        
1379
-		        // currentcontext à modifier celon l'appel
1380
-		        $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hideprices', 'i' => $i);
1381
-		        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)
1382
-		    }
1379
+				// currentcontext à modifier celon l'appel
1380
+				$params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hideprices', 'i' => $i);
1381
+				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)
1382
+			}
1383 1383
 		}
1384 1384
 		
1385 1385
 		return 0;
@@ -1508,11 +1508,11 @@  discard block
 block discarded – undo
1508 1508
 		$hidedetails = (int)GETPOST('hidedetails');
1509 1509
 		
1510 1510
 		if ($hideInnerLines) { // si c une ligne de titre
1511
-	    	$fk_parent_line=0;
1511
+			$fk_parent_line=0;
1512 1512
 			$TLines =array();
1513 1513
 		
1514 1514
 			$original_count=count($object->lines);
1515
-		    $TTvas = array(); // tableau de tva
1515
+			$TTvas = array(); // tableau de tva
1516 1516
 		    
1517 1517
 			foreach($object->lines as $k=>&$line) 
1518 1518
 			{
@@ -1542,48 +1542,48 @@  discard block
 block discarded – undo
1542 1542
 			
1543 1543
 				if ($hideInnerLines)
1544 1544
 				{
1545
-				    if(!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES))
1546
-				    {
1547
-				        if($line->tva_tx != '0.000' && $line->product_type!=9){
1545
+					if(!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES))
1546
+					{
1547
+						if($line->tva_tx != '0.000' && $line->product_type!=9){
1548 1548
 				            
1549
-    				        // on remplit le tableau de tva pour substituer les lignes cachées
1550
-    				        $TTvas[$line->tva_tx]['total_tva'] += $line->total_tva;
1551
-    				        $TTvas[$line->tva_tx]['total_ht'] += $line->total_ht;
1552
-    				        $TTvas[$line->tva_tx]['total_ttc'] += $line->total_ttc; 
1553
-    				    }
1554
-    					if($line->product_type==9 && $line->rowid>0)
1555
-    					{
1556
-    					    //Cas où je doit cacher les produits et afficher uniquement les sous-totaux avec les titres
1557
-    					    // génère des lignes d'affichage des montants HT soumis à tva
1558
-    					    $nbtva = count($TTvas);
1559
-    					    if(!empty($nbtva)){
1560
-    					        foreach ($TTvas as $tx =>$val){
1561
-    					            $l = clone $line;
1562
-    					            $l->product_type = 1;
1563
-    					            $l->special_code = '';
1564
-    					            $l->qty = 1;
1565
-    					            $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx));
1566
-    					            $l->tva_tx = $tx;
1567
-    					            $l->total_ht = $val['total_ht'];
1568
-    					            $l->total_tva = $val['total_tva'];
1569
-    					            $l->total = $line->total_ht;
1570
-    					            $l->total_ttc = $val['total_ttc'];
1571
-    					            $TLines[] = $l;
1572
-    					            array_shift($TTvas);
1573
-    					       }
1574
-    					    }
1549
+							// on remplit le tableau de tva pour substituer les lignes cachées
1550
+							$TTvas[$line->tva_tx]['total_tva'] += $line->total_tva;
1551
+							$TTvas[$line->tva_tx]['total_ht'] += $line->total_ht;
1552
+							$TTvas[$line->tva_tx]['total_ttc'] += $line->total_ttc; 
1553
+						}
1554
+						if($line->product_type==9 && $line->rowid>0)
1555
+						{
1556
+							//Cas où je doit cacher les produits et afficher uniquement les sous-totaux avec les titres
1557
+							// génère des lignes d'affichage des montants HT soumis à tva
1558
+							$nbtva = count($TTvas);
1559
+							if(!empty($nbtva)){
1560
+								foreach ($TTvas as $tx =>$val){
1561
+									$l = clone $line;
1562
+									$l->product_type = 1;
1563
+									$l->special_code = '';
1564
+									$l->qty = 1;
1565
+									$l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx));
1566
+									$l->tva_tx = $tx;
1567
+									$l->total_ht = $val['total_ht'];
1568
+									$l->total_tva = $val['total_tva'];
1569
+									$l->total = $line->total_ht;
1570
+									$l->total_ttc = $val['total_ttc'];
1571
+									$TLines[] = $l;
1572
+									array_shift($TTvas);
1573
+							   }
1574
+							}
1575 1575
     					    
1576
-    					    // ajoute la ligne de sous-total
1577
-    					    $TLines[] = $line; 
1578
-    					}
1579
-				    } else {
1576
+							// ajoute la ligne de sous-total
1577
+							$TLines[] = $line; 
1578
+						}
1579
+					} else {
1580 1580
 				        
1581
-				        if($line->product_type==9 && $line->rowid>0)
1582
-				        {
1583
-				            // ajoute la ligne de sous-total
1584
-				            $TLines[] = $line; 
1585
-				        }
1586
-				    }
1581
+						if($line->product_type==9 && $line->rowid>0)
1582
+						{
1583
+							// ajoute la ligne de sous-total
1584
+							$TLines[] = $line; 
1585
+						}
1586
+					}
1587 1587
 				    
1588 1588
 					
1589 1589
 				}
@@ -1608,20 +1608,20 @@  discard block
 block discarded – undo
1608 1608
 			$nbtva = count($TTvas);
1609 1609
 			if(!empty($nbtva) && $hideInnerLines && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES))
1610 1610
 			{
1611
-			    foreach ($TTvas as $tx =>$val){
1612
-			        $l = clone $line;
1613
-			        $l->product_type = 1;
1614
-			        $l->special_code = '';
1615
-			        $l->qty = 1;
1616
-			        $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx));
1617
-			        $l->tva_tx = $tx;
1618
-			        $l->total_ht = $val['total_ht'];
1619
-			        $l->total_tva = $val['total_tva'];
1620
-			        $l->total = $line->total_ht;
1621
-			        $l->total_ttc = $val['total_ttc'];
1622
-			        $TLines[] = $l;
1623
-			        array_shift($TTvas);
1624
-			    }
1611
+				foreach ($TTvas as $tx =>$val){
1612
+					$l = clone $line;
1613
+					$l->product_type = 1;
1614
+					$l->special_code = '';
1615
+					$l->qty = 1;
1616
+					$l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx));
1617
+					$l->tva_tx = $tx;
1618
+					$l->total_ht = $val['total_ht'];
1619
+					$l->total_tva = $val['total_tva'];
1620
+					$l->total = $line->total_ht;
1621
+					$l->total_ttc = $val['total_ttc'];
1622
+					$TLines[] = $l;
1623
+					array_shift($TTvas);
1624
+				}
1625 1625
 			}
1626 1626
 			
1627 1627
 			global $nblignes;
@@ -1633,7 +1633,7 @@  discard block
 block discarded – undo
1633 1633
 				$this->resprints = '';
1634 1634
 				return 0;
1635 1635
 			}
1636
-	    }
1636
+		}
1637 1637
 		
1638 1638
 		return 0;
1639 1639
 	}
@@ -1796,18 +1796,18 @@  discard block
 block discarded – undo
1796 1796
 		}
1797 1797
 		elseif($object->element == 'order_supplier' )
1798 1798
 		{
1799
-		    $createRight = $user->rights->fournisseur->commande->creer;
1799
+			$createRight = $user->rights->fournisseur->commande->creer;
1800 1800
 		}
1801 1801
 		elseif($object->element == 'invoice_supplier' )
1802 1802
 		{
1803
-		    $createRight = $user->rights->fournisseur->facture->creer;
1803
+			$createRight = $user->rights->fournisseur->facture->creer;
1804 1804
 		}
1805 1805
 		
1806 1806
 		if($line->special_code!=$this->module_number || $line->product_type!=9) {
1807 1807
 			null;
1808 1808
 		}	
1809 1809
 		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)) 
1810
-        {
1810
+		{
1811 1811
 			if($object->element=='facture')$idvar = 'facid';
1812 1812
 			else $idvar='id';
1813 1813
 			
@@ -1854,7 +1854,7 @@  discard block
 block discarded – undo
1854 1854
 			//var_dump($line);
1855 1855
             
1856 1856
 			// HTML 5 data for js
1857
-            $data = $this->_getHtmlData($parameters, $object, $action, $hookmanager);
1857
+			$data = $this->_getHtmlData($parameters, $object, $action, $hookmanager);
1858 1858
             
1859 1859
 			
1860 1860
 			?>
@@ -1912,8 +1912,8 @@  discard block
 block discarded – undo
1912 1912
 						}
1913 1913
 						
1914 1914
 						if ($object->element == 'order_supplier' || $object->element == 'invoice_supplier') {
1915
-						    $line->label = !empty($line->description) ? $line->description : $line->desc;
1916
-						    $line->description = '';
1915
+							$line->label = !empty($line->description) ? $line->description : $line->desc;
1916
+							$line->description = '';
1917 1917
 						}
1918 1918
 						$newlabel = $line->label;
1919 1919
 						if($line->label=='' && !$isFreeText) {
@@ -2204,17 +2204,17 @@  discard block
 block discarded – undo
2204 2204
 		if ($object->statut == 0 && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && $action != 'editline')
2205 2205
 		{
2206 2206
 		    
2207
-		    if($object->element == 'invoice_supplier' || $object->element == 'order_supplier')
2208
-		    {
2209
-		        foreach ($object->lines as $line)
2210
-		        {
2211
-		            // fetch optionals attributes and labels
2212
-		            require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
2213
-		            $extrafields=new ExtraFields($this->db);
2214
-		            $extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true);
2215
-		            $line->fetch_optionals($line->id,$extralabels);
2216
-		        }
2217
-		    }
2207
+			if($object->element == 'invoice_supplier' || $object->element == 'order_supplier')
2208
+			{
2209
+				foreach ($object->lines as $line)
2210
+				{
2211
+					// fetch optionals attributes and labels
2212
+					require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
2213
+					$extrafields=new ExtraFields($this->db);
2214
+					$extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true);
2215
+					$line->fetch_optionals($line->id,$extralabels);
2216
+				}
2217
+			}
2218 2218
 		    
2219 2219
 			$TSubNc = array();
2220 2220
 			foreach ($object->lines as &$l)
@@ -2305,80 +2305,80 @@  discard block
 block discarded – undo
2305 2305
 	{
2306 2306
 		dol_include_once('/subtotal/class/subtotal.class.php');
2307 2307
 
2308
-	    $line = &$parameters['line'];
2308
+		$line = &$parameters['line'];
2309 2309
 	    
2310
-	    $ThtmlData['data-id']           = $line->id;
2311
-	    $ThtmlData['data-product_type'] = $line->product_type;
2312
-	    $ThtmlData['data-qty']          = 0; //$line->qty;
2313
-	    $ThtmlData['data-level']        = TSubtotal::getNiveau($line);
2310
+		$ThtmlData['data-id']           = $line->id;
2311
+		$ThtmlData['data-product_type'] = $line->product_type;
2312
+		$ThtmlData['data-qty']          = 0; //$line->qty;
2313
+		$ThtmlData['data-level']        = TSubtotal::getNiveau($line);
2314 2314
 	    
2315
-	    if(TSubtotal::isTitle($line)){
2316
-	        $ThtmlData['data-issubtotal'] = 'title';
2317
-	    }elseif(TSubtotal::isSubtotal($line)){
2318
-	        $ThtmlData['data-issubtotal'] = 'subtotal';
2319
-	    }
2320
-	    else{
2321
-	        $ThtmlData['data-issubtotal'] = 'freetext';
2322
-	    }
2315
+		if(TSubtotal::isTitle($line)){
2316
+			$ThtmlData['data-issubtotal'] = 'title';
2317
+		}elseif(TSubtotal::isSubtotal($line)){
2318
+			$ThtmlData['data-issubtotal'] = 'subtotal';
2319
+		}
2320
+		else{
2321
+			$ThtmlData['data-issubtotal'] = 'freetext';
2322
+		}
2323 2323
 	    
2324 2324
 	    
2325
-	    // Change or add data  from hooks
2326
-	    $parameters = array_replace($parameters , array(  'ThtmlData' => $ThtmlData )  );
2325
+		// Change or add data  from hooks
2326
+		$parameters = array_replace($parameters , array(  'ThtmlData' => $ThtmlData )  );
2327 2327
 	    
2328
-	    // hook 
2329
-	    $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
2330
-	    if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
2331
-	    if ($reshook>0)
2332
-	    {
2333
-	        $ThtmlData = $hookmanager->resArray;
2334
-	    }
2335
-
2336
-	    return $this->implodeHtmlData($ThtmlData);
2328
+		// hook 
2329
+		$reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
2330
+		if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
2331
+		if ($reshook>0)
2332
+		{
2333
+			$ThtmlData = $hookmanager->resArray;
2334
+		}
2335
+
2336
+		return $this->implodeHtmlData($ThtmlData);
2337 2337
 	
2338 2338
 	}
2339 2339
 	
2340 2340
 	
2341 2341
 	function implodeHtmlData($ThtmlData = array())
2342 2342
 	{
2343
-	    $data = '';
2344
-	    foreach($ThtmlData as $k => $h )
2345
-	    {
2346
-	        if(is_array($h))
2347
-	        {
2348
-	            $h = json_encode($h);
2349
-	        }
2343
+		$data = '';
2344
+		foreach($ThtmlData as $k => $h )
2345
+		{
2346
+			if(is_array($h))
2347
+			{
2348
+				$h = json_encode($h);
2349
+			}
2350 2350
 	        
2351
-	        $data .= $k . '="'.dol_htmlentities($h, ENT_QUOTES).'" ';
2352
-	    }
2351
+			$data .= $k . '="'.dol_htmlentities($h, ENT_QUOTES).'" ';
2352
+		}
2353 2353
 	    
2354
-	    return $data;
2354
+		return $data;
2355 2355
 	}
2356 2356
 	
2357 2357
 	function _ajax_block_order_js($object)
2358 2358
 	{
2359
-	    global $conf,$tagidfortablednd,$filepath,$langs;
2359
+		global $conf,$tagidfortablednd,$filepath,$langs;
2360 2360
 	    
2361
-	    /*
2361
+		/*
2362 2362
 	     * this part of js is base on dolibarr htdocs/core/tpl/ajaxrow.tpl.php 
2363 2363
 	     * for compatibility reasons we don't use tableDnD but jquery sortable
2364 2364
 	     */
2365 2365
 	    
2366
-	    $id=$object->id;
2367
-	    $nboflines=(isset($object->lines)?count($object->lines):0);
2368
-	    $forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1;
2366
+		$id=$object->id;
2367
+		$nboflines=(isset($object->lines)?count($object->lines):0);
2368
+		$forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1;
2369 2369
 	    
2370
-	    $id=$object->id;
2371
-	    $fk_element=$object->fk_element;
2372
-	    $table_element_line=$object->table_element_line;
2373
-	    $nboflines=(isset($object->lines)?count($object->lines):(empty($nboflines)?0:$nboflines));
2374
-	    $tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd);
2375
-	    $filepath=(empty($filepath)?'':$filepath);
2370
+		$id=$object->id;
2371
+		$fk_element=$object->fk_element;
2372
+		$table_element_line=$object->table_element_line;
2373
+		$nboflines=(isset($object->lines)?count($object->lines):(empty($nboflines)?0:$nboflines));
2374
+		$tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd);
2375
+		$filepath=(empty($filepath)?'':$filepath);
2376 2376
 	    
2377 2377
 	    
2378
-	    if (GETPOST('action','aZ09') != 'editline' && $nboflines > 1)
2379
-	    {
2378
+		if (GETPOST('action','aZ09') != 'editline' && $nboflines > 1)
2379
+		{
2380 2380
 	        
2381
-	        ?>
2381
+			?>
2382 2382
 		
2383 2383
 		
2384 2384
 			<script type="text/javascript">
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.