Passed
Pull Request — master (#2)
by
unknown
26:19
created
dolibarr/htdocs/core/modules/export/export_csv.modules.php 1 patch
Braces   +16 added lines, -9 removed lines patch added patch discarded remove patch
@@ -68,7 +68,9 @@  discard block
 block discarded – undo
68 68
 		$this->db = $db;
69 69
 
70 70
 		$this->separator=',';
71
-		if (! empty($conf->global->EXPORT_CSV_SEPARATOR_TO_USE)) $this->separator=$conf->global->EXPORT_CSV_SEPARATOR_TO_USE;
71
+		if (! empty($conf->global->EXPORT_CSV_SEPARATOR_TO_USE)) {
72
+		    $this->separator=$conf->global->EXPORT_CSV_SEPARATOR_TO_USE;
73
+		}
72 74
 		$this->escape='"';
73 75
 		$this->enclosure='"';
74 76
 
@@ -216,8 +218,7 @@  discard block
 block discarded – undo
216 218
 		if (! empty($conf->global->EXPORT_CSV_FORCE_CHARSET))
217 219
 		{
218 220
 			$outputlangs->charset_output = $conf->global->EXPORT_CSV_FORCE_CHARSET;
219
-		}
220
-		else
221
+		} else
221 222
 		{
222 223
 			$outputlangs->charset_output = 'ISO-8859-1';
223 224
 		}
@@ -252,8 +253,7 @@  discard block
 block discarded – undo
252 253
 		if (! empty($conf->global->EXPORT_CSV_FORCE_CHARSET))
253 254
 		{
254 255
 			$outputlangs->charset_output = $conf->global->EXPORT_CSV_FORCE_CHARSET;
255
-		}
256
-		else
256
+		} else
257 257
 		{
258 258
 			$outputlangs->charset_output = 'ISO-8859-1';
259 259
 		}
@@ -261,15 +261,22 @@  discard block
 block discarded – undo
261 261
 		$this->col=0;
262 262
 		foreach($array_selected_sorted as $code => $value)
263 263
 		{
264
-			if (strpos($code,' as ') == 0) $alias=str_replace(array('.','-','(',')'),'_',$code);
265
-			else $alias=substr($code, strpos($code, ' as ') + 4);
266
-			if (empty($alias)) dol_print_error('','Bad value for field with key='.$code.'. Try to redefine export.');
264
+			if (strpos($code,' as ') == 0) {
265
+			    $alias=str_replace(array('.','-','(',')'),'_',$code);
266
+			} else {
267
+			    $alias=substr($code, strpos($code, ' as ') + 4);
268
+			}
269
+			if (empty($alias)) {
270
+			    dol_print_error('','Bad value for field with key='.$code.'. Try to redefine export.');
271
+			}
267 272
 
268 273
 			$newvalue=$outputlangs->convToOutputCharset($objp->$alias);		// objp->$alias must be utf8 encoded as any var in memory	// newvalue is now $outputlangs->charset_output encoded
269 274
 			$typefield=isset($array_types[$code])?$array_types[$code]:'';
270 275
 
271 276
 			// Translation newvalue
272
-			if (preg_match('/^\((.*)\)$/i',$newvalue,$reg)) $newvalue=$outputlangs->transnoentities($reg[1]);
277
+			if (preg_match('/^\((.*)\)$/i',$newvalue,$reg)) {
278
+			    $newvalue=$outputlangs->transnoentities($reg[1]);
279
+			}
273 280
 
274 281
 			$newvalue=$this->csvClean($newvalue,$outputlangs->charset_output);
275 282
 
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/export/export_tsv.modules.php 1 patch
Braces   +11 added lines, -4 removed lines patch added patch discarded remove patch
@@ -237,15 +237,22 @@
 block discarded – undo
237 237
 		$this->col=0;
238 238
  		foreach($array_selected_sorted as $code => $value)
239 239
         {
240
-			if (strpos($code,' as ') == 0) $alias=str_replace(array('.','-','(',')'),'_',$code);
241
-			else $alias=substr($code, strpos($code, ' as ') + 4);
242
-            if (empty($alias)) dol_print_error('','Bad value for field with code='.$code.'. Try to redefine export.');
240
+			if (strpos($code,' as ') == 0) {
241
+			    $alias=str_replace(array('.','-','(',')'),'_',$code);
242
+			} else {
243
+			    $alias=substr($code, strpos($code, ' as ') + 4);
244
+			}
245
+            if (empty($alias)) {
246
+                dol_print_error('','Bad value for field with code='.$code.'. Try to redefine export.');
247
+            }
243 248
 
244 249
             $newvalue=$outputlangs->convToOutputCharset($objp->$alias);		// objp->$alias must be utf8 encoded as any var in memory // newvalue is now $outputlangs->charset_output encoded
245 250
             $typefield=isset($array_types[$code])?$array_types[$code]:'';
246 251
 
247 252
             // Translation newvalue
248
-			if (preg_match('/^\((.*)\)$/i',$newvalue,$reg)) $newvalue=$outputlangs->transnoentities($reg[1]);
253
+			if (preg_match('/^\((.*)\)$/i',$newvalue,$reg)) {
254
+			    $newvalue=$outputlangs->transnoentities($reg[1]);
255
+			}
249 256
 
250 257
 			$newvalue=$this->tsv_clean($newvalue,$outputlangs->charset_output);
251 258
 
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/syslog/mod_syslog_chromephp.php 1 patch
Braces   +28 added lines, -16 removed lines patch added patch discarded remove patch
@@ -67,20 +67,20 @@  discard block
 block discarded – undo
67 67
 			set_include_path($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH);
68 68
 
69 69
 		    $res = @include_once 'ChromePhp.php';
70
-		    if (! $res) $res=@include_once 'ChromePhp.class.php';
70
+		    if (! $res) {
71
+		        $res=@include_once 'ChromePhp.class.php';
72
+		    }
71 73
 
72 74
 		    restore_include_path();
73 75
 
74 76
 		    if ($res)
75 77
 		    {
76 78
         		return empty($conf->global->SYSLOG_DISABLE_LOGHANDLER_CHROMEPHP)?1:0;    // Set SYSLOG_DISABLE_LOGHANDLER_CHROMEPHP to 1 to disable this loghandler
77
-		    }
78
-		    else
79
+		    } else
79 80
 		    {
80 81
 		        return 0;
81 82
 		    }
82
-		}
83
-		catch(Exception $e)
83
+		} catch(Exception $e)
84 84
 		{
85 85
 		    print '<!-- ChromePHP not available into PHP -->'."\n";
86 86
 		}
@@ -122,11 +122,12 @@  discard block
 block discarded – undo
122 122
 		if (! file_exists($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH.'/ChromePhp.php') && ! file_exists($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH.'/ChromePhp.class.php'))
123 123
 		{
124 124
 			$conf->global->MAIN_SYSLOG_DISABLE_CHROMEPHP = 1; // avoid infinite loop
125
-			if (is_object($langs))   // $langs may not be defined yet.
125
+			if (is_object($langs)) {
126
+			    // $langs may not be defined yet.
126 127
 			{
127 128
 				$errors[] = $langs->trans("ErrorFailedToOpenFile", 'ChromePhp.class.php or ChromePhp.php');
128 129
 			}
129
-			else
130
+			} else
130 131
 			{
131 132
 				$errors[] = "ErrorFailedToOpenFile ChromePhp.class.php or ChromePhp.php";
132 133
 			}
@@ -145,10 +146,15 @@  discard block
 block discarded – undo
145 146
 	{
146 147
 		global $conf;
147 148
 
148
-		if (! empty($conf->global->MAIN_SYSLOG_DISABLE_CHROMEPHP)) return;	// Global option to disable output of this handler
149
+		if (! empty($conf->global->MAIN_SYSLOG_DISABLE_CHROMEPHP)) {
150
+		    return;
151
+		}
152
+		// Global option to disable output of this handler
149 153
 
150 154
 		//We check the configuration to avoid showing PHP warnings
151
-		if (count($this->checkConfiguration()) > 0) return false;
155
+		if (count($this->checkConfiguration()) > 0) {
156
+		    return false;
157
+		}
152 158
 
153 159
 		try
154 160
 		{
@@ -157,16 +163,22 @@  discard block
 block discarded – undo
157 163
 			$oldinclude=get_include_path();
158 164
 			set_include_path($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH);
159 165
 		    $res = @include_once 'ChromePhp.php';
160
-		    if (! $res) $res=@include_once 'ChromePhp.class.php';
166
+		    if (! $res) {
167
+		        $res=@include_once 'ChromePhp.class.php';
168
+		    }
161 169
 			set_include_path($oldinclude);
162 170
 			
163 171
 			ob_start();	// To be sure headers are not flushed until all page is completely processed
164
-			if ($content['level'] == LOG_ERR) ChromePhp::error($content['message']);
165
-			elseif ($content['level'] == LOG_WARNING) ChromePhp::warn($content['message']);
166
-			elseif ($content['level'] == LOG_INFO) ChromePhp::log($content['message']);
167
-			else ChromePhp::log($content['message']);
168
-		}
169
-		catch (Exception $e)
172
+			if ($content['level'] == LOG_ERR) {
173
+			    ChromePhp::error($content['message']);
174
+			} elseif ($content['level'] == LOG_WARNING) {
175
+			    ChromePhp::warn($content['message']);
176
+			} elseif ($content['level'] == LOG_INFO) {
177
+			    ChromePhp::log($content['message']);
178
+			} else {
179
+			    ChromePhp::log($content['message']);
180
+			}
181
+		} catch (Exception $e)
170 182
 		{
171 183
 			// Do not use dol_syslog here to avoid infinite loop
172 184
 		}
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/syslog/mod_syslog_syslog.php 1 patch
Braces   +16 added lines, -7 removed lines patch added patch discarded remove patch
@@ -51,7 +51,9 @@  discard block
 block discarded – undo
51 51
 	    global $conf;
52 52
 
53 53
 		// This function does not exists on some ISP (Ex: Free in France)
54
-		if (!function_exists('openlog')) return 0;
54
+		if (!function_exists('openlog')) {
55
+		    return 0;
56
+		}
55 57
 
56 58
 		return empty($conf->global->SYSLOG_DISABLE_LOGHANDLER_SYSLOG)?1:0;    // Set SYSLOG_DISABLE_LOGHANDLER_SYSLOG to 1 to disable this loghandler
57 59
 	}
@@ -89,11 +91,12 @@  discard block
 block discarded – undo
89 91
 	    if ($facility)
90 92
 		{
91 93
 			// Only LOG_USER supported on Windows
92
-			if (! empty($_SERVER["WINDIR"])) $facility=constant('LOG_USER');
94
+			if (! empty($_SERVER["WINDIR"])) {
95
+			    $facility=constant('LOG_USER');
96
+			}
93 97
 
94 98
 			dol_syslog("admin/syslog: facility ".$facility);
95
-		}
96
-		else
99
+		} else
97 100
 		{
98 101
 		    $errors[] = $langs->trans("ErrorUnknownSyslogConstant", $facility);
99 102
 		}
@@ -111,13 +114,19 @@  discard block
 block discarded – undo
111 114
 	{
112 115
 		global $conf;
113 116
 
114
-		if (! empty($conf->global->MAIN_SYSLOG_DISABLE_SYSLOG)) return;	// Global option to disable output of this handler
117
+		if (! empty($conf->global->MAIN_SYSLOG_DISABLE_SYSLOG)) {
118
+		    return;
119
+		}
120
+		// Global option to disable output of this handler
115 121
 
116
-		if (! empty($conf->global->SYSLOG_FACILITY))  // Example LOG_USER
122
+		if (! empty($conf->global->SYSLOG_FACILITY)) {
123
+		    // Example LOG_USER
117 124
 		{
118 125
 			$facility = constant($conf->global->SYSLOG_FACILITY);
119 126
 		}
120
-		else $facility = constant('LOG_USER');
127
+		} else {
128
+		    $facility = constant('LOG_USER');
129
+		}
121 130
 
122 131
 		// (int) is required to avoid error parameter 3 expected to be long
123 132
 		openlog('dolibarr', LOG_PID | LOG_PERROR, (int) $facility);
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/syslog/mod_syslog_firephp.php 1 patch
Braces   +21 added lines, -12 removed lines patch added patch discarded remove patch
@@ -80,8 +80,7 @@  discard block
 block discarded – undo
80 80
 			} else {
81 81
 				return 0;
82 82
 			}
83
-		}
84
-		catch(Exception $e)
83
+		} catch(Exception $e)
85 84
 		{
86 85
 			print '<!-- FirePHP not available into PHP -->'."\n";
87 86
 		}
@@ -123,11 +122,12 @@  discard block
 block discarded – undo
123 122
 		if (!file_exists($conf->global->SYSLOG_FIREPHP_INCLUDEPATH . self::$firephp_class_path))
124 123
 		{
125 124
 			$conf->global->MAIN_SYSLOG_DISABLE_FIREPHP = 1; // avoid infinite loop
126
-			if (is_object($langs))   // $langs may not be defined yet.
125
+			if (is_object($langs)) {
126
+			    // $langs may not be defined yet.
127 127
 			{
128 128
 				$errors[] = $langs->trans("ErrorFailedToOpenFile", self::$firephp_class_path);
129 129
 			}
130
-			else
130
+			} else
131 131
 			{
132 132
 				$errors[] = "ErrorFailedToOpenFile " . self::$firephp_class_path;
133 133
 			}
@@ -146,10 +146,15 @@  discard block
 block discarded – undo
146 146
 	{
147 147
 		global $conf;
148 148
 
149
-		if (! empty($conf->global->MAIN_SYSLOG_DISABLE_FIREPHP)) return;	// Global option to disable output of this handler
149
+		if (! empty($conf->global->MAIN_SYSLOG_DISABLE_FIREPHP)) {
150
+		    return;
151
+		}
152
+		// Global option to disable output of this handler
150 153
 
151 154
 		//We check the configuration to avoid showing PHP warnings
152
-		if (count($this->checkConfiguration())) return false;
155
+		if (count($this->checkConfiguration())) {
156
+		    return false;
157
+		}
153 158
 
154 159
 		try
155 160
 		{
@@ -161,12 +166,16 @@  discard block
 block discarded – undo
161 166
 			set_include_path($oldinclude);
162 167
 			ob_start();	// To be sure headers are not flushed until all page is completely processed
163 168
 			$firephp = FirePHP::getInstance(true);
164
-			if ($content['level'] == LOG_ERR) $firephp->error($content['message']);
165
-			elseif ($content['level'] == LOG_WARNING) $firephp->warn($content['message']);
166
-			elseif ($content['level'] == LOG_INFO) $firephp->log($content['message']);
167
-			else $firephp->log($content['message']);
168
-		}
169
-		catch (Exception $e)
169
+			if ($content['level'] == LOG_ERR) {
170
+			    $firephp->error($content['message']);
171
+			} elseif ($content['level'] == LOG_WARNING) {
172
+			    $firephp->warn($content['message']);
173
+			} elseif ($content['level'] == LOG_INFO) {
174
+			    $firephp->log($content['message']);
175
+			} else {
176
+			    $firephp->log($content['message']);
177
+			}
178
+		} catch (Exception $e)
170 179
 		{
171 180
 			// Do not use dol_syslog here to avoid infinite loop
172 181
 			return false;
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/modAdherent.class.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -326,11 +326,13 @@
 block discarded – undo
326 326
 		// Add extra fields
327 327
 		$sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'adherent' AND entity IN (0,".$conf->entity.")";
328 328
 		$resql=$this->db->query($sql);
329
-		if ($resql)    // This can fail when class is used on old database (during migration for example)
329
+		if ($resql) {
330
+		    // This can fail when class is used on old database (during migration for example)
330 331
 		{
331 332
 		    while ($obj=$this->db->fetch_object($resql))
332 333
 		    {
333 334
 		        $fieldname='extra.'.$obj->name;
335
+		}
334 336
 		        $fieldlabel=ucfirst($obj->label);
335 337
 		        $this->import_fields_array[$r][$fieldname]=$fieldlabel.($obj->fieldrequired?'*':'');
336 338
 		    }
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/modCategorie.class.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -187,11 +187,13 @@  discard block
 block discarded – undo
187 187
         // Add extra fields
188 188
         $sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'societe'";
189 189
         $resql=$this->db->query($sql);
190
-        if ($resql)    // This can fail when class is used on old database (during migration for example)
190
+        if ($resql) {
191
+            // This can fail when class is used on old database (during migration for example)
191 192
         {
192 193
             while ($obj=$this->db->fetch_object($resql))
193 194
             {
194 195
                 $fieldname='extra.'.$obj->name;
196
+        }
195 197
                 $fieldlabel=ucfirst($obj->label);
196 198
                 $typeFilter="Text";
197 199
                 switch($obj->type)
@@ -352,11 +354,13 @@  discard block
 block discarded – undo
352 354
         // Add extra fields
353 355
         $sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'socpeople'";
354 356
         $resql=$this->db->query($sql);
355
-        if ($resql)    // This can fail when class is used on old database (during migration for example)
357
+        if ($resql) {
358
+            // This can fail when class is used on old database (during migration for example)
356 359
         {
357 360
         	while ($obj=$this->db->fetch_object($resql))
358 361
         	{
359 362
         		$fieldname='extra.'.$obj->name;
363
+        }
360 364
         		$fieldlabel=ucfirst($obj->label);
361 365
         		$typeFilter="Text";
362 366
         		switch($obj->type)
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/modMultiCurrency.class.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -311,7 +311,9 @@
 block discarded – undo
311 311
 			$multicurrency->name = $langs->cache_currencies[$conf->currency]['label'].' ('.$langs->getCurrencySymbol($conf->currency).')';
312 312
 			$r = $multicurrency->create($user);
313 313
 
314
-			if ($r > 0)	$multicurrency->addRate(1);
314
+			if ($r > 0) {
315
+			    $multicurrency->addRate(1);
316
+			}
315 317
 		}
316 318
 	}
317 319
 }
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php 1 patch
Braces   +172 added lines, -88 removed lines patch added patch discarded remove patch
@@ -133,7 +133,10 @@  discard block
 block discarded – undo
133 133
 
134 134
 		// Get source company
135 135
 		$this->emetteur=$mysoc;
136
-		if (empty($this->emetteur->country_code)) $this->emetteur->country_code=substr($langs->defaultlang,-2);    // By default, if was not defined
136
+		if (empty($this->emetteur->country_code)) {
137
+		    $this->emetteur->country_code=substr($langs->defaultlang,-2);
138
+		}
139
+		// By default, if was not defined
137 140
 
138 141
 		// Define position of columns
139 142
 		$this->posxdesc=$this->marge_gauche+1;
@@ -163,9 +166,13 @@  discard block
 block discarded – undo
163 166
 	    // phpcs:enable
164 167
 		global $user, $langs, $conf, $mysoc, $db, $hookmanager, $nblignes;
165 168
 
166
-		if (! is_object($outputlangs)) $outputlangs=$langs;
169
+		if (! is_object($outputlangs)) {
170
+		    $outputlangs=$langs;
171
+		}
167 172
 		// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
168
-		if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
173
+		if (! empty($conf->global->MAIN_USE_FPDF)) {
174
+		    $outputlangs->charset_output='ISO-8859-1';
175
+		}
169 176
 
170 177
 		// Translations
171 178
 		$outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products", "orders", "deliveries"));
@@ -183,8 +190,7 @@  discard block
 block discarded – undo
183 190
 			{
184 191
 				$dir = $conf->commande->dir_output;
185 192
 				$file = $dir . "/SPECIMEN.pdf";
186
-			}
187
-			else
193
+			} else
188 194
 			{
189 195
 				$objectref = dol_sanitizeFileName($object->ref);
190 196
 				$dir = $conf->commande->dir_output . "/" . $objectref;
@@ -244,7 +250,9 @@  discard block
 block discarded – undo
244 250
 				$pdf->SetCreator("Dolibarr ".DOL_VERSION);
245 251
 				$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
246 252
 				$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("PdfOrderTitle")." ".$outputlangs->convToOutputCharset($object->thirdparty->name));
247
-				if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
253
+				if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) {
254
+				    $pdf->SetCompression(false);
255
+				}
248 256
 
249 257
 				$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);   // Left, Top, Right
250 258
 
@@ -268,7 +276,9 @@  discard block
 block discarded – undo
268 276
 
269 277
 				// New page
270 278
 				$pdf->AddPage();
271
-				if (! empty($tplidx)) $pdf->useTemplate($tplidx);
279
+				if (! empty($tplidx)) {
280
+				    $pdf->useTemplate($tplidx);
281
+				}
272 282
 				$pagenb++;
273 283
 				$top_shift = $this->_pagehead($pdf, $object, 1, $outputlangs);
274 284
 				$pdf->SetFont('','', $default_font_size - 1);
@@ -310,7 +320,9 @@  discard block
 block discarded – undo
310 320
 						$salereparray=$object->thirdparty->getSalesRepresentatives($user);
311 321
 						$salerepobj=new User($this->db);
312 322
 						$salerepobj->fetch($salereparray[0]['id']);
313
-						if (! empty($salerepobj->signature)) $notetoshow=dol_concatdesc($notetoshow, $salerepobj->signature);
323
+						if (! empty($salerepobj->signature)) {
324
+						    $notetoshow=dol_concatdesc($notetoshow, $salerepobj->signature);
325
+						}
314 326
 					}
315 327
 				}
316 328
 
@@ -342,8 +354,12 @@  discard block
 block discarded – undo
342 354
 				        while ($pagenb < $pageposafternote) {
343 355
 				            $pdf->AddPage();
344 356
 				            $pagenb++;
345
-				            if (! empty($tplidx)) $pdf->useTemplate($tplidx);
346
-				            if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
357
+				            if (! empty($tplidx)) {
358
+				                $pdf->useTemplate($tplidx);
359
+				            }
360
+				            if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
361
+				                $this->_pagehead($pdf, $object, 0, $outputlangs);
362
+				            }
347 363
 				            // $this->_pagefoot($pdf,$object,$outputlangs,1);
348 364
 				            $pdf->setTopMargin($tab_top_newpage);
349 365
 				            // The only function to edit the bottom margin of current page to set it.
@@ -359,9 +375,11 @@  discard block
 block discarded – undo
359 375
 
360 376
 				        $posyafter = $pdf->GetY();
361 377
 
362
-				        if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+20)))	// There is no space left for total+free text
378
+				        if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+20))) {
379
+				            // There is no space left for total+free text
363 380
 				        {
364 381
 				            $pdf->AddPage('','',true);
382
+				        }
365 383
 				            $pagenb++;
366 384
 				            $pageposafternote++;
367 385
 				            $pdf->setPage($pageposafternote);
@@ -383,8 +401,7 @@  discard block
 block discarded – undo
383 401
 				            if($i>$pageposbeforenote){
384 402
 				                $height_note = $this->page_hauteur - ($tab_top_newpage + $heightforfooter);
385 403
 				                $pdf->Rect($this->marge_gauche, $tab_top_newpage-1, $tab_width, $height_note + 1);
386
-				            }
387
-				            else{
404
+				            } else{
388 405
 				                $height_note = $this->page_hauteur - ($tab_top + $heightforfooter);
389 406
 				                $pdf->Rect($this->marge_gauche, $tab_top-1, $tab_width, $height_note + 1);
390 407
 				            }
@@ -398,12 +415,15 @@  discard block
 block discarded – undo
398 415
 
399 416
 				        // apply note frame to last page
400 417
 				        $pdf->setPage($pageposafternote);
401
-				        if (! empty($tplidx)) $pdf->useTemplate($tplidx);
402
-				        if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
418
+				        if (! empty($tplidx)) {
419
+				            $pdf->useTemplate($tplidx);
420
+				        }
421
+				        if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
422
+				            $this->_pagehead($pdf, $object, 0, $outputlangs);
423
+				        }
403 424
 				        $height_note=$posyafter-$tab_top_newpage;
404 425
 				        $pdf->Rect($this->marge_gauche, $tab_top_newpage-1, $tab_width, $height_note+1);
405
-				    }
406
-				    else // No pagebreak
426
+				    } else // No pagebreak
407 427
 				    {
408 428
 				        $pdf->commitTransaction();
409 429
 				        $posyafter = $pdf->GetY();
@@ -418,8 +438,12 @@  discard block
 block discarded – undo
418 438
 				            $pagenb++;
419 439
 				            $pageposafternote++;
420 440
 				            $pdf->setPage($pageposafternote);
421
-				            if (! empty($tplidx)) $pdf->useTemplate($tplidx);
422
-				            if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
441
+				            if (! empty($tplidx)) {
442
+				                $pdf->useTemplate($tplidx);
443
+				            }
444
+				            if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
445
+				                $this->_pagehead($pdf, $object, 0, $outputlangs);
446
+				            }
423 447
 
424 448
 				            $posyafter = $tab_top_newpage;
425 449
 				        }
@@ -427,8 +451,7 @@  discard block
 block discarded – undo
427 451
 
428 452
 				    $tab_height = $tab_height - $height_note;
429 453
 				    $tab_top = $posyafter +6;
430
-				}
431
-				else
454
+				} else
432 455
 				{
433 456
 					$height_note=0;
434 457
 				}
@@ -463,32 +486,36 @@  discard block
 block discarded – undo
463 486
     					$pdf->startTransaction();
464 487
     					pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->getColumnContentWidth('desc'),3,$this->getColumnContentXStart('desc'),$curY,$hideref,$hidedesc);
465 488
     					$pageposafter=$pdf->getPage();
466
-    					if ($pageposafter > $pageposbefore)	// There is a pagebreak
489
+    					if ($pageposafter > $pageposbefore) {
490
+    					    // There is a pagebreak
467 491
     					{
468 492
     						$pdf->rollbackTransaction(true);
493
+    					}
469 494
     						$pageposafter=$pageposbefore;
470 495
     						//print $pageposafter.'-'.$pageposbefore;exit;
471 496
     						$pdf->setPageOrientation('', 1, $heightforfooter);	// The only function to edit the bottom margin of current page to set it.
472 497
     						pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->getColumnContentWidth('desc'),3,$this->getColumnContentXStart('desc'),$curY,$hideref,$hidedesc);
473 498
     						$pageposafter=$pdf->getPage();
474 499
     						$posyafter=$pdf->GetY();
475
-    						if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot)))	// There is no space left for total+free text
500
+    						if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) {
501
+    						    // There is no space left for total+free text
476 502
     						{
477 503
     							if ($i == ($nblignes-1))	// No more lines, and no space left to show total, so we create a new page
478 504
     							{
479 505
     								$pdf->AddPage('','',true);
480
-    								if (! empty($tplidx)) $pdf->useTemplate($tplidx);
506
+    						}
507
+    								if (! empty($tplidx)) {
508
+    								    $pdf->useTemplate($tplidx);
509
+    								}
481 510
     								//if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
482 511
     								$pdf->setPage($pageposafter+1);
483 512
     							}
484
-    						}
485
-    						else
513
+    						} else
486 514
     						{
487 515
     							// We found a page break
488 516
     							$showpricebeforepagebreak=0;
489 517
     						}
490
-    					}
491
-    					else	// No pagebreak
518
+    					} else	// No pagebreak
492 519
     					{
493 520
     						$pdf->commitTransaction();
494 521
     					}
@@ -573,8 +600,11 @@  discard block
 block discarded – undo
573 600
 
574 601
 
575 602
 					// Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva
576
-					if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne=$object->lines[$i]->multicurrency_total_tva;
577
-					else $tvaligne=$object->lines[$i]->total_tva;
603
+					if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) {
604
+					    $tvaligne=$object->lines[$i]->multicurrency_total_tva;
605
+					} else {
606
+					    $tvaligne=$object->lines[$i]->total_tva;
607
+					}
578 608
 
579 609
 					$localtax1ligne=$object->lines[$i]->total_localtax1;
580 610
 					$localtax2ligne=$object->lines[$i]->total_localtax2;
@@ -583,29 +613,43 @@  discard block
 block discarded – undo
583 613
 					$localtax1_type=$object->lines[$i]->localtax1_type;
584 614
 					$localtax2_type=$object->lines[$i]->localtax2_type;
585 615
 
586
-					if ($object->remise_percent) $tvaligne-=($tvaligne*$object->remise_percent)/100;
587
-					if ($object->remise_percent) $localtax1ligne-=($localtax1ligne*$object->remise_percent)/100;
588
-					if ($object->remise_percent) $localtax2ligne-=($localtax2ligne*$object->remise_percent)/100;
616
+					if ($object->remise_percent) {
617
+					    $tvaligne-=($tvaligne*$object->remise_percent)/100;
618
+					}
619
+					if ($object->remise_percent) {
620
+					    $localtax1ligne-=($localtax1ligne*$object->remise_percent)/100;
621
+					}
622
+					if ($object->remise_percent) {
623
+					    $localtax2ligne-=($localtax2ligne*$object->remise_percent)/100;
624
+					}
589 625
 
590 626
 					$vatrate=(string) $object->lines[$i]->tva_tx;
591 627
 
592 628
 					// Retrieve type from database for backward compatibility with old records
593 629
 					if ((! isset($localtax1_type) || $localtax1_type=='' || ! isset($localtax2_type) || $localtax2_type=='') // if tax type not defined
594
-					&& (! empty($localtax1_rate) || ! empty($localtax2_rate))) // and there is local tax
630
+					&& (! empty($localtax1_rate) || ! empty($localtax2_rate))) {
631
+					    // and there is local tax
595 632
 					{
596 633
 						$localtaxtmp_array=getLocalTaxesFromRate($vatrate,0,$object->thirdparty,$mysoc);
634
+					}
597 635
 						$localtax1_type = $localtaxtmp_array[0];
598 636
 						$localtax2_type = $localtaxtmp_array[2];
599 637
 					}
600 638
 
601 639
 				    // retrieve global local tax
602
-					if ($localtax1_type && $localtax1ligne != 0)
603
-						$this->localtax1[$localtax1_type][$localtax1_rate]+=$localtax1ligne;
604
-					if ($localtax2_type && $localtax2ligne != 0)
605
-						$this->localtax2[$localtax2_type][$localtax2_rate]+=$localtax2ligne;
640
+					if ($localtax1_type && $localtax1ligne != 0) {
641
+											$this->localtax1[$localtax1_type][$localtax1_rate]+=$localtax1ligne;
642
+					}
643
+					if ($localtax2_type && $localtax2ligne != 0) {
644
+											$this->localtax2[$localtax2_type][$localtax2_rate]+=$localtax2ligne;
645
+					}
606 646
 
607
-					if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*';
608
-					if (! isset($this->tva[$vatrate])) 				$this->tva[$vatrate]=0;
647
+					if (($object->lines[$i]->info_bits & 0x01) == 0x01) {
648
+					    $vatrate.='*';
649
+					}
650
+					if (! isset($this->tva[$vatrate])) {
651
+					    $this->tva[$vatrate]=0;
652
+					}
609 653
 					$this->tva[$vatrate] += $tvaligne;
610 654
 
611 655
 					// Add line
@@ -627,8 +671,7 @@  discard block
 block discarded – undo
627 671
 						if ($pagenb == $pageposbeforeprintlines)
628 672
 						{
629 673
 							$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code);
630
-						}
631
-						else
674
+						} else
632 675
 						{
633 676
 							$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code);
634 677
 						}
@@ -636,32 +679,38 @@  discard block
 block discarded – undo
636 679
 						$pagenb++;
637 680
 						$pdf->setPage($pagenb);
638 681
 						$pdf->setPageOrientation('', 1, 0);	// The only function to edit the bottom margin of current page to set it.
639
-						if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
682
+						if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
683
+						    $this->_pagehead($pdf, $object, 0, $outputlangs);
684
+						}
640 685
 					}
641 686
 					if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak)
642 687
 					{
643 688
 					    if ($pagenb == $pageposafter)
644 689
 						{
645 690
 							$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code);
646
-						}
647
-						else
691
+						} else
648 692
 						{
649 693
 							$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code);
650 694
 						}
651 695
 						$this->_pagefoot($pdf,$object,$outputlangs,1);
652 696
 						// New page
653 697
 						$pdf->AddPage();
654
-						if (! empty($tplidx)) $pdf->useTemplate($tplidx);
698
+						if (! empty($tplidx)) {
699
+						    $pdf->useTemplate($tplidx);
700
+						}
655 701
 						$pagenb++;
656
-						if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
702
+						if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
703
+						    $this->_pagehead($pdf, $object, 0, $outputlangs);
704
+						}
657 705
 					}
658 706
 				}
659 707
 
660 708
 				// Show square
661
-				if ($pagenb == $pageposbeforeprintlines)
662
-					$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0, $object->multicurrency_code);
663
-				else
664
-					$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code);
709
+				if ($pagenb == $pageposbeforeprintlines) {
710
+									$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0, $object->multicurrency_code);
711
+				} else {
712
+									$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code);
713
+				}
665 714
 				$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
666 715
 
667 716
 				// Affiche zone infos
@@ -680,7 +729,9 @@  discard block
 block discarded – undo
680 729
 
681 730
 				// Pied de page
682 731
 				$this->_pagefoot($pdf, $object, $outputlangs);
683
-				if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages();
732
+				if (method_exists($pdf, 'AliasNbPages')) {
733
+				    $pdf->AliasNbPages();
734
+				}
684 735
 
685 736
 				$pdf->Close();
686 737
 
@@ -692,20 +743,19 @@  discard block
 block discarded – undo
692 743
 				global $action;
693 744
 				$reshook=$hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action);    // Note that $action and $object may have been modified by some hooks
694 745
 
695
-				if (! empty($conf->global->MAIN_UMASK))
696
-					@chmod($file, octdec($conf->global->MAIN_UMASK));
746
+				if (! empty($conf->global->MAIN_UMASK)) {
747
+									@chmod($file, octdec($conf->global->MAIN_UMASK));
748
+				}
697 749
 
698 750
 				$this->result = array('fullpath'=>$file);
699 751
 
700 752
 				return 1;   // Pas d'erreur
701
-			}
702
-			else
753
+			} else
703 754
 			{
704 755
 				$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
705 756
 				return 0;
706 757
 			}
707
-		}
708
-		else
758
+		} else
709 759
 		{
710 760
 			$this->error=$langs->transnoentities("ErrorConstantNotDefined","COMMANDE_OUTPUTDIR");
711 761
 			return 0;
@@ -811,10 +861,11 @@  discard block
 block discarded – undo
811 861
 			$pdf->MultiCell(80, 4, $dlp, 0, 'L');
812 862
 
813 863
             $posy=$pdf->GetY()+1;
814
-		}
815
-        elseif ($object->availability_code || $object->availability)    // Show availability conditions
864
+		} elseif ($object->availability_code || $object->availability) {
865
+            // Show availability conditions
816 866
 		{
817 867
 			$pdf->SetFont('','B', $default_font_size - 2);
868
+        }
818 869
 			$pdf->SetXY($this->marge_gauche, $posy);
819 870
 			$titre = $outputlangs->transnoentities("AvailabilityPeriod").':';
820 871
 			$pdf->MultiCell(80, 4, $titre, 0, 'L');
@@ -894,7 +945,10 @@  discard block
 block discarded – undo
894 945
 			if (! empty($object->fk_account) || ! empty($object->fk_bank) || ! empty($conf->global->FACTURE_RIB_NUMBER))
895 946
 			{
896 947
 				$bankid=(empty($object->fk_account)?$conf->global->FACTURE_RIB_NUMBER:$object->fk_account);
897
-				if (! empty($object->fk_bank)) $bankid=$object->fk_bank;   // For backward compatibility when object->fk_account is forced with object->fk_bank
948
+				if (! empty($object->fk_bank)) {
949
+				    $bankid=$object->fk_bank;
950
+				}
951
+				// For backward compatibility when object->fk_account is forced with object->fk_bank
898 952
 				$account = new Account($this->db);
899 953
 				$account->fetch($bankid);
900 954
 
@@ -933,10 +987,12 @@  discard block
 block discarded – undo
933 987
 
934 988
 		// Tableau total
935 989
         $col1x = 120; $col2x = 170;
936
-		if ($this->page_largeur < 210) // To work with US executive format
990
+		if ($this->page_largeur < 210) {
991
+		    // To work with US executive format
937 992
 		{
938 993
 			$col2x-=20;
939 994
 		}
995
+		}
940 996
 		$largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
941 997
 
942 998
 		$useborder=0;
@@ -963,22 +1019,25 @@  discard block
 block discarded – undo
963 1019
 			if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_IFNULL) && $tvaisnull)
964 1020
 			{
965 1021
 				// Nothing to do
966
-			}
967
-			else
1022
+			} else
968 1023
 			{
969 1024
 				//Local tax 1 before VAT
970 1025
 				//if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on')
971 1026
 				//{
972 1027
 					foreach( $this->localtax1 as $localtax_type => $localtax_rate )
973 1028
 					{
974
-						if (in_array((string) $localtax_type, array('1','3','5'))) continue;
1029
+						if (in_array((string) $localtax_type, array('1','3','5'))) {
1030
+						    continue;
1031
+						}
975 1032
 						foreach( $localtax_rate as $tvakey => $tvaval )
976 1033
 						{
977
-							if ($tvakey!=0)    // On affiche pas taux 0
1034
+							if ($tvakey!=0) {
1035
+							    // On affiche pas taux 0
978 1036
 							{
979 1037
 								//$this->atleastoneratenotnull++;
980 1038
 
981 1039
 								$index++;
1040
+							}
982 1041
 								$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
983 1042
 
984 1043
 								$tvacompl='';
@@ -1002,16 +1061,20 @@  discard block
 block discarded – undo
1002 1061
 				//{
1003 1062
 					foreach( $this->localtax2 as $localtax_type => $localtax_rate )
1004 1063
 					{
1005
-						if (in_array((string) $localtax_type, array('1','3','5'))) continue;
1064
+						if (in_array((string) $localtax_type, array('1','3','5'))) {
1065
+						    continue;
1066
+						}
1006 1067
 						foreach( $localtax_rate as $tvakey => $tvaval )
1007 1068
 						{
1008
-							if ($tvakey!=0)    // On affiche pas taux 0
1069
+							if ($tvakey!=0) {
1070
+							    // On affiche pas taux 0
1009 1071
 							{
1010 1072
 								//$this->atleastoneratenotnull++;
1011 1073
 
1012 1074
 
1013 1075
 
1014 1076
 								$index++;
1077
+							}
1015 1078
 								$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1016 1079
 
1017 1080
 								$tvacompl='';
@@ -1033,9 +1096,11 @@  discard block
 block discarded – undo
1033 1096
 				// VAT
1034 1097
 				foreach($this->tva as $tvakey => $tvaval)
1035 1098
 				{
1036
-					if ($tvakey != 0)    // On affiche pas taux 0
1099
+					if ($tvakey != 0) {
1100
+					    // On affiche pas taux 0
1037 1101
 					{
1038 1102
 						$this->atleastoneratenotnull++;
1103
+					}
1039 1104
 
1040 1105
 						$index++;
1041 1106
 						$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
@@ -1060,15 +1125,19 @@  discard block
 block discarded – undo
1060 1125
 				//{
1061 1126
 					foreach( $this->localtax1 as $localtax_type => $localtax_rate )
1062 1127
 					{
1063
-						if (in_array((string) $localtax_type, array('2','4','6'))) continue;
1128
+						if (in_array((string) $localtax_type, array('2','4','6'))) {
1129
+						    continue;
1130
+						}
1064 1131
 
1065 1132
 						foreach( $localtax_rate as $tvakey => $tvaval )
1066 1133
 						{
1067
-							if ($tvakey != 0)    // On affiche pas taux 0
1134
+							if ($tvakey != 0) {
1135
+							    // On affiche pas taux 0
1068 1136
 							{
1069 1137
 								//$this->atleastoneratenotnull++;
1070 1138
 
1071 1139
 								$index++;
1140
+							}
1072 1141
 								$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1073 1142
 
1074 1143
 								$tvacompl='';
@@ -1092,15 +1161,19 @@  discard block
 block discarded – undo
1092 1161
 				//{
1093 1162
 					foreach( $this->localtax2 as $localtax_type => $localtax_rate )
1094 1163
 					{
1095
-						if (in_array((string) $localtax_type, array('2','4','6'))) continue;
1164
+						if (in_array((string) $localtax_type, array('2','4','6'))) {
1165
+						    continue;
1166
+						}
1096 1167
 
1097 1168
 						foreach( $localtax_rate as $tvakey => $tvaval )
1098 1169
 						{
1099
-							if ($tvakey != 0)    // On affiche pas taux 0
1170
+							if ($tvakey != 0) {
1171
+							    // On affiche pas taux 0
1100 1172
 							{
1101 1173
 								//$this->atleastoneratenotnull++;
1102 1174
 
1103 1175
 								$index++;
1176
+							}
1104 1177
 								$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1105 1178
 
1106 1179
 								$tvacompl='';
@@ -1141,7 +1214,9 @@  discard block
 block discarded – undo
1141 1214
 		//$depositsamount=$object->getSumDepositsUsed();
1142 1215
 		//print "x".$creditnoteamount."-".$depositsamount;exit;
1143 1216
 		$resteapayer = price2num($total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT');
1144
-		if (! empty($object->paye)) $resteapayer=0;
1217
+		if (! empty($object->paye)) {
1218
+		    $resteapayer=0;
1219
+		}
1145 1220
 
1146 1221
 		if ($deja_regle > 0)
1147 1222
 		{
@@ -1189,7 +1264,9 @@  discard block
 block discarded – undo
1189 1264
 
1190 1265
 		// Force to disable hidetop and hidebottom
1191 1266
 		$hidebottom=0;
1192
-		if ($hidetop) $hidetop=-1;
1267
+		if ($hidetop) {
1268
+		    $hidetop=-1;
1269
+		}
1193 1270
 
1194 1271
 		$currency = !empty($currency) ? $currency : $conf->currency;
1195 1272
 		$default_font_size = pdf_getPDFFontSize($outputlangs);
@@ -1205,7 +1282,9 @@  discard block
 block discarded – undo
1205 1282
 			$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
1206 1283
 
1207 1284
 			//$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230';
1208
-			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));
1285
+			if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) {
1286
+			    $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));
1287
+			}
1209 1288
 		}
1210 1289
 
1211 1290
 		$pdf->SetDrawColor(128,128,128);
@@ -1217,7 +1296,9 @@  discard block
 block discarded – undo
1217 1296
 
1218 1297
 		foreach ($this->cols as $colKey => $colDef)
1219 1298
 		{
1220
-		    if(!$this->getColumnStatus($colKey)) continue;
1299
+		    if(!$this->getColumnStatus($colKey)) {
1300
+		        continue;
1301
+		    }
1221 1302
 
1222 1303
 		    // get title label
1223 1304
 		    $colDef['title']['label'] = !empty($colDef['title']['label'])?$colDef['title']['label']:$outputlangs->transnoentities($colDef['title']['textkey']);
@@ -1286,16 +1367,14 @@  discard block
 block discarded – undo
1286 1367
 				{
1287 1368
 				    $height=pdf_getHeightForLogo($logo);
1288 1369
 				    $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);	// width=0 (auto)
1289
-				}
1290
-				else
1370
+				} else
1291 1371
 				{
1292 1372
 					$pdf->SetTextColor(200,0,0);
1293 1373
 					$pdf->SetFont('','B', $default_font_size -2);
1294 1374
 					$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L');
1295 1375
 					$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
1296 1376
 				}
1297
-			}
1298
-			else
1377
+			} else
1299 1378
 			{
1300 1379
 				$text=$this->emetteur->name;
1301 1380
 				$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
@@ -1375,7 +1454,9 @@  discard block
 block discarded – undo
1375 1454
 			// Show sender
1376 1455
 			$posy=42+$top_shift;
1377 1456
 			$posx=$this->marge_gauche;
1378
-			if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->page_largeur-$this->marge_droite-80;
1457
+			if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
1458
+			    $posx=$this->page_largeur-$this->marge_droite-80;
1459
+			}
1379 1460
 			$hautcadre=40;
1380 1461
 
1381 1462
 			// Show sender frame
@@ -1424,10 +1505,15 @@  discard block
 block discarded – undo
1424 1505
 
1425 1506
 			// Show recipient
1426 1507
 			$widthrecbox=100;
1427
-			if ($this->page_largeur < 210) $widthrecbox=84;	// To work with US executive format
1508
+			if ($this->page_largeur < 210) {
1509
+			    $widthrecbox=84;
1510
+			}
1511
+			// To work with US executive format
1428 1512
 			$posy=42+$top_shift;
1429 1513
 			$posx=$this->page_largeur-$this->marge_droite-$widthrecbox;
1430
-			if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche;
1514
+			if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
1515
+			    $posx=$this->marge_gauche;
1516
+			}
1431 1517
 
1432 1518
 			// Show recipient frame
1433 1519
 			$pdf->SetTextColor(0,0,0);
@@ -1659,12 +1745,10 @@  discard block
 block discarded – undo
1659 1745
 	    if ($reshook < 0)
1660 1746
 	    {
1661 1747
 	        setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
1662
-	    }
1663
-	    elseif (empty($reshook))
1748
+	    } elseif (empty($reshook))
1664 1749
 	    {
1665 1750
 	        $this->cols = array_replace($this->cols, $hookmanager->resArray); // array_replace is used to preserve keys
1666
-	    }
1667
-	    else
1751
+	    } else
1668 1752
 	    {
1669 1753
 	        $this->cols = $hookmanager->resArray;
1670 1754
 	    }
Please login to merge, or discard this patch.