Passed
Branch develop (66e4de)
by Laurent
33:03
created
htdocs/core/lib/report.lib.php 1 patch
Braces   +21 added lines, -7 removed lines patch added patch discarded remove patch
@@ -44,7 +44,9 @@  discard block
 block discarded – undo
44 44
 
45 45
 	print "\n\n<!-- start banner of report -->\n";
46 46
 
47
-	if (!empty($varlink)) $varlink = '?'.$varlink;
47
+	if (!empty($varlink)) {
48
+		$varlink = '?'.$varlink;
49
+	}
48 50
 
49 51
 	$head = array();
50 52
 
@@ -73,7 +75,9 @@  discard block
 block discarded – undo
73 75
 	print '<td>';
74 76
 	print $reportname;
75 77
 	print '</td>';
76
-	if ($variante) print '<td></td>';
78
+	if ($variante) {
79
+		print '<td></td>';
80
+	}
77 81
 	print '</tr>'."\n";
78 82
 
79 83
 	// Calculation mode
@@ -83,7 +87,9 @@  discard block
 block discarded – undo
83 87
 		print '<td width="150">'.$langs->trans("CalculationMode").'</td>';
84 88
 		print '<td>';
85 89
 		print $calcmode;
86
-		if ($variante) print '<td></td>';
90
+		if ($variante) {
91
+			print '<td></td>';
92
+		}
87 93
 		print '</td>';
88 94
 		print '</tr>'."\n";
89 95
 	}
@@ -92,8 +98,12 @@  discard block
 block discarded – undo
92 98
 	print '<tr>';
93 99
 	print '<td>'.$langs->trans("ReportPeriod").'</td>';
94 100
 	print '<td>';
95
-	if ($period) print $period;
96
-	if ($variante) print '<td class="nowraponall">'.$periodlink.'</td>';
101
+	if ($period) {
102
+		print $period;
103
+	}
104
+	if ($variante) {
105
+		print '<td class="nowraponall">'.$periodlink.'</td>';
106
+	}
97 107
 	print '</td>';
98 108
 	print '</tr>'."\n";
99 109
 
@@ -101,7 +111,9 @@  discard block
 block discarded – undo
101 111
 	print '<tr>';
102 112
 	print '<td>'.$langs->trans("ReportDescription").'</td>';
103 113
 	print '<td>'.$description.'</td>';
104
-	if ($variante) print '<td></td>';
114
+	if ($variante) {
115
+		print '<td></td>';
116
+	}
105 117
 	print '</tr>'."\n";
106 118
 
107 119
 	// Ligne d'export
@@ -110,7 +122,9 @@  discard block
 block discarded – undo
110 122
 	print '<td>';
111 123
 	print dol_print_date($builddate, 'dayhour');
112 124
 	print '</td>';
113
-	if ($variante) print '<td>'.($exportlink ? $langs->trans("Export").': '.$exportlink : '').'</td>';
125
+	if ($variante) {
126
+		print '<td>'.($exportlink ? $langs->trans("Export").': '.$exportlink : '').'</td>';
127
+	}
114 128
 	print '</tr>'."\n";
115 129
 
116 130
 	print '</table>'."\n";
Please login to merge, or discard this patch.
htdocs/theme/md/btn.inc.php 1 patch
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,8 @@
 block discarded – undo
1 1
 <?php
2
-if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
2
+if (!defined('ISLOADEDBYSTEELSHEET')) {
3
+	die('Must be call by steelsheet');
4
+}
5
+?>
3 6
 /* <style type="text/css" > */
4 7
 
5 8
 :root {
Please login to merge, or discard this patch.
htdocs/theme/md/badges.inc.php 1 patch
Braces   +10 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,5 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
2
+if (!defined('ISLOADEDBYSTEELSHEET')) {
3
+	die('Must be call by steelsheet');
4
+}
5
+?>
3 6
 /* <style type="text/css" > */
4 7
 /*
5 8
  Badge style is based on boostrap framework
@@ -231,8 +234,12 @@  discard block
 block discarded – undo
231 234
 			$thisBadgeBackgroundColor = "#fff";
232 235
 		}
233 236
 
234
-		if (in_array((string) $statusName, array('0', '5', '9'))) $thisBadgeTextColor = '#999999';
235
-		if (in_array((string) $statusName, array('6'))) $thisBadgeTextColor = '#777777';
237
+		if (in_array((string) $statusName, array('0', '5', '9'))) {
238
+			$thisBadgeTextColor = '#999999';
239
+		}
240
+		if (in_array((string) $statusName, array('6'))) {
241
+			$thisBadgeTextColor = '#777777';
242
+		}
236 243
 		
237 244
 		print $cssPrefix.".badge-status".$statusName." {\n";
238 245
 		print "        color: ".$thisBadgeTextColor." !important;\n";
Please login to merge, or discard this patch.
htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php 1 patch
Braces   +30 added lines, -12 removed lines patch added patch discarded remove patch
@@ -95,7 +95,10 @@  discard block
 block discarded – undo
95 95
 
96 96
 		// Recupere emetteur
97 97
 		$this->emetteur = $mysoc;
98
-		if (!$this->emetteur->country_code) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined
98
+		if (!$this->emetteur->country_code) {
99
+			$this->emetteur->country_code = substr($langs->defaultlang, -2);
100
+		}
101
+		// By default if not defined
99 102
 	}
100 103
 
101 104
 
@@ -133,10 +136,13 @@  discard block
 block discarded – undo
133 136
 			if (!$tmpdir) {
134 137
 				unset($listofdir[$key]); continue;
135 138
 			}
136
-			if (!is_dir($tmpdir)) $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0);
137
-			else {
139
+			if (!is_dir($tmpdir)) {
140
+				$texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0);
141
+			} else {
138 142
 				$tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\.(ods|odt)');
139
-				if (count($tmpfiles)) $listoffiles = array_merge($listoffiles, $tmpfiles);
143
+				if (count($tmpfiles)) {
144
+					$listoffiles = array_merge($listoffiles, $tmpfiles);
145
+				}
140 146
 			}
141 147
 		}
142 148
 		$texthelp = $langs->trans("ListOfDirectoriesForModelGenODT");
@@ -224,7 +230,9 @@  discard block
 block discarded – undo
224 230
 		$hookmanager->initHooks(array('odtgeneration'));
225 231
 		global $action;
226 232
 
227
-		if (!is_object($outputlangs)) $outputlangs = $langs;
233
+		if (!is_object($outputlangs)) {
234
+			$outputlangs = $langs;
235
+		}
228 236
 		$sav_charset_output = $outputlangs->charset_output;
229 237
 		$outputlangs->charset_output = 'UTF-8';
230 238
 
@@ -252,7 +260,9 @@  discard block
 block discarded – undo
252 260
 
253 261
 			$dir = $conf->product->dir_output;
254 262
 			$objectref = dol_sanitizeFileName($object->ref);
255
-			if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref;
263
+			if (!preg_match('/specimen/i', $objectref)) {
264
+				$dir .= "/".$objectref;
265
+			}
256 266
 			$file = $dir."/".$objectref.".odt";
257 267
 
258 268
 			if (!file_exists($dir))
@@ -279,7 +289,9 @@  discard block
 block discarded – undo
279 289
 				if (!empty($conf->global->MAIN_DOC_USE_TIMING))
280 290
 				{
281 291
 					$format = $conf->global->MAIN_DOC_USE_TIMING;
282
-					if ($format == '1') $format = '%Y%m%d%H%M%S';
292
+					if ($format == '1') {
293
+						$format = '%Y%m%d%H%M%S';
294
+					}
283 295
 					$filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat;
284 296
 				} else {
285 297
 					$filename = $newfiletmp.'.'.$newfileformat;
@@ -382,7 +394,9 @@  discard block
 block discarded – undo
382 394
 				$array_other = $this->get_substitutionarray_other($outputlangs);
383 395
 				// retrieve contact information for use in stock as contact_xxx tags
384 396
 				$array_thirdparty_contact = array();
385
-				if ($usecontact && is_object($contactobject)) $array_thirdparty_contact = $this->get_substitutionarray_contact($contactobject, $outputlangs, 'contact');
397
+				if ($usecontact && is_object($contactobject)) {
398
+					$array_thirdparty_contact = $this->get_substitutionarray_contact($contactobject, $outputlangs, 'contact');
399
+				}
386 400
 
387 401
 				$tmparray = array_merge($substitutionarray, $array_object_from_properties, $array_user, $array_soc, $array_thirdparty, $array_other, $array_thirdparty_contact);
388 402
 				complete_substitutions_array($tmparray, $outputlangs, $object);
@@ -394,10 +408,13 @@  discard block
 block discarded – undo
394 408
 				foreach ($tmparray as $key=>$value)
395 409
 				{
396 410
 					try {
397
-						if (preg_match('/logo$/', $key)) // Image
411
+						if (preg_match('/logo$/', $key)) {
412
+							// Image
398 413
 						{
399 414
 							if (file_exists($value)) $odfHandler->setImage($key, $value);
400
-							else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
415
+						} else {
416
+								$odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
417
+							}
401 418
 						} else // Text
402 419
 						{
403 420
 							$odfHandler->setVars($key, $value, true, 'UTF-8');
@@ -478,8 +495,9 @@  discard block
 block discarded – undo
478 495
 
479 496
 				$reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
480 497
 
481
-				if (!empty($conf->global->MAIN_UMASK))
482
-					@chmod($file, octdec($conf->global->MAIN_UMASK));
498
+				if (!empty($conf->global->MAIN_UMASK)) {
499
+									@chmod($file, octdec($conf->global->MAIN_UMASK));
500
+				}
483 501
 
484 502
 				$odfHandler = null; // Destroy object
485 503
 
Please login to merge, or discard this patch.
htdocs/core/modules/reception/doc/pdf_squille.modules.php 1 patch
Braces   +125 added lines, -45 removed lines patch added patch discarded remove patch
@@ -62,7 +62,10 @@  discard block
 block discarded – undo
62 62
 
63 63
 		// Get source company
64 64
 		$this->emetteur = $mysoc;
65
-		if (!$this->emetteur->country_code) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined
65
+		if (!$this->emetteur->country_code) {
66
+			$this->emetteur->country_code = substr($langs->defaultlang, -2);
67
+		}
68
+		// By default if not defined
66 69
 
67 70
 		// Define position of columns
68 71
 		$this->posxdesc = $this->marge_gauche + 1;
@@ -81,9 +84,11 @@  discard block
 block discarded – undo
81 84
 
82 85
 		$this->posxpicture = $this->posxweightvol - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images
83 86
 
84
-		if ($this->page_largeur < 210) // To work with US executive format
87
+		if ($this->page_largeur < 210) {
88
+			// To work with US executive format
85 89
 		{
86 90
 			$this->posxweightvol -= 20;
91
+		}
87 92
 			$this->posxpicture -= 20;
88 93
 			$this->posxqtyordered -= 20;
89 94
 			$this->posxqtytoship -= 20;
@@ -116,9 +121,13 @@  discard block
 block discarded – undo
116 121
 
117 122
 		$object->fetch_thirdparty();
118 123
 
119
-		if (!is_object($outputlangs)) $outputlangs = $langs;
124
+		if (!is_object($outputlangs)) {
125
+			$outputlangs = $langs;
126
+		}
120 127
 		// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
121
-		if (!empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output = 'ISO-8859-1';
128
+		if (!empty($conf->global->MAIN_USE_FPDF)) {
129
+			$outputlangs->charset_output = 'ISO-8859-1';
130
+		}
122 131
 
123 132
 		$outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products", "propal", "deliveries", "receptions", "productbatch", "sendings"));
124 133
 
@@ -132,7 +141,9 @@  discard block
 block discarded – undo
132 141
 
133 142
 			for ($i = 0; $i < $nblines; $i++)
134 143
 			{
135
-				if (empty($object->lines[$i]->fk_product)) continue;
144
+				if (empty($object->lines[$i]->fk_product)) {
145
+					continue;
146
+				}
136 147
 
137 148
 				$objphoto = new Product($this->db);
138 149
 				$objphoto->fetch($object->lines[$i]->fk_product);
@@ -159,11 +170,15 @@  discard block
 block discarded – undo
159 170
 					break;
160 171
 				}
161 172
 
162
-				if ($realpath) $realpatharray[$i] = $realpath;
173
+				if ($realpath) {
174
+					$realpatharray[$i] = $realpath;
175
+				}
163 176
 			}
164 177
 		}
165 178
 
166
-		if (count($realpatharray) == 0) $this->posxpicture = $this->posxweightvol;
179
+		if (count($realpatharray) == 0) {
180
+			$this->posxpicture = $this->posxweightvol;
181
+		}
167 182
 
168 183
 		if ($conf->reception->dir_output)
169 184
 		{
@@ -227,20 +242,26 @@  discard block
 block discarded – undo
227 242
 				$pagenb = 0;
228 243
 				$pdf->SetDrawColor(128, 128, 128);
229 244
 
230
-				if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages();
245
+				if (method_exists($pdf, 'AliasNbPages')) {
246
+					$pdf->AliasNbPages();
247
+				}
231 248
 
232 249
 				$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
233 250
 				$pdf->SetSubject($outputlangs->transnoentities("Reception"));
234 251
 				$pdf->SetCreator("Dolibarr ".DOL_VERSION);
235 252
 				$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
236 253
 				$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Reception"));
237
-				if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
254
+				if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) {
255
+					$pdf->SetCompression(false);
256
+				}
238 257
 
239 258
 				$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
240 259
 
241 260
 				// New page
242 261
 				$pdf->AddPage();
243
-				if (!empty($tplidx)) $pdf->useTemplate($tplidx);
262
+				if (!empty($tplidx)) {
263
+					$pdf->useTemplate($tplidx);
264
+				}
244 265
 				$pagenb++;
245 266
 				$this->_pagehead($pdf, $object, 1, $outputlangs);
246 267
 				$pdf->SetFont('', '', $default_font_size - 1);
@@ -297,7 +318,9 @@  discard block
 block discarded – undo
297 318
 								// Get code using getLabelFromKey
298 319
 								$code = $outputlangs->getLabelFromKey($this->db, $object->shipment_method_id, 'c_shipment_mode', 'rowid', 'code');
299 320
 								$label = '';
300
-								if ($object->tracking_url != $object->tracking_number) $label .= $outputlangs->trans("LinkToTrackYourPackage")."<br>";
321
+								if ($object->tracking_url != $object->tracking_number) {
322
+									$label .= $outputlangs->trans("LinkToTrackYourPackage")."<br>";
323
+								}
301 324
 								$label .= $outputlangs->trans("ReceptionMethod").": ".$outputlangs->trans("ReceptionMethod".strtoupper($code));
302 325
 								//var_dump($object->tracking_url != $object->tracking_number);exit;
303 326
 								if ($object->tracking_url != $object->tracking_number)
@@ -347,7 +370,9 @@  discard block
 block discarded – undo
347 370
 
348 371
 					// Define size of image if we need it
349 372
 					$imglinesize = array();
350
-					if (!empty($realpatharray[$i])) $imglinesize = pdf_getSizeForImage($realpatharray[$i]);
373
+					if (!empty($realpatharray[$i])) {
374
+						$imglinesize = pdf_getSizeForImage($realpatharray[$i]);
375
+					}
351 376
 
352 377
 					$pdf->setTopMargin($tab_top_newpage);
353 378
 					$pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it.
@@ -358,19 +383,27 @@  discard block
 block discarded – undo
358 383
 					$posYAfterDescription = 0;
359 384
 
360 385
 					// We start with Photo of product line
361
-					if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot)))	// If photo too high, we moved completely on new page
386
+					if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
387
+						// If photo too high, we moved completely on new page
362 388
 					{
363 389
 						$pdf->AddPage('', '', true);
364
-						if (!empty($tplidx)) $pdf->useTemplate($tplidx);
365
-						if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
390
+					}
391
+						if (!empty($tplidx)) {
392
+							$pdf->useTemplate($tplidx);
393
+						}
394
+						if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
395
+							$this->_pagehead($pdf, $object, 0, $outputlangs);
396
+						}
366 397
 						$pdf->setPage($pageposbefore + 1);
367 398
 
368 399
 						$curY = $tab_top_newpage;
369 400
 
370 401
 						// Allows data in the first page if description is long enough to break in multiples pages
371
-						if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
372
-							$showpricebeforepagebreak = 1;
373
-						else $showpricebeforepagebreak = 0;
402
+						if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) {
403
+													$showpricebeforepagebreak = 1;
404
+						} else {
405
+							$showpricebeforepagebreak = 0;
406
+						}
374 407
 					}
375 408
 
376 409
 					if (isset($imglinesize['width']) && isset($imglinesize['height']))
@@ -388,9 +421,11 @@  discard block
 block discarded – undo
388 421
 					pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->posxpicture - $curX, 3, $curX, $curY, $hideref, $hidedesc);
389 422
 
390 423
 					$pageposafter = $pdf->getPage();
391
-					if ($pageposafter > $pageposbefore)	// There is a pagebreak
424
+					if ($pageposafter > $pageposbefore) {
425
+						// There is a pagebreak
392 426
 					{
393 427
 						$pdf->rollbackTransaction(true);
428
+					}
394 429
 						$pageposafter = $pageposbefore;
395 430
 						//print $pageposafter.'-'.$pageposbefore;exit;
396 431
 						$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
@@ -400,22 +435,30 @@  discard block
 block discarded – undo
400 435
 						$pageposafter = $pdf->getPage();
401 436
 						$posyafter = $pdf->GetY();
402 437
 						//var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit;
403
-						if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot)))	// There is no space left for total+free text
438
+						if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
439
+							// There is no space left for total+free text
404 440
 						{
405 441
 							if ($i == ($nblines - 1))	// No more lines, and no space left to show total, so we create a new page
406 442
 							{
407 443
 								$pdf->AddPage('', '', true);
408
-								if (!empty($tplidx)) $pdf->useTemplate($tplidx);
409
-								if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
444
+						}
445
+								if (!empty($tplidx)) {
446
+									$pdf->useTemplate($tplidx);
447
+								}
448
+								if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
449
+									$this->_pagehead($pdf, $object, 0, $outputlangs);
450
+								}
410 451
 								$pdf->setPage($pageposafter + 1);
411 452
 							}
412 453
 						} else {
413 454
 							// We found a page break
414 455
 
415 456
 							// Allows data in the first page if description is long enough to break in multiples pages
416
-							if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
417
-								$showpricebeforepagebreak = 1;
418
-							else $showpricebeforepagebreak = 0;
457
+							if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) {
458
+															$showpricebeforepagebreak = 1;
459
+							} else {
460
+								$showpricebeforepagebreak = 0;
461
+							}
419 462
 						}
420 463
 					} else // No pagebreak
421 464
 					{
@@ -479,7 +522,9 @@  discard block
 block discarded – undo
479 522
 					}
480 523
 
481 524
 					$nexY += 3;
482
-					if ($weighttxt && $voltxt) $nexY += 2;
525
+					if ($weighttxt && $voltxt) {
526
+						$nexY += 2;
527
+					}
483 528
 
484 529
 					// Add line
485 530
 					if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1))
@@ -517,7 +562,9 @@  discard block
 block discarded – undo
517 562
 						$this->_pagefoot($pdf, $object, $outputlangs, 1);
518 563
 						// New page
519 564
 						$pdf->AddPage();
520
-						if (!empty($tplidx)) $pdf->useTemplate($tplidx);
565
+						if (!empty($tplidx)) {
566
+							$pdf->useTemplate($tplidx);
567
+						}
521 568
 						$pagenb++;
522 569
 					}
523 570
 				}
@@ -537,7 +584,9 @@  discard block
 block discarded – undo
537 584
 
538 585
 				// Pied de page
539 586
 				$this->_pagefoot($pdf, $object, $outputlangs);
540
-				if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages();
587
+				if (method_exists($pdf, 'AliasNbPages')) {
588
+					$pdf->AliasNbPages();
589
+				}
541 590
 
542 591
 				$pdf->Close();
543 592
 
@@ -554,8 +603,9 @@  discard block
 block discarded – undo
554 603
 					$this->errors = $hookmanager->errors;
555 604
 				}
556 605
 
557
-				if (!empty($conf->global->MAIN_UMASK))
558
-				@chmod($file, octdec($conf->global->MAIN_UMASK));
606
+				if (!empty($conf->global->MAIN_UMASK)) {
607
+								@chmod($file, octdec($conf->global->MAIN_UMASK));
608
+				}
559 609
 
560 610
 				return 1; // No error
561 611
 			} else {
@@ -600,8 +650,11 @@  discard block
 block discarded – undo
600 650
 		{
601 651
 			$col2x-=20;
602 652
 		}*/
603
-		if (empty($conf->global->RECEPTION_PDF_HIDE_ORDERED)) $largcol2 = ($this->posxqtyordered - $this->posxweightvol);
604
-		else $largcol2 = ($this->posxqtytoship - $this->posxweightvol);
653
+		if (empty($conf->global->RECEPTION_PDF_HIDE_ORDERED)) {
654
+			$largcol2 = ($this->posxqtyordered - $this->posxweightvol);
655
+		} else {
656
+			$largcol2 = ($this->posxqtytoship - $this->posxweightvol);
657
+		}
605 658
 
606 659
 		$useborder = 0;
607 660
 		$index = 0;
@@ -623,10 +676,18 @@  discard block
 block discarded – undo
623 676
 			$object->volume_units = $object->size_units * 3;
624 677
 		}
625 678
 
626
-		if ($totalWeight != '') $totalWeighttoshow = showDimensionInBestUnit($totalWeight, 0, "weight", $outputlangs);
627
-		if ($totalVolume != '') $totalVolumetoshow = showDimensionInBestUnit($totalVolume, 0, "volume", $outputlangs);
628
-		if ($object->trueWeight) $totalWeighttoshow = showDimensionInBestUnit($object->trueWeight, $object->weight_units, "weight", $outputlangs);
629
-		if ($object->trueVolume) $totalVolumetoshow = showDimensionInBestUnit($object->trueVolume, $object->volume_units, "volume", $outputlangs);
679
+		if ($totalWeight != '') {
680
+			$totalWeighttoshow = showDimensionInBestUnit($totalWeight, 0, "weight", $outputlangs);
681
+		}
682
+		if ($totalVolume != '') {
683
+			$totalVolumetoshow = showDimensionInBestUnit($totalVolume, 0, "volume", $outputlangs);
684
+		}
685
+		if ($object->trueWeight) {
686
+			$totalWeighttoshow = showDimensionInBestUnit($object->trueWeight, $object->weight_units, "weight", $outputlangs);
687
+		}
688
+		if ($object->trueVolume) {
689
+			$totalVolumetoshow = showDimensionInBestUnit($object->trueVolume, $object->volume_units, "volume", $outputlangs);
690
+		}
630 691
 
631 692
 		$pdf->SetFillColor(255, 255, 255);
632 693
 		$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
@@ -664,7 +725,9 @@  discard block
 block discarded – undo
664 725
 
665 726
 			$index++;
666 727
 		}
667
-		if (!$totalWeighttoshow && !$totalVolumetoshow) $index++;
728
+		if (!$totalWeighttoshow && !$totalVolumetoshow) {
729
+			$index++;
730
+		}
668 731
 
669 732
 		$pdf->SetTextColor(0, 0, 0);
670 733
 
@@ -690,7 +753,9 @@  discard block
 block discarded – undo
690 753
 
691 754
 		// Force to disable hidetop and hidebottom
692 755
 		$hidebottom = 0;
693
-		if ($hidetop) $hidetop = -1;
756
+		if ($hidetop) {
757
+			$hidetop = -1;
758
+		}
694 759
 
695 760
 		$default_font_size = pdf_getPDFFontSize($outputlangs);
696 761
 
@@ -876,9 +941,11 @@  discard block
 block discarded – undo
876 941
 		$origin_id = $object->origin_id;
877 942
 
878 943
 		// TODO move to external function
879
-		if (!empty($conf->fournisseur->enabled))     // commonly $origin='commande'
944
+		if (!empty($conf->fournisseur->enabled)) {
945
+			// commonly $origin='commande'
880 946
 		{
881 947
 			$outputlangs->load('orders');
948
+		}
882 949
 
883 950
 			$classname = 'CommandeFournisseur';
884 951
 			$linkedobject = new $classname($this->db);
@@ -889,7 +956,9 @@  discard block
 block discarded – undo
889 956
 
890 957
 				$pdf->SetFont('', '', $default_font_size - 2);
891 958
 				$text = $linkedobject->ref;
892
-				if ($linkedobject->ref_client) $text .= ' ('.$linkedobject->ref_client.')';
959
+				if ($linkedobject->ref_client) {
960
+					$text .= ' ('.$linkedobject->ref_client.')';
961
+				}
893 962
 				$Yoff = $Yoff + 8;
894 963
 				$pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff);
895 964
 				$pdf->MultiCell($w, 2, $outputlangs->transnoentities("RefOrder")." : ".$outputlangs->transnoentities($text), 0, 'R');
@@ -905,8 +974,12 @@  discard block
 block discarded – undo
905 974
 			$carac_emetteur = '';
906 975
 		 	// Add internal contact of origin element if defined
907 976
 			$arrayidcontact = array();
908
-			if (!empty($origin) && is_object($object->$origin)) $arrayidcontact = $object->$origin->getIdContact('internal', 'SALESREPFOLL');
909
-			if (empty($arrayidcontact)) $arrayidcontact = $object->$origin->getIdContact('internal', 'SHIPPING');
977
+			if (!empty($origin) && is_object($object->$origin)) {
978
+				$arrayidcontact = $object->$origin->getIdContact('internal', 'SALESREPFOLL');
979
+			}
980
+			if (empty($arrayidcontact)) {
981
+				$arrayidcontact = $object->$origin->getIdContact('internal', 'SHIPPING');
982
+			}
910 983
 		 	if (count($arrayidcontact) > 0)
911 984
 		 	{
912 985
 		 		$object->fetch_user(reset($arrayidcontact));
@@ -918,7 +991,9 @@  discard block
 block discarded – undo
918 991
 			// Show sender
919 992
 			$posy = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42;
920 993
 			$posx = $this->marge_gauche;
921
-			if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->page_largeur - $this->marge_droite - 80;
994
+			if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
995
+				$posx = $this->page_largeur - $this->marge_droite - 80;
996
+			}
922 997
 
923 998
 			$hautcadre = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 38 : 40;
924 999
 			$widthrecbox = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 82;
@@ -970,10 +1045,15 @@  discard block
 block discarded – undo
970 1045
 
971 1046
 			// Show recipient
972 1047
 			$widthrecbox = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 100;
973
-			if ($this->page_largeur < 210) $widthrecbox = 84; // To work with US executive format
1048
+			if ($this->page_largeur < 210) {
1049
+				$widthrecbox = 84;
1050
+			}
1051
+			// To work with US executive format
974 1052
 			$posy = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42;
975 1053
 			$posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
976
-			if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->marge_gauche;
1054
+			if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
1055
+				$posx = $this->marge_gauche;
1056
+			}
977 1057
 
978 1058
 			// Show recipient frame
979 1059
 			$pdf->SetTextColor(0, 0, 0);
Please login to merge, or discard this patch.
htdocs/core/modules/modRecruitment.class.php 1 patch
Braces   +7 added lines, -2 removed lines patch added patch discarded remove patch
@@ -403,7 +403,10 @@  discard block
 block discarded – undo
403 403
 		global $conf, $langs;
404 404
 
405 405
 		$result = $this->_load_tables('/recruitment/sql/');
406
-		if ($result < 0) return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
406
+		if ($result < 0) {
407
+			return -1;
408
+		}
409
+		// Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
407 410
 
408 411
 		// Create extrafields during init
409 412
 		//include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
@@ -425,7 +428,9 @@  discard block
 block discarded – undo
425 428
 		$myTmpObjects['RecruitmentJobPosition'] = array('includerefgeneration'=>1, 'includedocgeneration'=>1);
426 429
 
427 430
 		foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
428
-			if ($myTmpObjectKey == 'MyObject') continue;
431
+			if ($myTmpObjectKey == 'MyObject') {
432
+				continue;
433
+			}
429 434
 			if ($myTmpObjectArray['includerefgeneration']) {
430 435
 				$src = DOL_DOCUMENT_ROOT.'/install/doctemplates/mymodule/template_myobjects.odt';
431 436
 				$dirodt = DOL_DATA_ROOT.'/doctemplates/mymodule';
Please login to merge, or discard this patch.
htdocs/core/ajax/ajaxdirpreview.php 1 patch
Braces   +135 added lines, -52 removed lines patch added patch discarded remove patch
@@ -27,14 +27,25 @@  discard block
 block discarded – undo
27 27
  * 				ajaxdirpreview.php?mode=nojs&action=preview&module=ecm&section=0&file=xxx
28 28
  */
29 29
 
30
-if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); // Disables token renewal
31
-if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
32
-if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
33
-if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
30
+if (!defined('NOTOKENRENEWAL')) {
31
+	define('NOTOKENRENEWAL', 1);
32
+}
33
+// Disables token renewal
34
+if (!defined('NOREQUIREMENU')) {
35
+	define('NOREQUIREMENU', '1');
36
+}
37
+if (!defined('NOREQUIREHTML')) {
38
+	define('NOREQUIREHTML', '1');
39
+}
40
+if (!defined('NOREQUIREAJAX')) {
41
+	define('NOREQUIREAJAX', '1');
42
+}
34 43
 
35
-if (!isset($mode) || $mode != 'noajax')    // For ajax call
44
+if (!isset($mode) || $mode != 'noajax') {
45
+	// For ajax call
36 46
 {
37 47
 	require_once '../../main.inc.php';
48
+}
38 49
 	require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
39 50
 	require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
40 51
 	require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php';
@@ -54,8 +65,12 @@  discard block
 block discarded – undo
54 65
 	$offset = $limit * $page;
55 66
 	$pageprev = $page - 1;
56 67
 	$pagenext = $page + 1;
57
-	if (!$sortorder) $sortorder = "ASC";
58
-	if (!$sortfield) $sortfield = "name";
68
+	if (!$sortorder) {
69
+		$sortorder = "ASC";
70
+	}
71
+	if (!$sortfield) {
72
+		$sortfield = "name";
73
+	}
59 74
 
60 75
 	$rootdirfordoc = $conf->ecm->dir_output;
61 76
 
@@ -97,15 +112,20 @@  discard block
 block discarded – undo
97 112
 
98 113
 if (empty($url))
99 114
 {
100
-	if (GETPOSTISSET('website')) $url = DOL_URL_ROOT.'/website/index.php';
101
-	else $url = DOL_URL_ROOT.'/ecm/index.php';
102
-}
115
+	if (GETPOSTISSET('website')) {
116
+		$url = DOL_URL_ROOT.'/website/index.php';
117
+	} else {
118
+		$url = DOL_URL_ROOT.'/ecm/index.php';
119
+	}
120
+	}
103 121
 
104 122
 // Load translation files required by the page
105 123
 $langs->loadLangs(array("ecm", "companies", "other"));
106 124
 
107 125
 // Security check
108
-if ($user->socid > 0) $socid = $user->socid;
126
+if ($user->socid > 0) {
127
+	$socid = $user->socid;
128
+}
109 129
 
110 130
 //print 'xxx'.$upload_dir;
111 131
 
@@ -122,8 +142,10 @@  discard block
 block discarded – undo
122 142
 // Check permissions
123 143
 if ($modulepart == 'ecm')
124 144
 {
125
-	if (!$user->rights->ecm->read) accessforbidden();
126
-}
145
+	if (!$user->rights->ecm->read) {
146
+		accessforbidden();
147
+	}
148
+	}
127 149
 if ($modulepart == 'medias')
128 150
 {
129 151
 	// Always allowed
@@ -166,8 +188,12 @@  discard block
 block discarded – undo
166 188
 //print '<!-- Page called with mode='.dol_escape_htmltag(isset($mode)?$mode:'').' type='.dol_escape_htmltag($type).' module='.dol_escape_htmltag($module).' url='.dol_escape_htmltag($url).' '.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]).' -->'."\n";
167 189
 
168 190
 $param = ($sortfield ? '&sortfield='.urlencode($sortfield) : '').($sortorder ? '&sortorder='.urlencode($sortorder) : '');
169
-if (!empty($websitekey)) $param .= '&website='.urlencode($websitekey);
170
-if (!empty($pageid))     $param .= '&pageid='.urlencode($pageid);
191
+if (!empty($websitekey)) {
192
+	$param .= '&website='.urlencode($websitekey);
193
+}
194
+if (!empty($pageid)) {
195
+	$param .= '&pageid='.urlencode($pageid);
196
+}
171 197
 
172 198
 
173 199
 // Dir scan
@@ -202,34 +228,58 @@  discard block
 block discarded – undo
202 228
 	);
203 229
 
204 230
 	// TODO change for multicompany sharing
205
-	if ($module == 'company') $upload_dir = $conf->societe->dir_output;
206
-	elseif ($module == 'invoice') $upload_dir = $conf->facture->dir_output;
207
-	elseif ($module == 'invoice_supplier') $upload_dir = $conf->fournisseur->facture->dir_output;
208
-	elseif ($module == 'propal') $upload_dir = $conf->propal->dir_output;
209
-	elseif ($module == 'supplier_proposal') $upload_dir = $conf->supplier_proposal->dir_output;
210
-	elseif ($module == 'order') $upload_dir = $conf->commande->dir_output;
211
-	elseif ($module == 'order_supplier') $upload_dir = $conf->fournisseur->commande->dir_output;
212
-	elseif ($module == 'contract') $upload_dir = $conf->contrat->dir_output;
213
-	elseif ($module == 'product') $upload_dir = $conf->product->dir_output;
214
-	elseif ($module == 'tax') $upload_dir = $conf->tax->dir_output;
215
-	elseif ($module == 'project') $upload_dir = $conf->projet->dir_output;
216
-	elseif ($module == 'fichinter') $upload_dir = $conf->ficheinter->dir_output;
217
-	elseif ($module == 'user') $upload_dir = $conf->user->dir_output;
218
-	elseif ($module == 'expensereport') $upload_dir = $conf->expensereport->dir_output;
219
-	elseif ($module == 'holiday') $upload_dir = $conf->holiday->dir_output;
220
-	elseif ($module == 'recruitment-recruitmentcandidature') $upload_dir = $conf->recruitment->dir_output.'/recruitmentcandidature';
221
-	elseif ($module == 'banque') $upload_dir = $conf->bank->dir_output;
222
-	elseif ($module == 'mrp-mo') $upload_dir = $conf->mrp->dir_output.'/mo';
231
+	if ($module == 'company') {
232
+		$upload_dir = $conf->societe->dir_output;
233
+	} elseif ($module == 'invoice') {
234
+		$upload_dir = $conf->facture->dir_output;
235
+	} elseif ($module == 'invoice_supplier') {
236
+		$upload_dir = $conf->fournisseur->facture->dir_output;
237
+	} elseif ($module == 'propal') {
238
+		$upload_dir = $conf->propal->dir_output;
239
+	} elseif ($module == 'supplier_proposal') {
240
+		$upload_dir = $conf->supplier_proposal->dir_output;
241
+	} elseif ($module == 'order') {
242
+		$upload_dir = $conf->commande->dir_output;
243
+	} elseif ($module == 'order_supplier') {
244
+		$upload_dir = $conf->fournisseur->commande->dir_output;
245
+	} elseif ($module == 'contract') {
246
+		$upload_dir = $conf->contrat->dir_output;
247
+	} elseif ($module == 'product') {
248
+		$upload_dir = $conf->product->dir_output;
249
+	} elseif ($module == 'tax') {
250
+		$upload_dir = $conf->tax->dir_output;
251
+	} elseif ($module == 'project') {
252
+		$upload_dir = $conf->projet->dir_output;
253
+	} elseif ($module == 'fichinter') {
254
+		$upload_dir = $conf->ficheinter->dir_output;
255
+	} elseif ($module == 'user') {
256
+		$upload_dir = $conf->user->dir_output;
257
+	} elseif ($module == 'expensereport') {
258
+		$upload_dir = $conf->expensereport->dir_output;
259
+	} elseif ($module == 'holiday') {
260
+		$upload_dir = $conf->holiday->dir_output;
261
+	} elseif ($module == 'recruitment-recruitmentcandidature') {
262
+		$upload_dir = $conf->recruitment->dir_output.'/recruitmentcandidature';
263
+	} elseif ($module == 'banque') {
264
+		$upload_dir = $conf->bank->dir_output;
265
+	} elseif ($module == 'mrp-mo') {
266
+		$upload_dir = $conf->mrp->dir_output.'/mo';
267
+	}
223 268
 
224 269
 	// Automatic list
225 270
 	if (in_array($module, $automodules))
226 271
 	{
227 272
 		$param .= '&module='.$module;
228
-		if (isset($search_doc_ref) && $search_doc_ref != '') $param .= '&search_doc_ref='.urlencode($search_doc_ref);
273
+		if (isset($search_doc_ref) && $search_doc_ref != '') {
274
+			$param .= '&search_doc_ref='.urlencode($search_doc_ref);
275
+		}
229 276
 
230 277
 		$textifempty = ($section ? $langs->trans("NoFileFound") : ($showonrightsize == 'featurenotyetavailable' ? $langs->trans("FeatureNotYetAvailable") : $langs->trans("NoFileFound")));
231 278
 
232
-		if ($module == 'company') $excludefiles[] = '^contact$'; // The subdir 'contact' contains files of contacts with no id of thirdparty.
279
+		if ($module == 'company') {
280
+			$excludefiles[] = '^contact$';
281
+		}
282
+		// The subdir 'contact' contains files of contacts with no id of thirdparty.
233 283
 
234 284
 		$filter = preg_quote($search_doc_ref, '/');
235 285
 		$filearray = dol_dir_list($upload_dir, "files", 1, $filter, $excludefiles, $sortfield, $sorting, 1);
@@ -254,13 +304,19 @@  discard block
 block discarded – undo
254 304
 			  'sendit' => string 'Envoyer fichier' (length=15)
255 305
     		 */
256 306
 			$relativepath = GETPOST('file', 'alpha') ?GETPOST('file', 'alpha') : GETPOST('section_dir', 'alpha');
257
-			if ($relativepath && $relativepath != '/') $relativepath .= '/';
307
+			if ($relativepath && $relativepath != '/') {
308
+				$relativepath .= '/';
309
+			}
258 310
 			$upload_dir = $dolibarr_main_data_root.'/'.$module.'/'.$relativepath;
259 311
 			if (GETPOSTISSET('website') || GETPOSTISSET('file_manager'))
260 312
 			{
261 313
 				$param .= '&file_manager=1';
262
-				if (!preg_match('/website=/', $param)) $param .= '&website='.urlencode(GETPOST('website', 'alpha'));
263
-				if (!preg_match('/pageid=/', $param)) $param .= '&pageid='.urlencode(GETPOST('pageid', 'int'));
314
+				if (!preg_match('/website=/', $param)) {
315
+					$param .= '&website='.urlencode(GETPOST('website', 'alpha'));
316
+				}
317
+				if (!preg_match('/pageid=/', $param)) {
318
+					$param .= '&pageid='.urlencode(GETPOST('pageid', 'int'));
319
+				}
264 320
 				//if (!preg_match('/backtopage=/',$param)) $param.='&backtopage='.urlencode($_SERVER["PHP_SELF"].'?file_manager=1&website='.$websitekey.'&pageid='.$pageid);
265 321
 			}
266 322
 		} else {
@@ -279,14 +335,21 @@  discard block
 block discarded – undo
279 335
 		if ($section)
280 336
 		{
281 337
 			$param .= '&section='.$section;
282
-			if (isset($search_doc_ref) && $search_doc_ref != '') $param .= '&search_doc_ref='.$search_doc_ref;
338
+			if (isset($search_doc_ref) && $search_doc_ref != '') {
339
+				$param .= '&search_doc_ref='.$search_doc_ref;
340
+			}
283 341
 
284 342
 			$textifempty = $langs->trans('NoFileFound');
285 343
 		} elseif ($section === '0')
286 344
 		{
287
-			if ($module == 'ecm') $textifempty = '<br><div class="center"><font class="warning">'.$langs->trans("DirNotSynchronizedSyncFirst").'</font></div><br>';
288
-			else $textifempty = $langs->trans('NoFileFound');
289
-		} else $textifempty = ($showonrightsize == 'featurenotyetavailable' ? $langs->trans("FeatureNotYetAvailable") : $langs->trans("ECMSelectASection"));
345
+			if ($module == 'ecm') {
346
+				$textifempty = '<br><div class="center"><font class="warning">'.$langs->trans("DirNotSynchronizedSyncFirst").'</font></div><br>';
347
+			} else {
348
+				$textifempty = $langs->trans('NoFileFound');
349
+			}
350
+		} else {
351
+			$textifempty = ($showonrightsize == 'featurenotyetavailable' ? $langs->trans("FeatureNotYetAvailable") : $langs->trans("ECMSelectASection"));
352
+		}
290 353
 
291 354
 		if ($module == 'medias')
292 355
 		{
@@ -294,12 +357,14 @@  discard block
 block discarded – undo
294 357
 			$modulepart = 'medias';
295 358
 			$perm = ($user->rights->website->write || $user->rights->emailing->creer);
296 359
 			$title = 'none';
297
-		} elseif ($module == 'ecm') // DMS/ECM -> manual structure
360
+		} elseif ($module == 'ecm') {
361
+			// DMS/ECM -> manual structure
298 362
 		{
299 363
 			if ($user->rights->ecm->read)
300 364
 			{
301 365
 				// Buttons: Preview
302 366
 				$useinecm = 2;
367
+		}
303 368
 			}
304 369
 
305 370
 			if ($user->rights->ecm->upload)
@@ -335,18 +400,28 @@  discard block
 block discarded – undo
335 400
 
336 401
 // Bottom of page
337 402
 $useajax = 1;
338
-if (!empty($conf->dol_use_jmobile)) $useajax = 0;
339
-if (empty($conf->use_javascript_ajax)) $useajax = 0;
340
-if (!empty($conf->global->MAIN_ECM_DISABLE_JS)) $useajax = 0;
403
+if (!empty($conf->dol_use_jmobile)) {
404
+	$useajax = 0;
405
+}
406
+if (empty($conf->use_javascript_ajax)) {
407
+	$useajax = 0;
408
+}
409
+if (!empty($conf->global->MAIN_ECM_DISABLE_JS)) {
410
+	$useajax = 0;
411
+}
341 412
 
342 413
 //$param.=($param?'?':'').(preg_replace('/^&/','',$param));
343 414
 
344 415
 if ($useajax || $action == 'delete')
345 416
 {
346 417
 	$urlfile = '';
347
-	if ($action == 'delete') $urlfile = GETPOST('urlfile', 'alpha');
418
+	if ($action == 'delete') {
419
+		$urlfile = GETPOST('urlfile', 'alpha');
420
+	}
348 421
 
349
-	if (empty($section_dir)) $section_dir = GETPOST("file", "alpha");
422
+	if (empty($section_dir)) {
423
+		$section_dir = GETPOST("file", "alpha");
424
+	}
350 425
 	$section_id = $section;
351 426
 
352 427
 	require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
@@ -358,9 +433,15 @@  discard block
 block discarded – undo
358 433
 	$formquestion['section_dir'] = array('type'=>'hidden', 'value'=>$section_dir, 'name'=>'section_dir'); // We must always put field, even if empty because it is filled by javascript later
359 434
 	$formquestion['sortfield'] = array('type'=>'hidden', 'value'=>$sortfield, 'name'=>'sortfield'); // We must always put field, even if empty because it is filled by javascript later
360 435
 	$formquestion['sortorder'] = array('type'=>'hidden', 'value'=>$sortorder, 'name'=>'sortorder'); // We must always put field, even if empty because it is filled by javascript later
361
-	if (!empty($action) && $action == 'file_manager')	$formquestion['file_manager'] = array('type'=>'hidden', 'value'=>1, 'name'=>'file_manager');
362
-	if (!empty($websitekey))							$formquestion['website'] = array('type'=>'hidden', 'value'=>$websitekey, 'name'=>'website');
363
-	if (!empty($pageid) && $pageid > 0)				$formquestion['pageid'] = array('type'=>'hidden', 'value'=>$pageid, 'name'=>'pageid');
436
+	if (!empty($action) && $action == 'file_manager') {
437
+		$formquestion['file_manager'] = array('type'=>'hidden', 'value'=>1, 'name'=>'file_manager');
438
+	}
439
+	if (!empty($websitekey)) {
440
+		$formquestion['website'] = array('type'=>'hidden', 'value'=>$websitekey, 'name'=>'website');
441
+	}
442
+	if (!empty($pageid) && $pageid > 0) {
443
+		$formquestion['pageid'] = array('type'=>'hidden', 'value'=>$pageid, 'name'=>'pageid');
444
+	}
364 445
 
365 446
 	print $form->formconfirm($url, $langs->trans("DeleteFile"), $langs->trans("ConfirmDeleteFile"), 'confirm_deletefile', $formquestion, "no", ($useajax ? 'deletefile' : 0));
366 447
 }
@@ -400,4 +481,6 @@  discard block
 block discarded – undo
400 481
 }
401 482
 
402 483
 // Close db if mode is not noajax
403
-if ((!isset($mode) || $mode != 'noajax') && is_object($db)) $db->close();
484
+if ((!isset($mode) || $mode != 'noajax') && is_object($db)) {
485
+	$db->close();
486
+}
Please login to merge, or discard this patch.
htdocs/core/actions_sendmails.inc.php 1 patch
Braces   +73 added lines, -25 removed lines patch added patch discarded remove patch
@@ -77,9 +77,15 @@  discard block
 block discarded – undo
77 77
 	$listofnames = array();
78 78
 	$listofmimes = array();
79 79
 	$keytoavoidconflict = empty($trackid) ? '' : '-'.$trackid;
80
-	if (!empty($_SESSION["listofpaths".$keytoavoidconflict])) $listofpaths = explode(';', $_SESSION["listofpaths".$keytoavoidconflict]);
81
-	if (!empty($_SESSION["listofnames".$keytoavoidconflict])) $listofnames = explode(';', $_SESSION["listofnames".$keytoavoidconflict]);
82
-	if (!empty($_SESSION["listofmimes".$keytoavoidconflict])) $listofmimes = explode(';', $_SESSION["listofmimes".$keytoavoidconflict]);
80
+	if (!empty($_SESSION["listofpaths".$keytoavoidconflict])) {
81
+		$listofpaths = explode(';', $_SESSION["listofpaths".$keytoavoidconflict]);
82
+	}
83
+	if (!empty($_SESSION["listofnames".$keytoavoidconflict])) {
84
+		$listofnames = explode(';', $_SESSION["listofnames".$keytoavoidconflict]);
85
+	}
86
+	if (!empty($_SESSION["listofmimes".$keytoavoidconflict])) {
87
+		$listofmimes = explode(';', $_SESSION["listofmimes".$keytoavoidconflict]);
88
+	}
83 89
 
84 90
 	include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
85 91
 	$formmail = new FormMail($db);
@@ -103,7 +109,9 @@  discard block
 block discarded – undo
103 109
  */
104 110
 if (($action == 'send' || $action == 'relance') && !$_POST['addfile'] && !$_POST['removAll'] && !$_POST['removedfile'] && !$_POST['cancel'] && !$_POST['modelselected'])
105 111
 {
106
-	if (empty($trackid)) $trackid = GETPOST('trackid', 'aZ09');
112
+	if (empty($trackid)) {
113
+		$trackid = GETPOST('trackid', 'aZ09');
114
+	}
107 115
 
108 116
 	$subject = ''; $actionmsg = ''; $actionmsg2 = '';
109 117
 
@@ -118,30 +126,42 @@  discard block
 block discarded – undo
118 126
 		{
119 127
 			$resultthirdparty = $object->fetch_thirdparty();
120 128
 			$thirdparty = $object->thirdparty;
121
-			if (is_object($thirdparty)) $sendtosocid = $thirdparty->id;
129
+			if (is_object($thirdparty)) {
130
+				$sendtosocid = $thirdparty->id;
131
+			}
122 132
 		} elseif ($object->element == 'member' || $object->element == 'user')
123 133
 		{
124 134
 			$thirdparty = $object;
125
-			if ($object->socid > 0) $sendtosocid = $object->socid;
135
+			if ($object->socid > 0) {
136
+				$sendtosocid = $object->socid;
137
+			}
126 138
 		} elseif ($object->element == 'expensereport')
127 139
 		{
128 140
 			$tmpuser = new User($db);
129 141
 			$tmpuser->fetch($object->fk_user_author);
130 142
 			$thirdparty = $tmpuser;
131
-			if ($object->socid > 0) $sendtosocid = $object->socid;
143
+			if ($object->socid > 0) {
144
+				$sendtosocid = $object->socid;
145
+			}
132 146
 		} elseif ($object->element == 'societe')
133 147
 		{
134 148
 			$thirdparty = $object;
135
-			if (is_object($thirdparty) && $thirdparty->id > 0) $sendtosocid = $thirdparty->id;
149
+			if (is_object($thirdparty) && $thirdparty->id > 0) {
150
+				$sendtosocid = $thirdparty->id;
151
+			}
136 152
 		} elseif ($object->element == 'contact')
137 153
 		{
138 154
 			$contact = $object;
139 155
 			if ($contact->id > 0) {
140 156
 				$contact->fetch_thirdparty();
141 157
 				$thirdparty = $contact->thirdparty;
142
-				if (is_object($thirdparty) && $thirdparty->id > 0) $sendtosocid = $thirdparty->id;
158
+				if (is_object($thirdparty) && $thirdparty->id > 0) {
159
+					$sendtosocid = $thirdparty->id;
160
+				}
143 161
 			}
144
-		} else dol_print_error('', "Use actions_sendmails.in.php for an element/object '".$object->element."' that is not supported");
162
+		} else {
163
+			dol_print_error('', "Use actions_sendmails.in.php for an element/object '".$object->element."' that is not supported");
164
+		}
145 165
 
146 166
 		if (is_object($hookmanager))
147 167
 		{
@@ -165,8 +185,11 @@  discard block
 block discarded – undo
165 185
 		$receiver = $_POST['receiver'];
166 186
 		if (!is_array($receiver))
167 187
 		{
168
-			if ($receiver == '-1') $receiver = array();
169
-			else $receiver = array($receiver);
188
+			if ($receiver == '-1') {
189
+				$receiver = array();
190
+			} else {
191
+				$receiver = array($receiver);
192
+			}
170 193
 		}
171 194
 
172 195
 		$tmparray = array();
@@ -181,17 +204,22 @@  discard block
 block discarded – undo
181 204
 			// Recipient was provided from combo list
182 205
 			foreach ($receiver as $key=>$val)
183 206
 			{
184
-				if ($val == 'thirdparty') // Key selected means current third party ('thirdparty' may be used for current member or current user too)
207
+				if ($val == 'thirdparty') {
208
+					// Key selected means current third party ('thirdparty' may be used for current member or current user too)
185 209
 				{
186 210
 					$tmparray[] = dol_string_nospecial($thirdparty->getFullName($langs), ' ', array(",")).' <'.$thirdparty->email.'>';
187 211
 				}
188
-				elseif ($val == 'contact') // Key selected means current contact
212
+				} elseif ($val == 'contact') {
213
+					// Key selected means current contact
189 214
 				{
190 215
 					$tmparray[] = dol_string_nospecial($contact->getFullName($langs), ' ', array(",")).' <'.$contact->email.'>';
216
+				}
191 217
 					$sendtoid[] = $contact->id;
192
-				} elseif ($val)	// $val is the Id of a contact
218
+				} elseif ($val) {
219
+					// $val is the Id of a contact
193 220
 				{
194 221
 					$tmparray[] = $thirdparty->contact_get_property((int) $val, 'email');
222
+				}
195 223
 					$sendtoid[] = ((int) $val);
196 224
 				}
197 225
 			}
@@ -217,8 +245,11 @@  discard block
 block discarded – undo
217 245
 		$receivercc = $_POST['receivercc'];
218 246
 		if (!is_array($receivercc))
219 247
 		{
220
-			if ($receivercc == '-1') $receivercc = array();
221
-			else $receivercc = array($receivercc);
248
+			if ($receivercc == '-1') {
249
+				$receivercc = array();
250
+			} else {
251
+				$receivercc = array($receivercc);
252
+			}
222 253
 		}
223 254
 		$tmparray = array();
224 255
 		if (trim($_POST['sendtocc']))
@@ -230,18 +261,24 @@  discard block
 block discarded – undo
230 261
 			foreach ($receivercc as $key=>$val)
231 262
 			{
232 263
 				// Recipient was provided from combo list
233
-				if ($val == 'thirdparty')	// Key selected means currentthird party (may be usd for current member or current user too)
264
+				if ($val == 'thirdparty') {
265
+					// Key selected means currentthird party (may be usd for current member or current user too)
234 266
 				{
235 267
 					$tmparray[] = dol_string_nospecial($thirdparty->name, ' ', array(",")).' <'.$thirdparty->email.'>';
236 268
 				}
269
+				}
237 270
 				// Recipient was provided from combo list
238
-				elseif ($val == 'contact')	// Key selected means current contact
271
+				elseif ($val == 'contact') {
272
+					// Key selected means current contact
239 273
 				{
240 274
 					$tmparray[] = dol_string_nospecial($contact->name, ' ', array(",")).' <'.$contact->email.'>';
275
+				}
241 276
 					//$sendtoid[] = $contact->id;  TODO Add also id of contact in CC ?
242
-				} elseif ($val)				// $val is the Id of a contact
277
+				} elseif ($val) {
278
+					// $val is the Id of a contact
243 279
 				{
244 280
 					$tmparray[] = $thirdparty->contact_get_property((int) $val, 'email');
281
+				}
245 282
 					//$sendtoid[] = ((int) $val);  TODO Add also id of contact in CC ?
246 283
 				}
247 284
 			}
@@ -326,7 +363,9 @@  discard block
 block discarded – undo
326 363
 				{
327 364
 					$actionmsg = $langs->transnoentities('MailFrom').': '.dol_escape_htmltag($from);
328 365
 					$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTo').': '.dol_escape_htmltag($sendto));
329
-					if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc').": ".dol_escape_htmltag($sendtocc));
366
+					if ($sendtocc) {
367
+						$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc').": ".dol_escape_htmltag($sendtocc));
368
+					}
330 369
 					$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic').": ".$subject);
331 370
 					$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody').":");
332 371
 					$actionmsg = dol_concatdesc($actionmsg, $message);
@@ -405,7 +444,9 @@  discard block
 block discarded – undo
405 444
 			}
406 445
 
407 446
 			// Send mail (substitutionarray must be done just before this)
408
-			if (empty($sendcontext)) $sendcontext = 'standard';
447
+			if (empty($sendcontext)) {
448
+				$sendcontext = 'standard';
449
+			}
409 450
 			$mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1, '', '', $trackid, '', $sendcontext);
410 451
 
411 452
 			if ($mailfile->error)
@@ -419,7 +460,10 @@  discard block
 block discarded – undo
419 460
 					// Initialisation of datas of object to call trigger
420 461
 					if (is_object($object))
421 462
 					{
422
-						if (empty($actiontypecode)) $actiontypecode = 'AC_OTH_AUTO'; // Event insert into agenda automatically
463
+						if (empty($actiontypecode)) {
464
+							$actiontypecode = 'AC_OTH_AUTO';
465
+						}
466
+						// Event insert into agenda automatically
423 467
 
424 468
 						$object->socid = $sendtosocid; // To link to a company
425 469
 						$object->sendtoid = $sendtoid; // To link to contact-addresses. This is an array.
@@ -451,7 +495,9 @@  discard block
 block discarded – undo
451 495
 						{
452 496
 							// Call trigger
453 497
 							$result = $object->call_trigger(empty($triggersendname) ? $trigger_name : $triggersendname, $user);
454
-							if ($result < 0) $error++;
498
+							if ($result < 0) {
499
+								$error++;
500
+							}
455 501
 							// End call triggers
456 502
 
457 503
 							if ($error) {
@@ -467,7 +513,9 @@  discard block
 block discarded – undo
467 513
 					setEventMessages($mesg, null, 'mesgs');
468 514
 
469 515
   					$moreparam = '';
470
-	  				if (isset($paramname2) || isset($paramval2)) $moreparam .= '&'.($paramname2 ? $paramname2 : 'mid').'='.$paramval2;
516
+	  				if (isset($paramname2) || isset($paramval2)) {
517
+	  					$moreparam .= '&'.($paramname2 ? $paramname2 : 'mid').'='.$paramval2;
518
+	  				}
471 519
 		  			header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname ? $paramname : 'id').'='.(is_object($object) ? $object->id : '').$moreparam);
472 520
 			  		exit;
473 521
 				} else {
Please login to merge, or discard this patch.
htdocs/core/lib/member.lib.php 1 patch
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -59,7 +59,9 @@  discard block
 block discarded – undo
59 59
 		$head[$h][0] = DOL_URL_ROOT.'/adherents/subscription.php?rowid='.$object->id;
60 60
 		$head[$h][1] = $langs->trans("Subscriptions");
61 61
 		$head[$h][2] = 'subscription';
62
-		if ($nbSubscription > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbSubscription.'</span>';
62
+		if ($nbSubscription > 0) {
63
+			$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbSubscription.'</span>';
64
+		}
63 65
 		$h++;
64 66
 	}
65 67
 
@@ -70,13 +72,21 @@  discard block
 block discarded – undo
70 72
 	complete_head_from_modules($conf, $langs, $object, $head, $h, 'member');
71 73
 
72 74
 	$nbNote = 0;
73
-	if (!empty($object->note)) $nbNote++;
74
-	if (!empty($object->note_private)) $nbNote++;
75
-	if (!empty($object->note_public)) $nbNote++;
75
+	if (!empty($object->note)) {
76
+		$nbNote++;
77
+	}
78
+	if (!empty($object->note_private)) {
79
+		$nbNote++;
80
+	}
81
+	if (!empty($object->note_public)) {
82
+		$nbNote++;
83
+	}
76 84
 	$head[$h][0] = DOL_URL_ROOT.'/adherents/note.php?id='.$object->id;
77 85
 	$head[$h][1] = $langs->trans("Note");
78 86
 	$head[$h][2] = 'note';
79
-	if ($nbNote > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
87
+	if ($nbNote > 0) {
88
+		$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
89
+	}
80 90
 	$h++;
81 91
 
82 92
 	// Attachments
@@ -87,7 +97,9 @@  discard block
 block discarded – undo
87 97
 	$nbLinks = Link::count($db, $object->element, $object->id);
88 98
 	$head[$h][0] = DOL_URL_ROOT.'/adherents/document.php?id='.$object->id;
89 99
 	$head[$h][1] = $langs->trans('Documents');
90
-	if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>';
100
+	if (($nbFiles + $nbLinks) > 0) {
101
+		$head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>';
102
+	}
91 103
 	$head[$h][2] = 'document';
92 104
 	$h++;
93 105
 
Please login to merge, or discard this patch.