Passed
Push — master ( 5adaa9...b51057 )
by
unknown
02:40
created
core/modules/propale/doc/pdf_azur_subtotal.modules.php 3 patches
Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -128,15 +128,15 @@  discard block
 block discarded – undo
128 128
 	}
129 129
 
130 130
 	/**
131
-     *  Function to build pdf onto disk
132
-     *
133
-     *  @param		Object		$object				Object to generate
134
-     *  @param		Translate	$outputlangs		Lang output object
135
-     *  @param		string		$srctemplatepath	Full path of source filename for generator using a template file
136
-     *  @param		int			$hidedetails		Do not show line details
137
-     *  @param		int			$hidedesc			Do not show desc
138
-     *  @param		int			$hideref			Do not show ref
139
-     *  @return     int             				1=OK, 0=KO
131
+	 *  Function to build pdf onto disk
132
+	 *
133
+	 *  @param		Object		$object				Object to generate
134
+	 *  @param		Translate	$outputlangs		Lang output object
135
+	 *  @param		string		$srctemplatepath	Full path of source filename for generator using a template file
136
+	 *  @param		int			$hidedetails		Do not show line details
137
+	 *  @param		int			$hidedesc			Do not show desc
138
+	 *  @param		int			$hideref			Do not show ref
139
+	 *  @return     int             				1=OK, 0=KO
140 140
 	 */
141 141
 	function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0)
142 142
 	{
@@ -259,25 +259,25 @@  discard block
 block discarded – undo
259 259
 				$reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action);    // Note that $action and $object may have been modified by some hooks
260 260
 
261 261
 				// Create pdf instance
262
-                $pdf=pdf_getInstance($this->format);
263
-                $default_font_size = pdf_getPDFFontSize($outputlangs);	// Must be after pdf_getInstance
264
-                $heightforinfotot = 50;	// Height reserved to output the info and total part
265
-		        $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
266
-	            $heightforfooter = $this->marge_basse + 8;	// Height reserved to output the footer (value include bottom margin)
267
-                $pdf->SetAutoPageBreak(1,0);
268
-
269
-                if (class_exists('TCPDF'))
270
-                {
271
-                    $pdf->setPrintHeader(false);
272
-                    $pdf->setPrintFooter(false);
273
-                }
274
-                $pdf->SetFont(pdf_getPDFFont($outputlangs));
275
-                // Set path to the background PDF File
276
-                if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
277
-                {
278
-                    $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
279
-                    $tplidx = $pdf->importPage(1);
280
-                }
262
+				$pdf=pdf_getInstance($this->format);
263
+				$default_font_size = pdf_getPDFFontSize($outputlangs);	// Must be after pdf_getInstance
264
+				$heightforinfotot = 50;	// Height reserved to output the info and total part
265
+				$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
266
+				$heightforfooter = $this->marge_basse + 8;	// Height reserved to output the footer (value include bottom margin)
267
+				$pdf->SetAutoPageBreak(1,0);
268
+
269
+				if (class_exists('TCPDF'))
270
+				{
271
+					$pdf->setPrintHeader(false);
272
+					$pdf->setPrintFooter(false);
273
+				}
274
+				$pdf->SetFont(pdf_getPDFFont($outputlangs));
275
+				// Set path to the background PDF File
276
+				if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
277
+				{
278
+					$pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
279
+					$tplidx = $pdf->importPage(1);
280
+				}
281 281
 
282 282
 				$pdf->Open();
283 283
 				$pagenb=0;
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
 						$localtax2_type = $localtaxtmp_array[2];
613 613
 					}
614 614
 
615
-				    // retrieve global local tax
615
+					// retrieve global local tax
616 616
 					if ($localtax1_type && $localtax1ligne != 0)
617 617
 						$this->localtax1[$localtax1_type][$localtax1_rate]+=$localtax1ligne;
618 618
 					if ($localtax2_type && $localtax2ligne != 0)
@@ -750,11 +750,11 @@  discard block
 block discarded – undo
750 750
 	/**
751 751
 	 *  Show payments table
752 752
 	 *
753
-     *  @param	PDF			$pdf           Object PDF
754
-     *  @param  Object		$object         Object proposal
755
-     *  @param  int			$posy           Position y in PDF
756
-     *  @param  Translate	$outputlangs    Object langs for output
757
-     *  @return int             			<0 if KO, >0 if OK
753
+	 *  @param	PDF			$pdf           Object PDF
754
+	 *  @param  Object		$object         Object proposal
755
+	 *  @param  int			$posy           Position y in PDF
756
+	 *  @param  Translate	$outputlangs    Object langs for output
757
+	 *  @return int             			<0 if KO, >0 if OK
758 758
 	 */
759 759
 	function _tableau_versements(&$pdf, $object, $posy, $outputlangs)
760 760
 	{
@@ -790,10 +790,10 @@  discard block
 block discarded – undo
790 790
 
791 791
 		$posxval=52;
792 792
 
793
-        // Show shipping date
794
-        if (! empty($object->date_livraison))
793
+		// Show shipping date
794
+		if (! empty($object->date_livraison))
795 795
 		{
796
-            $outputlangs->load("sendings");
796
+			$outputlangs->load("sendings");
797 797
 			$pdf->SetFont('','B', $default_font_size - 2);
798 798
 			$pdf->SetXY($this->marge_gauche, $posy);
799 799
 			$titre = $outputlangs->transnoentities("DateDeliveryPlanned").':';
@@ -803,9 +803,9 @@  discard block
 block discarded – undo
803 803
 			$dlp=dol_print_date($object->date_livraison,"daytext",false,$outputlangs,true);
804 804
 			$pdf->MultiCell(80, 4, $dlp, 0, 'L');
805 805
 
806
-            $posy=$pdf->GetY()+1;
806
+			$posy=$pdf->GetY()+1;
807 807
 		}
808
-        elseif ($object->availability_code || $object->availability)    // Show availability conditions
808
+		elseif ($object->availability_code || $object->availability)    // Show availability conditions
809 809
 		{
810 810
 			$pdf->SetFont('','B', $default_font_size - 2);
811 811
 			$pdf->SetXY($this->marge_gauche, $posy);
@@ -891,13 +891,13 @@  discard block
 block discarded – undo
891 891
 						$pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo',$account->proprio),0,'L',0);
892 892
 						$posy=$pdf->GetY()+1;
893 893
 
894
-			            if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS))
895
-			            {
894
+						if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS))
895
+						{
896 896
 							$pdf->SetXY($this->marge_gauche, $posy);
897 897
 							$pdf->SetFont('','', $default_font_size - $diffsizetitle);
898 898
 							$pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($account->owner_address), 0, 'L', 0);
899 899
 							$posy=$pdf->GetY()+2;
900
-			            }
900
+						}
901 901
 					}
902 902
 					if ($conf->global->FACTURE_CHQ_NUMBER == -1)
903 903
 					{
@@ -906,13 +906,13 @@  discard block
 block discarded – undo
906 906
 						$pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo',$this->emetteur->name),0,'L',0);
907 907
 						$posy=$pdf->GetY()+1;
908 908
 
909
-			            if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS))
910
-			            {
909
+						if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS))
910
+						{
911 911
 							$pdf->SetXY($this->marge_gauche, $posy);
912 912
 							$pdf->SetFont('','', $default_font_size - $diffsizetitle);
913 913
 							$pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0, 'L', 0);
914 914
 							$posy=$pdf->GetY()+2;
915
-			            }
915
+						}
916 916
 					}
917 917
 				}
918 918
 			}
@@ -1022,7 +1022,7 @@  discard block
 block discarded – undo
1022 1022
 							}
1023 1023
 						}
1024 1024
 					}
1025
-	      		//}
1025
+		  		//}
1026 1026
 				//Local tax 2 before VAT
1027 1027
 				//if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on')
1028 1028
 				//{
@@ -1114,7 +1114,7 @@  discard block
 block discarded – undo
1114 1114
 							}
1115 1115
 						}
1116 1116
 					}
1117
-	      		//}
1117
+		  		//}
1118 1118
 				//Local tax 2 after VAT
1119 1119
 				//if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on')
1120 1120
 				//{
@@ -1124,7 +1124,7 @@  discard block
 block discarded – undo
1124 1124
 
1125 1125
 						foreach( $localtax_rate as $tvakey => $tvaval )
1126 1126
 						{
1127
-						    // retrieve global local tax
1127
+							// retrieve global local tax
1128 1128
 							if ($tvakey != 0)    // On affiche pas taux 0
1129 1129
 							{
1130 1130
 								//$this->atleastoneratenotnull++;
@@ -1341,7 +1341,7 @@  discard block
 block discarded – undo
1341 1341
 		//  Show Draft Watermark
1342 1342
 		if($object->statut==0 && (! empty($conf->global->PROPALE_DRAFT_WATERMARK)) )
1343 1343
 		{
1344
-            pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->PROPALE_DRAFT_WATERMARK);
1344
+			pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->PROPALE_DRAFT_WATERMARK);
1345 1345
 		}
1346 1346
 
1347 1347
 		$pdf->SetTextColor(0,0,60);
@@ -1358,8 +1358,8 @@  discard block
 block discarded – undo
1358 1358
 		{
1359 1359
 			if (is_readable($logo))
1360 1360
 			{
1361
-			    $height=pdf_getHeightForLogo($logo);
1362
-			    $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);	// width=0 (auto)
1361
+				$height=pdf_getHeightForLogo($logo);
1362
+				$pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);	// width=0 (auto)
1363 1363
 			}
1364 1364
 			else
1365 1365
 			{
@@ -1517,7 +1517,7 @@  discard block
 block discarded – undo
1517 1517
 
1518 1518
 	/**
1519 1519
 	 *   	Show footer of page. Need this->emetteur object
1520
-     *
1520
+	 *
1521 1521
 	 *   	@param	PDF			$pdf     			PDF
1522 1522
 	 * 		@param	Object		$object				Object to show
1523 1523
 	 *      @param	Translate	$outputlangs		Object lang for output
Please login to merge, or discard this patch.
Spacing   +417 added lines, -417 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 	var $description;
43 43
 	var $type;
44 44
 
45
-	var $phpmin = array(4,3,0); // Minimum version of PHP required by module
45
+	var $phpmin = array(4, 3, 0); // Minimum version of PHP required by module
46 46
 	var $version = 'dolibarr';
47 47
 
48 48
 	var $page_largeur;
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	var	$marge_haute;
54 54
 	var	$marge_basse;
55 55
 
56
-	var $emetteur;	// Objet societe qui emet
56
+	var $emetteur; // Objet societe qui emet
57 57
 
58 58
 
59 59
 	/**
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 */
64 64
 	function __construct($db)
65 65
 	{
66
-		global $conf,$langs,$mysoc;
66
+		global $conf, $langs, $mysoc;
67 67
 
68 68
 		$langs->load("main");
69 69
 		$langs->load("bills");
@@ -75,56 +75,56 @@  discard block
 block discarded – undo
75 75
 
76 76
 		// Dimension page pour format A4
77 77
 		$this->type = 'pdf';
78
-		$formatarray=pdf_getFormat();
78
+		$formatarray = pdf_getFormat();
79 79
 		$this->page_largeur = $formatarray['width'];
80 80
 		$this->page_hauteur = $formatarray['height'];
81
-		$this->format = array($this->page_largeur,$this->page_hauteur);
82
-		$this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10;
83
-		$this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10;
84
-		$this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10;
85
-		$this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10;
86
-
87
-		$this->option_logo = 1;                    // Affiche logo
88
-		$this->option_tva = 1;                     // Gere option tva FACTURE_TVAOPTION
89
-		$this->option_modereg = 1;                 // Affiche mode reglement
90
-		$this->option_condreg = 1;                 // Affiche conditions reglement
91
-		$this->option_codeproduitservice = 1;      // Affiche code produit-service
92
-		$this->option_multilang = 1;               // Dispo en plusieurs langues
93
-		$this->option_escompte = 1;                // Affiche si il y a eu escompte
94
-		$this->option_credit_note = 1;             // Support credit notes
95
-		$this->option_freetext = 1;				   // Support add of a personalised text
96
-		$this->option_draft_watermark = 1;		   //Support add of a watermark on drafts
97
-
98
-		$this->franchise=!$mysoc->tva_assuj;
81
+		$this->format = array($this->page_largeur, $this->page_hauteur);
82
+		$this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10;
83
+		$this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10;
84
+		$this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10;
85
+		$this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10;
86
+
87
+		$this->option_logo = 1; // Affiche logo
88
+		$this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION
89
+		$this->option_modereg = 1; // Affiche mode reglement
90
+		$this->option_condreg = 1; // Affiche conditions reglement
91
+		$this->option_codeproduitservice = 1; // Affiche code produit-service
92
+		$this->option_multilang = 1; // Dispo en plusieurs langues
93
+		$this->option_escompte = 1; // Affiche si il y a eu escompte
94
+		$this->option_credit_note = 1; // Support credit notes
95
+		$this->option_freetext = 1; // Support add of a personalised text
96
+		$this->option_draft_watermark = 1; //Support add of a watermark on drafts
97
+
98
+		$this->franchise = !$mysoc->tva_assuj;
99 99
 
100 100
 		// Get source company
101
-		$this->emetteur=$mysoc;
102
-		if (empty($this->emetteur->country_code)) $this->emetteur->country_code=substr($langs->defaultlang,-2);    // By default, if was not defined
101
+		$this->emetteur = $mysoc;
102
+		if (empty($this->emetteur->country_code)) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default, if was not defined
103 103
 
104 104
 		// Define position of columns
105
-		$this->posxdesc=$this->marge_gauche+1;
106
-		$this->posxtva=112;
107
-		$this->posxup=126;
108
-		$this->posxqty=145;
109
-		$this->posxdiscount=162;
110
-		$this->postotalht=174;
111
-		if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva=$this->posxup;
112
-		$this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH);	// width of images
105
+		$this->posxdesc = $this->marge_gauche + 1;
106
+		$this->posxtva = 112;
107
+		$this->posxup = 126;
108
+		$this->posxqty = 145;
109
+		$this->posxdiscount = 162;
110
+		$this->postotalht = 174;
111
+		if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva = $this->posxup;
112
+		$this->posxpicture = $this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images
113 113
 		if ($this->page_largeur < 210) // To work with US executive format
114 114
 		{
115
-			$this->posxpicture-=20;
116
-			$this->posxtva-=20;
117
-			$this->posxup-=20;
118
-			$this->posxqty-=20;
119
-			$this->posxdiscount-=20;
120
-			$this->postotalht-=20;
115
+			$this->posxpicture -= 20;
116
+			$this->posxtva -= 20;
117
+			$this->posxup -= 20;
118
+			$this->posxqty -= 20;
119
+			$this->posxdiscount -= 20;
120
+			$this->postotalht -= 20;
121 121
 		}
122 122
 
123
-		$this->tva=array();
124
-		$this->localtax1=array();
125
-		$this->localtax2=array();
126
-		$this->atleastoneratenotnull=0;
127
-		$this->atleastonediscount=0;
123
+		$this->tva = array();
124
+		$this->localtax1 = array();
125
+		$this->localtax2 = array();
126
+		$this->atleastoneratenotnull = 0;
127
+		$this->atleastonediscount = 0;
128 128
 	}
129 129
 
130 130
 	/**
@@ -138,13 +138,13 @@  discard block
 block discarded – undo
138 138
      *  @param		int			$hideref			Do not show ref
139 139
      *  @return     int             				1=OK, 0=KO
140 140
 	 */
141
-	function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0)
141
+	function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
142 142
 	{
143
-		global $user,$langs,$conf,$mysoc,$db,$hookmanager;
143
+		global $user, $langs, $conf, $mysoc, $db, $hookmanager;
144 144
 
145
-		if (! is_object($outputlangs)) $outputlangs=$langs;
145
+		if (!is_object($outputlangs)) $outputlangs = $langs;
146 146
 		// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
147
-		if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
147
+		if (!empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output = 'ISO-8859-1';
148 148
 
149 149
 		$outputlangs->load("main");
150 150
 		$outputlangs->load("dict");
@@ -156,51 +156,51 @@  discard block
 block discarded – undo
156 156
 		$nblignes = count($object->lines);
157 157
 
158 158
 		// Loop on each lines to detect if there is at least one image to show
159
-		$realpatharray=array();
160
-		if (! empty($conf->global->MAIN_GENERATE_PROPOSALS_WITH_PICTURE))
159
+		$realpatharray = array();
160
+		if (!empty($conf->global->MAIN_GENERATE_PROPOSALS_WITH_PICTURE))
161 161
 		{
162 162
 			$objphoto = new Product($this->db);
163 163
 
164
-			for ($i = 0 ; $i < $nblignes ; $i++)
164
+			for ($i = 0; $i < $nblignes; $i++)
165 165
 			{
166 166
 				if (empty($object->lines[$i]->fk_product)) continue;
167 167
 
168 168
 				$objphoto->fetch($object->lines[$i]->fk_product);
169 169
 
170
-				if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO))
170
+				if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO))
171 171
 				{
172
-					$pdir[0] = get_exdir($objphoto->id,2) . $objphoto->id ."/photos/";
172
+					$pdir[0] = get_exdir($objphoto->id, 2).$objphoto->id."/photos/";
173 173
 					$pdir[1] = dol_sanitizeFileName($objphoto->ref).'/';
174 174
 				}
175 175
 				else
176 176
 				{
177 177
 					$pdir[0] = dol_sanitizeFileName($objphoto->ref).'/';
178
-					$pdir[1] = get_exdir($objphoto->id,2) . $objphoto->id ."/photos/";
178
+					$pdir[1] = get_exdir($objphoto->id, 2).$objphoto->id."/photos/";
179 179
 				}
180 180
 
181 181
 				$arephoto = false;
182 182
 				foreach ($pdir as $midir)
183 183
 				{
184
-					if (! $arephoto)
184
+					if (!$arephoto)
185 185
 					{
186 186
 						$dir = $conf->product->dir_output.'/'.$midir;
187 187
 
188
-						foreach ($objphoto->liste_photos($dir,1) as $key => $obj)
188
+						foreach ($objphoto->liste_photos($dir, 1) as $key => $obj)
189 189
 						{
190 190
 							if (empty($conf->global->CAT_HIGH_QUALITY_IMAGES))		// If CAT_HIGH_QUALITY_IMAGES not defined, we use thumb if defined and then original photo
191 191
 							{
192 192
 								if ($obj['photo_vignette'])
193 193
 								{
194
-									$filename= $obj['photo_vignette'];
194
+									$filename = $obj['photo_vignette'];
195 195
 								}
196 196
 								else
197 197
 								{
198
-									$filename=$obj['photo'];
198
+									$filename = $obj['photo'];
199 199
 								}
200 200
 							}
201 201
 							else
202 202
 							{
203
-								$filename=$obj['photo'];
203
+								$filename = $obj['photo'];
204 204
 							}
205 205
 
206 206
 							$realpath = $dir.$filename;
@@ -209,16 +209,16 @@  discard block
 block discarded – undo
209 209
 					}
210 210
 				}
211 211
 
212
-				if ($realpath && $arephoto) $realpatharray[$i]=$realpath;
212
+				if ($realpath && $arephoto) $realpatharray[$i] = $realpath;
213 213
 			}
214 214
 		}
215 215
 
216
-		if (count($realpatharray) == 0) $this->posxpicture=$this->posxtva;
216
+		if (count($realpatharray) == 0) $this->posxpicture = $this->posxtva;
217 217
 
218 218
 		if ($conf->propal->dir_output)
219 219
 		{
220 220
 			$object->fetch_thirdparty();
221
-			if(!empty($object->client) ){
221
+			if (!empty($object->client)) {
222 222
 				$object->thirdparty = $object->client;
223 223
 			}
224 224
 			// $deja_regle = 0;
@@ -227,20 +227,20 @@  discard block
 block discarded – undo
227 227
 			if ($object->specimen)
228 228
 			{
229 229
 				$dir = $conf->propal->dir_output;
230
-				$file = $dir . "/SPECIMEN.pdf";
230
+				$file = $dir."/SPECIMEN.pdf";
231 231
 			}
232 232
 			else
233 233
 			{
234 234
 				$objectref = dol_sanitizeFileName($object->ref);
235
-				$dir = $conf->propal->dir_output . "/" . $objectref;
236
-				$file = $dir . "/" . $objectref . ".pdf";
235
+				$dir = $conf->propal->dir_output."/".$objectref;
236
+				$file = $dir."/".$objectref.".pdf";
237 237
 			}
238 238
 
239
-			if (! file_exists($dir))
239
+			if (!file_exists($dir))
240 240
 			{
241 241
 				if (dol_mkdir($dir) < 0)
242 242
 				{
243
-					$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
243
+					$this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
244 244
 					return 0;
245 245
 				}
246 246
 			}
@@ -248,23 +248,23 @@  discard block
 block discarded – undo
248 248
 			if (file_exists($dir))
249 249
 			{
250 250
 				// Add pdfgeneration hook
251
-				if (! is_object($hookmanager))
251
+				if (!is_object($hookmanager))
252 252
 				{
253 253
 					include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
254
-					$hookmanager=new HookManager($this->db);
254
+					$hookmanager = new HookManager($this->db);
255 255
 				}
256 256
 				$hookmanager->initHooks(array('pdfgeneration'));
257
-				$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
257
+				$parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs);
258 258
 				global $action;
259
-				$reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action);    // Note that $action and $object may have been modified by some hooks
259
+				$reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
260 260
 
261 261
 				// Create pdf instance
262
-                $pdf=pdf_getInstance($this->format);
263
-                $default_font_size = pdf_getPDFFontSize($outputlangs);	// Must be after pdf_getInstance
264
-                $heightforinfotot = 50;	// Height reserved to output the info and total part
265
-		        $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
266
-	            $heightforfooter = $this->marge_basse + 8;	// Height reserved to output the footer (value include bottom margin)
267
-                $pdf->SetAutoPageBreak(1,0);
262
+                $pdf = pdf_getInstance($this->format);
263
+                $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
264
+                $heightforinfotot = 50; // Height reserved to output the info and total part
265
+		        $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
266
+	            $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
267
+                $pdf->SetAutoPageBreak(1, 0);
268 268
 
269 269
                 if (class_exists('TCPDF'))
270 270
                 {
@@ -273,27 +273,27 @@  discard block
 block discarded – undo
273 273
                 }
274 274
                 $pdf->SetFont(pdf_getPDFFont($outputlangs));
275 275
                 // Set path to the background PDF File
276
-                if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
276
+                if (empty($conf->global->MAIN_DISABLE_FPDI) && !empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
277 277
                 {
278 278
                     $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
279 279
                     $tplidx = $pdf->importPage(1);
280 280
                 }
281 281
 
282 282
 				$pdf->Open();
283
-				$pagenb=0;
284
-				$pdf->SetDrawColor(128,128,128);
283
+				$pagenb = 0;
284
+				$pdf->SetDrawColor(128, 128, 128);
285 285
 
286 286
 				$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
287 287
 				$pdf->SetSubject($outputlangs->transnoentities("CommercialProposal"));
288 288
 				$pdf->SetCreator("Dolibarr ".DOL_VERSION);
289 289
 				$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
290 290
 				$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("CommercialProposal"));
291
-				if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
291
+				if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
292 292
 
293
-				$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);   // Left, Top, Right
293
+				$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
294 294
 
295 295
 				// Positionne $this->atleastonediscount si on a au moins une remise
296
-				for ($i = 0 ; $i < $nblignes ; $i++)
296
+				for ($i = 0; $i < $nblignes; $i++)
297 297
 				{
298 298
 					if ($object->lines[$i]->remise_percent)
299 299
 					{
@@ -302,60 +302,60 @@  discard block
 block discarded – undo
302 302
 				}
303 303
 				if (empty($this->atleastonediscount))
304 304
 				{
305
-					$this->posxpicture+=($this->postotalht - $this->posxdiscount);
306
-					$this->posxtva+=($this->postotalht - $this->posxdiscount);
307
-					$this->posxup+=($this->postotalht - $this->posxdiscount);
308
-					$this->posxqty+=($this->postotalht - $this->posxdiscount);
309
-					$this->posxdiscount+=($this->postotalht - $this->posxdiscount);
305
+					$this->posxpicture += ($this->postotalht - $this->posxdiscount);
306
+					$this->posxtva += ($this->postotalht - $this->posxdiscount);
307
+					$this->posxup += ($this->postotalht - $this->posxdiscount);
308
+					$this->posxqty += ($this->postotalht - $this->posxdiscount);
309
+					$this->posxdiscount += ($this->postotalht - $this->posxdiscount);
310 310
 					//$this->postotalht;
311 311
 				}
312 312
 
313 313
 				// New page
314 314
 				$pdf->AddPage();
315
-				if (! empty($tplidx)) $pdf->useTemplate($tplidx);
315
+				if (!empty($tplidx)) $pdf->useTemplate($tplidx);
316 316
 				$pagenb++;
317 317
 				$this->_pagehead($pdf, $object, 1, $outputlangs);
318
-				$pdf->SetFont('','', $default_font_size - 1);
319
-				$pdf->MultiCell(0, 3, '');		// Set interline to 3
320
-				$pdf->SetTextColor(0,0,0);
318
+				$pdf->SetFont('', '', $default_font_size - 1);
319
+				$pdf->MultiCell(0, 3, ''); // Set interline to 3
320
+				$pdf->SetTextColor(0, 0, 0);
321 321
 
322 322
 				$tab_top = 90;
323
-				$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10);
323
+				$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 : 10);
324 324
 				$tab_height = 130;
325 325
 				$tab_height_newpage = 150;
326 326
 
327 327
 				// Affiche notes
328
-				$notetoshow=empty($object->note_public)?'':$object->note_public;
329
-				if (! empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE))
328
+				$notetoshow = empty($object->note_public) ? '' : $object->note_public;
329
+				if (!empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE))
330 330
 				{
331 331
 					// Get first sale rep
332 332
 					if (is_object($object->thirdparty))
333 333
 					{
334
-						$salereparray=$object->thirdparty->getSalesRepresentatives($user);
335
-						$salerepobj=new User($this->db);
334
+						$salereparray = $object->thirdparty->getSalesRepresentatives($user);
335
+						$salerepobj = new User($this->db);
336 336
 						$salerepobj->fetch($salereparray[0]['id']);
337
-						if (! empty($salerepobj->signature)) $notetoshow=dol_concatdesc($notetoshow, $salerepobj->signature);
337
+						if (!empty($salerepobj->signature)) $notetoshow = dol_concatdesc($notetoshow, $salerepobj->signature);
338 338
 					}
339 339
 				}
340 340
 				if ($notetoshow)
341 341
 				{
342 342
 					$tab_top = 88;
343 343
 
344
-					$pdf->SetFont('','', $default_font_size - 1);
345
-					$pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1);
344
+					$pdf->SetFont('', '', $default_font_size - 1);
345
+					$pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1);
346 346
 					$nexY = $pdf->GetY();
347
-					$height_note=$nexY-$tab_top;
347
+					$height_note = $nexY - $tab_top;
348 348
 
349 349
 					// Rect prend une longueur en 3eme param
350
-					$pdf->SetDrawColor(192,192,192);
351
-					$pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+1);
350
+					$pdf->SetDrawColor(192, 192, 192);
351
+					$pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1);
352 352
 
353 353
 					$tab_height = $tab_height - $height_note;
354
-					$tab_top = $nexY+6;
354
+					$tab_top = $nexY + 6;
355 355
 				}
356 356
 				else
357 357
 				{
358
-					$height_note=0;
358
+					$height_note = 0;
359 359
 				}
360 360
 
361 361
 				$iniY = $tab_top + 7;
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 				$TStack = array();
370 370
 				
371 371
 				// Loop on each lines
372
-				for ($i = 0 ; $i < $nblignes ; $i++)
372
+				for ($i = 0; $i < $nblignes; $i++)
373 373
 				{
374 374
 					$package_qty = $TStack[count($TStack) - 1]['package_qty'];
375 375
 					$inPackage = count($TStack) > 0;
@@ -433,94 +433,94 @@  discard block
 block discarded – undo
433 433
 					}
434 434
 					
435 435
 					$curY = $nexY;
436
-					$pdf->SetFont('','', $default_font_size - 1);   // Into loop to work with multipage
437
-					$pdf->SetTextColor(0,0,0);
436
+					$pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage
437
+					$pdf->SetTextColor(0, 0, 0);
438 438
 
439 439
 					// Define size of image if we need it
440
-					$imglinesize=array();
441
-					if (! empty($realpatharray[$i])) $imglinesize=pdf_getSizeForImage($realpatharray[$i]);
440
+					$imglinesize = array();
441
+					if (!empty($realpatharray[$i])) $imglinesize = pdf_getSizeForImage($realpatharray[$i]);
442 442
 
443 443
 					$pdf->setTopMargin($tab_top_newpage);
444
-					$pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot);	// The only function to edit the bottom margin of current page to set it.
445
-					$pageposbefore=$pdf->getPage();
444
+					$pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it.
445
+					$pageposbefore = $pdf->getPage();
446 446
 
447
-					$showpricebeforepagebreak=1;
448
-					$posYAfterImage=0;
449
-					$posYAfterDescription=0;
447
+					$showpricebeforepagebreak = 1;
448
+					$posYAfterImage = 0;
449
+					$posYAfterDescription = 0;
450 450
 
451 451
 					// We start with Photo of product line
452
-					if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur-($heightforfooter+$heightforfreetext+$heightforinfotot)))	// If photo too high, we moved completely on new page
452
+					if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot)))	// If photo too high, we moved completely on new page
453 453
 					{
454
-						$pdf->AddPage('','',true);
455
-						if (! empty($tplidx)) $pdf->useTemplate($tplidx);
454
+						$pdf->AddPage('', '', true);
455
+						if (!empty($tplidx)) $pdf->useTemplate($tplidx);
456 456
 						if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
457
-						$pdf->setPage($pageposbefore+1);
457
+						$pdf->setPage($pageposbefore + 1);
458 458
 
459 459
 						$curY = $tab_top_newpage;
460
-						$showpricebeforepagebreak=0;
460
+						$showpricebeforepagebreak = 0;
461 461
 					}
462 462
 
463 463
 					if (isset($imglinesize['width']) && isset($imglinesize['height']))
464 464
 					{
465
-						$curX = $this->posxpicture-1;
466
-						$pdf->Image($realpatharray[$i], $curX + (($this->posxtva-$this->posxpicture-$imglinesize['width'])/2), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300);	// Use 300 dpi
465
+						$curX = $this->posxpicture - 1;
466
+						$pdf->Image($realpatharray[$i], $curX + (($this->posxtva - $this->posxpicture - $imglinesize['width']) / 2), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi
467 467
 						// $pdf->Image does not increase value return by getY, so we save it manually
468
-						$posYAfterImage=$curY+$imglinesize['height'];
468
+						$posYAfterImage = $curY + $imglinesize['height'];
469 469
 					}
470 470
 
471 471
 					// Description of product line
472
-					$curX = $this->posxdesc-1;
472
+					$curX = $this->posxdesc - 1;
473 473
 
474 474
 					$pdf->startTransaction();
475
-					pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxpicture-$curX,3,$curX,$curY,$hideref,$hidedesc);
475
+					pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->posxpicture - $curX, 3, $curX, $curY, $hideref, $hidedesc);
476 476
 
477
-					$pageposafter=$pdf->getPage();
477
+					$pageposafter = $pdf->getPage();
478 478
 					if ($pageposafter > $pageposbefore)	// There is a pagebreak
479 479
 					{
480 480
 						$pdf->rollbackTransaction(true);
481
-						$pageposafter=$pageposbefore;
481
+						$pageposafter = $pageposbefore;
482 482
 						//print $pageposafter.'-'.$pageposbefore;exit;
483
-						$pdf->setPageOrientation('', 1, $heightforfooter);	// The only function to edit the bottom margin of current page to set it.
484
-						pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxpicture-$curX,3,$curX,$curY,$hideref,$hidedesc);
483
+						$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
484
+						pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->posxpicture - $curX, 3, $curX, $curY, $hideref, $hidedesc);
485 485
 
486
-						$pageposafter=$pdf->getPage();
487
-						$posyafter=$pdf->GetY();
486
+						$pageposafter = $pdf->getPage();
487
+						$posyafter = $pdf->GetY();
488 488
 						//var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit;
489
-						if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot)))	// There is no space left for total+free text
489
+						if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot)))	// There is no space left for total+free text
490 490
 						{
491
-							if ($i == ($nblignes-1))	// No more lines, and no space left to show total, so we create a new page
491
+							if ($i == ($nblignes - 1))	// No more lines, and no space left to show total, so we create a new page
492 492
 							{
493
-								$pdf->AddPage('','',true);
494
-								if (! empty($tplidx)) $pdf->useTemplate($tplidx);
493
+								$pdf->AddPage('', '', true);
494
+								if (!empty($tplidx)) $pdf->useTemplate($tplidx);
495 495
 								if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
496
-								$pdf->setPage($pageposafter+1);
496
+								$pdf->setPage($pageposafter + 1);
497 497
 							}
498 498
 						}
499 499
 						else
500 500
 						{
501 501
 							// We found a page break
502
-							$showpricebeforepagebreak=0;
502
+							$showpricebeforepagebreak = 0;
503 503
 						}
504 504
 					}
505 505
 					else	// No pagebreak
506 506
 					{
507 507
 						$pdf->commitTransaction();
508 508
 					}
509
-					$posYAfterDescription=$pdf->GetY();
509
+					$posYAfterDescription = $pdf->GetY();
510 510
 
511 511
 					$nexY = $pdf->GetY();
512
-					$pageposafter=$pdf->getPage();
512
+					$pageposafter = $pdf->getPage();
513 513
 
514 514
 					$pdf->setPage($pageposbefore);
515 515
 					$pdf->setTopMargin($this->marge_haute);
516
-					$pdf->setPageOrientation('', 1, 0);	// The only function to edit the bottom margin of current page to set it.
516
+					$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
517 517
 
518 518
 					// We suppose that a too long description or photo were moved completely on next page
519 519
 					if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
520 520
 						$pdf->setPage($pageposafter); $curY = $tab_top_newpage;
521 521
 					}
522 522
 
523
-					$pdf->SetFont('','', $default_font_size - 1);   // On repositionne la police par defaut
523
+					$pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut
524 524
 
525 525
 					// VAT Rate
526 526
 					if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
 						}
534 534
 						
535 535
 						$pdf->SetXY($this->posxtva, $curY);
536
-						$pdf->MultiCell($this->posxup-$this->posxtva-0.8, 3, $vat_rate, 0, 'R');
536
+						$pdf->MultiCell($this->posxup - $this->posxtva - 0.8, 3, $vat_rate, 0, 'R');
537 537
 					}
538 538
 
539 539
 					// Unit price before discount
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
 					}
545 545
 					
546 546
 					$pdf->SetXY($this->posxup, $curY);
547
-					$pdf->MultiCell($this->posxqty-$this->posxup-0.8, 3, $up_excl_tax, 0, 'R', 0);
547
+					$pdf->MultiCell($this->posxqty - $this->posxup - 0.8, 3, $up_excl_tax, 0, 'R', 0);
548 548
 
549 549
 					// Booléen pour déterminer s'il s'agit d'une ligne de titre ou non
550 550
 					$isTitle = false;
@@ -568,14 +568,14 @@  discard block
 block discarded – undo
568 568
 					}
569 569
 					
570 570
 					$pdf->SetXY($this->posxqty, $curY);
571
-					$pdf->MultiCell($this->posxdiscount-$this->posxqty-0.8, 3, $qty, 0, 'R');	// Enough for 6 chars
571
+					$pdf->MultiCell($this->posxdiscount - $this->posxqty - 0.8, 3, $qty, 0, 'R'); // Enough for 6 chars
572 572
 
573 573
 					// Discount on line
574 574
 					if ($object->lines[$i]->remise_percent)
575 575
 					{
576
-						$pdf->SetXY($this->posxdiscount-2, $curY);
576
+						$pdf->SetXY($this->posxdiscount - 2, $curY);
577 577
 						$remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails);
578
-						$pdf->MultiCell($this->postotalht-$this->posxdiscount+2, 3, $remise_percent, 0, 'R');
578
+						$pdf->MultiCell($this->postotalht - $this->posxdiscount + 2, 3, $remise_percent, 0, 'R');
579 579
 					}
580 580
 
581 581
 					// Total HT line
@@ -586,40 +586,40 @@  discard block
 block discarded – undo
586 586
 					}
587 587
 					
588 588
 					$pdf->SetXY($this->postotalht, $curY);
589
-					$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalht, 3, $total_excl_tax, 0, 'R', 0);
589
+					$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalht, 3, $total_excl_tax, 0, 'R', 0);
590 590
 
591 591
 					// Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva
592
-					$tvaligne=$object->lines[$i]->total_tva;
593
-					$localtax1ligne=$object->lines[$i]->total_localtax1;
594
-					$localtax2ligne=$object->lines[$i]->total_localtax2;
595
-					$localtax1_rate=$object->lines[$i]->localtax1_tx;
596
-					$localtax2_rate=$object->lines[$i]->localtax2_tx;
597
-					$localtax1_type=$object->lines[$i]->localtax1_type;
598
-					$localtax2_type=$object->lines[$i]->localtax2_type;
592
+					$tvaligne = $object->lines[$i]->total_tva;
593
+					$localtax1ligne = $object->lines[$i]->total_localtax1;
594
+					$localtax2ligne = $object->lines[$i]->total_localtax2;
595
+					$localtax1_rate = $object->lines[$i]->localtax1_tx;
596
+					$localtax2_rate = $object->lines[$i]->localtax2_tx;
597
+					$localtax1_type = $object->lines[$i]->localtax1_type;
598
+					$localtax2_type = $object->lines[$i]->localtax2_type;
599 599
 
600
-					if ($object->remise_percent) $tvaligne-=($tvaligne*$object->remise_percent)/100;
601
-					if ($object->remise_percent) $localtax1ligne-=($localtax1ligne*$object->remise_percent)/100;
602
-					if ($object->remise_percent) $localtax2ligne-=($localtax2ligne*$object->remise_percent)/100;
600
+					if ($object->remise_percent) $tvaligne -= ($tvaligne * $object->remise_percent) / 100;
601
+					if ($object->remise_percent) $localtax1ligne -= ($localtax1ligne * $object->remise_percent) / 100;
602
+					if ($object->remise_percent) $localtax2ligne -= ($localtax2ligne * $object->remise_percent) / 100;
603 603
 
604
-					$vatrate=(string) $object->lines[$i]->tva_tx;
604
+					$vatrate = (string) $object->lines[$i]->tva_tx;
605 605
 
606 606
 					// Retrieve type from database for backward compatibility with old records
607
-					if ((! isset($localtax1_type) || $localtax1_type=='' || ! isset($localtax2_type) || $localtax2_type=='') // if tax type not defined
608
-					&& (! empty($localtax1_rate) || ! empty($localtax2_rate))) // and there is local tax
607
+					if ((!isset($localtax1_type) || $localtax1_type == '' || !isset($localtax2_type) || $localtax2_type == '') // if tax type not defined
608
+					&& (!empty($localtax1_rate) || !empty($localtax2_rate))) // and there is local tax
609 609
 					{
610
-						$localtaxtmp_array=getLocalTaxesFromRate($vatrate,0,$object->thirdparty,$mysoc);
610
+						$localtaxtmp_array = getLocalTaxesFromRate($vatrate, 0, $object->thirdparty, $mysoc);
611 611
 						$localtax1_type = $localtaxtmp_array[0];
612 612
 						$localtax2_type = $localtaxtmp_array[2];
613 613
 					}
614 614
 
615 615
 				    // retrieve global local tax
616 616
 					if ($localtax1_type && $localtax1ligne != 0)
617
-						$this->localtax1[$localtax1_type][$localtax1_rate]+=$localtax1ligne;
617
+						$this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne;
618 618
 					if ($localtax2_type && $localtax2ligne != 0)
619
-						$this->localtax2[$localtax2_type][$localtax2_rate]+=$localtax2ligne;
619
+						$this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne;
620 620
 
621
-					if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*';
622
-					if (! isset($this->tva[$vatrate]))				$this->tva[$vatrate]='';
621
+					if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate .= '*';
622
+					if (!isset($this->tva[$vatrate]))				$this->tva[$vatrate] = '';
623 623
 
624 624
 					if (!empty($object->lines[$i]->TTotal_tva))
625 625
 					{
@@ -633,19 +633,19 @@  discard block
 block discarded – undo
633 633
 						$this->tva[$vatrate] += $tvaligne;
634 634
 					}
635 635
 
636
-					if ($posYAfterImage > $posYAfterDescription) $nexY=$posYAfterImage;
636
+					if ($posYAfterImage > $posYAfterDescription) $nexY = $posYAfterImage;
637 637
 
638 638
 					// Add line
639
-					if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
639
+					if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
640 640
 					{
641 641
 						$pdf->setPage($pageposafter);
642
-						$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210)));
642
+						$pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(210, 210, 210)));
643 643
 						//$pdf->SetDrawColor(190,190,200);
644
-						$pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1);
644
+						$pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1);
645 645
 						$pdf->SetLineStyle(array('dash'=>0));
646 646
 					}
647 647
 
648
-					$nexY+=2;    // Passe espace entre les lignes
648
+					$nexY += 2; // Passe espace entre les lignes
649 649
 
650 650
 					// Detect if some page were added automatically and output _tableau for past pages
651 651
 					while ($pagenb < $pageposafter)
@@ -659,13 +659,13 @@  discard block
 block discarded – undo
659 659
 						{
660 660
 							$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
661 661
 						}
662
-						$this->_pagefoot($pdf,$object,$outputlangs,1);
662
+						$this->_pagefoot($pdf, $object, $outputlangs, 1);
663 663
 						$pagenb++;
664 664
 						$pdf->setPage($pagenb);
665
-						$pdf->setPageOrientation('', 1, 0);	// The only function to edit the bottom margin of current page to set it.
665
+						$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
666 666
 						if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
667 667
 					}
668
-					if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak)
668
+					if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak)
669 669
 					{
670 670
 						if ($pagenb == 1)
671 671
 						{
@@ -675,10 +675,10 @@  discard block
 block discarded – undo
675 675
 						{
676 676
 							$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
677 677
 						}
678
-						$this->_pagefoot($pdf,$object,$outputlangs,1);
678
+						$this->_pagefoot($pdf, $object, $outputlangs, 1);
679 679
 						// New page
680 680
 						$pdf->AddPage();
681
-						if (! empty($tplidx)) $pdf->useTemplate($tplidx);
681
+						if (!empty($tplidx)) $pdf->useTemplate($tplidx);
682 682
 						$pagenb++;
683 683
 						if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
684 684
 					}
@@ -688,20 +688,20 @@  discard block
 block discarded – undo
688 688
 				if ($pagenb == 1)
689 689
 				{
690 690
 					$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
691
-					$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
691
+					$bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
692 692
 				}
693 693
 				else
694 694
 				{
695 695
 					$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
696
-					$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
696
+					$bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
697 697
 				}
698 698
 
699 699
 				// Affiche zone infos
700
-				$posy=$this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs);
700
+				$posy = $this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs);
701 701
 
702 702
 				if (!$conf->global->SUBTOTAL_HIDE_DOCUMENT_TOTAL) {
703 703
 					// Affiche zone totaux
704
-					$posy=$this->_tableau_tot($pdf, $object, 0, $bottomlasttab, $outputlangs);
704
+					$posy = $this->_tableau_tot($pdf, $object, 0, $bottomlasttab, $outputlangs);
705 705
 				}
706 706
 
707 707
 				// Affiche zone versements
@@ -713,38 +713,38 @@  discard block
 block discarded – undo
713 713
 				*/
714 714
 
715 715
 				// Pied de page
716
-				$this->_pagefoot($pdf,$object,$outputlangs);
717
-				if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();
716
+				$this->_pagefoot($pdf, $object, $outputlangs);
717
+				if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages();
718 718
 
719 719
 				$pdf->Close();
720 720
 
721
-				$pdf->Output($file,'F');
721
+				$pdf->Output($file, 'F');
722 722
 
723 723
 				//Add pdfgeneration hook
724 724
 				$hookmanager->initHooks(array('pdfgeneration'));
725
-				$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
725
+				$parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs);
726 726
 				global $action;
727
-				$reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action);    // Note that $action and $object may have been modified by some hooks
727
+				$reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
728 728
 
729
-				if (! empty($conf->global->MAIN_UMASK))
729
+				if (!empty($conf->global->MAIN_UMASK))
730 730
 				@chmod($file, octdec($conf->global->MAIN_UMASK));
731 731
 
732
-				return 1;   // Pas d'erreur
732
+				return 1; // Pas d'erreur
733 733
 			}
734 734
 			else
735 735
 			{
736
-				$this->error=$langs->trans("ErrorCanNotCreateDir",$dir);
736
+				$this->error = $langs->trans("ErrorCanNotCreateDir", $dir);
737 737
 				return 0;
738 738
 			}
739 739
 		}
740 740
 		else
741 741
 		{
742
-			$this->error=$langs->trans("ErrorConstantNotDefined","PROP_OUTPUTDIR");
742
+			$this->error = $langs->trans("ErrorConstantNotDefined", "PROP_OUTPUTDIR");
743 743
 			return 0;
744 744
 		}
745 745
 
746
-		$this->error=$langs->trans("ErrorUnknown");
747
-		return 0;   // Erreur par defaut
746
+		$this->error = $langs->trans("ErrorUnknown");
747
+		return 0; // Erreur par defaut
748 748
 	}
749 749
 
750 750
 	/**
@@ -776,66 +776,66 @@  discard block
 block discarded – undo
776 776
 		global $conf;
777 777
 		$default_font_size = pdf_getPDFFontSize($outputlangs);
778 778
 
779
-		$pdf->SetFont('','', $default_font_size - 1);
779
+		$pdf->SetFont('', '', $default_font_size - 1);
780 780
 
781 781
 		// If France, show VAT mention if not applicable
782 782
 		if ($this->emetteur->country_code == 'FR' && $this->franchise == 1)
783 783
 		{
784
-			$pdf->SetFont('','B', $default_font_size - 2);
784
+			$pdf->SetFont('', 'B', $default_font_size - 2);
785 785
 			$pdf->SetXY($this->marge_gauche, $posy);
786 786
 			$pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0);
787 787
 
788
-			$posy=$pdf->GetY()+4;
788
+			$posy = $pdf->GetY() + 4;
789 789
 		}
790 790
 
791
-		$posxval=52;
791
+		$posxval = 52;
792 792
 
793 793
         // Show shipping date
794
-        if (! empty($object->date_livraison))
794
+        if (!empty($object->date_livraison))
795 795
 		{
796 796
             $outputlangs->load("sendings");
797
-			$pdf->SetFont('','B', $default_font_size - 2);
797
+			$pdf->SetFont('', 'B', $default_font_size - 2);
798 798
 			$pdf->SetXY($this->marge_gauche, $posy);
799 799
 			$titre = $outputlangs->transnoentities("DateDeliveryPlanned").':';
800 800
 			$pdf->MultiCell(80, 4, $titre, 0, 'L');
801
-			$pdf->SetFont('','', $default_font_size - 2);
801
+			$pdf->SetFont('', '', $default_font_size - 2);
802 802
 			$pdf->SetXY($posxval, $posy);
803
-			$dlp=dol_print_date($object->date_livraison,"daytext",false,$outputlangs,true);
803
+			$dlp = dol_print_date($object->date_livraison, "daytext", false, $outputlangs, true);
804 804
 			$pdf->MultiCell(80, 4, $dlp, 0, 'L');
805 805
 
806
-            $posy=$pdf->GetY()+1;
806
+            $posy = $pdf->GetY() + 1;
807 807
 		}
808 808
         elseif ($object->availability_code || $object->availability)    // Show availability conditions
809 809
 		{
810
-			$pdf->SetFont('','B', $default_font_size - 2);
810
+			$pdf->SetFont('', 'B', $default_font_size - 2);
811 811
 			$pdf->SetXY($this->marge_gauche, $posy);
812 812
 			$titre = $outputlangs->transnoentities("AvailabilityPeriod").':';
813 813
 			$pdf->MultiCell(80, 4, $titre, 0, 'L');
814
-			$pdf->SetTextColor(0,0,0);
815
-			$pdf->SetFont('','', $default_font_size - 2);
814
+			$pdf->SetTextColor(0, 0, 0);
815
+			$pdf->SetFont('', '', $default_font_size - 2);
816 816
 			$pdf->SetXY($posxval, $posy);
817
-			$lib_availability=$outputlangs->transnoentities("AvailabilityType".$object->availability_code)!=('AvailabilityType'.$object->availability_code)?$outputlangs->transnoentities("AvailabilityType".$object->availability_code):$outputlangs->convToOutputCharset($object->availability);
818
-			$lib_availability=str_replace('\n',"\n",$lib_availability);
817
+			$lib_availability = $outputlangs->transnoentities("AvailabilityType".$object->availability_code) != ('AvailabilityType'.$object->availability_code) ? $outputlangs->transnoentities("AvailabilityType".$object->availability_code) : $outputlangs->convToOutputCharset($object->availability);
818
+			$lib_availability = str_replace('\n', "\n", $lib_availability);
819 819
 			$pdf->MultiCell(80, 4, $lib_availability, 0, 'L');
820 820
 
821
-			$posy=$pdf->GetY()+1;
821
+			$posy = $pdf->GetY() + 1;
822 822
 		}
823 823
 
824 824
 		// Show payments conditions
825 825
 		if (empty($conf->global->PROPALE_PDF_HIDE_PAYMENTTERMCOND) && ($object->cond_reglement_code || $object->cond_reglement))
826 826
 		{
827
-			$pdf->SetFont('','B', $default_font_size - 2);
827
+			$pdf->SetFont('', 'B', $default_font_size - 2);
828 828
 			$pdf->SetXY($this->marge_gauche, $posy);
829 829
 			$titre = $outputlangs->transnoentities("PaymentConditions").':';
830 830
 			$pdf->MultiCell(80, 4, $titre, 0, 'L');
831 831
 
832
-			$pdf->SetFont('','', $default_font_size - 2);
832
+			$pdf->SetFont('', '', $default_font_size - 2);
833 833
 			$pdf->SetXY($posxval, $posy);
834
-			$lib_condition_paiement=$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code)!=('PaymentCondition'.$object->cond_reglement_code)?$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code):$outputlangs->convToOutputCharset($object->cond_reglement_doc);
835
-			$lib_condition_paiement=str_replace('\n',"\n",$lib_condition_paiement);
836
-			$pdf->MultiCell(80, 4, $lib_condition_paiement,0,'L');
834
+			$lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc);
835
+			$lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement);
836
+			$pdf->MultiCell(80, 4, $lib_condition_paiement, 0, 'L');
837 837
 
838
-			$posy=$pdf->GetY()+3;
838
+			$posy = $pdf->GetY() + 3;
839 839
 		}
840 840
 
841 841
 		if (empty($conf->global->PROPALE_PDF_HIDE_PAYMENTTERMCOND))
@@ -861,25 +861,25 @@  discard block
 block discarded – undo
861 861
 			&& $object->mode_reglement_code != 'CHQ'
862 862
 			&& $object->mode_reglement_code != 'VIR')
863 863
 			{
864
-				$pdf->SetFont('','B', $default_font_size - 2);
864
+				$pdf->SetFont('', 'B', $default_font_size - 2);
865 865
 				$pdf->SetXY($this->marge_gauche, $posy);
866 866
 				$titre = $outputlangs->transnoentities("PaymentMode").':';
867 867
 				$pdf->MultiCell(80, 5, $titre, 0, 'L');
868
-				$pdf->SetFont('','', $default_font_size - 2);
868
+				$pdf->SetFont('', '', $default_font_size - 2);
869 869
 				$pdf->SetXY($posxval, $posy);
870
-				$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);
871
-				$pdf->MultiCell(80, 5, $lib_mode_reg,0,'L');
870
+				$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);
871
+				$pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L');
872 872
 
873
-				$posy=$pdf->GetY()+2;
873
+				$posy = $pdf->GetY() + 2;
874 874
 			}
875 875
 
876 876
 			// Show payment mode CHQ
877 877
 			if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ')
878 878
 			{
879 879
 				// Si mode reglement non force ou si force a CHQ
880
-				if (! empty($conf->global->FACTURE_CHQ_NUMBER))
880
+				if (!empty($conf->global->FACTURE_CHQ_NUMBER))
881 881
 				{
882
-					$diffsizetitle=(empty($conf->global->PDF_DIFFSIZE_TITLE)?3:$conf->global->PDF_DIFFSIZE_TITLE);
882
+					$diffsizetitle = (empty($conf->global->PDF_DIFFSIZE_TITLE) ? 3 : $conf->global->PDF_DIFFSIZE_TITLE);
883 883
 
884 884
 					if ($conf->global->FACTURE_CHQ_NUMBER > 0)
885 885
 					{
@@ -887,31 +887,31 @@  discard block
 block discarded – undo
887 887
 						$account->fetch($conf->global->FACTURE_CHQ_NUMBER);
888 888
 
889 889
 						$pdf->SetXY($this->marge_gauche, $posy);
890
-						$pdf->SetFont('','B', $default_font_size - $diffsizetitle);
891
-						$pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo',$account->proprio),0,'L',0);
892
-						$posy=$pdf->GetY()+1;
890
+						$pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
891
+						$pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $account->proprio), 0, 'L', 0);
892
+						$posy = $pdf->GetY() + 1;
893 893
 
894 894
 			            if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS))
895 895
 			            {
896 896
 							$pdf->SetXY($this->marge_gauche, $posy);
897
-							$pdf->SetFont('','', $default_font_size - $diffsizetitle);
897
+							$pdf->SetFont('', '', $default_font_size - $diffsizetitle);
898 898
 							$pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($account->owner_address), 0, 'L', 0);
899
-							$posy=$pdf->GetY()+2;
899
+							$posy = $pdf->GetY() + 2;
900 900
 			            }
901 901
 					}
902 902
 					if ($conf->global->FACTURE_CHQ_NUMBER == -1)
903 903
 					{
904 904
 						$pdf->SetXY($this->marge_gauche, $posy);
905
-						$pdf->SetFont('','B', $default_font_size - $diffsizetitle);
906
-						$pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo',$this->emetteur->name),0,'L',0);
907
-						$posy=$pdf->GetY()+1;
905
+						$pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
906
+						$pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $this->emetteur->name), 0, 'L', 0);
907
+						$posy = $pdf->GetY() + 1;
908 908
 
909 909
 			            if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS))
910 910
 			            {
911 911
 							$pdf->SetXY($this->marge_gauche, $posy);
912
-							$pdf->SetFont('','', $default_font_size - $diffsizetitle);
912
+							$pdf->SetFont('', '', $default_font_size - $diffsizetitle);
913 913
 							$pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0, 'L', 0);
914
-							$posy=$pdf->GetY()+2;
914
+							$posy = $pdf->GetY() + 2;
915 915
 			            }
916 916
 					}
917 917
 				}
@@ -920,18 +920,18 @@  discard block
 block discarded – undo
920 920
 			// If payment mode not forced or forced to VIR, show payment with BAN
921 921
 			if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR')
922 922
 			{
923
-				if (! empty($object->fk_bank) || ! empty($conf->global->FACTURE_RIB_NUMBER))
923
+				if (!empty($object->fk_bank) || !empty($conf->global->FACTURE_RIB_NUMBER))
924 924
 				{
925
-					$bankid=(empty($object->fk_bank)?$conf->global->FACTURE_RIB_NUMBER:$object->fk_bank);
925
+					$bankid = (empty($object->fk_bank) ? $conf->global->FACTURE_RIB_NUMBER : $object->fk_bank);
926 926
 					$account = new Account($this->db);
927 927
 					$account->fetch($bankid);
928 928
 
929
-					$curx=$this->marge_gauche;
930
-					$cury=$posy;
929
+					$curx = $this->marge_gauche;
930
+					$cury = $posy;
931 931
 
932
-					$posy=pdf_bank($pdf,$outputlangs,$curx,$cury,$account,0,$default_font_size);
932
+					$posy = pdf_bank($pdf, $outputlangs, $curx, $cury, $account, 0, $default_font_size);
933 933
 
934
-					$posy+=2;
934
+					$posy += 2;
935 935
 				}
936 936
 			}
937 937
 		}
@@ -952,40 +952,40 @@  discard block
 block discarded – undo
952 952
 	 */
953 953
 	function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
954 954
 	{
955
-		global $conf,$mysoc;
955
+		global $conf, $mysoc;
956 956
 		$default_font_size = pdf_getPDFFontSize($outputlangs);
957 957
 
958 958
 		$tab2_top = $posy;
959 959
 		$tab2_hl = 4;
960
-		$pdf->SetFont('','', $default_font_size - 1);
960
+		$pdf->SetFont('', '', $default_font_size - 1);
961 961
 
962 962
 		// Tableau total
963 963
 		$col1x = 120; $col2x = 170;
964 964
 		if ($this->page_largeur < 210) // To work with US executive format
965 965
 		{
966
-			$col2x-=20;
966
+			$col2x -= 20;
967 967
 		}
968 968
 		$largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
969 969
 
970
-		$useborder=0;
970
+		$useborder = 0;
971 971
 		$index = 0;
972 972
 
973 973
 		// Total HT
974
-		$pdf->SetFillColor(255,255,255);
974
+		$pdf->SetFillColor(255, 255, 255);
975 975
 		$pdf->SetXY($col1x, $tab2_top + 0);
976
-		$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
976
+		$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
977 977
 
978 978
 		$pdf->SetXY($col2x, $tab2_top + 0);
979
-		$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ht + (! empty($object->remise)?$object->remise:0), 0, $outputlangs), 0, 'R', 1);
979
+		$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ht + (!empty($object->remise) ? $object->remise : 0), 0, $outputlangs), 0, 'R', 1);
980 980
 
981 981
 		// Show VAT by rates and total
982
-		$pdf->SetFillColor(248,248,248);
982
+		$pdf->SetFillColor(248, 248, 248);
983 983
 
984
-		$this->atleastoneratenotnull=0;
984
+		$this->atleastoneratenotnull = 0;
985 985
 		if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
986 986
 		{
987
-			$tvaisnull=((! empty($this->tva) && count($this->tva) == 1 && isset($this->tva['0.000']) && is_float($this->tva['0.000'])) ? true : false);
988
-			if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_ISNULL) && $tvaisnull)
987
+			$tvaisnull = ((!empty($this->tva) && count($this->tva) == 1 && isset($this->tva['0.000']) && is_float($this->tva['0.000'])) ? true : false);
988
+			if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_ISNULL) && $tvaisnull)
989 989
 			{
990 990
 				// Nothing to do
991 991
 			}
@@ -994,28 +994,28 @@  discard block
 block discarded – undo
994 994
 				//Local tax 1 before VAT
995 995
 				//if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on')
996 996
 				//{
997
-					foreach( $this->localtax1 as $localtax_type => $localtax_rate )
997
+					foreach ($this->localtax1 as $localtax_type => $localtax_rate)
998 998
 					{
999
-						if (in_array((string) $localtax_type, array('1','3','5'))) continue;
999
+						if (in_array((string) $localtax_type, array('1', '3', '5'))) continue;
1000 1000
 
1001
-						foreach( $localtax_rate as $tvakey => $tvaval )
1001
+						foreach ($localtax_rate as $tvakey => $tvaval)
1002 1002
 						{
1003
-							if ($tvakey!=0)    // On affiche pas taux 0
1003
+							if ($tvakey != 0)    // On affiche pas taux 0
1004 1004
 							{
1005 1005
 								//$this->atleastoneratenotnull++;
1006 1006
 
1007 1007
 								$index++;
1008 1008
 								$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1009 1009
 
1010
-								$tvacompl='';
1011
-								if (preg_match('/\*/',$tvakey))
1010
+								$tvacompl = '';
1011
+								if (preg_match('/\*/', $tvakey))
1012 1012
 								{
1013
-									$tvakey=str_replace('*','',$tvakey);
1013
+									$tvakey = str_replace('*', '', $tvakey);
1014 1014
 									$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
1015 1015
 								}
1016
-								$totalvat = $outputlangs->transcountrynoentities("TotalLT1",$mysoc->country_code).' ';
1017
-								$totalvat.=vatrate(abs($tvakey),1).$tvacompl;
1018
-								$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
1016
+								$totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' ';
1017
+								$totalvat .= vatrate(abs($tvakey), 1).$tvacompl;
1018
+								$pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
1019 1019
 
1020 1020
 								$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1021 1021
 								$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
@@ -1026,13 +1026,13 @@  discard block
 block discarded – undo
1026 1026
 				//Local tax 2 before VAT
1027 1027
 				//if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on')
1028 1028
 				//{
1029
-					foreach( $this->localtax2 as $localtax_type => $localtax_rate )
1029
+					foreach ($this->localtax2 as $localtax_type => $localtax_rate)
1030 1030
 					{
1031
-						if (in_array((string) $localtax_type, array('1','3','5'))) continue;
1031
+						if (in_array((string) $localtax_type, array('1', '3', '5'))) continue;
1032 1032
 
1033
-						foreach( $localtax_rate as $tvakey => $tvaval )
1033
+						foreach ($localtax_rate as $tvakey => $tvaval)
1034 1034
 						{
1035
-							if ($tvakey!=0)    // On affiche pas taux 0
1035
+							if ($tvakey != 0)    // On affiche pas taux 0
1036 1036
 							{
1037 1037
 								//$this->atleastoneratenotnull++;
1038 1038
 
@@ -1041,15 +1041,15 @@  discard block
 block discarded – undo
1041 1041
 								$index++;
1042 1042
 								$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1043 1043
 
1044
-								$tvacompl='';
1045
-								if (preg_match('/\*/',$tvakey))
1044
+								$tvacompl = '';
1045
+								if (preg_match('/\*/', $tvakey))
1046 1046
 								{
1047
-									$tvakey=str_replace('*','',$tvakey);
1047
+									$tvakey = str_replace('*', '', $tvakey);
1048 1048
 									$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
1049 1049
 								}
1050 1050
 								$totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' ';
1051
-								$totalvat.=vatrate(abs($tvakey),1).$tvacompl;
1052
-								$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
1051
+								$totalvat .= vatrate(abs($tvakey), 1).$tvacompl;
1052
+								$pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
1053 1053
 
1054 1054
 								$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1055 1055
 								$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
@@ -1059,7 +1059,7 @@  discard block
 block discarded – undo
1059 1059
 					}
1060 1060
 				//}
1061 1061
 				// VAT
1062
-				foreach($this->tva as $tvakey => $tvaval)
1062
+				foreach ($this->tva as $tvakey => $tvaval)
1063 1063
 				{
1064 1064
 					if ($tvakey > 0)    // On affiche pas taux 0
1065 1065
 					{
@@ -1068,15 +1068,15 @@  discard block
 block discarded – undo
1068 1068
 						$index++;
1069 1069
 						$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1070 1070
 
1071
-						$tvacompl='';
1072
-						if (preg_match('/\*/',$tvakey))
1071
+						$tvacompl = '';
1072
+						if (preg_match('/\*/', $tvakey))
1073 1073
 						{
1074
-							$tvakey=str_replace('*','',$tvakey);
1074
+							$tvakey = str_replace('*', '', $tvakey);
1075 1075
 							$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
1076 1076
 						}
1077
-						$totalvat =$outputlangs->transnoentities("TotalVAT").' ';
1078
-						$totalvat.=vatrate($tvakey,1).$tvacompl;
1079
-						$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
1077
+						$totalvat = $outputlangs->transnoentities("TotalVAT").' ';
1078
+						$totalvat .= vatrate($tvakey, 1).$tvacompl;
1079
+						$pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
1080 1080
 
1081 1081
 						$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1082 1082
 						$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
@@ -1086,11 +1086,11 @@  discard block
 block discarded – undo
1086 1086
 				//Local tax 1 after VAT
1087 1087
 				//if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on')
1088 1088
 				//{
1089
-					foreach( $this->localtax1 as $localtax_type => $localtax_rate )
1089
+					foreach ($this->localtax1 as $localtax_type => $localtax_rate)
1090 1090
 					{
1091
-						if (in_array((string) $localtax_type, array('2','4','6'))) continue;
1091
+						if (in_array((string) $localtax_type, array('2', '4', '6'))) continue;
1092 1092
 
1093
-						foreach( $localtax_rate as $tvakey => $tvaval )
1093
+						foreach ($localtax_rate as $tvakey => $tvaval)
1094 1094
 						{
1095 1095
 							if ($tvakey != 0)    // On affiche pas taux 0
1096 1096
 							{
@@ -1099,16 +1099,16 @@  discard block
 block discarded – undo
1099 1099
 								$index++;
1100 1100
 								$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1101 1101
 
1102
-								$tvacompl='';
1103
-								if (preg_match('/\*/',$tvakey))
1102
+								$tvacompl = '';
1103
+								if (preg_match('/\*/', $tvakey))
1104 1104
 								{
1105
-									$tvakey=str_replace('*','',$tvakey);
1105
+									$tvakey = str_replace('*', '', $tvakey);
1106 1106
 									$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
1107 1107
 								}
1108
-								$totalvat = $outputlangs->transcountrynoentities("TotalLT1",$mysoc->country_code).' ';
1108
+								$totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' ';
1109 1109
 
1110
-								$totalvat.=vatrate(abs($tvakey),1).$tvacompl;
1111
-								$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
1110
+								$totalvat .= vatrate(abs($tvakey), 1).$tvacompl;
1111
+								$pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
1112 1112
 								$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1113 1113
 								$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
1114 1114
 							}
@@ -1118,11 +1118,11 @@  discard block
 block discarded – undo
1118 1118
 				//Local tax 2 after VAT
1119 1119
 				//if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on')
1120 1120
 				//{
1121
-					foreach( $this->localtax2 as $localtax_type => $localtax_rate )
1121
+					foreach ($this->localtax2 as $localtax_type => $localtax_rate)
1122 1122
 					{
1123
-						if (in_array((string) $localtax_type, array('2','4','6'))) continue;
1123
+						if (in_array((string) $localtax_type, array('2', '4', '6'))) continue;
1124 1124
 
1125
-						foreach( $localtax_rate as $tvakey => $tvaval )
1125
+						foreach ($localtax_rate as $tvakey => $tvaval)
1126 1126
 						{
1127 1127
 						    // retrieve global local tax
1128 1128
 							if ($tvakey != 0)    // On affiche pas taux 0
@@ -1132,16 +1132,16 @@  discard block
 block discarded – undo
1132 1132
 								$index++;
1133 1133
 								$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1134 1134
 
1135
-								$tvacompl='';
1136
-								if (preg_match('/\*/',$tvakey))
1135
+								$tvacompl = '';
1136
+								if (preg_match('/\*/', $tvakey))
1137 1137
 								{
1138
-									$tvakey=str_replace('*','',$tvakey);
1138
+									$tvakey = str_replace('*', '', $tvakey);
1139 1139
 									$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
1140 1140
 								}
1141
-								$totalvat = $outputlangs->transcountrynoentities("TotalLT2",$mysoc->country_code).' ';
1141
+								$totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' ';
1142 1142
 
1143
-								$totalvat.=vatrate(abs($tvakey),1).$tvacompl;
1144
-								$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
1143
+								$totalvat .= vatrate(abs($tvakey), 1).$tvacompl;
1144
+								$pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
1145 1145
 
1146 1146
 								$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1147 1147
 								$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
@@ -1153,16 +1153,16 @@  discard block
 block discarded – undo
1153 1153
 				// Total TTC
1154 1154
 				$index++;
1155 1155
 				$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1156
-				$pdf->SetTextColor(0,0,60);
1157
-				$pdf->SetFillColor(224,224,224);
1158
-				$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1);
1156
+				$pdf->SetTextColor(0, 0, 60);
1157
+				$pdf->SetFillColor(224, 224, 224);
1158
+				$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1);
1159 1159
 
1160 1160
 				$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1161 1161
 				$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc, 0, $outputlangs), $useborder, 'R', 1);
1162 1162
 			}
1163 1163
 		}
1164 1164
 
1165
-		$pdf->SetTextColor(0,0,0);
1165
+		$pdf->SetTextColor(0, 0, 0);
1166 1166
 
1167 1167
 		/*
1168 1168
 		$resteapayer = $object->total_ttc - $deja_regle;
@@ -1174,7 +1174,7 @@  discard block
 block discarded – undo
1174 1174
 			$index++;
1175 1175
 
1176 1176
 			$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1177
-			$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("AlreadyPaid"), 0, 'L', 0);
1177
+			$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("AlreadyPaid"), 0, 'L', 0);
1178 1178
 
1179 1179
 			$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1180 1180
 			$pdf->MultiCell($largcol2, $tab2_hl, price($deja_regle, 0, $outputlangs), 0, 'R', 0);
@@ -1196,16 +1196,16 @@  discard block
 block discarded – undo
1196 1196
 			*/
1197 1197
 
1198 1198
 			$index++;
1199
-			$pdf->SetTextColor(0,0,60);
1200
-			$pdf->SetFillColor(224,224,224);
1199
+			$pdf->SetTextColor(0, 0, 60);
1200
+			$pdf->SetFillColor(224, 224, 224);
1201 1201
 			$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1202
-			$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("RemainderToPay"), $useborder, 'L', 1);
1202
+			$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("RemainderToPay"), $useborder, 'L', 1);
1203 1203
 
1204 1204
 			$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1205 1205
 			$pdf->MultiCell($largcol2, $tab2_hl, price($resteapayer, 0, $outputlangs), $useborder, 'R', 1);
1206 1206
 
1207
-			$pdf->SetFont('','', $default_font_size - 1);
1208
-			$pdf->SetTextColor(0,0,0);
1207
+			$pdf->SetFont('', '', $default_font_size - 1);
1208
+			$pdf->SetTextColor(0, 0, 0);
1209 1209
 		}
1210 1210
 
1211 1211
 		$index++;
@@ -1224,47 +1224,47 @@  discard block
 block discarded – undo
1224 1224
 	 *   @param		int			$hidebottom		Hide bottom bar of array
1225 1225
 	 *   @return	void
1226 1226
 	 */
1227
-	function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
1227
+	function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
1228 1228
 	{
1229 1229
 		global $conf;
1230 1230
 
1231 1231
 		// Force to disable hidetop and hidebottom
1232
-		$hidebottom=0;
1233
-		if ($hidetop) $hidetop=-1;
1232
+		$hidebottom = 0;
1233
+		if ($hidetop) $hidetop = -1;
1234 1234
 
1235 1235
 		$default_font_size = pdf_getPDFFontSize($outputlangs);
1236 1236
 
1237 1237
 		// Amount in (at tab_top - 1)
1238
-		$pdf->SetTextColor(0,0,0);
1239
-		$pdf->SetFont('','',$default_font_size - 2);
1238
+		$pdf->SetTextColor(0, 0, 0);
1239
+		$pdf->SetFont('', '', $default_font_size - 2);
1240 1240
 
1241 1241
 		if (empty($hidetop))
1242 1242
 		{
1243
-			$titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$conf->currency));
1244
-			$pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4);
1243
+			$titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$conf->currency));
1244
+			$pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4);
1245 1245
 			$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
1246 1246
 
1247 1247
 			//$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230';
1248
-			if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, 5, 'F', null, explode(',',$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR));
1248
+			if (!empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR));
1249 1249
 		}
1250 1250
 
1251
-		$pdf->SetDrawColor(128,128,128);
1252
-		$pdf->SetFont('','',$default_font_size - 1);
1251
+		$pdf->SetDrawColor(128, 128, 128);
1252
+		$pdf->SetFont('', '', $default_font_size - 1);
1253 1253
 
1254 1254
 		// Output Rect
1255
-		$this->printRect($pdf,$this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom);	// Rect prend une longueur en 3eme param et 4eme param
1255
+		$this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param
1256 1256
 
1257 1257
 		if (empty($hidetop))
1258 1258
 		{
1259
-			$pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5);	// line prend une position y en 2eme param et 4eme param
1259
+			$pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur - $this->marge_droite, $tab_top + 5); // line prend une position y en 2eme param et 4eme param
1260 1260
 
1261
-			$pdf->SetXY($this->posxdesc-1, $tab_top+1);
1262
-			$pdf->MultiCell(108,2, $outputlangs->transnoentities("Designation"),'','L');
1261
+			$pdf->SetXY($this->posxdesc - 1, $tab_top + 1);
1262
+			$pdf->MultiCell(108, 2, $outputlangs->transnoentities("Designation"), '', 'L');
1263 1263
 		}
1264 1264
 
1265
-		if (! empty($conf->global->MAIN_GENERATE_PROPOSALS_WITH_PICTURE))
1265
+		if (!empty($conf->global->MAIN_GENERATE_PROPOSALS_WITH_PICTURE))
1266 1266
 		{
1267
-			$pdf->line($this->posxpicture-1, $tab_top, $this->posxpicture-1, $tab_top + $tab_height);
1267
+			$pdf->line($this->posxpicture - 1, $tab_top, $this->posxpicture - 1, $tab_top + $tab_height);
1268 1268
 			if (empty($hidetop))
1269 1269
 			{
1270 1270
 				//$pdf->SetXY($this->posxpicture-1, $tab_top+1);
@@ -1274,35 +1274,35 @@  discard block
 block discarded – undo
1274 1274
 
1275 1275
 		if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
1276 1276
 		{
1277
-			$pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height);
1277
+			$pdf->line($this->posxtva - 1, $tab_top, $this->posxtva - 1, $tab_top + $tab_height);
1278 1278
 			if (empty($hidetop))
1279 1279
 			{
1280
-				$pdf->SetXY($this->posxtva-3, $tab_top+1);
1281
-				$pdf->MultiCell($this->posxup-$this->posxtva+3,2, $outputlangs->transnoentities("VAT"),'','C');
1280
+				$pdf->SetXY($this->posxtva - 3, $tab_top + 1);
1281
+				$pdf->MultiCell($this->posxup - $this->posxtva + 3, 2, $outputlangs->transnoentities("VAT"), '', 'C');
1282 1282
 			}
1283 1283
 		}
1284 1284
 
1285
-		$pdf->line($this->posxup-1, $tab_top, $this->posxup-1, $tab_top + $tab_height);
1285
+		$pdf->line($this->posxup - 1, $tab_top, $this->posxup - 1, $tab_top + $tab_height);
1286 1286
 		if (empty($hidetop))
1287 1287
 		{
1288
-			$pdf->SetXY($this->posxup-1, $tab_top+1);
1289
-			$pdf->MultiCell($this->posxqty-$this->posxup-1,2, $outputlangs->transnoentities("PriceUHT"),'','C');
1288
+			$pdf->SetXY($this->posxup - 1, $tab_top + 1);
1289
+			$pdf->MultiCell($this->posxqty - $this->posxup - 1, 2, $outputlangs->transnoentities("PriceUHT"), '', 'C');
1290 1290
 		}
1291 1291
 
1292
-		$pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height);
1292
+		$pdf->line($this->posxqty - 1, $tab_top, $this->posxqty - 1, $tab_top + $tab_height);
1293 1293
 		if (empty($hidetop))
1294 1294
 		{
1295
-			$pdf->SetXY($this->posxqty-1, $tab_top+1);
1296
-			$pdf->MultiCell($this->posxdiscount-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C');
1295
+			$pdf->SetXY($this->posxqty - 1, $tab_top + 1);
1296
+			$pdf->MultiCell($this->posxdiscount - $this->posxqty - 1, 2, $outputlangs->transnoentities("Qty"), '', 'C');
1297 1297
 		}
1298 1298
 
1299
-		$pdf->line($this->posxdiscount-1, $tab_top, $this->posxdiscount-1, $tab_top + $tab_height);
1299
+		$pdf->line($this->posxdiscount - 1, $tab_top, $this->posxdiscount - 1, $tab_top + $tab_height);
1300 1300
 		if (empty($hidetop))
1301 1301
 		{
1302 1302
 			if ($this->atleastonediscount)
1303 1303
 			{
1304
-				$pdf->SetXY($this->posxdiscount-1, $tab_top+1);
1305
-				$pdf->MultiCell($this->postotalht-$this->posxdiscount+1,2, $outputlangs->transnoentities("ReductionShort"),'','C');
1304
+				$pdf->SetXY($this->posxdiscount - 1, $tab_top + 1);
1305
+				$pdf->MultiCell($this->postotalht - $this->posxdiscount + 1, 2, $outputlangs->transnoentities("ReductionShort"), '', 'C');
1306 1306
 			}
1307 1307
 		}
1308 1308
 		if ($this->atleastonediscount)
@@ -1311,8 +1311,8 @@  discard block
 block discarded – undo
1311 1311
 		}
1312 1312
 		if (empty($hidetop))
1313 1313
 		{
1314
-			$pdf->SetXY($this->postotalht-1, $tab_top+1);
1315
-			$pdf->MultiCell(30,2, $outputlangs->transnoentities("TotalHT"),'','C');
1314
+			$pdf->SetXY($this->postotalht - 1, $tab_top + 1);
1315
+			$pdf->MultiCell(30, 2, $outputlangs->transnoentities("TotalHT"), '', 'C');
1316 1316
 		}
1317 1317
 	}
1318 1318
 
@@ -1327,7 +1327,7 @@  discard block
 block discarded – undo
1327 1327
 	 */
1328 1328
 	function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
1329 1329
 	{
1330
-		global $conf,$langs;
1330
+		global $conf, $langs;
1331 1331
 
1332 1332
 		$outputlangs->load("main");
1333 1333
 		$outputlangs->load("bills");
@@ -1336,87 +1336,87 @@  discard block
 block discarded – undo
1336 1336
 
1337 1337
 		$default_font_size = pdf_getPDFFontSize($outputlangs);
1338 1338
 
1339
-		pdf_pagehead($pdf,$outputlangs,$this->page_hauteur);
1339
+		pdf_pagehead($pdf, $outputlangs, $this->page_hauteur);
1340 1340
 
1341 1341
 		//  Show Draft Watermark
1342
-		if($object->statut==0 && (! empty($conf->global->PROPALE_DRAFT_WATERMARK)) )
1342
+		if ($object->statut == 0 && (!empty($conf->global->PROPALE_DRAFT_WATERMARK)))
1343 1343
 		{
1344
-            pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->PROPALE_DRAFT_WATERMARK);
1344
+            pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->PROPALE_DRAFT_WATERMARK);
1345 1345
 		}
1346 1346
 
1347
-		$pdf->SetTextColor(0,0,60);
1348
-		$pdf->SetFont('','B', $default_font_size + 3);
1347
+		$pdf->SetTextColor(0, 0, 60);
1348
+		$pdf->SetFont('', 'B', $default_font_size + 3);
1349 1349
 
1350
-		$posy=$this->marge_haute;
1351
-		$posx=$this->page_largeur-$this->marge_droite-100;
1350
+		$posy = $this->marge_haute;
1351
+		$posx = $this->page_largeur - $this->marge_droite - 100;
1352 1352
 
1353
-		$pdf->SetXY($this->marge_gauche,$posy);
1353
+		$pdf->SetXY($this->marge_gauche, $posy);
1354 1354
 
1355 1355
 		// Logo
1356
-		$logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
1356
+		$logo = $conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
1357 1357
 		if ($this->emetteur->logo)
1358 1358
 		{
1359 1359
 			if (is_readable($logo))
1360 1360
 			{
1361
-			    $height=pdf_getHeightForLogo($logo);
1362
-			    $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);	// width=0 (auto)
1361
+			    $height = pdf_getHeightForLogo($logo);
1362
+			    $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto)
1363 1363
 			}
1364 1364
 			else
1365 1365
 			{
1366
-				$pdf->SetTextColor(200,0,0);
1367
-				$pdf->SetFont('','B',$default_font_size - 2);
1368
-				$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L');
1366
+				$pdf->SetTextColor(200, 0, 0);
1367
+				$pdf->SetFont('', 'B', $default_font_size - 2);
1368
+				$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L');
1369 1369
 				$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
1370 1370
 			}
1371 1371
 		}
1372 1372
 		else
1373 1373
 		{
1374
-			$text=$this->emetteur->name;
1374
+			$text = $this->emetteur->name;
1375 1375
 			$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
1376 1376
 		}
1377 1377
 
1378
-		$pdf->SetFont('','B',$default_font_size + 3);
1379
-		$pdf->SetXY($posx,$posy);
1380
-		$pdf->SetTextColor(0,0,60);
1381
-		$title=$outputlangs->transnoentities("CommercialProposal");
1378
+		$pdf->SetFont('', 'B', $default_font_size + 3);
1379
+		$pdf->SetXY($posx, $posy);
1380
+		$pdf->SetTextColor(0, 0, 60);
1381
+		$title = $outputlangs->transnoentities("CommercialProposal");
1382 1382
 		$pdf->MultiCell(100, 4, $title, '', 'R');
1383 1383
 
1384
-		$pdf->SetFont('','B',$default_font_size);
1384
+		$pdf->SetFont('', 'B', $default_font_size);
1385 1385
 
1386
-		$posy+=5;
1387
-		$pdf->SetXY($posx,$posy);
1388
-		$pdf->SetTextColor(0,0,60);
1389
-		$pdf->MultiCell(100, 4, $outputlangs->transnoentities("Ref")." : " . $outputlangs->convToOutputCharset($object->ref), '', 'R');
1386
+		$posy += 5;
1387
+		$pdf->SetXY($posx, $posy);
1388
+		$pdf->SetTextColor(0, 0, 60);
1389
+		$pdf->MultiCell(100, 4, $outputlangs->transnoentities("Ref")." : ".$outputlangs->convToOutputCharset($object->ref), '', 'R');
1390 1390
 
1391
-		$posy+=1;
1392
-		$pdf->SetFont('','', $default_font_size - 2);
1391
+		$posy += 1;
1392
+		$pdf->SetFont('', '', $default_font_size - 2);
1393 1393
 
1394 1394
 		if ($object->ref_client)
1395 1395
 		{
1396
-			$posy+=4;
1397
-			$pdf->SetXY($posx,$posy);
1398
-			$pdf->SetTextColor(0,0,60);
1399
-			$pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : " . $outputlangs->convToOutputCharset($object->ref_client), '', 'R');
1396
+			$posy += 4;
1397
+			$pdf->SetXY($posx, $posy);
1398
+			$pdf->SetTextColor(0, 0, 60);
1399
+			$pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R');
1400 1400
 		}
1401 1401
 
1402
-		$posy+=4;
1403
-		$pdf->SetXY($posx,$posy);
1404
-		$pdf->SetTextColor(0,0,60);
1405
-		$pdf->MultiCell(100, 3, $outputlangs->transnoentities("Date")." : " . dol_print_date($object->date,"day",false,$outputlangs,true), '', 'R');
1402
+		$posy += 4;
1403
+		$pdf->SetXY($posx, $posy);
1404
+		$pdf->SetTextColor(0, 0, 60);
1405
+		$pdf->MultiCell(100, 3, $outputlangs->transnoentities("Date")." : ".dol_print_date($object->date, "day", false, $outputlangs, true), '', 'R');
1406 1406
 
1407
-		$posy+=4;
1408
-		$pdf->SetXY($posx,$posy);
1409
-		$pdf->SetTextColor(0,0,60);
1410
-		$pdf->MultiCell(100, 3, $outputlangs->transnoentities("DateEndPropal")." : " . dol_print_date($object->fin_validite,"day",false,$outputlangs,true), '', 'R');
1407
+		$posy += 4;
1408
+		$pdf->SetXY($posx, $posy);
1409
+		$pdf->SetTextColor(0, 0, 60);
1410
+		$pdf->MultiCell(100, 3, $outputlangs->transnoentities("DateEndPropal")." : ".dol_print_date($object->fin_validite, "day", false, $outputlangs, true), '', 'R');
1411 1411
 		if ($object->thirdparty->code_client)
1412 1412
 		{
1413
-			$posy+=4;
1414
-			$pdf->SetXY($posx,$posy);
1415
-			$pdf->SetTextColor(0,0,60);
1416
-			$pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->thirdparty->code_client), '', 'R');
1413
+			$posy += 4;
1414
+			$pdf->SetXY($posx, $posy);
1415
+			$pdf->SetTextColor(0, 0, 60);
1416
+			$pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : ".$outputlangs->transnoentities($object->thirdparty->code_client), '', 'R');
1417 1417
 		}
1418 1418
 
1419
-		$posy+=2;
1419
+		$posy += 2;
1420 1420
 
1421 1421
 		// Show list of linked objects
1422 1422
 		$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size);
@@ -1424,95 +1424,95 @@  discard block
 block discarded – undo
1424 1424
 		if ($showaddress)
1425 1425
 		{
1426 1426
 			// Sender properties
1427
-			$carac_emetteur='';
1427
+			$carac_emetteur = '';
1428 1428
 		 	// Add internal contact of proposal if defined
1429
-			$arrayidcontact=$object->getIdContact('internal','SALESREPFOLL');
1429
+			$arrayidcontact = $object->getIdContact('internal', 'SALESREPFOLL');
1430 1430
 		 	if (count($arrayidcontact) > 0)
1431 1431
 		 	{
1432 1432
 		 		$object->fetch_user($arrayidcontact[0]);
1433
-		 		$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n";
1433
+		 		$carac_emetteur .= ($carac_emetteur ? "\n" : '').$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n";
1434 1434
 		 	}
1435 1435
 
1436 1436
 		 	$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty);
1437 1437
 
1438 1438
 			// Show sender
1439
-			$posy=42;
1440
-		 	$posx=$this->marge_gauche;
1441
-			if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->page_largeur-$this->marge_droite-80;
1442
-			$hautcadre=40;
1439
+			$posy = 42;
1440
+		 	$posx = $this->marge_gauche;
1441
+			if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->page_largeur - $this->marge_droite - 80;
1442
+			$hautcadre = 40;
1443 1443
 
1444 1444
 			// Show sender frame
1445
-			$pdf->SetTextColor(0,0,0);
1446
-			$pdf->SetFont('','', $default_font_size - 2);
1447
-			$pdf->SetXY($posx,$posy-5);
1448
-			$pdf->MultiCell(66,5, $outputlangs->transnoentities("BillFrom").":", 0, 'L');
1449
-			$pdf->SetXY($posx,$posy);
1450
-			$pdf->SetFillColor(230,230,230);
1445
+			$pdf->SetTextColor(0, 0, 0);
1446
+			$pdf->SetFont('', '', $default_font_size - 2);
1447
+			$pdf->SetXY($posx, $posy - 5);
1448
+			$pdf->MultiCell(66, 5, $outputlangs->transnoentities("BillFrom").":", 0, 'L');
1449
+			$pdf->SetXY($posx, $posy);
1450
+			$pdf->SetFillColor(230, 230, 230);
1451 1451
 			$pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1);
1452
-			$pdf->SetTextColor(0,0,60);
1452
+			$pdf->SetTextColor(0, 0, 60);
1453 1453
 
1454 1454
 			// Show sender name
1455
-			$pdf->SetXY($posx+2,$posy+3);
1456
-			$pdf->SetFont('','B', $default_font_size);
1455
+			$pdf->SetXY($posx + 2, $posy + 3);
1456
+			$pdf->SetFont('', 'B', $default_font_size);
1457 1457
 			$pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L');
1458
-			$posy=$pdf->getY();
1458
+			$posy = $pdf->getY();
1459 1459
 
1460 1460
 			// Show sender information
1461
-			$pdf->SetXY($posx+2,$posy);
1462
-			$pdf->SetFont('','', $default_font_size - 1);
1461
+			$pdf->SetXY($posx + 2, $posy);
1462
+			$pdf->SetFont('', '', $default_font_size - 1);
1463 1463
 			$pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L');
1464 1464
 
1465 1465
 
1466 1466
 			// If CUSTOMER contact defined, we use it
1467
-			$usecontact=false;
1468
-			$arrayidcontact=$object->getIdContact('external','CUSTOMER');
1467
+			$usecontact = false;
1468
+			$arrayidcontact = $object->getIdContact('external', 'CUSTOMER');
1469 1469
 			if (count($arrayidcontact) > 0)
1470 1470
 			{
1471
-				$usecontact=true;
1472
-				$result=$object->fetch_contact($arrayidcontact[0]);
1471
+				$usecontact = true;
1472
+				$result = $object->fetch_contact($arrayidcontact[0]);
1473 1473
 			}
1474 1474
 
1475 1475
 			// Recipient name
1476
-			if (! empty($usecontact))
1476
+			if (!empty($usecontact))
1477 1477
 			{
1478 1478
 				// On peut utiliser le nom de la societe du contact
1479
-				if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname;
1479
+				if (!empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname;
1480 1480
 				else $socname = $object->thirdparty->name;
1481
-				$carac_client_name=$outputlangs->convToOutputCharset($socname);
1481
+				$carac_client_name = $outputlangs->convToOutputCharset($socname);
1482 1482
 			}
1483 1483
 			else
1484 1484
 			{
1485
-				$carac_client_name=$outputlangs->convToOutputCharset($object->thirdparty->name);
1485
+				$carac_client_name = $outputlangs->convToOutputCharset($object->thirdparty->name);
1486 1486
 			}
1487 1487
 
1488
-			$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->thirdparty,($usecontact?$object->contact:''),$usecontact,'target');
1488
+			$carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact : ''), $usecontact, 'target');
1489 1489
 
1490 1490
 			// Show recipient
1491
-			$widthrecbox=100;
1492
-			if ($this->page_largeur < 210) $widthrecbox=84;	// To work with US executive format
1493
-			$posy=42;
1494
-			$posx=$this->page_largeur-$this->marge_droite-$widthrecbox;
1495
-			if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche;
1491
+			$widthrecbox = 100;
1492
+			if ($this->page_largeur < 210) $widthrecbox = 84; // To work with US executive format
1493
+			$posy = 42;
1494
+			$posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
1495
+			if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->marge_gauche;
1496 1496
 
1497 1497
 			// Show recipient frame
1498
-			$pdf->SetTextColor(0,0,0);
1499
-			$pdf->SetFont('','', $default_font_size - 2);
1500
-			$pdf->SetXY($posx+2,$posy-5);
1498
+			$pdf->SetTextColor(0, 0, 0);
1499
+			$pdf->SetFont('', '', $default_font_size - 2);
1500
+			$pdf->SetXY($posx + 2, $posy - 5);
1501 1501
 			$pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo").":", 0, 'L');
1502 1502
 			$pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
1503 1503
 
1504 1504
 			// Show recipient name
1505
-			$pdf->SetXY($posx+2,$posy+3);
1506
-			$pdf->SetFont('','B', $default_font_size);
1505
+			$pdf->SetXY($posx + 2, $posy + 3);
1506
+			$pdf->SetFont('', 'B', $default_font_size);
1507 1507
 			$pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L');
1508 1508
 
1509 1509
 			// Show recipient information
1510
-			$pdf->SetFont('','', $default_font_size - 1);
1511
-			$pdf->SetXY($posx+2,$posy+4+(dol_nboflines_bis($carac_client_name,50)*4));
1510
+			$pdf->SetFont('', '', $default_font_size - 1);
1511
+			$pdf->SetXY($posx + 2, $posy + 4 + (dol_nboflines_bis($carac_client_name, 50) * 4));
1512 1512
 			$pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L');
1513 1513
 		}
1514 1514
 
1515
-		$pdf->SetTextColor(0,0,0);
1515
+		$pdf->SetTextColor(0, 0, 0);
1516 1516
 	}
1517 1517
 
1518 1518
 	/**
@@ -1524,11 +1524,11 @@  discard block
 block discarded – undo
1524 1524
 	 *      @param	int			$hidefreetext		1=Hide free text
1525 1525
 	 *      @return	int								Return height of bottom margin including footer text
1526 1526
 	 */
1527
-	function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0)
1527
+	function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
1528 1528
 	{
1529
-		$showdetails=0;
1530
-		$free_text = (float)DOL_VERSION > 3.8 ? 'PROPOSAL_FREE_TEXT' : 'PROPALE_FREE_TEXT';
1531
-		return pdf_pagefoot($pdf,$outputlangs,$free_text,$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext);
1529
+		$showdetails = 0;
1530
+		$free_text = (float) DOL_VERSION > 3.8 ? 'PROPOSAL_FREE_TEXT' : 'PROPALE_FREE_TEXT';
1531
+		return pdf_pagefoot($pdf, $outputlangs, $free_text, $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
1532 1532
 	}
1533 1533
 
1534 1534
 }
Please login to merge, or discard this patch.
Braces   +174 added lines, -90 removed lines patch added patch discarded remove patch
@@ -99,7 +99,10 @@  discard block
 block discarded – undo
99 99
 
100 100
 		// Get source company
101 101
 		$this->emetteur=$mysoc;
102
-		if (empty($this->emetteur->country_code)) $this->emetteur->country_code=substr($langs->defaultlang,-2);    // By default, if was not defined
102
+		if (empty($this->emetteur->country_code)) {
103
+			$this->emetteur->country_code=substr($langs->defaultlang,-2);
104
+		}
105
+		// By default, if was not defined
103 106
 
104 107
 		// Define position of columns
105 108
 		$this->posxdesc=$this->marge_gauche+1;
@@ -108,11 +111,15 @@  discard block
 block discarded – undo
108 111
 		$this->posxqty=145;
109 112
 		$this->posxdiscount=162;
110 113
 		$this->postotalht=174;
111
-		if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva=$this->posxup;
114
+		if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) {
115
+			$this->posxtva=$this->posxup;
116
+		}
112 117
 		$this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH);	// width of images
113
-		if ($this->page_largeur < 210) // To work with US executive format
118
+		if ($this->page_largeur < 210) {
119
+			// To work with US executive format
114 120
 		{
115 121
 			$this->posxpicture-=20;
122
+		}
116 123
 			$this->posxtva-=20;
117 124
 			$this->posxup-=20;
118 125
 			$this->posxqty-=20;
@@ -142,9 +149,13 @@  discard block
 block discarded – undo
142 149
 	{
143 150
 		global $user,$langs,$conf,$mysoc,$db,$hookmanager;
144 151
 
145
-		if (! is_object($outputlangs)) $outputlangs=$langs;
152
+		if (! is_object($outputlangs)) {
153
+			$outputlangs=$langs;
154
+		}
146 155
 		// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
147
-		if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
156
+		if (! empty($conf->global->MAIN_USE_FPDF)) {
157
+			$outputlangs->charset_output='ISO-8859-1';
158
+		}
148 159
 
149 160
 		$outputlangs->load("main");
150 161
 		$outputlangs->load("dict");
@@ -163,7 +174,9 @@  discard block
 block discarded – undo
163 174
 
164 175
 			for ($i = 0 ; $i < $nblignes ; $i++)
165 176
 			{
166
-				if (empty($object->lines[$i]->fk_product)) continue;
177
+				if (empty($object->lines[$i]->fk_product)) {
178
+					continue;
179
+				}
167 180
 
168 181
 				$objphoto->fetch($object->lines[$i]->fk_product);
169 182
 
@@ -171,8 +184,7 @@  discard block
 block discarded – undo
171 184
 				{
172 185
 					$pdir[0] = get_exdir($objphoto->id,2) . $objphoto->id ."/photos/";
173 186
 					$pdir[1] = dol_sanitizeFileName($objphoto->ref).'/';
174
-				}
175
-				else
187
+				} else
176 188
 				{
177 189
 					$pdir[0] = dol_sanitizeFileName($objphoto->ref).'/';
178 190
 					$pdir[1] = get_exdir($objphoto->id,2) . $objphoto->id ."/photos/";
@@ -187,18 +199,18 @@  discard block
 block discarded – undo
187 199
 
188 200
 						foreach ($objphoto->liste_photos($dir,1) as $key => $obj)
189 201
 						{
190
-							if (empty($conf->global->CAT_HIGH_QUALITY_IMAGES))		// If CAT_HIGH_QUALITY_IMAGES not defined, we use thumb if defined and then original photo
202
+							if (empty($conf->global->CAT_HIGH_QUALITY_IMAGES)) {
203
+								// If CAT_HIGH_QUALITY_IMAGES not defined, we use thumb if defined and then original photo
191 204
 							{
192 205
 								if ($obj['photo_vignette'])
193 206
 								{
194 207
 									$filename= $obj['photo_vignette'];
195
-								}
196
-								else
208
+							}
209
+								} else
197 210
 								{
198 211
 									$filename=$obj['photo'];
199 212
 								}
200
-							}
201
-							else
213
+							} else
202 214
 							{
203 215
 								$filename=$obj['photo'];
204 216
 							}
@@ -209,11 +221,15 @@  discard block
 block discarded – undo
209 221
 					}
210 222
 				}
211 223
 
212
-				if ($realpath && $arephoto) $realpatharray[$i]=$realpath;
224
+				if ($realpath && $arephoto) {
225
+					$realpatharray[$i]=$realpath;
226
+				}
213 227
 			}
214 228
 		}
215 229
 
216
-		if (count($realpatharray) == 0) $this->posxpicture=$this->posxtva;
230
+		if (count($realpatharray) == 0) {
231
+			$this->posxpicture=$this->posxtva;
232
+		}
217 233
 
218 234
 		if ($conf->propal->dir_output)
219 235
 		{
@@ -228,8 +244,7 @@  discard block
 block discarded – undo
228 244
 			{
229 245
 				$dir = $conf->propal->dir_output;
230 246
 				$file = $dir . "/SPECIMEN.pdf";
231
-			}
232
-			else
247
+			} else
233 248
 			{
234 249
 				$objectref = dol_sanitizeFileName($object->ref);
235 250
 				$dir = $conf->propal->dir_output . "/" . $objectref;
@@ -288,7 +303,9 @@  discard block
 block discarded – undo
288 303
 				$pdf->SetCreator("Dolibarr ".DOL_VERSION);
289 304
 				$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
290 305
 				$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("CommercialProposal"));
291
-				if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
306
+				if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) {
307
+					$pdf->SetCompression(false);
308
+				}
292 309
 
293 310
 				$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);   // Left, Top, Right
294 311
 
@@ -312,7 +329,9 @@  discard block
 block discarded – undo
312 329
 
313 330
 				// New page
314 331
 				$pdf->AddPage();
315
-				if (! empty($tplidx)) $pdf->useTemplate($tplidx);
332
+				if (! empty($tplidx)) {
333
+					$pdf->useTemplate($tplidx);
334
+				}
316 335
 				$pagenb++;
317 336
 				$this->_pagehead($pdf, $object, 1, $outputlangs);
318 337
 				$pdf->SetFont('','', $default_font_size - 1);
@@ -334,7 +353,9 @@  discard block
 block discarded – undo
334 353
 						$salereparray=$object->thirdparty->getSalesRepresentatives($user);
335 354
 						$salerepobj=new User($this->db);
336 355
 						$salerepobj->fetch($salereparray[0]['id']);
337
-						if (! empty($salerepobj->signature)) $notetoshow=dol_concatdesc($notetoshow, $salerepobj->signature);
356
+						if (! empty($salerepobj->signature)) {
357
+							$notetoshow=dol_concatdesc($notetoshow, $salerepobj->signature);
358
+						}
338 359
 					}
339 360
 				}
340 361
 				if ($notetoshow)
@@ -352,8 +373,7 @@  discard block
 block discarded – undo
352 373
 
353 374
 					$tab_height = $tab_height - $height_note;
354 375
 					$tab_top = $nexY+6;
355
-				}
356
-				else
376
+				} else
357 377
 				{
358 378
 					$height_note=0;
359 379
 				}
@@ -438,7 +458,9 @@  discard block
 block discarded – undo
438 458
 
439 459
 					// Define size of image if we need it
440 460
 					$imglinesize=array();
441
-					if (! empty($realpatharray[$i])) $imglinesize=pdf_getSizeForImage($realpatharray[$i]);
461
+					if (! empty($realpatharray[$i])) {
462
+						$imglinesize=pdf_getSizeForImage($realpatharray[$i]);
463
+					}
442 464
 
443 465
 					$pdf->setTopMargin($tab_top_newpage);
444 466
 					$pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot);	// The only function to edit the bottom margin of current page to set it.
@@ -449,11 +471,17 @@  discard block
 block discarded – undo
449 471
 					$posYAfterDescription=0;
450 472
 
451 473
 					// We start with Photo of product line
452
-					if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur-($heightforfooter+$heightforfreetext+$heightforinfotot)))	// If photo too high, we moved completely on new page
474
+					if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur-($heightforfooter+$heightforfreetext+$heightforinfotot))) {
475
+						// If photo too high, we moved completely on new page
453 476
 					{
454 477
 						$pdf->AddPage('','',true);
455
-						if (! empty($tplidx)) $pdf->useTemplate($tplidx);
456
-						if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
478
+					}
479
+						if (! empty($tplidx)) {
480
+							$pdf->useTemplate($tplidx);
481
+						}
482
+						if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
483
+							$this->_pagehead($pdf, $object, 0, $outputlangs);
484
+						}
457 485
 						$pdf->setPage($pageposbefore+1);
458 486
 
459 487
 						$curY = $tab_top_newpage;
@@ -475,9 +503,11 @@  discard block
 block discarded – undo
475 503
 					pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxpicture-$curX,3,$curX,$curY,$hideref,$hidedesc);
476 504
 
477 505
 					$pageposafter=$pdf->getPage();
478
-					if ($pageposafter > $pageposbefore)	// There is a pagebreak
506
+					if ($pageposafter > $pageposbefore) {
507
+						// There is a pagebreak
479 508
 					{
480 509
 						$pdf->rollbackTransaction(true);
510
+					}
481 511
 						$pageposafter=$pageposbefore;
482 512
 						//print $pageposafter.'-'.$pageposbefore;exit;
483 513
 						$pdf->setPageOrientation('', 1, $heightforfooter);	// The only function to edit the bottom margin of current page to set it.
@@ -486,23 +516,27 @@  discard block
 block discarded – undo
486 516
 						$pageposafter=$pdf->getPage();
487 517
 						$posyafter=$pdf->GetY();
488 518
 						//var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit;
489
-						if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot)))	// There is no space left for total+free text
519
+						if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) {
520
+							// There is no space left for total+free text
490 521
 						{
491 522
 							if ($i == ($nblignes-1))	// No more lines, and no space left to show total, so we create a new page
492 523
 							{
493 524
 								$pdf->AddPage('','',true);
494
-								if (! empty($tplidx)) $pdf->useTemplate($tplidx);
495
-								if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
525
+						}
526
+								if (! empty($tplidx)) {
527
+									$pdf->useTemplate($tplidx);
528
+								}
529
+								if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
530
+									$this->_pagehead($pdf, $object, 0, $outputlangs);
531
+								}
496 532
 								$pdf->setPage($pageposafter+1);
497 533
 							}
498
-						}
499
-						else
534
+						} else
500 535
 						{
501 536
 							// We found a page break
502 537
 							$showpricebeforepagebreak=0;
503 538
 						}
504
-					}
505
-					else	// No pagebreak
539
+					} else	// No pagebreak
506 540
 					{
507 541
 						$pdf->commitTransaction();
508 542
 					}
@@ -597,29 +631,43 @@  discard block
 block discarded – undo
597 631
 					$localtax1_type=$object->lines[$i]->localtax1_type;
598 632
 					$localtax2_type=$object->lines[$i]->localtax2_type;
599 633
 
600
-					if ($object->remise_percent) $tvaligne-=($tvaligne*$object->remise_percent)/100;
601
-					if ($object->remise_percent) $localtax1ligne-=($localtax1ligne*$object->remise_percent)/100;
602
-					if ($object->remise_percent) $localtax2ligne-=($localtax2ligne*$object->remise_percent)/100;
634
+					if ($object->remise_percent) {
635
+						$tvaligne-=($tvaligne*$object->remise_percent)/100;
636
+					}
637
+					if ($object->remise_percent) {
638
+						$localtax1ligne-=($localtax1ligne*$object->remise_percent)/100;
639
+					}
640
+					if ($object->remise_percent) {
641
+						$localtax2ligne-=($localtax2ligne*$object->remise_percent)/100;
642
+					}
603 643
 
604 644
 					$vatrate=(string) $object->lines[$i]->tva_tx;
605 645
 
606 646
 					// Retrieve type from database for backward compatibility with old records
607 647
 					if ((! isset($localtax1_type) || $localtax1_type=='' || ! isset($localtax2_type) || $localtax2_type=='') // if tax type not defined
608
-					&& (! empty($localtax1_rate) || ! empty($localtax2_rate))) // and there is local tax
648
+					&& (! empty($localtax1_rate) || ! empty($localtax2_rate))) {
649
+						// and there is local tax
609 650
 					{
610 651
 						$localtaxtmp_array=getLocalTaxesFromRate($vatrate,0,$object->thirdparty,$mysoc);
652
+					}
611 653
 						$localtax1_type = $localtaxtmp_array[0];
612 654
 						$localtax2_type = $localtaxtmp_array[2];
613 655
 					}
614 656
 
615 657
 				    // retrieve global local tax
616
-					if ($localtax1_type && $localtax1ligne != 0)
617
-						$this->localtax1[$localtax1_type][$localtax1_rate]+=$localtax1ligne;
618
-					if ($localtax2_type && $localtax2ligne != 0)
619
-						$this->localtax2[$localtax2_type][$localtax2_rate]+=$localtax2ligne;
658
+					if ($localtax1_type && $localtax1ligne != 0) {
659
+											$this->localtax1[$localtax1_type][$localtax1_rate]+=$localtax1ligne;
660
+					}
661
+					if ($localtax2_type && $localtax2ligne != 0) {
662
+											$this->localtax2[$localtax2_type][$localtax2_rate]+=$localtax2ligne;
663
+					}
620 664
 
621
-					if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*';
622
-					if (! isset($this->tva[$vatrate]))				$this->tva[$vatrate]='';
665
+					if (($object->lines[$i]->info_bits & 0x01) == 0x01) {
666
+						$vatrate.='*';
667
+					}
668
+					if (! isset($this->tva[$vatrate])) {
669
+						$this->tva[$vatrate]='';
670
+					}
623 671
 
624 672
 					if (!empty($object->lines[$i]->TTotal_tva))
625 673
 					{
@@ -627,13 +675,14 @@  discard block
 block discarded – undo
627 675
 						{
628 676
 							$this->tva[$vatrate] += $tvaligne;
629 677
 						}
630
-					}
631
-					else {
678
+					} else {
632 679
 						// standard
633 680
 						$this->tva[$vatrate] += $tvaligne;
634 681
 					}
635 682
 
636
-					if ($posYAfterImage > $posYAfterDescription) $nexY=$posYAfterImage;
683
+					if ($posYAfterImage > $posYAfterDescription) {
684
+						$nexY=$posYAfterImage;
685
+					}
637 686
 
638 687
 					// Add line
639 688
 					if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
@@ -654,8 +703,7 @@  discard block
 block discarded – undo
654 703
 						if ($pagenb == 1)
655 704
 						{
656 705
 							$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
657
-						}
658
-						else
706
+						} else
659 707
 						{
660 708
 							$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
661 709
 						}
@@ -663,24 +711,29 @@  discard block
 block discarded – undo
663 711
 						$pagenb++;
664 712
 						$pdf->setPage($pagenb);
665 713
 						$pdf->setPageOrientation('', 1, 0);	// The only function to edit the bottom margin of current page to set it.
666
-						if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
714
+						if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
715
+							$this->_pagehead($pdf, $object, 0, $outputlangs);
716
+						}
667 717
 					}
668 718
 					if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak)
669 719
 					{
670 720
 						if ($pagenb == 1)
671 721
 						{
672 722
 							$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
673
-						}
674
-						else
723
+						} else
675 724
 						{
676 725
 							$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
677 726
 						}
678 727
 						$this->_pagefoot($pdf,$object,$outputlangs,1);
679 728
 						// New page
680 729
 						$pdf->AddPage();
681
-						if (! empty($tplidx)) $pdf->useTemplate($tplidx);
730
+						if (! empty($tplidx)) {
731
+							$pdf->useTemplate($tplidx);
732
+						}
682 733
 						$pagenb++;
683
-						if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
734
+						if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
735
+							$this->_pagehead($pdf, $object, 0, $outputlangs);
736
+						}
684 737
 					}
685 738
 				}
686 739
 
@@ -689,8 +742,7 @@  discard block
 block discarded – undo
689 742
 				{
690 743
 					$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
691 744
 					$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
692
-				}
693
-				else
745
+				} else
694 746
 				{
695 747
 					$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
696 748
 					$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
@@ -714,7 +766,9 @@  discard block
 block discarded – undo
714 766
 
715 767
 				// Pied de page
716 768
 				$this->_pagefoot($pdf,$object,$outputlangs);
717
-				if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();
769
+				if (method_exists($pdf,'AliasNbPages')) {
770
+					$pdf->AliasNbPages();
771
+				}
718 772
 
719 773
 				$pdf->Close();
720 774
 
@@ -726,18 +780,17 @@  discard block
 block discarded – undo
726 780
 				global $action;
727 781
 				$reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action);    // Note that $action and $object may have been modified by some hooks
728 782
 
729
-				if (! empty($conf->global->MAIN_UMASK))
730
-				@chmod($file, octdec($conf->global->MAIN_UMASK));
783
+				if (! empty($conf->global->MAIN_UMASK)) {
784
+								@chmod($file, octdec($conf->global->MAIN_UMASK));
785
+				}
731 786
 
732 787
 				return 1;   // Pas d'erreur
733
-			}
734
-			else
788
+			} else
735 789
 			{
736 790
 				$this->error=$langs->trans("ErrorCanNotCreateDir",$dir);
737 791
 				return 0;
738 792
 			}
739
-		}
740
-		else
793
+		} else
741 794
 		{
742 795
 			$this->error=$langs->trans("ErrorConstantNotDefined","PROP_OUTPUTDIR");
743 796
 			return 0;
@@ -804,10 +857,11 @@  discard block
 block discarded – undo
804 857
 			$pdf->MultiCell(80, 4, $dlp, 0, 'L');
805 858
 
806 859
             $posy=$pdf->GetY()+1;
807
-		}
808
-        elseif ($object->availability_code || $object->availability)    // Show availability conditions
860
+		} elseif ($object->availability_code || $object->availability) {
861
+        	// Show availability conditions
809 862
 		{
810 863
 			$pdf->SetFont('','B', $default_font_size - 2);
864
+        }
811 865
 			$pdf->SetXY($this->marge_gauche, $posy);
812 866
 			$titre = $outputlangs->transnoentities("AvailabilityPeriod").':';
813 867
 			$pdf->MultiCell(80, 4, $titre, 0, 'L');
@@ -961,10 +1015,12 @@  discard block
 block discarded – undo
961 1015
 
962 1016
 		// Tableau total
963 1017
 		$col1x = 120; $col2x = 170;
964
-		if ($this->page_largeur < 210) // To work with US executive format
1018
+		if ($this->page_largeur < 210) {
1019
+			// To work with US executive format
965 1020
 		{
966 1021
 			$col2x-=20;
967 1022
 		}
1023
+		}
968 1024
 		$largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
969 1025
 
970 1026
 		$useborder=0;
@@ -988,23 +1044,26 @@  discard block
 block discarded – undo
988 1044
 			if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_ISNULL) && $tvaisnull)
989 1045
 			{
990 1046
 				// Nothing to do
991
-			}
992
-			else
1047
+			} else
993 1048
 			{
994 1049
 				//Local tax 1 before VAT
995 1050
 				//if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on')
996 1051
 				//{
997 1052
 					foreach( $this->localtax1 as $localtax_type => $localtax_rate )
998 1053
 					{
999
-						if (in_array((string) $localtax_type, array('1','3','5'))) continue;
1054
+						if (in_array((string) $localtax_type, array('1','3','5'))) {
1055
+							continue;
1056
+						}
1000 1057
 
1001 1058
 						foreach( $localtax_rate as $tvakey => $tvaval )
1002 1059
 						{
1003
-							if ($tvakey!=0)    // On affiche pas taux 0
1060
+							if ($tvakey!=0) {
1061
+								// On affiche pas taux 0
1004 1062
 							{
1005 1063
 								//$this->atleastoneratenotnull++;
1006 1064
 
1007 1065
 								$index++;
1066
+							}
1008 1067
 								$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1009 1068
 
1010 1069
 								$tvacompl='';
@@ -1028,17 +1087,21 @@  discard block
 block discarded – undo
1028 1087
 				//{
1029 1088
 					foreach( $this->localtax2 as $localtax_type => $localtax_rate )
1030 1089
 					{
1031
-						if (in_array((string) $localtax_type, array('1','3','5'))) continue;
1090
+						if (in_array((string) $localtax_type, array('1','3','5'))) {
1091
+							continue;
1092
+						}
1032 1093
 
1033 1094
 						foreach( $localtax_rate as $tvakey => $tvaval )
1034 1095
 						{
1035
-							if ($tvakey!=0)    // On affiche pas taux 0
1096
+							if ($tvakey!=0) {
1097
+								// On affiche pas taux 0
1036 1098
 							{
1037 1099
 								//$this->atleastoneratenotnull++;
1038 1100
 
1039 1101
 
1040 1102
 
1041 1103
 								$index++;
1104
+							}
1042 1105
 								$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1043 1106
 
1044 1107
 								$tvacompl='';
@@ -1061,9 +1124,11 @@  discard block
 block discarded – undo
1061 1124
 				// VAT
1062 1125
 				foreach($this->tva as $tvakey => $tvaval)
1063 1126
 				{
1064
-					if ($tvakey > 0)    // On affiche pas taux 0
1127
+					if ($tvakey > 0) {
1128
+						// On affiche pas taux 0
1065 1129
 					{
1066 1130
 						$this->atleastoneratenotnull++;
1131
+					}
1067 1132
 
1068 1133
 						$index++;
1069 1134
 						$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
@@ -1088,15 +1153,19 @@  discard block
 block discarded – undo
1088 1153
 				//{
1089 1154
 					foreach( $this->localtax1 as $localtax_type => $localtax_rate )
1090 1155
 					{
1091
-						if (in_array((string) $localtax_type, array('2','4','6'))) continue;
1156
+						if (in_array((string) $localtax_type, array('2','4','6'))) {
1157
+							continue;
1158
+						}
1092 1159
 
1093 1160
 						foreach( $localtax_rate as $tvakey => $tvaval )
1094 1161
 						{
1095
-							if ($tvakey != 0)    // On affiche pas taux 0
1162
+							if ($tvakey != 0) {
1163
+								// On affiche pas taux 0
1096 1164
 							{
1097 1165
 								//$this->atleastoneratenotnull++;
1098 1166
 
1099 1167
 								$index++;
1168
+							}
1100 1169
 								$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1101 1170
 
1102 1171
 								$tvacompl='';
@@ -1120,16 +1189,20 @@  discard block
 block discarded – undo
1120 1189
 				//{
1121 1190
 					foreach( $this->localtax2 as $localtax_type => $localtax_rate )
1122 1191
 					{
1123
-						if (in_array((string) $localtax_type, array('2','4','6'))) continue;
1192
+						if (in_array((string) $localtax_type, array('2','4','6'))) {
1193
+							continue;
1194
+						}
1124 1195
 
1125 1196
 						foreach( $localtax_rate as $tvakey => $tvaval )
1126 1197
 						{
1127 1198
 						    // retrieve global local tax
1128
-							if ($tvakey != 0)    // On affiche pas taux 0
1199
+							if ($tvakey != 0) {
1200
+								// On affiche pas taux 0
1129 1201
 							{
1130 1202
 								//$this->atleastoneratenotnull++;
1131 1203
 
1132 1204
 								$index++;
1205
+							}
1133 1206
 								$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1134 1207
 
1135 1208
 								$tvacompl='';
@@ -1230,7 +1303,9 @@  discard block
 block discarded – undo
1230 1303
 
1231 1304
 		// Force to disable hidetop and hidebottom
1232 1305
 		$hidebottom=0;
1233
-		if ($hidetop) $hidetop=-1;
1306
+		if ($hidetop) {
1307
+			$hidetop=-1;
1308
+		}
1234 1309
 
1235 1310
 		$default_font_size = pdf_getPDFFontSize($outputlangs);
1236 1311
 
@@ -1245,7 +1320,9 @@  discard block
 block discarded – undo
1245 1320
 			$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
1246 1321
 
1247 1322
 			//$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230';
1248
-			if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, 5, 'F', null, explode(',',$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR));
1323
+			if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) {
1324
+				$pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, 5, 'F', null, explode(',',$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR));
1325
+			}
1249 1326
 		}
1250 1327
 
1251 1328
 		$pdf->SetDrawColor(128,128,128);
@@ -1360,16 +1437,14 @@  discard block
 block discarded – undo
1360 1437
 			{
1361 1438
 			    $height=pdf_getHeightForLogo($logo);
1362 1439
 			    $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);	// width=0 (auto)
1363
-			}
1364
-			else
1440
+			} else
1365 1441
 			{
1366 1442
 				$pdf->SetTextColor(200,0,0);
1367 1443
 				$pdf->SetFont('','B',$default_font_size - 2);
1368 1444
 				$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L');
1369 1445
 				$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
1370 1446
 			}
1371
-		}
1372
-		else
1447
+		} else
1373 1448
 		{
1374 1449
 			$text=$this->emetteur->name;
1375 1450
 			$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
@@ -1438,7 +1513,9 @@  discard block
 block discarded – undo
1438 1513
 			// Show sender
1439 1514
 			$posy=42;
1440 1515
 		 	$posx=$this->marge_gauche;
1441
-			if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->page_largeur-$this->marge_droite-80;
1516
+			if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
1517
+				$posx=$this->page_largeur-$this->marge_droite-80;
1518
+			}
1442 1519
 			$hautcadre=40;
1443 1520
 
1444 1521
 			// Show sender frame
@@ -1476,11 +1553,13 @@  discard block
 block discarded – undo
1476 1553
 			if (! empty($usecontact))
1477 1554
 			{
1478 1555
 				// On peut utiliser le nom de la societe du contact
1479
-				if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname;
1480
-				else $socname = $object->thirdparty->name;
1556
+				if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
1557
+					$socname = $object->contact->socname;
1558
+				} else {
1559
+					$socname = $object->thirdparty->name;
1560
+				}
1481 1561
 				$carac_client_name=$outputlangs->convToOutputCharset($socname);
1482
-			}
1483
-			else
1562
+			} else
1484 1563
 			{
1485 1564
 				$carac_client_name=$outputlangs->convToOutputCharset($object->thirdparty->name);
1486 1565
 			}
@@ -1489,10 +1568,15 @@  discard block
 block discarded – undo
1489 1568
 
1490 1569
 			// Show recipient
1491 1570
 			$widthrecbox=100;
1492
-			if ($this->page_largeur < 210) $widthrecbox=84;	// To work with US executive format
1571
+			if ($this->page_largeur < 210) {
1572
+				$widthrecbox=84;
1573
+			}
1574
+			// To work with US executive format
1493 1575
 			$posy=42;
1494 1576
 			$posx=$this->page_largeur-$this->marge_droite-$widthrecbox;
1495
-			if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche;
1577
+			if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
1578
+				$posx=$this->marge_gauche;
1579
+			}
1496 1580
 
1497 1581
 			// Show recipient frame
1498 1582
 			$pdf->SetTextColor(0,0,0);
Please login to merge, or discard this patch.
core/modules/commande/doc/pdf_einstein_subtotal.modules.php 3 patches
Indentation   +116 added lines, -116 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)
@@ -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.
Spacing   +383 added lines, -383 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
  *	\brief      Fichier de la classe permettant de generer les commandes au modele Einstein
27 27
  */
28 28
 
29
-require_once DOL_DOCUMENT_ROOT .'/core/modules/commande/modules_commande.php';
29
+require_once DOL_DOCUMENT_ROOT.'/core/modules/commande/modules_commande.php';
30 30
 require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
31 31
 require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
32 32
 require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
     var $description;
44 44
     var $type;
45 45
 
46
-    var $phpmin = array(4,3,0); // Minimum version of PHP required by module
46
+    var $phpmin = array(4, 3, 0); // Minimum version of PHP required by module
47 47
     var $version = 'dolibarr';
48 48
 
49 49
     var $page_largeur;
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
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
 	/**
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	 */
65 65
 	function __construct($db)
66 66
 	{
67
-		global $conf,$langs,$mysoc;
67
+		global $conf, $langs, $mysoc;
68 68
 
69 69
 		$langs->load("main");
70 70
 		$langs->load("bills");
@@ -76,56 +76,56 @@  discard block
 block discarded – undo
76 76
 
77 77
 		// Dimension page pour format A4
78 78
 		$this->type = 'pdf';
79
-		$formatarray=pdf_getFormat();
79
+		$formatarray = pdf_getFormat();
80 80
 		$this->page_largeur = $formatarray['width'];
81 81
 		$this->page_hauteur = $formatarray['height'];
82
-		$this->format = array($this->page_largeur,$this->page_hauteur);
83
-		$this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10;
84
-		$this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10;
85
-		$this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10;
86
-		$this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10;
87
-
88
-		$this->option_logo = 1;                    // Affiche logo
89
-		$this->option_tva = 1;                     // Gere option tva FACTURE_TVAOPTION
90
-		$this->option_modereg = 1;                 // Affiche mode reglement
91
-		$this->option_condreg = 1;                 // Affiche conditions reglement
92
-		$this->option_codeproduitservice = 1;      // Affiche code produit-service
93
-		$this->option_multilang = 1;               // Dispo en plusieurs langues
94
-		$this->option_escompte = 0;                // Affiche si il y a eu escompte
95
-		$this->option_credit_note = 0;             // Support credit notes
96
-		$this->option_freetext = 1;				   // Support add of a personalised text
97
-		$this->option_draft_watermark = 1;		   // Support add of a watermark on drafts
98
-
99
-		$this->franchise=!$mysoc->tva_assuj;
82
+		$this->format = array($this->page_largeur, $this->page_hauteur);
83
+		$this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10;
84
+		$this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10;
85
+		$this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10;
86
+		$this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10;
87
+
88
+		$this->option_logo = 1; // Affiche logo
89
+		$this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION
90
+		$this->option_modereg = 1; // Affiche mode reglement
91
+		$this->option_condreg = 1; // Affiche conditions reglement
92
+		$this->option_codeproduitservice = 1; // Affiche code produit-service
93
+		$this->option_multilang = 1; // Dispo en plusieurs langues
94
+		$this->option_escompte = 0; // Affiche si il y a eu escompte
95
+		$this->option_credit_note = 0; // Support credit notes
96
+		$this->option_freetext = 1; // Support add of a personalised text
97
+		$this->option_draft_watermark = 1; // Support add of a watermark on drafts
98
+
99
+		$this->franchise = !$mysoc->tva_assuj;
100 100
 
101 101
 		// Get source company
102
-		$this->emetteur=$mysoc;
103
-		if (empty($this->emetteur->country_code)) $this->emetteur->country_code=substr($langs->defaultlang,-2);    // By default, if was not defined
102
+		$this->emetteur = $mysoc;
103
+		if (empty($this->emetteur->country_code)) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default, if was not defined
104 104
 
105 105
 		// Define position of columns
106
-		$this->posxdesc=$this->marge_gauche+1;
107
-		$this->posxtva=112;
108
-		$this->posxup=126;
109
-		$this->posxqty=145;
110
-		$this->posxdiscount=162;
111
-		$this->postotalht=174;
112
-		if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva=$this->posxup;
113
-		$this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH);	// width of images
106
+		$this->posxdesc = $this->marge_gauche + 1;
107
+		$this->posxtva = 112;
108
+		$this->posxup = 126;
109
+		$this->posxqty = 145;
110
+		$this->posxdiscount = 162;
111
+		$this->postotalht = 174;
112
+		if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva = $this->posxup;
113
+		$this->posxpicture = $this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images
114 114
 		if ($this->page_largeur < 210) // To work with US executive format
115 115
 		{
116
-			$this->posxpicture-=20;
117
-			$this->posxtva-=20;
118
-			$this->posxup-=20;
119
-			$this->posxqty-=20;
120
-			$this->posxdiscount-=20;
121
-			$this->postotalht-=20;
116
+			$this->posxpicture -= 20;
117
+			$this->posxtva -= 20;
118
+			$this->posxup -= 20;
119
+			$this->posxqty -= 20;
120
+			$this->posxdiscount -= 20;
121
+			$this->postotalht -= 20;
122 122
 		}
123 123
 
124
-		$this->tva=array();
125
-		$this->localtax1=array();
126
-		$this->localtax2=array();
127
-		$this->atleastoneratenotnull=0;
128
-		$this->atleastonediscount=0;
124
+		$this->tva = array();
125
+		$this->localtax1 = array();
126
+		$this->localtax2 = array();
127
+		$this->atleastoneratenotnull = 0;
128
+		$this->atleastonediscount = 0;
129 129
 	}
130 130
 
131 131
 	/**
@@ -139,13 +139,13 @@  discard block
 block discarded – undo
139 139
      *  @param		int			$hideref			Do not show ref
140 140
      *  @return     int             			1=OK, 0=KO
141 141
 	 */
142
-	function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0)
142
+	function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
143 143
 	{
144
-		global $user,$langs,$conf,$mysoc,$db,$hookmanager;
144
+		global $user, $langs, $conf, $mysoc, $db, $hookmanager;
145 145
 
146
-		if (! is_object($outputlangs)) $outputlangs=$langs;
146
+		if (!is_object($outputlangs)) $outputlangs = $langs;
147 147
 		// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
148
-		if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
148
+		if (!empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output = 'ISO-8859-1';
149 149
 
150 150
 		$outputlangs->load("main");
151 151
 		$outputlangs->load("dict");
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 		if ($conf->commande->dir_output)
161 161
 		{
162 162
             $object->fetch_thirdparty();
163
-			if(!empty($object->client) ){
163
+			if (!empty($object->client)) {
164 164
 				$object->thirdparty = $object->client;
165 165
 			}
166 166
             $deja_regle = "";
@@ -169,20 +169,20 @@  discard block
 block discarded – undo
169 169
 			if ($object->specimen)
170 170
 			{
171 171
 				$dir = $conf->commande->dir_output;
172
-				$file = $dir . "/SPECIMEN.pdf";
172
+				$file = $dir."/SPECIMEN.pdf";
173 173
 			}
174 174
 			else
175 175
 			{
176 176
 				$objectref = dol_sanitizeFileName($object->ref);
177
-				$dir = $conf->commande->dir_output . "/" . $objectref;
178
-				$file = $dir . "/" . $objectref . ".pdf";
177
+				$dir = $conf->commande->dir_output."/".$objectref;
178
+				$file = $dir."/".$objectref.".pdf";
179 179
 			}
180 180
 
181
-			if (! file_exists($dir))
181
+			if (!file_exists($dir))
182 182
 			{
183 183
 				if (dol_mkdir($dir) < 0)
184 184
 				{
185
-					$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
185
+					$this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
186 186
 					return 0;
187 187
 				}
188 188
 			}
@@ -190,23 +190,23 @@  discard block
 block discarded – undo
190 190
 			if (file_exists($dir))
191 191
 			{
192 192
 				// Add pdfgeneration hook
193
-				if (! is_object($hookmanager))
193
+				if (!is_object($hookmanager))
194 194
 				{
195 195
 					include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
196
-					$hookmanager=new HookManager($this->db);
196
+					$hookmanager = new HookManager($this->db);
197 197
 				}
198 198
 				$hookmanager->initHooks(array('pdfgeneration'));
199
-				$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
199
+				$parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs);
200 200
 				global $action;
201
-				$reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action);    // Note that $action and $object may have been modified by some hooks
201
+				$reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
202 202
 
203 203
 				// Create pdf instance
204
-				$pdf=pdf_getInstance($this->format);
205
-				$default_font_size = pdf_getPDFFontSize($outputlangs);	// Must be after pdf_getInstance
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);
204
+				$pdf = pdf_getInstance($this->format);
205
+				$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
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 210
 
211 211
                 if (class_exists('TCPDF'))
212 212
                 {
@@ -215,27 +215,27 @@  discard block
 block discarded – undo
215 215
                 }
216 216
                 $pdf->SetFont(pdf_getPDFFont($outputlangs));
217 217
                 // Set path to the background PDF File
218
-                if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
218
+                if (empty($conf->global->MAIN_DISABLE_FPDI) && !empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
219 219
                 {
220 220
                     $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
221 221
                     $tplidx = $pdf->importPage(1);
222 222
                 }
223 223
 
224 224
 				$pdf->Open();
225
-				$pagenb=0;
226
-				$pdf->SetDrawColor(128,128,128);
225
+				$pagenb = 0;
226
+				$pdf->SetDrawColor(128, 128, 128);
227 227
 
228 228
 				$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
229 229
 				$pdf->SetSubject($outputlangs->transnoentities("Order"));
230 230
 				$pdf->SetCreator("Dolibarr ".DOL_VERSION);
231 231
 				$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
232 232
 				$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Order"));
233
-				if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
233
+				if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
234 234
 
235
-				$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);   // Left, Top, Right
235
+				$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
236 236
 
237 237
 				// Positionne $this->atleastonediscount si on a au moins une remise
238
-				for ($i = 0 ; $i < $nblignes ; $i++)
238
+				for ($i = 0; $i < $nblignes; $i++)
239 239
 				{
240 240
 					if ($object->lines[$i]->remise_percent)
241 241
 					{
@@ -244,61 +244,61 @@  discard block
 block discarded – undo
244 244
 				}
245 245
 				if (empty($this->atleastonediscount))
246 246
 				{
247
-					$this->posxpicture+=($this->postotalht - $this->posxdiscount);
248
-					$this->posxtva+=($this->postotalht - $this->posxdiscount);
249
-					$this->posxup+=($this->postotalht - $this->posxdiscount);
250
-					$this->posxqty+=($this->postotalht - $this->posxdiscount);
251
-					$this->posxdiscount+=($this->postotalht - $this->posxdiscount);
247
+					$this->posxpicture += ($this->postotalht - $this->posxdiscount);
248
+					$this->posxtva += ($this->postotalht - $this->posxdiscount);
249
+					$this->posxup += ($this->postotalht - $this->posxdiscount);
250
+					$this->posxqty += ($this->postotalht - $this->posxdiscount);
251
+					$this->posxdiscount += ($this->postotalht - $this->posxdiscount);
252 252
 					//$this->postotalht;
253 253
 				}
254 254
 
255 255
 				// New page
256 256
 				$pdf->AddPage();
257
-				if (! empty($tplidx)) $pdf->useTemplate($tplidx);
257
+				if (!empty($tplidx)) $pdf->useTemplate($tplidx);
258 258
 				$pagenb++;
259 259
 				$this->_pagehead($pdf, $object, 1, $outputlangs);
260
-				$pdf->SetFont('','', $default_font_size - 1);
261
-				$pdf->MultiCell(0, 3, '');		// Set interline to 3
262
-				$pdf->SetTextColor(0,0,0);
260
+				$pdf->SetFont('', '', $default_font_size - 1);
261
+				$pdf->MultiCell(0, 3, ''); // Set interline to 3
262
+				$pdf->SetTextColor(0, 0, 0);
263 263
 
264 264
 
265 265
 				$tab_top = 90;
266
-				$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10);
266
+				$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 : 10);
267 267
 				$tab_height = 130;
268 268
 				$tab_height_newpage = 150;
269 269
 
270 270
 				// Affiche notes
271
-				$notetoshow=empty($object->note_public)?'':$object->note_public;
272
-				if (! empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE))
271
+				$notetoshow = empty($object->note_public) ? '' : $object->note_public;
272
+				if (!empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE))
273 273
 				{
274 274
 					// Get first sale rep
275 275
 					if (is_object($object->thirdparty))
276 276
 					{
277
-						$salereparray=$object->thirdparty->getSalesRepresentatives($user);
278
-						$salerepobj=new User($this->db);
277
+						$salereparray = $object->thirdparty->getSalesRepresentatives($user);
278
+						$salerepobj = new User($this->db);
279 279
 						$salerepobj->fetch($salereparray[0]['id']);
280
-						if (! empty($salerepobj->signature)) $notetoshow=dol_concatdesc($notetoshow, $salerepobj->signature);
280
+						if (!empty($salerepobj->signature)) $notetoshow = dol_concatdesc($notetoshow, $salerepobj->signature);
281 281
 					}
282 282
 				}
283 283
 				if ($notetoshow)
284 284
 				{
285 285
 					$tab_top = 88;
286 286
 
287
-					$pdf->SetFont('','', $default_font_size - 1);
288
-					$pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1);
287
+					$pdf->SetFont('', '', $default_font_size - 1);
288
+					$pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1);
289 289
 					$nexY = $pdf->GetY();
290
-					$height_note=$nexY-$tab_top;
290
+					$height_note = $nexY - $tab_top;
291 291
 
292 292
 					// Rect prend une longueur en 3eme param
293
-					$pdf->SetDrawColor(192,192,192);
294
-					$pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+1);
293
+					$pdf->SetDrawColor(192, 192, 192);
294
+					$pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1);
295 295
 
296 296
 					$tab_height = $tab_height - $height_note;
297
-					$tab_top = $nexY+6;
297
+					$tab_top = $nexY + 6;
298 298
 				}
299 299
 				else
300 300
 				{
301
-					$height_note=0;
301
+					$height_note = 0;
302 302
 				}
303 303
 
304 304
 				$iniY = $tab_top + 7;
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 				$TStack = array();
313 313
 
314 314
 				// Loop on each lines
315
-				for ($i = 0 ; $i < $nblignes ; $i++)
315
+				for ($i = 0; $i < $nblignes; $i++)
316 316
 				{
317 317
 					$package_qty = $TStack[count($TStack) - 1]['package_qty'];
318 318
 					$inPackage = count($TStack) > 0;
@@ -376,44 +376,44 @@  discard block
 block discarded – undo
376 376
 					}
377 377
 					
378 378
 					$curY = $nexY;
379
-					$pdf->SetFont('','', $default_font_size - 1);   // Into loop to work with multipage
380
-					$pdf->SetTextColor(0,0,0);
379
+					$pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage
380
+					$pdf->SetTextColor(0, 0, 0);
381 381
 
382 382
 					$pdf->setTopMargin($tab_top_newpage);
383
-					$pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot);	// The only function to edit the bottom margin of current page to set it.
384
-					$pageposbefore=$pdf->getPage();
383
+					$pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it.
384
+					$pageposbefore = $pdf->getPage();
385 385
 
386 386
 					// Description of product line
387
-					$curX = $this->posxdesc-1;
387
+					$curX = $this->posxdesc - 1;
388 388
 
389
-					$showpricebeforepagebreak=1;
389
+					$showpricebeforepagebreak = 1;
390 390
 
391 391
 					$pdf->startTransaction();
392
-					pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,$hideref,$hidedesc);
393
-					$pageposafter=$pdf->getPage();
392
+					pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->posxtva - $curX, 3, $curX, $curY, $hideref, $hidedesc);
393
+					$pageposafter = $pdf->getPage();
394 394
 					if ($pageposafter > $pageposbefore)	// There is a pagebreak
395 395
 					{
396 396
 						$pdf->rollbackTransaction(true);
397
-						$pageposafter=$pageposbefore;
397
+						$pageposafter = $pageposbefore;
398 398
 						//print $pageposafter.'-'.$pageposbefore;exit;
399
-						$pdf->setPageOrientation('', 1, $heightforfooter);	// The only function to edit the bottom margin of current page to set it.
400
-						pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,4,$curX,$curY,$hideref,$hidedesc);
401
-						$pageposafter=$pdf->getPage();
402
-						$posyafter=$pdf->GetY();
403
-						if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot)))	// There is no space left for total+free text
399
+						$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
400
+						pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->posxtva - $curX, 4, $curX, $curY, $hideref, $hidedesc);
401
+						$pageposafter = $pdf->getPage();
402
+						$posyafter = $pdf->GetY();
403
+						if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot)))	// There is no space left for total+free text
404 404
 						{
405
-							if ($i == ($nblignes-1))	// No more lines, and no space left to show total, so we create a new page
405
+							if ($i == ($nblignes - 1))	// No more lines, and no space left to show total, so we create a new page
406 406
 							{
407
-								$pdf->AddPage('','',true);
408
-								if (! empty($tplidx)) $pdf->useTemplate($tplidx);
407
+								$pdf->AddPage('', '', true);
408
+								if (!empty($tplidx)) $pdf->useTemplate($tplidx);
409 409
 								if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
410
-								$pdf->setPage($pageposafter+1);
410
+								$pdf->setPage($pageposafter + 1);
411 411
 							}
412 412
 						}
413 413
 						else
414 414
 						{
415 415
 							// We found a page break
416
-							$showpricebeforepagebreak=0;
416
+							$showpricebeforepagebreak = 0;
417 417
 						}
418 418
 					}
419 419
 					else	// No pagebreak
@@ -422,17 +422,17 @@  discard block
 block discarded – undo
422 422
 					}
423 423
 
424 424
 					$nexY = $pdf->GetY();
425
-					$pageposafter=$pdf->getPage();
425
+					$pageposafter = $pdf->getPage();
426 426
 					$pdf->setPage($pageposbefore);
427 427
 					$pdf->setTopMargin($this->marge_haute);
428
-					$pdf->setPageOrientation('', 1, 0);	// The only function to edit the bottom margin of current page to set it.
428
+					$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
429 429
 
430 430
 					// We suppose that a too long description is moved completely on next page
431 431
 					if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
432 432
 						$pdf->setPage($pageposafter); $curY = $tab_top_newpage;
433 433
 					}
434 434
 
435
-					$pdf->SetFont('','',  $default_font_size - 1);   // On repositionne la police par defaut
435
+					$pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut
436 436
 
437 437
 					// VAT Rate
438 438
 					if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
 						}
446 446
 
447 447
 						$pdf->SetXY($this->posxtva, $curY);
448
-						$pdf->MultiCell($this->posxup-$this->posxtva-0.8, 3, $vat_rate, 0, 'R');
448
+						$pdf->MultiCell($this->posxup - $this->posxtva - 0.8, 3, $vat_rate, 0, 'R');
449 449
 					}
450 450
 
451 451
 					// Unit price before discount
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
 					}
457 457
 
458 458
 					$pdf->SetXY($this->posxup, $curY);
459
-					$pdf->MultiCell($this->posxqty-$this->posxup-0.8, 3, $up_excl_tax, 0, 'R', 0);
459
+					$pdf->MultiCell($this->posxqty - $this->posxup - 0.8, 3, $up_excl_tax, 0, 'R', 0);
460 460
 
461 461
 					// Booléen pour déterminer s'il s'agit d'une ligne de titre ou non
462 462
 					$isTitle = false;
@@ -478,14 +478,14 @@  discard block
 block discarded – undo
478 478
 					}
479 479
 					
480 480
 					$pdf->SetXY($this->posxqty, $curY);
481
-					$pdf->MultiCell($this->posxdiscount-$this->posxqty-0.8, 3, $qty, 0, 'R');	// Enough for 6 chars
481
+					$pdf->MultiCell($this->posxdiscount - $this->posxqty - 0.8, 3, $qty, 0, 'R'); // Enough for 6 chars
482 482
 
483 483
 					// Discount on line
484 484
 					if ($object->lines[$i]->remise_percent)
485 485
 					{
486
-						$pdf->SetXY($this->posxdiscount-2, $curY);
486
+						$pdf->SetXY($this->posxdiscount - 2, $curY);
487 487
 						$remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails);
488
-						$pdf->MultiCell($this->postotalht-$this->posxdiscount+2, 3, $remise_percent, 0, 'R');
488
+						$pdf->MultiCell($this->postotalht - $this->posxdiscount + 2, 3, $remise_percent, 0, 'R');
489 489
 					}
490 490
 
491 491
 					// Total HT line
@@ -496,41 +496,41 @@  discard block
 block discarded – undo
496 496
 					}
497 497
 
498 498
 					$pdf->SetXY($this->postotalht, $curY);
499
-					$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalht, 3, $total_excl_tax, 0, 'R', 0);
499
+					$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalht, 3, $total_excl_tax, 0, 'R', 0);
500 500
 
501 501
 					// Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva
502
-					$tvaligne=$object->lines[$i]->total_tva;
502
+					$tvaligne = $object->lines[$i]->total_tva;
503 503
 
504
-					$localtax1ligne=$object->lines[$i]->total_localtax1;
505
-					$localtax2ligne=$object->lines[$i]->total_localtax2;
506
-					$localtax1_rate=$object->lines[$i]->localtax1_tx;
507
-					$localtax2_rate=$object->lines[$i]->localtax2_tx;
508
-					$localtax1_type=$object->lines[$i]->localtax1_type;
509
-					$localtax2_type=$object->lines[$i]->localtax2_type;
504
+					$localtax1ligne = $object->lines[$i]->total_localtax1;
505
+					$localtax2ligne = $object->lines[$i]->total_localtax2;
506
+					$localtax1_rate = $object->lines[$i]->localtax1_tx;
507
+					$localtax2_rate = $object->lines[$i]->localtax2_tx;
508
+					$localtax1_type = $object->lines[$i]->localtax1_type;
509
+					$localtax2_type = $object->lines[$i]->localtax2_type;
510 510
 
511
-					if ($object->remise_percent) $tvaligne-=($tvaligne*$object->remise_percent)/100;
512
-					if ($object->remise_percent) $localtax1ligne-=($localtax1ligne*$object->remise_percent)/100;
513
-					if ($object->remise_percent) $localtax2ligne-=($localtax2ligne*$object->remise_percent)/100;
511
+					if ($object->remise_percent) $tvaligne -= ($tvaligne * $object->remise_percent) / 100;
512
+					if ($object->remise_percent) $localtax1ligne -= ($localtax1ligne * $object->remise_percent) / 100;
513
+					if ($object->remise_percent) $localtax2ligne -= ($localtax2ligne * $object->remise_percent) / 100;
514 514
 
515
-					$vatrate=(string) $object->lines[$i]->tva_tx;
515
+					$vatrate = (string) $object->lines[$i]->tva_tx;
516 516
 					
517 517
 					// Retrieve type from database for backward compatibility with old records
518
-					if ((! isset($localtax1_type) || $localtax1_type=='' || ! isset($localtax2_type) || $localtax2_type=='') // if tax type not defined
519
-					&& (! empty($localtax1_rate) || ! empty($localtax2_rate))) // and there is local tax
518
+					if ((!isset($localtax1_type) || $localtax1_type == '' || !isset($localtax2_type) || $localtax2_type == '') // if tax type not defined
519
+					&& (!empty($localtax1_rate) || !empty($localtax2_rate))) // and there is local tax
520 520
 					{
521
-						$localtaxtmp_array=getLocalTaxesFromRate($vatrate,0,$object->thirdparty,$mysoc);
521
+						$localtaxtmp_array = getLocalTaxesFromRate($vatrate, 0, $object->thirdparty, $mysoc);
522 522
 						$localtax1_type = $localtaxtmp_array[0];
523 523
 						$localtax2_type = $localtaxtmp_array[2];
524 524
 					}
525 525
 
526 526
 				    // retrieve global local tax
527 527
 					if ($localtax1_type && $localtax1ligne != 0)
528
-						$this->localtax1[$localtax1_type][$localtax1_rate]+=$localtax1ligne;
528
+						$this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne;
529 529
 					if ($localtax2_type && $localtax2ligne != 0)
530
-						$this->localtax2[$localtax2_type][$localtax2_rate]+=$localtax2ligne;
530
+						$this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne;
531 531
 
532
-					if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*';
533
-					if (! isset($this->tva[$vatrate])) 				$this->tva[$vatrate]='';
532
+					if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate .= '*';
533
+					if (!isset($this->tva[$vatrate])) 				$this->tva[$vatrate] = '';
534 534
 					
535 535
 					if (!empty($object->lines[$i]->TTotal_tva))
536 536
 					{
@@ -545,16 +545,16 @@  discard block
 block discarded – undo
545 545
 					}
546 546
 
547 547
 					// Add line
548
-					if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
548
+					if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
549 549
 					{
550 550
 						$pdf->setPage($pageposafter);
551
-						$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210)));
551
+						$pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(210, 210, 210)));
552 552
 						//$pdf->SetDrawColor(190,190,200);
553
-						$pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1);
553
+						$pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1);
554 554
 						$pdf->SetLineStyle(array('dash'=>0));
555 555
 					}
556 556
 
557
-					$nexY+=2;    // Passe espace entre les lignes
557
+					$nexY += 2; // Passe espace entre les lignes
558 558
 
559 559
 					// Detect if some page were added automatically and output _tableau for past pages
560 560
 					while ($pagenb < $pageposafter)
@@ -568,13 +568,13 @@  discard block
 block discarded – undo
568 568
 						{
569 569
 							$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
570 570
 						}
571
-						$this->_pagefoot($pdf,$object,$outputlangs,1);
571
+						$this->_pagefoot($pdf, $object, $outputlangs, 1);
572 572
 						$pagenb++;
573 573
 						$pdf->setPage($pagenb);
574
-						$pdf->setPageOrientation('', 1, 0);	// The only function to edit the bottom margin of current page to set it.
574
+						$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
575 575
 						if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
576 576
 					}
577
-					if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak)
577
+					if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak)
578 578
 					{
579 579
 						if ($pagenb == 1)
580 580
 						{
@@ -584,10 +584,10 @@  discard block
 block discarded – undo
584 584
 						{
585 585
 							$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
586 586
 						}
587
-						$this->_pagefoot($pdf,$object,$outputlangs,1);
587
+						$this->_pagefoot($pdf, $object, $outputlangs, 1);
588 588
 						// New page
589 589
 						$pdf->AddPage();
590
-						if (! empty($tplidx)) $pdf->useTemplate($tplidx);
590
+						if (!empty($tplidx)) $pdf->useTemplate($tplidx);
591 591
 						$pagenb++;
592 592
 						if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
593 593
 					}
@@ -597,60 +597,60 @@  discard block
 block discarded – undo
597 597
 				if ($pagenb == 1)
598 598
 				{
599 599
 					$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
600
-					$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
600
+					$bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
601 601
 				}
602 602
 				else
603 603
 				{
604 604
 					$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
605
-					$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
605
+					$bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
606 606
 				}
607 607
 
608 608
 				// Affiche zone infos
609
-				$posy=$this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs);
609
+				$posy = $this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs);
610 610
 
611 611
 				if (!$conf->global->SUBTOTAL_HIDE_DOCUMENT_TOTAL) {
612 612
 					// Affiche zone totaux
613
-					$posy=$this->_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs);
613
+					$posy = $this->_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs);
614 614
 				}
615 615
 
616 616
 				// Affiche zone versements
617 617
 				if ($deja_regle)
618 618
 				{
619
-					$posy=$this->_tableau_versements($pdf, $object, $posy, $outputlangs);
619
+					$posy = $this->_tableau_versements($pdf, $object, $posy, $outputlangs);
620 620
 				}
621 621
 
622 622
 				// Pied de page
623
-				$this->_pagefoot($pdf,$object,$outputlangs);
624
-				if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();
623
+				$this->_pagefoot($pdf, $object, $outputlangs);
624
+				if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages();
625 625
 
626 626
 				$pdf->Close();
627 627
 
628
-				$pdf->Output($file,'F');
628
+				$pdf->Output($file, 'F');
629 629
 
630 630
 				// Add pdfgeneration hook
631 631
 				$hookmanager->initHooks(array('pdfgeneration'));
632
-				$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
632
+				$parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs);
633 633
 				global $action;
634
-				$reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action);    // Note that $action and $object may have been modified by some hooks
634
+				$reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
635 635
 
636
-				if (! empty($conf->global->MAIN_UMASK))
636
+				if (!empty($conf->global->MAIN_UMASK))
637 637
 					@chmod($file, octdec($conf->global->MAIN_UMASK));
638 638
 
639
-				return 1;   // Pas d'erreur
639
+				return 1; // Pas d'erreur
640 640
 			}
641 641
 			else
642 642
 			{
643
-				$this->error=$langs->trans("ErrorCanNotCreateDir",$dir);
643
+				$this->error = $langs->trans("ErrorCanNotCreateDir", $dir);
644 644
 				return 0;
645 645
 			}
646 646
 		}
647 647
 		else
648 648
 		{
649
-			$this->error=$langs->trans("ErrorConstantNotDefined","COMMANDE_OUTPUTDIR");
649
+			$this->error = $langs->trans("ErrorConstantNotDefined", "COMMANDE_OUTPUTDIR");
650 650
 			return 0;
651 651
 		}
652
-		$this->error=$langs->trans("ErrorUnknown");
653
-		return 0;   // Erreur par defaut
652
+		$this->error = $langs->trans("ErrorUnknown");
653
+		return 0; // Erreur par defaut
654 654
 	}
655 655
 
656 656
 	/**
@@ -682,35 +682,35 @@  discard block
 block discarded – undo
682 682
 		global $conf;
683 683
 		$default_font_size = pdf_getPDFFontSize($outputlangs);
684 684
 
685
-		$pdf->SetFont('','', $default_font_size - 1);
685
+		$pdf->SetFont('', '', $default_font_size - 1);
686 686
 
687 687
         // If France, show VAT mention if not applicable
688 688
 		if ($this->emetteur->country_code == 'FR' && $this->franchise == 1)
689 689
 		{
690
-			$pdf->SetFont('','B', $default_font_size - 2);
690
+			$pdf->SetFont('', 'B', $default_font_size - 2);
691 691
 			$pdf->SetXY($this->marge_gauche, $posy);
692 692
 			$pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0);
693 693
 
694
-			$posy=$pdf->GetY()+4;
694
+			$posy = $pdf->GetY() + 4;
695 695
 		}
696 696
 
697
-		$posxval=52;
697
+		$posxval = 52;
698 698
 
699 699
 		// Show payments conditions
700 700
 		if ($object->cond_reglement_code || $object->cond_reglement)
701 701
 		{
702
-			$pdf->SetFont('','B', $default_font_size - 2);
702
+			$pdf->SetFont('', 'B', $default_font_size - 2);
703 703
 			$pdf->SetXY($this->marge_gauche, $posy);
704 704
 			$titre = $outputlangs->transnoentities("PaymentConditions").':';
705 705
 			$pdf->MultiCell(80, 4, $titre, 0, 'L');
706 706
 
707
-			$pdf->SetFont('','', $default_font_size - 2);
707
+			$pdf->SetFont('', '', $default_font_size - 2);
708 708
 			$pdf->SetXY($posxval, $posy);
709
-			$lib_condition_paiement=$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code)!=('PaymentCondition'.$object->cond_reglement_code)?$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code):$outputlangs->convToOutputCharset($object->cond_reglement_doc);
710
-			$lib_condition_paiement=str_replace('\n',"\n",$lib_condition_paiement);
711
-			$pdf->MultiCell(80, 4, $lib_condition_paiement,0,'L');
709
+			$lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc);
710
+			$lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement);
711
+			$pdf->MultiCell(80, 4, $lib_condition_paiement, 0, 'L');
712 712
 
713
-			$posy=$pdf->GetY()+3;
713
+			$posy = $pdf->GetY() + 3;
714 714
 		}
715 715
 
716 716
         // Check a payment mode is defined
@@ -741,34 +741,34 @@  discard block
 block discarded – undo
741 741
 		}*/
742 742
 
743 743
 	    // Show planed date of delivery
744
-        if (! empty($object->date_livraison))
744
+        if (!empty($object->date_livraison))
745 745
 		{
746 746
             $outputlangs->load("sendings");
747
-			$pdf->SetFont('','B', $default_font_size - 2);
747
+			$pdf->SetFont('', 'B', $default_font_size - 2);
748 748
 			$pdf->SetXY($this->marge_gauche, $posy);
749 749
 			$titre = $outputlangs->transnoentities("DateDeliveryPlanned").':';
750 750
 			$pdf->MultiCell(80, 4, $titre, 0, 'L');
751
-			$pdf->SetFont('','', $default_font_size - 2);
751
+			$pdf->SetFont('', '', $default_font_size - 2);
752 752
 			$pdf->SetXY($posxval, $posy);
753
-			$dlp=dol_print_date($object->date_livraison,"daytext",false,$outputlangs,true);
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 758
         elseif ($object->availability_code || $object->availability)    // Show availability conditions
759 759
 		{
760
-			$pdf->SetFont('','B', $default_font_size - 2);
760
+			$pdf->SetFont('', 'B', $default_font_size - 2);
761 761
 			$pdf->SetXY($this->marge_gauche, $posy);
762 762
 			$titre = $outputlangs->transnoentities("AvailabilityPeriod").':';
763 763
 			$pdf->MultiCell(80, 4, $titre, 0, 'L');
764
-			$pdf->SetTextColor(0,0,0);
765
-			$pdf->SetFont('','', $default_font_size - 2);
764
+			$pdf->SetTextColor(0, 0, 0);
765
+			$pdf->SetFont('', '', $default_font_size - 2);
766 766
 			$pdf->SetXY($posxval, $posy);
767
-			$lib_availability=$outputlangs->transnoentities("AvailabilityType".$object->availability_code)!=('AvailabilityType'.$object->availability_code)?$outputlangs->transnoentities("AvailabilityType".$object->availability_code):$outputlangs->convToOutputCharset(isset($object->availability)?$object->availability:'');
768
-			$lib_availability=str_replace('\n',"\n",$lib_availability);
767
+			$lib_availability = $outputlangs->transnoentities("AvailabilityType".$object->availability_code) != ('AvailabilityType'.$object->availability_code) ? $outputlangs->transnoentities("AvailabilityType".$object->availability_code) : $outputlangs->convToOutputCharset(isset($object->availability) ? $object->availability : '');
768
+			$lib_availability = str_replace('\n', "\n", $lib_availability);
769 769
 			$pdf->MultiCell(80, 4, $lib_availability, 0, 'L');
770 770
 
771
-			$posy=$pdf->GetY()+1;
771
+			$posy = $pdf->GetY() + 1;
772 772
 		}
773 773
 
774 774
       	// Show payment mode
@@ -776,24 +776,24 @@  discard block
 block discarded – undo
776 776
         	 && $object->mode_reglement_code != 'CHQ'
777 777
            	 && $object->mode_reglement_code != 'VIR')
778 778
            	 {
779
-	            $pdf->SetFont('','B', $default_font_size - 2);
779
+	            $pdf->SetFont('', 'B', $default_font_size - 2);
780 780
 	            $pdf->SetXY($this->marge_gauche, $posy);
781 781
 	            $titre = $outputlangs->transnoentities("PaymentMode").':';
782 782
 	            $pdf->MultiCell(80, 5, $titre, 0, 'L');
783 783
 
784
-				$pdf->SetFont('','', $default_font_size - 2);
784
+				$pdf->SetFont('', '', $default_font_size - 2);
785 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');
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;
789
+	            $posy = $pdf->GetY() + 2;
790 790
            	 }
791 791
 
792 792
 		// Show payment mode CHQ
793 793
         if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ')
794 794
         {
795 795
         	// Si mode reglement non force ou si force a CHQ
796
-	        if (! empty($conf->global->FACTURE_CHQ_NUMBER))
796
+	        if (!empty($conf->global->FACTURE_CHQ_NUMBER))
797 797
 	        {
798 798
 	            if ($conf->global->FACTURE_CHQ_NUMBER > 0)
799 799
 	            {
@@ -801,31 +801,31 @@  discard block
 block discarded – undo
801 801
 	                $account->fetch($conf->global->FACTURE_CHQ_NUMBER);
802 802
 
803 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;
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 807
 
808 808
 		            if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS))
809 809
 		            {
810 810
 		                $pdf->SetXY($this->marge_gauche, $posy);
811
-		                $pdf->SetFont('','', $default_font_size - 3);
811
+		                $pdf->SetFont('', '', $default_font_size - 3);
812 812
 		                $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($account->owner_address), 0, 'L', 0);
813
-			            $posy=$pdf->GetY()+2;
813
+			            $posy = $pdf->GetY() + 2;
814 814
 		            }
815 815
 	            }
816 816
 	            if ($conf->global->FACTURE_CHQ_NUMBER == -1)
817 817
 	            {
818 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;
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 822
 
823 823
 		            if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS))
824 824
 		            {
825 825
 			            $pdf->SetXY($this->marge_gauche, $posy);
826
-		                $pdf->SetFont('','', $default_font_size - 3);
826
+		                $pdf->SetFont('', '', $default_font_size - 3);
827 827
 		                $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0, 'L', 0);
828
-			            $posy=$pdf->GetY()+2;
828
+			            $posy = $pdf->GetY() + 2;
829 829
 		            }
830 830
 	            }
831 831
 	        }
@@ -834,18 +834,18 @@  discard block
 block discarded – undo
834 834
         // If payment mode not forced or forced to VIR, show payment with BAN
835 835
         if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR')
836 836
         {
837
-        	if (! empty($object->fk_bank) || ! empty($conf->global->FACTURE_RIB_NUMBER))
837
+        	if (!empty($object->fk_bank) || !empty($conf->global->FACTURE_RIB_NUMBER))
838 838
 			{
839
-				$bankid=(empty($object->fk_bank)?$conf->global->FACTURE_RIB_NUMBER:$object->fk_bank);
839
+				$bankid = (empty($object->fk_bank) ? $conf->global->FACTURE_RIB_NUMBER : $object->fk_bank);
840 840
 				$account = new Account($this->db);
841 841
 				$account->fetch($bankid);
842 842
 
843
-				$curx=$this->marge_gauche;
844
-				$cury=$posy;
843
+				$curx = $this->marge_gauche;
844
+				$cury = $posy;
845 845
 
846
-				$posy=pdf_bank($pdf,$outputlangs,$curx,$cury,$account,0,$default_font_size);
846
+				$posy = pdf_bank($pdf, $outputlangs, $curx, $cury, $account, 0, $default_font_size);
847 847
 
848
-				$posy+=2;
848
+				$posy += 2;
849 849
 			}
850 850
         }
851 851
 
@@ -865,41 +865,41 @@  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
 
872 872
 		$tab2_top = $posy;
873 873
 		$tab2_hl = 4;
874
-		$pdf->SetFont('','', $default_font_size - 1);
874
+		$pdf->SetFont('', '', $default_font_size - 1);
875 875
 
876 876
 		// Tableau total
877 877
         $col1x = 120; $col2x = 170;
878 878
 		if ($this->page_largeur < 210) // To work with US executive format
879 879
 		{
880
-			$col2x-=20;
880
+			$col2x -= 20;
881 881
 		}
882 882
 		$largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
883 883
 
884
-		$useborder=0;
884
+		$useborder = 0;
885 885
 		$index = 0;
886 886
 
887 887
 		// Total HT
888
-		$pdf->SetFillColor(255,255,255);
888
+		$pdf->SetFillColor(255, 255, 255);
889 889
 		$pdf->SetXY($col1x, $tab2_top + 0);
890
-		$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
890
+		$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
891 891
 
892 892
 		$pdf->SetXY($col2x, $tab2_top + 0);
893
-		$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ht + (! empty($object->remise)?$object->remise:0), 0, $outputlangs), 0, 'R', 1);
893
+		$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ht + (!empty($object->remise) ? $object->remise : 0), 0, $outputlangs), 0, 'R', 1);
894 894
 
895 895
 		// Show VAT by rates and total
896
-		$pdf->SetFillColor(248,248,248);
896
+		$pdf->SetFillColor(248, 248, 248);
897 897
 
898
-		$this->atleastoneratenotnull=0;
898
+		$this->atleastoneratenotnull = 0;
899 899
 		if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
900 900
 		{
901
-			$tvaisnull=((! empty($this->tva) && count($this->tva) == 1 && isset($this->tva['0.000']) && is_float($this->tva['0.000'])) ? true : false);
902
-			if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_ISNULL) && $tvaisnull)
901
+			$tvaisnull = ((!empty($this->tva) && count($this->tva) == 1 && isset($this->tva['0.000']) && is_float($this->tva['0.000'])) ? true : false);
902
+			if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_ISNULL) && $tvaisnull)
903 903
 			{
904 904
 				// Nothing to do
905 905
 			}
@@ -908,27 +908,27 @@  discard block
 block discarded – undo
908 908
 				//Local tax 1 before VAT
909 909
 				//if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on')
910 910
 				//{
911
-					foreach( $this->localtax1 as $localtax_type => $localtax_rate )
911
+					foreach ($this->localtax1 as $localtax_type => $localtax_rate)
912 912
 					{
913
-						if (in_array((string) $localtax_type, array('1','3','5'))) continue;
914
-						foreach( $localtax_rate as $tvakey => $tvaval )
913
+						if (in_array((string) $localtax_type, array('1', '3', '5'))) continue;
914
+						foreach ($localtax_rate as $tvakey => $tvaval)
915 915
 						{
916
-							if ($tvakey!=0)    // On affiche pas taux 0
916
+							if ($tvakey != 0)    // On affiche pas taux 0
917 917
 							{
918 918
 								//$this->atleastoneratenotnull++;
919 919
 
920 920
 								$index++;
921 921
 								$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
922 922
 
923
-								$tvacompl='';
924
-								if (preg_match('/\*/',$tvakey))
923
+								$tvacompl = '';
924
+								if (preg_match('/\*/', $tvakey))
925 925
 								{
926
-									$tvakey=str_replace('*','',$tvakey);
926
+									$tvakey = str_replace('*', '', $tvakey);
927 927
 									$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
928 928
 								}
929
-								$totalvat = $outputlangs->transcountrynoentities("TotalLT1",$mysoc->country_code).' ';
930
-								$totalvat.=vatrate(abs($tvakey),1).$tvacompl;
931
-								$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
929
+								$totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' ';
930
+								$totalvat .= vatrate(abs($tvakey), 1).$tvacompl;
931
+								$pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
932 932
 
933 933
 								$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
934 934
 								$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
@@ -939,12 +939,12 @@  discard block
 block discarded – undo
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
 				//{
942
-					foreach( $this->localtax2 as $localtax_type => $localtax_rate )
942
+					foreach ($this->localtax2 as $localtax_type => $localtax_rate)
943 943
 					{
944
-						if (in_array((string) $localtax_type, array('1','3','5'))) continue;
945
-						foreach( $localtax_rate as $tvakey => $tvaval )
944
+						if (in_array((string) $localtax_type, array('1', '3', '5'))) continue;
945
+						foreach ($localtax_rate as $tvakey => $tvaval)
946 946
 						{
947
-							if ($tvakey!=0)    // On affiche pas taux 0
947
+							if ($tvakey != 0)    // On affiche pas taux 0
948 948
 							{
949 949
 								//$this->atleastoneratenotnull++;
950 950
 
@@ -953,15 +953,15 @@  discard block
 block discarded – undo
953 953
 								$index++;
954 954
 								$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
955 955
 
956
-								$tvacompl='';
957
-								if (preg_match('/\*/',$tvakey))
956
+								$tvacompl = '';
957
+								if (preg_match('/\*/', $tvakey))
958 958
 								{
959
-									$tvakey=str_replace('*','',$tvakey);
959
+									$tvakey = str_replace('*', '', $tvakey);
960 960
 									$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
961 961
 								}
962
-								$totalvat = $outputlangs->transcountrynoentities("TotalLT2",$mysoc->country_code).' ';
963
-								$totalvat.=vatrate(abs($tvakey),1).$tvacompl;
964
-								$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
962
+								$totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' ';
963
+								$totalvat .= vatrate(abs($tvakey), 1).$tvacompl;
964
+								$pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
965 965
 
966 966
 								$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
967 967
 								$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
@@ -971,7 +971,7 @@  discard block
 block discarded – undo
971 971
 					}
972 972
 				//}
973 973
 				// VAT
974
-				foreach($this->tva as $tvakey => $tvaval)
974
+				foreach ($this->tva as $tvakey => $tvaval)
975 975
 				{
976 976
 					if ($tvakey > 0)    // On affiche pas taux 0
977 977
 					{
@@ -980,15 +980,15 @@  discard block
 block discarded – undo
980 980
 						$index++;
981 981
 						$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
982 982
 
983
-						$tvacompl='';
984
-						if (preg_match('/\*/',$tvakey))
983
+						$tvacompl = '';
984
+						if (preg_match('/\*/', $tvakey))
985 985
 						{
986
-							$tvakey=str_replace('*','',$tvakey);
986
+							$tvakey = str_replace('*', '', $tvakey);
987 987
 							$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
988 988
 						}
989
-						$totalvat =$outputlangs->transnoentities("TotalVAT").' ';
990
-						$totalvat.=vatrate($tvakey,1).$tvacompl;
991
-						$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
989
+						$totalvat = $outputlangs->transnoentities("TotalVAT").' ';
990
+						$totalvat .= vatrate($tvakey, 1).$tvacompl;
991
+						$pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
992 992
 
993 993
 						$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
994 994
 						$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
@@ -998,11 +998,11 @@  discard block
 block discarded – undo
998 998
 				//Local tax 1 after VAT
999 999
 				//if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on')
1000 1000
 				//{
1001
-					foreach( $this->localtax1 as $localtax_type => $localtax_rate )
1001
+					foreach ($this->localtax1 as $localtax_type => $localtax_rate)
1002 1002
 					{
1003
-						if (in_array((string) $localtax_type, array('2','4','6'))) continue;
1003
+						if (in_array((string) $localtax_type, array('2', '4', '6'))) continue;
1004 1004
 
1005
-						foreach( $localtax_rate as $tvakey => $tvaval )
1005
+						foreach ($localtax_rate as $tvakey => $tvaval)
1006 1006
 						{
1007 1007
 							if ($tvakey != 0)    // On affiche pas taux 0
1008 1008
 							{
@@ -1011,16 +1011,16 @@  discard block
 block discarded – undo
1011 1011
 								$index++;
1012 1012
 								$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1013 1013
 
1014
-								$tvacompl='';
1015
-								if (preg_match('/\*/',$tvakey))
1014
+								$tvacompl = '';
1015
+								if (preg_match('/\*/', $tvakey))
1016 1016
 								{
1017
-									$tvakey=str_replace('*','',$tvakey);
1017
+									$tvakey = str_replace('*', '', $tvakey);
1018 1018
 									$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
1019 1019
 								}
1020
-								$totalvat = $outputlangs->transcountrynoentities("TotalLT1",$mysoc->country_code).' ';
1020
+								$totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' ';
1021 1021
 
1022
-								$totalvat.=vatrate(abs($tvakey),1).$tvacompl;
1023
-								$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
1022
+								$totalvat .= vatrate(abs($tvakey), 1).$tvacompl;
1023
+								$pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
1024 1024
 								$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1025 1025
 								$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
1026 1026
 							}
@@ -1030,11 +1030,11 @@  discard block
 block discarded – undo
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
 				//{
1033
-					foreach( $this->localtax2 as $localtax_type => $localtax_rate )
1033
+					foreach ($this->localtax2 as $localtax_type => $localtax_rate)
1034 1034
 					{
1035
-						if (in_array((string) $localtax_type, array('2','4','6'))) continue;
1035
+						if (in_array((string) $localtax_type, array('2', '4', '6'))) continue;
1036 1036
 
1037
-						foreach( $localtax_rate as $tvakey => $tvaval )
1037
+						foreach ($localtax_rate as $tvakey => $tvaval)
1038 1038
 						{
1039 1039
 							if ($tvakey != 0)    // On affiche pas taux 0
1040 1040
 							{
@@ -1043,16 +1043,16 @@  discard block
 block discarded – undo
1043 1043
 								$index++;
1044 1044
 								$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1045 1045
 
1046
-								$tvacompl='';
1047
-								if (preg_match('/\*/',$tvakey))
1046
+								$tvacompl = '';
1047
+								if (preg_match('/\*/', $tvakey))
1048 1048
 								{
1049
-									$tvakey=str_replace('*','',$tvakey);
1049
+									$tvakey = str_replace('*', '', $tvakey);
1050 1050
 									$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
1051 1051
 								}
1052
-								$totalvat = $outputlangs->transcountrynoentities("TotalLT2",$mysoc->country_code).' ';
1052
+								$totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' ';
1053 1053
 
1054
-								$totalvat.=vatrate(abs($tvakey),1).$tvacompl;
1055
-								$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
1054
+								$totalvat .= vatrate(abs($tvakey), 1).$tvacompl;
1055
+								$pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
1056 1056
 
1057 1057
 								$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1058 1058
 								$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
@@ -1064,24 +1064,24 @@  discard block
 block discarded – undo
1064 1064
 				// Total TTC
1065 1065
 				$index++;
1066 1066
 				$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1067
-				$pdf->SetTextColor(0,0,60);
1068
-				$pdf->SetFillColor(224,224,224);
1069
-				$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1);
1067
+				$pdf->SetTextColor(0, 0, 60);
1068
+				$pdf->SetFillColor(224, 224, 224);
1069
+				$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1);
1070 1070
 
1071 1071
 				$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1072 1072
 				$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc, 0, $outputlangs), $useborder, 'R', 1);
1073 1073
 			}
1074 1074
 		}
1075 1075
 
1076
-		$pdf->SetTextColor(0,0,0);
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;
1083 1083
 		$resteapayer = price2num($object->total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT');
1084
-		if (! empty($object->paye)) $resteapayer=0;
1084
+		if (!empty($object->paye)) $resteapayer = 0;
1085 1085
 
1086 1086
 		if ($deja_regle > 0)
1087 1087
 		{
@@ -1089,21 +1089,21 @@  discard block
 block discarded – undo
1089 1089
 			$index++;
1090 1090
 
1091 1091
 			$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1092
-			$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("AlreadyPaid"), 0, 'L', 0);
1092
+			$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("AlreadyPaid"), 0, 'L', 0);
1093 1093
 			$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1094 1094
 			$pdf->MultiCell($largcol2, $tab2_hl, price($deja_regle, 0, $outputlangs), 0, 'R', 0);
1095 1095
 
1096 1096
 			$index++;
1097
-			$pdf->SetTextColor(0,0,60);
1098
-			$pdf->SetFillColor(224,224,224);
1097
+			$pdf->SetTextColor(0, 0, 60);
1098
+			$pdf->SetFillColor(224, 224, 224);
1099 1099
 			$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1100
-			$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("RemainderToPay"), $useborder, 'L', 1);
1100
+			$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("RemainderToPay"), $useborder, 'L', 1);
1101 1101
 
1102 1102
 			$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1103 1103
 			$pdf->MultiCell($largcol2, $tab2_hl, price($resteapayer, 0, $outputlangs), $useborder, 'R', 1);
1104 1104
 
1105
-			$pdf->SetFont('','', $default_font_size - 1);
1106
-			$pdf->SetTextColor(0,0,0);
1105
+			$pdf->SetFont('', '', $default_font_size - 1);
1106
+			$pdf->SetTextColor(0, 0, 0);
1107 1107
 		}
1108 1108
 
1109 1109
 		$index++;
@@ -1122,75 +1122,75 @@  discard block
 block discarded – undo
1122 1122
 	 *   @param		int			$hidebottom		Hide bottom bar of array
1123 1123
 	 *   @return	void
1124 1124
 	 */
1125
-	function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
1125
+	function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
1126 1126
 	{
1127 1127
 		global $conf;
1128 1128
 
1129 1129
 		// Force to disable hidetop and hidebottom
1130
-		$hidebottom=0;
1131
-		if ($hidetop) $hidetop=-1;
1130
+		$hidebottom = 0;
1131
+		if ($hidetop) $hidetop = -1;
1132 1132
 
1133 1133
 		$default_font_size = pdf_getPDFFontSize($outputlangs);
1134 1134
 
1135 1135
 		// Amount in (at tab_top - 1)
1136
-		$pdf->SetTextColor(0,0,0);
1137
-		$pdf->SetFont('','', $default_font_size - 2);
1136
+		$pdf->SetTextColor(0, 0, 0);
1137
+		$pdf->SetFont('', '', $default_font_size - 2);
1138 1138
 
1139 1139
 		if (empty($hidetop))
1140 1140
 		{
1141
-			$titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$conf->currency));
1142
-			$pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4);
1141
+			$titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$conf->currency));
1142
+			$pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4);
1143 1143
 			$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
1144 1144
 
1145 1145
 			//$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230';
1146
-			if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, 5, 'F', null, explode(',',$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR));
1146
+			if (!empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR));
1147 1147
 		}
1148 1148
 
1149
-		$pdf->SetDrawColor(128,128,128);
1150
-		$pdf->SetFont('','', $default_font_size - 1);
1149
+		$pdf->SetDrawColor(128, 128, 128);
1150
+		$pdf->SetFont('', '', $default_font_size - 1);
1151 1151
 
1152 1152
 		// Output Rect
1153
-		$this->printRect($pdf,$this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom);	// Rect prend une longueur en 3eme param et 4eme param
1153
+		$this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param
1154 1154
 
1155 1155
 		if (empty($hidetop))
1156 1156
 		{
1157
-			$pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5);	// line prend une position y en 2eme param et 4eme param
1157
+			$pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur - $this->marge_droite, $tab_top + 5); // line prend une position y en 2eme param et 4eme param
1158 1158
 
1159
-			$pdf->SetXY($this->posxdesc-1, $tab_top+1);
1160
-			$pdf->MultiCell(108,2, $outputlangs->transnoentities("Designation"),'','L');
1159
+			$pdf->SetXY($this->posxdesc - 1, $tab_top + 1);
1160
+			$pdf->MultiCell(108, 2, $outputlangs->transnoentities("Designation"), '', 'L');
1161 1161
 		}
1162 1162
 
1163 1163
 		if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
1164 1164
 		{
1165
-			$pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height);
1165
+			$pdf->line($this->posxtva - 1, $tab_top, $this->posxtva - 1, $tab_top + $tab_height);
1166 1166
 			if (empty($hidetop))
1167 1167
 			{
1168
-				$pdf->SetXY($this->posxtva-3, $tab_top+1);
1169
-				$pdf->MultiCell($this->posxup-$this->posxtva+3,2, $outputlangs->transnoentities("VAT"),'','C');
1168
+				$pdf->SetXY($this->posxtva - 3, $tab_top + 1);
1169
+				$pdf->MultiCell($this->posxup - $this->posxtva + 3, 2, $outputlangs->transnoentities("VAT"), '', 'C');
1170 1170
 			}
1171 1171
 		}
1172 1172
 
1173
-		$pdf->line($this->posxup-1, $tab_top, $this->posxup-1, $tab_top + $tab_height);
1173
+		$pdf->line($this->posxup - 1, $tab_top, $this->posxup - 1, $tab_top + $tab_height);
1174 1174
 		if (empty($hidetop))
1175 1175
 		{
1176
-			$pdf->SetXY($this->posxup-1, $tab_top+1);
1177
-			$pdf->MultiCell($this->posxqty-$this->posxup-1,2, $outputlangs->transnoentities("PriceUHT"),'','C');
1176
+			$pdf->SetXY($this->posxup - 1, $tab_top + 1);
1177
+			$pdf->MultiCell($this->posxqty - $this->posxup - 1, 2, $outputlangs->transnoentities("PriceUHT"), '', 'C');
1178 1178
 		}
1179 1179
 
1180
-		$pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height);
1180
+		$pdf->line($this->posxqty - 1, $tab_top, $this->posxqty - 1, $tab_top + $tab_height);
1181 1181
 		if (empty($hidetop))
1182 1182
 		{
1183
-			$pdf->SetXY($this->posxqty-1, $tab_top+1);
1184
-			$pdf->MultiCell($this->posxdiscount-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C');
1183
+			$pdf->SetXY($this->posxqty - 1, $tab_top + 1);
1184
+			$pdf->MultiCell($this->posxdiscount - $this->posxqty - 1, 2, $outputlangs->transnoentities("Qty"), '', 'C');
1185 1185
 		}
1186 1186
 
1187
-		$pdf->line($this->posxdiscount-1, $tab_top, $this->posxdiscount-1, $tab_top + $tab_height);
1187
+		$pdf->line($this->posxdiscount - 1, $tab_top, $this->posxdiscount - 1, $tab_top + $tab_height);
1188 1188
 		if (empty($hidetop))
1189 1189
 		{
1190 1190
 			if ($this->atleastonediscount)
1191 1191
 			{
1192
-				$pdf->SetXY($this->posxdiscount-1, $tab_top+1);
1193
-				$pdf->MultiCell($this->postotalht-$this->posxdiscount+1,2, $outputlangs->transnoentities("ReductionShort"),'','C');
1192
+				$pdf->SetXY($this->posxdiscount - 1, $tab_top + 1);
1193
+				$pdf->MultiCell($this->postotalht - $this->posxdiscount + 1, 2, $outputlangs->transnoentities("ReductionShort"), '', 'C');
1194 1194
 			}
1195 1195
 		}
1196 1196
 
@@ -1200,8 +1200,8 @@  discard block
 block discarded – undo
1200 1200
 		}
1201 1201
 		if (empty($hidetop))
1202 1202
 		{
1203
-			$pdf->SetXY($this->postotalht-1, $tab_top+1);
1204
-			$pdf->MultiCell(30,2, $outputlangs->transnoentities("TotalHT"),'','C');
1203
+			$pdf->SetXY($this->postotalht - 1, $tab_top + 1);
1204
+			$pdf->MultiCell(30, 2, $outputlangs->transnoentities("TotalHT"), '', 'C');
1205 1205
 		}
1206 1206
 	}
1207 1207
 
@@ -1216,7 +1216,7 @@  discard block
 block discarded – undo
1216 1216
 	 */
1217 1217
 	function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
1218 1218
 	{
1219
-		global $conf,$langs,$hookmanager;
1219
+		global $conf, $langs, $hookmanager;
1220 1220
 
1221 1221
 		$outputlangs->load("main");
1222 1222
 		$outputlangs->load("bills");
@@ -1225,75 +1225,75 @@  discard block
 block discarded – undo
1225 1225
 		$outputlangs->load("orders");
1226 1226
 		$default_font_size = pdf_getPDFFontSize($outputlangs);
1227 1227
 
1228
-		pdf_pagehead($pdf,$outputlangs,$this->page_hauteur);
1228
+		pdf_pagehead($pdf, $outputlangs, $this->page_hauteur);
1229 1229
 
1230 1230
 		// Show Draft Watermark
1231
-		if($object->statut==0 && (! empty($conf->global->COMMANDE_DRAFT_WATERMARK)) )
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
-		$pdf->SetTextColor(0,0,60);
1237
-		$pdf->SetFont('','B', $default_font_size + 3);
1236
+		$pdf->SetTextColor(0, 0, 60);
1237
+		$pdf->SetFont('', 'B', $default_font_size + 3);
1238 1238
 
1239
-		$posy=$this->marge_haute;
1240
-		$posx=$this->page_largeur-$this->marge_droite-100;
1239
+		$posy = $this->marge_haute;
1240
+		$posx = $this->page_largeur - $this->marge_droite - 100;
1241 1241
 
1242
-		$pdf->SetXY($this->marge_gauche,$posy);
1242
+		$pdf->SetXY($this->marge_gauche, $posy);
1243 1243
 
1244 1244
 		// Logo
1245
-		$logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
1245
+		$logo = $conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
1246 1246
 		if ($this->emetteur->logo)
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
 			{
1255
-				$pdf->SetTextColor(200,0,0);
1256
-				$pdf->SetFont('','B', $default_font_size -2);
1257
-				$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L');
1255
+				$pdf->SetTextColor(200, 0, 0);
1256
+				$pdf->SetFont('', 'B', $default_font_size - 2);
1257
+				$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L');
1258 1258
 				$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
1259 1259
 			}
1260 1260
 		}
1261 1261
 		else
1262 1262
 		{
1263
-			$text=$this->emetteur->name;
1263
+			$text = $this->emetteur->name;
1264 1264
 			$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
1265 1265
 		}
1266 1266
 
1267
-		$pdf->SetFont('','B', $default_font_size + 3);
1268
-		$pdf->SetXY($posx,$posy);
1269
-		$pdf->SetTextColor(0,0,60);
1270
-		$title=$outputlangs->transnoentities("Order");
1267
+		$pdf->SetFont('', 'B', $default_font_size + 3);
1268
+		$pdf->SetXY($posx, $posy);
1269
+		$pdf->SetTextColor(0, 0, 60);
1270
+		$title = $outputlangs->transnoentities("Order");
1271 1271
 		$pdf->MultiCell(100, 3, $title, '', 'R');
1272 1272
 
1273
-		$pdf->SetFont('','B',$default_font_size);
1273
+		$pdf->SetFont('', 'B', $default_font_size);
1274 1274
 
1275
-		$posy+=5;
1276
-		$pdf->SetXY($posx,$posy);
1277
-		$pdf->SetTextColor(0,0,60);
1278
-		$pdf->MultiCell(100, 4, $outputlangs->transnoentities("Ref")." : " . $outputlangs->convToOutputCharset($object->ref), '', 'R');
1275
+		$posy += 5;
1276
+		$pdf->SetXY($posx, $posy);
1277
+		$pdf->SetTextColor(0, 0, 60);
1278
+		$pdf->MultiCell(100, 4, $outputlangs->transnoentities("Ref")." : ".$outputlangs->convToOutputCharset($object->ref), '', 'R');
1279 1279
 
1280
-		$posy+=1;
1281
-		$pdf->SetFont('','', $default_font_size - 1);
1280
+		$posy += 1;
1281
+		$pdf->SetFont('', '', $default_font_size - 1);
1282 1282
 
1283 1283
 		if ($object->ref_client)
1284 1284
 		{
1285
-			$posy+=5;
1286
-			$pdf->SetXY($posx,$posy);
1287
-			$pdf->SetTextColor(0,0,60);
1288
-			$pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : " . $outputlangs->convToOutputCharset($object->ref_client), '', 'R');
1285
+			$posy += 5;
1286
+			$pdf->SetXY($posx, $posy);
1287
+			$pdf->SetTextColor(0, 0, 60);
1288
+			$pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R');
1289 1289
 		}
1290 1290
 
1291
-		$posy+=4;
1292
-		$pdf->SetXY($posx,$posy);
1293
-		$pdf->SetTextColor(0,0,60);
1294
-		$pdf->MultiCell(100, 3, $outputlangs->transnoentities("OrderDate")." : " . dol_print_date($object->date,"%d %b %Y",false,$outputlangs,true), '', 'R');
1291
+		$posy += 4;
1292
+		$pdf->SetXY($posx, $posy);
1293
+		$pdf->SetTextColor(0, 0, 60);
1294
+		$pdf->MultiCell(100, 3, $outputlangs->transnoentities("OrderDate")." : ".dol_print_date($object->date, "%d %b %Y", false, $outputlangs, true), '', 'R');
1295 1295
 
1296
-		$posy+=2;
1296
+		$posy += 2;
1297 1297
 
1298 1298
 		// Show list of linked objects
1299 1299
 		$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size);
@@ -1304,84 +1304,84 @@  discard block
 block discarded – undo
1304 1304
 			$carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty);
1305 1305
 
1306 1306
 			// Show sender
1307
-			$posy=42;
1308
-			$posx=$this->marge_gauche;
1309
-			if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->page_largeur-$this->marge_droite-80;
1310
-			$hautcadre=40;
1307
+			$posy = 42;
1308
+			$posx = $this->marge_gauche;
1309
+			if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->page_largeur - $this->marge_droite - 80;
1310
+			$hautcadre = 40;
1311 1311
 
1312 1312
 			// Show sender frame
1313
-			$pdf->SetTextColor(0,0,0);
1314
-			$pdf->SetFont('','', $default_font_size - 2);
1315
-			$pdf->SetXY($posx,$posy-5);
1316
-			$pdf->MultiCell(66,5, $outputlangs->transnoentities("BillFrom").":", 0, 'L');
1317
-			$pdf->SetXY($posx,$posy);
1318
-			$pdf->SetFillColor(230,230,230);
1313
+			$pdf->SetTextColor(0, 0, 0);
1314
+			$pdf->SetFont('', '', $default_font_size - 2);
1315
+			$pdf->SetXY($posx, $posy - 5);
1316
+			$pdf->MultiCell(66, 5, $outputlangs->transnoentities("BillFrom").":", 0, 'L');
1317
+			$pdf->SetXY($posx, $posy);
1318
+			$pdf->SetFillColor(230, 230, 230);
1319 1319
 			$pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1);
1320
-			$pdf->SetTextColor(0,0,60);
1320
+			$pdf->SetTextColor(0, 0, 60);
1321 1321
 
1322 1322
 			// Show sender name
1323
-			$pdf->SetXY($posx+2,$posy+3);
1324
-			$pdf->SetFont('','B', $default_font_size);
1323
+			$pdf->SetXY($posx + 2, $posy + 3);
1324
+			$pdf->SetFont('', 'B', $default_font_size);
1325 1325
 			$pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L');
1326
-			$posy=$pdf->getY();
1326
+			$posy = $pdf->getY();
1327 1327
 
1328 1328
 			// Show sender information
1329
-			$pdf->SetXY($posx+2,$posy);
1330
-			$pdf->SetFont('','', $default_font_size - 1);
1329
+			$pdf->SetXY($posx + 2, $posy);
1330
+			$pdf->SetFont('', '', $default_font_size - 1);
1331 1331
 			$pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L');
1332 1332
 
1333 1333
 
1334 1334
 
1335 1335
 			// If CUSTOMER contact defined on order, we use it
1336
-			$usecontact=false;
1337
-			$arrayidcontact=$object->getIdContact('external','CUSTOMER');
1336
+			$usecontact = false;
1337
+			$arrayidcontact = $object->getIdContact('external', 'CUSTOMER');
1338 1338
 			if (count($arrayidcontact) > 0)
1339 1339
 			{
1340
-				$usecontact=true;
1341
-				$result=$object->fetch_contact($arrayidcontact[0]);
1340
+				$usecontact = true;
1341
+				$result = $object->fetch_contact($arrayidcontact[0]);
1342 1342
 			}
1343 1343
 
1344 1344
 			// Recipient name
1345
-			if (! empty($usecontact))
1345
+			if (!empty($usecontact))
1346 1346
 			{
1347 1347
 				// On peut utiliser le nom de la societe du contact
1348
-				if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname;
1348
+				if (!empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname;
1349 1349
 				else $socname = $object->thirdparty->name;
1350
-				$carac_client_name=$outputlangs->convToOutputCharset($socname);
1350
+				$carac_client_name = $outputlangs->convToOutputCharset($socname);
1351 1351
 			}
1352 1352
 			else
1353 1353
 			{
1354
-				$carac_client_name=$outputlangs->convToOutputCharset($object->thirdparty->name);
1354
+				$carac_client_name = $outputlangs->convToOutputCharset($object->thirdparty->name);
1355 1355
 			}
1356 1356
 
1357
-			$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->thirdparty,($usecontact?$object->contact:''),$usecontact,'target');
1357
+			$carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact : ''), $usecontact, 'target');
1358 1358
 
1359 1359
 			// Show recipient
1360
-			$widthrecbox=100;
1361
-			if ($this->page_largeur < 210) $widthrecbox=84;	// To work with US executive format
1362
-			$posy=42;
1363
-			$posx=$this->page_largeur-$this->marge_droite-$widthrecbox;
1364
-			if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche;
1360
+			$widthrecbox = 100;
1361
+			if ($this->page_largeur < 210) $widthrecbox = 84; // To work with US executive format
1362
+			$posy = 42;
1363
+			$posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
1364
+			if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->marge_gauche;
1365 1365
 
1366 1366
 			// Show recipient frame
1367
-			$pdf->SetTextColor(0,0,0);
1368
-			$pdf->SetFont('','', $default_font_size - 2);
1369
-			$pdf->SetXY($posx+2,$posy-5);
1370
-			$pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo").":",0,'L');
1367
+			$pdf->SetTextColor(0, 0, 0);
1368
+			$pdf->SetFont('', '', $default_font_size - 2);
1369
+			$pdf->SetXY($posx + 2, $posy - 5);
1370
+			$pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo").":", 0, 'L');
1371 1371
 			$pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
1372 1372
 
1373 1373
 			// Show recipient name
1374
-			$pdf->SetXY($posx+2,$posy+3);
1375
-			$pdf->SetFont('','B', $default_font_size);
1374
+			$pdf->SetXY($posx + 2, $posy + 3);
1375
+			$pdf->SetFont('', 'B', $default_font_size);
1376 1376
 			$pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L');
1377 1377
 
1378 1378
 			// Show recipient information
1379
-			$pdf->SetFont('','', $default_font_size - 1);
1380
-			$pdf->SetXY($posx+2,$posy+4+(dol_nboflines_bis($carac_client_name,50)*4));
1379
+			$pdf->SetFont('', '', $default_font_size - 1);
1380
+			$pdf->SetXY($posx + 2, $posy + 4 + (dol_nboflines_bis($carac_client_name, 50) * 4));
1381 1381
 			$pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L');
1382 1382
 		}
1383 1383
 
1384
-		$pdf->SetTextColor(0,0,0);
1384
+		$pdf->SetTextColor(0, 0, 0);
1385 1385
 	}
1386 1386
 
1387 1387
 	/**
@@ -1393,11 +1393,11 @@  discard block
 block discarded – undo
1393 1393
 	 *      @param	int			$hidefreetext		1=Hide free text
1394 1394
 	 *      @return	int								Return height of bottom margin including footer text
1395 1395
 	 */
1396
-	function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0)
1396
+	function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
1397 1397
 	{
1398
-		$showdetails=0;
1399
-		$free_text = (float)DOL_VERSION > 3.8 ? 'ORDER_FREE_TEXT' : 'COMMANDE_FREE_TEXT';
1400
-		return pdf_pagefoot($pdf,$outputlangs,$free_text,$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext);
1398
+		$showdetails = 0;
1399
+		$free_text = (float) DOL_VERSION > 3.8 ? 'ORDER_FREE_TEXT' : 'COMMANDE_FREE_TEXT';
1400
+		return pdf_pagefoot($pdf, $outputlangs, $free_text, $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
1401 1401
 	}
1402 1402
 
1403 1403
 }
Please login to merge, or discard this patch.
Braces   +147 added lines, -76 removed lines patch added patch discarded remove patch
@@ -100,7 +100,10 @@  discard block
 block discarded – undo
100 100
 
101 101
 		// Get source company
102 102
 		$this->emetteur=$mysoc;
103
-		if (empty($this->emetteur->country_code)) $this->emetteur->country_code=substr($langs->defaultlang,-2);    // By default, if was not defined
103
+		if (empty($this->emetteur->country_code)) {
104
+			$this->emetteur->country_code=substr($langs->defaultlang,-2);
105
+		}
106
+		// By default, if was not defined
104 107
 
105 108
 		// Define position of columns
106 109
 		$this->posxdesc=$this->marge_gauche+1;
@@ -109,11 +112,15 @@  discard block
 block discarded – undo
109 112
 		$this->posxqty=145;
110 113
 		$this->posxdiscount=162;
111 114
 		$this->postotalht=174;
112
-		if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva=$this->posxup;
115
+		if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) {
116
+			$this->posxtva=$this->posxup;
117
+		}
113 118
 		$this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH);	// width of images
114
-		if ($this->page_largeur < 210) // To work with US executive format
119
+		if ($this->page_largeur < 210) {
120
+			// To work with US executive format
115 121
 		{
116 122
 			$this->posxpicture-=20;
123
+		}
117 124
 			$this->posxtva-=20;
118 125
 			$this->posxup-=20;
119 126
 			$this->posxqty-=20;
@@ -143,9 +150,13 @@  discard block
 block discarded – undo
143 150
 	{
144 151
 		global $user,$langs,$conf,$mysoc,$db,$hookmanager;
145 152
 
146
-		if (! is_object($outputlangs)) $outputlangs=$langs;
153
+		if (! is_object($outputlangs)) {
154
+			$outputlangs=$langs;
155
+		}
147 156
 		// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
148
-		if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
157
+		if (! empty($conf->global->MAIN_USE_FPDF)) {
158
+			$outputlangs->charset_output='ISO-8859-1';
159
+		}
149 160
 
150 161
 		$outputlangs->load("main");
151 162
 		$outputlangs->load("dict");
@@ -170,8 +181,7 @@  discard block
 block discarded – undo
170 181
 			{
171 182
 				$dir = $conf->commande->dir_output;
172 183
 				$file = $dir . "/SPECIMEN.pdf";
173
-			}
174
-			else
184
+			} else
175 185
 			{
176 186
 				$objectref = dol_sanitizeFileName($object->ref);
177 187
 				$dir = $conf->commande->dir_output . "/" . $objectref;
@@ -230,7 +240,9 @@  discard block
 block discarded – undo
230 240
 				$pdf->SetCreator("Dolibarr ".DOL_VERSION);
231 241
 				$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
232 242
 				$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Order"));
233
-				if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
243
+				if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) {
244
+					$pdf->SetCompression(false);
245
+				}
234 246
 
235 247
 				$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);   // Left, Top, Right
236 248
 
@@ -254,7 +266,9 @@  discard block
 block discarded – undo
254 266
 
255 267
 				// New page
256 268
 				$pdf->AddPage();
257
-				if (! empty($tplidx)) $pdf->useTemplate($tplidx);
269
+				if (! empty($tplidx)) {
270
+					$pdf->useTemplate($tplidx);
271
+				}
258 272
 				$pagenb++;
259 273
 				$this->_pagehead($pdf, $object, 1, $outputlangs);
260 274
 				$pdf->SetFont('','', $default_font_size - 1);
@@ -277,7 +291,9 @@  discard block
 block discarded – undo
277 291
 						$salereparray=$object->thirdparty->getSalesRepresentatives($user);
278 292
 						$salerepobj=new User($this->db);
279 293
 						$salerepobj->fetch($salereparray[0]['id']);
280
-						if (! empty($salerepobj->signature)) $notetoshow=dol_concatdesc($notetoshow, $salerepobj->signature);
294
+						if (! empty($salerepobj->signature)) {
295
+							$notetoshow=dol_concatdesc($notetoshow, $salerepobj->signature);
296
+						}
281 297
 					}
282 298
 				}
283 299
 				if ($notetoshow)
@@ -295,8 +311,7 @@  discard block
 block discarded – undo
295 311
 
296 312
 					$tab_height = $tab_height - $height_note;
297 313
 					$tab_top = $nexY+6;
298
-				}
299
-				else
314
+				} else
300 315
 				{
301 316
 					$height_note=0;
302 317
 				}
@@ -391,32 +406,38 @@  discard block
 block discarded – undo
391 406
 					$pdf->startTransaction();
392 407
 					pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,$hideref,$hidedesc);
393 408
 					$pageposafter=$pdf->getPage();
394
-					if ($pageposafter > $pageposbefore)	// There is a pagebreak
409
+					if ($pageposafter > $pageposbefore) {
410
+						// There is a pagebreak
395 411
 					{
396 412
 						$pdf->rollbackTransaction(true);
413
+					}
397 414
 						$pageposafter=$pageposbefore;
398 415
 						//print $pageposafter.'-'.$pageposbefore;exit;
399 416
 						$pdf->setPageOrientation('', 1, $heightforfooter);	// The only function to edit the bottom margin of current page to set it.
400 417
 						pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,4,$curX,$curY,$hideref,$hidedesc);
401 418
 						$pageposafter=$pdf->getPage();
402 419
 						$posyafter=$pdf->GetY();
403
-						if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot)))	// There is no space left for total+free text
420
+						if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) {
421
+							// There is no space left for total+free text
404 422
 						{
405 423
 							if ($i == ($nblignes-1))	// No more lines, and no space left to show total, so we create a new page
406 424
 							{
407 425
 								$pdf->AddPage('','',true);
408
-								if (! empty($tplidx)) $pdf->useTemplate($tplidx);
409
-								if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
426
+						}
427
+								if (! empty($tplidx)) {
428
+									$pdf->useTemplate($tplidx);
429
+								}
430
+								if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
431
+									$this->_pagehead($pdf, $object, 0, $outputlangs);
432
+								}
410 433
 								$pdf->setPage($pageposafter+1);
411 434
 							}
412
-						}
413
-						else
435
+						} else
414 436
 						{
415 437
 							// We found a page break
416 438
 							$showpricebeforepagebreak=0;
417 439
 						}
418
-					}
419
-					else	// No pagebreak
440
+					} else	// No pagebreak
420 441
 					{
421 442
 						$pdf->commitTransaction();
422 443
 					}
@@ -508,29 +529,43 @@  discard block
 block discarded – undo
508 529
 					$localtax1_type=$object->lines[$i]->localtax1_type;
509 530
 					$localtax2_type=$object->lines[$i]->localtax2_type;
510 531
 
511
-					if ($object->remise_percent) $tvaligne-=($tvaligne*$object->remise_percent)/100;
512
-					if ($object->remise_percent) $localtax1ligne-=($localtax1ligne*$object->remise_percent)/100;
513
-					if ($object->remise_percent) $localtax2ligne-=($localtax2ligne*$object->remise_percent)/100;
532
+					if ($object->remise_percent) {
533
+						$tvaligne-=($tvaligne*$object->remise_percent)/100;
534
+					}
535
+					if ($object->remise_percent) {
536
+						$localtax1ligne-=($localtax1ligne*$object->remise_percent)/100;
537
+					}
538
+					if ($object->remise_percent) {
539
+						$localtax2ligne-=($localtax2ligne*$object->remise_percent)/100;
540
+					}
514 541
 
515 542
 					$vatrate=(string) $object->lines[$i]->tva_tx;
516 543
 					
517 544
 					// Retrieve type from database for backward compatibility with old records
518 545
 					if ((! isset($localtax1_type) || $localtax1_type=='' || ! isset($localtax2_type) || $localtax2_type=='') // if tax type not defined
519
-					&& (! empty($localtax1_rate) || ! empty($localtax2_rate))) // and there is local tax
546
+					&& (! empty($localtax1_rate) || ! empty($localtax2_rate))) {
547
+						// and there is local tax
520 548
 					{
521 549
 						$localtaxtmp_array=getLocalTaxesFromRate($vatrate,0,$object->thirdparty,$mysoc);
550
+					}
522 551
 						$localtax1_type = $localtaxtmp_array[0];
523 552
 						$localtax2_type = $localtaxtmp_array[2];
524 553
 					}
525 554
 
526 555
 				    // retrieve global local tax
527
-					if ($localtax1_type && $localtax1ligne != 0)
528
-						$this->localtax1[$localtax1_type][$localtax1_rate]+=$localtax1ligne;
529
-					if ($localtax2_type && $localtax2ligne != 0)
530
-						$this->localtax2[$localtax2_type][$localtax2_rate]+=$localtax2ligne;
556
+					if ($localtax1_type && $localtax1ligne != 0) {
557
+											$this->localtax1[$localtax1_type][$localtax1_rate]+=$localtax1ligne;
558
+					}
559
+					if ($localtax2_type && $localtax2ligne != 0) {
560
+											$this->localtax2[$localtax2_type][$localtax2_rate]+=$localtax2ligne;
561
+					}
531 562
 
532
-					if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*';
533
-					if (! isset($this->tva[$vatrate])) 				$this->tva[$vatrate]='';
563
+					if (($object->lines[$i]->info_bits & 0x01) == 0x01) {
564
+						$vatrate.='*';
565
+					}
566
+					if (! isset($this->tva[$vatrate])) {
567
+						$this->tva[$vatrate]='';
568
+					}
534 569
 					
535 570
 					if (!empty($object->lines[$i]->TTotal_tva))
536 571
 					{
@@ -538,8 +573,7 @@  discard block
 block discarded – undo
538 573
 						{
539 574
 							$this->tva[$vatrate] += $tvaligne;
540 575
 						}
541
-					}
542
-					else {
576
+					} else {
543 577
 						// standard
544 578
 						$this->tva[$vatrate] += $tvaligne;
545 579
 					}
@@ -563,8 +597,7 @@  discard block
 block discarded – undo
563 597
 						if ($pagenb == 1)
564 598
 						{
565 599
 							$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
566
-						}
567
-						else
600
+						} else
568 601
 						{
569 602
 							$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
570 603
 						}
@@ -572,24 +605,29 @@  discard block
 block discarded – undo
572 605
 						$pagenb++;
573 606
 						$pdf->setPage($pagenb);
574 607
 						$pdf->setPageOrientation('', 1, 0);	// The only function to edit the bottom margin of current page to set it.
575
-						if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
608
+						if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
609
+							$this->_pagehead($pdf, $object, 0, $outputlangs);
610
+						}
576 611
 					}
577 612
 					if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak)
578 613
 					{
579 614
 						if ($pagenb == 1)
580 615
 						{
581 616
 							$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
582
-						}
583
-						else
617
+						} else
584 618
 						{
585 619
 							$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
586 620
 						}
587 621
 						$this->_pagefoot($pdf,$object,$outputlangs,1);
588 622
 						// New page
589 623
 						$pdf->AddPage();
590
-						if (! empty($tplidx)) $pdf->useTemplate($tplidx);
624
+						if (! empty($tplidx)) {
625
+							$pdf->useTemplate($tplidx);
626
+						}
591 627
 						$pagenb++;
592
-						if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
628
+						if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
629
+							$this->_pagehead($pdf, $object, 0, $outputlangs);
630
+						}
593 631
 					}
594 632
 				}
595 633
 
@@ -598,8 +636,7 @@  discard block
 block discarded – undo
598 636
 				{
599 637
 					$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
600 638
 					$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
601
-				}
602
-				else
639
+				} else
603 640
 				{
604 641
 					$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
605 642
 					$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
@@ -621,7 +658,9 @@  discard block
 block discarded – undo
621 658
 
622 659
 				// Pied de page
623 660
 				$this->_pagefoot($pdf,$object,$outputlangs);
624
-				if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();
661
+				if (method_exists($pdf,'AliasNbPages')) {
662
+					$pdf->AliasNbPages();
663
+				}
625 664
 
626 665
 				$pdf->Close();
627 666
 
@@ -633,18 +672,17 @@  discard block
 block discarded – undo
633 672
 				global $action;
634 673
 				$reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action);    // Note that $action and $object may have been modified by some hooks
635 674
 
636
-				if (! empty($conf->global->MAIN_UMASK))
637
-					@chmod($file, octdec($conf->global->MAIN_UMASK));
675
+				if (! empty($conf->global->MAIN_UMASK)) {
676
+									@chmod($file, octdec($conf->global->MAIN_UMASK));
677
+				}
638 678
 
639 679
 				return 1;   // Pas d'erreur
640
-			}
641
-			else
680
+			} else
642 681
 			{
643 682
 				$this->error=$langs->trans("ErrorCanNotCreateDir",$dir);
644 683
 				return 0;
645 684
 			}
646
-		}
647
-		else
685
+		} else
648 686
 		{
649 687
 			$this->error=$langs->trans("ErrorConstantNotDefined","COMMANDE_OUTPUTDIR");
650 688
 			return 0;
@@ -754,10 +792,11 @@  discard block
 block discarded – undo
754 792
 			$pdf->MultiCell(80, 4, $dlp, 0, 'L');
755 793
 
756 794
             $posy=$pdf->GetY()+1;
757
-		}
758
-        elseif ($object->availability_code || $object->availability)    // Show availability conditions
795
+		} elseif ($object->availability_code || $object->availability) {
796
+        	// Show availability conditions
759 797
 		{
760 798
 			$pdf->SetFont('','B', $default_font_size - 2);
799
+        }
761 800
 			$pdf->SetXY($this->marge_gauche, $posy);
762 801
 			$titre = $outputlangs->transnoentities("AvailabilityPeriod").':';
763 802
 			$pdf->MultiCell(80, 4, $titre, 0, 'L');
@@ -875,10 +914,12 @@  discard block
 block discarded – undo
875 914
 
876 915
 		// Tableau total
877 916
         $col1x = 120; $col2x = 170;
878
-		if ($this->page_largeur < 210) // To work with US executive format
917
+		if ($this->page_largeur < 210) {
918
+			// To work with US executive format
879 919
 		{
880 920
 			$col2x-=20;
881 921
 		}
922
+		}
882 923
 		$largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
883 924
 
884 925
 		$useborder=0;
@@ -902,22 +943,25 @@  discard block
 block discarded – undo
902 943
 			if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_ISNULL) && $tvaisnull)
903 944
 			{
904 945
 				// Nothing to do
905
-			}
906
-			else
946
+			} else
907 947
 			{
908 948
 				//Local tax 1 before VAT
909 949
 				//if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on')
910 950
 				//{
911 951
 					foreach( $this->localtax1 as $localtax_type => $localtax_rate )
912 952
 					{
913
-						if (in_array((string) $localtax_type, array('1','3','5'))) continue;
953
+						if (in_array((string) $localtax_type, array('1','3','5'))) {
954
+							continue;
955
+						}
914 956
 						foreach( $localtax_rate as $tvakey => $tvaval )
915 957
 						{
916
-							if ($tvakey!=0)    // On affiche pas taux 0
958
+							if ($tvakey!=0) {
959
+								// On affiche pas taux 0
917 960
 							{
918 961
 								//$this->atleastoneratenotnull++;
919 962
 
920 963
 								$index++;
964
+							}
921 965
 								$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
922 966
 
923 967
 								$tvacompl='';
@@ -941,16 +985,20 @@  discard block
 block discarded – undo
941 985
 				//{
942 986
 					foreach( $this->localtax2 as $localtax_type => $localtax_rate )
943 987
 					{
944
-						if (in_array((string) $localtax_type, array('1','3','5'))) continue;
988
+						if (in_array((string) $localtax_type, array('1','3','5'))) {
989
+							continue;
990
+						}
945 991
 						foreach( $localtax_rate as $tvakey => $tvaval )
946 992
 						{
947
-							if ($tvakey!=0)    // On affiche pas taux 0
993
+							if ($tvakey!=0) {
994
+								// On affiche pas taux 0
948 995
 							{
949 996
 								//$this->atleastoneratenotnull++;
950 997
 
951 998
 
952 999
 
953 1000
 								$index++;
1001
+							}
954 1002
 								$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
955 1003
 
956 1004
 								$tvacompl='';
@@ -973,9 +1021,11 @@  discard block
 block discarded – undo
973 1021
 				// VAT
974 1022
 				foreach($this->tva as $tvakey => $tvaval)
975 1023
 				{
976
-					if ($tvakey > 0)    // On affiche pas taux 0
1024
+					if ($tvakey > 0) {
1025
+						// On affiche pas taux 0
977 1026
 					{
978 1027
 						$this->atleastoneratenotnull++;
1028
+					}
979 1029
 
980 1030
 						$index++;
981 1031
 						$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
@@ -1000,15 +1050,19 @@  discard block
 block discarded – undo
1000 1050
 				//{
1001 1051
 					foreach( $this->localtax1 as $localtax_type => $localtax_rate )
1002 1052
 					{
1003
-						if (in_array((string) $localtax_type, array('2','4','6'))) continue;
1053
+						if (in_array((string) $localtax_type, array('2','4','6'))) {
1054
+							continue;
1055
+						}
1004 1056
 
1005 1057
 						foreach( $localtax_rate as $tvakey => $tvaval )
1006 1058
 						{
1007
-							if ($tvakey != 0)    // On affiche pas taux 0
1059
+							if ($tvakey != 0) {
1060
+								// On affiche pas taux 0
1008 1061
 							{
1009 1062
 								//$this->atleastoneratenotnull++;
1010 1063
 
1011 1064
 								$index++;
1065
+							}
1012 1066
 								$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1013 1067
 
1014 1068
 								$tvacompl='';
@@ -1032,15 +1086,19 @@  discard block
 block discarded – undo
1032 1086
 				//{
1033 1087
 					foreach( $this->localtax2 as $localtax_type => $localtax_rate )
1034 1088
 					{
1035
-						if (in_array((string) $localtax_type, array('2','4','6'))) continue;
1089
+						if (in_array((string) $localtax_type, array('2','4','6'))) {
1090
+							continue;
1091
+						}
1036 1092
 
1037 1093
 						foreach( $localtax_rate as $tvakey => $tvaval )
1038 1094
 						{
1039
-							if ($tvakey != 0)    // On affiche pas taux 0
1095
+							if ($tvakey != 0) {
1096
+								// On affiche pas taux 0
1040 1097
 							{
1041 1098
 								//$this->atleastoneratenotnull++;
1042 1099
 
1043 1100
 								$index++;
1101
+							}
1044 1102
 								$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1045 1103
 
1046 1104
 								$tvacompl='';
@@ -1081,7 +1139,9 @@  discard block
 block discarded – undo
1081 1139
 		//$depositsamount=$object->getSumDepositsUsed();
1082 1140
 		//print "x".$creditnoteamount."-".$depositsamount;exit;
1083 1141
 		$resteapayer = price2num($object->total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT');
1084
-		if (! empty($object->paye)) $resteapayer=0;
1142
+		if (! empty($object->paye)) {
1143
+			$resteapayer=0;
1144
+		}
1085 1145
 
1086 1146
 		if ($deja_regle > 0)
1087 1147
 		{
@@ -1128,7 +1188,9 @@  discard block
 block discarded – undo
1128 1188
 
1129 1189
 		// Force to disable hidetop and hidebottom
1130 1190
 		$hidebottom=0;
1131
-		if ($hidetop) $hidetop=-1;
1191
+		if ($hidetop) {
1192
+			$hidetop=-1;
1193
+		}
1132 1194
 
1133 1195
 		$default_font_size = pdf_getPDFFontSize($outputlangs);
1134 1196
 
@@ -1143,7 +1205,9 @@  discard block
 block discarded – undo
1143 1205
 			$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
1144 1206
 
1145 1207
 			//$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230';
1146
-			if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, 5, 'F', null, explode(',',$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR));
1208
+			if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) {
1209
+				$pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, 5, 'F', null, explode(',',$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR));
1210
+			}
1147 1211
 		}
1148 1212
 
1149 1213
 		$pdf->SetDrawColor(128,128,128);
@@ -1249,16 +1313,14 @@  discard block
 block discarded – undo
1249 1313
 			{
1250 1314
 			    $height=pdf_getHeightForLogo($logo);
1251 1315
 			    $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);	// width=0 (auto)
1252
-			}
1253
-			else
1316
+			} else
1254 1317
 			{
1255 1318
 				$pdf->SetTextColor(200,0,0);
1256 1319
 				$pdf->SetFont('','B', $default_font_size -2);
1257 1320
 				$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L');
1258 1321
 				$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
1259 1322
 			}
1260
-		}
1261
-		else
1323
+		} else
1262 1324
 		{
1263 1325
 			$text=$this->emetteur->name;
1264 1326
 			$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
@@ -1306,7 +1368,9 @@  discard block
 block discarded – undo
1306 1368
 			// Show sender
1307 1369
 			$posy=42;
1308 1370
 			$posx=$this->marge_gauche;
1309
-			if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->page_largeur-$this->marge_droite-80;
1371
+			if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
1372
+				$posx=$this->page_largeur-$this->marge_droite-80;
1373
+			}
1310 1374
 			$hautcadre=40;
1311 1375
 
1312 1376
 			// Show sender frame
@@ -1345,11 +1409,13 @@  discard block
 block discarded – undo
1345 1409
 			if (! empty($usecontact))
1346 1410
 			{
1347 1411
 				// On peut utiliser le nom de la societe du contact
1348
-				if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname;
1349
-				else $socname = $object->thirdparty->name;
1412
+				if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
1413
+					$socname = $object->contact->socname;
1414
+				} else {
1415
+					$socname = $object->thirdparty->name;
1416
+				}
1350 1417
 				$carac_client_name=$outputlangs->convToOutputCharset($socname);
1351
-			}
1352
-			else
1418
+			} else
1353 1419
 			{
1354 1420
 				$carac_client_name=$outputlangs->convToOutputCharset($object->thirdparty->name);
1355 1421
 			}
@@ -1358,10 +1424,15 @@  discard block
 block discarded – undo
1358 1424
 
1359 1425
 			// Show recipient
1360 1426
 			$widthrecbox=100;
1361
-			if ($this->page_largeur < 210) $widthrecbox=84;	// To work with US executive format
1427
+			if ($this->page_largeur < 210) {
1428
+				$widthrecbox=84;
1429
+			}
1430
+			// To work with US executive format
1362 1431
 			$posy=42;
1363 1432
 			$posx=$this->page_largeur-$this->marge_droite-$widthrecbox;
1364
-			if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche;
1433
+			if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
1434
+				$posx=$this->marge_gauche;
1435
+			}
1365 1436
 
1366 1437
 			// Show recipient frame
1367 1438
 			$pdf->SetTextColor(0,0,0);
Please login to merge, or discard this patch.
core/triggers/interface_90_modSubtotal_subtotaltrigger.class.php 3 patches
Indentation   +528 added lines, -528 removed lines patch added patch discarded remove patch
@@ -36,68 +36,68 @@  discard block
 block discarded – undo
36 36
 class Interfacesubtotaltrigger
37 37
 {
38 38
 
39
-    private $db;
40
-
41
-    /**
42
-     * Constructor
43
-     *
44
-     * 	@param		DoliDB		$db		Database handler
45
-     */
46
-    public function __construct($db)
47
-    {
48
-        $this->db = $db;
49
-
50
-        $this->name = preg_replace('/^Interface/i', '', get_class($this));
51
-        $this->family = "demo";
52
-        $this->description = "Triggers of this module are empty functions."
53
-            . "They have no effect."
54
-            . "They are provided for tutorial purpose only.";
55
-        // 'development', 'experimental', 'dolibarr' or version
56
-        $this->version = 'development';
57
-        $this->picto = 'titre@titre';
58
-    }
59
-
60
-    /**
61
-     * Trigger name
62
-     *
63
-     * 	@return		string	Name of trigger file
64
-     */
65
-    public function getName()
66
-    {
67
-        return $this->name;
68
-    }
69
-
70
-    /**
71
-     * Trigger description
72
-     *
73
-     * 	@return		string	Description of trigger file
74
-     */
75
-    public function getDesc()
76
-    {
77
-        return $this->description;
78
-    }
79
-
80
-    /**
81
-     * Trigger version
82
-     *
83
-     * 	@return		string	Version of trigger file
84
-     */
85
-    public function getVersion()
86
-    {
87
-        global $langs;
88
-        $langs->load("admin");
89
-
90
-        if ($this->version == 'development') {
91
-            return $langs->trans("Development");
92
-        } elseif ($this->version == 'experimental')
93
-
94
-                return $langs->trans("Experimental");
95
-        elseif ($this->version == 'dolibarr') return DOL_VERSION;
96
-        elseif ($this->version) return $this->version;
97
-        else {
98
-            return $langs->trans("Unknown");
99
-        }
100
-    }
39
+	private $db;
40
+
41
+	/**
42
+	 * Constructor
43
+	 *
44
+	 * 	@param		DoliDB		$db		Database handler
45
+	 */
46
+	public function __construct($db)
47
+	{
48
+		$this->db = $db;
49
+
50
+		$this->name = preg_replace('/^Interface/i', '', get_class($this));
51
+		$this->family = "demo";
52
+		$this->description = "Triggers of this module are empty functions."
53
+			. "They have no effect."
54
+			. "They are provided for tutorial purpose only.";
55
+		// 'development', 'experimental', 'dolibarr' or version
56
+		$this->version = 'development';
57
+		$this->picto = 'titre@titre';
58
+	}
59
+
60
+	/**
61
+	 * Trigger name
62
+	 *
63
+	 * 	@return		string	Name of trigger file
64
+	 */
65
+	public function getName()
66
+	{
67
+		return $this->name;
68
+	}
69
+
70
+	/**
71
+	 * Trigger description
72
+	 *
73
+	 * 	@return		string	Description of trigger file
74
+	 */
75
+	public function getDesc()
76
+	{
77
+		return $this->description;
78
+	}
79
+
80
+	/**
81
+	 * Trigger version
82
+	 *
83
+	 * 	@return		string	Version of trigger file
84
+	 */
85
+	public function getVersion()
86
+	{
87
+		global $langs;
88
+		$langs->load("admin");
89
+
90
+		if ($this->version == 'development') {
91
+			return $langs->trans("Development");
92
+		} elseif ($this->version == 'experimental')
93
+
94
+				return $langs->trans("Experimental");
95
+		elseif ($this->version == 'dolibarr') return DOL_VERSION;
96
+		elseif ($this->version) return $this->version;
97
+		else {
98
+			return $langs->trans("Unknown");
99
+		}
100
+	}
101 101
 	
102 102
 	public function addToBegin(&$parent, &$object, $rang)
103 103
 	{
@@ -147,27 +147,27 @@  discard block
 block discarded – undo
147 147
 		}
148 148
 	}
149 149
 	
150
-    /**
151
-     * Function called when a Dolibarrr business event is done.
152
-     * All functions "run_trigger" are triggered if file
153
-     * is inside directory core/triggers
154
-     *
155
-     * 	@param		string		$action		Event action code
156
-     * 	@param		Object		$object		Object
157
-     * 	@param		User		$user		Object user
158
-     * 	@param		Translate	$langs		Object langs
159
-     * 	@param		conf		$conf		Object conf
160
-     * 	@return		int						<0 if KO, 0 if no triggered ran, >0 if OK
161
-     */
162
-    public function run_trigger($action, $object, $user, $langs, $conf)
163
-    {
164
-        // Put here code you want to execute when a Dolibarr business events occurs.
165
-        // Data and type of action are stored into $object and $action
166
-        // Users
167
-        dol_include_once('/subtotal/class/subtotal.class.php');
168
-        $langs->load('subtotal@subtotal');
150
+	/**
151
+	 * Function called when a Dolibarrr business event is done.
152
+	 * All functions "run_trigger" are triggered if file
153
+	 * is inside directory core/triggers
154
+	 *
155
+	 * 	@param		string		$action		Event action code
156
+	 * 	@param		Object		$object		Object
157
+	 * 	@param		User		$user		Object user
158
+	 * 	@param		Translate	$langs		Object langs
159
+	 * 	@param		conf		$conf		Object conf
160
+	 * 	@return		int						<0 if KO, 0 if no triggered ran, >0 if OK
161
+	 */
162
+	public function run_trigger($action, $object, $user, $langs, $conf)
163
+	{
164
+		// Put here code you want to execute when a Dolibarr business events occurs.
165
+		// Data and type of action are stored into $object and $action
166
+		// Users
167
+		dol_include_once('/subtotal/class/subtotal.class.php');
168
+		$langs->load('subtotal@subtotal');
169 169
         
170
-        if (!empty($conf->global->SUBTOTAL_ALLOW_ADD_LINE_UNDER_TITLE) && in_array($action, array('LINEPROPAL_INSERT', 'LINEORDER_INSERT', 'LINEBILL_INSERT')))
170
+		if (!empty($conf->global->SUBTOTAL_ALLOW_ADD_LINE_UNDER_TITLE) && in_array($action, array('LINEPROPAL_INSERT', 'LINEORDER_INSERT', 'LINEBILL_INSERT')))
171 171
 		{
172 172
 			
173 173
 			$rang = GETPOST('under_title', 'int'); // Rang du titre
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 		}
200 200
         
201 201
 		
202
-        if ($action == 'LINEBILL_INSERT' && $object->special_code != TSubtotal::$module_number)
202
+		if ($action == 'LINEBILL_INSERT' && $object->special_code != TSubtotal::$module_number)
203 203
 		{
204 204
 			$subtotal_add_title_bloc_from_orderstoinvoice = GETPOST('subtotal_add_title_bloc_from_orderstoinvoice');
205 205
 			if (!empty($subtotal_add_title_bloc_from_orderstoinvoice))
@@ -307,177 +307,177 @@  discard block
 block discarded – undo
307 307
 		}
308 308
 		
309 309
         
310
-        if ($action == 'USER_LOGIN') {
311
-            dol_syslog(
312
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
313
-            );
314
-        } elseif ($action == 'USER_UPDATE_SESSION') {
315
-            // Warning: To increase performances, this action is triggered only if
316
-            // constant MAIN_ACTIVATE_UPDATESESSIONTRIGGER is set to 1.
317
-            dol_syslog(
318
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
319
-            );
320
-        } elseif ($action == 'USER_CREATE') {
321
-            dol_syslog(
322
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
323
-            );
324
-        } elseif ($action == 'USER_CREATE_FROM_CONTACT') {
325
-            dol_syslog(
326
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
327
-            );
328
-        } elseif ($action == 'USER_MODIFY') {
329
-            dol_syslog(
330
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
331
-            );
332
-        } elseif ($action == 'USER_NEW_PASSWORD') {
333
-            dol_syslog(
334
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
335
-            );
336
-        } elseif ($action == 'USER_ENABLEDISABLE') {
337
-            dol_syslog(
338
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
339
-            );
340
-        } elseif ($action == 'USER_DELETE') {
341
-            dol_syslog(
342
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
343
-            );
344
-        } elseif ($action == 'USER_LOGOUT') {
345
-            dol_syslog(
346
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
347
-            );
348
-        } elseif ($action == 'USER_SETINGROUP') {
349
-            dol_syslog(
350
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
351
-            );
352
-        } elseif ($action == 'USER_REMOVEFROMGROUP') {
353
-            dol_syslog(
354
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
355
-            );
356
-        }
357
-
358
-        // Groups
359
-        elseif ($action == 'GROUP_CREATE') {
360
-            dol_syslog(
361
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
362
-            );
363
-        } elseif ($action == 'GROUP_MODIFY') {
364
-            dol_syslog(
365
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
366
-            );
367
-        } elseif ($action == 'GROUP_DELETE') {
368
-            dol_syslog(
369
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
370
-            );
371
-        }
372
-
373
-        // Companies
374
-        elseif ($action == 'COMPANY_CREATE') {
375
-            dol_syslog(
376
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
377
-            );
378
-        } elseif ($action == 'COMPANY_MODIFY') {
379
-            dol_syslog(
380
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
381
-            );
382
-        } elseif ($action == 'COMPANY_DELETE') {
383
-            dol_syslog(
384
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
385
-            );
386
-        }
387
-
388
-        // Contacts
389
-        elseif ($action == 'CONTACT_CREATE') {
390
-            dol_syslog(
391
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
392
-            );
393
-        } elseif ($action == 'CONTACT_MODIFY') {
394
-            dol_syslog(
395
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
396
-            );
397
-        } elseif ($action == 'CONTACT_DELETE') {
398
-            dol_syslog(
399
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
400
-            );
401
-        }
402
-
403
-        // Products
404
-        elseif ($action == 'PRODUCT_CREATE') {
405
-            dol_syslog(
406
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
407
-            );
408
-        } elseif ($action == 'PRODUCT_MODIFY') {
409
-            dol_syslog(
410
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
411
-            );
412
-        } elseif ($action == 'PRODUCT_DELETE') {
413
-            dol_syslog(
414
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
415
-            );
416
-        }
417
-
418
-        // Customer orders
419
-        elseif ($action == 'ORDER_CREATE') {
420
-            dol_syslog(
421
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
422
-            );
423
-        } elseif ($action == 'ORDER_CLONE') {
424
-            dol_syslog(
425
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
426
-            );
427
-        } elseif ($action == 'ORDER_VALIDATE') {
428
-            dol_syslog(
429
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
430
-            );
431
-        } elseif ($action == 'ORDER_DELETE') {
432
-            dol_syslog(
433
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
434
-            );
435
-        } elseif ($action == 'ORDER_BUILDDOC') {
436
-            dol_syslog(
437
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
438
-            );
439
-        } elseif ($action == 'ORDER_SENTBYMAIL') {
440
-            dol_syslog(
441
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
442
-            );
443
-        } elseif ($action == 'LINEORDER_INSERT') {
444
-            dol_syslog(
445
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
446
-            );
447
-        } elseif ($action == 'LINEORDER_DELETE') {
448
-            dol_syslog(
449
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
450
-            );
451
-        }
452
-
453
-        // Supplier orders
454
-        elseif ($action == 'ORDER_SUPPLIER_CREATE') {
455
-            dol_syslog(
456
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
457
-            );
458
-        } elseif ($action == 'ORDER_SUPPLIER_VALIDATE') {
459
-            dol_syslog(
460
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
461
-            );
462
-        } elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') {
463
-            dol_syslog(
464
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
465
-            );
466
-        } elseif ($action == 'SUPPLIER_ORDER_BUILDDOC') {
467
-            dol_syslog(
468
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
469
-            );
470
-        }
471
-
472
-        // Proposals
473
-        elseif ($action == 'PROPAL_CREATE') {
474
-            dol_syslog(
475
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
476
-            );
477
-        } elseif ($action == 'PROPAL_CLONE') {
478
-            dol_syslog(
479
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
480
-            );
310
+		if ($action == 'USER_LOGIN') {
311
+			dol_syslog(
312
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
313
+			);
314
+		} elseif ($action == 'USER_UPDATE_SESSION') {
315
+			// Warning: To increase performances, this action is triggered only if
316
+			// constant MAIN_ACTIVATE_UPDATESESSIONTRIGGER is set to 1.
317
+			dol_syslog(
318
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
319
+			);
320
+		} elseif ($action == 'USER_CREATE') {
321
+			dol_syslog(
322
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
323
+			);
324
+		} elseif ($action == 'USER_CREATE_FROM_CONTACT') {
325
+			dol_syslog(
326
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
327
+			);
328
+		} elseif ($action == 'USER_MODIFY') {
329
+			dol_syslog(
330
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
331
+			);
332
+		} elseif ($action == 'USER_NEW_PASSWORD') {
333
+			dol_syslog(
334
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
335
+			);
336
+		} elseif ($action == 'USER_ENABLEDISABLE') {
337
+			dol_syslog(
338
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
339
+			);
340
+		} elseif ($action == 'USER_DELETE') {
341
+			dol_syslog(
342
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
343
+			);
344
+		} elseif ($action == 'USER_LOGOUT') {
345
+			dol_syslog(
346
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
347
+			);
348
+		} elseif ($action == 'USER_SETINGROUP') {
349
+			dol_syslog(
350
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
351
+			);
352
+		} elseif ($action == 'USER_REMOVEFROMGROUP') {
353
+			dol_syslog(
354
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
355
+			);
356
+		}
357
+
358
+		// Groups
359
+		elseif ($action == 'GROUP_CREATE') {
360
+			dol_syslog(
361
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
362
+			);
363
+		} elseif ($action == 'GROUP_MODIFY') {
364
+			dol_syslog(
365
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
366
+			);
367
+		} elseif ($action == 'GROUP_DELETE') {
368
+			dol_syslog(
369
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
370
+			);
371
+		}
372
+
373
+		// Companies
374
+		elseif ($action == 'COMPANY_CREATE') {
375
+			dol_syslog(
376
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
377
+			);
378
+		} elseif ($action == 'COMPANY_MODIFY') {
379
+			dol_syslog(
380
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
381
+			);
382
+		} elseif ($action == 'COMPANY_DELETE') {
383
+			dol_syslog(
384
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
385
+			);
386
+		}
387
+
388
+		// Contacts
389
+		elseif ($action == 'CONTACT_CREATE') {
390
+			dol_syslog(
391
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
392
+			);
393
+		} elseif ($action == 'CONTACT_MODIFY') {
394
+			dol_syslog(
395
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
396
+			);
397
+		} elseif ($action == 'CONTACT_DELETE') {
398
+			dol_syslog(
399
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
400
+			);
401
+		}
402
+
403
+		// Products
404
+		elseif ($action == 'PRODUCT_CREATE') {
405
+			dol_syslog(
406
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
407
+			);
408
+		} elseif ($action == 'PRODUCT_MODIFY') {
409
+			dol_syslog(
410
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
411
+			);
412
+		} elseif ($action == 'PRODUCT_DELETE') {
413
+			dol_syslog(
414
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
415
+			);
416
+		}
417
+
418
+		// Customer orders
419
+		elseif ($action == 'ORDER_CREATE') {
420
+			dol_syslog(
421
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
422
+			);
423
+		} elseif ($action == 'ORDER_CLONE') {
424
+			dol_syslog(
425
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
426
+			);
427
+		} elseif ($action == 'ORDER_VALIDATE') {
428
+			dol_syslog(
429
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
430
+			);
431
+		} elseif ($action == 'ORDER_DELETE') {
432
+			dol_syslog(
433
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
434
+			);
435
+		} elseif ($action == 'ORDER_BUILDDOC') {
436
+			dol_syslog(
437
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
438
+			);
439
+		} elseif ($action == 'ORDER_SENTBYMAIL') {
440
+			dol_syslog(
441
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
442
+			);
443
+		} elseif ($action == 'LINEORDER_INSERT') {
444
+			dol_syslog(
445
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
446
+			);
447
+		} elseif ($action == 'LINEORDER_DELETE') {
448
+			dol_syslog(
449
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
450
+			);
451
+		}
452
+
453
+		// Supplier orders
454
+		elseif ($action == 'ORDER_SUPPLIER_CREATE') {
455
+			dol_syslog(
456
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
457
+			);
458
+		} elseif ($action == 'ORDER_SUPPLIER_VALIDATE') {
459
+			dol_syslog(
460
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
461
+			);
462
+		} elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') {
463
+			dol_syslog(
464
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
465
+			);
466
+		} elseif ($action == 'SUPPLIER_ORDER_BUILDDOC') {
467
+			dol_syslog(
468
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
469
+			);
470
+		}
471
+
472
+		// Proposals
473
+		elseif ($action == 'PROPAL_CREATE') {
474
+			dol_syslog(
475
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
476
+			);
477
+		} elseif ($action == 'PROPAL_CLONE') {
478
+			dol_syslog(
479
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
480
+			);
481 481
 			
482 482
 			$doli_action = GETPOST('action');
483 483
 
@@ -501,281 +501,281 @@  discard block
 block discarded – undo
501 501
 				}
502 502
 			}
503 503
 			
504
-        } elseif ($action == 'PROPAL_MODIFY') {
505
-            dol_syslog(
506
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
507
-            );
508
-        } elseif ($action == 'PROPAL_VALIDATE') {
509
-            dol_syslog(
510
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
511
-            );
512
-        } elseif ($action == 'PROPAL_BUILDDOC') {
513
-            dol_syslog(
514
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
515
-            );
516
-        } elseif ($action == 'PROPAL_SENTBYMAIL') {
517
-            dol_syslog(
518
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
519
-            );
520
-        } elseif ($action == 'PROPAL_CLOSE_SIGNED') {
521
-            dol_syslog(
522
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
523
-            );
524
-        } elseif ($action == 'PROPAL_CLOSE_REFUSED') {
525
-            dol_syslog(
526
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
527
-            );
528
-        } elseif ($action == 'PROPAL_DELETE') {
529
-            dol_syslog(
530
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
531
-            );
532
-        } elseif ($action == 'LINEPROPAL_INSERT') {
533
-            dol_syslog(
534
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
535
-            );
536
-        } elseif ($action == 'LINEPROPAL_MODIFY') {
537
-            dol_syslog(
538
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
539
-            );
540
-        } elseif ($action == 'LINEPROPAL_DELETE') {
541
-            dol_syslog(
542
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
543
-            );
544
-        }
545
-
546
-        // Contracts
547
-        elseif ($action == 'CONTRACT_CREATE') {
548
-            dol_syslog(
549
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
550
-            );
551
-        } elseif ($action == 'CONTRACT_MODIFY') {
552
-            dol_syslog(
553
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
554
-            );
555
-        } elseif ($action == 'CONTRACT_ACTIVATE') {
556
-            dol_syslog(
557
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
558
-            );
559
-        } elseif ($action == 'CONTRACT_CANCEL') {
560
-            dol_syslog(
561
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
562
-            );
563
-        } elseif ($action == 'CONTRACT_CLOSE') {
564
-            dol_syslog(
565
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
566
-            );
567
-        } elseif ($action == 'CONTRACT_DELETE') {
568
-            dol_syslog(
569
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
570
-            );
571
-        }
504
+		} elseif ($action == 'PROPAL_MODIFY') {
505
+			dol_syslog(
506
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
507
+			);
508
+		} elseif ($action == 'PROPAL_VALIDATE') {
509
+			dol_syslog(
510
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
511
+			);
512
+		} elseif ($action == 'PROPAL_BUILDDOC') {
513
+			dol_syslog(
514
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
515
+			);
516
+		} elseif ($action == 'PROPAL_SENTBYMAIL') {
517
+			dol_syslog(
518
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
519
+			);
520
+		} elseif ($action == 'PROPAL_CLOSE_SIGNED') {
521
+			dol_syslog(
522
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
523
+			);
524
+		} elseif ($action == 'PROPAL_CLOSE_REFUSED') {
525
+			dol_syslog(
526
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
527
+			);
528
+		} elseif ($action == 'PROPAL_DELETE') {
529
+			dol_syslog(
530
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
531
+			);
532
+		} elseif ($action == 'LINEPROPAL_INSERT') {
533
+			dol_syslog(
534
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
535
+			);
536
+		} elseif ($action == 'LINEPROPAL_MODIFY') {
537
+			dol_syslog(
538
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
539
+			);
540
+		} elseif ($action == 'LINEPROPAL_DELETE') {
541
+			dol_syslog(
542
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
543
+			);
544
+		}
545
+
546
+		// Contracts
547
+		elseif ($action == 'CONTRACT_CREATE') {
548
+			dol_syslog(
549
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
550
+			);
551
+		} elseif ($action == 'CONTRACT_MODIFY') {
552
+			dol_syslog(
553
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
554
+			);
555
+		} elseif ($action == 'CONTRACT_ACTIVATE') {
556
+			dol_syslog(
557
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
558
+			);
559
+		} elseif ($action == 'CONTRACT_CANCEL') {
560
+			dol_syslog(
561
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
562
+			);
563
+		} elseif ($action == 'CONTRACT_CLOSE') {
564
+			dol_syslog(
565
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
566
+			);
567
+		} elseif ($action == 'CONTRACT_DELETE') {
568
+			dol_syslog(
569
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
570
+			);
571
+		}
572 572
 
573 573
 		elseif ($action == 'BILL_CLONE') {
574
-            dol_syslog(
575
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
576
-            );
577
-        } elseif ($action == 'BILL_MODIFY') {
578
-            dol_syslog(
579
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
580
-            );
581
-        } elseif ($action == 'BILL_VALIDATE') {
582
-            dol_syslog(
583
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
584
-            );
585
-        } elseif ($action == 'BILL_BUILDDOC') {
586
-            dol_syslog(
587
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
588
-            );
589
-        } elseif ($action == 'BILL_SENTBYMAIL') {
590
-            dol_syslog(
591
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
592
-            );
593
-        } elseif ($action == 'BILL_CANCEL') {
594
-            dol_syslog(
595
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
596
-            );
597
-        } elseif ($action == 'BILL_DELETE') {
598
-            dol_syslog(
599
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
600
-            );
601
-        } elseif ($action == 'LINEBILL_INSERT') {
574
+			dol_syslog(
575
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
576
+			);
577
+		} elseif ($action == 'BILL_MODIFY') {
578
+			dol_syslog(
579
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
580
+			);
581
+		} elseif ($action == 'BILL_VALIDATE') {
582
+			dol_syslog(
583
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
584
+			);
585
+		} elseif ($action == 'BILL_BUILDDOC') {
586
+			dol_syslog(
587
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
588
+			);
589
+		} elseif ($action == 'BILL_SENTBYMAIL') {
590
+			dol_syslog(
591
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
592
+			);
593
+		} elseif ($action == 'BILL_CANCEL') {
594
+			dol_syslog(
595
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
596
+			);
597
+		} elseif ($action == 'BILL_DELETE') {
598
+			dol_syslog(
599
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
600
+			);
601
+		} elseif ($action == 'LINEBILL_INSERT') {
602 602
 				
603
-        	dol_syslog(
604
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
605
-            );
606
-        } elseif ($action == 'LINEBILL_DELETE') {
607
-            dol_syslog(
608
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
609
-            );
610
-        }
611
-
612
-        // Payments
613
-        elseif ($action == 'PAYMENT_CUSTOMER_CREATE') {
614
-            dol_syslog(
615
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
616
-            );
617
-        } elseif ($action == 'PAYMENT_SUPPLIER_CREATE') {
618
-            dol_syslog(
619
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
620
-            );
621
-        } elseif ($action == 'PAYMENT_ADD_TO_BANK') {
622
-            dol_syslog(
623
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
624
-            );
625
-        } elseif ($action == 'PAYMENT_DELETE') {
626
-            dol_syslog(
627
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
628
-            );
629
-        }
630
-
631
-        // Interventions
632
-        elseif ($action == 'FICHEINTER_CREATE') {
633
-            dol_syslog(
634
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
635
-            );
636
-        } elseif ($action == 'FICHEINTER_MODIFY') {
637
-            dol_syslog(
638
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
639
-            );
640
-        } elseif ($action == 'FICHEINTER_VALIDATE') {
641
-            dol_syslog(
642
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
643
-            );
644
-        } elseif ($action == 'FICHEINTER_DELETE') {
645
-            dol_syslog(
646
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
647
-            );
648
-        }
649
-
650
-        // Members
651
-        elseif ($action == 'MEMBER_CREATE') {
652
-            dol_syslog(
653
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
654
-            );
655
-        } elseif ($action == 'MEMBER_VALIDATE') {
656
-            dol_syslog(
657
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
658
-            );
659
-        } elseif ($action == 'MEMBER_SUBSCRIPTION') {
660
-            dol_syslog(
661
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
662
-            );
663
-        } elseif ($action == 'MEMBER_MODIFY') {
664
-            dol_syslog(
665
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
666
-            );
667
-        } elseif ($action == 'MEMBER_NEW_PASSWORD') {
668
-            dol_syslog(
669
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
670
-            );
671
-        } elseif ($action == 'MEMBER_RESILIATE') {
672
-            dol_syslog(
673
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
674
-            );
675
-        } elseif ($action == 'MEMBER_DELETE') {
676
-            dol_syslog(
677
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
678
-            );
679
-        }
680
-
681
-        // Categories
682
-        elseif ($action == 'CATEGORY_CREATE') {
683
-            dol_syslog(
684
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
685
-            );
686
-        } elseif ($action == 'CATEGORY_MODIFY') {
687
-            dol_syslog(
688
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
689
-            );
690
-        } elseif ($action == 'CATEGORY_DELETE') {
691
-            dol_syslog(
692
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
693
-            );
694
-        }
695
-
696
-        // Projects
697
-        elseif ($action == 'PROJECT_CREATE') {
698
-            dol_syslog(
699
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
700
-            );
701
-        } elseif ($action == 'PROJECT_MODIFY') {
702
-            dol_syslog(
703
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
704
-            );
705
-        } elseif ($action == 'PROJECT_DELETE') {
706
-            dol_syslog(
707
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
708
-            );
709
-        }
710
-
711
-        // Project tasks
712
-        elseif ($action == 'TASK_CREATE') {
713
-            dol_syslog(
714
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
715
-            );
716
-        } elseif ($action == 'TASK_MODIFY') {
717
-            dol_syslog(
718
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
719
-            );
720
-        } elseif ($action == 'TASK_DELETE') {
721
-            dol_syslog(
722
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
723
-            );
724
-        }
725
-
726
-        // Task time spent
727
-        elseif ($action == 'TASK_TIMESPENT_CREATE') {
728
-            dol_syslog(
729
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
730
-            );
731
-        } elseif ($action == 'TASK_TIMESPENT_MODIFY') {
732
-            dol_syslog(
733
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
734
-            );
735
-        } elseif ($action == 'TASK_TIMESPENT_DELETE') {
736
-            dol_syslog(
737
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
738
-            );
739
-        }
740
-
741
-        // Shipping
742
-        elseif ($action == 'SHIPPING_CREATE') {
743
-            dol_syslog(
744
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
745
-            );
746
-        } elseif ($action == 'SHIPPING_MODIFY') {
747
-            dol_syslog(
748
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
749
-            );
750
-        } elseif ($action == 'SHIPPING_VALIDATE') {
751
-            dol_syslog(
752
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
753
-            );
754
-        } elseif ($action == 'SHIPPING_SENTBYMAIL') {
755
-            dol_syslog(
756
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
757
-            );
758
-        } elseif ($action == 'SHIPPING_DELETE') {
759
-            dol_syslog(
760
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
761
-            );
762
-        } elseif ($action == 'SHIPPING_BUILDDOC') {
763
-            dol_syslog(
764
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
765
-            );
766
-        }
767
-
768
-        // File
769
-        elseif ($action == 'FILE_UPLOAD') {
770
-            dol_syslog(
771
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
772
-            );
773
-        } elseif ($action == 'FILE_DELETE') {
774
-            dol_syslog(
775
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
776
-            );
777
-        }
778
-
779
-        return 0;
780
-    }
603
+			dol_syslog(
604
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
605
+			);
606
+		} elseif ($action == 'LINEBILL_DELETE') {
607
+			dol_syslog(
608
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
609
+			);
610
+		}
611
+
612
+		// Payments
613
+		elseif ($action == 'PAYMENT_CUSTOMER_CREATE') {
614
+			dol_syslog(
615
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
616
+			);
617
+		} elseif ($action == 'PAYMENT_SUPPLIER_CREATE') {
618
+			dol_syslog(
619
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
620
+			);
621
+		} elseif ($action == 'PAYMENT_ADD_TO_BANK') {
622
+			dol_syslog(
623
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
624
+			);
625
+		} elseif ($action == 'PAYMENT_DELETE') {
626
+			dol_syslog(
627
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
628
+			);
629
+		}
630
+
631
+		// Interventions
632
+		elseif ($action == 'FICHEINTER_CREATE') {
633
+			dol_syslog(
634
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
635
+			);
636
+		} elseif ($action == 'FICHEINTER_MODIFY') {
637
+			dol_syslog(
638
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
639
+			);
640
+		} elseif ($action == 'FICHEINTER_VALIDATE') {
641
+			dol_syslog(
642
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
643
+			);
644
+		} elseif ($action == 'FICHEINTER_DELETE') {
645
+			dol_syslog(
646
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
647
+			);
648
+		}
649
+
650
+		// Members
651
+		elseif ($action == 'MEMBER_CREATE') {
652
+			dol_syslog(
653
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
654
+			);
655
+		} elseif ($action == 'MEMBER_VALIDATE') {
656
+			dol_syslog(
657
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
658
+			);
659
+		} elseif ($action == 'MEMBER_SUBSCRIPTION') {
660
+			dol_syslog(
661
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
662
+			);
663
+		} elseif ($action == 'MEMBER_MODIFY') {
664
+			dol_syslog(
665
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
666
+			);
667
+		} elseif ($action == 'MEMBER_NEW_PASSWORD') {
668
+			dol_syslog(
669
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
670
+			);
671
+		} elseif ($action == 'MEMBER_RESILIATE') {
672
+			dol_syslog(
673
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
674
+			);
675
+		} elseif ($action == 'MEMBER_DELETE') {
676
+			dol_syslog(
677
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
678
+			);
679
+		}
680
+
681
+		// Categories
682
+		elseif ($action == 'CATEGORY_CREATE') {
683
+			dol_syslog(
684
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
685
+			);
686
+		} elseif ($action == 'CATEGORY_MODIFY') {
687
+			dol_syslog(
688
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
689
+			);
690
+		} elseif ($action == 'CATEGORY_DELETE') {
691
+			dol_syslog(
692
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
693
+			);
694
+		}
695
+
696
+		// Projects
697
+		elseif ($action == 'PROJECT_CREATE') {
698
+			dol_syslog(
699
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
700
+			);
701
+		} elseif ($action == 'PROJECT_MODIFY') {
702
+			dol_syslog(
703
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
704
+			);
705
+		} elseif ($action == 'PROJECT_DELETE') {
706
+			dol_syslog(
707
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
708
+			);
709
+		}
710
+
711
+		// Project tasks
712
+		elseif ($action == 'TASK_CREATE') {
713
+			dol_syslog(
714
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
715
+			);
716
+		} elseif ($action == 'TASK_MODIFY') {
717
+			dol_syslog(
718
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
719
+			);
720
+		} elseif ($action == 'TASK_DELETE') {
721
+			dol_syslog(
722
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
723
+			);
724
+		}
725
+
726
+		// Task time spent
727
+		elseif ($action == 'TASK_TIMESPENT_CREATE') {
728
+			dol_syslog(
729
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
730
+			);
731
+		} elseif ($action == 'TASK_TIMESPENT_MODIFY') {
732
+			dol_syslog(
733
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
734
+			);
735
+		} elseif ($action == 'TASK_TIMESPENT_DELETE') {
736
+			dol_syslog(
737
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
738
+			);
739
+		}
740
+
741
+		// Shipping
742
+		elseif ($action == 'SHIPPING_CREATE') {
743
+			dol_syslog(
744
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
745
+			);
746
+		} elseif ($action == 'SHIPPING_MODIFY') {
747
+			dol_syslog(
748
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
749
+			);
750
+		} elseif ($action == 'SHIPPING_VALIDATE') {
751
+			dol_syslog(
752
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
753
+			);
754
+		} elseif ($action == 'SHIPPING_SENTBYMAIL') {
755
+			dol_syslog(
756
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
757
+			);
758
+		} elseif ($action == 'SHIPPING_DELETE') {
759
+			dol_syslog(
760
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
761
+			);
762
+		} elseif ($action == 'SHIPPING_BUILDDOC') {
763
+			dol_syslog(
764
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
765
+			);
766
+		}
767
+
768
+		// File
769
+		elseif ($action == 'FILE_UPLOAD') {
770
+			dol_syslog(
771
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
772
+			);
773
+		} elseif ($action == 'FILE_DELETE') {
774
+			dol_syslog(
775
+				"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
776
+			);
777
+		}
778
+
779
+		return 0;
780
+	}
781 781
 }
782 782
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -107,13 +107,13 @@  discard block
 block discarded – undo
107 107
 			if ($object->id != $line->id && $line->rang > $rang)
108 108
 			{
109 109
 				// Update du rang de toutes les lignes suivant mon titre
110
-				$parent->updateRangOfLine($line->id, $line->rang+1);
110
+				$parent->updateRangOfLine($line->id, $line->rang + 1);
111 111
 			}
112 112
 		}
113 113
 		
114 114
 		// Update du rang de la ligne fraichement ajouté pour la déplacer sous mon titre
115
-		$parent->updateRangOfLine($object->id, $rang+1);
116
-		$object->rang = $rang+1;
115
+		$parent->updateRangOfLine($object->id, $rang + 1);
116
+		$object->rang = $rang + 1;
117 117
 	}
118 118
 	
119 119
 	public function addToEnd(&$parent, &$object, $rang)
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 			
137 137
 			if ($subtotal_line_found)
138 138
 			{
139
-				$parent->updateRangOfLine($line->id, $line->rang+1);
139
+				$parent->updateRangOfLine($line->id, $line->rang + 1);
140 140
 			}
141 141
 		}
142 142
 		
@@ -257,10 +257,10 @@  discard block
 block discarded – undo
257 257
 		{
258 258
 			$doli_action = GETPOST('action');
259 259
 			$set = GETPOST('set');
260
-			if ( (in_array($doli_action, array('updateligne', 'updateline', 'addline', 'add')) || $set == 'defaultTVA') && !TSubtotal::isTitle($object) && !TSubtotal::isSubtotal($object) && in_array($object->element, array('propaldet', 'commandedet', 'facturedet')))
260
+			if ((in_array($doli_action, array('updateligne', 'updateline', 'addline', 'add')) || $set == 'defaultTVA') && !TSubtotal::isTitle($object) && !TSubtotal::isSubtotal($object) && in_array($object->element, array('propaldet', 'commandedet', 'facturedet')))
261 261
 			{
262 262
 				 dol_syslog(
263
-					"[SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS] Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". object=".$object->element." id=" . $object->id
263
+					"[SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS] Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". object=".$object->element." id=".$object->id
264 264
 				);
265 265
 				 
266 266
 				$TTitle = TSubtotal::getAllTitleFromLine($object);
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 				}
281 281
 
282 282
 				// $object correspond à la ligne ajoutée
283
-				if(! empty($object->array_options['options_subtotal_nc'])) {
283
+				if (!empty($object->array_options['options_subtotal_nc'])) {
284 284
 					$object->total_ht = $object->total_tva = $object->total_ttc = $object->total_localtax1 = $object->total_localtax2 = 
285 285
 							$object->multicurrency_total_ht = $object->multicurrency_total_tva = $object->multicurrency_total_ttc = 0;
286 286
 
@@ -294,12 +294,12 @@  discard block
 block discarded – undo
294 294
 		
295 295
 		// Les lignes libres (y compris les sous-totaux) créées à partir d'une facture modèle n'ont pas la TVA de la ligne du modèle mais la TVA par défaut
296 296
 		if ($action == 'BILL_CREATE' && $object->fac_rec > 0) {
297
-			dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id);
297
+			dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
298 298
 
299 299
 			$object->fetch_lines(); // Lignes pas rajoutées à $object->lines par les appels à addline();
300 300
 
301
-			foreach($object->lines as &$line) {
302
-				if(TSubtotal::isSubtotal($line) && ! empty($line->tva_tx)) {
301
+			foreach ($object->lines as &$line) {
302
+				if (TSubtotal::isSubtotal($line) && !empty($line->tva_tx)) {
303 303
 					$line->tva_tx = 0;
304 304
 					$line->update();
305 305
 				}
@@ -309,174 +309,174 @@  discard block
 block discarded – undo
309 309
         
310 310
         if ($action == 'USER_LOGIN') {
311 311
             dol_syslog(
312
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
312
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
313 313
             );
314 314
         } elseif ($action == 'USER_UPDATE_SESSION') {
315 315
             // Warning: To increase performances, this action is triggered only if
316 316
             // constant MAIN_ACTIVATE_UPDATESESSIONTRIGGER is set to 1.
317 317
             dol_syslog(
318
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
318
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
319 319
             );
320 320
         } elseif ($action == 'USER_CREATE') {
321 321
             dol_syslog(
322
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
322
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
323 323
             );
324 324
         } elseif ($action == 'USER_CREATE_FROM_CONTACT') {
325 325
             dol_syslog(
326
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
326
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
327 327
             );
328 328
         } elseif ($action == 'USER_MODIFY') {
329 329
             dol_syslog(
330
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
330
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
331 331
             );
332 332
         } elseif ($action == 'USER_NEW_PASSWORD') {
333 333
             dol_syslog(
334
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
334
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
335 335
             );
336 336
         } elseif ($action == 'USER_ENABLEDISABLE') {
337 337
             dol_syslog(
338
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
338
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
339 339
             );
340 340
         } elseif ($action == 'USER_DELETE') {
341 341
             dol_syslog(
342
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
342
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
343 343
             );
344 344
         } elseif ($action == 'USER_LOGOUT') {
345 345
             dol_syslog(
346
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
346
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
347 347
             );
348 348
         } elseif ($action == 'USER_SETINGROUP') {
349 349
             dol_syslog(
350
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
350
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
351 351
             );
352 352
         } elseif ($action == 'USER_REMOVEFROMGROUP') {
353 353
             dol_syslog(
354
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
354
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
355 355
             );
356 356
         }
357 357
 
358 358
         // Groups
359 359
         elseif ($action == 'GROUP_CREATE') {
360 360
             dol_syslog(
361
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
361
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
362 362
             );
363 363
         } elseif ($action == 'GROUP_MODIFY') {
364 364
             dol_syslog(
365
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
365
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
366 366
             );
367 367
         } elseif ($action == 'GROUP_DELETE') {
368 368
             dol_syslog(
369
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
369
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
370 370
             );
371 371
         }
372 372
 
373 373
         // Companies
374 374
         elseif ($action == 'COMPANY_CREATE') {
375 375
             dol_syslog(
376
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
376
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
377 377
             );
378 378
         } elseif ($action == 'COMPANY_MODIFY') {
379 379
             dol_syslog(
380
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
380
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
381 381
             );
382 382
         } elseif ($action == 'COMPANY_DELETE') {
383 383
             dol_syslog(
384
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
384
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
385 385
             );
386 386
         }
387 387
 
388 388
         // Contacts
389 389
         elseif ($action == 'CONTACT_CREATE') {
390 390
             dol_syslog(
391
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
391
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
392 392
             );
393 393
         } elseif ($action == 'CONTACT_MODIFY') {
394 394
             dol_syslog(
395
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
395
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
396 396
             );
397 397
         } elseif ($action == 'CONTACT_DELETE') {
398 398
             dol_syslog(
399
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
399
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
400 400
             );
401 401
         }
402 402
 
403 403
         // Products
404 404
         elseif ($action == 'PRODUCT_CREATE') {
405 405
             dol_syslog(
406
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
406
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
407 407
             );
408 408
         } elseif ($action == 'PRODUCT_MODIFY') {
409 409
             dol_syslog(
410
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
410
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
411 411
             );
412 412
         } elseif ($action == 'PRODUCT_DELETE') {
413 413
             dol_syslog(
414
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
414
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
415 415
             );
416 416
         }
417 417
 
418 418
         // Customer orders
419 419
         elseif ($action == 'ORDER_CREATE') {
420 420
             dol_syslog(
421
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
421
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
422 422
             );
423 423
         } elseif ($action == 'ORDER_CLONE') {
424 424
             dol_syslog(
425
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
425
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
426 426
             );
427 427
         } elseif ($action == 'ORDER_VALIDATE') {
428 428
             dol_syslog(
429
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
429
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
430 430
             );
431 431
         } elseif ($action == 'ORDER_DELETE') {
432 432
             dol_syslog(
433
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
433
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
434 434
             );
435 435
         } elseif ($action == 'ORDER_BUILDDOC') {
436 436
             dol_syslog(
437
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
437
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
438 438
             );
439 439
         } elseif ($action == 'ORDER_SENTBYMAIL') {
440 440
             dol_syslog(
441
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
441
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
442 442
             );
443 443
         } elseif ($action == 'LINEORDER_INSERT') {
444 444
             dol_syslog(
445
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
445
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
446 446
             );
447 447
         } elseif ($action == 'LINEORDER_DELETE') {
448 448
             dol_syslog(
449
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
449
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
450 450
             );
451 451
         }
452 452
 
453 453
         // Supplier orders
454 454
         elseif ($action == 'ORDER_SUPPLIER_CREATE') {
455 455
             dol_syslog(
456
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
456
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
457 457
             );
458 458
         } elseif ($action == 'ORDER_SUPPLIER_VALIDATE') {
459 459
             dol_syslog(
460
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
460
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
461 461
             );
462 462
         } elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') {
463 463
             dol_syslog(
464
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
464
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
465 465
             );
466 466
         } elseif ($action == 'SUPPLIER_ORDER_BUILDDOC') {
467 467
             dol_syslog(
468
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
468
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
469 469
             );
470 470
         }
471 471
 
472 472
         // Proposals
473 473
         elseif ($action == 'PROPAL_CREATE') {
474 474
             dol_syslog(
475
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
475
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
476 476
             );
477 477
         } elseif ($action == 'PROPAL_CLONE') {
478 478
             dol_syslog(
479
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
479
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
480 480
             );
481 481
 			
482 482
 			$doli_action = GETPOST('action');
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
 			if (in_array($doli_action, array('confirm_clone')))
485 485
 			{
486 486
 				dol_syslog(
487
-					"[SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS] Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". object=".$object->element." id=" . $object->id
487
+					"[SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS] Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". object=".$object->element." id=".$object->id
488 488
 				);
489 489
 				 
490 490
 				foreach ($object->lines as &$line)
@@ -503,276 +503,276 @@  discard block
 block discarded – undo
503 503
 			
504 504
         } elseif ($action == 'PROPAL_MODIFY') {
505 505
             dol_syslog(
506
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
506
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
507 507
             );
508 508
         } elseif ($action == 'PROPAL_VALIDATE') {
509 509
             dol_syslog(
510
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
510
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
511 511
             );
512 512
         } elseif ($action == 'PROPAL_BUILDDOC') {
513 513
             dol_syslog(
514
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
514
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
515 515
             );
516 516
         } elseif ($action == 'PROPAL_SENTBYMAIL') {
517 517
             dol_syslog(
518
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
518
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
519 519
             );
520 520
         } elseif ($action == 'PROPAL_CLOSE_SIGNED') {
521 521
             dol_syslog(
522
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
522
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
523 523
             );
524 524
         } elseif ($action == 'PROPAL_CLOSE_REFUSED') {
525 525
             dol_syslog(
526
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
526
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
527 527
             );
528 528
         } elseif ($action == 'PROPAL_DELETE') {
529 529
             dol_syslog(
530
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
530
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
531 531
             );
532 532
         } elseif ($action == 'LINEPROPAL_INSERT') {
533 533
             dol_syslog(
534
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
534
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
535 535
             );
536 536
         } elseif ($action == 'LINEPROPAL_MODIFY') {
537 537
             dol_syslog(
538
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
538
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
539 539
             );
540 540
         } elseif ($action == 'LINEPROPAL_DELETE') {
541 541
             dol_syslog(
542
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
542
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
543 543
             );
544 544
         }
545 545
 
546 546
         // Contracts
547 547
         elseif ($action == 'CONTRACT_CREATE') {
548 548
             dol_syslog(
549
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
549
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
550 550
             );
551 551
         } elseif ($action == 'CONTRACT_MODIFY') {
552 552
             dol_syslog(
553
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
553
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
554 554
             );
555 555
         } elseif ($action == 'CONTRACT_ACTIVATE') {
556 556
             dol_syslog(
557
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
557
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
558 558
             );
559 559
         } elseif ($action == 'CONTRACT_CANCEL') {
560 560
             dol_syslog(
561
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
561
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
562 562
             );
563 563
         } elseif ($action == 'CONTRACT_CLOSE') {
564 564
             dol_syslog(
565
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
565
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
566 566
             );
567 567
         } elseif ($action == 'CONTRACT_DELETE') {
568 568
             dol_syslog(
569
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
569
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
570 570
             );
571 571
         }
572 572
 
573 573
 		elseif ($action == 'BILL_CLONE') {
574 574
             dol_syslog(
575
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
575
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
576 576
             );
577 577
         } elseif ($action == 'BILL_MODIFY') {
578 578
             dol_syslog(
579
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
579
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
580 580
             );
581 581
         } elseif ($action == 'BILL_VALIDATE') {
582 582
             dol_syslog(
583
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
583
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
584 584
             );
585 585
         } elseif ($action == 'BILL_BUILDDOC') {
586 586
             dol_syslog(
587
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
587
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
588 588
             );
589 589
         } elseif ($action == 'BILL_SENTBYMAIL') {
590 590
             dol_syslog(
591
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
591
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
592 592
             );
593 593
         } elseif ($action == 'BILL_CANCEL') {
594 594
             dol_syslog(
595
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
595
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
596 596
             );
597 597
         } elseif ($action == 'BILL_DELETE') {
598 598
             dol_syslog(
599
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
599
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
600 600
             );
601 601
         } elseif ($action == 'LINEBILL_INSERT') {
602 602
 				
603 603
         	dol_syslog(
604
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
604
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
605 605
             );
606 606
         } elseif ($action == 'LINEBILL_DELETE') {
607 607
             dol_syslog(
608
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
608
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
609 609
             );
610 610
         }
611 611
 
612 612
         // Payments
613 613
         elseif ($action == 'PAYMENT_CUSTOMER_CREATE') {
614 614
             dol_syslog(
615
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
615
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
616 616
             );
617 617
         } elseif ($action == 'PAYMENT_SUPPLIER_CREATE') {
618 618
             dol_syslog(
619
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
619
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
620 620
             );
621 621
         } elseif ($action == 'PAYMENT_ADD_TO_BANK') {
622 622
             dol_syslog(
623
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
623
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
624 624
             );
625 625
         } elseif ($action == 'PAYMENT_DELETE') {
626 626
             dol_syslog(
627
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
627
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
628 628
             );
629 629
         }
630 630
 
631 631
         // Interventions
632 632
         elseif ($action == 'FICHEINTER_CREATE') {
633 633
             dol_syslog(
634
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
634
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
635 635
             );
636 636
         } elseif ($action == 'FICHEINTER_MODIFY') {
637 637
             dol_syslog(
638
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
638
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
639 639
             );
640 640
         } elseif ($action == 'FICHEINTER_VALIDATE') {
641 641
             dol_syslog(
642
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
642
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
643 643
             );
644 644
         } elseif ($action == 'FICHEINTER_DELETE') {
645 645
             dol_syslog(
646
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
646
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
647 647
             );
648 648
         }
649 649
 
650 650
         // Members
651 651
         elseif ($action == 'MEMBER_CREATE') {
652 652
             dol_syslog(
653
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
653
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
654 654
             );
655 655
         } elseif ($action == 'MEMBER_VALIDATE') {
656 656
             dol_syslog(
657
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
657
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
658 658
             );
659 659
         } elseif ($action == 'MEMBER_SUBSCRIPTION') {
660 660
             dol_syslog(
661
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
661
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
662 662
             );
663 663
         } elseif ($action == 'MEMBER_MODIFY') {
664 664
             dol_syslog(
665
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
665
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
666 666
             );
667 667
         } elseif ($action == 'MEMBER_NEW_PASSWORD') {
668 668
             dol_syslog(
669
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
669
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
670 670
             );
671 671
         } elseif ($action == 'MEMBER_RESILIATE') {
672 672
             dol_syslog(
673
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
673
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
674 674
             );
675 675
         } elseif ($action == 'MEMBER_DELETE') {
676 676
             dol_syslog(
677
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
677
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
678 678
             );
679 679
         }
680 680
 
681 681
         // Categories
682 682
         elseif ($action == 'CATEGORY_CREATE') {
683 683
             dol_syslog(
684
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
684
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
685 685
             );
686 686
         } elseif ($action == 'CATEGORY_MODIFY') {
687 687
             dol_syslog(
688
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
688
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
689 689
             );
690 690
         } elseif ($action == 'CATEGORY_DELETE') {
691 691
             dol_syslog(
692
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
692
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
693 693
             );
694 694
         }
695 695
 
696 696
         // Projects
697 697
         elseif ($action == 'PROJECT_CREATE') {
698 698
             dol_syslog(
699
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
699
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
700 700
             );
701 701
         } elseif ($action == 'PROJECT_MODIFY') {
702 702
             dol_syslog(
703
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
703
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
704 704
             );
705 705
         } elseif ($action == 'PROJECT_DELETE') {
706 706
             dol_syslog(
707
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
707
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
708 708
             );
709 709
         }
710 710
 
711 711
         // Project tasks
712 712
         elseif ($action == 'TASK_CREATE') {
713 713
             dol_syslog(
714
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
714
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
715 715
             );
716 716
         } elseif ($action == 'TASK_MODIFY') {
717 717
             dol_syslog(
718
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
718
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
719 719
             );
720 720
         } elseif ($action == 'TASK_DELETE') {
721 721
             dol_syslog(
722
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
722
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
723 723
             );
724 724
         }
725 725
 
726 726
         // Task time spent
727 727
         elseif ($action == 'TASK_TIMESPENT_CREATE') {
728 728
             dol_syslog(
729
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
729
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
730 730
             );
731 731
         } elseif ($action == 'TASK_TIMESPENT_MODIFY') {
732 732
             dol_syslog(
733
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
733
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
734 734
             );
735 735
         } elseif ($action == 'TASK_TIMESPENT_DELETE') {
736 736
             dol_syslog(
737
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
737
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
738 738
             );
739 739
         }
740 740
 
741 741
         // Shipping
742 742
         elseif ($action == 'SHIPPING_CREATE') {
743 743
             dol_syslog(
744
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
744
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
745 745
             );
746 746
         } elseif ($action == 'SHIPPING_MODIFY') {
747 747
             dol_syslog(
748
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
748
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
749 749
             );
750 750
         } elseif ($action == 'SHIPPING_VALIDATE') {
751 751
             dol_syslog(
752
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
752
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
753 753
             );
754 754
         } elseif ($action == 'SHIPPING_SENTBYMAIL') {
755 755
             dol_syslog(
756
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
756
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
757 757
             );
758 758
         } elseif ($action == 'SHIPPING_DELETE') {
759 759
             dol_syslog(
760
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
760
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
761 761
             );
762 762
         } elseif ($action == 'SHIPPING_BUILDDOC') {
763 763
             dol_syslog(
764
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
764
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
765 765
             );
766 766
         }
767 767
 
768 768
         // File
769 769
         elseif ($action == 'FILE_UPLOAD') {
770 770
             dol_syslog(
771
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
771
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
772 772
             );
773 773
         } elseif ($action == 'FILE_DELETE') {
774 774
             dol_syslog(
775
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
775
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
776 776
             );
777 777
         }
778 778
 
Please login to merge, or discard this patch.
Braces   +42 added lines, -21 removed lines patch added patch discarded remove patch
@@ -89,12 +89,14 @@  discard block
 block discarded – undo
89 89
 
90 90
         if ($this->version == 'development') {
91 91
             return $langs->trans("Development");
92
-        } elseif ($this->version == 'experimental')
93
-
92
+        } elseif ($this->version == 'experimental') {
93
+        
94 94
                 return $langs->trans("Experimental");
95
-        elseif ($this->version == 'dolibarr') return DOL_VERSION;
96
-        elseif ($this->version) return $this->version;
97
-        else {
95
+        } elseif ($this->version == 'dolibarr') {
96
+        	return DOL_VERSION;
97
+        } elseif ($this->version) {
98
+        	return $this->version;
99
+        } else {
98 100
             return $langs->trans("Unknown");
99 101
         }
100 102
     }
@@ -122,14 +124,18 @@  discard block
 block discarded – undo
122 124
 		$subtotal_line_found = false;
123 125
 		foreach ($parent->lines as $k => &$line)
124 126
 		{
125
-			if ($line->rang < $rang) continue;
126
-			elseif ($line->rang == $rang) // Je suis sur la ligne de titre où je souhaite ajouter ma nouvelle ligne en fin de bloc
127
+			if ($line->rang < $rang) {
128
+				continue;
129
+			} elseif ($line->rang == $rang) {
130
+				// Je suis sur la ligne de titre où je souhaite ajouter ma nouvelle ligne en fin de bloc
127 131
 			{
128 132
 				$title_level = $line->qty;
129 133
 			}
130
-			elseif (!$subtotal_line_found && $title_level > -1 && ($line->qty == 100 - $title_level)) // Le level de mon titre a été trouvé avant, donc maintenant je vais m'arrêter jusqu'à trouver un sous-total
134
+			} elseif (!$subtotal_line_found && $title_level > -1 && ($line->qty == 100 - $title_level)) {
135
+				// Le level de mon titre a été trouvé avant, donc maintenant je vais m'arrêter jusqu'à trouver un sous-total
131 136
 			{
132 137
 				$subtotal_line_found = true;
138
+			}
133 139
 				$rang = $line->rang;
134 140
 			}
135 141
 			
@@ -191,8 +197,11 @@  discard block
 block discarded – undo
191 197
 						break;
192 198
 				}
193 199
 				
194
-				if (!empty($conf->global->SUBTOTAL_ADD_LINE_UNDER_TITLE_AT_END_BLOCK)) $this->addToEnd($parent, $object, $rang);
195
-				else $this->addToBegin($parent, $object, $rang);
200
+				if (!empty($conf->global->SUBTOTAL_ADD_LINE_UNDER_TITLE_AT_END_BLOCK)) {
201
+					$this->addToEnd($parent, $object, $rang);
202
+				} else {
203
+					$this->addToBegin($parent, $object, $rang);
204
+				}
196 205
 				
197 206
 			}
198 207
 			
@@ -220,7 +229,9 @@  discard block
 block discarded – undo
220 229
 						$commande->fetch($current_fk_commande);
221 230
 						
222 231
 						$label = $conf->global->SUBTOTAL_TEXT_FOR_TITLE_ORDETSTOINVOICE;
223
-						if (empty($label)) $label = 'Commande [__REFORDER__] - Référence client : [__REFCUSTOMER__]';
232
+						if (empty($label)) {
233
+							$label = 'Commande [__REFORDER__] - Référence client : [__REFCUSTOMER__]';
234
+						}
224 235
 						$label = str_replace(array('__REFORDER__', '__REFCUSTOMER__'), array($commande->ref, $commande->ref_client), $label);
225 236
 						
226 237
 						TSubtotal::addTitle($facture, $label, 1, $rang);
@@ -271,10 +282,15 @@  discard block
 block discarded – undo
271 282
 						$object->total_ht = $object->total_tva = $object->total_ttc = $object->total_localtax1 = $object->total_localtax2 = 
272 283
 							$object->multicurrency_total_ht = $object->multicurrency_total_tva = $object->multicurrency_total_ttc = 0;
273 284
 
274
-						if ($object->element == 'propal') $res = $object->update(1);
275
-						else $res = $object->update($user, 1);
285
+						if ($object->element == 'propal') {
286
+							$res = $object->update(1);
287
+						} else {
288
+							$res = $object->update($user, 1);
289
+						}
276 290
 						
277
-						if ($res > 0) setEventMessage($langs->trans('subtotal_update_nc_success'));
291
+						if ($res > 0) {
292
+							setEventMessage($langs->trans('subtotal_update_nc_success'));
293
+						}
278 294
 						break;
279 295
 					}
280 296
 				}
@@ -284,10 +300,15 @@  discard block
 block discarded – undo
284 300
 					$object->total_ht = $object->total_tva = $object->total_ttc = $object->total_localtax1 = $object->total_localtax2 = 
285 301
 							$object->multicurrency_total_ht = $object->multicurrency_total_tva = $object->multicurrency_total_ttc = 0;
286 302
 
287
-					if ($object->element == 'propaldet') $res = $object->update(1);
288
-					else $res = $object->update($user, 1);
303
+					if ($object->element == 'propaldet') {
304
+						$res = $object->update(1);
305
+					} else {
306
+						$res = $object->update($user, 1);
307
+					}
289 308
 
290
-					if ($res > 0) setEventMessage($langs->trans('subtotal_update_nc_success'));
309
+					if ($res > 0) {
310
+						setEventMessage($langs->trans('subtotal_update_nc_success'));
311
+					}
291 312
 				}
292 313
 			}
293 314
 		}
@@ -496,7 +517,9 @@  discard block
 block discarded – undo
496 517
 
497 518
 						$res = $line->update(1);
498 519
 						
499
-						if ($res > 0) setEventMessage($langs->trans('subtotal_update_nc_success'));
520
+						if ($res > 0) {
521
+							setEventMessage($langs->trans('subtotal_update_nc_success'));
522
+						}
500 523
 					}
501 524
 				}
502 525
 			}
@@ -568,9 +591,7 @@  discard block
 block discarded – undo
568 591
             dol_syslog(
569 592
                 "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
570 593
             );
571
-        }
572
-
573
-		elseif ($action == 'BILL_CLONE') {
594
+        } elseif ($action == 'BILL_CLONE') {
574 595
             dol_syslog(
575 596
                 "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
576 597
             );
Please login to merge, or discard this patch.
core/modules/modSubtotal.class.php 2 patches
Indentation   +380 added lines, -380 removed lines patch added patch discarded remove patch
@@ -31,170 +31,170 @@  discard block
 block discarded – undo
31 31
 class modSubtotal extends DolibarrModules
32 32
 {
33 33
 
34
-    /**
35
-     * 	Constructor. Define names, constants, directories, boxes, permissions
36
-     *
37
-     * 	@param	DoliDB		$db	Database handler
38
-     */
34
+	/**
35
+	 * 	Constructor. Define names, constants, directories, boxes, permissions
36
+	 *
37
+	 * 	@param	DoliDB		$db	Database handler
38
+	 */
39 39
      
40
-    public function __construct($db)
41
-    {
42
-        global $langs, $conf;
40
+	public function __construct($db)
41
+	{
42
+		global $langs, $conf;
43 43
 
44
-        $this->db = $db;
44
+		$this->db = $db;
45 45
 
46 46
 		$this->editor_name = 'ATM-Consulting';
47
-        // Id for module (must be unique).
48
-        // Use a free id here
49
-        // (See in Home -> System information -> Dolibarr for list of used modules id).
50
-        $this->numero = 104777; // 104000 to 104999 for ATM CONSULTING
51
-        // Key text used to identify module (for permissions, menus, etc...)
52
-        $this->rights_class = 'subtotal';
47
+		// Id for module (must be unique).
48
+		// Use a free id here
49
+		// (See in Home -> System information -> Dolibarr for list of used modules id).
50
+		$this->numero = 104777; // 104000 to 104999 for ATM CONSULTING
51
+		// Key text used to identify module (for permissions, menus, etc...)
52
+		$this->rights_class = 'subtotal';
53 53
 
54
-        // Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
55
-        // It is used to group modules in module setup page
56
-        $this->family = "technic";
57
-        // Module label (no space allowed)
58
-        // used if translation string 'ModuleXXXName' not found
59
-        // (where XXX is value of numeric property 'numero' of module)
60
-        $this->name = preg_replace('/^mod/i', '', get_class($this));
61
-        // Module description
62
-        // used if translation string 'ModuleXXXDesc' not found
63
-        // (where XXX is value of numeric property 'numero' of module)
64
-        $this->description = "Module permettant l'ajout de sous-totaux et sous-totaux intermédiaires et le déplacement d'une ligne aisée de l'un dans l'autre";
65
-        // Possible values for version are: 'development', 'experimental' or version
66
-        $this->version = '3.0.1';
67
-        // Key used in llx_const table to save module status enabled/disabled
68
-        // (where MYMODULE is value of property name of module in uppercase)
69
-        $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name);
70
-        // Where to store the module in setup page
71
-        // (0=common,1=interface,2=others,3=very specific)
72
-        $this->special = 2;
73
-        // Name of image file used for this module.
74
-        // If file is in theme/yourtheme/img directory under name object_pictovalue.png
75
-        // use this->picto='pictovalue'
76
-        // If file is in module/img directory under name object_pictovalue.png
77
-        // use this->picto='pictovalue@module'
78
-        $this->picto = 'subtotal@subtotal'; // mypicto@titre
79
-        // Defined all module parts (triggers, login, substitutions, menus, css, etc...)
80
-        // for default path (eg: /titre/core/xxxxx) (0=disable, 1=enable)
81
-        // for specific path of parts (eg: /titre/core/modules/barcode)
82
-        // for specific css file (eg: /titre/css/titre.css.php)
83
-        $this->module_parts = array(
84
-            // Set this to 1 if module has its own trigger directory
85
-            'triggers' => 1,
86
-            // Set this to 1 if module has its own login method directory
87
-            //'login' => 0,
88
-            // Set this to 1 if module has its own substitution function file
89
-            //'substitutions' => 0,
90
-            // Set this to 1 if module has its own menus handler directory
91
-            //'menus' => 0,
92
-            // Set this to 1 if module has its own barcode directory
93
-            //'barcode' => 0,
94
-            // Set this to 1 if module has its own models directory
95
-            'models' => 1,
96
-            // Set this to relative path of css if module has its own css file
97
-            //'css' => '/titre/css/mycss.css.php',
98
-            // Set here all hooks context managed by module
99
-            'hooks' => array('invoicecard','propalcard','ordercard','odtgeneration','orderstoinvoice','admin','invoicereccard')
100
-            // Set here all workflow context managed by module
101
-            //'workflow' => array('order' => array('WORKFLOW_ORDER_AUTOCREATE_INVOICE'))
102
-        );
54
+		// Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
55
+		// It is used to group modules in module setup page
56
+		$this->family = "technic";
57
+		// Module label (no space allowed)
58
+		// used if translation string 'ModuleXXXName' not found
59
+		// (where XXX is value of numeric property 'numero' of module)
60
+		$this->name = preg_replace('/^mod/i', '', get_class($this));
61
+		// Module description
62
+		// used if translation string 'ModuleXXXDesc' not found
63
+		// (where XXX is value of numeric property 'numero' of module)
64
+		$this->description = "Module permettant l'ajout de sous-totaux et sous-totaux intermédiaires et le déplacement d'une ligne aisée de l'un dans l'autre";
65
+		// Possible values for version are: 'development', 'experimental' or version
66
+		$this->version = '3.0.1';
67
+		// Key used in llx_const table to save module status enabled/disabled
68
+		// (where MYMODULE is value of property name of module in uppercase)
69
+		$this->const_name = 'MAIN_MODULE_' . strtoupper($this->name);
70
+		// Where to store the module in setup page
71
+		// (0=common,1=interface,2=others,3=very specific)
72
+		$this->special = 2;
73
+		// Name of image file used for this module.
74
+		// If file is in theme/yourtheme/img directory under name object_pictovalue.png
75
+		// use this->picto='pictovalue'
76
+		// If file is in module/img directory under name object_pictovalue.png
77
+		// use this->picto='pictovalue@module'
78
+		$this->picto = 'subtotal@subtotal'; // mypicto@titre
79
+		// Defined all module parts (triggers, login, substitutions, menus, css, etc...)
80
+		// for default path (eg: /titre/core/xxxxx) (0=disable, 1=enable)
81
+		// for specific path of parts (eg: /titre/core/modules/barcode)
82
+		// for specific css file (eg: /titre/css/titre.css.php)
83
+		$this->module_parts = array(
84
+			// Set this to 1 if module has its own trigger directory
85
+			'triggers' => 1,
86
+			// Set this to 1 if module has its own login method directory
87
+			//'login' => 0,
88
+			// Set this to 1 if module has its own substitution function file
89
+			//'substitutions' => 0,
90
+			// Set this to 1 if module has its own menus handler directory
91
+			//'menus' => 0,
92
+			// Set this to 1 if module has its own barcode directory
93
+			//'barcode' => 0,
94
+			// Set this to 1 if module has its own models directory
95
+			'models' => 1,
96
+			// Set this to relative path of css if module has its own css file
97
+			//'css' => '/titre/css/mycss.css.php',
98
+			// Set here all hooks context managed by module
99
+			'hooks' => array('invoicecard','propalcard','ordercard','odtgeneration','orderstoinvoice','admin','invoicereccard')
100
+			// Set here all workflow context managed by module
101
+			//'workflow' => array('order' => array('WORKFLOW_ORDER_AUTOCREATE_INVOICE'))
102
+		);
103 103
 
104
-        // Data directories to create when module is enabled.
105
-        // Example: this->dirs = array("/titre/temp");
106
-        $this->dirs = array();
104
+		// Data directories to create when module is enabled.
105
+		// Example: this->dirs = array("/titre/temp");
106
+		$this->dirs = array();
107 107
 
108
-        // Config pages. Put here list of php pages
109
-        // stored into titre/admin directory, used to setup module.
110
-        $this->config_page_url = array("subtotal_setup.php@subtotal");
108
+		// Config pages. Put here list of php pages
109
+		// stored into titre/admin directory, used to setup module.
110
+		$this->config_page_url = array("subtotal_setup.php@subtotal");
111 111
 
112
-        // Dependencies
113
-        // List of modules id that must be enabled if this module is enabled
114
-        $this->depends = array();
112
+		// Dependencies
113
+		// List of modules id that must be enabled if this module is enabled
114
+		$this->depends = array();
115 115
 
116 116
 		$this->conflictwith=array('modMilestone');
117
-        // List of modules id to disable if this one is disabled
118
-        $this->requiredby = array();
119
-        // Minimum version of PHP required by module
120
-        $this->phpmin = array(5, 3);
121
-        // Minimum version of Dolibarr required by module
122
-        $this->need_dolibarr_version = array(3, 2);
123
-        $this->langfiles = array("subtotal@subtotal"); // langfiles@titre
124
-        // Constants
125
-        // List of particular constants to add when module is enabled
126
-        // (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
127
-        // Example:
128
-        $this->const = array(
129
-            	0=>array(
130
-            		'SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES',
131
-            		'chaine',
132
-            		'I',
133
-            		'Définit le style (B : gras, I : Italique, U : Souligné) des sous titres lorsque le détail des lignes et des ensembles est caché',
134
-            		1
135
-            	)
117
+		// List of modules id to disable if this one is disabled
118
+		$this->requiredby = array();
119
+		// Minimum version of PHP required by module
120
+		$this->phpmin = array(5, 3);
121
+		// Minimum version of Dolibarr required by module
122
+		$this->need_dolibarr_version = array(3, 2);
123
+		$this->langfiles = array("subtotal@subtotal"); // langfiles@titre
124
+		// Constants
125
+		// List of particular constants to add when module is enabled
126
+		// (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
127
+		// Example:
128
+		$this->const = array(
129
+				0=>array(
130
+					'SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES',
131
+					'chaine',
132
+					'I',
133
+					'Définit le style (B : gras, I : Italique, U : Souligné) des sous titres lorsque le détail des lignes et des ensembles est caché',
134
+					1
135
+				)
136 136
 				,1=>array('SUBTOTAL_ALLOW_ADD_BLOCK', 'chaine', '1', 'Permet l\'ajout de titres et sous-totaux')
137 137
 				,2=>array('SUBTOTAL_ALLOW_EDIT_BLOCK', 'chaine', '1', 'Permet de modifier titres et sous-totaux')
138 138
 				,3=>array('SUBTOTAL_ALLOW_REMOVE_BLOCK', 'chaine', '1', 'Permet de supprimer les titres et sous-totaux')
139 139
 				,4=>array('SUBTOTAL_TITLE_STYLE', 'chaine', 'BU')
140 140
 				,5=>array('SUBTOTAL_SUBTOTAL_STYLE', 'chaine', 'B')
141
-            //	1=>array(
142
-            //		'MYMODULE_MYNEWCONST2',
143
-            //		'chaine',
144
-            //		'myvalue',
145
-            //		'This is another constant to add',
146
-            //		0
147
-            //	)
148
-        );
141
+			//	1=>array(
142
+			//		'MYMODULE_MYNEWCONST2',
143
+			//		'chaine',
144
+			//		'myvalue',
145
+			//		'This is another constant to add',
146
+			//		0
147
+			//	)
148
+		);
149 149
 		
150 150
 
151 151
 
152 152
 
153
-        // Array to add new pages in new tabs
154
-        // Example:
155
-        $this->tabs = array(
156
-            //	// To add a new tab identified by code tabname1
157
-            //	'objecttype:+tabname1:Title1:langfile@titre:$user->rights->titre->read:/titre/mynewtab1.php?id=__ID__',
158
-            //	// To add another new tab identified by code tabname2
159
-            //	'objecttype:+tabname2:Title2:langfile@titre:$user->rights->othermodule->read:/titre/mynewtab2.php?id=__ID__',
160
-            //	// To remove an existing tab identified by code tabname
161
-            //	'objecttype:-tabname'
162
-        );
163
-        // where objecttype can be
164
-        // 'thirdparty'			to add a tab in third party view
165
-        // 'intervention'		to add a tab in intervention view
166
-        // 'order_supplier'		to add a tab in supplier order view
167
-        // 'invoice_supplier'	to add a tab in supplier invoice view
168
-        // 'invoice'			to add a tab in customer invoice view
169
-        // 'order'				to add a tab in customer order view
170
-        // 'product'			to add a tab in product view
171
-        // 'stock'				to add a tab in stock view
172
-        // 'propal'				to add a tab in propal view
173
-        // 'member'				to add a tab in fundation member view
174
-        // 'contract'			to add a tab in contract view
175
-        // 'user'				to add a tab in user view
176
-        // 'group'				to add a tab in group view
177
-        // 'contact'			to add a tab in contact view
178
-        // 'categories_x'		to add a tab in category view
179
-        // (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member)
180
-        // Dictionnaries
181
-        if (! isset($conf->subtotal->enabled)) {
182
-            $conf->subtotal=new stdClass();
183
-            $conf->subtotal->enabled = 0;
184
-        }
185
-        $this->dictionaries = array(
153
+		// Array to add new pages in new tabs
154
+		// Example:
155
+		$this->tabs = array(
156
+			//	// To add a new tab identified by code tabname1
157
+			//	'objecttype:+tabname1:Title1:langfile@titre:$user->rights->titre->read:/titre/mynewtab1.php?id=__ID__',
158
+			//	// To add another new tab identified by code tabname2
159
+			//	'objecttype:+tabname2:Title2:langfile@titre:$user->rights->othermodule->read:/titre/mynewtab2.php?id=__ID__',
160
+			//	// To remove an existing tab identified by code tabname
161
+			//	'objecttype:-tabname'
162
+		);
163
+		// where objecttype can be
164
+		// 'thirdparty'			to add a tab in third party view
165
+		// 'intervention'		to add a tab in intervention view
166
+		// 'order_supplier'		to add a tab in supplier order view
167
+		// 'invoice_supplier'	to add a tab in supplier invoice view
168
+		// 'invoice'			to add a tab in customer invoice view
169
+		// 'order'				to add a tab in customer order view
170
+		// 'product'			to add a tab in product view
171
+		// 'stock'				to add a tab in stock view
172
+		// 'propal'				to add a tab in propal view
173
+		// 'member'				to add a tab in fundation member view
174
+		// 'contract'			to add a tab in contract view
175
+		// 'user'				to add a tab in user view
176
+		// 'group'				to add a tab in group view
177
+		// 'contact'			to add a tab in contact view
178
+		// 'categories_x'		to add a tab in category view
179
+		// (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member)
180
+		// Dictionnaries
181
+		if (! isset($conf->subtotal->enabled)) {
182
+			$conf->subtotal=new stdClass();
183
+			$conf->subtotal->enabled = 0;
184
+		}
185
+		$this->dictionaries = array(
186 186
 			'langs'=>'subtotal@subtotal',
187
-            'tabname'=>array(MAIN_DB_PREFIX.'c_subtotal_free_text'),		// List of tables we want to see into dictonnary editor
188
-            'tablib'=>array($langs->trans('subtotalFreeLineDictionary')),													// Label of tables
189
-            'tabsql'=>array('SELECT f.rowid as rowid, f.label, f.content, f.entity, f.active FROM '.MAIN_DB_PREFIX.'c_subtotal_free_text as f WHERE f.entity='.$conf->entity),	// Request to select fields
190
-            'tabsqlsort'=>array('label ASC'),																					// Sort order
191
-            'tabfield'=>array('label,content'),							// List of fields (result of select to show dictionary)
192
-            'tabfieldvalue'=>array('label,content'),						// List of fields (list of fields to edit a record)
193
-            'tabfieldinsert'=>array('label,content,entity'),					// List of fields (list of fields for insert)
194
-            'tabrowid'=>array('rowid'),											// Name of columns with primary key (try to always name it 'rowid')
195
-            'tabcond'=>array($conf->subtotal->enabled)	
187
+			'tabname'=>array(MAIN_DB_PREFIX.'c_subtotal_free_text'),		// List of tables we want to see into dictonnary editor
188
+			'tablib'=>array($langs->trans('subtotalFreeLineDictionary')),													// Label of tables
189
+			'tabsql'=>array('SELECT f.rowid as rowid, f.label, f.content, f.entity, f.active FROM '.MAIN_DB_PREFIX.'c_subtotal_free_text as f WHERE f.entity='.$conf->entity),	// Request to select fields
190
+			'tabsqlsort'=>array('label ASC'),																					// Sort order
191
+			'tabfield'=>array('label,content'),							// List of fields (result of select to show dictionary)
192
+			'tabfieldvalue'=>array('label,content'),						// List of fields (list of fields to edit a record)
193
+			'tabfieldinsert'=>array('label,content,entity'),					// List of fields (list of fields for insert)
194
+			'tabrowid'=>array('rowid'),											// Name of columns with primary key (try to always name it 'rowid')
195
+			'tabcond'=>array($conf->subtotal->enabled)	
196 196
 		);
197
-        /* Example:
197
+		/* Example:
198 198
           // This is to avoid warnings
199 199
           if (! isset($conf->titre->enabled)) $conf->titre->enabled=0;
200 200
           $this->dictionnaries=array(
@@ -235,223 +235,223 @@  discard block
 block discarded – undo
235 235
           );
236 236
          */
237 237
 
238
-        // Boxes
239
-        // Add here list of php file(s) stored in core/boxes that contains class to show a box.
240
-        $this->boxes = array(); // Boxes list
238
+		// Boxes
239
+		// Add here list of php file(s) stored in core/boxes that contains class to show a box.
240
+		$this->boxes = array(); // Boxes list
241 241
        
242
-        /*
242
+		/*
243 243
           $this->boxes[$r][1] = "myboxb.php";
244 244
           $r++;
245 245
          */
246 246
 
247
-        // Permissions
248
-        $this->rights = array(); // Permission array used by this module
249
-        $r = 0;
247
+		// Permissions
248
+		$this->rights = array(); // Permission array used by this module
249
+		$r = 0;
250 250
 
251
-        // Add here list of permission defined by
252
-        // an id, a label, a boolean and two constant strings.
253
-        // Example:
254
-        //// Permission id (must not be already used)
255
-        //$this->rights[$r][0] = 2000;
256
-        //// Permission label
257
-        //$this->rights[$r][1] = 'Permision label';
258
-        //// Permission by default for new user (0/1)
259
-        //$this->rights[$r][3] = 1;
260
-        //// In php code, permission will be checked by test
261
-        //// if ($user->rights->permkey->level1->level2)
262
-        //$this->rights[$r][4] = 'level1';
263
-        //// In php code, permission will be checked by test
264
-        //// if ($user->rights->permkey->level1->level2)
265
-        //$this->rights[$r][5] = 'level2';
266
-        //$r++;
267
-        // Main menu entries
268
-        $this->menus = array(); // List of menus to add
269
-        $r = 0;
251
+		// Add here list of permission defined by
252
+		// an id, a label, a boolean and two constant strings.
253
+		// Example:
254
+		//// Permission id (must not be already used)
255
+		//$this->rights[$r][0] = 2000;
256
+		//// Permission label
257
+		//$this->rights[$r][1] = 'Permision label';
258
+		//// Permission by default for new user (0/1)
259
+		//$this->rights[$r][3] = 1;
260
+		//// In php code, permission will be checked by test
261
+		//// if ($user->rights->permkey->level1->level2)
262
+		//$this->rights[$r][4] = 'level1';
263
+		//// In php code, permission will be checked by test
264
+		//// if ($user->rights->permkey->level1->level2)
265
+		//$this->rights[$r][5] = 'level2';
266
+		//$r++;
267
+		// Main menu entries
268
+		$this->menus = array(); // List of menus to add
269
+		$r = 0;
270 270
 
271
-        // Add here entries to declare new menus
272
-        //
273
-        // Example to declare a new Top Menu entry and its Left menu entry:
274
-        //$this->menu[$r]=array(
275
-        //	// Put 0 if this is a top menu
276
-        //	'fk_menu'=>0,
277
-        //	// This is a Top menu entry
278
-        //	'type'=>'top',
279
-        //	'titre'=>'titre top menu',
280
-        //	'mainmenu'=>'titre',
281
-        //	'leftmenu'=>'titre',
282
-        //	'url'=>'/titre/pagetop.php',
283
-        //	// Lang file to use (without .lang) by module.
284
-        //	// File must be in langs/code_CODE/ directory.
285
-        //	'langs'=>'mylangfile',
286
-        //	'position'=>100,
287
-        //	// Define condition to show or hide menu entry.
288
-        //	// Use '$conf->titre->enabled' if entry must be visible if module is enabled.
289
-        //	'enabled'=>'$conf->titre->enabled',
290
-        //	// Use 'perms'=>'$user->rights->titre->level1->level2'
291
-        //	// if you want your menu with a permission rules
292
-        //	'perms'=>'1',
293
-        //	'target'=>'',
294
-        //	// 0=Menu for internal users, 1=external users, 2=both
295
-        //	'user'=>2
296
-        //);
297
-        //$r++;
298
-        //$this->menu[$r]=array(
299
-        //	// Use r=value where r is index key used for the parent menu entry
300
-        //	// (higher parent must be a top menu entry)
301
-        //	'fk_menu'=>'r=0',
302
-        //	// This is a Left menu entry
303
-        //	'type'=>'left',
304
-        //	'titre'=>'titre left menu',
305
-        //	'mainmenu'=>'titre',
306
-        //	'leftmenu'=>'titre',
307
-        //	'url'=>'/titre/pagelevel1.php',
308
-        //	// Lang file to use (without .lang) by module.
309
-        //	// File must be in langs/code_CODE/ directory.
310
-        //	'langs'=>'mylangfile',
311
-        //	'position'=>100,
312
-        //	// Define condition to show or hide menu entry.
313
-        //	// Use '$conf->titre->enabled' if entry must be visible if module is enabled.
314
-        //	'enabled'=>'$conf->titre->enabled',
315
-        //	// Use 'perms'=>'$user->rights->titre->level1->level2'
316
-        //	// if you want your menu with a permission rules
317
-        //	'perms'=>'1',
318
-        //	'target'=>'',
319
-        //	// 0=Menu for internal users, 1=external users, 2=both
320
-        //	'user'=>2
321
-        //);
322
-        //$r++;
323
-        //
324
-        // Example to declare a Left Menu entry into an existing Top menu entry:
325
-        //$this->menu[$r]=array(
326
-        //	// Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy'
327
-        //	'fk_menu'=>'fk_mainmenu=mainmenucode',
328
-        //	// This is a Left menu entry
329
-        //	'type'=>'left',
330
-        //	'titre'=>'titre left menu',
331
-        //	'mainmenu'=>'mainmenucode',
332
-        //	'leftmenu'=>'titre',
333
-        //	'url'=>'/titre/pagelevel2.php',
334
-        //	// Lang file to use (without .lang) by module.
335
-        //	// File must be in langs/code_CODE/ directory.
336
-        //	'langs'=>'mylangfile',
337
-        //	'position'=>100,
338
-        //	// Define condition to show or hide menu entry.
339
-        //	// Use '$conf->titre->enabled' if entry must be visible if module is enabled.
340
-        //	// Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
341
-        //	'enabled'=>'$conf->titre->enabled',
342
-        //	// Use 'perms'=>'$user->rights->titre->level1->level2'
343
-        //	// if you want your menu with a permission rules
344
-        //	'perms'=>'1',
345
-        //	'target'=>'',
346
-        //	// 0=Menu for internal users, 1=external users, 2=both
347
-        //	'user'=>2
348
-        //);
349
-        //$r++;
350
-        // Exports
351
-        $r = 1;
271
+		// Add here entries to declare new menus
272
+		//
273
+		// Example to declare a new Top Menu entry and its Left menu entry:
274
+		//$this->menu[$r]=array(
275
+		//	// Put 0 if this is a top menu
276
+		//	'fk_menu'=>0,
277
+		//	// This is a Top menu entry
278
+		//	'type'=>'top',
279
+		//	'titre'=>'titre top menu',
280
+		//	'mainmenu'=>'titre',
281
+		//	'leftmenu'=>'titre',
282
+		//	'url'=>'/titre/pagetop.php',
283
+		//	// Lang file to use (without .lang) by module.
284
+		//	// File must be in langs/code_CODE/ directory.
285
+		//	'langs'=>'mylangfile',
286
+		//	'position'=>100,
287
+		//	// Define condition to show or hide menu entry.
288
+		//	// Use '$conf->titre->enabled' if entry must be visible if module is enabled.
289
+		//	'enabled'=>'$conf->titre->enabled',
290
+		//	// Use 'perms'=>'$user->rights->titre->level1->level2'
291
+		//	// if you want your menu with a permission rules
292
+		//	'perms'=>'1',
293
+		//	'target'=>'',
294
+		//	// 0=Menu for internal users, 1=external users, 2=both
295
+		//	'user'=>2
296
+		//);
297
+		//$r++;
298
+		//$this->menu[$r]=array(
299
+		//	// Use r=value where r is index key used for the parent menu entry
300
+		//	// (higher parent must be a top menu entry)
301
+		//	'fk_menu'=>'r=0',
302
+		//	// This is a Left menu entry
303
+		//	'type'=>'left',
304
+		//	'titre'=>'titre left menu',
305
+		//	'mainmenu'=>'titre',
306
+		//	'leftmenu'=>'titre',
307
+		//	'url'=>'/titre/pagelevel1.php',
308
+		//	// Lang file to use (without .lang) by module.
309
+		//	// File must be in langs/code_CODE/ directory.
310
+		//	'langs'=>'mylangfile',
311
+		//	'position'=>100,
312
+		//	// Define condition to show or hide menu entry.
313
+		//	// Use '$conf->titre->enabled' if entry must be visible if module is enabled.
314
+		//	'enabled'=>'$conf->titre->enabled',
315
+		//	// Use 'perms'=>'$user->rights->titre->level1->level2'
316
+		//	// if you want your menu with a permission rules
317
+		//	'perms'=>'1',
318
+		//	'target'=>'',
319
+		//	// 0=Menu for internal users, 1=external users, 2=both
320
+		//	'user'=>2
321
+		//);
322
+		//$r++;
323
+		//
324
+		// Example to declare a Left Menu entry into an existing Top menu entry:
325
+		//$this->menu[$r]=array(
326
+		//	// Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy'
327
+		//	'fk_menu'=>'fk_mainmenu=mainmenucode',
328
+		//	// This is a Left menu entry
329
+		//	'type'=>'left',
330
+		//	'titre'=>'titre left menu',
331
+		//	'mainmenu'=>'mainmenucode',
332
+		//	'leftmenu'=>'titre',
333
+		//	'url'=>'/titre/pagelevel2.php',
334
+		//	// Lang file to use (without .lang) by module.
335
+		//	// File must be in langs/code_CODE/ directory.
336
+		//	'langs'=>'mylangfile',
337
+		//	'position'=>100,
338
+		//	// Define condition to show or hide menu entry.
339
+		//	// Use '$conf->titre->enabled' if entry must be visible if module is enabled.
340
+		//	// Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
341
+		//	'enabled'=>'$conf->titre->enabled',
342
+		//	// Use 'perms'=>'$user->rights->titre->level1->level2'
343
+		//	// if you want your menu with a permission rules
344
+		//	'perms'=>'1',
345
+		//	'target'=>'',
346
+		//	// 0=Menu for internal users, 1=external users, 2=both
347
+		//	'user'=>2
348
+		//);
349
+		//$r++;
350
+		// Exports
351
+		$r = 1;
352 352
 
353
-        // Example:
354
-        //$this->export_code[$r]=$this->rights_class.'_'.$r;
355
-        //// Translation key (used only if key ExportDataset_xxx_z not found)
356
-        //$this->export_label[$r]='CustomersInvoicesAndInvoiceLines';
357
-        //// Condition to show export in list (ie: '$user->id==3').
358
-        //// Set to 1 to always show when module is enabled.
359
-        //$this->export_enabled[$r]='1';
360
-        //$this->export_permission[$r]=array(array("facture","facture","export"));
361
-        //$this->export_fields_array[$r]=array(
362
-        //	's.rowid'=>"IdCompany",
363
-        //	's.nom'=>'CompanyName',
364
-        //	's.address'=>'Address',
365
-        //	's.cp'=>'Zip',
366
-        //	's.ville'=>'Town',
367
-        //	's.fk_pays'=>'Country',
368
-        //	's.tel'=>'Phone',
369
-        //	's.siren'=>'ProfId1',
370
-        //	's.siret'=>'ProfId2',
371
-        //	's.ape'=>'ProfId3',
372
-        //	's.idprof4'=>'ProfId4',
373
-        //	's.code_compta'=>'CustomerAccountancyCode',
374
-        //	's.code_compta_fournisseur'=>'SupplierAccountancyCode',
375
-        //	'f.rowid'=>"InvoiceId",
376
-        //	'f.facnumber'=>"InvoiceRef",
377
-        //	'f.datec'=>"InvoiceDateCreation",
378
-        //	'f.datef'=>"DateInvoice",
379
-        //	'f.total'=>"TotalHT",
380
-        //	'f.total_ttc'=>"TotalTTC",
381
-        //	'f.tva'=>"TotalVAT",
382
-        //	'f.paye'=>"InvoicePaid",
383
-        //	'f.fk_statut'=>'InvoiceStatus',
384
-        //	'f.note'=>"InvoiceNote",
385
-        //	'fd.rowid'=>'LineId',
386
-        //	'fd.description'=>"LineDescription",
387
-        //	'fd.price'=>"LineUnitPrice",
388
-        //	'fd.tva_tx'=>"LineVATRate",
389
-        //	'fd.qty'=>"LineQty",
390
-        //	'fd.total_ht'=>"LineTotalHT",
391
-        //	'fd.total_tva'=>"LineTotalTVA",
392
-        //	'fd.total_ttc'=>"LineTotalTTC",
393
-        //	'fd.date_start'=>"DateStart",
394
-        //	'fd.date_end'=>"DateEnd",
395
-        //	'fd.fk_product'=>'ProductId',
396
-        //	'p.ref'=>'ProductRef'
397
-        //);
398
-        //$this->export_entities_array[$r]=array('s.rowid'=>"company",
399
-        //	's.nom'=>'company',
400
-        //	's.address'=>'company',
401
-        //	's.cp'=>'company',
402
-        //	's.ville'=>'company',
403
-        //	's.fk_pays'=>'company',
404
-        //	's.tel'=>'company',
405
-        //	's.siren'=>'company',
406
-        //	's.siret'=>'company',
407
-        //	's.ape'=>'company',
408
-        //	's.idprof4'=>'company',
409
-        //	's.code_compta'=>'company',
410
-        //	's.code_compta_fournisseur'=>'company',
411
-        //	'f.rowid'=>"invoice",
412
-        //	'f.facnumber'=>"invoice",
413
-        //	'f.datec'=>"invoice",
414
-        //	'f.datef'=>"invoice",
415
-        //	'f.total'=>"invoice",
416
-        //	'f.total_ttc'=>"invoice",
417
-        //	'f.tva'=>"invoice",
418
-        //	'f.paye'=>"invoice",
419
-        //	'f.fk_statut'=>'invoice',
420
-        //	'f.note'=>"invoice",
421
-        //	'fd.rowid'=>'invoice_line',
422
-        //	'fd.description'=>"invoice_line",
423
-        //	'fd.price'=>"invoice_line",
424
-        //	'fd.total_ht'=>"invoice_line",
425
-        //	'fd.total_tva'=>"invoice_line",
426
-        //	'fd.total_ttc'=>"invoice_line",
427
-        //	'fd.tva_tx'=>"invoice_line",
428
-        //	'fd.qty'=>"invoice_line",
429
-        //	'fd.date_start'=>"invoice_line",
430
-        //	'fd.date_end'=>"invoice_line",
431
-        //	'fd.fk_product'=>'product',
432
-        //	'p.ref'=>'product'
433
-        //);
434
-        //$this->export_sql_start[$r] = 'SELECT DISTINCT ';
435
-        //$this->export_sql_end[$r] = ' FROM (' . MAIN_DB_PREFIX . 'facture as f, '
436
-        //	. MAIN_DB_PREFIX . 'facturedet as fd, ' . MAIN_DB_PREFIX . 'societe as s)';
437
-        //$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX
438
-        //	. 'product as p on (fd.fk_product = p.rowid)';
439
-        //$this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid '
440
-        //	. 'AND f.rowid = fd.fk_facture';
441
-        //$r++;
442
-    }
353
+		// Example:
354
+		//$this->export_code[$r]=$this->rights_class.'_'.$r;
355
+		//// Translation key (used only if key ExportDataset_xxx_z not found)
356
+		//$this->export_label[$r]='CustomersInvoicesAndInvoiceLines';
357
+		//// Condition to show export in list (ie: '$user->id==3').
358
+		//// Set to 1 to always show when module is enabled.
359
+		//$this->export_enabled[$r]='1';
360
+		//$this->export_permission[$r]=array(array("facture","facture","export"));
361
+		//$this->export_fields_array[$r]=array(
362
+		//	's.rowid'=>"IdCompany",
363
+		//	's.nom'=>'CompanyName',
364
+		//	's.address'=>'Address',
365
+		//	's.cp'=>'Zip',
366
+		//	's.ville'=>'Town',
367
+		//	's.fk_pays'=>'Country',
368
+		//	's.tel'=>'Phone',
369
+		//	's.siren'=>'ProfId1',
370
+		//	's.siret'=>'ProfId2',
371
+		//	's.ape'=>'ProfId3',
372
+		//	's.idprof4'=>'ProfId4',
373
+		//	's.code_compta'=>'CustomerAccountancyCode',
374
+		//	's.code_compta_fournisseur'=>'SupplierAccountancyCode',
375
+		//	'f.rowid'=>"InvoiceId",
376
+		//	'f.facnumber'=>"InvoiceRef",
377
+		//	'f.datec'=>"InvoiceDateCreation",
378
+		//	'f.datef'=>"DateInvoice",
379
+		//	'f.total'=>"TotalHT",
380
+		//	'f.total_ttc'=>"TotalTTC",
381
+		//	'f.tva'=>"TotalVAT",
382
+		//	'f.paye'=>"InvoicePaid",
383
+		//	'f.fk_statut'=>'InvoiceStatus',
384
+		//	'f.note'=>"InvoiceNote",
385
+		//	'fd.rowid'=>'LineId',
386
+		//	'fd.description'=>"LineDescription",
387
+		//	'fd.price'=>"LineUnitPrice",
388
+		//	'fd.tva_tx'=>"LineVATRate",
389
+		//	'fd.qty'=>"LineQty",
390
+		//	'fd.total_ht'=>"LineTotalHT",
391
+		//	'fd.total_tva'=>"LineTotalTVA",
392
+		//	'fd.total_ttc'=>"LineTotalTTC",
393
+		//	'fd.date_start'=>"DateStart",
394
+		//	'fd.date_end'=>"DateEnd",
395
+		//	'fd.fk_product'=>'ProductId',
396
+		//	'p.ref'=>'ProductRef'
397
+		//);
398
+		//$this->export_entities_array[$r]=array('s.rowid'=>"company",
399
+		//	's.nom'=>'company',
400
+		//	's.address'=>'company',
401
+		//	's.cp'=>'company',
402
+		//	's.ville'=>'company',
403
+		//	's.fk_pays'=>'company',
404
+		//	's.tel'=>'company',
405
+		//	's.siren'=>'company',
406
+		//	's.siret'=>'company',
407
+		//	's.ape'=>'company',
408
+		//	's.idprof4'=>'company',
409
+		//	's.code_compta'=>'company',
410
+		//	's.code_compta_fournisseur'=>'company',
411
+		//	'f.rowid'=>"invoice",
412
+		//	'f.facnumber'=>"invoice",
413
+		//	'f.datec'=>"invoice",
414
+		//	'f.datef'=>"invoice",
415
+		//	'f.total'=>"invoice",
416
+		//	'f.total_ttc'=>"invoice",
417
+		//	'f.tva'=>"invoice",
418
+		//	'f.paye'=>"invoice",
419
+		//	'f.fk_statut'=>'invoice',
420
+		//	'f.note'=>"invoice",
421
+		//	'fd.rowid'=>'invoice_line',
422
+		//	'fd.description'=>"invoice_line",
423
+		//	'fd.price'=>"invoice_line",
424
+		//	'fd.total_ht'=>"invoice_line",
425
+		//	'fd.total_tva'=>"invoice_line",
426
+		//	'fd.total_ttc'=>"invoice_line",
427
+		//	'fd.tva_tx'=>"invoice_line",
428
+		//	'fd.qty'=>"invoice_line",
429
+		//	'fd.date_start'=>"invoice_line",
430
+		//	'fd.date_end'=>"invoice_line",
431
+		//	'fd.fk_product'=>'product',
432
+		//	'p.ref'=>'product'
433
+		//);
434
+		//$this->export_sql_start[$r] = 'SELECT DISTINCT ';
435
+		//$this->export_sql_end[$r] = ' FROM (' . MAIN_DB_PREFIX . 'facture as f, '
436
+		//	. MAIN_DB_PREFIX . 'facturedet as fd, ' . MAIN_DB_PREFIX . 'societe as s)';
437
+		//$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX
438
+		//	. 'product as p on (fd.fk_product = p.rowid)';
439
+		//$this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid '
440
+		//	. 'AND f.rowid = fd.fk_facture';
441
+		//$r++;
442
+	}
443 443
 
444
-    /**
445
-     * Function called when module is enabled.
446
-     * The init function add constants, boxes, permissions and menus
447
-     * (defined in constructor) into Dolibarr database.
448
-     * It also creates data directories
449
-     *
450
-     * 	@param		string	$options	Options when enabling module ('', 'noboxes')
451
-     * 	@return		int					1 if OK, 0 if KO
452
-     */
453
-    public function init($options = '')
454
-    {
444
+	/**
445
+	 * Function called when module is enabled.
446
+	 * The init function add constants, boxes, permissions and menus
447
+	 * (defined in constructor) into Dolibarr database.
448
+	 * It also creates data directories
449
+	 *
450
+	 * 	@param		string	$options	Options when enabling module ('', 'noboxes')
451
+	 * 	@return		int					1 if OK, 0 if KO
452
+	 */
453
+	public function init($options = '')
454
+	{
455 455
 	  	global $conf;
456 456
 		
457 457
 		
@@ -459,39 +459,39 @@  discard block
 block discarded – undo
459 459
 			exit("Attention, ce module rentre ne conflit avec le module Jalon/Milestones. Merci de le désactiver auparavant.");
460 460
 		}
461 461
       */
462
-	    $sql = array();
462
+		$sql = array();
463 463
 
464
-        $result = $this->loadTables();
464
+		$result = $this->loadTables();
465 465
 
466 466
 		
467
-        return $this->_init($sql, $options);
468
-    }
467
+		return $this->_init($sql, $options);
468
+	}
469 469
 
470
-    /**
471
-     * Function called when module is disabled.
472
-     * Remove from database constants, boxes and permissions from Dolibarr database.
473
-     * Data directories are not deleted
474
-     *
475
-     * 	@param		string	$options	Options when enabling module ('', 'noboxes')
476
-     * 	@return		int					1 if OK, 0 if KO
477
-     */
478
-    public function remove($options = '')
479
-    {
480
-        $sql = array();
470
+	/**
471
+	 * Function called when module is disabled.
472
+	 * Remove from database constants, boxes and permissions from Dolibarr database.
473
+	 * Data directories are not deleted
474
+	 *
475
+	 * 	@param		string	$options	Options when enabling module ('', 'noboxes')
476
+	 * 	@return		int					1 if OK, 0 if KO
477
+	 */
478
+	public function remove($options = '')
479
+	{
480
+		$sql = array();
481 481
 
482
-        return $this->_remove($sql, $options);
483
-    }
482
+		return $this->_remove($sql, $options);
483
+	}
484 484
 
485
-    /**
486
-     * Create tables, keys and data required by module
487
-     * Files llx_table1.sql, llx_table1.key.sql llx_data.sql with create table, create keys
488
-     * and create data commands must be stored in directory /titre/sql/
489
-     * This function is called by this->init
490
-     *
491
-     * 	@return		int		<=0 if KO, >0 if OK
492
-     */
493
-    private function loadTables()
494
-    {
495
-        return $this->_load_tables('/subtotal/sql/');
496
-    }
485
+	/**
486
+	 * Create tables, keys and data required by module
487
+	 * Files llx_table1.sql, llx_table1.key.sql llx_data.sql with create table, create keys
488
+	 * and create data commands must be stored in directory /titre/sql/
489
+	 * This function is called by this->init
490
+	 *
491
+	 * 	@return		int		<=0 if KO, >0 if OK
492
+	 */
493
+	private function loadTables()
494
+	{
495
+		return $this->_load_tables('/subtotal/sql/');
496
+	}
497 497
 }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  * 	\ingroup	titre
24 24
  * 	\brief		Description and activation file for module titre
25 25
  */
26
-include_once DOL_DOCUMENT_ROOT . "/core/modules/DolibarrModules.class.php";
26
+include_once DOL_DOCUMENT_ROOT."/core/modules/DolibarrModules.class.php";
27 27
 
28 28
 /**
29 29
  * Description and activation class for module titre
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
         $this->version = '3.0.1';
67 67
         // Key used in llx_const table to save module status enabled/disabled
68 68
         // (where MYMODULE is value of property name of module in uppercase)
69
-        $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name);
69
+        $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
70 70
         // Where to store the module in setup page
71 71
         // (0=common,1=interface,2=others,3=very specific)
72 72
         $this->special = 2;
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
             // Set this to relative path of css if module has its own css file
97 97
             //'css' => '/titre/css/mycss.css.php',
98 98
             // Set here all hooks context managed by module
99
-            'hooks' => array('invoicecard','propalcard','ordercard','odtgeneration','orderstoinvoice','admin','invoicereccard')
99
+            'hooks' => array('invoicecard', 'propalcard', 'ordercard', 'odtgeneration', 'orderstoinvoice', 'admin', 'invoicereccard')
100 100
             // Set here all workflow context managed by module
101 101
             //'workflow' => array('order' => array('WORKFLOW_ORDER_AUTOCREATE_INVOICE'))
102 102
         );
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
         // List of modules id that must be enabled if this module is enabled
114 114
         $this->depends = array();
115 115
 
116
-		$this->conflictwith=array('modMilestone');
116
+		$this->conflictwith = array('modMilestone');
117 117
         // List of modules id to disable if this one is disabled
118 118
         $this->requiredby = array();
119 119
         // Minimum version of PHP required by module
@@ -178,20 +178,20 @@  discard block
 block discarded – undo
178 178
         // 'categories_x'		to add a tab in category view
179 179
         // (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member)
180 180
         // Dictionnaries
181
-        if (! isset($conf->subtotal->enabled)) {
182
-            $conf->subtotal=new stdClass();
181
+        if (!isset($conf->subtotal->enabled)) {
182
+            $conf->subtotal = new stdClass();
183 183
             $conf->subtotal->enabled = 0;
184 184
         }
185 185
         $this->dictionaries = array(
186 186
 			'langs'=>'subtotal@subtotal',
187
-            'tabname'=>array(MAIN_DB_PREFIX.'c_subtotal_free_text'),		// List of tables we want to see into dictonnary editor
188
-            'tablib'=>array($langs->trans('subtotalFreeLineDictionary')),													// Label of tables
189
-            'tabsql'=>array('SELECT f.rowid as rowid, f.label, f.content, f.entity, f.active FROM '.MAIN_DB_PREFIX.'c_subtotal_free_text as f WHERE f.entity='.$conf->entity),	// Request to select fields
190
-            'tabsqlsort'=>array('label ASC'),																					// Sort order
191
-            'tabfield'=>array('label,content'),							// List of fields (result of select to show dictionary)
192
-            'tabfieldvalue'=>array('label,content'),						// List of fields (list of fields to edit a record)
193
-            'tabfieldinsert'=>array('label,content,entity'),					// List of fields (list of fields for insert)
194
-            'tabrowid'=>array('rowid'),											// Name of columns with primary key (try to always name it 'rowid')
187
+            'tabname'=>array(MAIN_DB_PREFIX.'c_subtotal_free_text'), // List of tables we want to see into dictonnary editor
188
+            'tablib'=>array($langs->trans('subtotalFreeLineDictionary')), // Label of tables
189
+            'tabsql'=>array('SELECT f.rowid as rowid, f.label, f.content, f.entity, f.active FROM '.MAIN_DB_PREFIX.'c_subtotal_free_text as f WHERE f.entity='.$conf->entity), // Request to select fields
190
+            'tabsqlsort'=>array('label ASC'), // Sort order
191
+            'tabfield'=>array('label,content'), // List of fields (result of select to show dictionary)
192
+            'tabfieldvalue'=>array('label,content'), // List of fields (list of fields to edit a record)
193
+            'tabfieldinsert'=>array('label,content,entity'), // List of fields (list of fields for insert)
194
+            'tabrowid'=>array('rowid'), // Name of columns with primary key (try to always name it 'rowid')
195 195
             'tabcond'=>array($conf->subtotal->enabled)	
196 196
 		);
197 197
         /* Example:
Please login to merge, or discard this patch.