Passed
Push — master ( 49af33...3cffbe )
by Alxarafe
21:21
created
htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php 1 patch
Braces   +67 added lines, -57 removed lines patch added patch discarded remove patch
@@ -81,7 +81,10 @@  discard block
 block discarded – undo
81 81
 
82 82
 		// Recupere emetteur
83 83
 		$this->emetteur=$mysoc;
84
-		if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2);    // By default if not defined
84
+		if (! $this->emetteur->country_code) {
85
+		    $this->emetteur->country_code=substr($langs->defaultlang,-2);
86
+		}
87
+		// By default if not defined
85 88
 	}
86 89
 
87 90
 
@@ -119,11 +122,14 @@  discard block
 block discarded – undo
119 122
 			if (! $tmpdir) {
120 123
 				unset($listofdir[$key]); continue;
121 124
 			}
122
-			if (! is_dir($tmpdir)) $texttitle.=img_warning($langs->trans("ErrorDirNotFound",$tmpdir),0);
123
-			else
125
+			if (! is_dir($tmpdir)) {
126
+			    $texttitle.=img_warning($langs->trans("ErrorDirNotFound",$tmpdir),0);
127
+			} else
124 128
 			{
125 129
 				$tmpfiles=dol_dir_list($tmpdir,'files',0,'\.(ods|odt)');
126
-				if (count($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles);
130
+				if (count($tmpfiles)) {
131
+				    $listoffiles=array_merge($listoffiles,$tmpfiles);
132
+				}
127 133
 			}
128 134
 		}
129 135
 		$texthelp=$langs->trans("ListOfDirectoriesForModelGenODT");
@@ -205,7 +211,9 @@  discard block
 block discarded – undo
205 211
 		$hookmanager->initHooks(array('odtgeneration'));
206 212
 		global $action;
207 213
 
208
-		if (! is_object($outputlangs)) $outputlangs=$langs;
214
+		if (! is_object($outputlangs)) {
215
+		    $outputlangs=$langs;
216
+		}
209 217
 		$sav_charset_output=$outputlangs->charset_output;
210 218
 		$outputlangs->charset_output='UTF-8';
211 219
 
@@ -231,7 +239,9 @@  discard block
 block discarded – undo
231 239
 
232 240
 			$dir = $conf->reception->dir_output."/reception";
233 241
 			$objectref = dol_sanitizeFileName($object->ref);
234
-			if (! preg_match('/specimen/i',$objectref)) $dir.= "/" . $objectref;
242
+			if (! preg_match('/specimen/i',$objectref)) {
243
+			    $dir.= "/" . $objectref;
244
+			}
235 245
 			$file = $dir . "/" . $objectref . ".odt";
236 246
 
237 247
 			if (! file_exists($dir))
@@ -257,10 +267,11 @@  discard block
 block discarded – undo
257 267
 				if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
258 268
 				{
259 269
 				    $format=$conf->global->MAIN_DOC_USE_TIMING;
260
-				    if ($format == '1') $format='%Y%m%d%H%M%S';
270
+				    if ($format == '1') {
271
+				        $format='%Y%m%d%H%M%S';
272
+				    }
261 273
 					$filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat;
262
-				}
263
-				else
274
+				} else
264 275
 				{
265 276
 					$filename=$newfiletmp.'.'.$newfileformat;
266 277
 				}
@@ -286,10 +297,12 @@  discard block
 block discarded – undo
286 297
 				if (! empty($usecontact))
287 298
 				{
288 299
 					// On peut utiliser le nom de la societe du contact
289
-					if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact;
290
-					else $socobject = $object->thirdparty;
291
-				}
292
-				else
300
+					if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
301
+					    $socobject = $object->contact;
302
+					} else {
303
+					    $socobject = $object->thirdparty;
304
+					}
305
+				} else
293 306
 				{
294 307
 					$socobject=$object->thirdparty;
295 308
 				}
@@ -327,8 +340,7 @@  discard block
 block discarded – undo
327 340
 						'DELIMITER_RIGHT' => '}'
328 341
 						)
329 342
 					);
330
-				}
331
-				catch(Exception $e)
343
+				} catch(Exception $e)
332 344
 				{
333 345
 					$this->error=$e->getMessage();
334 346
 					return -1;
@@ -343,8 +355,7 @@  discard block
 block discarded – undo
343 355
 				// Make substitutions into odt of freetext
344 356
 				try {
345 357
 					$odfHandler->setVars('free_text', $newfreetext, true, 'UTF-8');
346
-				}
347
-				catch(OdfException $e)
358
+				} catch(OdfException $e)
348 359
 				{
349 360
 				}
350 361
 
@@ -354,18 +365,19 @@  discard block
 block discarded – undo
354 365
 				foreach($tmparray as $key=>$value)
355 366
 				{
356 367
 					try {
357
-						if (preg_match('/logo$/',$key)) // Image
368
+						if (preg_match('/logo$/',$key)) {
369
+						    // Image
358 370
 						{
359 371
 							//var_dump($value);exit;
360 372
 							if (file_exists($value)) $odfHandler->setImage($key, $value);
361
-							else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
362
-						}
363
-						else    // Text
373
+						} else {
374
+							    $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
375
+							}
376
+						} else    // Text
364 377
 						{
365 378
 							$odfHandler->setVars($key, $value, true, 'UTF-8');
366 379
 						}
367
-					}
368
-					catch(OdfException $e)
380
+					} catch(OdfException $e)
369 381
 					{
370 382
 					}
371 383
 				}
@@ -375,18 +387,19 @@  discard block
 block discarded – undo
375 387
 				foreach($tmparray as $key=>$value)
376 388
 				{
377 389
 					try {
378
-						if (preg_match('/logo$/',$key))	// Image
390
+						if (preg_match('/logo$/',$key)) {
391
+						    // Image
379 392
 						{
380 393
 							//var_dump($value);exit;
381 394
 							if (file_exists($value)) $odfHandler->setImage($key, $value);
382
-							else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
383
-						}
384
-						else	// Text
395
+						} else {
396
+							    $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
397
+							}
398
+						} else	// Text
385 399
 						{
386 400
 							$odfHandler->setVars($key, $value, true, 'UTF-8');
387 401
 						}
388
-					}
389
-					catch(OdfException $e)
402
+					} catch(OdfException $e)
390 403
 					{
391 404
 					}
392 405
 				}
@@ -395,17 +408,18 @@  discard block
 block discarded – undo
395 408
 				foreach($tmparray as $key=>$value)
396 409
 				{
397 410
 					try {
398
-						if (preg_match('/logo$/',$key))	// Image
411
+						if (preg_match('/logo$/',$key)) {
412
+						    // Image
399 413
 						{
400 414
 							if (file_exists($value)) $odfHandler->setImage($key, $value);
401
-							else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
402
-						}
403
-						else	// Text
415
+						} else {
416
+							    $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
417
+							}
418
+						} else	// Text
404 419
 						{
405 420
 							$odfHandler->setVars($key, $value, true, 'UTF-8');
406 421
 						}
407
-					}
408
-					catch(OdfException $e)
422
+					} catch(OdfException $e)
409 423
 					{
410 424
 					}
411 425
 				}
@@ -418,17 +432,18 @@  discard block
 block discarded – undo
418 432
 				foreach($tmparray as $key=>$value)
419 433
 				{
420 434
 					try {
421
-						if (preg_match('/logo$/',$key)) // Image
435
+						if (preg_match('/logo$/',$key)) {
436
+						    // Image
422 437
 						{
423 438
 							if (file_exists($value)) $odfHandler->setImage($key, $value);
424
-							else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
425
-						}
426
-						else    // Text
439
+						} else {
440
+							    $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
441
+							}
442
+						} else    // Text
427 443
 						{
428 444
 							$odfHandler->setVars($key, $value, true, 'UTF-8');
429 445
 						}
430
-					}
431
-					catch(OdfException $e)
446
+					} catch(OdfException $e)
432 447
 					{
433 448
 					}
434 449
 				}
@@ -448,19 +463,16 @@  discard block
 block discarded – undo
448 463
 							try
449 464
 							{
450 465
 								$listlines->setVars($key, $val, true, 'UTF-8');
451
-							}
452
-							catch(OdfException $e)
466
+							} catch(OdfException $e)
453 467
 							{
454
-							}
455
-							catch(SegmentException $e)
468
+							} catch(SegmentException $e)
456 469
 							{
457 470
 							}
458 471
 						}
459 472
 						$listlines->merge();
460 473
 					}
461 474
 					$odfHandler->mergeSegment($listlines);
462
-				}
463
-				catch(OdfException $e)
475
+				} catch(OdfException $e)
464 476
 				{
465 477
 					$this->error=$e->getMessage();
466 478
 					dol_syslog($this->error, LOG_WARNING);
@@ -473,8 +485,7 @@  discard block
 block discarded – undo
473 485
 				{
474 486
 					try {
475 487
 						$odfHandler->setVars($key, $value, true, 'UTF-8');
476
-					}
477
-					catch(OdfException $e)
488
+					} catch(OdfException $e)
478 489
 					{
479 490
 					}
480 491
 				}
@@ -487,15 +498,14 @@  discard block
 block discarded – undo
487 498
 				if (!empty($conf->global->MAIN_ODT_AS_PDF)) {
488 499
 					try {
489 500
 						$odfHandler->exportAsAttachedPDF($file);
490
-					}catch (Exception $e){
501
+					} catch (Exception $e){
491 502
 						$this->error=$e->getMessage();
492 503
 						return -1;
493 504
 					}
494
-				}
495
-				else {
505
+				} else {
496 506
 					try {
497 507
 					$odfHandler->saveToDisk($file);
498
-					}catch (Exception $e){
508
+					} catch (Exception $e){
499 509
 						$this->error=$e->getMessage();
500 510
 						return -1;
501 511
 					}
@@ -503,14 +513,14 @@  discard block
 block discarded – undo
503 513
 				$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
504 514
 				$reshook=$hookmanager->executeHooks('afterODTCreation',$parameters,$this,$action);    // Note that $action and $object may have been modified by some hooks
505 515
 
506
-				if (! empty($conf->global->MAIN_UMASK))
507
-					@chmod($file, octdec($conf->global->MAIN_UMASK));
516
+				if (! empty($conf->global->MAIN_UMASK)) {
517
+									@chmod($file, octdec($conf->global->MAIN_UMASK));
518
+				}
508 519
 
509 520
 				$odfHandler=null;	// Destroy object
510 521
 
511 522
 				return 1;   // Success
512
-			}
513
-			else
523
+			} else
514 524
 			{
515 525
 				$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
516 526
 				return -1;
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/reception/mod_reception_beryl.php 1 patch
Braces   +13 added lines, -6 removed lines patch added patch discarded remove patch
@@ -111,10 +111,12 @@  discard block
 block discarded – undo
111 111
 		if ($resql)
112 112
 		{
113 113
 			$obj = $db->fetch_object($resql);
114
-			if ($obj) $max = intval($obj->max);
115
-			else $max=0;
116
-		}
117
-		else
114
+			if ($obj) {
115
+			    $max = intval($obj->max);
116
+			} else {
117
+			    $max=0;
118
+			}
119
+		} else
118 120
 		{
119 121
 			dol_syslog("mod_reception_beryl::getNextValue", LOG_DEBUG);
120 122
 			return -1;
@@ -123,8 +125,13 @@  discard block
 block discarded – undo
123 125
 		$date=time();
124 126
 		$yymm = strftime("%y%m",$date);
125 127
 
126
-		if ($max >= (pow(10, 4) - 1)) $num=$max+1;	// If counter > 9999, we do not format on 4 chars, we take number as it is
127
-		else $num = sprintf("%04s",$max+1);
128
+		if ($max >= (pow(10, 4) - 1)) {
129
+		    $num=$max+1;
130
+		}
131
+		// If counter > 9999, we do not format on 4 chars, we take number as it is
132
+		else {
133
+		    $num = sprintf("%04s",$max+1);
134
+		}
128 135
 
129 136
 		dol_syslog("mod_reception_beryl::getNextValue return ".$this->prefix.$yymm."-".$num);
130 137
 		return $this->prefix.$yymm."-".$num;
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/payment/mod_payment_cicada.php 1 patch
Braces   +13 added lines, -6 removed lines patch added patch discarded remove patch
@@ -134,10 +134,12 @@  discard block
 block discarded – undo
134 134
 		if ($resql)
135 135
 		{
136 136
 			$obj = $db->fetch_object($resql);
137
-			if ($obj) $max = intval($obj->max);
138
-			else $max=0;
139
-		}
140
-		else
137
+			if ($obj) {
138
+			    $max = intval($obj->max);
139
+			} else {
140
+			    $max=0;
141
+			}
142
+		} else
141 143
 		{
142 144
 			dol_syslog(__METHOD__, LOG_DEBUG);
143 145
 			return -1;
@@ -147,8 +149,13 @@  discard block
 block discarded – undo
147 149
 		$date=$object->datepaye;
148 150
 		$yymm = strftime("%y%m",$date);
149 151
 
150
-    	if ($max >= (pow(10, 4) - 1)) $num=$max+1;	// If counter > 9999, we do not format on 4 chars, we take number as it is
151
-    	else $num = sprintf("%04s",$max+1);
152
+    	if ($max >= (pow(10, 4) - 1)) {
153
+    	    $num=$max+1;
154
+    	}
155
+    	// If counter > 9999, we do not format on 4 chars, we take number as it is
156
+    	else {
157
+    	    $num = sprintf("%04s",$max+1);
158
+    	}
152 159
 
153 160
 		dol_syslog(__METHOD__." return ".$this->prefix.$yymm."-".$num);
154 161
 		return $this->prefix.$yymm."-".$num;
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/modUser.class.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -263,11 +263,13 @@
 block discarded – undo
263 263
 		// Add extra fields
264 264
 		$sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'user' AND entity IN (0,".$conf->entity.")";
265 265
 		$resql=$this->db->query($sql);
266
-		if ($resql)    // This can fail when class is used on old database (during migration for example)
266
+		if ($resql) {
267
+		    // This can fail when class is used on old database (during migration for example)
267 268
 		{
268 269
 		    while ($obj=$this->db->fetch_object($resql))
269 270
 		    {
270 271
 		        $fieldname='extra.'.$obj->name;
272
+		}
271 273
 		        $fieldlabel=ucfirst($obj->label);
272 274
 		        $this->import_fields_array[$r][$fieldname]=$fieldlabel.($obj->fieldrequired?'*':'');
273 275
 		    }
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/export/export_excel2007.modules.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -94,8 +94,7 @@  discard block
 block discarded – undo
94 94
                 require_once PHP_WRITEEXCEL_PATH.'functions.writeexcel_utility.inc.php';
95 95
     			$this->label_lib='PhpWriteExcel';
96 96
                 $this->version_lib='unknown';
97
-    		}
98
-    		else
97
+    		} else
99 98
     		{
100 99
                 require_once PHPEXCEL_PATH.'PHPExcel.php';
101 100
                 require_once PHPEXCEL_PATH.'PHPExcel/Style/Alignment.php';
@@ -122,8 +121,7 @@  discard block
 block discarded – undo
122 121
 		if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL))
123 122
     	{
124 123
 	        $this->workbook->close();
125
-    	}
126
-    	else
124
+    	} else
127 125
     	{
128 126
             require_once PHPEXCEL_PATH.'PHPExcel/Writer/Excel5.php';
129 127
     	    $objWriter = new PHPExcel_Writer_Excel2007($this->workbook);
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/export/export_excel.modules.php 1 patch
Braces   +32 added lines, -31 removed lines patch added patch discarded remove patch
@@ -94,8 +94,7 @@  discard block
 block discarded – undo
94 94
                 require_once PHP_WRITEEXCEL_PATH.'functions.writeexcel_utility.inc.php';
95 95
     			$this->label_lib='PhpWriteExcel';
96 96
                 $this->version_lib='unknown';
97
-    		}
98
-    		else
97
+    		} else
99 98
     		{
100 99
                 require_once PHPEXCEL_PATH.'PHPExcel.php';
101 100
                 require_once PHPEXCEL_PATH.'PHPExcel/Style/Alignment.php';
@@ -211,17 +210,18 @@  discard block
 block discarded – undo
211 210
     		$this->workbook->set_tempdir($conf->export->dir_temp);			// Set temporary directory
212 211
     		$this->workbook->set_sheetname($outputlangs->trans("Sheet"));
213 212
     		$this->worksheet = &$this->workbook->addworksheet();
214
-		}
215
-		else
213
+		} else
216 214
 		{
217 215
             require_once PHPEXCEL_PATH.'PHPExcel.php';
218 216
             require_once PHPEXCEL_PATH.'PHPExcel/Style/Alignment.php';
219 217
 
220 218
 		    if ($this->id == 'excel2007')
221 219
 		    {
222
-	            if (! class_exists('ZipArchive'))	// For Excel2007, PHPExcel need ZipArchive
220
+	            if (! class_exists('ZipArchive')) {
221
+	                // For Excel2007, PHPExcel need ZipArchive
223 222
 	            {
224 223
 	            	$langs->load("errors");
224
+	            }
225 225
 	            	$this->error=$langs->trans('ErrorPHPNeedModule','zip');
226 226
 	            	return -1;
227 227
 	            }
@@ -291,8 +291,7 @@  discard block
 block discarded – undo
291 291
     		//$formatheader->set_size(12);
292 292
     		//$formatheader->set_font("Courier New");
293 293
     		//$formatheader->set_align('center');
294
-		}
295
-		else
294
+		} else
296 295
 		{
297 296
             $this->workbook->getActiveSheet()->getStyle('1')->getFont()->setBold(true);
298 297
 		    $this->workbook->getActiveSheet()->getStyle('1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
@@ -303,17 +302,20 @@  discard block
 block discarded – undo
303 302
 		{
304 303
             $alias=$array_export_fields_label[$code];
305 304
 			//print "dd".$alias;
306
-			if (empty($alias)) dol_print_error('','Bad value for field with code='.$code.'. Try to redefine export.');
305
+			if (empty($alias)) {
306
+			    dol_print_error('','Bad value for field with code='.$code.'. Try to redefine export.');
307
+			}
307 308
     		if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL))
308 309
     		{
309 310
     			$this->worksheet->write($this->row, $this->col, $outputlangs->transnoentities($alias), $formatheader);
310
-    		}
311
-    		else
311
+    		} else
312 312
     		{
313 313
                 $this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row+1, $outputlangs->transnoentities($alias));
314
-    		    if (! empty($array_types[$code]) && in_array($array_types[$code],array('Date','Numeric','TextAuto')))		// Set autowidth for some types
314
+    		    if (! empty($array_types[$code]) && in_array($array_types[$code],array('Date','Numeric','TextAuto'))) {
315
+    		        // Set autowidth for some types
315 316
                 {
316 317
                 	$this->workbook->getActiveSheet()->getColumnDimension($this->column2Letter($this->col + 1))->setAutoSize(true);
318
+    		    }
317 319
                 }
318 320
     		}
319 321
 			$this->col++;
@@ -348,9 +350,14 @@  discard block
 block discarded – undo
348 350
 
349 351
 		foreach($array_selected_sorted as $code => $value)
350 352
 		{
351
-			if (strpos($code,' as ') == 0) $alias=str_replace(array('.','-','(',')'),'_',$code);
352
-			else $alias=substr($code, strpos($code, ' as ') + 4);
353
-            if (empty($alias)) dol_print_error('','Bad value for field with code='.$code.'. Try to redefine export.');
353
+			if (strpos($code,' as ') == 0) {
354
+			    $alias=str_replace(array('.','-','(',')'),'_',$code);
355
+			} else {
356
+			    $alias=substr($code, strpos($code, ' as ') + 4);
357
+			}
358
+            if (empty($alias)) {
359
+                dol_print_error('','Bad value for field with code='.$code.'. Try to redefine export.');
360
+            }
354 361
             $newvalue=$objp->$alias;
355 362
 
356 363
 			$newvalue=$this->excel_clean($newvalue);
@@ -367,8 +374,7 @@  discard block
 block discarded – undo
367 374
 			if (preg_match('/^\((.*)\)$/i',$newvalue,$reg))
368 375
 			{
369 376
 				$newvalue=$outputlangs->transnoentities($reg[1]);
370
-			}
371
-			else
377
+			} else
372 378
 			{
373 379
 				$newvalue=$outputlangs->convToOutputCharset($newvalue);
374 380
 			}
@@ -384,16 +390,14 @@  discard block
 block discarded – undo
384 390
     				//print "x".$arrayvalue[0].'.'.strval($arrayvalue[1]).'<br>';
385 391
     				$newvalue=strval($arrayvalue[0]).'.'.strval($arrayvalue[1]);	// $newvalue=strval(36892.521); directly does not work because . will be convert into , later
386 392
         		    $this->worksheet->write($this->row, $this->col, $newvalue, PHPExcel_Shared_Date::PHPToExcel($formatdate));
387
-        		}
388
-        		else
393
+        		} else
389 394
         		{
390 395
         		    $newvalue=dol_stringtotime($newvalue);
391 396
         		    $this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row+1, PHPExcel_Shared_Date::PHPToExcel($newvalue));
392 397
         		    $coord=$this->workbook->getActiveSheet()->getCellByColumnAndRow($this->col, $this->row+1)->getCoordinate();
393 398
         		    $this->workbook->getActiveSheet()->getStyle($coord)->getNumberFormat()->setFormatCode('yyyy-mm-dd');
394 399
         		}
395
-			}
396
-			elseif (preg_match('/^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9]$/i',$newvalue))
400
+			} elseif (preg_match('/^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9]$/i',$newvalue))
397 401
 			{
398 402
 				if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL))
399 403
     		    {
@@ -404,22 +408,19 @@  discard block
 block discarded – undo
404 408
     				//print "x".$arrayvalue[0].'.'.strval($arrayvalue[1]).'<br>';
405 409
     				$newvalue=strval($arrayvalue[0]).'.'.strval($arrayvalue[1]);	// $newvalue=strval(36892.521); directly does not work because . will be convert into , later
406 410
     		        $this->worksheet->write($this->row, $this->col, $newvalue, $formatdatehour);
407
-    		    }
408
-    		    else
411
+    		    } else
409 412
     		    {
410 413
         		    $newvalue=dol_stringtotime($newvalue);
411 414
     		        $this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row+1, PHPExcel_Shared_Date::PHPToExcel($newvalue));
412 415
         		    $coord=$this->workbook->getActiveSheet()->getCellByColumnAndRow($this->col, $this->row+1)->getCoordinate();
413 416
         		    $this->workbook->getActiveSheet()->getStyle($coord)->getNumberFormat()->setFormatCode('yyyy-mm-dd h:mm:ss');
414 417
     		    }
415
-			}
416
-			else
418
+			} else
417 419
 			{
418 420
 				if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL))
419 421
     		    {
420 422
 			        $this->worksheet->write($this->row, $this->col, $newvalue);
421
-    		    }
422
-    		    else
423
+    		    } else
423 424
 				{
424 425
     		    	if ($typefield == 'Text' || $typefield == 'TextAuto')
425 426
     		    	{
@@ -428,8 +429,7 @@  discard block
 block discarded – undo
428 429
     		    		$coord=$this->workbook->getActiveSheet()->getCellByColumnAndRow($this->col, $this->row+1)->getCoordinate();
429 430
     		    		$this->workbook->getActiveSheet()->getStyle($coord)->getNumberFormat()->setFormatCode('@');
430 431
     		    		$this->workbook->getActiveSheet()->getStyle($coord)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
431
-    		    	}
432
-    		    	else
432
+    		    	} else
433 433
     		    	{
434 434
     		    		$this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row+1, $newvalue);
435 435
     		    	}
@@ -470,8 +470,7 @@  discard block
 block discarded – undo
470 470
 		if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL))
471 471
     	{
472 472
 	        $this->workbook->close();
473
-    	}
474
-    	else
473
+    	} else
475 474
     	{
476 475
             require_once PHPEXCEL_PATH.'PHPExcel/Writer/Excel5.php';
477 476
     	    $objWriter = new PHPExcel_Writer_Excel5($this->workbook);
@@ -510,7 +509,9 @@  discard block
 block discarded – undo
510 509
     {
511 510
 
512 511
     	$c = intval($c);
513
-    	if ($c <= 0) return '';
512
+    	if ($c <= 0) {
513
+    	    return '';
514
+    	}
514 515
 
515 516
     	while ($c != 0)
516 517
     	{
Please login to merge, or discard this patch.
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.