Passed
Branch develop (66e4de)
by Laurent
33:03
created
htdocs/core/lib/ldap.lib.php 1 patch
Braces   +30 added lines, -10 removed lines patch added patch discarded remove patch
@@ -142,15 +142,28 @@  discard block
 block discarded – undo
142 142
 	global $bc, $conf;
143 143
 
144 144
 	$count--;
145
-	if ($count == 0) return -1; // To stop loop
146
-	if (!is_array($result)) return -1;
145
+	if ($count == 0) {
146
+		return -1;
147
+	}
148
+	// To stop loop
149
+	if (!is_array($result)) {
150
+		return -1;
151
+	}
147 152
 
148 153
 	foreach ($result as $key => $val)
149 154
 	{
150
-		if ("$key" == "objectclass") continue;
151
-		if ("$key" == "count") continue;
152
-		if ("$key" == "dn") continue;
153
-		if ("$val" == "objectclass") continue;
155
+		if ("$key" == "objectclass") {
156
+			continue;
157
+		}
158
+		if ("$key" == "count") {
159
+			continue;
160
+		}
161
+		if ("$key" == "dn") {
162
+			continue;
163
+		}
164
+		if ("$val" == "objectclass") {
165
+			continue;
166
+		}
154 167
 
155 168
 		$lastkey[$level] = $key;
156 169
 
@@ -163,18 +176,25 @@  discard block
 block discarded – undo
163 176
 				print '<td>';
164 177
 				print $key;
165 178
 				print '</td><td>';
166
-				if (strtolower($key) == 'userpassword') $hide = 1;
179
+				if (strtolower($key) == 'userpassword') {
180
+					$hide = 1;
181
+				}
167 182
 			}
168 183
 			show_ldap_content($val, $level + 1, $count, $var, $hide, $val["count"]);
169 184
 		} elseif ($subcount)
170 185
 		{
171 186
 			$subcount--;
172 187
 			$newstring = dol_htmlentitiesbr($val);
173
-			if ($hide) print preg_replace('/./i', '*', $newstring);
174
-			else print $newstring;
188
+			if ($hide) {
189
+				print preg_replace('/./i', '*', $newstring);
190
+			} else {
191
+				print $newstring;
192
+			}
175 193
 			print '<br>';
176 194
 		}
177
-		if ("$val" != $lastkey[$level] && !$subcount) print '</td></tr>';
195
+		if ("$val" != $lastkey[$level] && !$subcount) {
196
+			print '</td></tr>';
197
+		}
178 198
 	}
179 199
 	return 1;
180 200
 }
Please login to merge, or discard this patch.
htdocs/core/lib/signature.lib.php 1 patch
Braces   +16 added lines, -6 removed lines patch added patch discarded remove patch
@@ -59,15 +59,22 @@  discard block
 block discarded – undo
59 59
 	if ($type == 'proposal')
60 60
 	{
61 61
 		$out = DOL_MAIN_URL_ROOT.'/public/onlinesign/newonlinesign.php?source=proposal&ref='.($mode ? '<font color="#666666">' : '');
62
-		if ($mode == 1) $out .= 'proposal_ref';
63
-		if ($mode == 0) $out .= urlencode($ref);
62
+		if ($mode == 1) {
63
+			$out .= 'proposal_ref';
64
+		}
65
+		if ($mode == 0) {
66
+			$out .= urlencode($ref);
67
+		}
64 68
 		$out .= ($mode ? '</font>' : '');
65
-		if ($mode == 1) $out .= '&hashp=<font color="#666666">hash_of_file</font>';
66
-		else {
69
+		if ($mode == 1) {
70
+			$out .= '&hashp=<font color="#666666">hash_of_file</font>';
71
+		} else {
67 72
 			include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
68 73
 			$propaltmp = new Propal($db);
69 74
 			$res = $propaltmp->fetch(0, $ref);
70
-			if ($res <= 0) return 'FailedToGetProposal';
75
+			if ($res <= 0) {
76
+				return 'FailedToGetProposal';
77
+			}
71 78
 
72 79
 			include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';
73 80
 			$ecmfile = new EcmFiles($db);
@@ -86,7 +93,10 @@  discard block
 block discarded – undo
86 93
 	}
87 94
 
88 95
 	// For multicompany
89
-	if (!empty($out)) $out .= "&entity=".$conf->entity; // Check the entity because He may be the same reference in several entities
96
+	if (!empty($out)) {
97
+		$out .= "&entity=".$conf->entity;
98
+	}
99
+	// Check the entity because He may be the same reference in several entities
90 100
 
91 101
 	return $out;
92 102
 }
Please login to merge, or discard this patch.
htdocs/core/lib/doc.lib.php 1 patch
Braces   +31 added lines, -10 removed lines patch added patch discarded remove patch
@@ -48,8 +48,11 @@  discard block
 block discarded – undo
48 48
 	$ref_supplier = (!empty($line->ref_supplier) ? $line->ref_supplier : (!empty($line->ref_fourn) ? $line->ref_fourn : '')); // TODO Not yet saved for supplier invoices, only supplier orders
49 49
 	$note = (!empty($line->note) ? $line->note : '');
50 50
 
51
-	if ($issupplierline) $prodser = new ProductFournisseur($db);
52
-	else $prodser = new Product($db);
51
+	if ($issupplierline) {
52
+		$prodser = new ProductFournisseur($db);
53
+	} else {
54
+		$prodser = new Product($db);
55
+	}
53 56
 
54 57
 	if ($idprod)
55 58
 	{
@@ -57,9 +60,15 @@  discard block
 block discarded – undo
57 60
 		// If a predefined product and multilang and on other lang, we renamed label with label translated
58 61
 		if (!empty($conf->global->MAIN_MULTILANGS) && ($outputlangs->defaultlang != $langs->defaultlang))
59 62
 		{
60
-			if (!empty($prodser->multilangs[$outputlangs->defaultlang]["label"]) && $label == $prodser->label)     $label = $prodser->multilangs[$outputlangs->defaultlang]["label"];
61
-			if (!empty($prodser->multilangs[$outputlangs->defaultlang]["description"]) && $desc == $prodser->description) $desc = $prodser->multilangs[$outputlangs->defaultlang]["description"];
62
-			if (!empty($prodser->multilangs[$outputlangs->defaultlang]["note"]) && $note == $prodser->note)        $note = $prodser->multilangs[$outputlangs->defaultlang]["note"];
63
+			if (!empty($prodser->multilangs[$outputlangs->defaultlang]["label"]) && $label == $prodser->label) {
64
+				$label = $prodser->multilangs[$outputlangs->defaultlang]["label"];
65
+			}
66
+			if (!empty($prodser->multilangs[$outputlangs->defaultlang]["description"]) && $desc == $prodser->description) {
67
+				$desc = $prodser->multilangs[$outputlangs->defaultlang]["description"];
68
+			}
69
+			if (!empty($prodser->multilangs[$outputlangs->defaultlang]["note"]) && $note == $prodser->note) {
70
+				$note = $prodser->multilangs[$outputlangs->defaultlang]["note"];
71
+			}
63 72
 		}
64 73
 	}
65 74
 
@@ -82,7 +91,9 @@  discard block
 block discarded – undo
82 91
 			$sourceref = !empty($discount->discount_type) ? $discount->ref_invoive_supplier_source : $discount->ref_facture_source;
83 92
 			$libelleproduitservice = $outputlangs->transnoentitiesnoconv("DiscountFromDeposit", $sourceref);
84 93
 			// Add date of deposit
85
-			if (!empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) $libelleproduitservice .= ' ('.dol_print_date($discount->datec, 'day', '', $outputlangs).')';
94
+			if (!empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) {
95
+				$libelleproduitservice .= ' ('.dol_print_date($discount->datec, 'day', '', $outputlangs).')';
96
+			}
86 97
 		} elseif ($desc == '(EXCESS RECEIVED)' && $line->fk_remise_except)
87 98
 		{
88 99
 			$discount = new DiscountAbsolute($db);
@@ -96,7 +107,9 @@  discard block
 block discarded – undo
96 107
 		} else {
97 108
 			if ($idprod)
98 109
 			{
99
-				if (empty($hidedesc)) $libelleproduitservice = dol_concatdesc($libelleproduitservice, $desc);
110
+				if (empty($hidedesc)) {
111
+					$libelleproduitservice = dol_concatdesc($libelleproduitservice, $desc);
112
+				}
100 113
 			} else {
101 114
 				$libelleproduitservice = dol_concatdesc($libelleproduitservice, $desc);
102 115
 			}
@@ -111,11 +124,13 @@  discard block
 block discarded – undo
111 124
 		{
112 125
 			$prefix_prodserv = "";
113 126
 			$ref_prodserv = "";
114
-			if (!empty($conf->global->PRODUCT_ADD_TYPE_IN_DOCUMENTS))   // In standard mode, we do not show this
127
+			if (!empty($conf->global->PRODUCT_ADD_TYPE_IN_DOCUMENTS)) {
128
+				// In standard mode, we do not show this
115 129
 			{
116 130
 				if ($prodser->isService())
117 131
 				{
118 132
 					$prefix_prodserv = $outputlangs->transnoentitiesnoconv("Service")." ";
133
+			}
119 134
 				} else {
120 135
 					$prefix_prodserv = $outputlangs->transnoentitiesnoconv("Product")." ";
121 136
 				}
@@ -123,8 +138,14 @@  discard block
 block discarded – undo
123 138
 
124 139
 			if (empty($hideref))
125 140
 			{
126
-				if ($issupplierline) $ref_prodserv = $prodser->ref.' ('.$outputlangs->trans("SupplierRef").' '.$ref_supplier.')'; // Show local ref and supplier ref
127
-				else $ref_prodserv = $prodser->ref; // Show local ref only
141
+				if ($issupplierline) {
142
+					$ref_prodserv = $prodser->ref.' ('.$outputlangs->trans("SupplierRef").' '.$ref_supplier.')';
143
+				}
144
+				// Show local ref and supplier ref
145
+				else {
146
+					$ref_prodserv = $prodser->ref;
147
+				}
148
+				// Show local ref only
128 149
 
129 150
 				$ref_prodserv .= " - ";
130 151
 			}
Please login to merge, or discard this patch.
htdocs/core/lib/website2.lib.php 1 patch
Braces   +56 added lines, -27 removed lines patch added patch discarded remove patch
@@ -45,8 +45,9 @@  discard block
 block discarded – undo
45 45
 	$mastercontent .= "}\n";
46 46
 	$mastercontent .= '?>'."\n";
47 47
 	$result = file_put_contents($filemaster, $mastercontent);
48
-	if (!empty($conf->global->MAIN_UMASK))
49
-		@chmod($filemaster, octdec($conf->global->MAIN_UMASK));
48
+	if (!empty($conf->global->MAIN_UMASK)) {
49
+			@chmod($filemaster, octdec($conf->global->MAIN_UMASK));
50
+	}
50 51
 
51 52
 		return $result;
52 53
 }
@@ -128,7 +129,10 @@  discard block
 block discarded – undo
128 129
 	dol_delete_file($filetpl);
129 130
 
130 131
 	$shortlangcode = '';
131
-	if ($objectpage->lang) $shortlangcode = substr($objectpage->lang, 0, 2); // en_US or en-US -> en
132
+	if ($objectpage->lang) {
133
+		$shortlangcode = substr($objectpage->lang, 0, 2);
134
+	}
135
+	// en_US or en-US -> en
132 136
 
133 137
 	$tplcontent = '';
134 138
 	$tplcontent .= "<?php // BEGIN PHP\n";
@@ -174,7 +178,10 @@  discard block
 block discarded – undo
174 178
 			$tmppage->fetch($translationof);
175 179
 			if ($tmppage->id > 0) {
176 180
 				$tmpshortlangcode = '';
177
-				if ($tmppage->lang) $tmpshortlangcode = preg_replace('/[_-].*$/', '', $tmppage->lang); // en_US or en-US -> en
181
+				if ($tmppage->lang) {
182
+					$tmpshortlangcode = preg_replace('/[_-].*$/', '', $tmppage->lang);
183
+				}
184
+				// en_US or en-US -> en
178 185
 				if ($tmpshortlangcode != $shortlangcode) {
179 186
 					$tplcontent .= '<link rel="alternate" hreflang="'.$tmpshortlangcode.'" href="'.($object->fk_default_home == $tmppage->id ? '/' : (($tmpshortlangcode != substr($object->lang, 0, 2)) ? '/'.$tmpshortlangcode : '').'/'.$tmppage->pageurl.'.php').'" />'."\n";
180 187
 				}
@@ -191,7 +198,10 @@  discard block
 block discarded – undo
191 198
 				while ($obj = $db->fetch_object($resql))
192 199
 				{
193 200
 					$tmpshortlangcode = '';
194
-					if ($obj->lang) $tmpshortlangcode = preg_replace('/[_-].*$/', '', $obj->lang); // en_US or en-US -> en
201
+					if ($obj->lang) {
202
+						$tmpshortlangcode = preg_replace('/[_-].*$/', '', $obj->lang);
203
+					}
204
+					// en_US or en-US -> en
195 205
 					if ($tmpshortlangcode != $shortlangcode) {
196 206
 						$tplcontent .= '<link rel="alternate" hreflang="'.$tmpshortlangcode.'" href="'.($object->fk_default_home == $obj->id ? '/' : (($tmpshortlangcode != substr($object->lang, 0, 2) ? '/'.$tmpshortlangcode : '')).'/'.$obj->pageurl.'.php').'" />'."\n";
197 207
 					}
@@ -224,8 +234,9 @@  discard block
 block discarded – undo
224 234
 
225 235
 	//var_dump($filetpl);exit;
226 236
 	$result = file_put_contents($filetpl, $tplcontent);
227
-	if (!empty($conf->global->MAIN_UMASK))
228
-		@chmod($filetpl, octdec($conf->global->MAIN_UMASK));
237
+	if (!empty($conf->global->MAIN_UMASK)) {
238
+			@chmod($filetpl, octdec($conf->global->MAIN_UMASK));
239
+	}
229 240
 
230 241
 		return $result;
231 242
 }
@@ -302,8 +313,9 @@  discard block
 block discarded – undo
302 313
 
303 314
 	dol_mkdir($pathofwebsite);
304 315
 	$result = file_put_contents($filehtmlheader, $htmlheadercontent);
305
-	if (!empty($conf->global->MAIN_UMASK))
306
-		@chmod($filehtmlheader, octdec($conf->global->MAIN_UMASK));
316
+	if (!empty($conf->global->MAIN_UMASK)) {
317
+			@chmod($filehtmlheader, octdec($conf->global->MAIN_UMASK));
318
+	}
307 319
 
308 320
 	return $result;
309 321
 }
@@ -323,8 +335,9 @@  discard block
 block discarded – undo
323 335
 
324 336
 	dol_mkdir($pathofwebsite);
325 337
 	$result = file_put_contents($filecss, $csscontent);
326
-	if (!empty($conf->global->MAIN_UMASK))
327
-		@chmod($filecss, octdec($conf->global->MAIN_UMASK));
338
+	if (!empty($conf->global->MAIN_UMASK)) {
339
+			@chmod($filecss, octdec($conf->global->MAIN_UMASK));
340
+	}
328 341
 
329 342
 	return $result;
330 343
 }
@@ -344,8 +357,9 @@  discard block
 block discarded – undo
344 357
 
345 358
 	dol_mkdir($pathofwebsite);
346 359
 	$result = file_put_contents($filejs, $jscontent);
347
-	if (!empty($conf->global->MAIN_UMASK))
348
-		@chmod($filejs, octdec($conf->global->MAIN_UMASK));
360
+	if (!empty($conf->global->MAIN_UMASK)) {
361
+			@chmod($filejs, octdec($conf->global->MAIN_UMASK));
362
+	}
349 363
 
350 364
 	return $result;
351 365
 }
@@ -365,8 +379,9 @@  discard block
 block discarded – undo
365 379
 
366 380
 	dol_mkdir($pathofwebsite);
367 381
 	$result = file_put_contents($filerobot, $robotcontent);
368
-	if (!empty($conf->global->MAIN_UMASK))
369
-		@chmod($filerobot, octdec($conf->global->MAIN_UMASK));
382
+	if (!empty($conf->global->MAIN_UMASK)) {
383
+			@chmod($filerobot, octdec($conf->global->MAIN_UMASK));
384
+	}
370 385
 
371 386
 	return $result;
372 387
 }
@@ -386,8 +401,9 @@  discard block
 block discarded – undo
386 401
 
387 402
 	dol_mkdir($pathofwebsite);
388 403
 	$result = file_put_contents($filehtaccess, $htaccess);
389
-	if (!empty($conf->global->MAIN_UMASK))
390
-		@chmod($filehtaccess, octdec($conf->global->MAIN_UMASK));
404
+	if (!empty($conf->global->MAIN_UMASK)) {
405
+			@chmod($filehtaccess, octdec($conf->global->MAIN_UMASK));
406
+	}
391 407
 
392 408
 	return $result;
393 409
 }
@@ -407,8 +423,9 @@  discard block
 block discarded – undo
407 423
 
408 424
 	dol_mkdir($pathofwebsite);
409 425
 	$result = file_put_contents($file, $content);
410
-	if (!empty($conf->global->MAIN_UMASK))
411
-		@chmod($file, octdec($conf->global->MAIN_UMASK));
426
+	if (!empty($conf->global->MAIN_UMASK)) {
427
+			@chmod($file, octdec($conf->global->MAIN_UMASK));
428
+	}
412 429
 
413 430
 	return $result;
414 431
 }
@@ -428,8 +445,9 @@  discard block
 block discarded – undo
428 445
 
429 446
 	dol_mkdir($pathofwebsite);
430 447
 	$result = file_put_contents($file, $content);
431
-	if (!empty($conf->global->MAIN_UMASK))
432
-		@chmod($file, octdec($conf->global->MAIN_UMASK));
448
+	if (!empty($conf->global->MAIN_UMASK)) {
449
+			@chmod($file, octdec($conf->global->MAIN_UMASK));
450
+	}
433 451
 
434 452
 		return $result;
435 453
 }
@@ -446,11 +464,13 @@  discard block
 block discarded – undo
446 464
 	global $conf, $langs, $db, $form;
447 465
 
448 466
 	$dirthemes = array('/doctemplates/websites');
449
-	if (!empty($conf->modules_parts['websitetemplates']))		// Using this feature slow down application
467
+	if (!empty($conf->modules_parts['websitetemplates'])) {
468
+		// Using this feature slow down application
450 469
 	{
451 470
 		foreach ($conf->modules_parts['websitetemplates'] as $reldir)
452 471
 		{
453 472
 			$dirthemes = array_merge($dirthemes, (array) ($reldir.'doctemplates/websites'));
473
+	}
454 474
 		}
455 475
 	}
456 476
 	$dirthemes = array_unique($dirthemes);
@@ -495,15 +515,21 @@  discard block
 block discarded – undo
495 515
 							$subdirwithoutzip = preg_replace('/\.zip$/i', '', $subdir);
496 516
 
497 517
 							// Disable not stable themes (dir ends with _exp or _dev)
498
-							if ($conf->global->MAIN_FEATURES_LEVEL < 2 && preg_match('/_dev$/i', $subdir)) continue;
499
-							if ($conf->global->MAIN_FEATURES_LEVEL < 1 && preg_match('/_exp$/i', $subdir)) continue;
518
+							if ($conf->global->MAIN_FEATURES_LEVEL < 2 && preg_match('/_dev$/i', $subdir)) {
519
+								continue;
520
+							}
521
+							if ($conf->global->MAIN_FEATURES_LEVEL < 1 && preg_match('/_exp$/i', $subdir)) {
522
+								continue;
523
+							}
500 524
 
501 525
 							print '<div class="inline-block" style="margin-top: 10px; margin-bottom: 10px; margin-right: 20px; margin-left: 20px;">';
502 526
 
503 527
 							$file = $dirtheme."/".$subdirwithoutzip.".jpg";
504 528
 							$url = DOL_URL_ROOT.'/viewimage.php?modulepart=doctemplateswebsite&file='.$subdirwithoutzip.".jpg";
505 529
 
506
-							if (!file_exists($file)) $url = DOL_URL_ROOT.'/public/theme/common/nophoto.png';
530
+							if (!file_exists($file)) {
531
+								$url = DOL_URL_ROOT.'/public/theme/common/nophoto.png';
532
+							}
507 533
 
508 534
 							$originalfile = basename($file);
509 535
 							$entity = $conf->entity;
@@ -513,8 +539,11 @@  discard block
 block discarded – undo
513 539
 
514 540
 							$ret = '';
515 541
 							$urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 1, '&entity='.$entity);
516
-							if (!empty($urladvanced)) $ret .= '<a class="'.$urladvanced['css'].'" target="'.$urladvanced['target'].'" mime="'.$urladvanced['mime'].'" href="'.$urladvanced['url'].'">';
517
-							else $ret .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">';
542
+							if (!empty($urladvanced)) {
543
+								$ret .= '<a class="'.$urladvanced['css'].'" target="'.$urladvanced['target'].'" mime="'.$urladvanced['mime'].'" href="'.$urladvanced['url'].'">';
544
+							} else {
545
+								$ret .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">';
546
+							}
518 547
 							print $ret;
519 548
 							print '<img class="img-skinthumb shadow" src="'.$url.'" border="0" alt="'.$title.'" title="'.$title.'" style="margin-bottom: 5px;">';
520 549
 							print '</a>';
Please login to merge, or discard this patch.
htdocs/core/lib/xcal.lib.php 1 patch
Braces   +9 added lines, -5 removed lines patch added patch discarded remove patch
@@ -361,7 +361,9 @@  discard block
 block discarded – undo
361 361
 
362 362
 		fwrite($fichier, "<channel>\n");
363 363
 		fwrite($fichier, "<title>".$title."</title>\n");
364
-		if ($langcode) fwrite($fichier, "<language>".$langcode."</language>\n");
364
+		if ($langcode) {
365
+			fwrite($fichier, "<language>".$langcode."</language>\n");
366
+		}
365 367
 
366 368
 		/*
367 369
         fwrite($fichier, "<description><![CDATA[".$desc.".]]></description>"."\n".
@@ -432,8 +434,9 @@  discard block
 block discarded – undo
432 434
 				fwrite($fichier, "<category><![CDATA[".$category."]]></category>\n");
433 435
 				fwrite($fichier, "<description><![CDATA[");
434 436
 
435
-				if ($description)
436
-					fwrite($fichier, $description);
437
+				if ($description) {
438
+									fwrite($fichier, $description);
439
+				}
437 440
 				// else
438 441
 				//     fwrite($fichier, "NoDesc");
439 442
 
@@ -586,8 +589,9 @@  discard block
 block discarded – undo
586 589
 				$out .= $newpara."=\r\n";
587 590
 
588 591
 				// extra space for cal
589
-				if ($forcal)
590
-					$out .= " ";
592
+				if ($forcal) {
593
+									$out .= " ";
594
+				}
591 595
 
592 596
 				$newpara = "";
593 597
 			}
Please login to merge, or discard this patch.
htdocs/core/lib/invoice2.lib.php 1 patch
Braces   +101 added lines, -40 removed lines patch added patch discarded remove patch
@@ -59,8 +59,11 @@  discard block
 block discarded – undo
59 59
 	}
60 60
 	if (in_array('date', $filter))
61 61
 	{
62
-		if (empty($sqlwhere)) $sqlwhere = ' WHERE ';
63
-		else $sqlwhere .= " AND";
62
+		if (empty($sqlwhere)) {
63
+			$sqlwhere = ' WHERE ';
64
+		} else {
65
+			$sqlwhere .= " AND";
66
+		}
64 67
 		$sqlwhere .= " f.fk_statut > 0";
65 68
 		$sqlwhere .= " AND f.datef >= '".$db->idate($dateafterdate)."'";
66 69
 		$sqlwhere .= " AND f.datef <= '".$db->idate($datebeforedate)."'";
@@ -69,17 +72,25 @@  discard block
 block discarded – undo
69 72
 	if (in_array('nopayment', $filter))
70 73
 	{
71 74
 		$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid = pf.fk_facture";
72
-		if (empty($sqlwhere)) $sqlwhere = ' WHERE ';
73
-		else $sqlwhere .= " AND";
75
+		if (empty($sqlwhere)) {
76
+			$sqlwhere = ' WHERE ';
77
+		} else {
78
+			$sqlwhere .= " AND";
79
+		}
74 80
 		$sqlwhere .= " f.fk_statut > 0";
75 81
 		$sqlwhere .= " AND pf.fk_paiement IS NULL";
76 82
 	}
77 83
 	if (in_array('payments', $filter) || in_array('bank', $filter))
78 84
 	{
79 85
 		$sql .= ", ".MAIN_DB_PREFIX."paiement_facture as pf, ".MAIN_DB_PREFIX."paiement as p";
80
-		if (in_array('bank', $filter)) $sql .= ", ".MAIN_DB_PREFIX."bank as b";
81
-		if (empty($sqlwhere)) $sqlwhere = ' WHERE ';
82
-		else $sqlwhere .= " AND";
86
+		if (in_array('bank', $filter)) {
87
+			$sql .= ", ".MAIN_DB_PREFIX."bank as b";
88
+		}
89
+		if (empty($sqlwhere)) {
90
+			$sqlwhere = ' WHERE ';
91
+		} else {
92
+			$sqlwhere .= " AND";
93
+		}
83 94
 		$sqlwhere .= " f.fk_statut > 0";
84 95
 		$sqlwhere .= " AND f.rowid = pf.fk_facture";
85 96
 		$sqlwhere .= " AND pf.fk_paiement = p.rowid";
@@ -97,41 +108,62 @@  discard block
 block discarded – undo
97 108
 	}
98 109
 	if (in_array('nodeposit', $filter))
99 110
 	{
100
-		if (empty($sqlwhere)) $sqlwhere = ' WHERE ';
101
-		else $sqlwhere .= " AND";
111
+		if (empty($sqlwhere)) {
112
+			$sqlwhere = ' WHERE ';
113
+		} else {
114
+			$sqlwhere .= " AND";
115
+		}
102 116
 		$sqlwhere .= ' type <> 3';
103 117
 	}
104 118
 	if (in_array('noreplacement', $filter))
105 119
 	{
106
-		if (empty($sqlwhere)) $sqlwhere = ' WHERE ';
107
-		else $sqlwhere .= " AND";
120
+		if (empty($sqlwhere)) {
121
+			$sqlwhere = ' WHERE ';
122
+		} else {
123
+			$sqlwhere .= " AND";
124
+		}
108 125
 		$sqlwhere .= ' type <> 1';
109 126
 	}
110 127
 	if (in_array('nocreditnote', $filter))
111 128
 	{
112
-		if (empty($sqlwhere)) $sqlwhere = ' WHERE ';
113
-		else $sqlwhere .= " AND";
129
+		if (empty($sqlwhere)) {
130
+			$sqlwhere = ' WHERE ';
131
+		} else {
132
+			$sqlwhere .= " AND";
133
+		}
114 134
 		$sqlwhere .= ' type <> 2';
115 135
 	}
116 136
 	if (in_array('excludethirdparties', $filter) && is_array($thirdpartiesid))
117 137
 	{
118
-		if (empty($sqlwhere)) $sqlwhere = ' WHERE ';
119
-		else $sqlwhere .= " AND";
138
+		if (empty($sqlwhere)) {
139
+			$sqlwhere = ' WHERE ';
140
+		} else {
141
+			$sqlwhere .= " AND";
142
+		}
120 143
 		$sqlwhere .= ' f.fk_soc NOT IN ('.join(',', $thirdpartiesid).')';
121 144
 	}
122 145
 	if (in_array('onlythirdparties', $filter) && is_array($thirdpartiesid))
123 146
 	{
124
-		if (empty($sqlwhere)) $sqlwhere = ' WHERE ';
125
-		else $sqlwhere .= " AND";
147
+		if (empty($sqlwhere)) {
148
+			$sqlwhere = ' WHERE ';
149
+		} else {
150
+			$sqlwhere .= " AND";
151
+		}
126 152
 		$sqlwhere .= ' f.fk_soc IN ('.join(',', $thirdpartiesid).')';
127 153
 	}
128
-	if ($sqlwhere) $sql .= $sqlwhere;
129
-	if ($sqlorder) $sql .= $sqlorder;
154
+	if ($sqlwhere) {
155
+		$sql .= $sqlwhere;
156
+	}
157
+	if ($sqlorder) {
158
+		$sql .= $sqlorder;
159
+	}
130 160
 
131 161
 	//print $sql; exit;
132 162
 	dol_syslog("scripts/invoices/rebuild_merge.php:", LOG_DEBUG);
133 163
 
134
-	if ($usestdout) print '--- start'."\n";
164
+	if ($usestdout) {
165
+		print '--- start'."\n";
166
+	}
135 167
 
136 168
 	// Start of transaction
137 169
 	//$db->begin();
@@ -174,10 +206,14 @@  discard block
 block discarded – undo
174 206
 					$filename = $conf->facture->dir_output.'/'.$fac->ref.'/'.$fac->ref.'.pdf';
175 207
 					if ($regenerate || !dol_is_file($filename))
176 208
 					{
177
-						if ($usestdout) print "Build PDF for invoice ".$obj->ref." - Lang = ".$outputlangs->defaultlang."\n";
209
+						if ($usestdout) {
210
+							print "Build PDF for invoice ".$obj->ref." - Lang = ".$outputlangs->defaultlang."\n";
211
+						}
178 212
 						$result = $fac->generateDocument($regenerate ? $regenerate : $fac->modelpdf, $outputlangs);
179 213
 					} else {
180
-						if ($usestdout) print "PDF for invoice ".$obj->ref." already exists\n";
214
+						if ($usestdout) {
215
+							print "PDF for invoice ".$obj->ref." already exists\n";
216
+						}
181 217
 					}
182 218
 
183 219
 					// Add file into files array
@@ -187,8 +223,11 @@  discard block
 block discarded – undo
187 223
 				if ($result <= 0)
188 224
 				{
189 225
 					$error++;
190
-					if ($usestdout) print "Error: Failed to build PDF for invoice ".($fac->ref ? $fac->ref : ' id '.$obj->rowid)."\n";
191
-					else dol_syslog("Failed to build PDF for invoice ".($fac->ref ? $fac->ref : ' id '.$obj->rowid), LOG_ERR);
226
+					if ($usestdout) {
227
+						print "Error: Failed to build PDF for invoice ".($fac->ref ? $fac->ref : ' id '.$obj->rowid)."\n";
228
+					} else {
229
+						dol_syslog("Failed to build PDF for invoice ".($fac->ref ? $fac->ref : ' id '.$obj->rowid), LOG_ERR);
230
+					}
192 231
 				}
193 232
 
194 233
 				$cpt++;
@@ -201,8 +240,11 @@  discard block
 block discarded – undo
201 240
 			$page_hauteur = $formatarray['height'];
202 241
 			$format = array($page_largeur, $page_hauteur);
203 242
 
204
-			if ($usestdout) print "Using output PDF format ".join('x', $format)."\n";
205
-			else dol_syslog("Using output PDF format ".join('x', $format), LOG_ERR);
243
+			if ($usestdout) {
244
+				print "Using output PDF format ".join('x', $format)."\n";
245
+			} else {
246
+				dol_syslog("Using output PDF format ".join('x', $format), LOG_ERR);
247
+			}
206 248
 
207 249
 
208 250
 			// Now, build a merged files with all files in $files array
@@ -217,14 +259,19 @@  discard block
 block discarded – undo
217 259
 			}
218 260
 			$pdf->SetFont(pdf_getPDFFont($langs));
219 261
 
220
-			if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false);
262
+			if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) {
263
+				$pdf->SetCompression(false);
264
+			}
221 265
 			//$pdf->SetCompression(false);
222 266
 
223 267
 			// Add all others
224 268
 			foreach ($files as $file)
225 269
 			{
226
-				if ($usestdout) print "Merge PDF file for invoice ".$file."\n";
227
-				else dol_syslog("Merge PDF file for invoice ".$file);
270
+				if ($usestdout) {
271
+					print "Merge PDF file for invoice ".$file."\n";
272
+				} else {
273
+					dol_syslog("Merge PDF file for invoice ".$file);
274
+				}
228 275
 
229 276
 				// Charge un document PDF depuis un fichier.
230 277
 				$pagecount = $pdf->setSourceFile($file);
@@ -242,27 +289,38 @@  discard block
 block discarded – undo
242 289
 
243 290
 			// Save merged file
244 291
 			$filename = $fileprefix;
245
-			if (empty($filename)) $filename = 'mergedpdf';
246
-			if (!empty($filesuffix)) $filename .= '_'.$filesuffix;
292
+			if (empty($filename)) {
293
+				$filename = 'mergedpdf';
294
+			}
295
+			if (!empty($filesuffix)) {
296
+				$filename .= '_'.$filesuffix;
297
+			}
247 298
 			$file = $diroutputpdf.'/'.$filename.'.pdf';
248 299
 
249 300
 			if (!$error && $pagecount)
250 301
 			{
251 302
 				$pdf->Output($file, 'F');
252
-				if (!empty($conf->global->MAIN_UMASK))
253
-					@chmod($file, octdec($conf->global->MAIN_UMASK));
303
+				if (!empty($conf->global->MAIN_UMASK)) {
304
+									@chmod($file, octdec($conf->global->MAIN_UMASK));
305
+				}
254 306
 			}
255 307
 
256 308
 			if ($usestdout)
257 309
 			{
258
-				if (!$error) print "Merged PDF has been built in ".$file."\n";
259
-				else print "Can't build PDF ".$file."\n";
310
+				if (!$error) {
311
+					print "Merged PDF has been built in ".$file."\n";
312
+				} else {
313
+					print "Can't build PDF ".$file."\n";
314
+				}
260 315
 			}
261 316
 
262 317
 			$result = 1;
263 318
 		} else {
264
-			if ($usestdout) print "No invoices found for criteria.\n";
265
-			else dol_syslog("No invoices found for criteria");
319
+			if ($usestdout) {
320
+				print "No invoices found for criteria.\n";
321
+			} else {
322
+				dol_syslog("No invoices found for criteria");
323
+			}
266 324
 			$result = 0;
267 325
 		}
268 326
 	} else {
@@ -271,6 +329,9 @@  discard block
 block discarded – undo
271 329
 		$error++;
272 330
 	}
273 331
 
274
-	if ($error) return -1;
275
-	else return $result;
276
-}
332
+	if ($error) {
333
+		return -1;
334
+	} else {
335
+		return $result;
336
+	}
337
+	}
Please login to merge, or discard this patch.
htdocs/core/search_page.php 1 patch
Braces   +19 added lines, -6 removed lines patch added patch discarded remove patch
@@ -27,15 +27,24 @@  discard block
 block discarded – undo
27 27
 //if (! defined('NOREQUIREDB'))   define('NOREQUIREDB','1');		// Not disabled cause need to load personalized language
28 28
 //if (! defined('NOREQUIRESOC'))    define('NOREQUIRESOC','1');
29 29
 //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');		// Not disabled cause need to do translations
30
-if (!defined('NOCSRFCHECK'))     define('NOCSRFCHECK', 1);
31
-if (!defined('NOTOKENRENEWAL'))  define('NOTOKENRENEWAL', 1);
30
+if (!defined('NOCSRFCHECK')) {
31
+	define('NOCSRFCHECK', 1);
32
+}
33
+if (!defined('NOTOKENRENEWAL')) {
34
+	define('NOTOKENRENEWAL', 1);
35
+}
32 36
 //if (! defined('NOLOGIN')) define('NOLOGIN',1);					// Not disabled cause need to load personalized language
33
-if (!defined('NOREQUIREMENU'))  define('NOREQUIREMENU', 1);
37
+if (!defined('NOREQUIREMENU')) {
38
+	define('NOREQUIREMENU', 1);
39
+}
34 40
 //if (! defined('NOREQUIREHTML'))  define('NOREQUIREHTML',1);
35 41
 
36 42
 require_once '../main.inc.php';
37 43
 
38
-if (GETPOST('lang', 'aZ09')) $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL by the main.inc.php
44
+if (GETPOST('lang', 'aZ09')) {
45
+	$langs->setDefaultLang(GETPOST('lang', 'aZ09'));
46
+}
47
+// If language was forced on URL by the main.inc.php
39 48
 
40 49
 $langs->load("main");
41 50
 
@@ -69,9 +78,11 @@  discard block
 block discarded – undo
69 78
 // Define $searchform
70 79
 $searchform = '';
71 80
 
72
-if ($conf->use_javascript_ajax && 1 == 2)   // select2 is ko with jmobile
81
+if ($conf->use_javascript_ajax && 1 == 2) {
82
+	// select2 is ko with jmobile
73 83
 {
74 84
 	if (!is_object($form)) $form = new Form($db);
85
+}
75 86
 	$selected = -1;
76 87
 	$searchform .= '<br><br>'.$form->selectArrayAjax('searchselectcombo', DOL_URL_ROOT.'/core/ajax/selectsearchbox.php', $selected, '', '', 0, 1, 'minwidth300', 1, $langs->trans("Search"), 0);
77 88
 } else {
@@ -105,7 +116,9 @@  discard block
 block discarded – undo
105 116
 if (empty($reshook))
106 117
 {
107 118
 	$searchform .= $hookmanager->resPrint;
108
-} else $searchform = $hookmanager->resPrint;
119
+} else {
120
+	$searchform = $hookmanager->resPrint;
121
+}
109 122
 
110 123
 
111 124
 print "\n";
Please login to merge, or discard this patch.
htdocs/core/filemanagerdol/connectors/php/commands.php 1 patch
Braces   +34 added lines, -19 removed lines patch added patch discarded remove patch
@@ -43,8 +43,9 @@  discard block
 block discarded – undo
43 43
 	{
44 44
 		while ($sFile = readdir($oCurrentFolder))
45 45
 		{
46
-			if ($sFile != '.' && $sFile != '..' && is_dir($sServerDir.$sFile))
47
-				$aFolders[] = '<Folder name="'.ConvertToXmlAttribute($sFile).'" />';
46
+			if ($sFile != '.' && $sFile != '..' && is_dir($sServerDir.$sFile)) {
47
+							$aFolders[] = '<Folder name="'.ConvertToXmlAttribute($sFile).'" />';
48
+			}
48 49
 		}
49 50
 		closedir($oCurrentFolder);
50 51
 	}
@@ -53,8 +54,9 @@  discard block
 block discarded – undo
53 54
 	echo "<Folders>";
54 55
 
55 56
 	natcasesort($aFolders);
56
-	foreach ($aFolders as $sFolder)
57
-		echo $sFolder;
57
+	foreach ($aFolders as $sFolder) {
58
+			echo $sFolder;
59
+	}
58 60
 
59 61
 	// Close the "Folders" node.
60 62
 	echo "</Folders>";
@@ -84,9 +86,9 @@  discard block
 block discarded – undo
84 86
 		{
85 87
 			if ($sFile != '.' && $sFile != '..')
86 88
 			{
87
-				if (is_dir($sServerDir.$sFile))
88
-					$aFolders[] = '<Folder name="'.ConvertToXmlAttribute($sFile).'" />';
89
-				else {
89
+				if (is_dir($sServerDir.$sFile)) {
90
+									$aFolders[] = '<Folder name="'.ConvertToXmlAttribute($sFile).'" />';
91
+				} else {
90 92
 					$iFileSize = @filesize($sServerDir.$sFile);
91 93
 					if (!$iFileSize) {
92 94
 						$iFileSize = 0;
@@ -94,8 +96,9 @@  discard block
 block discarded – undo
94 96
 					if ($iFileSize > 0)
95 97
 					{
96 98
 						$iFileSize = round($iFileSize / 1024);
97
-						if ($iFileSize < 1)
98
-							$iFileSize = 1;
99
+						if ($iFileSize < 1) {
100
+													$iFileSize = 1;
101
+						}
99 102
 					}
100 103
 
101 104
 					$aFiles[] = '<File name="'.ConvertToXmlAttribute($sFile).'" size="'.$iFileSize.'" />';
@@ -109,8 +112,9 @@  discard block
 block discarded – undo
109 112
 	natcasesort($aFolders);
110 113
 	echo '<Folders>';
111 114
 
112
-	foreach ($aFolders as $sFolder)
113
-		echo $sFolder;
115
+	foreach ($aFolders as $sFolder) {
116
+			echo $sFolder;
117
+	}
114 118
 
115 119
 	echo '</Folders>';
116 120
 
@@ -118,8 +122,9 @@  discard block
 block discarded – undo
118 122
 	natcasesort($aFiles);
119 123
 	echo '<Files>';
120 124
 
121
-	foreach ($aFiles as $sFiles)
122
-		echo $sFiles;
125
+	foreach ($aFiles as $sFiles) {
126
+			echo $sFiles;
127
+	}
123 128
 
124 129
 	echo '</Files>';
125 130
 }
@@ -144,8 +149,10 @@  discard block
 block discarded – undo
144 149
 		$sNewFolderName = $_GET['NewFolderName'];
145 150
 		$sNewFolderName = SanitizeFolderName($sNewFolderName);
146 151
 
147
-		if (strpos($sNewFolderName, '..') !== false)
148
-			$sErrorNumber = '102'; // Invalid folder name.
152
+		if (strpos($sNewFolderName, '..') !== false) {
153
+					$sErrorNumber = '102';
154
+		}
155
+		// Invalid folder name.
149 156
 		else {
150 157
 			// Map the virtual path to the local server path of the current folder.
151 158
 			$sServerDir = ServerMapFolder($resourceType, $currentFolder, 'CreateFolder');
@@ -169,9 +176,13 @@  discard block
 block discarded – undo
169 176
 						$sErrorNumber = '110';
170 177
 						break;
171 178
 				}
172
-			} else $sErrorNumber = '103';
179
+			} else {
180
+				$sErrorNumber = '103';
181
+			}
173 182
 		}
174
-	} else $sErrorNumber = '102';
183
+	} else {
184
+		$sErrorNumber = '102';
185
+	}
175 186
 
176 187
 	// Create the "Error" node.
177 188
 	echo '<Error number="'.$sErrorNumber.'" />';
@@ -287,8 +298,12 @@  discard block
 block discarded – undo
287 298
 					$sErrorNumber = '202';
288 299
 				}
289 300
 			}
290
-		} else $sErrorNumber = '202';
291
-	} else $sErrorNumber = '202';
301
+		} else {
302
+			$sErrorNumber = '202';
303
+		}
304
+	} else {
305
+		$sErrorNumber = '202';
306
+	}
292 307
 
293 308
 
294 309
 	$sFileUrl = CombinePaths(GetResourceTypePath($resourceType, $sCommand), $currentFolder);
Please login to merge, or discard this patch.
htdocs/core/filemanagerdol/connectors/php/basexml.php 1 patch
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -90,8 +90,9 @@  discard block
 block discarded – undo
90 90
  */
91 91
 function SendError($number, $text)
92 92
 {
93
-	if ($_GET['Command'] == 'FileUpload')
94
-		SendUploadResults($number, "", "", $text);
93
+	if ($_GET['Command'] == 'FileUpload') {
94
+			SendUploadResults($number, "", "", $text);
95
+	}
95 96
 
96 97
 	if (isset($GLOBALS['HeaderSent']) && $GLOBALS['HeaderSent'])
97 98
 	{
@@ -123,7 +124,9 @@  discard block
 block discarded – undo
123 124
  */
124 125
 function SendErrorNode($number, $text)
125 126
 {
126
-	if ($text)
127
-		echo '<Error number="'.$number.'" text="'.htmlspecialchars($text).'" />';
128
-	else echo '<Error number="'.$number.'" />';
129
-}
127
+	if ($text) {
128
+			echo '<Error number="'.$number.'" text="'.htmlspecialchars($text).'" />';
129
+	} else {
130
+		echo '<Error number="'.$number.'" />';
131
+	}
132
+	}
Please login to merge, or discard this patch.