Passed
Push — master ( e3d7a6...b538be )
by John
02:46 queued 10s
created
core/modules/facture/doc/pdf_crabe_subtotal.modules.php 1 patch
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -38,17 +38,17 @@  discard block
 block discarded – undo
38 38
  */
39 39
 class pdf_crabe_subtotal extends ModelePDFFactures
40 40
 {
41
-    var $db;
42
-    var $name;
43
-    var $description;
44
-    var $type;
41
+	var $db;
42
+	var $name;
43
+	var $description;
44
+	var $type;
45 45
 
46
-    var $phpmin = array(4,3,0); // Minimum version of PHP required by module
47
-    var $version = 'dolibarr';
46
+	var $phpmin = array(4,3,0); // Minimum version of PHP required by module
47
+	var $version = 'dolibarr';
48 48
 
49
-    var $page_largeur;
50
-    var $page_hauteur;
51
-    var $format;
49
+	var $page_largeur;
50
+	var $page_hauteur;
51
+	var $format;
52 52
 	var $marge_gauche;
53 53
 	var	$marge_droite;
54 54
 	var	$marge_haute;
@@ -130,15 +130,15 @@  discard block
 block discarded – undo
130 130
 
131 131
 
132 132
 	/**
133
-     *  Function to build pdf onto disk
134
-     *
135
-     *  @param		Object		$object				Object to generate
136
-     *  @param		Translate	$outputlangs		Lang output object
137
-     *  @param		string		$srctemplatepath	Full path of source filename for generator using a template file
138
-     *  @param		int			$hidedetails		Do not show line details
139
-     *  @param		int			$hidedesc			Do not show desc
140
-     *  @param		int			$hideref			Do not show ref
141
-     *  @return     int         	    			1=OK, 0=KO
133
+	 *  Function to build pdf onto disk
134
+	 *
135
+	 *  @param		Object		$object				Object to generate
136
+	 *  @param		Translate	$outputlangs		Lang output object
137
+	 *  @param		string		$srctemplatepath	Full path of source filename for generator using a template file
138
+	 *  @param		int			$hidedetails		Do not show line details
139
+	 *  @param		int			$hidedesc			Do not show desc
140
+	 *  @param		int			$hideref			Do not show ref
141
+	 *  @return     int         	    			1=OK, 0=KO
142 142
 	 */
143 143
 	function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0)
144 144
 	{
@@ -230,25 +230,25 @@  discard block
 block discarded – undo
230 230
 
231 231
 				// Create pdf instance
232 232
 				$pdf=pdf_getInstance($this->format);
233
-                $default_font_size = pdf_getPDFFontSize($outputlangs);	// Must be after pdf_getInstance
233
+				$default_font_size = pdf_getPDFFontSize($outputlangs);	// Must be after pdf_getInstance
234 234
 				$heightforinfotot = 50;	// Height reserved to output the info and total part
235
-		        $heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5);	// Height reserved to output the free text on last page
236
-	            $heightforfooter = $this->marge_basse + 8;	// Height reserved to output the footer (value include bottom margin)
237
-                $pdf->SetAutoPageBreak(1,0);
238
-
239
-                if (class_exists('TCPDF'))
240
-                {
241
-                    $pdf->setPrintHeader(false);
242
-                    $pdf->setPrintFooter(false);
243
-                }
244
-                $pdf->SetFont(pdf_getPDFFont($outputlangs));
245
-
246
-                // Set path to the background PDF File
247
-                if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
248
-                {
249
-				    $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
250
-				    $tplidx = $pdf->importPage(1);
251
-                }
235
+				$heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5);	// Height reserved to output the free text on last page
236
+				$heightforfooter = $this->marge_basse + 8;	// Height reserved to output the footer (value include bottom margin)
237
+				$pdf->SetAutoPageBreak(1,0);
238
+
239
+				if (class_exists('TCPDF'))
240
+				{
241
+					$pdf->setPrintHeader(false);
242
+					$pdf->setPrintFooter(false);
243
+				}
244
+				$pdf->SetFont(pdf_getPDFFont($outputlangs));
245
+
246
+				// Set path to the background PDF File
247
+				if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
248
+				{
249
+					$pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
250
+					$tplidx = $pdf->importPage(1);
251
+				}
252 252
 
253 253
 				$pdf->Open();
254 254
 				$pagenb=0;
@@ -538,8 +538,8 @@  discard block
 block discarded – undo
538 538
 					// Discount on line
539 539
 					if ($object->lines[$i]->remise_percent)
540 540
 					{
541
-                        $pdf->SetXY($this->posxdiscount-2, $curY);
542
-					    $remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails);
541
+						$pdf->SetXY($this->posxdiscount-2, $curY);
542
+						$remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails);
543 543
 						$pdf->MultiCell($this->postotalht-$this->posxdiscount+2, 3, $remise_percent, 0, 'R');
544 544
 					}
545 545
 
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
 						$localtax2_type = $localtaxtmp_array[2];
578 578
 					}
579 579
 
580
-				    // retrieve global local tax
580
+					// retrieve global local tax
581 581
 					if ($localtax1_type && $localtax1ligne != 0)
582 582
 						$this->localtax1[$localtax1_type][$localtax1_rate]+=$localtax1ligne;
583 583
 					if ($localtax2_type && $localtax2ligne != 0)
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
 					}
596 596
 					else {
597 597
 						// standard
598
-                        if(!empty($tvaligne)) $this->tva[$vatrate] += $tvaligne;
598
+						if(!empty($tvaligne)) $this->tva[$vatrate] += $tvaligne;
599 599
 					}
600 600
 
601 601
 					if ($posYAfterImage > $posYAfterDescription) $nexY=$posYAfterImage;
@@ -713,20 +713,20 @@  discard block
 block discarded – undo
713 713
 	/**
714 714
 	 *  Show payments table
715 715
 	 *
716
-     *  @param	PDF			$pdf           Object PDF
717
-     *  @param  Object		$object         Object invoice
718
-     *  @param  int			$posy           Position y in PDF
719
-     *  @param  Translate	$outputlangs    Object langs for output
720
-     *  @return int             			<0 if KO, >0 if OK
716
+	 *  @param	PDF			$pdf           Object PDF
717
+	 *  @param  Object		$object         Object invoice
718
+	 *  @param  int			$posy           Position y in PDF
719
+	 *  @param  Translate	$outputlangs    Object langs for output
720
+	 *  @return int             			<0 if KO, >0 if OK
721 721
 	 */
722 722
 	function _tableau_versements(&$pdf, $object, $posy, $outputlangs)
723 723
 	{
724 724
 		global $conf;
725 725
 
726
-        $sign=1;
727
-        if ($object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1;
726
+		$sign=1;
727
+		if ($object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1;
728 728
 
729
-        $tab3_posx = 120;
729
+		$tab3_posx = 120;
730 730
 		$tab3_top = $posy + 8;
731 731
 		$tab3_width = 80;
732 732
 		$tab3_height = 4;
@@ -953,13 +953,13 @@  discard block
 block discarded – undo
953 953
 						$pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo',$account->proprio),0,'L',0);
954 954
 						$posy=$pdf->GetY()+1;
955 955
 
956
-			            if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS))
957
-			            {
956
+						if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS))
957
+						{
958 958
 							$pdf->SetXY($this->marge_gauche, $posy);
959 959
 							$pdf->SetFont('','', $default_font_size - $diffsizetitle);
960 960
 							$pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($account->owner_address), 0, 'L', 0);
961 961
 							$posy=$pdf->GetY()+2;
962
-			            }
962
+						}
963 963
 					}
964 964
 					if ($conf->global->FACTURE_CHQ_NUMBER == -1)
965 965
 					{
@@ -968,13 +968,13 @@  discard block
 block discarded – undo
968 968
 						$pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo',$this->emetteur->name),0,'L',0);
969 969
 						$posy=$pdf->GetY()+1;
970 970
 
971
-			            if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS))
972
-			            {
971
+						if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS))
972
+						{
973 973
 							$pdf->SetXY($this->marge_gauche, $posy);
974 974
 							$pdf->SetFont('','', $default_font_size - $diffsizetitle);
975 975
 							$pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0, 'L', 0);
976 976
 							$posy=$pdf->GetY()+2;
977
-			            }
977
+						}
978 978
 					}
979 979
 				}
980 980
 			}
@@ -1016,10 +1016,10 @@  discard block
 block discarded – undo
1016 1016
 	{
1017 1017
 		global $conf,$mysoc;
1018 1018
 
1019
-        $sign=1;
1020
-        if ($object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1;
1019
+		$sign=1;
1020
+		if ($object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1;
1021 1021
 
1022
-        $default_font_size = pdf_getPDFFontSize($outputlangs);
1022
+		$default_font_size = pdf_getPDFFontSize($outputlangs);
1023 1023
 
1024 1024
 		$tab2_top = $posy;
1025 1025
 		$tab2_hl = 4;
@@ -1088,7 +1088,7 @@  discard block
 block discarded – undo
1088 1088
 							}
1089 1089
 						}
1090 1090
 					}
1091
-	      		//}
1091
+		  		//}
1092 1092
 				//Local tax 2 before VAT
1093 1093
 				//if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on')
1094 1094
 				//{
@@ -1180,7 +1180,7 @@  discard block
 block discarded – undo
1180 1180
 							}
1181 1181
 						}
1182 1182
 					}
1183
-	      		//}
1183
+		  		//}
1184 1184
 				//Local tax 2 after VAT
1185 1185
 				//if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on')
1186 1186
 				//{
@@ -1190,7 +1190,7 @@  discard block
 block discarded – undo
1190 1190
 
1191 1191
 						foreach( $localtax_rate as $tvakey => $tvaval )
1192 1192
 						{
1193
-						    // retrieve global local tax
1193
+							// retrieve global local tax
1194 1194
 							if ($tvakey != 0)    // On affiche pas taux 0
1195 1195
 							{
1196 1196
 								//$this->atleastoneratenotnull++;
@@ -1424,15 +1424,15 @@  discard block
 block discarded – undo
1424 1424
 
1425 1425
 		// Show Draft Watermark
1426 1426
 		if($object->statut==0 && (! empty($conf->global->FACTURE_DRAFT_WATERMARK)) )
1427
-        {
1428
-		      pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->FACTURE_DRAFT_WATERMARK);
1429
-        }
1427
+		{
1428
+			  pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->FACTURE_DRAFT_WATERMARK);
1429
+		}
1430 1430
 
1431 1431
 		$pdf->SetTextColor(0,0,60);
1432 1432
 		$pdf->SetFont('','B', $default_font_size + 3);
1433 1433
 
1434 1434
 		$posy=$this->marge_haute;
1435
-        $posx=$this->page_largeur-$this->marge_droite-100;
1435
+		$posx=$this->page_largeur-$this->marge_droite-100;
1436 1436
 
1437 1437
 		$pdf->SetXY($this->marge_gauche,$posy);
1438 1438
 
@@ -1442,7 +1442,7 @@  discard block
 block discarded – undo
1442 1442
 		{
1443 1443
 			if (is_readable($logo))
1444 1444
 			{
1445
-			    $height=pdf_getHeightForLogo($logo);
1445
+				$height=pdf_getHeightForLogo($logo);
1446 1446
 				$pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);	// width=0 (auto)
1447 1447
 			}
1448 1448
 			else
@@ -1633,7 +1633,7 @@  discard block
 block discarded – undo
1633 1633
 
1634 1634
 	/**
1635 1635
 	 *   	Show footer of page. Need this->emetteur object
1636
-     *
1636
+	 *
1637 1637
 	 *   	@param	PDF			$pdf     			PDF
1638 1638
 	 * 		@param	Object		$object				Object to show
1639 1639
 	 *      @param	Translate	$outputlangs		Object lang for output
Please login to merge, or discard this patch.
core/modules/commande/doc/pdf_einstein_subtotal.modules.php 1 patch
Indentation   +117 added lines, -117 removed lines patch added patch discarded remove patch
@@ -38,23 +38,23 @@  discard block
 block discarded – undo
38 38
  */
39 39
 class pdf_einstein_subtotal extends ModelePDFCommandes
40 40
 {
41
-    var $db;
42
-    var $name;
43
-    var $description;
44
-    var $type;
41
+	var $db;
42
+	var $name;
43
+	var $description;
44
+	var $type;
45 45
 
46
-    var $phpmin = array(4,3,0); // Minimum version of PHP required by module
47
-    var $version = 'dolibarr';
46
+	var $phpmin = array(4,3,0); // Minimum version of PHP required by module
47
+	var $version = 'dolibarr';
48 48
 
49
-    var $page_largeur;
50
-    var $page_hauteur;
51
-    var $format;
49
+	var $page_largeur;
50
+	var $page_hauteur;
51
+	var $format;
52 52
 	var $marge_gauche;
53 53
 	var	$marge_droite;
54 54
 	var	$marge_haute;
55 55
 	var	$marge_basse;
56 56
 
57
-    var $emetteur;	// Objet societe qui emet
57
+	var $emetteur;	// Objet societe qui emet
58 58
 
59 59
 
60 60
 	/**
@@ -129,15 +129,15 @@  discard block
 block discarded – undo
129 129
 	}
130 130
 
131 131
 	/**
132
-     *  Function to build pdf onto disk
133
-     *
134
-     *  @param		Object		$object				Object to generate
135
-     *  @param		Translate	$outputlangs		Lang output object
136
-     *  @param		string		$srctemplatepath	Full path of source filename for generator using a template file
137
-     *  @param		int			$hidedetails		Do not show line details
138
-     *  @param		int			$hidedesc			Do not show desc
139
-     *  @param		int			$hideref			Do not show ref
140
-     *  @return     int             			1=OK, 0=KO
132
+	 *  Function to build pdf onto disk
133
+	 *
134
+	 *  @param		Object		$object				Object to generate
135
+	 *  @param		Translate	$outputlangs		Lang output object
136
+	 *  @param		string		$srctemplatepath	Full path of source filename for generator using a template file
137
+	 *  @param		int			$hidedetails		Do not show line details
138
+	 *  @param		int			$hidedesc			Do not show desc
139
+	 *  @param		int			$hideref			Do not show ref
140
+	 *  @return     int             			1=OK, 0=KO
141 141
 	 */
142 142
 	function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0)
143 143
 	{
@@ -159,13 +159,13 @@  discard block
 block discarded – undo
159 159
 
160 160
 		if ($conf->commande->dir_output)
161 161
 		{
162
-            $object->fetch_thirdparty();
162
+			$object->fetch_thirdparty();
163 163
 			if(!empty($object->client) ){
164 164
 				$object->thirdparty = $object->client;
165 165
 			}
166
-            $deja_regle = "";
166
+			$deja_regle = "";
167 167
 
168
-            // Definition of $dir and $file
168
+			// Definition of $dir and $file
169 169
 			if ($object->specimen)
170 170
 			{
171 171
 				$dir = $conf->commande->dir_output;
@@ -204,22 +204,22 @@  discard block
 block discarded – undo
204 204
 				$pdf=pdf_getInstance($this->format);
205 205
 				$default_font_size = pdf_getPDFFontSize($outputlangs);	// Must be after pdf_getInstance
206 206
 				$heightforinfotot = 50;	// Height reserved to output the info and total part
207
-		        $heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5);	// Height reserved to output the free text on last page
208
-	            $heightforfooter = $this->marge_basse + 8;	// Height reserved to output the footer (value include bottom margin)
209
-                $pdf->SetAutoPageBreak(1,0);
210
-
211
-                if (class_exists('TCPDF'))
212
-                {
213
-                    $pdf->setPrintHeader(false);
214
-                    $pdf->setPrintFooter(false);
215
-                }
216
-                $pdf->SetFont(pdf_getPDFFont($outputlangs));
217
-                // Set path to the background PDF File
218
-                if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
219
-                {
220
-                    $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
221
-                    $tplidx = $pdf->importPage(1);
222
-                }
207
+				$heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5);	// Height reserved to output the free text on last page
208
+				$heightforfooter = $this->marge_basse + 8;	// Height reserved to output the footer (value include bottom margin)
209
+				$pdf->SetAutoPageBreak(1,0);
210
+
211
+				if (class_exists('TCPDF'))
212
+				{
213
+					$pdf->setPrintHeader(false);
214
+					$pdf->setPrintFooter(false);
215
+				}
216
+				$pdf->SetFont(pdf_getPDFFont($outputlangs));
217
+				// Set path to the background PDF File
218
+				if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
219
+				{
220
+					$pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
221
+					$tplidx = $pdf->importPage(1);
222
+				}
223 223
 
224 224
 				$pdf->Open();
225 225
 				$pagenb=0;
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
 						$localtax2_type = $localtaxtmp_array[2];
524 524
 					}
525 525
 
526
-				    // retrieve global local tax
526
+					// retrieve global local tax
527 527
 					if ($localtax1_type && $localtax1ligne != 0)
528 528
 						$this->localtax1[$localtax1_type][$localtax1_rate]+=$localtax1ligne;
529 529
 					if ($localtax2_type && $localtax2ligne != 0)
@@ -541,7 +541,7 @@  discard block
 block discarded – undo
541 541
 					}
542 542
 					else {
543 543
 						// standard
544
-                        if(!empty($tvaligne)) $this->tva[$vatrate] += $tvaligne;
544
+						if(!empty($tvaligne)) $this->tva[$vatrate] += $tvaligne;
545 545
 					}
546 546
 
547 547
 					// Add line
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
 
656 656
 	/**
657 657
 	 *  Show payments table
658
-     *
658
+	 *
659 659
 	 *  @param	PDF			$pdf     		Object PDF
660 660
 	 *  @param  Object		$object			Object order
661 661
 	 *	@param	int			$posy			Position y in PDF
@@ -684,7 +684,7 @@  discard block
 block discarded – undo
684 684
 
685 685
 		$pdf->SetFont('','', $default_font_size - 1);
686 686
 
687
-        // If France, show VAT mention if not applicable
687
+		// If France, show VAT mention if not applicable
688 688
 		if ($this->emetteur->country_code == 'FR' && $this->franchise == 1)
689 689
 		{
690 690
 			$pdf->SetFont('','B', $default_font_size - 2);
@@ -713,8 +713,8 @@  discard block
 block discarded – undo
713 713
 			$posy=$pdf->GetY()+3;
714 714
 		}
715 715
 
716
-        // Check a payment mode is defined
717
-        /* Not used with orders
716
+		// Check a payment mode is defined
717
+		/* Not used with orders
718 718
 		if (empty($object->mode_reglement_code)
719 719
         	&& ! $conf->global->FACTURE_CHQ_NUMBER
720 720
         	&& ! $conf->global->FACTURE_RIB_NUMBER)
@@ -740,10 +740,10 @@  discard block
 block discarded – undo
740 740
             $posy=$pdf->GetY()+1;
741 741
 		}*/
742 742
 
743
-	    // Show planed date of delivery
744
-        if (! empty($object->date_livraison))
743
+		// Show planed date of delivery
744
+		if (! empty($object->date_livraison))
745 745
 		{
746
-            $outputlangs->load("sendings");
746
+			$outputlangs->load("sendings");
747 747
 			$pdf->SetFont('','B', $default_font_size - 2);
748 748
 			$pdf->SetXY($this->marge_gauche, $posy);
749 749
 			$titre = $outputlangs->transnoentities("DateDeliveryPlanned").':';
@@ -753,9 +753,9 @@  discard block
 block discarded – undo
753 753
 			$dlp=dol_print_date($object->date_livraison,"daytext",false,$outputlangs,true);
754 754
 			$pdf->MultiCell(80, 4, $dlp, 0, 'L');
755 755
 
756
-            $posy=$pdf->GetY()+1;
756
+			$posy=$pdf->GetY()+1;
757 757
 		}
758
-        elseif ($object->availability_code || $object->availability)    // Show availability conditions
758
+		elseif ($object->availability_code || $object->availability)    // Show availability conditions
759 759
 		{
760 760
 			$pdf->SetFont('','B', $default_font_size - 2);
761 761
 			$pdf->SetXY($this->marge_gauche, $posy);
@@ -771,70 +771,70 @@  discard block
 block discarded – undo
771 771
 			$posy=$pdf->GetY()+1;
772 772
 		}
773 773
 
774
-      	// Show payment mode
775
-        if ($object->mode_reglement_code
776
-        	 && $object->mode_reglement_code != 'CHQ'
777
-           	 && $object->mode_reglement_code != 'VIR')
778
-           	 {
779
-	            $pdf->SetFont('','B', $default_font_size - 2);
780
-	            $pdf->SetXY($this->marge_gauche, $posy);
781
-	            $titre = $outputlangs->transnoentities("PaymentMode").':';
782
-	            $pdf->MultiCell(80, 5, $titre, 0, 'L');
774
+	  	// Show payment mode
775
+		if ($object->mode_reglement_code
776
+			 && $object->mode_reglement_code != 'CHQ'
777
+		   	 && $object->mode_reglement_code != 'VIR')
778
+		   	 {
779
+				$pdf->SetFont('','B', $default_font_size - 2);
780
+				$pdf->SetXY($this->marge_gauche, $posy);
781
+				$titre = $outputlangs->transnoentities("PaymentMode").':';
782
+				$pdf->MultiCell(80, 5, $titre, 0, 'L');
783 783
 
784 784
 				$pdf->SetFont('','', $default_font_size - 2);
785
-	            $pdf->SetXY($posxval, $posy);
786
-	            $lib_mode_reg=$outputlangs->transnoentities("PaymentType".$object->mode_reglement_code)!=('PaymentType'.$object->mode_reglement_code)?$outputlangs->transnoentities("PaymentType".$object->mode_reglement_code):$outputlangs->convToOutputCharset($object->mode_reglement);
787
-	            $pdf->MultiCell(80, 5, $lib_mode_reg,0,'L');
785
+				$pdf->SetXY($posxval, $posy);
786
+				$lib_mode_reg=$outputlangs->transnoentities("PaymentType".$object->mode_reglement_code)!=('PaymentType'.$object->mode_reglement_code)?$outputlangs->transnoentities("PaymentType".$object->mode_reglement_code):$outputlangs->convToOutputCharset($object->mode_reglement);
787
+				$pdf->MultiCell(80, 5, $lib_mode_reg,0,'L');
788 788
 
789
-	            $posy=$pdf->GetY()+2;
790
-           	 }
789
+				$posy=$pdf->GetY()+2;
790
+		   	 }
791 791
 
792 792
 		// Show payment mode CHQ
793
-        if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ')
794
-        {
795
-        	// Si mode reglement non force ou si force a CHQ
796
-	        if (! empty($conf->global->FACTURE_CHQ_NUMBER))
797
-	        {
798
-	            if ($conf->global->FACTURE_CHQ_NUMBER > 0)
799
-	            {
800
-	                $account = new Account($this->db);
801
-	                $account->fetch($conf->global->FACTURE_CHQ_NUMBER);
802
-
803
-	                $pdf->SetXY($this->marge_gauche, $posy);
804
-	                $pdf->SetFont('','B', $default_font_size - 3);
805
-	                $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo',$account->proprio),0,'L',0);
806
-		            $posy=$pdf->GetY()+1;
807
-
808
-		            if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS))
809
-		            {
810
-		                $pdf->SetXY($this->marge_gauche, $posy);
811
-		                $pdf->SetFont('','', $default_font_size - 3);
812
-		                $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($account->owner_address), 0, 'L', 0);
813
-			            $posy=$pdf->GetY()+2;
814
-		            }
815
-	            }
816
-	            if ($conf->global->FACTURE_CHQ_NUMBER == -1)
817
-	            {
818
-	                $pdf->SetXY($this->marge_gauche, $posy);
819
-	                $pdf->SetFont('','B', $default_font_size - 3);
820
-	                $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo',$this->emetteur->name),0,'L',0);
821
-		            $posy=$pdf->GetY()+1;
822
-
823
-		            if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS))
824
-		            {
825
-			            $pdf->SetXY($this->marge_gauche, $posy);
826
-		                $pdf->SetFont('','', $default_font_size - 3);
827
-		                $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0, 'L', 0);
828
-			            $posy=$pdf->GetY()+2;
829
-		            }
830
-	            }
831
-	        }
793
+		if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ')
794
+		{
795
+			// Si mode reglement non force ou si force a CHQ
796
+			if (! empty($conf->global->FACTURE_CHQ_NUMBER))
797
+			{
798
+				if ($conf->global->FACTURE_CHQ_NUMBER > 0)
799
+				{
800
+					$account = new Account($this->db);
801
+					$account->fetch($conf->global->FACTURE_CHQ_NUMBER);
802
+
803
+					$pdf->SetXY($this->marge_gauche, $posy);
804
+					$pdf->SetFont('','B', $default_font_size - 3);
805
+					$pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo',$account->proprio),0,'L',0);
806
+					$posy=$pdf->GetY()+1;
807
+
808
+					if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS))
809
+					{
810
+						$pdf->SetXY($this->marge_gauche, $posy);
811
+						$pdf->SetFont('','', $default_font_size - 3);
812
+						$pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($account->owner_address), 0, 'L', 0);
813
+						$posy=$pdf->GetY()+2;
814
+					}
815
+				}
816
+				if ($conf->global->FACTURE_CHQ_NUMBER == -1)
817
+				{
818
+					$pdf->SetXY($this->marge_gauche, $posy);
819
+					$pdf->SetFont('','B', $default_font_size - 3);
820
+					$pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo',$this->emetteur->name),0,'L',0);
821
+					$posy=$pdf->GetY()+1;
822
+
823
+					if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS))
824
+					{
825
+						$pdf->SetXY($this->marge_gauche, $posy);
826
+						$pdf->SetFont('','', $default_font_size - 3);
827
+						$pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0, 'L', 0);
828
+						$posy=$pdf->GetY()+2;
829
+					}
830
+				}
831
+			}
832 832
 		}
833 833
 
834
-        // If payment mode not forced or forced to VIR, show payment with BAN
835
-        if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR')
836
-        {
837
-        	if (! empty($object->fk_bank) || ! empty($conf->global->FACTURE_RIB_NUMBER))
834
+		// If payment mode not forced or forced to VIR, show payment with BAN
835
+		if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR')
836
+		{
837
+			if (! empty($object->fk_bank) || ! empty($conf->global->FACTURE_RIB_NUMBER))
838 838
 			{
839 839
 				$bankid=(empty($object->fk_bank)?$conf->global->FACTURE_RIB_NUMBER:$object->fk_bank);
840 840
 				$account = new Account($this->db);
@@ -847,7 +847,7 @@  discard block
 block discarded – undo
847 847
 
848 848
 				$posy+=2;
849 849
 			}
850
-        }
850
+		}
851 851
 
852 852
 		return $posy;
853 853
 	}
@@ -865,7 +865,7 @@  discard block
 block discarded – undo
865 865
 	 */
866 866
 	function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
867 867
 	{
868
-	    global $conf,$mysoc;
868
+		global $conf,$mysoc;
869 869
 
870 870
 		$default_font_size = pdf_getPDFFontSize($outputlangs);
871 871
 
@@ -874,7 +874,7 @@  discard block
 block discarded – undo
874 874
 		$pdf->SetFont('','', $default_font_size - 1);
875 875
 
876 876
 		// Tableau total
877
-        $col1x = 120; $col2x = 170;
877
+		$col1x = 120; $col2x = 170;
878 878
 		if ($this->page_largeur < 210) // To work with US executive format
879 879
 		{
880 880
 			$col2x-=20;
@@ -935,7 +935,7 @@  discard block
 block discarded – undo
935 935
 							}
936 936
 						}
937 937
 					}
938
-	      		//}
938
+		  		//}
939 939
 				//Local tax 2 before VAT
940 940
 				//if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on')
941 941
 				//{
@@ -1026,7 +1026,7 @@  discard block
 block discarded – undo
1026 1026
 							}
1027 1027
 						}
1028 1028
 					}
1029
-	      		//}
1029
+		  		//}
1030 1030
 				//Local tax 2 after VAT
1031 1031
 				//if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on')
1032 1032
 				//{
@@ -1075,8 +1075,8 @@  discard block
 block discarded – undo
1075 1075
 
1076 1076
 		$pdf->SetTextColor(0,0,0);
1077 1077
 
1078
-        $creditnoteamount=0;
1079
-        $depositsamount=0;
1078
+		$creditnoteamount=0;
1079
+		$depositsamount=0;
1080 1080
 		//$creditnoteamount=$object->getSumCreditNotesUsed();
1081 1081
 		//$depositsamount=$object->getSumDepositsUsed();
1082 1082
 		//print "x".$creditnoteamount."-".$depositsamount;exit;
@@ -1230,7 +1230,7 @@  discard block
 block discarded – undo
1230 1230
 		// Show Draft Watermark
1231 1231
 		if($object->statut==0 && (! empty($conf->global->COMMANDE_DRAFT_WATERMARK)) )
1232 1232
 		{
1233
-            pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->COMMANDE_DRAFT_WATERMARK);
1233
+			pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->COMMANDE_DRAFT_WATERMARK);
1234 1234
 		}
1235 1235
 
1236 1236
 		$pdf->SetTextColor(0,0,60);
@@ -1247,8 +1247,8 @@  discard block
 block discarded – undo
1247 1247
 		{
1248 1248
 			if (is_readable($logo))
1249 1249
 			{
1250
-			    $height=pdf_getHeightForLogo($logo);
1251
-			    $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);	// width=0 (auto)
1250
+				$height=pdf_getHeightForLogo($logo);
1251
+				$pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);	// width=0 (auto)
1252 1252
 			}
1253 1253
 			else
1254 1254
 			{
@@ -1386,7 +1386,7 @@  discard block
 block discarded – undo
1386 1386
 
1387 1387
 	/**
1388 1388
 	 *   	Show footer of page. Need this->emetteur object
1389
-     *
1389
+	 *
1390 1390
 	 *   	@param	PDF			$pdf     			PDF
1391 1391
 	 * 		@param	Object		$object				Object to show
1392 1392
 	 *      @param	Translate	$outputlangs		Object lang for output
Please login to merge, or discard this patch.
core/triggers/interface_90_modSubtotal_subtotaltrigger.class.php 1 patch
Indentation   +612 added lines, -612 removed lines patch added patch discarded remove patch
@@ -36,68 +36,68 @@  discard block
 block discarded – undo
36 36
 class Interfacesubtotaltrigger
37 37
 {
38 38
 
39
-    private $db;
40
-
41
-    /**
42
-     * Constructor
43
-     *
44
-     * 	@param		DoliDB		$db		Database handler
45
-     */
46
-    public function __construct($db)
47
-    {
48
-        $this->db = $db;
49
-
50
-        $this->name = preg_replace('/^Interface/i', '', get_class($this));
51
-        $this->family = "demo";
52
-        $this->description = "Triggers of this module are empty functions."
53
-            . "They have no effect."
54
-            . "They are provided for tutorial purpose only.";
55
-        // 'development', 'experimental', 'dolibarr' or version
56
-        $this->version = 'development';
57
-        $this->picto = 'titre@titre';
58
-    }
59
-
60
-    /**
61
-     * Trigger name
62
-     *
63
-     * 	@return		string	Name of trigger file
64
-     */
65
-    public function getName()
66
-    {
67
-        return $this->name;
68
-    }
69
-
70
-    /**
71
-     * Trigger description
72
-     *
73
-     * 	@return		string	Description of trigger file
74
-     */
75
-    public function getDesc()
76
-    {
77
-        return $this->description;
78
-    }
79
-
80
-    /**
81
-     * Trigger version
82
-     *
83
-     * 	@return		string	Version of trigger file
84
-     */
85
-    public function getVersion()
86
-    {
87
-        global $langs;
88
-        $langs->load("admin");
89
-
90
-        if ($this->version == 'development') {
91
-            return $langs->trans("Development");
92
-        } elseif ($this->version == 'experimental')
93
-
94
-                return $langs->trans("Experimental");
95
-        elseif ($this->version == 'dolibarr') return DOL_VERSION;
96
-        elseif ($this->version) return $this->version;
97
-        else {
98
-            return $langs->trans("Unknown");
99
-        }
100
-    }
39
+	private $db;
40
+
41
+	/**
42
+	 * Constructor
43
+	 *
44
+	 * 	@param		DoliDB		$db		Database handler
45
+	 */
46
+	public function __construct($db)
47
+	{
48
+		$this->db = $db;
49
+
50
+		$this->name = preg_replace('/^Interface/i', '', get_class($this));
51
+		$this->family = "demo";
52
+		$this->description = "Triggers of this module are empty functions."
53
+			. "They have no effect."
54
+			. "They are provided for tutorial purpose only.";
55
+		// 'development', 'experimental', 'dolibarr' or version
56
+		$this->version = 'development';
57
+		$this->picto = 'titre@titre';
58
+	}
59
+
60
+	/**
61
+	 * Trigger name
62
+	 *
63
+	 * 	@return		string	Name of trigger file
64
+	 */
65
+	public function getName()
66
+	{
67
+		return $this->name;
68
+	}
69
+
70
+	/**
71
+	 * Trigger description
72
+	 *
73
+	 * 	@return		string	Description of trigger file
74
+	 */
75
+	public function getDesc()
76
+	{
77
+		return $this->description;
78
+	}
79
+
80
+	/**
81
+	 * Trigger version
82
+	 *
83
+	 * 	@return		string	Version of trigger file
84
+	 */
85
+	public function getVersion()
86
+	{
87
+		global $langs;
88
+		$langs->load("admin");
89
+
90
+		if ($this->version == 'development') {
91
+			return $langs->trans("Development");
92
+		} elseif ($this->version == 'experimental')
93
+
94
+				return $langs->trans("Experimental");
95
+		elseif ($this->version == 'dolibarr') return DOL_VERSION;
96
+		elseif ($this->version) return $this->version;
97
+		else {
98
+			return $langs->trans("Unknown");
99
+		}
100
+	}
101 101
 	
102 102
 	public function addToBegin(&$parent, &$object, $rang)
103 103
 	{
@@ -147,27 +147,27 @@  discard block
 block discarded – undo
147 147
 		}
148 148
 	}
149 149
 	
150
-    /**
151
-     * Function called when a Dolibarrr business event is done.
152
-     * All functions "run_trigger" are triggered if file
153
-     * is inside directory core/triggers
154
-     *
155
-     * 	@param		string		$action		Event action code
156
-     * 	@param		Object		$object		Object
157
-     * 	@param		User		$user		Object user
158
-     * 	@param		Translate	$langs		Object langs
159
-     * 	@param		conf		$conf		Object conf
160
-     * 	@return		int						<0 if KO, 0 if no triggered ran, >0 if OK
161
-     */
162
-    public function run_trigger($action, $object, $user, $langs, $conf)
163
-    {
164
-        // Put here code you want to execute when a Dolibarr business events occurs.
165
-        // Data and type of action are stored into $object and $action
166
-        // Users
167
-        dol_include_once('/subtotal/class/subtotal.class.php');
168
-        $langs->load('subtotal@subtotal');
169
-
170
-        if (!empty($conf->global->SUBTOTAL_ALLOW_ADD_LINE_UNDER_TITLE) && in_array($action, array('LINEPROPAL_INSERT', 'LINEORDER_INSERT', 'LINEBILL_INSERT')))
150
+	/**
151
+	 * Function called when a Dolibarrr business event is done.
152
+	 * All functions "run_trigger" are triggered if file
153
+	 * is inside directory core/triggers
154
+	 *
155
+	 * 	@param		string		$action		Event action code
156
+	 * 	@param		Object		$object		Object
157
+	 * 	@param		User		$user		Object user
158
+	 * 	@param		Translate	$langs		Object langs
159
+	 * 	@param		conf		$conf		Object conf
160
+	 * 	@return		int						<0 if KO, 0 if no triggered ran, >0 if OK
161
+	 */
162
+	public function run_trigger($action, $object, $user, $langs, $conf)
163
+	{
164
+		// Put here code you want to execute when a Dolibarr business events occurs.
165
+		// Data and type of action are stored into $object and $action
166
+		// Users
167
+		dol_include_once('/subtotal/class/subtotal.class.php');
168
+		$langs->load('subtotal@subtotal');
169
+
170
+		if (!empty($conf->global->SUBTOTAL_ALLOW_ADD_LINE_UNDER_TITLE) && in_array($action, array('LINEPROPAL_INSERT', 'LINEORDER_INSERT', 'LINEBILL_INSERT')))
171 171
 		{
172 172
 			$rang = GETPOST('under_title', 'int'); // Rang du titre
173 173
 			if ($rang > 0)
@@ -185,9 +185,9 @@  discard block
 block discarded – undo
185 185
 						$parent = new Facture($this->db);
186 186
 						$parent->fetch($object->fk_facture);
187 187
 						break;
188
-                    case 'LINEBILL_SUPPLIER_CREATE':
189
-                        $parent = new FactureFournisseur($this->db);
190
-                        $parent->fetch($object->fk_facture_fourn);
188
+					case 'LINEBILL_SUPPLIER_CREATE':
189
+						$parent = new FactureFournisseur($this->db);
190
+						$parent->fetch($object->fk_facture_fourn);
191 191
 					default:
192 192
 						$parent = $object;
193 193
 						break;
@@ -201,77 +201,77 @@  discard block
 block discarded – undo
201 201
 		}
202 202
         
203 203
 		
204
-        if ($action == 'LINEBILL_INSERT' || $action == 'LINEBILL_SUPPLIER_CREATE')
204
+		if ($action == 'LINEBILL_INSERT' || $action == 'LINEBILL_SUPPLIER_CREATE')
205 205
 		{
206
-		    $is_supplier = $action == 'LINEBILL_SUPPLIER_CREATE' ? true : false;
207
-            /** @var bool $subtotal_skip Permet d'éviter de faire du traitement en double sur les titres est sous-totaux car ils ont automatiquement le bon rang, il ne faut donc pas faire un addline pour en suite update le rang ici */
208
-		    global $subtotal_skip;
209
-
210
-		    if ($subtotal_skip)
211
-            {
212
-                $subtotal_skip = false;
213
-            }
214
-		    else
215
-            {
216
-			    $subtotal_add_title_bloc_from_orderstoinvoice = GETPOST('subtotal_add_title_bloc_from_orderstoinvoice');
217
-			    if (!empty($subtotal_add_title_bloc_from_orderstoinvoice))
218
-			    {
219
-				    global $subtotal_current_rang, $subtotal_bloc_previous_fk_commande, $subtotal_bloc_already_add_title, $subtotal_bloc_already_add_st;
206
+			$is_supplier = $action == 'LINEBILL_SUPPLIER_CREATE' ? true : false;
207
+			/** @var bool $subtotal_skip Permet d'éviter de faire du traitement en double sur les titres est sous-totaux car ils ont automatiquement le bon rang, il ne faut donc pas faire un addline pour en suite update le rang ici */
208
+			global $subtotal_skip;
209
+
210
+			if ($subtotal_skip)
211
+			{
212
+				$subtotal_skip = false;
213
+			}
214
+			else
215
+			{
216
+				$subtotal_add_title_bloc_from_orderstoinvoice = GETPOST('subtotal_add_title_bloc_from_orderstoinvoice');
217
+				if (!empty($subtotal_add_title_bloc_from_orderstoinvoice))
218
+				{
219
+					global $subtotal_current_rang, $subtotal_bloc_previous_fk_commande, $subtotal_bloc_already_add_title, $subtotal_bloc_already_add_st;
220 220
 				    
221
-				    $current_fk_commande = TSubtotal::getOrderIdFromLineId($this->db, $object->origin_id, $is_supplier);
222
-				    $last_fk_commandedet = TSubtotal::getLastLineOrderId($this->db, $current_fk_commande, $is_supplier);
223
-
224
-				    if (!$is_supplier){
225
-				        $facture = new Facture($this->db);
226
-				        $ret = $facture->fetch($object->fk_facture);
227
-                    }
228
-				    else
229
-                    {
230
-				        $facture = new FactureFournisseur($this->db);
231
-				        $ret = $facture->fetch($object->fk_facture_fourn);
232
-                    }
233
-
234
-				    if ($ret > 0 && !$subtotal_bloc_already_add_st)
235
-				    {
236
-					    $rang = !empty($subtotal_current_rang) ? $subtotal_current_rang : $object->rang;
237
-					    // Si le fk_commande courrant est différent alors on change de commande => ajout d'un titre
238
-					    if ($current_fk_commande != $subtotal_bloc_previous_fk_commande ) {
239
-                            if (!$is_supplier) $commande = new Commande($this->db);
240
-                            else $commande = new CommandeFournisseur($this->db);
241
-                            $commande->fetch($current_fk_commande);
242
-
243
-                            $label = $conf->global->SUBTOTAL_TEXT_FOR_TITLE_ORDETSTOINVOICE;
244
-                            if (empty($label)) {
245
-                                $label = 'Commande [__REFORDER__]';
246
-                                if (!$is_supplier) $label .= ' - Référence client : [__REFCUSTOMER__]';
247
-                            }
248
-                            $label = str_replace(array('__REFORDER__', '__REFCUSTOMER__'), array($commande->ref, $commande->ref_client), $label);
249
-
250
-                            if(!empty($current_fk_commande)) {
251
-                                $subtotal_skip = true;
252
-                                TSubtotal::addTitle($facture, $label, 1, $rang);
253
-                                $rang++;
254
-                            }
255
-                        }
256
-
257
-                        $object->rang = $rang;
258
-					    $facture->updateRangOfLine($object->id, $rang);
259
-					    $rang++;
260
-					    // Est-ce qu'il s'agit de la dernière ligne de la commande d'origine ? Si oui alors on ajout un sous-total
261
-                            if ($last_fk_commandedet === (int) $object->origin_id && !empty($current_fk_commande))
262
-					    {
263
-                            $subtotal_skip = true;
264
-                            $subtotal_bloc_already_add_st = 1;
265
-                            TSubtotal::addTotal($facture, $langs->trans('SubTotal'), 1, $rang);
266
-                            $subtotal_bloc_already_add_st = 0;
267
-                            $rang++;
268
-					    }
269
-				    }
270
-
271
-				    $subtotal_bloc_previous_fk_commande = $current_fk_commande;
272
-				    $subtotal_current_rang = $rang;
273
-			    }
274
-		    }
221
+					$current_fk_commande = TSubtotal::getOrderIdFromLineId($this->db, $object->origin_id, $is_supplier);
222
+					$last_fk_commandedet = TSubtotal::getLastLineOrderId($this->db, $current_fk_commande, $is_supplier);
223
+
224
+					if (!$is_supplier){
225
+						$facture = new Facture($this->db);
226
+						$ret = $facture->fetch($object->fk_facture);
227
+					}
228
+					else
229
+					{
230
+						$facture = new FactureFournisseur($this->db);
231
+						$ret = $facture->fetch($object->fk_facture_fourn);
232
+					}
233
+
234
+					if ($ret > 0 && !$subtotal_bloc_already_add_st)
235
+					{
236
+						$rang = !empty($subtotal_current_rang) ? $subtotal_current_rang : $object->rang;
237
+						// Si le fk_commande courrant est différent alors on change de commande => ajout d'un titre
238
+						if ($current_fk_commande != $subtotal_bloc_previous_fk_commande ) {
239
+							if (!$is_supplier) $commande = new Commande($this->db);
240
+							else $commande = new CommandeFournisseur($this->db);
241
+							$commande->fetch($current_fk_commande);
242
+
243
+							$label = $conf->global->SUBTOTAL_TEXT_FOR_TITLE_ORDETSTOINVOICE;
244
+							if (empty($label)) {
245
+								$label = 'Commande [__REFORDER__]';
246
+								if (!$is_supplier) $label .= ' - Référence client : [__REFCUSTOMER__]';
247
+							}
248
+							$label = str_replace(array('__REFORDER__', '__REFCUSTOMER__'), array($commande->ref, $commande->ref_client), $label);
249
+
250
+							if(!empty($current_fk_commande)) {
251
+								$subtotal_skip = true;
252
+								TSubtotal::addTitle($facture, $label, 1, $rang);
253
+								$rang++;
254
+							}
255
+						}
256
+
257
+						$object->rang = $rang;
258
+						$facture->updateRangOfLine($object->id, $rang);
259
+						$rang++;
260
+						// Est-ce qu'il s'agit de la dernière ligne de la commande d'origine ? Si oui alors on ajout un sous-total
261
+							if ($last_fk_commandedet === (int) $object->origin_id && !empty($current_fk_commande))
262
+						{
263
+							$subtotal_skip = true;
264
+							$subtotal_bloc_already_add_st = 1;
265
+							TSubtotal::addTotal($facture, $langs->trans('SubTotal'), 1, $rang);
266
+							$subtotal_bloc_already_add_st = 0;
267
+							$rang++;
268
+						}
269
+					}
270
+
271
+					$subtotal_bloc_previous_fk_commande = $current_fk_commande;
272
+					$subtotal_current_rang = $rang;
273
+				}
274
+			}
275 275
 		
276 276
 		}
277 277
 		
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 		
287 287
 		if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && in_array($action, array('LINEPROPAL_INSERT', 'LINEPROPAL_UPDATE', 'LINEORDER_INSERT', 'LINEORDER_UPDATE', 'LINEBILL_INSERT', 'LINEBILL_UPDATE', 'LINEBILL_SUPPLIER_CREATE', 'LINEBILL_SUPPLIER_UPDATE')))
288 288
 		{
289
-            if(! function_exists('_updateLineNC')) dol_include_once('/subtotal/lib/subtotal.lib.php');
289
+			if(! function_exists('_updateLineNC')) dol_include_once('/subtotal/lib/subtotal.lib.php');
290 290
 
291 291
 			$doli_action = GETPOST('action');
292 292
 			$set = GETPOST('set');
@@ -352,173 +352,173 @@  discard block
 block discarded – undo
352 352
 		}
353 353
 		
354 354
         
355
-        if ($action == 'USER_LOGIN') {
356
-            dol_syslog(
357
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
358
-            );
359
-        } elseif ($action == 'USER_UPDATE_SESSION') {
360
-            // Warning: To increase performances, this action is triggered only if
361
-            // constant MAIN_ACTIVATE_UPDATESESSIONTRIGGER is set to 1.
362
-            dol_syslog(
363
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
364
-            );
365
-        } elseif ($action == 'USER_CREATE') {
366
-            dol_syslog(
367
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
368
-            );
369
-        } elseif ($action == 'USER_CREATE_FROM_CONTACT') {
370
-            dol_syslog(
371
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
372
-            );
373
-        } elseif ($action == 'USER_MODIFY') {
374
-            dol_syslog(
375
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
376
-            );
377
-        } elseif ($action == 'USER_NEW_PASSWORD') {
378
-            dol_syslog(
379
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
380
-            );
381
-        } elseif ($action == 'USER_ENABLEDISABLE') {
382
-            dol_syslog(
383
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
384
-            );
385
-        } elseif ($action == 'USER_DELETE') {
386
-            dol_syslog(
387
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
388
-            );
389
-        } elseif ($action == 'USER_LOGOUT') {
390
-            dol_syslog(
391
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
392
-            );
393
-        } elseif ($action == 'USER_SETINGROUP') {
394
-            dol_syslog(
395
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
396
-            );
397
-        } elseif ($action == 'USER_REMOVEFROMGROUP') {
398
-            dol_syslog(
399
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
400
-            );
401
-        }
402
-
403
-        // Groups
404
-        elseif ($action == 'GROUP_CREATE') {
405
-            dol_syslog(
406
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
407
-            );
408
-        } elseif ($action == 'GROUP_MODIFY') {
409
-            dol_syslog(
410
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
411
-            );
412
-        } elseif ($action == 'GROUP_DELETE') {
413
-            dol_syslog(
414
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
415
-            );
416
-        }
417
-
418
-        // Companies
419
-        elseif ($action == 'COMPANY_CREATE') {
420
-            dol_syslog(
421
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
422
-            );
423
-        } elseif ($action == 'COMPANY_MODIFY') {
424
-            dol_syslog(
425
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
426
-            );
427
-        } elseif ($action == 'COMPANY_DELETE') {
428
-            dol_syslog(
429
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
430
-            );
431
-        }
432
-
433
-        // Contacts
434
-        elseif ($action == 'CONTACT_CREATE') {
435
-            dol_syslog(
436
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
437
-            );
438
-        } elseif ($action == 'CONTACT_MODIFY') {
439
-            dol_syslog(
440
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
441
-            );
442
-        } elseif ($action == 'CONTACT_DELETE') {
443
-            dol_syslog(
444
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
445
-            );
446
-        }
447
-
448
-        // Products
449
-        elseif ($action == 'PRODUCT_CREATE') {
450
-            dol_syslog(
451
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
452
-            );
453
-        } elseif ($action == 'PRODUCT_MODIFY') {
454
-            dol_syslog(
455
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
456
-            );
457
-        } elseif ($action == 'PRODUCT_DELETE') {
458
-            dol_syslog(
459
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
460
-            );
461
-        }
462
-
463
-        // Customer orders
464
-        elseif ($action == 'ORDER_CREATE') {
465
-            dol_syslog(
466
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
467
-            );
468
-        } elseif ($action == 'ORDER_VALIDATE') {
469
-            dol_syslog(
470
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
471
-            );
472
-        } elseif ($action == 'ORDER_DELETE') {
473
-            dol_syslog(
474
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
475
-            );
476
-        } elseif ($action == 'ORDER_BUILDDOC') {
477
-            dol_syslog(
478
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
479
-            );
480
-        } elseif ($action == 'ORDER_SENTBYMAIL') {
481
-            dol_syslog(
482
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
483
-            );
484
-        } elseif ($action == 'LINEORDER_INSERT') {
485
-            dol_syslog(
486
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
487
-            );
488
-        } elseif ($action == 'LINEORDER_DELETE') {
489
-            dol_syslog(
490
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
491
-            );
492
-        }
493
-
494
-        // Supplier orders
495
-        elseif ($action == 'ORDER_SUPPLIER_CREATE') {
496
-            dol_syslog(
497
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
498
-            );
499
-        } elseif ($action == 'ORDER_SUPPLIER_VALIDATE') {
500
-            dol_syslog(
501
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
502
-            );
503
-        } elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') {
504
-            dol_syslog(
505
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
506
-            );
507
-        } elseif ($action == 'SUPPLIER_ORDER_BUILDDOC') {
508
-            dol_syslog(
509
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
510
-            );
511
-        }
512
-
513
-        // Proposals
514
-        elseif ($action == 'PROPAL_CREATE') {
515
-            dol_syslog(
516
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
517
-            );
518
-        } elseif (in_array($action, array('PROPAL_CLONE', 'ORDER_CLONE', 'BILL_CLONE'))) {
519
-            dol_syslog(
520
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
521
-            );
355
+		if ($action == 'USER_LOGIN') {
356
+			dol_syslog(
357
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
358
+			);
359
+		} elseif ($action == 'USER_UPDATE_SESSION') {
360
+			// Warning: To increase performances, this action is triggered only if
361
+			// constant MAIN_ACTIVATE_UPDATESESSIONTRIGGER is set to 1.
362
+			dol_syslog(
363
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
364
+			);
365
+		} elseif ($action == 'USER_CREATE') {
366
+			dol_syslog(
367
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
368
+			);
369
+		} elseif ($action == 'USER_CREATE_FROM_CONTACT') {
370
+			dol_syslog(
371
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
372
+			);
373
+		} elseif ($action == 'USER_MODIFY') {
374
+			dol_syslog(
375
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
376
+			);
377
+		} elseif ($action == 'USER_NEW_PASSWORD') {
378
+			dol_syslog(
379
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
380
+			);
381
+		} elseif ($action == 'USER_ENABLEDISABLE') {
382
+			dol_syslog(
383
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
384
+			);
385
+		} elseif ($action == 'USER_DELETE') {
386
+			dol_syslog(
387
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
388
+			);
389
+		} elseif ($action == 'USER_LOGOUT') {
390
+			dol_syslog(
391
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
392
+			);
393
+		} elseif ($action == 'USER_SETINGROUP') {
394
+			dol_syslog(
395
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
396
+			);
397
+		} elseif ($action == 'USER_REMOVEFROMGROUP') {
398
+			dol_syslog(
399
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
400
+			);
401
+		}
402
+
403
+		// Groups
404
+		elseif ($action == 'GROUP_CREATE') {
405
+			dol_syslog(
406
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
407
+			);
408
+		} elseif ($action == 'GROUP_MODIFY') {
409
+			dol_syslog(
410
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
411
+			);
412
+		} elseif ($action == 'GROUP_DELETE') {
413
+			dol_syslog(
414
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
415
+			);
416
+		}
417
+
418
+		// Companies
419
+		elseif ($action == 'COMPANY_CREATE') {
420
+			dol_syslog(
421
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
422
+			);
423
+		} elseif ($action == 'COMPANY_MODIFY') {
424
+			dol_syslog(
425
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
426
+			);
427
+		} elseif ($action == 'COMPANY_DELETE') {
428
+			dol_syslog(
429
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
430
+			);
431
+		}
432
+
433
+		// Contacts
434
+		elseif ($action == 'CONTACT_CREATE') {
435
+			dol_syslog(
436
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
437
+			);
438
+		} elseif ($action == 'CONTACT_MODIFY') {
439
+			dol_syslog(
440
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
441
+			);
442
+		} elseif ($action == 'CONTACT_DELETE') {
443
+			dol_syslog(
444
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
445
+			);
446
+		}
447
+
448
+		// Products
449
+		elseif ($action == 'PRODUCT_CREATE') {
450
+			dol_syslog(
451
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
452
+			);
453
+		} elseif ($action == 'PRODUCT_MODIFY') {
454
+			dol_syslog(
455
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
456
+			);
457
+		} elseif ($action == 'PRODUCT_DELETE') {
458
+			dol_syslog(
459
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
460
+			);
461
+		}
462
+
463
+		// Customer orders
464
+		elseif ($action == 'ORDER_CREATE') {
465
+			dol_syslog(
466
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
467
+			);
468
+		} elseif ($action == 'ORDER_VALIDATE') {
469
+			dol_syslog(
470
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
471
+			);
472
+		} elseif ($action == 'ORDER_DELETE') {
473
+			dol_syslog(
474
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
475
+			);
476
+		} elseif ($action == 'ORDER_BUILDDOC') {
477
+			dol_syslog(
478
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
479
+			);
480
+		} elseif ($action == 'ORDER_SENTBYMAIL') {
481
+			dol_syslog(
482
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
483
+			);
484
+		} elseif ($action == 'LINEORDER_INSERT') {
485
+			dol_syslog(
486
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
487
+			);
488
+		} elseif ($action == 'LINEORDER_DELETE') {
489
+			dol_syslog(
490
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
491
+			);
492
+		}
493
+
494
+		// Supplier orders
495
+		elseif ($action == 'ORDER_SUPPLIER_CREATE') {
496
+			dol_syslog(
497
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
498
+			);
499
+		} elseif ($action == 'ORDER_SUPPLIER_VALIDATE') {
500
+			dol_syslog(
501
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
502
+			);
503
+		} elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') {
504
+			dol_syslog(
505
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
506
+			);
507
+		} elseif ($action == 'SUPPLIER_ORDER_BUILDDOC') {
508
+			dol_syslog(
509
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
510
+			);
511
+		}
512
+
513
+		// Proposals
514
+		elseif ($action == 'PROPAL_CREATE') {
515
+			dol_syslog(
516
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
517
+			);
518
+		} elseif (in_array($action, array('PROPAL_CLONE', 'ORDER_CLONE', 'BILL_CLONE'))) {
519
+			dol_syslog(
520
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
521
+			);
522 522
 			
523 523
 			$doli_action = GETPOST('action');
524 524
 
@@ -551,296 +551,296 @@  discard block
 block discarded – undo
551 551
 				if (!empty($line)) $object->update_price(1);
552 552
 			}
553 553
 			
554
-        } elseif ($action == 'PROPAL_MODIFY') {
555
-            dol_syslog(
556
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
557
-            );
558
-        } elseif ($action == 'PROPAL_VALIDATE') {
559
-            dol_syslog(
560
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
561
-            );
562
-        } elseif ($action == 'PROPAL_BUILDDOC') {
563
-            dol_syslog(
564
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
565
-            );
566
-        } elseif ($action == 'PROPAL_SENTBYMAIL') {
567
-            dol_syslog(
568
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
569
-            );
570
-        } elseif ($action == 'PROPAL_CLOSE_SIGNED') {
571
-            dol_syslog(
572
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
573
-            );
574
-        } elseif ($action == 'PROPAL_CLOSE_REFUSED') {
575
-            dol_syslog(
576
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
577
-            );
578
-        } elseif ($action == 'PROPAL_DELETE') {
579
-            dol_syslog(
580
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
581
-            );
582
-        } elseif ($action == 'LINEPROPAL_INSERT') {
583
-            dol_syslog(
584
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
585
-            );
586
-        } elseif ($action == 'LINEPROPAL_MODIFY') {
587
-            dol_syslog(
588
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
589
-            );
590
-        } elseif ($action == 'LINEPROPAL_DELETE') {
591
-            dol_syslog(
592
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
593
-            );
594
-        }
595
-
596
-        // Contracts
597
-        elseif ($action == 'CONTRACT_CREATE') {
598
-            dol_syslog(
599
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
600
-            );
601
-        } elseif ($action == 'CONTRACT_MODIFY') {
602
-            dol_syslog(
603
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
604
-            );
605
-        } elseif ($action == 'CONTRACT_ACTIVATE') {
606
-            dol_syslog(
607
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
608
-            );
609
-        } elseif ($action == 'CONTRACT_CANCEL') {
610
-            dol_syslog(
611
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
612
-            );
613
-        } elseif ($action == 'CONTRACT_CLOSE') {
614
-            dol_syslog(
615
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
616
-            );
617
-        } elseif ($action == 'CONTRACT_DELETE') {
618
-            dol_syslog(
619
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
620
-            );
621
-        }
554
+		} elseif ($action == 'PROPAL_MODIFY') {
555
+			dol_syslog(
556
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
557
+			);
558
+		} elseif ($action == 'PROPAL_VALIDATE') {
559
+			dol_syslog(
560
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
561
+			);
562
+		} elseif ($action == 'PROPAL_BUILDDOC') {
563
+			dol_syslog(
564
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
565
+			);
566
+		} elseif ($action == 'PROPAL_SENTBYMAIL') {
567
+			dol_syslog(
568
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
569
+			);
570
+		} elseif ($action == 'PROPAL_CLOSE_SIGNED') {
571
+			dol_syslog(
572
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
573
+			);
574
+		} elseif ($action == 'PROPAL_CLOSE_REFUSED') {
575
+			dol_syslog(
576
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
577
+			);
578
+		} elseif ($action == 'PROPAL_DELETE') {
579
+			dol_syslog(
580
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
581
+			);
582
+		} elseif ($action == 'LINEPROPAL_INSERT') {
583
+			dol_syslog(
584
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
585
+			);
586
+		} elseif ($action == 'LINEPROPAL_MODIFY') {
587
+			dol_syslog(
588
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
589
+			);
590
+		} elseif ($action == 'LINEPROPAL_DELETE') {
591
+			dol_syslog(
592
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
593
+			);
594
+		}
595
+
596
+		// Contracts
597
+		elseif ($action == 'CONTRACT_CREATE') {
598
+			dol_syslog(
599
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
600
+			);
601
+		} elseif ($action == 'CONTRACT_MODIFY') {
602
+			dol_syslog(
603
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
604
+			);
605
+		} elseif ($action == 'CONTRACT_ACTIVATE') {
606
+			dol_syslog(
607
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
608
+			);
609
+		} elseif ($action == 'CONTRACT_CANCEL') {
610
+			dol_syslog(
611
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
612
+			);
613
+		} elseif ($action == 'CONTRACT_CLOSE') {
614
+			dol_syslog(
615
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
616
+			);
617
+		} elseif ($action == 'CONTRACT_DELETE') {
618
+			dol_syslog(
619
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
620
+			);
621
+		}
622 622
 
623 623
 		elseif ($action == 'BILL_MODIFY') {
624
-            dol_syslog(
625
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
626
-            );
627
-
628
-
629
-            global $conf;
630
-
631
-            if (!empty($conf->global->INVOICE_USE_SITUATION) && $object->element == 'facture' && $object->type == Facture::TYPE_SITUATION)
632
-            {
633
-                $object->situation_final = 1;
634
-                foreach($object->lines as $i => $line) {
635
-                    if(!TSubtotal::isModSubtotalLine($line) && $line->situation_percent != 100){
636
-                        $object->situation_final = 0;
637
-                        break;
638
-                    }
639
-                }
640
-                // ne pas utiliser $object->setFinal ne peut pas marcher
641
-                $sql = 'UPDATE ' . MAIN_DB_PREFIX . 'facture SET situation_final = ' . $object->situation_final . ' where rowid = ' . $object->id;
642
-                $resql=$object->db->query($sql);
643
-            }
644
-
645
-
646
-        } elseif ($action == 'BILL_VALIDATE') {
647
-            dol_syslog(
648
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
649
-            );
650
-        } elseif ($action == 'BILL_BUILDDOC') {
651
-            dol_syslog(
652
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
653
-            );
654
-        } elseif ($action == 'BILL_SENTBYMAIL') {
655
-            dol_syslog(
656
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
657
-            );
658
-        } elseif ($action == 'BILL_CANCEL') {
659
-            dol_syslog(
660
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
661
-            );
662
-        } elseif ($action == 'BILL_DELETE') {
663
-            dol_syslog(
664
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
665
-            );
666
-        } elseif ($action == 'LINEBILL_INSERT') {
624
+			dol_syslog(
625
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
626
+			);
627
+
628
+
629
+			global $conf;
630
+
631
+			if (!empty($conf->global->INVOICE_USE_SITUATION) && $object->element == 'facture' && $object->type == Facture::TYPE_SITUATION)
632
+			{
633
+				$object->situation_final = 1;
634
+				foreach($object->lines as $i => $line) {
635
+					if(!TSubtotal::isModSubtotalLine($line) && $line->situation_percent != 100){
636
+						$object->situation_final = 0;
637
+						break;
638
+					}
639
+				}
640
+				// ne pas utiliser $object->setFinal ne peut pas marcher
641
+				$sql = 'UPDATE ' . MAIN_DB_PREFIX . 'facture SET situation_final = ' . $object->situation_final . ' where rowid = ' . $object->id;
642
+				$resql=$object->db->query($sql);
643
+			}
644
+
645
+
646
+		} elseif ($action == 'BILL_VALIDATE') {
647
+			dol_syslog(
648
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
649
+			);
650
+		} elseif ($action == 'BILL_BUILDDOC') {
651
+			dol_syslog(
652
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
653
+			);
654
+		} elseif ($action == 'BILL_SENTBYMAIL') {
655
+			dol_syslog(
656
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
657
+			);
658
+		} elseif ($action == 'BILL_CANCEL') {
659
+			dol_syslog(
660
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
661
+			);
662
+		} elseif ($action == 'BILL_DELETE') {
663
+			dol_syslog(
664
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
665
+			);
666
+		} elseif ($action == 'LINEBILL_INSERT') {
667 667
 				
668
-        	dol_syslog(
669
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
670
-            );
671
-        } elseif ($action == 'LINEBILL_DELETE') {
672
-            dol_syslog(
673
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
674
-            );
675
-        }
676
-
677
-        // Payments
678
-        elseif ($action == 'PAYMENT_CUSTOMER_CREATE') {
679
-            dol_syslog(
680
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
681
-            );
682
-        } elseif ($action == 'PAYMENT_SUPPLIER_CREATE') {
683
-            dol_syslog(
684
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
685
-            );
686
-        } elseif ($action == 'PAYMENT_ADD_TO_BANK') {
687
-            dol_syslog(
688
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
689
-            );
690
-        } elseif ($action == 'PAYMENT_DELETE') {
691
-            dol_syslog(
692
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
693
-            );
694
-        }
695
-
696
-        // Interventions
697
-        elseif ($action == 'FICHEINTER_CREATE') {
698
-            dol_syslog(
699
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
700
-            );
701
-        } elseif ($action == 'FICHEINTER_MODIFY') {
702
-            dol_syslog(
703
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
704
-            );
705
-        } elseif ($action == 'FICHEINTER_VALIDATE') {
706
-            dol_syslog(
707
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
708
-            );
709
-        } elseif ($action == 'FICHEINTER_DELETE') {
710
-            dol_syslog(
711
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
712
-            );
713
-        }
714
-
715
-        // Members
716
-        elseif ($action == 'MEMBER_CREATE') {
717
-            dol_syslog(
718
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
719
-            );
720
-        } elseif ($action == 'MEMBER_VALIDATE') {
721
-            dol_syslog(
722
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
723
-            );
724
-        } elseif ($action == 'MEMBER_SUBSCRIPTION') {
725
-            dol_syslog(
726
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
727
-            );
728
-        } elseif ($action == 'MEMBER_MODIFY') {
729
-            dol_syslog(
730
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
731
-            );
732
-        } elseif ($action == 'MEMBER_NEW_PASSWORD') {
733
-            dol_syslog(
734
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
735
-            );
736
-        } elseif ($action == 'MEMBER_RESILIATE') {
737
-            dol_syslog(
738
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
739
-            );
740
-        } elseif ($action == 'MEMBER_DELETE') {
741
-            dol_syslog(
742
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
743
-            );
744
-        }
745
-
746
-        // Categories
747
-        elseif ($action == 'CATEGORY_CREATE') {
748
-            dol_syslog(
749
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
750
-            );
751
-        } elseif ($action == 'CATEGORY_MODIFY') {
752
-            dol_syslog(
753
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
754
-            );
755
-        } elseif ($action == 'CATEGORY_DELETE') {
756
-            dol_syslog(
757
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
758
-            );
759
-        }
760
-
761
-        // Projects
762
-        elseif ($action == 'PROJECT_CREATE') {
763
-            dol_syslog(
764
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
765
-            );
766
-        } elseif ($action == 'PROJECT_MODIFY') {
767
-            dol_syslog(
768
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
769
-            );
770
-        } elseif ($action == 'PROJECT_DELETE') {
771
-            dol_syslog(
772
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
773
-            );
774
-        }
775
-
776
-        // Project tasks
777
-        elseif ($action == 'TASK_CREATE') {
778
-            dol_syslog(
779
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
780
-            );
781
-        } elseif ($action == 'TASK_MODIFY') {
782
-            dol_syslog(
783
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
784
-            );
785
-        } elseif ($action == 'TASK_DELETE') {
786
-            dol_syslog(
787
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
788
-            );
789
-        }
790
-
791
-        // Task time spent
792
-        elseif ($action == 'TASK_TIMESPENT_CREATE') {
793
-            dol_syslog(
794
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
795
-            );
796
-        } elseif ($action == 'TASK_TIMESPENT_MODIFY') {
797
-            dol_syslog(
798
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
799
-            );
800
-        } elseif ($action == 'TASK_TIMESPENT_DELETE') {
801
-            dol_syslog(
802
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
803
-            );
804
-        }
805
-
806
-        // Shipping
807
-        elseif ($action == 'SHIPPING_CREATE') {
808
-            dol_syslog(
809
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
810
-            );
811
-        } elseif ($action == 'SHIPPING_MODIFY') {
812
-            dol_syslog(
813
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
814
-            );
815
-        } elseif ($action == 'SHIPPING_VALIDATE') {
816
-            dol_syslog(
817
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
818
-            );
819
-        } elseif ($action == 'SHIPPING_SENTBYMAIL') {
820
-            dol_syslog(
821
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
822
-            );
823
-        } elseif ($action == 'SHIPPING_DELETE') {
824
-            dol_syslog(
825
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
826
-            );
827
-        } elseif ($action == 'SHIPPING_BUILDDOC') {
828
-            dol_syslog(
829
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
830
-            );
831
-        }
832
-
833
-        // File
834
-        elseif ($action == 'FILE_UPLOAD') {
835
-            dol_syslog(
836
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
837
-            );
838
-        } elseif ($action == 'FILE_DELETE') {
839
-            dol_syslog(
840
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
841
-            );
842
-        }
843
-
844
-        return 0;
845
-    }
668
+			dol_syslog(
669
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
670
+			);
671
+		} elseif ($action == 'LINEBILL_DELETE') {
672
+			dol_syslog(
673
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
674
+			);
675
+		}
676
+
677
+		// Payments
678
+		elseif ($action == 'PAYMENT_CUSTOMER_CREATE') {
679
+			dol_syslog(
680
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
681
+			);
682
+		} elseif ($action == 'PAYMENT_SUPPLIER_CREATE') {
683
+			dol_syslog(
684
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
685
+			);
686
+		} elseif ($action == 'PAYMENT_ADD_TO_BANK') {
687
+			dol_syslog(
688
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
689
+			);
690
+		} elseif ($action == 'PAYMENT_DELETE') {
691
+			dol_syslog(
692
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
693
+			);
694
+		}
695
+
696
+		// Interventions
697
+		elseif ($action == 'FICHEINTER_CREATE') {
698
+			dol_syslog(
699
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
700
+			);
701
+		} elseif ($action == 'FICHEINTER_MODIFY') {
702
+			dol_syslog(
703
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
704
+			);
705
+		} elseif ($action == 'FICHEINTER_VALIDATE') {
706
+			dol_syslog(
707
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
708
+			);
709
+		} elseif ($action == 'FICHEINTER_DELETE') {
710
+			dol_syslog(
711
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
712
+			);
713
+		}
714
+
715
+		// Members
716
+		elseif ($action == 'MEMBER_CREATE') {
717
+			dol_syslog(
718
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
719
+			);
720
+		} elseif ($action == 'MEMBER_VALIDATE') {
721
+			dol_syslog(
722
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
723
+			);
724
+		} elseif ($action == 'MEMBER_SUBSCRIPTION') {
725
+			dol_syslog(
726
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
727
+			);
728
+		} elseif ($action == 'MEMBER_MODIFY') {
729
+			dol_syslog(
730
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
731
+			);
732
+		} elseif ($action == 'MEMBER_NEW_PASSWORD') {
733
+			dol_syslog(
734
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
735
+			);
736
+		} elseif ($action == 'MEMBER_RESILIATE') {
737
+			dol_syslog(
738
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
739
+			);
740
+		} elseif ($action == 'MEMBER_DELETE') {
741
+			dol_syslog(
742
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
743
+			);
744
+		}
745
+
746
+		// Categories
747
+		elseif ($action == 'CATEGORY_CREATE') {
748
+			dol_syslog(
749
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
750
+			);
751
+		} elseif ($action == 'CATEGORY_MODIFY') {
752
+			dol_syslog(
753
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
754
+			);
755
+		} elseif ($action == 'CATEGORY_DELETE') {
756
+			dol_syslog(
757
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
758
+			);
759
+		}
760
+
761
+		// Projects
762
+		elseif ($action == 'PROJECT_CREATE') {
763
+			dol_syslog(
764
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
765
+			);
766
+		} elseif ($action == 'PROJECT_MODIFY') {
767
+			dol_syslog(
768
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
769
+			);
770
+		} elseif ($action == 'PROJECT_DELETE') {
771
+			dol_syslog(
772
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
773
+			);
774
+		}
775
+
776
+		// Project tasks
777
+		elseif ($action == 'TASK_CREATE') {
778
+			dol_syslog(
779
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
780
+			);
781
+		} elseif ($action == 'TASK_MODIFY') {
782
+			dol_syslog(
783
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
784
+			);
785
+		} elseif ($action == 'TASK_DELETE') {
786
+			dol_syslog(
787
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
788
+			);
789
+		}
790
+
791
+		// Task time spent
792
+		elseif ($action == 'TASK_TIMESPENT_CREATE') {
793
+			dol_syslog(
794
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
795
+			);
796
+		} elseif ($action == 'TASK_TIMESPENT_MODIFY') {
797
+			dol_syslog(
798
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
799
+			);
800
+		} elseif ($action == 'TASK_TIMESPENT_DELETE') {
801
+			dol_syslog(
802
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
803
+			);
804
+		}
805
+
806
+		// Shipping
807
+		elseif ($action == 'SHIPPING_CREATE') {
808
+			dol_syslog(
809
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
810
+			);
811
+		} elseif ($action == 'SHIPPING_MODIFY') {
812
+			dol_syslog(
813
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
814
+			);
815
+		} elseif ($action == 'SHIPPING_VALIDATE') {
816
+			dol_syslog(
817
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
818
+			);
819
+		} elseif ($action == 'SHIPPING_SENTBYMAIL') {
820
+			dol_syslog(
821
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
822
+			);
823
+		} elseif ($action == 'SHIPPING_DELETE') {
824
+			dol_syslog(
825
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
826
+			);
827
+		} elseif ($action == 'SHIPPING_BUILDDOC') {
828
+			dol_syslog(
829
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
830
+			);
831
+		}
832
+
833
+		// File
834
+		elseif ($action == 'FILE_UPLOAD') {
835
+			dol_syslog(
836
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
837
+			);
838
+		} elseif ($action == 'FILE_DELETE') {
839
+			dol_syslog(
840
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
841
+			);
842
+		}
843
+
844
+		return 0;
845
+	}
846 846
 }
Please login to merge, or discard this patch.
class/actions_subtotal.class.php 1 patch
Indentation   +337 added lines, -337 removed lines patch added patch discarded remove patch
@@ -101,11 +101,11 @@  discard block
 block discarded – undo
101 101
 	 * @return     void
102 102
 	 */
103 103
     
104
-    var $module_number = 104777;
104
+	var $module_number = 104777;
105 105
     
106
-    function formObjectOptions($parameters, &$object, &$action, $hookmanager) 
107
-    {
108
-      	global $langs,$db,$user, $conf;
106
+	function formObjectOptions($parameters, &$object, &$action, $hookmanager) 
107
+	{
108
+	  	global $langs,$db,$user, $conf;
109 109
 		
110 110
 		$langs->load('subtotal@subtotal');
111 111
 		
@@ -120,10 +120,10 @@  discard block
 block discarded – undo
120 120
 				$createRight = $user->rights->facture->creer;
121 121
 			} elseif($object->element == 'order_supplier' )
122 122
 			{
123
-			    $createRight = $user->rights->fournisseur->commande->creer;
123
+				$createRight = $user->rights->fournisseur->commande->creer;
124 124
 			} elseif($object->element == 'invoice_supplier' )
125 125
 			{
126
-			    $createRight = $user->rights->fournisseur->facture->creer;
126
+				$createRight = $user->rights->fournisseur->facture->creer;
127 127
 			}
128 128
 			elseif($object->element == 'shipping')
129 129
 			{
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 					
178 178
 					if (!empty($conf->global->SUBTOTAL_AUTO_ADD_SUBTOTAL_ON_ADDING_NEW_TITLE) && $qty < 10) TSubtotal::addSubtotalMissing($object, $qty);
179 179
 					
180
-	    			TSubtotal::addSubTotalLine($object, $title, $qty);
180
+					TSubtotal::addSubTotalLine($object, $title, $qty);
181 181
 				}
182 182
 				else if($action==='ask_deleteallline') {
183 183
 						$form=new Form($db);
@@ -399,36 +399,36 @@  discard block
 block discarded – undo
399 399
 		$TContext = explode(':',$parameters['context']);
400 400
 		if (
401 401
 				in_array('invoicecard',$TContext)
402
-		        || in_array('invoicesuppliercard',$TContext)
402
+				|| in_array('invoicesuppliercard',$TContext)
403 403
 				|| in_array('propalcard',$TContext)
404 404
 				|| in_array('ordercard',$TContext)
405
-		        || in_array('ordersuppliercard',$TContext)
405
+				|| in_array('ordersuppliercard',$TContext)
406 406
 				|| in_array('invoicereccard',$TContext)
407 407
 			)
408
-	        {	
409
-	            $hideInnerLines	= isset( $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] ) ?  $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] : 0;
410
-	            $hidedetails	= isset( $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] ) ?  $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] : 0;
408
+			{	
409
+				$hideInnerLines	= isset( $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] ) ?  $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] : 0;
410
+				$hidedetails	= isset( $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] ) ?  $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] : 0;
411 411
 				$hidepricesDefaultConf = !empty($conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED)?$conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED:0;
412 412
 				$hideprices= isset( $_SESSION['subtotal_hideprices_'.$parameters['modulepart']][$object->id] ) ?  $_SESSION['subtotal_hideprices_'.$parameters['modulepart']][$object->id] : $hidepricesDefaultConf;
413 413
 				
414 414
 				$var=false;
415
-		     	$out.= '<tr '.$bc[$var].'>
415
+			 	$out.= '<tr '.$bc[$var].'>
416 416
 		     			<td colspan="4" align="right">
417 417
 		     				<label for="hideInnerLines">'.$langs->trans('HideInnerLines').'</label>
418 418
 		     				<input type="checkbox" onclick="if($(this).is(\':checked\')) { $(\'#hidedetails\').prop(\'checked\', \'checked\')  }" id="hideInnerLines" name="hideInnerLines" value="1" '.(( $hideInnerLines ) ? 'checked="checked"' : '' ).' />
419 419
 		     			</td>
420 420
 		     			</tr>';
421 421
 				
422
-		     	$var=!$var;
423
-		     	$out.= '<tr '.$bc[$var].'>
422
+			 	$var=!$var;
423
+			 	$out.= '<tr '.$bc[$var].'>
424 424
 		     			<td colspan="4" align="right">
425 425
 		     				<label for="hidedetails">'.$langs->trans('SubTotalhidedetails').'</label>
426 426
 		     				<input type="checkbox" id="hidedetails" name="hidedetails" value="1" '.(( $hidedetails ) ? 'checked="checked"' : '' ).' />
427 427
 		     			</td>
428 428
 		     			</tr>';
429 429
 		     	
430
-		     	$var=!$var;
431
-		     	$out.= '<tr '.$bc[$var].'>
430
+			 	$var=!$var;
431
+			 	$out.= '<tr '.$bc[$var].'>
432 432
 		     			<td colspan="4" align="right">
433 433
 		     				<label for="hideprices">'.$langs->trans('SubTotalhidePrice').'</label>
434 434
 		     				<input type="checkbox" id="hideprices" name="hideprices" value="1" '.(( $hideprices ) ? 'checked="checked"' : '' ).' />
@@ -440,9 +440,9 @@  discard block
 block discarded – undo
440 440
 				if ( 
441 441
 					(in_array('propalcard',$TContext) && !empty($conf->global->SUBTOTAL_PROPAL_ADD_RECAP))
442 442
 					|| (in_array('ordercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP))
443
-				    || (in_array('ordersuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP))
443
+					|| (in_array('ordersuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP))
444 444
 					|| (in_array('invoicecard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP))
445
-				    || (in_array('invoicesuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP))
445
+					|| (in_array('invoicesuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP))
446 446
 					|| (in_array('invoicereccard',$TContext)  && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP ))
447 447
 				)
448 448
 				{
@@ -461,19 +461,19 @@  discard block
 block discarded – undo
461 461
 			}
462 462
 			
463 463
 		
464
-        return 1;
464
+		return 1;
465 465
 	} 
466 466
 	 
467
-    function formEditProductOptions($parameters, &$object, &$action, $hookmanager) 
468
-    {
467
+	function formEditProductOptions($parameters, &$object, &$action, $hookmanager) 
468
+	{
469 469
 		
470
-    	if (in_array('invoicecard',explode(':',$parameters['context'])))
471
-        {
470
+		if (in_array('invoicecard',explode(':',$parameters['context'])))
471
+		{
472 472
         	
473
-        }
473
+		}
474 474
 		
475
-        return 0;
476
-    }
475
+		return 0;
476
+	}
477 477
 	
478 478
 	function ODTSubstitutionLine(&$parameters, &$object, $action, $hookmanager) {
479 479
 		global $conf;
@@ -484,14 +484,14 @@  discard block
 block discarded – undo
484 484
 			$object = &$parameters['object'];
485 485
 			$substitutionarray = &$parameters['substitutionarray'];
486 486
 			
487
-            $substitutionarray['line_not_modsubtotal'] = true;
488
-            $substitutionarray['line_modsubtotal'] = false;
489
-            $substitutionarray['line_modsubtotal_total'] = false;
490
-            $substitutionarray['line_modsubtotal_title'] = false;
487
+			$substitutionarray['line_not_modsubtotal'] = true;
488
+			$substitutionarray['line_modsubtotal'] = false;
489
+			$substitutionarray['line_modsubtotal_total'] = false;
490
+			$substitutionarray['line_modsubtotal_title'] = false;
491 491
 
492 492
 			if($line->product_type == 9 && $line->special_code == $this->module_number) {
493 493
 				$substitutionarray['line_modsubtotal'] = 1;	
494
-                $substitutionarray['line_not_modsubtotal'] = false;
494
+				$substitutionarray['line_not_modsubtotal'] = false;
495 495
 				
496 496
 				$substitutionarray['line_price_ht']
497 497
 					 = $substitutionarray['line_price_vat'] 
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
 					$substitutionarray['line_modsubtotal_total'] = true;
506 506
 					
507 507
 					//list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1);
508
-                    $TInfo = $this->getTotalLineFromObject($object, $line, '', 1);
508
+					$TInfo = $this->getTotalLineFromObject($object, $line, '', 1);
509 509
 
510 510
 					$substitutionarray['line_price_ht'] = price($TInfo[0]);
511 511
 					$substitutionarray['line_price_vat'] = price($TInfo[1]);
@@ -529,11 +529,11 @@  discard block
 block discarded – undo
529 529
 	
530 530
 		if (
531 531
 				in_array('invoicecard',explode(':',$parameters['context']))
532
-		        || in_array('invoicesuppliercard',explode(':',$parameters['context']))
532
+				|| in_array('invoicesuppliercard',explode(':',$parameters['context']))
533 533
 				|| in_array('propalcard',explode(':',$parameters['context']))
534
-		        || in_array('supplier_proposalcard',explode(':',$parameters['context']))
534
+				|| in_array('supplier_proposalcard',explode(':',$parameters['context']))
535 535
 				|| in_array('ordercard',explode(':',$parameters['context']))
536
-		        || in_array('ordersuppliercard',explode(':',$parameters['context']))
536
+				|| in_array('ordersuppliercard',explode(':',$parameters['context']))
537 537
 				|| in_array('invoicereccard',explode(':',$parameters['context']))
538 538
 		) {
539 539
 			
@@ -612,20 +612,20 @@  discard block
 block discarded – undo
612 612
 				in_array('invoicecard',explode(':',$parameters['context']))
613 613
 				|| in_array('propalcard',explode(':',$parameters['context']))
614 614
 				|| in_array('ordercard',explode(':',$parameters['context']))
615
-			    || in_array('ordersuppliercard',explode(':',$parameters['context']))
616
-			    || in_array('invoicesuppliercard',explode(':',$parameters['context']))
617
-			    || in_array('supplier_proposalcard',explode(':',$parameters['context']))
615
+				|| in_array('ordersuppliercard',explode(':',$parameters['context']))
616
+				|| in_array('invoicesuppliercard',explode(':',$parameters['context']))
617
+				|| in_array('supplier_proposalcard',explode(':',$parameters['context']))
618 618
 			)
619
-	        {								
619
+			{								
620 620
 				if(in_array('invoicecard',explode(':',$parameters['context']))) {
621 621
 					$sessname = 'subtotal_hideInnerLines_facture';	
622 622
 					$sessname2 = 'subtotal_hidedetails_facture';
623 623
 					$sessname3 = 'subtotal_hideprices_facture';
624 624
 				}
625 625
 				elseif(in_array('invoicesuppliercard',explode(':',$parameters['context']))) {
626
-				    $sessname = 'subtotal_hideInnerLines_facture_fournisseur';
627
-				    $sessname2 = 'subtotal_hidedetails_facture_fournisseur';
628
-				    $sessname3 = 'subtotal_hideprices_facture_fournisseur';
626
+					$sessname = 'subtotal_hideInnerLines_facture_fournisseur';
627
+					$sessname2 = 'subtotal_hidedetails_facture_fournisseur';
628
+					$sessname3 = 'subtotal_hideprices_facture_fournisseur';
629 629
 				}
630 630
 				elseif(in_array('propalcard',explode(':',$parameters['context']))) {
631 631
 					$sessname = 'subtotal_hideInnerLines_propal';
@@ -633,9 +633,9 @@  discard block
 block discarded – undo
633 633
 					$sessname3 = 'subtotal_hideprices_propal';
634 634
 				}
635 635
 				elseif(in_array('supplier_proposalcard',explode(':',$parameters['context']))) {
636
-				    $sessname = 'subtotal_hideInnerLines_supplier_proposal';
637
-				    $sessname2 = 'subtotal_hidedetails_supplier_proposal';
638
-				    $sessname3 = 'subtotal_hideprices_supplier_proposal';
636
+					$sessname = 'subtotal_hideInnerLines_supplier_proposal';
637
+					$sessname2 = 'subtotal_hidedetails_supplier_proposal';
638
+					$sessname3 = 'subtotal_hideprices_supplier_proposal';
639 639
 				}
640 640
 				elseif(in_array('ordercard',explode(':',$parameters['context']))) {
641 641
 					$sessname = 'subtotal_hideInnerLines_commande';
@@ -643,9 +643,9 @@  discard block
 block discarded – undo
643 643
 					$sessname3 = 'subtotal_hideprices_commande';
644 644
 				}
645 645
 				elseif(in_array('ordersuppliercard',explode(':',$parameters['context']))) {
646
-				    $sessname = 'subtotal_hideInnerLines_commande_fournisseur';
647
-				    $sessname2 = 'subtotal_hidedetails_commande_fournisseur';
648
-				    $sessname3 = 'subtotal_hideprices_commande_fournisseur';
646
+					$sessname = 'subtotal_hideInnerLines_commande_fournisseur';
647
+					$sessname2 = 'subtotal_hidedetails_commande_fournisseur';
648
+					$sessname3 = 'subtotal_hideprices_commande_fournisseur';
649 649
 				}
650 650
 				else {
651 651
 					$sessname = 'subtotal_hideInnerLines_unknown';
@@ -670,17 +670,17 @@  discard block
 block discarded – undo
670 670
 				foreach($object->lines as &$line) {
671 671
 					if ($line->product_type == 9 && $line->special_code == $this->module_number) {
672 672
 					    
673
-                        if($line->qty>=90) {
674
-                            $line->modsubtotal_total = 1;
675
-                        }
676
-                        else{
677
-                            $line->modsubtotal_title = 1;
678
-                        }
673
+						if($line->qty>=90) {
674
+							$line->modsubtotal_total = 1;
675
+						}
676
+						else{
677
+							$line->modsubtotal_title = 1;
678
+						}
679 679
                         
680 680
 						$line->total_ht = $this->getTotalLineFromObject($object, $line, '');
681 681
 					}
682
-	        	}
683
-	        }
682
+				}
683
+			}
684 684
 			
685 685
 		}
686 686
 		else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') {
@@ -697,7 +697,7 @@  discard block
 block discarded – undo
697 697
 				 */
698 698
 				else if($object->element=='invoice_supplier')
699 699
 				{
700
-				    $object->deleteline($idLine);
700
+					$object->deleteline($idLine);
701 701
 				}
702 702
 				/**
703 703
 				 * @var $object Propal
@@ -720,7 +720,7 @@  discard block
 block discarded – undo
720 720
 				 */
721 721
 				else if($object->element=='order_supplier')
722 722
 				{
723
-				    $object->deleteline($idLine);
723
+					$object->deleteline($idLine);
724 724
 				}
725 725
 				/**
726 726
 				 * @var $object Facturerec
@@ -795,7 +795,7 @@  discard block
 block discarded – undo
795 795
 		
796 796
 		foreach($object->lines as $l) {
797 797
 		
798
-		    $lid = (!empty($l->rowid) ? $l->rowid : $l->id);
798
+			$lid = (!empty($l->rowid) ? $l->rowid : $l->id);
799 799
 			if($lid == $lineid) {
800 800
 
801 801
 				$found = true;
@@ -804,7 +804,7 @@  discard block
 block discarded – undo
804 804
 			
805 805
 			if($found) {
806 806
 				
807
-			    $Tab[] = (!empty($l->rowid) ? $l->rowid : $l->id);
807
+				$Tab[] = (!empty($l->rowid) ? $l->rowid : $l->id);
808 808
 				
809 809
 				if($l->special_code==$this->module_number && (($l->qty==99 && $qty_line==1) || ($l->qty==98 && $qty_line==2))   ) {
810 810
 					break; // end of story
@@ -845,39 +845,39 @@  discard block
 block discarded – undo
845 845
 		foreach($TLineReverse as $l)
846 846
 		{
847 847
 			//print $l->rang.'>='.$rang.' '.$total.'<br/>';
848
-            if ($l->rang>=$rang) continue;
849
-            if (!empty($title_break) && $title_break->id == $l->id) break;
850
-            elseif (!TSubtotal::isModSubtotalLine($l))
851
-            {
852
-                // TODO retirer le test avec $builddoc quand Dolibarr affichera le total progression sur la card et pas seulement dans le PDF
853
-                if ($builddoc && $object->element == 'facture' && $object->type==Facture::TYPE_SITUATION)
854
-                {
855
-                    if ($l->situation_percent > 0)
856
-                    {
857
-                        $prev_progress = 0;
858
-                        $progress = 1;
859
-                        if (method_exists($l, 'get_prev_progress'))
860
-                        {
861
-                            $prev_progress = $l->get_prev_progress($object->id);
862
-                            $progress = ($l->situation_percent - $prev_progress) / 100;
863
-                        }
864
-
865
-                        $result = $sign * ($l->total_ht / ($l->situation_percent / 100)) * $progress;
866
-                        $total+= $result;
867
-                        // TODO check si les 3 lignes du dessous sont corrects
868
-                        $total_tva += $sign * ($l->total_tva / ($l->situation_percent / 100)) * $progress;
869
-                        $TTotal_tva[$l->tva_tx] += $sign * ($l->total_tva / ($l->situation_percent / 100)) * $progress;
870
-                        $total_ttc += $sign * ($l->total_tva / ($l->total_ttc / 100)) * $progress;
871
-                    }
872
-                }
873
-                else
874
-                {
875
-                    $total += $l->total_ht;
876
-                    $total_tva += $l->total_tva;
877
-                    $TTotal_tva[$l->tva_tx] += $l->total_tva;
878
-                    $total_ttc += $l->total_ttc;
879
-                }
880
-            }
848
+			if ($l->rang>=$rang) continue;
849
+			if (!empty($title_break) && $title_break->id == $l->id) break;
850
+			elseif (!TSubtotal::isModSubtotalLine($l))
851
+			{
852
+				// TODO retirer le test avec $builddoc quand Dolibarr affichera le total progression sur la card et pas seulement dans le PDF
853
+				if ($builddoc && $object->element == 'facture' && $object->type==Facture::TYPE_SITUATION)
854
+				{
855
+					if ($l->situation_percent > 0)
856
+					{
857
+						$prev_progress = 0;
858
+						$progress = 1;
859
+						if (method_exists($l, 'get_prev_progress'))
860
+						{
861
+							$prev_progress = $l->get_prev_progress($object->id);
862
+							$progress = ($l->situation_percent - $prev_progress) / 100;
863
+						}
864
+
865
+						$result = $sign * ($l->total_ht / ($l->situation_percent / 100)) * $progress;
866
+						$total+= $result;
867
+						// TODO check si les 3 lignes du dessous sont corrects
868
+						$total_tva += $sign * ($l->total_tva / ($l->situation_percent / 100)) * $progress;
869
+						$TTotal_tva[$l->tva_tx] += $sign * ($l->total_tva / ($l->situation_percent / 100)) * $progress;
870
+						$total_ttc += $sign * ($l->total_tva / ($l->total_ttc / 100)) * $progress;
871
+					}
872
+				}
873
+				else
874
+				{
875
+					$total += $l->total_ht;
876
+					$total_tva += $l->total_tva;
877
+					$TTotal_tva[$l->tva_tx] += $l->total_tva;
878
+					$total_ttc += $l->total_ttc;
879
+				}
880
+			}
881 881
 		}
882 882
 		if (!$return_all) return $total;
883 883
 		else return array($total, $total_tva, $total_ttc, $TTotal_tva);
@@ -915,7 +915,7 @@  discard block
 block discarded – undo
915 915
 		if(method_exists('Closure','bind')) {
916 916
 			$pageBreakOriginalValue = $pdf->AcceptPageBreak();
917 917
 			$sweetsThief = function ($pdf) {
918
-		    		return $pdf->bMargin ;
918
+					return $pdf->bMargin ;
919 919
 			};
920 920
 			$sweetsThief = Closure::bind($sweetsThief, null, $pdf);
921 921
 	
@@ -986,7 +986,7 @@  discard block
 block discarded – undo
986 986
 					$TTotal_tva = $TInfo[3];
987 987
 					$total_to_print = price($TInfo[0]);
988 988
 
989
-                    $line->total_ht = $TInfo[0];
989
+					$line->total_ht = $TInfo[0];
990 990
 					$line->total = $TInfo[0];
991 991
 					if (!TSubtotal::isModSubtotalLine($line)) $line->total_tva = $TInfo[1];
992 992
 					$line->total_ttc = $TInfo[2];
@@ -1143,7 +1143,7 @@  discard block
 block discarded – undo
1143 1143
 	}
1144 1144
 	
1145 1145
 	function pdf_getlinetotalexcltax($parameters=array(), &$object, &$action='') {
1146
-	    global $conf, $hideprices, $hookmanager;
1146
+		global $conf, $hideprices, $hookmanager;
1147 1147
 		
1148 1148
 		if(is_array($parameters)) $i = & $parameters['i'];
1149 1149
 		else $i = (int)$parameters;
@@ -1182,7 +1182,7 @@  discard block
 block discarded – undo
1182 1182
 			}
1183 1183
 		}
1184 1184
 		if ((int)GETPOST('hideInnerLines') && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)){
1185
-		    $this->resprints = price($object->lines[$i]->total_ht);
1185
+			$this->resprints = price($object->lines[$i]->total_ht);
1186 1186
 		}
1187 1187
 		
1188 1188
 		// Si la gestion C/NC est active et que je suis sur un ligne dont l'extrafield est coché
@@ -1311,7 +1311,7 @@  discard block
 block discarded – undo
1311 1311
 	}
1312 1312
 	
1313 1313
 	function pdf_getlineupexcltax($parameters=array(), &$object, &$action='') {
1314
-	    global $conf,$hideprices,$hookmanager;
1314
+		global $conf,$hideprices,$hookmanager;
1315 1315
 
1316 1316
 		if(is_array($parameters)) $i = & $parameters['i'];
1317 1317
 		else $i = (int)$parameters;
@@ -1319,18 +1319,18 @@  discard block
 block discarded – undo
1319 1319
 		if($this->isModSubtotalLine($parameters,$object) ) {
1320 1320
 			$this->resprints = ' ';
1321 1321
 
1322
-            $line = $object->lines[$i];
1322
+			$line = $object->lines[$i];
1323 1323
 
1324
-            // On récupère les montants du bloc pour les afficher dans la ligne de sous-total
1325
-            if(TSubtotal::isSubtotal($line)) {
1326
-                $parentTitle = TSubtotal::getParentTitleOfLine($object, $i);
1324
+			// On récupère les montants du bloc pour les afficher dans la ligne de sous-total
1325
+			if(TSubtotal::isSubtotal($line)) {
1326
+				$parentTitle = TSubtotal::getParentTitleOfLine($object, $i);
1327 1327
 
1328
-                if(is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals();
1329
-                if(! empty($parentTitle->array_options['options_show_total_ht'])) {
1330
-                    $TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle);
1331
-                    $this->resprints = price($TTotal['total_unit_subprice']);
1332
-                }
1333
-            }
1328
+				if(is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals();
1329
+				if(! empty($parentTitle->array_options['options_show_total_ht'])) {
1330
+					$TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle);
1331
+					$this->resprints = price($TTotal['total_unit_subprice']);
1332
+				}
1333
+			}
1334 1334
 		
1335 1335
 			if((float)DOL_VERSION<=3.6) {
1336 1336
 				return '';
@@ -1346,58 +1346,58 @@  discard block
 block discarded – undo
1346 1346
 		(!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))
1347 1347
 		)
1348 1348
 		{
1349
-		    // alors je dois vérifier si la méthode fait partie de la conf qui l'exclue
1350
-		    if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC)))
1351
-		    {
1352
-		        $this->resprints = ' ';
1349
+			// alors je dois vérifier si la méthode fait partie de la conf qui l'exclue
1350
+			if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC)))
1351
+			{
1352
+				$this->resprints = ' ';
1353 1353
 		        
1354
-		        // currentcontext à modifier celon l'appel
1355
-		        $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i);
1356
-		        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)
1354
+				// currentcontext à modifier celon l'appel
1355
+				$params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i);
1356
+				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)
1357 1357
 		        
1358
-		    }
1358
+			}
1359 1359
 		}
1360 1360
 		// Cache le prix pour les lignes standards dolibarr qui sont dans un ensemble
1361 1361
 		else if (!empty($hideprices))
1362 1362
 		{
1363 1363
 		    
1364
-		    // Check if a title exist for this line && if the title have subtotal
1365
-		    $lineTitle = TSubtotal::getParentTitleOfLine($object, $i);
1366
-		    if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true))
1367
-		    {
1364
+			// Check if a title exist for this line && if the title have subtotal
1365
+			$lineTitle = TSubtotal::getParentTitleOfLine($object, $i);
1366
+			if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true))
1367
+			{
1368 1368
 		        
1369
-		        $this->resprints = ' ';
1369
+				$this->resprints = ' ';
1370 1370
 		        
1371
-		        // currentcontext à modifier celon l'appel
1372
-		        $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hideprices', 'i' => $i);
1373
-		        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)
1374
-		    }
1371
+				// currentcontext à modifier celon l'appel
1372
+				$params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hideprices', 'i' => $i);
1373
+				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)
1374
+			}
1375 1375
 		}
1376 1376
 		
1377 1377
 		return 0;
1378 1378
 	}
1379 1379
 	
1380 1380
 	function pdf_getlineremisepercent($parameters=array(), &$object, &$action='') {
1381
-	    global $conf,$hideprices,$hookmanager;
1381
+		global $conf,$hideprices,$hookmanager;
1382 1382
 
1383
-        if(is_array($parameters)) $i = & $parameters['i'];
1384
-        else $i = (int) $parameters;
1383
+		if(is_array($parameters)) $i = & $parameters['i'];
1384
+		else $i = (int) $parameters;
1385 1385
 
1386 1386
 		if($this->isModSubtotalLine($parameters,$object) ) {
1387 1387
 			$this->resprints = ' ';
1388 1388
 
1389
-            $line = $object->lines[$i];
1389
+			$line = $object->lines[$i];
1390 1390
 
1391
-            // Affichage de la remise 
1392
-            if(TSubtotal::isSubtotal($line)) {
1393
-                $parentTitle = TSubtotal::getParentTitleOfLine($object, $i);
1391
+			// Affichage de la remise 
1392
+			if(TSubtotal::isSubtotal($line)) {
1393
+				$parentTitle = TSubtotal::getParentTitleOfLine($object, $i);
1394 1394
 
1395
-                if(empty($parentTitle->array_options)) $parentTitle->fetch_optionals();
1396
-                if(! empty($parentTitle->array_options['options_show_reduc'])) {
1397
-                    $TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle);
1398
-                    $this->resprints = price((1-$TTotal['total_ht'] / $TTotal['total_subprice'])*100, 0, '', 1, 2, 2).'%';
1399
-                }
1400
-            }
1395
+				if(empty($parentTitle->array_options)) $parentTitle->fetch_optionals();
1396
+				if(! empty($parentTitle->array_options['options_show_reduc'])) {
1397
+					$TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle);
1398
+					$this->resprints = price((1-$TTotal['total_ht'] / $TTotal['total_subprice'])*100, 0, '', 1, 2, 2).'%';
1399
+				}
1400
+			}
1401 1401
 		
1402 1402
 			if((float)DOL_VERSION<=3.6) {
1403 1403
 				return '';
@@ -1407,15 +1407,15 @@  discard block
 block discarded – undo
1407 1407
 			}
1408 1408
 		}
1409 1409
 		elseif (!empty($hideprices)
1410
-		        || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) )
1411
-		        )
1412
-		    {
1413
-		        if (!empty($hideprices) || !in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC)))
1414
-		        {
1415
-		            $this->resprints = ' ';
1416
-		            return 1;
1417
-		        }
1418
-		    }
1410
+				|| (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) )
1411
+				)
1412
+			{
1413
+				if (!empty($hideprices) || !in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC)))
1414
+				{
1415
+					$this->resprints = ' ';
1416
+					return 1;
1417
+				}
1418
+			}
1419 1419
 		
1420 1420
 		return 0;
1421 1421
 	}
@@ -1451,7 +1451,7 @@  discard block
 block discarded – undo
1451 1451
 	}
1452 1452
 	
1453 1453
 	function pdf_getlinevatrate($parameters=array(), &$object, &$action='') {
1454
-	    global $conf,$hideprices,$hookmanager;
1454
+		global $conf,$hideprices,$hookmanager;
1455 1455
 	    
1456 1456
 		if($this->isModSubtotalLine($parameters,$object) ){
1457 1457
 			$this->resprints = ' ';
@@ -1476,31 +1476,31 @@  discard block
 block discarded – undo
1476 1476
 		(!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))
1477 1477
 		)
1478 1478
 		{
1479
-		    // alors je dois vérifier si la méthode fait partie de la conf qui l'exclue
1480
-		    if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC)))
1481
-		    {
1482
-		        $this->resprints = ' ';
1479
+			// alors je dois vérifier si la méthode fait partie de la conf qui l'exclue
1480
+			if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC)))
1481
+			{
1482
+				$this->resprints = ' ';
1483 1483
 		        
1484
-		        // currentcontext à modifier celon l'appel
1485
-		        $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i);
1486
-		        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)
1487
-		    }
1484
+				// currentcontext à modifier celon l'appel
1485
+				$params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i);
1486
+				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)
1487
+			}
1488 1488
 		}
1489 1489
 		// Cache le prix pour les lignes standards dolibarr qui sont dans un ensemble
1490 1490
 		else if (!empty($hideprices))
1491 1491
 		{
1492 1492
 		    
1493
-		    // Check if a title exist for this line && if the title have subtotal
1494
-		    $lineTitle = TSubtotal::getParentTitleOfLine($object, $i);
1495
-		    if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true))
1496
-		    {
1493
+			// Check if a title exist for this line && if the title have subtotal
1494
+			$lineTitle = TSubtotal::getParentTitleOfLine($object, $i);
1495
+			if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true))
1496
+			{
1497 1497
 		        
1498
-		        $this->resprints = ' ';
1498
+				$this->resprints = ' ';
1499 1499
 		        
1500
-		        // currentcontext à modifier celon l'appel
1501
-		        $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hideprices', 'i' => $i);
1502
-		        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)
1503
-		    }
1500
+				// currentcontext à modifier celon l'appel
1501
+				$params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hideprices', 'i' => $i);
1502
+				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)
1503
+			}
1504 1504
 		}
1505 1505
 		
1506 1506
 		return 0;
@@ -1624,33 +1624,33 @@  discard block
 block discarded – undo
1624 1624
 		
1625 1625
 		$this->add_numerotation($object);	
1626 1626
 		
1627
-        foreach($object->lines as $k => &$l) {
1628
-            if(TSubtotal::isSubtotal($l)) {
1629
-                $parentTitle = TSubtotal::getParentTitleOfLine($object, $k);
1630
-                if(is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals();
1631
-                if(! empty($parentTitle->id) && ! empty($parentTitle->array_options['options_show_reduc'])) {
1632
-                    $l->remise_percent = 100;    // Affichage de la réduction sur la ligne de sous-total
1633
-                }
1634
-            }
1627
+		foreach($object->lines as $k => &$l) {
1628
+			if(TSubtotal::isSubtotal($l)) {
1629
+				$parentTitle = TSubtotal::getParentTitleOfLine($object, $k);
1630
+				if(is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals();
1631
+				if(! empty($parentTitle->id) && ! empty($parentTitle->array_options['options_show_reduc'])) {
1632
+					$l->remise_percent = 100;    // Affichage de la réduction sur la ligne de sous-total
1633
+				}
1634
+			}
1635 1635
 
1636 1636
 
1637
-            // Pas de hook sur les colonnes du PDF expédition, on unset les bonnes variables
1638
-            if(($object->element == 'shipping' || $object->element == 'delivery') && $this->isModSubtotalLine($k, $object))
1637
+			// Pas de hook sur les colonnes du PDF expédition, on unset les bonnes variables
1638
+			if(($object->element == 'shipping' || $object->element == 'delivery') && $this->isModSubtotalLine($k, $object))
1639 1639
 			{
1640 1640
 				$l->qty = $l->qty_asked;
1641 1641
 				unset($l->qty_asked, $l->qty_shipped, $l->volume, $l->weight);
1642 1642
 			}
1643
-        }
1643
+		}
1644 1644
 
1645 1645
 		$hideInnerLines = (int)GETPOST('hideInnerLines');
1646 1646
 		$hidedetails = (int)GETPOST('hidedetails');
1647 1647
 
1648 1648
 		if ($hideInnerLines) { // si c une ligne de titre
1649
-	    	$fk_parent_line=0;
1649
+			$fk_parent_line=0;
1650 1650
 			$TLines =array();
1651 1651
 		
1652 1652
 			$original_count=count($object->lines);
1653
-		    $TTvas = array(); // tableau de tva
1653
+			$TTvas = array(); // tableau de tva
1654 1654
 		    
1655 1655
 			foreach($object->lines as $k=>&$line) 
1656 1656
 			{
@@ -1691,48 +1691,48 @@  discard block
 block discarded – undo
1691 1691
 			
1692 1692
 				if ($hideInnerLines)
1693 1693
 				{
1694
-				    if(!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES))
1695
-				    {
1696
-				        if($line->tva_tx != '0.000' && $line->product_type!=9){
1694
+					if(!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES))
1695
+					{
1696
+						if($line->tva_tx != '0.000' && $line->product_type!=9){
1697 1697
 				            
1698
-    				        // on remplit le tableau de tva pour substituer les lignes cachées
1699
-    				        $TTvas[$line->tva_tx]['total_tva'] += $line->total_tva;
1700
-    				        $TTvas[$line->tva_tx]['total_ht'] += $line->total_ht;
1701
-    				        $TTvas[$line->tva_tx]['total_ttc'] += $line->total_ttc; 
1702
-    				    }
1703
-    					if($line->product_type==9 && $line->rowid>0)
1704
-    					{
1705
-    					    //Cas où je doit cacher les produits et afficher uniquement les sous-totaux avec les titres
1706
-    					    // génère des lignes d'affichage des montants HT soumis à tva
1707
-    					    $nbtva = count($TTvas);
1708
-    					    if(!empty($nbtva)){
1709
-    					        foreach ($TTvas as $tx =>$val){
1710
-    					            $l = clone $line;
1711
-    					            $l->product_type = 1;
1712
-    					            $l->special_code = '';
1713
-    					            $l->qty = 1;
1714
-    					            $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx));
1715
-    					            $l->tva_tx = $tx;
1716
-    					            $l->total_ht = $val['total_ht'];
1717
-    					            $l->total_tva = $val['total_tva'];
1718
-    					            $l->total = $line->total_ht;
1719
-    					            $l->total_ttc = $val['total_ttc'];
1720
-    					            $TLines[] = $l;
1721
-    					            array_shift($TTvas);
1722
-    					       }
1723
-    					    }
1698
+							// on remplit le tableau de tva pour substituer les lignes cachées
1699
+							$TTvas[$line->tva_tx]['total_tva'] += $line->total_tva;
1700
+							$TTvas[$line->tva_tx]['total_ht'] += $line->total_ht;
1701
+							$TTvas[$line->tva_tx]['total_ttc'] += $line->total_ttc; 
1702
+						}
1703
+						if($line->product_type==9 && $line->rowid>0)
1704
+						{
1705
+							//Cas où je doit cacher les produits et afficher uniquement les sous-totaux avec les titres
1706
+							// génère des lignes d'affichage des montants HT soumis à tva
1707
+							$nbtva = count($TTvas);
1708
+							if(!empty($nbtva)){
1709
+								foreach ($TTvas as $tx =>$val){
1710
+									$l = clone $line;
1711
+									$l->product_type = 1;
1712
+									$l->special_code = '';
1713
+									$l->qty = 1;
1714
+									$l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx));
1715
+									$l->tva_tx = $tx;
1716
+									$l->total_ht = $val['total_ht'];
1717
+									$l->total_tva = $val['total_tva'];
1718
+									$l->total = $line->total_ht;
1719
+									$l->total_ttc = $val['total_ttc'];
1720
+									$TLines[] = $l;
1721
+									array_shift($TTvas);
1722
+							   }
1723
+							}
1724 1724
     					    
1725
-    					    // ajoute la ligne de sous-total
1726
-    					    $TLines[] = $line; 
1727
-    					}
1728
-				    } else {
1725
+							// ajoute la ligne de sous-total
1726
+							$TLines[] = $line; 
1727
+						}
1728
+					} else {
1729 1729
 				        
1730
-				        if($line->product_type==9 && $line->rowid>0)
1731
-				        {
1732
-				            // ajoute la ligne de sous-total
1733
-				            $TLines[] = $line; 
1734
-				        }
1735
-				    }
1730
+						if($line->product_type==9 && $line->rowid>0)
1731
+						{
1732
+							// ajoute la ligne de sous-total
1733
+							$TLines[] = $line; 
1734
+						}
1735
+					}
1736 1736
 				    
1737 1737
 					
1738 1738
 				}
@@ -1757,20 +1757,20 @@  discard block
 block discarded – undo
1757 1757
 			$nbtva = count($TTvas);
1758 1758
 			if(!empty($nbtva) && $hideInnerLines && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES))
1759 1759
 			{
1760
-			    foreach ($TTvas as $tx =>$val){
1761
-			        $l = clone $line;
1762
-			        $l->product_type = 1;
1763
-			        $l->special_code = '';
1764
-			        $l->qty = 1;
1765
-			        $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx));
1766
-			        $l->tva_tx = $tx;
1767
-			        $l->total_ht = $val['total_ht'];
1768
-			        $l->total_tva = $val['total_tva'];
1769
-			        $l->total = $line->total_ht;
1770
-			        $l->total_ttc = $val['total_ttc'];
1771
-			        $TLines[] = $l;
1772
-			        array_shift($TTvas);
1773
-			    }
1760
+				foreach ($TTvas as $tx =>$val){
1761
+					$l = clone $line;
1762
+					$l->product_type = 1;
1763
+					$l->special_code = '';
1764
+					$l->qty = 1;
1765
+					$l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx));
1766
+					$l->tva_tx = $tx;
1767
+					$l->total_ht = $val['total_ht'];
1768
+					$l->total_tva = $val['total_tva'];
1769
+					$l->total = $line->total_ht;
1770
+					$l->total_ttc = $val['total_ttc'];
1771
+					$TLines[] = $l;
1772
+					array_shift($TTvas);
1773
+				}
1774 1774
 			}
1775 1775
 			
1776 1776
 			global $nblignes;
@@ -1782,7 +1782,7 @@  discard block
 block discarded – undo
1782 1782
 				$this->resprints = '';
1783 1783
 				return 0;
1784 1784
 			}
1785
-	    }
1785
+		}
1786 1786
 		
1787 1787
 		return 0;
1788 1788
 	}
@@ -1974,11 +1974,11 @@  discard block
 block discarded – undo
1974 1974
 		}
1975 1975
 		elseif($object->element == 'order_supplier' )
1976 1976
 		{
1977
-		    $createRight = $user->rights->fournisseur->commande->creer;
1977
+			$createRight = $user->rights->fournisseur->commande->creer;
1978 1978
 		}
1979 1979
 		elseif($object->element == 'invoice_supplier' )
1980 1980
 		{
1981
-		    $createRight = $user->rights->fournisseur->facture->creer;
1981
+			$createRight = $user->rights->fournisseur->facture->creer;
1982 1982
 		}
1983 1983
 		elseif($object->element == 'commande' && in_array('ordershipmentcard', $contexts))
1984 1984
 		{
@@ -2007,27 +2007,27 @@  discard block
 block discarded – undo
2007 2007
 			$line = $originline;
2008 2008
 		}
2009 2009
  		if($object->element=='facture')$idvar = 'facid';
2010
-        else $idvar='id';
2010
+		else $idvar='id';
2011 2011
 		if($line->special_code!=$this->module_number || $line->product_type!=9) {
2012 2012
 			if ($object->statut == 0  && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_LINE) && $object->element !== 'invoice_supplier')
2013
-            {
2014
-                if(!(TSubtotal::isModSubtotalLine($line)) && ( $line->fk_prev_id === null ) && !($action == "editline" && GETPOST('lineid') == $line->id)) {
2015
-                    echo '<a name="duplicate-'.$line->id.'" href="' . $_SERVER['PHP_SELF'] . '?' . $idvar . '=' . $object->id . '&action=duplicate&lineid=' . $line->id . '"><i class="fa fa-clone" aria-hidden="true"></i></a>';
2013
+			{
2014
+				if(!(TSubtotal::isModSubtotalLine($line)) && ( $line->fk_prev_id === null ) && !($action == "editline" && GETPOST('lineid') == $line->id)) {
2015
+					echo '<a name="duplicate-'.$line->id.'" href="' . $_SERVER['PHP_SELF'] . '?' . $idvar . '=' . $object->id . '&action=duplicate&lineid=' . $line->id . '"><i class="fa fa-clone" aria-hidden="true"></i></a>';
2016 2016
 
2017
-                    ?>
2017
+					?>
2018 2018
                         <script type="text/javascript">
2019 2019
                             $(document).ready(function() {
2020 2020
                                 $("a[name='duplicate-<?php echo $line->id; ?>']").prependTo($('#row-<?php echo $line->id; ?>').find('.linecoledit'));
2021 2021
                             });
2022 2022
                         </script>
2023 2023
                     <?php
2024
-                }
2024
+				}
2025 2025
 
2026
-            }
2026
+			}
2027 2027
 			return 0;
2028 2028
 		}
2029 2029
 		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)) 
2030
-        {
2030
+		{
2031 2031
 
2032 2032
 
2033 2033
 			if((float)DOL_VERSION <= 3.4)
@@ -2075,7 +2075,7 @@  discard block
 block discarded – undo
2075 2075
 			//var_dump($line);
2076 2076
             
2077 2077
 			// HTML 5 data for js
2078
-            $data = $this->_getHtmlData($parameters, $object, $action, $hookmanager);
2078
+			$data = $this->_getHtmlData($parameters, $object, $action, $hookmanager);
2079 2079
             
2080 2080
 			
2081 2081
 			?>
@@ -2137,8 +2137,8 @@  discard block
 block discarded – undo
2137 2137
 						}
2138 2138
 						
2139 2139
 						if ($object->element == 'order_supplier' || $object->element == 'invoice_supplier') {
2140
-						    $line->label = !empty($line->description) ? $line->description : $line->desc;
2141
-						    $line->description = '';
2140
+							$line->label = !empty($line->description) ? $line->description : $line->desc;
2141
+							$line->description = '';
2142 2142
 						}
2143 2143
 						$newlabel = $line->label;
2144 2144
 						if($line->label=='' && !$isFreeText) {
@@ -2172,38 +2172,38 @@  discard block
 block discarded – undo
2172 2172
 						
2173 2173
 
2174 2174
 						echo '<div class="subtotal_underline" style="margin-left:24px; line-height: 25px;">';
2175
-                        echo '<div>';
2176
-                        echo '<input style="vertical-align:sub;"  type="checkbox" name="line-pagebreak" id="subtotal-pagebreak" value="8" '.(($line->info_bits > 0) ? 'checked="checked"' : '') .' />&nbsp;';
2177
-                        echo '<label for="subtotal-pagebreak">'.$langs->trans('AddBreakPageBefore').'</label>';
2178
-                        echo '</div>';
2179
-
2180
-                        if (TSubtotal::isTitle($line))
2181
-                        {
2182
-                            $form = new Form($db);
2183
-                            echo '<div>';
2184
-                            echo '<label for="subtotal_tva_tx">'.$form->textwithpicto($langs->trans('subtotal_apply_default_tva'), $langs->trans('subtotal_apply_default_tva_help')).'</label>';
2185
-                            echo '<select id="subtotal_tva_tx" name="subtotal_tva_tx" class="flat"><option selected="selected" value="">-</option>';
2186
-                            if (empty($readonlyForSituation)) echo str_replace('selected', '', $form->load_tva('subtotal_tva_tx', '', $parameters['seller'], $parameters['buyer'], 0, 0, '', true));
2187
-                            echo '</select>';
2188
-                            echo '</div>';
2189
-
2190
-                            if (!empty($conf->global->INVOICE_USE_SITUATION) && $object->element == 'facture' && $object->type == Facture::TYPE_SITUATION)
2191
-                            {
2192
-                                echo '<div>';
2193
-                                echo '<label for="subtotal_progress">'.$langs->trans('subtotal_apply_progress').'</label> <input id="subtotal_progress" name="subtotal_progress" value="" size="1" />%';
2194
-                                echo '</div>';
2195
-                            }
2196
-                            echo '<div>';
2197
-                            echo '<input style="vertical-align:sub;"  type="checkbox" name="line-showTotalHT" id="subtotal-showTotalHT" value="9" '.(($line->array_options['options_show_total_ht'] > 0) ? 'checked="checked"' : '') .' />&nbsp;';
2198
-                            echo '<label for="subtotal-showTotalHT">'.$langs->trans('ShowTotalHTOnSubtotalBlock').'</label>';
2199
-                            echo '</div>';
2200
-
2201
-                            echo '<div>';
2202
-                            echo '<input style="vertical-align:sub;"  type="checkbox" name="line-showReduc" id="subtotal-showReduc" value="1" '.(($line->array_options['options_show_reduc'] > 0) ? 'checked="checked"' : '') .' />&nbsp;';
2203
-                            echo '<label for="subtotal-showReduc">'.$langs->trans('ShowReducOnSubtotalBlock').'</label>';
2204
-                            echo '</div>';
2205
-                        }
2206
-                        else if ($isFreeText) echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation);
2175
+						echo '<div>';
2176
+						echo '<input style="vertical-align:sub;"  type="checkbox" name="line-pagebreak" id="subtotal-pagebreak" value="8" '.(($line->info_bits > 0) ? 'checked="checked"' : '') .' />&nbsp;';
2177
+						echo '<label for="subtotal-pagebreak">'.$langs->trans('AddBreakPageBefore').'</label>';
2178
+						echo '</div>';
2179
+
2180
+						if (TSubtotal::isTitle($line))
2181
+						{
2182
+							$form = new Form($db);
2183
+							echo '<div>';
2184
+							echo '<label for="subtotal_tva_tx">'.$form->textwithpicto($langs->trans('subtotal_apply_default_tva'), $langs->trans('subtotal_apply_default_tva_help')).'</label>';
2185
+							echo '<select id="subtotal_tva_tx" name="subtotal_tva_tx" class="flat"><option selected="selected" value="">-</option>';
2186
+							if (empty($readonlyForSituation)) echo str_replace('selected', '', $form->load_tva('subtotal_tva_tx', '', $parameters['seller'], $parameters['buyer'], 0, 0, '', true));
2187
+							echo '</select>';
2188
+							echo '</div>';
2189
+
2190
+							if (!empty($conf->global->INVOICE_USE_SITUATION) && $object->element == 'facture' && $object->type == Facture::TYPE_SITUATION)
2191
+							{
2192
+								echo '<div>';
2193
+								echo '<label for="subtotal_progress">'.$langs->trans('subtotal_apply_progress').'</label> <input id="subtotal_progress" name="subtotal_progress" value="" size="1" />%';
2194
+								echo '</div>';
2195
+							}
2196
+							echo '<div>';
2197
+							echo '<input style="vertical-align:sub;"  type="checkbox" name="line-showTotalHT" id="subtotal-showTotalHT" value="9" '.(($line->array_options['options_show_total_ht'] > 0) ? 'checked="checked"' : '') .' />&nbsp;';
2198
+							echo '<label for="subtotal-showTotalHT">'.$langs->trans('ShowTotalHTOnSubtotalBlock').'</label>';
2199
+							echo '</div>';
2200
+
2201
+							echo '<div>';
2202
+							echo '<input style="vertical-align:sub;"  type="checkbox" name="line-showReduc" id="subtotal-showReduc" value="1" '.(($line->array_options['options_show_reduc'] > 0) ? 'checked="checked"' : '') .' />&nbsp;';
2203
+							echo '<label for="subtotal-showReduc">'.$langs->trans('ShowReducOnSubtotalBlock').'</label>';
2204
+							echo '</div>';
2205
+						}
2206
+						else if ($isFreeText) echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation);
2207 2207
 						echo '</div>';
2208 2208
 
2209 2209
 						if($line->qty<10) {
@@ -2720,17 +2720,17 @@  discard block
 block discarded – undo
2720 2720
 		if ($object->statut == 0 && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && $action != 'editline')
2721 2721
 		{
2722 2722
 		    
2723
-		    if($object->element == 'invoice_supplier' || $object->element == 'order_supplier')
2724
-		    {
2725
-		        foreach ($object->lines as $line)
2726
-		        {
2727
-		            // fetch optionals attributes and labels
2728
-		            require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
2729
-		            $extrafields=new ExtraFields($this->db);
2730
-		            $extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true);
2731
-		            $line->fetch_optionals($line->id,$extralabels);
2732
-		        }
2733
-		    }
2723
+			if($object->element == 'invoice_supplier' || $object->element == 'order_supplier')
2724
+			{
2725
+				foreach ($object->lines as $line)
2726
+				{
2727
+					// fetch optionals attributes and labels
2728
+					require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
2729
+					$extrafields=new ExtraFields($this->db);
2730
+					$extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true);
2731
+					$line->fetch_optionals($line->id,$extralabels);
2732
+				}
2733
+			}
2734 2734
 		    
2735 2735
 			$TSubNc = array();
2736 2736
 			foreach ($object->lines as &$l)
@@ -2821,80 +2821,80 @@  discard block
 block discarded – undo
2821 2821
 	{
2822 2822
 		dol_include_once('/subtotal/class/subtotal.class.php');
2823 2823
 
2824
-	    $line = &$parameters['line'];
2824
+		$line = &$parameters['line'];
2825 2825
 	    
2826
-	    $ThtmlData['data-id']           = $line->id;
2827
-	    $ThtmlData['data-product_type'] = $line->product_type;
2828
-	    $ThtmlData['data-qty']          = 0; //$line->qty;
2829
-	    $ThtmlData['data-level']        = TSubtotal::getNiveau($line);
2826
+		$ThtmlData['data-id']           = $line->id;
2827
+		$ThtmlData['data-product_type'] = $line->product_type;
2828
+		$ThtmlData['data-qty']          = 0; //$line->qty;
2829
+		$ThtmlData['data-level']        = TSubtotal::getNiveau($line);
2830 2830
 	    
2831
-	    if(TSubtotal::isTitle($line)){
2832
-	        $ThtmlData['data-issubtotal'] = 'title';
2833
-	    }elseif(TSubtotal::isSubtotal($line)){
2834
-	        $ThtmlData['data-issubtotal'] = 'subtotal';
2835
-	    }
2836
-	    else{
2837
-	        $ThtmlData['data-issubtotal'] = 'freetext';
2838
-	    }
2831
+		if(TSubtotal::isTitle($line)){
2832
+			$ThtmlData['data-issubtotal'] = 'title';
2833
+		}elseif(TSubtotal::isSubtotal($line)){
2834
+			$ThtmlData['data-issubtotal'] = 'subtotal';
2835
+		}
2836
+		else{
2837
+			$ThtmlData['data-issubtotal'] = 'freetext';
2838
+		}
2839 2839
 	    
2840 2840
 	    
2841
-	    // Change or add data  from hooks
2842
-	    $parameters = array_replace($parameters , array(  'ThtmlData' => $ThtmlData )  );
2841
+		// Change or add data  from hooks
2842
+		$parameters = array_replace($parameters , array(  'ThtmlData' => $ThtmlData )  );
2843 2843
 	    
2844
-	    // hook 
2845
-	    $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
2846
-	    if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
2847
-	    if ($reshook>0)
2848
-	    {
2849
-	        $ThtmlData = $hookmanager->resArray;
2850
-	    }
2851
-
2852
-	    return $this->implodeHtmlData($ThtmlData);
2844
+		// hook 
2845
+		$reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
2846
+		if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
2847
+		if ($reshook>0)
2848
+		{
2849
+			$ThtmlData = $hookmanager->resArray;
2850
+		}
2851
+
2852
+		return $this->implodeHtmlData($ThtmlData);
2853 2853
 	
2854 2854
 	}
2855 2855
 	
2856 2856
 	
2857 2857
 	function implodeHtmlData($ThtmlData = array())
2858 2858
 	{
2859
-	    $data = '';
2860
-	    foreach($ThtmlData as $k => $h )
2861
-	    {
2862
-	        if(is_array($h))
2863
-	        {
2864
-	            $h = json_encode($h);
2865
-	        }
2859
+		$data = '';
2860
+		foreach($ThtmlData as $k => $h )
2861
+		{
2862
+			if(is_array($h))
2863
+			{
2864
+				$h = json_encode($h);
2865
+			}
2866 2866
 	        
2867
-	        $data .= $k . '="'.dol_htmlentities($h, ENT_QUOTES).'" ';
2868
-	    }
2867
+			$data .= $k . '="'.dol_htmlentities($h, ENT_QUOTES).'" ';
2868
+		}
2869 2869
 	    
2870
-	    return $data;
2870
+		return $data;
2871 2871
 	}
2872 2872
 	
2873 2873
 	function _ajax_block_order_js($object)
2874 2874
 	{
2875
-	    global $conf,$tagidfortablednd,$filepath,$langs;
2875
+		global $conf,$tagidfortablednd,$filepath,$langs;
2876 2876
 	    
2877
-	    /*
2877
+		/*
2878 2878
 	     * this part of js is base on dolibarr htdocs/core/tpl/ajaxrow.tpl.php 
2879 2879
 	     * for compatibility reasons we don't use tableDnD but jquery sortable
2880 2880
 	     */
2881 2881
 	    
2882
-	    $id=$object->id;
2883
-	    $nboflines=(isset($object->lines)?count($object->lines):0);
2884
-	    $forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1;
2882
+		$id=$object->id;
2883
+		$nboflines=(isset($object->lines)?count($object->lines):0);
2884
+		$forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1;
2885 2885
 	    
2886
-	    $id=$object->id;
2887
-	    $fk_element=$object->fk_element;
2888
-	    $table_element_line=$object->table_element_line;
2889
-	    $nboflines=(isset($object->lines)?count($object->lines):(empty($nboflines)?0:$nboflines));
2890
-	    $tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd);
2891
-	    $filepath=(empty($filepath)?'':$filepath);
2886
+		$id=$object->id;
2887
+		$fk_element=$object->fk_element;
2888
+		$table_element_line=$object->table_element_line;
2889
+		$nboflines=(isset($object->lines)?count($object->lines):(empty($nboflines)?0:$nboflines));
2890
+		$tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd);
2891
+		$filepath=(empty($filepath)?'':$filepath);
2892 2892
 	    
2893 2893
 	    
2894
-	    if (GETPOST('action','aZ09') != 'editline' && $nboflines > 1)
2895
-	    {
2894
+		if (GETPOST('action','aZ09') != 'editline' && $nboflines > 1)
2895
+		{
2896 2896
 	        
2897
-	        ?>
2897
+			?>
2898 2898
 		
2899 2899
 		
2900 2900
 			<script type="text/javascript">
Please login to merge, or discard this patch.
class/subtotal.class.php 1 patch
Indentation   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -34,15 +34,15 @@  discard block
 block discarded – undo
34 34
 			}
35 35
 
36 36
 			if($object->element=='facture')
37
-            {
38
-                /** @var Facture $object */
39
-                $res =  $object->addline($desc, 0,$qty,0,0,0,0,0,'','',0,0,'','HT',0,9,$rang, TSubtotal::$module_number, '', 0, 0, null, 0, $label);
40
-            }
37
+			{
38
+				/** @var Facture $object */
39
+				$res =  $object->addline($desc, 0,$qty,0,0,0,0,0,'','',0,0,'','HT',0,9,$rang, TSubtotal::$module_number, '', 0, 0, null, 0, $label);
40
+			}
41 41
 			elseif($object->element=='invoice_supplier') {
42
-                /** @var FactureFournisseur $object */
43
-			    $object->special_code = TSubtotal::$module_number;
44
-                if( (float)DOL_VERSION < 6 ) $rang = $object->line_max() + 1;
45
-			    $res = $object->addline($label,0,0,0,0,$qty,0,0,'','',0,0,'HT',9,$rang);
42
+				/** @var FactureFournisseur $object */
43
+				$object->special_code = TSubtotal::$module_number;
44
+				if( (float)DOL_VERSION < 6 ) $rang = $object->line_max() + 1;
45
+				$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
@@ -322,8 +322,8 @@  discard block
 block discarded – undo
322 322
 	{
323 323
 		if (empty($fk_commande)) return false;
324 324
 
325
-        $table = 'commandedet';
326
-        if ($supplier) $table = 'commande_fournisseurdet';
325
+		$table = 'commandedet';
326
+		if ($supplier) $table = 'commande_fournisseurdet';
327 327
 
328 328
 		$sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.$table.' WHERE fk_commande = '.$fk_commande.' ORDER BY rang DESC LIMIT 1';
329 329
 		$resql = $db->query($sql);
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 		{
344 344
 			if ($line->rang >= $rang) continue; // Tout ce qui ce trouve en dessous j'ignore, nous voulons uniquement ce qui ce trouve au dessus
345 345
 
346
-            if (self::isTitle($line))
346
+			if (self::isTitle($line))
347 347
 			{
348 348
 				if ($skip_title)
349 349
 				{
@@ -376,10 +376,10 @@  discard block
 block discarded – undo
376 376
 	
377 377
 	public static function isSubtotal(&$line, $level=-1)
378 378
 	{
379
-	    $res = $line->special_code == self::$module_number && $line->product_type == 9 && $line->qty >= 90;
380
-	    if($res && $level > -1) {
381
-	        return self::getNiveau($line) == $level;
382
-	    } else return $res;
379
+		$res = $line->special_code == self::$module_number && $line->product_type == 9 && $line->qty >= 90;
380
+		if($res && $level > -1) {
381
+			return self::getNiveau($line) == $level;
382
+		} else return $res;
383 383
 	}
384 384
 	
385 385
 	public static function isFreeText(&$line)
@@ -416,29 +416,29 @@  discard block
 block discarded – undo
416 416
 		$createRight = $user->rights->{$object->element}->creer;
417 417
 		if($object->element == 'facturerec' )
418 418
 		{
419
-		    $object->statut = 0; // hack for facture rec
420
-		    $createRight = $user->rights->facture->creer;
419
+			$object->statut = 0; // hack for facture rec
420
+			$createRight = $user->rights->facture->creer;
421 421
 		}
422 422
 		elseif($object->element == 'order_supplier' )
423 423
 		{
424
-		    $createRight = $user->rights->fournisseur->commande->creer;
424
+			$createRight = $user->rights->fournisseur->commande->creer;
425 425
 		}
426 426
 		elseif($object->element == 'invoice_supplier' )
427 427
 		{
428
-		    $createRight = $user->rights->fournisseur->facture->creer;
428
+			$createRight = $user->rights->fournisseur->facture->creer;
429 429
 		}
430 430
 		
431 431
 		if ($object->statut == 0  && $createRight && (!empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK) || !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_LINE)))
432 432
 		{
433 433
 			dol_include_once('/subtotal/lib/subtotal.lib.php');
434 434
 
435
-            if(!empty($object->lines)) {
436
-                foreach($object->lines as $line) {
437
-                    if($line->id == $lineid) $duplicateLine = $line;
438
-                }
439
-            }
440
-            if(!empty($duplicateLine) && !self::isModSubtotalLine($duplicateLine)) $TLine = array($duplicateLine);
441
-            else $TLine = self::getLinesFromTitleId($object, $lineid, $withBlockLine);
435
+			if(!empty($object->lines)) {
436
+				foreach($object->lines as $line) {
437
+					if($line->id == $lineid) $duplicateLine = $line;
438
+				}
439
+			}
440
+			if(!empty($duplicateLine) && !self::isModSubtotalLine($duplicateLine)) $TLine = array($duplicateLine);
441
+			else $TLine = self::getLinesFromTitleId($object, $lineid, $withBlockLine);
442 442
 
443 443
 			if (!empty($TLine))
444 444
 			{
@@ -456,8 +456,8 @@  discard block
 block discarded – undo
456 456
 							break;
457 457
 							
458 458
 						case 'supplier_proposal':
459
-						    $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, $object->element, $line->id);
460
-						    break;
459
+							$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, $object->element, $line->id);
460
+							break;
461 461
 							
462 462
 						case 'commande':
463 463
 							//$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)
@@ -465,12 +465,12 @@  discard block
 block discarded – undo
465 465
 							break;
466 466
 							
467 467
 						case 'order_supplier':
468
-						    $object->line = $line;
469
-						    $object->line->origin = $object->element;
470
-						    $object->line->origin_id = $line->id;
471
-						    $object->line->fk_commande = $object->id;
472
-						    $object->line->rang = $object->line_max() +1;
473
-						    $res = $object->line->insert(1);
468
+							$object->line = $line;
469
+							$object->line->origin = $object->element;
470
+							$object->line->origin_id = $line->id;
471
+							$object->line->fk_commande = $object->id;
472
+							$object->line->rang = $object->line_max() +1;
473
+							$res = $object->line->insert(1);
474 474
 							break;
475 475
 							
476 476
 						case 'facture':
@@ -523,8 +523,8 @@  discard block
 block discarded – undo
523 523
 					$object->db->commit();
524 524
 					foreach ($TLineAdded as &$line)
525 525
 					{
526
-					    // ç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
527
-					    _updateLineNC($object->element, $object->id, $line->id, $line->array_options['options_subtotal_nc']);
526
+						// ç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
527
+						_updateLineNC($object->element, $object->id, $line->id, $line->array_options['options_subtotal_nc']);
528 528
 					}
529 529
 					return count($TLineAdded);
530 530
 				}
@@ -598,33 +598,33 @@  discard block
 block discarded – undo
598 598
 		
599 599
 		switch ($object->element) 
600 600
 		{
601
-		    case 'propal':
602
-		        $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, 0, $notrigger);
603
-		        break;
601
+			case 'propal':
602
+				$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, 0, $notrigger);
603
+				break;
604 604
 		        
605
-		    case 'supplier_proposal':
606
-		        $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);
607
-		        break;
605
+			case 'supplier_proposal':
606
+				$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);
607
+				break;
608 608
 		        
609 609
 			case 'commande':
610 610
 				$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, 0, $notrigger);
611 611
 				break;
612 612
 				
613 613
 			case 'order_supplier':
614
-			    $object->special_code = SELF::$module_number;
615
-			    if (empty($desc)) $desc = $label;
616
-			    $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);
617
-			    break;
614
+				$object->special_code = SELF::$module_number;
615
+				if (empty($desc)) $desc = $label;
616
+				$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);
617
+				break;
618 618
 			
619 619
 			case 'facture':
620 620
 				$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, 0, $notrigger);
621 621
 				break;
622 622
 				
623 623
 			case 'invoice_supplier':
624
-			    $object->special_code = SELF::$module_number;
625
-			    if (empty($desc)) $desc = $label;
626
-			    $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);
627
-			    break;
624
+				$object->special_code = SELF::$module_number;
625
+				if (empty($desc)) $desc = $label;
626
+				$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);
627
+				break;
628 628
 				
629 629
 			case 'facturerec':
630 630
 				// Add extrafields and get rang
@@ -1015,8 +1015,8 @@  discard block
 block discarded – undo
1015 1015
 		{
1016 1016
 			if (is_readable($logo))
1017 1017
 			{
1018
-			    $height=pdf_getHeightForLogo($logo);
1019
-			    $pdf->Image($logo, $objmarge->marge_gauche, $posy, 0, $height);	// width=0 (auto)
1018
+				$height=pdf_getHeightForLogo($logo);
1019
+				$pdf->Image($logo, $objmarge->marge_gauche, $posy, 0, $height);	// width=0 (auto)
1020 1020
 			}
1021 1021
 			else
1022 1022
 			{
@@ -1207,13 +1207,13 @@  discard block
 block discarded – undo
1207 1207
 	 * @param	int		$hidebottom		Hide bottom
1208 1208
 	 * @return	void
1209 1209
 	 */
1210
-    private static function printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0)
1211
-    {
1212
-	    if (empty($hidetop) || $hidetop==-1) $pdf->line($x, $y, $x+$l, $y);
1213
-	    $pdf->line($x+$l, $y, $x+$l, $y+$h);
1214
-	    if (empty($hidebottom)) $pdf->line($x+$l, $y+$h, $x, $y+$h);
1215
-	    $pdf->line($x, $y+$h, $x, $y);
1216
-    }
1210
+	private static function printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0)
1211
+	{
1212
+		if (empty($hidetop) || $hidetop==-1) $pdf->line($x, $y, $x+$l, $y);
1213
+		$pdf->line($x+$l, $y, $x+$l, $y+$h);
1214
+		if (empty($hidebottom)) $pdf->line($x+$l, $y+$h, $x, $y+$h);
1215
+		$pdf->line($x, $y+$h, $x, $y);
1216
+	}
1217 1217
 	
1218 1218
 	
1219 1219
 	public static function concat(&$outputlangs, $files, $fileoutput='')
@@ -1223,14 +1223,14 @@  discard block
 block discarded – undo
1223 1223
 		if (empty($fileoutput)) $fileoutput = $file[0];
1224 1224
 		
1225 1225
 		$pdf=pdf_getInstance();
1226
-        if (class_exists('TCPDF'))
1227
-        {
1228
-            $pdf->setPrintHeader(false);
1229
-            $pdf->setPrintFooter(false);
1230
-        }
1231
-        $pdf->SetFont(pdf_getPDFFont($outputlangs));
1226
+		if (class_exists('TCPDF'))
1227
+		{
1228
+			$pdf->setPrintHeader(false);
1229
+			$pdf->setPrintFooter(false);
1230
+		}
1231
+		$pdf->SetFont(pdf_getPDFFont($outputlangs));
1232 1232
 
1233
-        if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
1233
+		if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
1234 1234
 
1235 1235
 		
1236 1236
 		foreach($files as $file)
Please login to merge, or discard this patch.