Passed
Branch develop (fc1365)
by Laurent
84:32
created
htdocs/core/lib/project.lib.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1625,7 +1625,9 @@  discard block
 block discarded – undo
1625 1625
 				// Duration
1626 1626
 				print '<td class="center duration'.($cssonholiday ? ' '.$cssonholiday : '').($cssweekend ? ' '.$cssweekend : '').'">';
1627 1627
 				$dayWorkLoad = !empty($projectstatic->weekWorkLoadPerTask[$preselectedday][$lines[$i]->id]) ? $projectstatic->weekWorkLoadPerTask[$preselectedday][$lines[$i]->id] : 0;
1628
-				if (!isset($totalforeachday[$preselectedday])) $totalforeachday[$preselectedday] = 0;
1628
+				if (!isset($totalforeachday[$preselectedday])) {
1629
+					$totalforeachday[$preselectedday] = 0;
1630
+				}
1629 1631
 				$totalforeachday[$preselectedday] += $dayWorkLoad;
1630 1632
 
1631 1633
 				$alreadyspent = '';
@@ -2006,7 +2008,9 @@  discard block
 block discarded – undo
2006 2008
 				$modeinput = 'hours';
2007 2009
 				for ($idw = 0; $idw < 7; $idw++) {
2008 2010
 					$tmpday = dol_time_plus_duree($firstdaytoshow, $idw, 'd');
2009
-					if (!isset($totalforeachday[$tmpday])) $totalforeachday[$tmpday] = 0;
2011
+					if (!isset($totalforeachday[$tmpday])) {
2012
+						$totalforeachday[$tmpday] = 0;
2013
+					}
2010 2014
 					$cssonholiday = '';
2011 2015
 					if (!$isavailable[$tmpday]['morning'] && !$isavailable[$tmpday]['afternoon']) {
2012 2016
 						$cssonholiday .= 'onholidayallday ';
@@ -2305,7 +2309,9 @@  discard block
 block discarded – undo
2305 2309
 				$month = $firstdaytoshowarray['mon'];
2306 2310
 				foreach ($TWeek as $weekIndex => $weekNb) {
2307 2311
 					$weekWorkLoad = !empty($projectstatic->monthWorkLoadPerTask[$weekNb][$lines[$i]->id]) ? $projectstatic->monthWorkLoadPerTask[$weekNb][$lines[$i]->id] : 0 ;
2308
-					if (!isset($totalforeachweek[$weekNb])) $totalforeachweek[$weekNb] = 0;
2312
+					if (!isset($totalforeachweek[$weekNb])) {
2313
+						$totalforeachweek[$weekNb] = 0;
2314
+					}
2309 2315
 					$totalforeachweek[$weekNb] += $weekWorkLoad;
2310 2316
 
2311 2317
 					$alreadyspent = '';
Please login to merge, or discard this patch.
htdocs/core/lib/date.lib.php 1 patch
Braces   +24 added lines, -8 removed lines patch added patch discarded remove patch
@@ -331,13 +331,27 @@  discard block
 block discarded – undo
331 331
 {
332 332
 	$result = 0;
333 333
 
334
-	if ($duration_unit == 's') $result = $duration_value / 3600;
335
-	if ($duration_unit == 'i') $result = $duration_value / 60;
336
-	if ($duration_unit == 'h') $result = $duration_value;
337
-	if ($duration_unit == 'd') $result = $duration_value * 24;
338
-	if ($duration_unit == 'w') $result = $duration_value * 24 * 7;
339
-	if ($duration_unit == 'm') $result = $duration_value * 730.484;
340
-	if ($duration_unit == 'y') $result = $duration_value * 365 * 24;
334
+	if ($duration_unit == 's') {
335
+		$result = $duration_value / 3600;
336
+	}
337
+	if ($duration_unit == 'i') {
338
+		$result = $duration_value / 60;
339
+	}
340
+	if ($duration_unit == 'h') {
341
+		$result = $duration_value;
342
+	}
343
+	if ($duration_unit == 'd') {
344
+		$result = $duration_value * 24;
345
+	}
346
+	if ($duration_unit == 'w') {
347
+		$result = $duration_value * 24 * 7;
348
+	}
349
+	if ($duration_unit == 'm') {
350
+		$result = $duration_value * 730.484;
351
+	}
352
+	if ($duration_unit == 'y') {
353
+		$result = $duration_value * 365 * 24;
354
+	}
341 355
 
342 356
 	return $result;
343 357
 }
@@ -929,7 +943,9 @@  discard block
 block discarded – undo
929 943
 				$date_1sunsept = strtotime('next thursday', strtotime('next sunday', mktime(0, 0, 0, 9, 1, $annee)));
930 944
 				$jour_1sunsept = date("d", $date_1sunsept);
931 945
 				$mois_1sunsept = date("m", $date_1sunsept);
932
-				if ($jour_1sunsept == $jour && $mois_1sunsept == $mois) $ferie=true;
946
+				if ($jour_1sunsept == $jour && $mois_1sunsept == $mois) {
947
+					$ferie=true;
948
+				}
933 949
 				// Geneva fast in Switzerland
934 950
 			}
935 951
 		}
Please login to merge, or discard this patch.
htdocs/core/class/html.form.class.php 1 patch
Braces   +123 added lines, -46 removed lines patch added patch discarded remove patch
@@ -2477,22 +2477,34 @@  discard block
 block discarded – undo
2477 2477
 		$sql = 'SELECT b.rowid, b.ref, b.label, b.fk_product';
2478 2478
 		$sql.= ' FROM '.MAIN_DB_PREFIX.'bom_bom as b';
2479 2479
 		$sql.= ' WHERE b.entity IN ('.getEntity('bom').')';
2480
-		if (!empty($status)) $sql.= ' AND status = '. (int) $status;
2481
-		if (!empty($type)) $sql.= ' AND bomtype = '. (int) $type;
2482
-		if (!empty($TProducts)) $sql .= ' AND fk_product IN ('.$this->db->sanitize(implode(',', $TProducts)).')';
2483
-		if (!empty($limit)) $sql.= ' LIMIT '. (int) $limit;
2480
+		if (!empty($status)) {
2481
+			$sql.= ' AND status = '. (int) $status;
2482
+		}
2483
+		if (!empty($type)) {
2484
+			$sql.= ' AND bomtype = '. (int) $type;
2485
+		}
2486
+		if (!empty($TProducts)) {
2487
+			$sql .= ' AND fk_product IN ('.$this->db->sanitize(implode(',', $TProducts)).')';
2488
+		}
2489
+		if (!empty($limit)) {
2490
+			$sql.= ' LIMIT '. (int) $limit;
2491
+		}
2484 2492
 		$resql = $db->query($sql);
2485 2493
 		if ($resql) {
2486 2494
 			if ($showempty)	{
2487 2495
 				$out .= '<option value="-1"';
2488
-				if (empty($selected)) $out .= ' selected';
2496
+				if (empty($selected)) {
2497
+					$out .= ' selected';
2498
+				}
2489 2499
 				$out .= '>&nbsp;</option>';
2490 2500
 			}
2491 2501
 			while ($obj = $db->fetch_object($resql)) {
2492 2502
 				$product = new Product($db);
2493 2503
 				$res = $product->fetch($obj->fk_product);
2494 2504
 				$out .= '<option value="'.$obj->rowid.'"';
2495
-				if ($obj->rowid == $selected) $out .= 'selected';
2505
+				if ($obj->rowid == $selected) {
2506
+					$out .= 'selected';
2507
+				}
2496 2508
 				$out .= '>'.$obj->ref.' - '.$product->label .' - '. $obj->label.'</option>';
2497 2509
 			}
2498 2510
 		} else {
@@ -7073,7 +7085,9 @@  discard block
 block discarded – undo
7073 7085
 		$out = '';
7074 7086
 
7075 7087
 		// check parameters
7076
-		if (is_null($ajaxoptions)) $ajaxoptions = array();
7088
+		if (is_null($ajaxoptions)) {
7089
+			$ajaxoptions = array();
7090
+		}
7077 7091
 
7078 7092
 		if (!empty($conf->use_javascript_ajax) && !empty($conf->global->TICKET_USE_SEARCH_TO_SELECT)) {
7079 7093
 			$placeholder = '';
@@ -7089,8 +7103,9 @@  discard block
 block discarded – undo
7089 7103
 			$urloption = '';
7090 7104
 			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/ticket/ajax/tickets.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
7091 7105
 
7092
-			if (empty($hidelabel)) $out .= $langs->trans("RefOrLabel").' : ';
7093
-			elseif ($hidelabel > 1) {
7106
+			if (empty($hidelabel)) {
7107
+				$out .= $langs->trans("RefOrLabel").' : ';
7108
+			} elseif ($hidelabel > 1) {
7094 7109
 				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"';
7095 7110
 				if ($hidelabel == 2) {
7096 7111
 					$out .= img_picto($langs->trans("Search"), 'search');
@@ -7104,8 +7119,11 @@  discard block
 block discarded – undo
7104 7119
 			$out .= $this->selectTicketsList($selected, $htmlname, $filtertype, $limit, $status, 0, $socid, $showempty, $forcecombo, $morecss);
7105 7120
 		}
7106 7121
 
7107
-		if (empty($nooutput)) print $out;
7108
-		else return $out;
7122
+		if (empty($nooutput)) {
7123
+			print $out;
7124
+		} else {
7125
+			return $out;
7126
+		}
7109 7127
 	}
7110 7128
 
7111 7129
 
@@ -7146,14 +7164,20 @@  discard block
 block discarded – undo
7146 7164
 			// For natural search
7147 7165
 			$scrit = explode(' ', $filterkey);
7148 7166
 			$i = 0;
7149
-			if (count($scrit) > 1) $sql .= "(";
7167
+			if (count($scrit) > 1) {
7168
+				$sql .= "(";
7169
+			}
7150 7170
 			foreach ($scrit as $crit) {
7151
-				if ($i > 0) $sql .= " AND ";
7171
+				if ($i > 0) {
7172
+					$sql .= " AND ";
7173
+				}
7152 7174
 				$sql .= "(p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.subject LIKE '".$this->db->escape($prefix.$crit)."%'";
7153 7175
 				$sql .= ")";
7154 7176
 				$i++;
7155 7177
 			}
7156
-			if (count($scrit) > 1) $sql .= ")";
7178
+			if (count($scrit) > 1) {
7179
+				$sql .= ")";
7180
+			}
7157 7181
 			$sql .= ')';
7158 7182
 		}
7159 7183
 
@@ -7181,12 +7205,19 @@  discard block
 block discarded – undo
7181 7205
 			// Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
7182 7206
 			//if (!empty($conf->use_javascript_ajax) || $forcecombo) $textifempty='';
7183 7207
 			if (!empty($conf->global->TICKET_USE_SEARCH_TO_SELECT)) {
7184
-				if ($showempty && !is_numeric($showempty)) $textifempty = $langs->trans($showempty);
7185
-				else $textifempty .= $langs->trans("All");
7208
+				if ($showempty && !is_numeric($showempty)) {
7209
+					$textifempty = $langs->trans($showempty);
7210
+				} else {
7211
+					$textifempty .= $langs->trans("All");
7212
+				}
7186 7213
 			} else {
7187
-				if ($showempty && !is_numeric($showempty)) $textifempty = $langs->trans($showempty);
7214
+				if ($showempty && !is_numeric($showempty)) {
7215
+					$textifempty = $langs->trans($showempty);
7216
+				}
7217
+			}
7218
+			if ($showempty) {
7219
+				$out .= '<option value="0" selected>'.$textifempty.'</option>';
7188 7220
 			}
7189
-			if ($showempty) $out .= '<option value="0" selected>'.$textifempty.'</option>';
7190 7221
 
7191 7222
 			$i = 0;
7192 7223
 			while ($num && $i < $num) {
@@ -7208,7 +7239,9 @@  discard block
 block discarded – undo
7208 7239
 
7209 7240
 			$this->db->free($result);
7210 7241
 
7211
-			if (empty($outputmode)) return $out;
7242
+			if (empty($outputmode)) {
7243
+				return $out;
7244
+			}
7212 7245
 			return $outarray;
7213 7246
 		} else {
7214 7247
 			dol_print_error($this->db);
@@ -7241,7 +7274,9 @@  discard block
 block discarded – undo
7241 7274
 		$opt .= '>';
7242 7275
 		$opt .= $objp->ref;
7243 7276
 		$objRef = $objp->ref;
7244
-		if (!empty($filterkey) && $filterkey != '') $objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1);
7277
+		if (!empty($filterkey) && $filterkey != '') {
7278
+			$objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1);
7279
+		}
7245 7280
 
7246 7281
 		$opt .= "</option>\n";
7247 7282
 		$optJson = array('key'=>$outkey, 'value'=>$outref, 'type'=>$outtype);
@@ -7273,7 +7308,9 @@  discard block
 block discarded – undo
7273 7308
 		$out = '';
7274 7309
 
7275 7310
 		// check parameters
7276
-		if (is_null($ajaxoptions)) $ajaxoptions = array();
7311
+		if (is_null($ajaxoptions)) {
7312
+			$ajaxoptions = array();
7313
+		}
7277 7314
 
7278 7315
 		if (!empty($conf->use_javascript_ajax) && !empty($conf->global->TICKET_USE_SEARCH_TO_SELECT)) {
7279 7316
 			$placeholder = '';
@@ -7288,8 +7325,9 @@  discard block
 block discarded – undo
7288 7325
 
7289 7326
 			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projects.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
7290 7327
 
7291
-			if (empty($hidelabel)) $out .= $langs->trans("RefOrLabel").' : ';
7292
-			elseif ($hidelabel > 1) {
7328
+			if (empty($hidelabel)) {
7329
+				$out .= $langs->trans("RefOrLabel").' : ';
7330
+			} elseif ($hidelabel > 1) {
7293 7331
 				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"';
7294 7332
 				if ($hidelabel == 2) {
7295 7333
 					$out .= img_picto($langs->trans("Search"), 'search');
@@ -7303,8 +7341,11 @@  discard block
 block discarded – undo
7303 7341
 			$out .= $this->selectProjectsList($selected, $htmlname, $filtertype, $limit, $status, 0, $socid, $showempty, $forcecombo, $morecss);
7304 7342
 		}
7305 7343
 
7306
-		if (empty($nooutput)) print $out;
7307
-		else return $out;
7344
+		if (empty($nooutput)) {
7345
+			print $out;
7346
+		} else {
7347
+			return $out;
7348
+		}
7308 7349
 	}
7309 7350
 
7310 7351
 	/**
@@ -7344,14 +7385,20 @@  discard block
 block discarded – undo
7344 7385
 			// For natural search
7345 7386
 			$scrit = explode(' ', $filterkey);
7346 7387
 			$i = 0;
7347
-			if (count($scrit) > 1) $sql .= "(";
7388
+			if (count($scrit) > 1) {
7389
+				$sql .= "(";
7390
+			}
7348 7391
 			foreach ($scrit as $crit) {
7349
-				if ($i > 0) $sql .= " AND ";
7392
+				if ($i > 0) {
7393
+					$sql .= " AND ";
7394
+				}
7350 7395
 				$sql .= "p.ref LIKE '".$this->db->escape($prefix.$crit)."%'";
7351 7396
 				$sql .= "";
7352 7397
 				$i++;
7353 7398
 			}
7354
-			if (count($scrit) > 1) $sql .= ")";
7399
+			if (count($scrit) > 1) {
7400
+				$sql .= ")";
7401
+			}
7355 7402
 			$sql .= ')';
7356 7403
 		}
7357 7404
 
@@ -7379,12 +7426,19 @@  discard block
 block discarded – undo
7379 7426
 			// Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
7380 7427
 			//if (!empty($conf->use_javascript_ajax) || $forcecombo) $textifempty='';
7381 7428
 			if (!empty($conf->global->PROJECT_USE_SEARCH_TO_SELECT)) {
7382
-				if ($showempty && !is_numeric($showempty)) $textifempty = $langs->trans($showempty);
7383
-				else $textifempty .= $langs->trans("All");
7429
+				if ($showempty && !is_numeric($showempty)) {
7430
+					$textifempty = $langs->trans($showempty);
7431
+				} else {
7432
+					$textifempty .= $langs->trans("All");
7433
+				}
7384 7434
 			} else {
7385
-				if ($showempty && !is_numeric($showempty)) $textifempty = $langs->trans($showempty);
7435
+				if ($showempty && !is_numeric($showempty)) {
7436
+					$textifempty = $langs->trans($showempty);
7437
+				}
7438
+			}
7439
+			if ($showempty) {
7440
+				$out .= '<option value="0" selected>'.$textifempty.'</option>';
7386 7441
 			}
7387
-			if ($showempty) $out .= '<option value="0" selected>'.$textifempty.'</option>';
7388 7442
 
7389 7443
 			$i = 0;
7390 7444
 			while ($num && $i < $num) {
@@ -7406,7 +7460,9 @@  discard block
 block discarded – undo
7406 7460
 
7407 7461
 			$this->db->free($result);
7408 7462
 
7409
-			if (empty($outputmode)) return $out;
7463
+			if (empty($outputmode)) {
7464
+				return $out;
7465
+			}
7410 7466
 			return $outarray;
7411 7467
 		} else {
7412 7468
 			dol_print_error($this->db);
@@ -7444,7 +7500,9 @@  discard block
 block discarded – undo
7444 7500
 		$opt .= '>';
7445 7501
 		$opt .= $objp->ref;
7446 7502
 		$objRef = $objp->ref;
7447
-		if (!empty($filterkey) && $filterkey != '') $objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1);
7503
+		if (!empty($filterkey) && $filterkey != '') {
7504
+			$objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1);
7505
+		}
7448 7506
 		$outval .= $objRef;
7449 7507
 
7450 7508
 		$opt .= "</option>\n";
@@ -7478,7 +7536,9 @@  discard block
 block discarded – undo
7478 7536
 		$out = '';
7479 7537
 
7480 7538
 		// check parameters
7481
-		if (is_null($ajaxoptions)) $ajaxoptions = array();
7539
+		if (is_null($ajaxoptions)) {
7540
+			$ajaxoptions = array();
7541
+		}
7482 7542
 
7483 7543
 		if (!empty($conf->use_javascript_ajax) && !empty($conf->global->TICKET_USE_SEARCH_TO_SELECT)) {
7484 7544
 			$placeholder = '';
@@ -7496,8 +7556,9 @@  discard block
 block discarded – undo
7496 7556
 
7497 7557
 			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/adherents/ajax/adherents.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
7498 7558
 
7499
-			if (empty($hidelabel)) $out .= $langs->trans("RefOrLabel").' : ';
7500
-			elseif ($hidelabel > 1) {
7559
+			if (empty($hidelabel)) {
7560
+				$out .= $langs->trans("RefOrLabel").' : ';
7561
+			} elseif ($hidelabel > 1) {
7501 7562
 				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"';
7502 7563
 				if ($hidelabel == 2) {
7503 7564
 					$out .= img_picto($langs->trans("Search"), 'search');
@@ -7513,8 +7574,11 @@  discard block
 block discarded – undo
7513 7574
 			$out .= $this->selectMembersList($selected, $htmlname, $filtertype, $limit, $filterkey, $status, 0, $showempty, $forcecombo, $morecss);
7514 7575
 		}
7515 7576
 
7516
-		if (empty($nooutput)) print $out;
7517
-		else return $out;
7577
+		if (empty($nooutput)) {
7578
+			print $out;
7579
+		} else {
7580
+			return $out;
7581
+		}
7518 7582
 	}
7519 7583
 
7520 7584
 	/**
@@ -7554,14 +7618,20 @@  discard block
 block discarded – undo
7554 7618
 			// For natural search
7555 7619
 			$scrit = explode(' ', $filterkey);
7556 7620
 			$i = 0;
7557
-			if (count($scrit) > 1) $sql .= "(";
7621
+			if (count($scrit) > 1) {
7622
+				$sql .= "(";
7623
+			}
7558 7624
 			foreach ($scrit as $crit) {
7559
-				if ($i > 0) $sql .= " AND ";
7625
+				if ($i > 0) {
7626
+					$sql .= " AND ";
7627
+				}
7560 7628
 				$sql .= "(p.firstname LIKE '".$this->db->escape($prefix.$crit)."%'";
7561 7629
 				$sql .= " OR p.lastname LIKE '".$this->db->escape($prefix.$crit)."%')";
7562 7630
 				$i++;
7563 7631
 			}
7564
-			if (count($scrit) > 1) $sql .= ")";
7632
+			if (count($scrit) > 1) {
7633
+				$sql .= ")";
7634
+			}
7565 7635
 			$sql .= ')';
7566 7636
 		}
7567 7637
 		if ($status != -1) {
@@ -7591,10 +7661,15 @@  discard block
 block discarded – undo
7591 7661
 			// Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
7592 7662
 			//if (!empty($conf->use_javascript_ajax) || $forcecombo) $textifempty='';
7593 7663
 			if (!empty($conf->global->PROJECT_USE_SEARCH_TO_SELECT)) {
7594
-				if ($showempty && !is_numeric($showempty)) $textifempty = $langs->trans($showempty);
7595
-				else $textifempty .= $langs->trans("All");
7664
+				if ($showempty && !is_numeric($showempty)) {
7665
+					$textifempty = $langs->trans($showempty);
7666
+				} else {
7667
+					$textifempty .= $langs->trans("All");
7668
+				}
7596 7669
 			} else {
7597
-				if ($showempty && !is_numeric($showempty)) $textifempty = $langs->trans($showempty);
7670
+				if ($showempty && !is_numeric($showempty)) {
7671
+					$textifempty = $langs->trans($showempty);
7672
+				}
7598 7673
 			}
7599 7674
 			if ($showempty) {
7600 7675
 				$out .= '<option value="-1" selected>'.$textifempty.'</option>';
@@ -7621,7 +7696,9 @@  discard block
 block discarded – undo
7621 7696
 
7622 7697
 			$this->db->free($result);
7623 7698
 
7624
-			if (empty($outputmode)) return $out;
7699
+			if (empty($outputmode)) {
7700
+				return $out;
7701
+			}
7625 7702
 			return $outarray;
7626 7703
 		} else {
7627 7704
 			dol_print_error($this->db);
Please login to merge, or discard this patch.
htdocs/core/modules/modStockTransfer.class.php 1 patch
Braces   +13 added lines, -4 removed lines patch added patch discarded remove patch
@@ -426,7 +426,10 @@  discard block
 block discarded – undo
426 426
 		global  $conf, $langs;
427 427
 
428 428
 		$result = $this->_load_tables('/install/mysql/tables/', 'stocktransfer');
429
-		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')
429
+		if ($result < 0) {
430
+			return -1;
431
+		}
432
+		// 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')
430 433
 
431 434
 		// Permissions
432 435
 		$this->remove($options);
@@ -437,17 +440,23 @@  discard block
 block discarded – undo
437 440
 		$resql = $this->db->query('SELECT rowid FROM '.MAIN_DB_PREFIX.'c_type_contact WHERE code = "STDEST" AND element = "StockTransfer" AND source = "internal"');
438 441
 		$res = $this->db->fetch_object($resql);
439 442
 		$nextid=$this->getNextId();
440
-		if (empty($res)) $this->db->query('INSERT INTO '.MAIN_DB_PREFIX.'c_type_contact(rowid, element, source, code, libelle, active, module, position) VALUES('.((int) $nextid).', "StockTransfer", "internal", "STRESP", "Responsable du transfert de stocks", 1, NULL, 0)');
443
+		if (empty($res)) {
444
+			$this->db->query('INSERT INTO '.MAIN_DB_PREFIX.'c_type_contact(rowid, element, source, code, libelle, active, module, position) VALUES('.((int) $nextid).', "StockTransfer", "internal", "STRESP", "Responsable du transfert de stocks", 1, NULL, 0)');
445
+		}
441 446
 
442 447
 		$resql = $this->db->query('SELECT rowid FROM '.MAIN_DB_PREFIX.'c_type_contact WHERE code = "STFROM" AND element = "StockTransfer" AND source = "external"');
443 448
 		$res = $this->db->fetch_object($resql);
444 449
 		$nextid=$this->getNextId();
445
-		if (empty($res)) $this->db->query('INSERT INTO '.MAIN_DB_PREFIX.'c_type_contact(rowid, element, source, code, libelle, active, module, position) VALUES('.((int) $nextid).', "StockTransfer", "external", "STFROM", "Contact expéditeur transfert de stocks", 1, NULL, 0)');
450
+		if (empty($res)) {
451
+			$this->db->query('INSERT INTO '.MAIN_DB_PREFIX.'c_type_contact(rowid, element, source, code, libelle, active, module, position) VALUES('.((int) $nextid).', "StockTransfer", "external", "STFROM", "Contact expéditeur transfert de stocks", 1, NULL, 0)');
452
+		}
446 453
 
447 454
 		$resql = $this->db->query('SELECT rowid FROM '.MAIN_DB_PREFIX.'c_type_contact WHERE code = "STDEST" AND element = "StockTransfer" AND source = "external"');
448 455
 		$res = $this->db->fetch_object($resql);
449 456
 		$nextid=$this->getNextId();
450
-		if (empty($res)) $this->db->query('INSERT INTO '.MAIN_DB_PREFIX.'c_type_contact(rowid, element, source, code, libelle, active, module, position) VALUES('.((int) $nextid).', "StockTransfer", "external", "STDEST", "Contact destinataire transfert de stocks", 1, NULL, 0)');
457
+		if (empty($res)) {
458
+			$this->db->query('INSERT INTO '.MAIN_DB_PREFIX.'c_type_contact(rowid, element, source, code, libelle, active, module, position) VALUES('.((int) $nextid).', "StockTransfer", "external", "STDEST", "Contact destinataire transfert de stocks", 1, NULL, 0)');
459
+		}
451 460
 
452 461
 		return $this->_init($sql, $options);
453 462
 	}
Please login to merge, or discard this patch.
htdocs/core/modules/expedition/doc/pdf_espadon.modules.php 1 patch
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -427,8 +427,12 @@  discard block
 block discarded – undo
427 427
 							while ($pagenb < $pageposafternote) {
428 428
 								$pdf->AddPage();
429 429
 								$pagenb++;
430
-								if (!empty($tplidx)) $pdf->useTemplate($tplidx);
431
-								if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs);
430
+								if (!empty($tplidx)) {
431
+									$pdf->useTemplate($tplidx);
432
+								}
433
+								if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
434
+									$this->_pagehead($pdf, $object, 0, $outputlangs);
435
+								}
432 436
 								// $this->_pagefoot($pdf,$object,$outputlangs,1);
433 437
 								$pdf->setTopMargin($tab_top_newpage);
434 438
 								// The only function to edit the bottom margin of current page to set it.
@@ -481,8 +485,12 @@  discard block
 block discarded – undo
481 485
 
482 486
 							// apply note frame to last page
483 487
 							$pdf->setPage($pageposafternote);
484
-							if (!empty($tplidx)) $pdf->useTemplate($tplidx);
485
-							if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs);
488
+							if (!empty($tplidx)) {
489
+								$pdf->useTemplate($tplidx);
490
+							}
491
+							if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
492
+								$this->_pagehead($pdf, $object, 0, $outputlangs);
493
+							}
486 494
 							$height_note = $posyafter - $tab_top_newpage;
487 495
 							$pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1);
488 496
 						} else // No pagebreak
@@ -499,8 +507,12 @@  discard block
 block discarded – undo
499 507
 								$pagenb++;
500 508
 								$pageposafternote++;
501 509
 								$pdf->setPage($pageposafternote);
502
-								if (!empty($tplidx)) $pdf->useTemplate($tplidx);
503
-								if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs);
510
+								if (!empty($tplidx)) {
511
+									$pdf->useTemplate($tplidx);
512
+								}
513
+								if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
514
+									$this->_pagehead($pdf, $object, 0, $outputlangs);
515
+								}
504 516
 
505 517
 								$posyafter = $tab_top_newpage;
506 518
 							}
Please login to merge, or discard this patch.
htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php 1 patch
Braces   +144 added lines, -55 removed lines patch added patch discarded remove patch
@@ -163,7 +163,10 @@  discard block
 block discarded – undo
163 163
 
164 164
 		// Get source company
165 165
 		$this->emetteur = $mysoc;
166
-		if (empty($this->emetteur->country_code)) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default, if was not defined
166
+		if (empty($this->emetteur->country_code)) {
167
+			$this->emetteur->country_code = substr($langs->defaultlang, -2);
168
+		}
169
+		// By default, if was not defined
167 170
 
168 171
 		// Define position of columns
169 172
 		$this->posxdesc = $this->marge_gauche + 1;
@@ -195,9 +198,13 @@  discard block
 block discarded – undo
195 198
 		// phpcs:enable
196 199
 		global $user, $langs, $conf, $mysoc, $db, $hookmanager, $nblines;
197 200
 
198
-		if (!is_object($outputlangs)) $outputlangs = $langs;
201
+		if (!is_object($outputlangs)) {
202
+			$outputlangs = $langs;
203
+		}
199 204
 		// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
200
-		if (!empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output = 'ISO-8859-1';
205
+		if (!empty($conf->global->MAIN_USE_FPDF)) {
206
+			$outputlangs->charset_output = 'ISO-8859-1';
207
+		}
201 208
 
202 209
 		// Load translation files required by the page
203 210
 		$outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products", "orders", "deliveries"));
@@ -223,7 +230,9 @@  discard block
 block discarded – undo
223 230
 			$objphoto = new Product($this->db);
224 231
 
225 232
 			for ($i = 0; $i < $nblines; $i++) {
226
-				if (empty($object->lines[$i]->fk_product)) continue;
233
+				if (empty($object->lines[$i]->fk_product)) {
234
+					continue;
235
+				}
227 236
 
228 237
 				$objphoto->fetch($object->lines[$i]->fk_product);
229 238
 				//var_dump($objphoto->ref);exit;
@@ -258,7 +267,9 @@  discard block
 block discarded – undo
258 267
 					}
259 268
 				}
260 269
 
261
-				if ($realpath && $arephoto) $realpatharray[$i] = $realpath;
270
+				if ($realpath && $arephoto) {
271
+					$realpatharray[$i] = $realpath;
272
+				}
262 273
 			}
263 274
 		}
264 275
 
@@ -343,7 +354,9 @@  discard block
 block discarded – undo
343 354
 
344 355
 				// New page
345 356
 				$pdf->AddPage();
346
-				if (!empty($tplidx)) $pdf->useTemplate($tplidx);
357
+				if (!empty($tplidx)) {
358
+					$pdf->useTemplate($tplidx);
359
+				}
347 360
 				$pagenb++;
348 361
 				$top_shift = $this->_pagehead($pdf, $object, 1, $outputlangs);
349 362
 				$pdf->SetFont('', '', $default_font_size - 1);
@@ -381,7 +394,9 @@  discard block
 block discarded – undo
381 394
 						$salereparray = $object->thirdparty->getSalesRepresentatives($user);
382 395
 						$salerepobj = new User($this->db);
383 396
 						$salerepobj->fetch($salereparray[0]['id']);
384
-						if (!empty($salerepobj->signature)) $notetoshow = dol_concatdesc($notetoshow, $salerepobj->signature);
397
+						if (!empty($salerepobj->signature)) {
398
+							$notetoshow = dol_concatdesc($notetoshow, $salerepobj->signature);
399
+						}
385 400
 					}
386 401
 				}
387 402
 
@@ -418,8 +433,12 @@  discard block
 block discarded – undo
418 433
 						while ($pagenb < $pageposafternote) {
419 434
 							$pdf->AddPage();
420 435
 							$pagenb++;
421
-							if (!empty($tplidx)) $pdf->useTemplate($tplidx);
422
-							if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs);
436
+							if (!empty($tplidx)) {
437
+								$pdf->useTemplate($tplidx);
438
+							}
439
+							if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
440
+								$this->_pagehead($pdf, $object, 0, $outputlangs);
441
+							}
423 442
 							// $this->_pagefoot($pdf,$object,$outputlangs,1);
424 443
 							$pdf->setTopMargin($tab_top_newpage);
425 444
 							// The only function to edit the bottom margin of current page to set it.
@@ -472,8 +491,12 @@  discard block
 block discarded – undo
472 491
 
473 492
 						// apply note frame to last page
474 493
 						$pdf->setPage($pageposafternote);
475
-						if (!empty($tplidx)) $pdf->useTemplate($tplidx);
476
-						if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs);
494
+						if (!empty($tplidx)) {
495
+							$pdf->useTemplate($tplidx);
496
+						}
497
+						if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
498
+							$this->_pagehead($pdf, $object, 0, $outputlangs);
499
+						}
477 500
 						$height_note = $posyafter - $tab_top_newpage;
478 501
 						$pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1);
479 502
 					} else // No pagebreak
@@ -490,8 +513,12 @@  discard block
 block discarded – undo
490 513
 							$pagenb++;
491 514
 							$pageposafternote++;
492 515
 							$pdf->setPage($pageposafternote);
493
-							if (!empty($tplidx)) $pdf->useTemplate($tplidx);
494
-							if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs);
516
+							if (!empty($tplidx)) {
517
+								$pdf->useTemplate($tplidx);
518
+							}
519
+							if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
520
+								$this->_pagehead($pdf, $object, 0, $outputlangs);
521
+							}
495 522
 
496 523
 							$posyafter = $tab_top_newpage;
497 524
 						}
@@ -524,7 +551,9 @@  discard block
 block discarded – undo
524 551
 
525 552
 					// Define size of image if we need it
526 553
 					$imglinesize = array();
527
-					if (!empty($realpatharray[$i])) $imglinesize = pdf_getSizeForImage($realpatharray[$i]);
554
+					if (!empty($realpatharray[$i])) {
555
+						$imglinesize = pdf_getSizeForImage($realpatharray[$i]);
556
+					}
528 557
 
529 558
 					$pdf->setTopMargin($tab_top_newpage);
530 559
 					$pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it.
@@ -538,15 +567,19 @@  discard block
 block discarded – undo
538 567
 						// We start with Photo of product line
539 568
 						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
540 569
 							$pdf->AddPage('', '', true);
541
-							if (!empty($tplidx)) $pdf->useTemplate($tplidx);
570
+							if (!empty($tplidx)) {
571
+								$pdf->useTemplate($tplidx);
572
+							}
542 573
 							$pdf->setPage($pageposbefore + 1);
543 574
 
544 575
 							$curY = $tab_top_newpage;
545 576
 
546 577
 							// Allows data in the first page if description is long enough to break in multiples pages
547
-							if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
548
-								$showpricebeforepagebreak = 1;
549
-							else $showpricebeforepagebreak = 0;
578
+							if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) {
579
+															$showpricebeforepagebreak = 1;
580
+							} else {
581
+								$showpricebeforepagebreak = 0;
582
+							}
550 583
 						}
551 584
 
552 585
 						if (!empty($this->cols['photo']) && isset($imglinesize['width']) && isset($imglinesize['height'])) {
@@ -581,16 +614,20 @@  discard block
 block discarded – undo
581 614
 							if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {	// There is no space left for total+free text
582 615
 								if ($i == ($nblines - 1)) {	// No more lines, and no space left to show total, so we create a new page
583 616
 									$pdf->AddPage('', '', true);
584
-									if (!empty($tplidx)) $pdf->useTemplate($tplidx);
617
+									if (!empty($tplidx)) {
618
+										$pdf->useTemplate($tplidx);
619
+									}
585 620
 									//if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs);
586 621
 									$pdf->setPage($pageposafter + 1);
587 622
 								}
588 623
 							} else {
589 624
 								// We found a page break
590 625
 								// Allows data in the first page if description is long enough to break in multiples pages
591
-								if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
592
-									$showpricebeforepagebreak = 1;
593
-								else $showpricebeforepagebreak = 0;
626
+								if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) {
627
+																	$showpricebeforepagebreak = 1;
628
+								} else {
629
+									$showpricebeforepagebreak = 0;
630
+								}
594 631
 							}
595 632
 						} else // No pagebreak
596 633
 						{
@@ -684,8 +721,11 @@  discard block
 block discarded – undo
684 721
 
685 722
 
686 723
 					// Collection of totals by value of vat in $this->tva["rate"] = total_tva
687
-					if (isModEnabled("multicurrency") && $object->multicurrency_tx != 1) $tvaligne = $object->lines[$i]->multicurrency_total_tva;
688
-					else $tvaligne = $object->lines[$i]->total_tva;
724
+					if (isModEnabled("multicurrency") && $object->multicurrency_tx != 1) {
725
+						$tvaligne = $object->lines[$i]->multicurrency_total_tva;
726
+					} else {
727
+						$tvaligne = $object->lines[$i]->total_tva;
728
+					}
689 729
 
690 730
 					$localtax1ligne = $object->lines[$i]->total_localtax1;
691 731
 					$localtax2ligne = $object->lines[$i]->total_localtax2;
@@ -694,9 +734,15 @@  discard block
 block discarded – undo
694 734
 					$localtax1_type = $object->lines[$i]->localtax1_type;
695 735
 					$localtax2_type = $object->lines[$i]->localtax2_type;
696 736
 
697
-					if ($object->remise_percent) $tvaligne -= ($tvaligne * $object->remise_percent) / 100;
698
-					if ($object->remise_percent) $localtax1ligne -= ($localtax1ligne * $object->remise_percent) / 100;
699
-					if ($object->remise_percent) $localtax2ligne -= ($localtax2ligne * $object->remise_percent) / 100;
737
+					if ($object->remise_percent) {
738
+						$tvaligne -= ($tvaligne * $object->remise_percent) / 100;
739
+					}
740
+					if ($object->remise_percent) {
741
+						$localtax1ligne -= ($localtax1ligne * $object->remise_percent) / 100;
742
+					}
743
+					if ($object->remise_percent) {
744
+						$localtax2ligne -= ($localtax2ligne * $object->remise_percent) / 100;
745
+					}
700 746
 
701 747
 					$vatrate = (string) $object->lines[$i]->tva_tx;
702 748
 
@@ -709,13 +755,19 @@  discard block
 block discarded – undo
709 755
 					}
710 756
 
711 757
 					// retrieve global local tax
712
-					if ($localtax1_type && $localtax1ligne != 0)
713
-						$this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne;
714
-					if ($localtax2_type && $localtax2ligne != 0)
715
-						$this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne;
758
+					if ($localtax1_type && $localtax1ligne != 0) {
759
+											$this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne;
760
+					}
761
+					if ($localtax2_type && $localtax2ligne != 0) {
762
+											$this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne;
763
+					}
716 764
 
717
-					if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate .= '*';
718
-					if (!isset($this->tva[$vatrate])) 				$this->tva[$vatrate] = 0;
765
+					if (($object->lines[$i]->info_bits & 0x01) == 0x01) {
766
+						$vatrate .= '*';
767
+					}
768
+					if (!isset($this->tva[$vatrate])) {
769
+						$this->tva[$vatrate] = 0;
770
+					}
719 771
 					$this->tva[$vatrate] += $tvaligne;
720 772
 
721 773
 					// Add line
@@ -740,7 +792,9 @@  discard block
 block discarded – undo
740 792
 						$pagenb++;
741 793
 						$pdf->setPage($pagenb);
742 794
 						$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
743
-						if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs);
795
+						if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
796
+							$this->_pagehead($pdf, $object, 0, $outputlangs);
797
+						}
744 798
 					}
745 799
 					if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
746 800
 						if ($pagenb == $pageposafter) {
@@ -751,16 +805,22 @@  discard block
 block discarded – undo
751 805
 						$this->_pagefoot($pdf, $object, $outputlangs, 1);
752 806
 						// New page
753 807
 						$pdf->AddPage();
754
-						if (!empty($tplidx)) $pdf->useTemplate($tplidx);
808
+						if (!empty($tplidx)) {
809
+							$pdf->useTemplate($tplidx);
810
+						}
755 811
 						$pagenb++;
756
-						if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs);
812
+						if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
813
+							$this->_pagehead($pdf, $object, 0, $outputlangs);
814
+						}
757 815
 					}
758 816
 				}
759 817
 
760 818
 				// Show square
761
-				if ($pagenb == $pageposbeforeprintlines)
762
-					$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, $hidetop, 0, $object->multicurrency_code);
763
-				else $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code);
819
+				if ($pagenb == $pageposbeforeprintlines) {
820
+									$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, $hidetop, 0, $object->multicurrency_code);
821
+				} else {
822
+					$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code);
823
+				}
764 824
 				$bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
765 825
 
766 826
 				// Affiche zone infos
@@ -780,7 +840,9 @@  discard block
 block discarded – undo
780 840
 
781 841
 				// Pied de page
782 842
 				$this->_pagefoot($pdf, $object, $outputlangs);
783
-				if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages();
843
+				if (method_exists($pdf, 'AliasNbPages')) {
844
+					$pdf->AliasNbPages();
845
+				}
784 846
 
785 847
 				$pdf->Close();
786 848
 
@@ -796,8 +858,9 @@  discard block
 block discarded – undo
796 858
 					$this->errors = $hookmanager->errors;
797 859
 				}
798 860
 
799
-				if (!empty($conf->global->MAIN_UMASK))
800
-					@chmod($file, octdec($conf->global->MAIN_UMASK));
861
+				if (!empty($conf->global->MAIN_UMASK)) {
862
+									@chmod($file, octdec($conf->global->MAIN_UMASK));
863
+				}
801 864
 
802 865
 				$this->result = array('fullpath'=>$file);
803 866
 
@@ -980,7 +1043,10 @@  discard block
 block discarded – undo
980 1043
 		if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR') {
981 1044
 			if (!empty($object->fk_account) || !empty($object->fk_bank) || getDolGlobalInt('FACTURE_RIB_NUMBER')) {
982 1045
 				$bankid = (empty($object->fk_account) ? $conf->global->FACTURE_RIB_NUMBER : $object->fk_account);
983
-				if (!empty($object->fk_bank)) $bankid = $object->fk_bank; // For backward compatibility when object->fk_account is forced with object->fk_bank
1046
+				if (!empty($object->fk_bank)) {
1047
+					$bankid = $object->fk_bank;
1048
+				}
1049
+				// For backward compatibility when object->fk_account is forced with object->fk_bank
984 1050
 				$account = new Account($this->db);
985 1051
 				$account->fetch($bankid);
986 1052
 
@@ -1066,7 +1132,9 @@  discard block
 block discarded – undo
1066 1132
 		//$depositsamount=$object->getSumDepositsUsed();
1067 1133
 		//print "x".$creditnoteamount."-".$depositsamount;exit;
1068 1134
 		$resteapayer = price2num($total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT');
1069
-		if (!empty($object->paye)) $resteapayer = 0;
1135
+		if (!empty($object->paye)) {
1136
+			$resteapayer = 0;
1137
+		}
1070 1138
 
1071 1139
 		if ($deja_regle > 0) {
1072 1140
 			// Already paid + Deposits
@@ -1114,7 +1182,9 @@  discard block
 block discarded – undo
1114 1182
 
1115 1183
 		// Force to disable hidetop and hidebottom
1116 1184
 		$hidebottom = 0;
1117
-		if ($hidetop) $hidetop = -1;
1185
+		if ($hidetop) {
1186
+			$hidetop = -1;
1187
+		}
1118 1188
 
1119 1189
 		$currency = !empty($currency) ? $currency : $conf->currency;
1120 1190
 		$default_font_size = pdf_getPDFFontSize($outputlangs);
@@ -1189,7 +1259,9 @@  discard block
 block discarded – undo
1189 1259
 		if (!getDolGlobalInt('PDF_DISABLE_MYCOMPANY_LOGO')) {
1190 1260
 			if ($this->emetteur->logo) {
1191 1261
 				$logodir = $conf->mycompany->dir_output;
1192
-				if (!empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity];
1262
+				if (!empty($conf->mycompany->multidir_output[$object->entity])) {
1263
+					$logodir = $conf->mycompany->multidir_output[$object->entity];
1264
+				}
1193 1265
 				if (!getDolGlobalInt('MAIN_PDF_USE_LARGE_LOGO')) {
1194 1266
 					$logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small;
1195 1267
 				} else {
@@ -1330,18 +1402,28 @@  discard block
 block discarded – undo
1330 1402
 				$result = $object->fetch_contact($arrayidcontact[0]);
1331 1403
 			}
1332 1404
 
1333
-			if ($usecontact) $thirdparty = $object->contact;
1334
-			else $thirdparty = $this->emetteur;
1405
+			if ($usecontact) {
1406
+				$thirdparty = $object->contact;
1407
+			} else {
1408
+				$thirdparty = $this->emetteur;
1409
+			}
1335 1410
 
1336
-			if (!empty($thirdparty)) $carac_emetteur_name = pdfBuildThirdpartyName($thirdparty, $outputlangs);
1411
+			if (!empty($thirdparty)) {
1412
+				$carac_emetteur_name = pdfBuildThirdpartyName($thirdparty, $outputlangs);
1413
+			}
1337 1414
 
1338
-			if ($usecontact) $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, $object->contact, 1, 'targetwithdetails', $object);
1339
-			else $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object);
1415
+			if ($usecontact) {
1416
+				$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, $object->contact, 1, 'targetwithdetails', $object);
1417
+			} else {
1418
+				$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object);
1419
+			}
1340 1420
 
1341 1421
 			// Show sender
1342 1422
 			$posy = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42;
1343 1423
 			$posx = $this->marge_gauche;
1344
-			if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->page_largeur - $this->marge_droite - 80;
1424
+			if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
1425
+				$posx = $this->page_largeur - $this->marge_droite - 80;
1426
+			}
1345 1427
 
1346 1428
 			$hautcadre = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 38 : 40;
1347 1429
 			$widthrecbox = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 82;
@@ -1385,16 +1467,23 @@  discard block
 block discarded – undo
1385 1467
 				$thirdparty = $object->thirdparty;
1386 1468
 			}
1387 1469
 
1388
-			if (!empty($thirdparty)) $carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs);
1470
+			if (!empty($thirdparty)) {
1471
+				$carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs);
1472
+			}
1389 1473
 
1390 1474
 			$carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, (!empty($object->contact) ? $object->contact : null), $usecontact, 'targetwithdetails', $object);
1391 1475
 
1392 1476
 			// Show recipient
1393 1477
 			$widthrecbox = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 100;
1394
-			if ($this->page_largeur < 210) $widthrecbox = 84; // To work with US executive format
1478
+			if ($this->page_largeur < 210) {
1479
+				$widthrecbox = 84;
1480
+			}
1481
+			// To work with US executive format
1395 1482
 			$posy = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42;
1396 1483
 			$posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
1397
-			if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->marge_gauche;
1484
+			if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
1485
+				$posx = $this->marge_gauche;
1486
+			}
1398 1487
 
1399 1488
 			// Show recipient frame
1400 1489
 			$pdf->SetTextColor(0, 0, 0);
Please login to merge, or discard this patch.
htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php 1 patch
Braces   +145 added lines, -55 removed lines patch added patch discarded remove patch
@@ -140,7 +140,10 @@  discard block
 block discarded – undo
140 140
 
141 141
 		// Get source company
142 142
 		$this->emetteur = $mysoc;
143
-		if (!$this->emetteur->country_code) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined
143
+		if (!$this->emetteur->country_code) {
144
+			$this->emetteur->country_code = substr($langs->defaultlang, -2);
145
+		}
146
+		// By default if not defined
144 147
 
145 148
 		// Define position of columns
146 149
 		$this->posxdesc = $this->marge_gauche + 1;
@@ -159,7 +162,9 @@  discard block
 block discarded – undo
159 162
 			$this->posxtotalht = $this->page_largeur - $this->marge_droite - 20;
160 163
 		}*/
161 164
 
162
-		if (!empty($conf->global->STOCKTRANSFER_PDF_HIDE_WEIGHT_AND_VOLUME)) $this->posxweightvol = $this->posxqty;
165
+		if (!empty($conf->global->STOCKTRANSFER_PDF_HIDE_WEIGHT_AND_VOLUME)) {
166
+			$this->posxweightvol = $this->posxqty;
167
+		}
163 168
 
164 169
 		$this->posxpicture = $this->posxweightvol - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images
165 170
 		//var_dump($this->posxpicture, $this->posxweightvol);exit;
@@ -200,9 +205,13 @@  discard block
 block discarded – undo
200 205
 
201 206
 		$this->atLeastOneBatch = $this->atLeastOneBatch($object);
202 207
 
203
-		if (!is_object($outputlangs)) $outputlangs = $langs;
208
+		if (!is_object($outputlangs)) {
209
+			$outputlangs = $langs;
210
+		}
204 211
 		// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
205
-		if (!empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output = 'ISO-8859-1';
212
+		if (!empty($conf->global->MAIN_USE_FPDF)) {
213
+			$outputlangs->charset_output = 'ISO-8859-1';
214
+		}
206 215
 
207 216
 		// Load traductions files required by page
208 217
 		$outputlangs->loadLangs(array("main", "bills", "products", "dict", "companies", "propal", "deliveries", "sendings", "productbatch", "stocks", "stocktransfer@stocktransfer"));
@@ -215,7 +224,9 @@  discard block
 block discarded – undo
215 224
 			$objphoto = new Product($this->db);
216 225
 
217 226
 			for ($i = 0; $i < $nblines; $i++) {
218
-				if (empty($object->lines[$i]->fk_product)) continue;
227
+				if (empty($object->lines[$i]->fk_product)) {
228
+					continue;
229
+				}
219 230
 
220 231
 				$objphoto = new Product($this->db);
221 232
 				$objphoto->fetch($object->lines[$i]->fk_product);
@@ -245,16 +256,23 @@  discard block
 block discarded – undo
245 256
 					break;
246 257
 				}
247 258
 
248
-				if ($realpath) $realpatharray[$i] = $realpath;
259
+				if ($realpath) {
260
+					$realpatharray[$i] = $realpath;
261
+				}
249 262
 			}
250 263
 		}
251 264
 
252
-		if (count($realpatharray) == 0) $this->posxpicture = $this->posxweightvol;
265
+		if (count($realpatharray) == 0) {
266
+			$this->posxpicture = $this->posxweightvol;
267
+		}
253 268
 
254 269
 
255 270
 		if (!empty($this->atLeastOneBatch)) {
256 271
 			$this->posxpicture = $this->posxlot;
257
-			if (!empty($conf->global->MAIN_GENERATE_STOCKTRANSFER_WITH_PICTURE)) $this->posxpicture -= (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images
272
+			if (!empty($conf->global->MAIN_GENERATE_STOCKTRANSFER_WITH_PICTURE)) {
273
+				$this->posxpicture -= (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH);
274
+			}
275
+			// width of images
258 276
 		}
259 277
 
260 278
 		if ($conf->stocktransfer->dir_output) {
@@ -294,7 +312,9 @@  discard block
 block discarded – undo
294 312
 				$heightforinfotot = 8; // Height reserved to output the info and total part
295 313
 				$heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page
296 314
 				$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
297
-				if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6;
315
+				if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) {
316
+					$heightforfooter += 6;
317
+				}
298 318
 				$pdf->SetAutoPageBreak(1, 0);
299 319
 
300 320
 				if (class_exists('TCPDF')) {
@@ -312,7 +332,9 @@  discard block
 block discarded – undo
312 332
 				$pagenb = 0;
313 333
 				$pdf->SetDrawColor(128, 128, 128);
314 334
 
315
-				if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages();
335
+				if (method_exists($pdf, 'AliasNbPages')) {
336
+					$pdf->AliasNbPages();
337
+				}
316 338
 
317 339
 				$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
318 340
 				$pdf->SetSubject($outputlangs->transnoentities("Shipment"));
@@ -327,7 +349,9 @@  discard block
 block discarded – undo
327 349
 
328 350
 				// New page
329 351
 				$pdf->AddPage();
330
-				if (!empty($tplidx)) $pdf->useTemplate($tplidx);
352
+				if (!empty($tplidx)) {
353
+					$pdf->useTemplate($tplidx);
354
+				}
331 355
 				$pagenb++;
332 356
 				$this->_pagehead($pdf, $object, 1, $outputlangs);
333 357
 				$pdf->SetFont('', '', $default_font_size - 1);
@@ -379,7 +403,9 @@  discard block
 block discarded – undo
379 403
 								// Get code using getLabelFromKey
380 404
 								$code = $outputlangs->getLabelFromKey($this->db, $object->shipping_method_id, 'c_shipment_mode', 'rowid', 'code');
381 405
 								$label = '';
382
-								if ($object->tracking_url != $object->tracking_number) $label .= $outputlangs->trans("LinkToTrackYourPackage")."<br>";
406
+								if ($object->tracking_url != $object->tracking_number) {
407
+									$label .= $outputlangs->trans("LinkToTrackYourPackage")."<br>";
408
+								}
383 409
 								$label .= $outputlangs->trans("SendingMethod").": ".$outputlangs->trans("SendingMethod".strtoupper($code));
384 410
 								//var_dump($object->tracking_url != $object->tracking_number);exit;
385 411
 								if ($object->tracking_url != $object->tracking_number) {
@@ -426,7 +452,9 @@  discard block
 block discarded – undo
426 452
 
427 453
 					// Define size of image if we need it
428 454
 					$imglinesize = array();
429
-					if (!empty($realpatharray[$i])) $imglinesize = pdf_getSizeForImage($realpatharray[$i]);
455
+					if (!empty($realpatharray[$i])) {
456
+						$imglinesize = pdf_getSizeForImage($realpatharray[$i]);
457
+					}
430 458
 
431 459
 					$pdf->setTopMargin($tab_top_newpage);
432 460
 					$pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it.
@@ -439,16 +467,22 @@  discard block
 block discarded – undo
439 467
 					// We start with Photo of product line
440 468
 					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
441 469
 						$pdf->AddPage('', '', true);
442
-						if (!empty($tplidx)) $pdf->useTemplate($tplidx);
443
-						if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs);
470
+						if (!empty($tplidx)) {
471
+							$pdf->useTemplate($tplidx);
472
+						}
473
+						if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
474
+							$this->_pagehead($pdf, $object, 0, $outputlangs);
475
+						}
444 476
 						$pdf->setPage($pageposbefore + 1);
445 477
 
446 478
 						$curY = $tab_top_newpage;
447 479
 
448 480
 						// Allows data in the first page if description is long enough to break in multiples pages
449
-						if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
450
-							$showpricebeforepagebreak = 1;
451
-						else $showpricebeforepagebreak = 0;
481
+						if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) {
482
+													$showpricebeforepagebreak = 1;
483
+						} else {
484
+							$showpricebeforepagebreak = 0;
485
+						}
452 486
 					}
453 487
 
454 488
 					if (isset($imglinesize['width']) && isset($imglinesize['height'])) {
@@ -495,17 +529,23 @@  discard block
 block discarded – undo
495 529
 						if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {	// There is no space left for total+free text
496 530
 							if ($i == ($nblines - 1)) {	// No more lines, and no space left to show total, so we create a new page
497 531
 								$pdf->AddPage('', '', true);
498
-								if (!empty($tplidx)) $pdf->useTemplate($tplidx);
499
-								if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs);
532
+								if (!empty($tplidx)) {
533
+									$pdf->useTemplate($tplidx);
534
+								}
535
+								if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
536
+									$this->_pagehead($pdf, $object, 0, $outputlangs);
537
+								}
500 538
 								$pdf->setPage($pageposafter + 1);
501 539
 							}
502 540
 						} else {
503 541
 							// We found a page break
504 542
 
505 543
 							// Allows data in the first page if description is long enough to break in multiples pages
506
-							if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
507
-								$showpricebeforepagebreak = 1;
508
-							else $showpricebeforepagebreak = 0;
544
+							if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) {
545
+															$showpricebeforepagebreak = 1;
546
+							} else {
547
+								$showpricebeforepagebreak = 0;
548
+							}
509 549
 						}
510 550
 					} else // No pagebreak
511 551
 					{
@@ -562,8 +602,9 @@  discard block
 block discarded – undo
562 602
 
563 603
 					// Warehouse source
564 604
 					$wh_source = new Entrepot($db);
565
-					if (!empty($TCacheEntrepots[$object->lines[$i]->fk_warehouse_source])) $wh_source = $TCacheEntrepots[$object->lines[$i]->fk_warehouse_source];
566
-					else {
605
+					if (!empty($TCacheEntrepots[$object->lines[$i]->fk_warehouse_source])) {
606
+						$wh_source = $TCacheEntrepots[$object->lines[$i]->fk_warehouse_source];
607
+					} else {
567 608
 						$wh_source->fetch($object->lines[$i]->fk_warehouse_source);
568 609
 						$TCacheEntrepots[$object->lines[$i]->fk_warehouse_source] = $wh_source;
569 610
 					}
@@ -572,8 +613,9 @@  discard block
 block discarded – undo
572 613
 
573 614
 					// Warehouse destination
574 615
 					$wh_destination = new Entrepot($db);
575
-					if (!empty($TCacheEntrepots[$object->lines[$i]->fk_warehouse_destination])) $wh_destination = $TCacheEntrepots[$object->lines[$i]->fk_warehouse_destination];
576
-					else {
616
+					if (!empty($TCacheEntrepots[$object->lines[$i]->fk_warehouse_destination])) {
617
+						$wh_destination = $TCacheEntrepots[$object->lines[$i]->fk_warehouse_destination];
618
+					} else {
577 619
 						$wh_destination->fetch($object->lines[$i]->fk_warehouse_destination);
578 620
 						$TCacheEntrepots[$object->lines[$i]->fk_warehouse_destination] = $wh_destination;
579 621
 					}
@@ -589,7 +631,9 @@  discard block
 block discarded – undo
589 631
 					}
590 632
 
591 633
 					$nexY += 3;
592
-					if ($weighttxt && $voltxt) $nexY += 2;
634
+					if ($weighttxt && $voltxt) {
635
+						$nexY += 2;
636
+					}
593 637
 
594 638
 					// Add line
595 639
 					if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) {
@@ -612,7 +656,9 @@  discard block
 block discarded – undo
612 656
 						$pagenb++;
613 657
 						$pdf->setPage($pagenb);
614 658
 						$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
615
-						if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs);
659
+						if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
660
+							$this->_pagehead($pdf, $object, 0, $outputlangs);
661
+						}
616 662
 					}
617 663
 					if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
618 664
 						if ($pagenb == 1) {
@@ -623,9 +669,13 @@  discard block
 block discarded – undo
623 669
 						$this->_pagefoot($pdf, $object, $outputlangs, 1);
624 670
 						// New page
625 671
 						$pdf->AddPage();
626
-						if (!empty($tplidx)) $pdf->useTemplate($tplidx);
672
+						if (!empty($tplidx)) {
673
+							$pdf->useTemplate($tplidx);
674
+						}
627 675
 						$pagenb++;
628
-						if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs);
676
+						if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
677
+							$this->_pagehead($pdf, $object, 0, $outputlangs);
678
+						}
629 679
 					}
630 680
 				}
631 681
 
@@ -643,7 +693,9 @@  discard block
 block discarded – undo
643 693
 
644 694
 				// Pied de page
645 695
 				$this->_pagefoot($pdf, $object, $outputlangs);
646
-				if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages();
696
+				if (method_exists($pdf, 'AliasNbPages')) {
697
+					$pdf->AliasNbPages();
698
+				}
647 699
 
648 700
 				$pdf->Close();
649 701
 
@@ -659,8 +711,9 @@  discard block
 block discarded – undo
659 711
 					$this->errors = $hookmanager->errors;
660 712
 				}
661 713
 
662
-				if (!empty($conf->global->MAIN_UMASK))
663
-					@chmod($file, octdec($conf->global->MAIN_UMASK));
714
+				if (!empty($conf->global->MAIN_UMASK)) {
715
+									@chmod($file, octdec($conf->global->MAIN_UMASK));
716
+				}
664 717
 
665 718
 				$this->result = array('fullpath'=>$file);
666 719
 
@@ -706,8 +759,11 @@  discard block
 block discarded – undo
706 759
 		{
707 760
 			$col2x-=20;
708 761
 		}*/
709
-		if (empty($conf->global->STOCKTRANSFER_PDF_HIDE_ORDERED)) $largcol2 = ($this->posxwarehousesource - $this->posxqty);
710
-		else $largcol2 = ($this->posxwarehousedestination - $this->posxqty);
762
+		if (empty($conf->global->STOCKTRANSFER_PDF_HIDE_ORDERED)) {
763
+			$largcol2 = ($this->posxwarehousesource - $this->posxqty);
764
+		} else {
765
+			$largcol2 = ($this->posxwarehousedestination - $this->posxqty);
766
+		}
711 767
 
712 768
 		$useborder = 0;
713 769
 		$index = 0;
@@ -720,20 +776,29 @@  discard block
 block discarded – undo
720 776
 		$totalWeight = $tmparray['weight'];
721 777
 		$totalVolume = $tmparray['volume'];
722 778
 		$totalQty = 0;
723
-		if (!empty($object->lines))
724
-		foreach ($object->lines as $line) {
779
+		if (!empty($object->lines)) {
780
+				foreach ($object->lines as $line) {
725 781
 			$totalQty+=$line->qty;
726 782
 		}
783
+		}
727 784
 		// Set trueVolume and volume_units not currently stored into database
728 785
 		if ($object->trueWidth && $object->trueHeight && $object->trueDepth) {
729 786
 			$object->trueVolume = price(($object->trueWidth * $object->trueHeight * $object->trueDepth), 0, $outputlangs, 0, 0);
730 787
 			$object->volume_units = $object->size_units * 3;
731 788
 		}
732 789
 
733
-		if ($totalWeight != '') $totalWeighttoshow = showDimensionInBestUnit($totalWeight, 0, "weight", $outputlangs);
734
-		if ($totalVolume != '') $totalVolumetoshow = showDimensionInBestUnit($totalVolume, 0, "volume", $outputlangs);
735
-		if ($object->trueWeight) $totalWeighttoshow = showDimensionInBestUnit($object->trueWeight, $object->weight_units, "weight", $outputlangs);
736
-		if ($object->trueVolume) $totalVolumetoshow = showDimensionInBestUnit($object->trueVolume, $object->volume_units, "volume", $outputlangs);
790
+		if ($totalWeight != '') {
791
+			$totalWeighttoshow = showDimensionInBestUnit($totalWeight, 0, "weight", $outputlangs);
792
+		}
793
+		if ($totalVolume != '') {
794
+			$totalVolumetoshow = showDimensionInBestUnit($totalVolume, 0, "volume", $outputlangs);
795
+		}
796
+		if ($object->trueWeight) {
797
+			$totalWeighttoshow = showDimensionInBestUnit($object->trueWeight, $object->weight_units, "weight", $outputlangs);
798
+		}
799
+		if ($object->trueVolume) {
800
+			$totalVolumetoshow = showDimensionInBestUnit($object->trueVolume, $object->volume_units, "volume", $outputlangs);
801
+		}
737 802
 
738 803
 		$pdf->SetFillColor(255, 255, 255);
739 804
 		$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
@@ -766,7 +831,9 @@  discard block
 block discarded – undo
766 831
 
767 832
 				$index++;
768 833
 			}
769
-			if (!$totalWeighttoshow && !$totalVolumetoshow) $index++;
834
+			if (!$totalWeighttoshow && !$totalVolumetoshow) {
835
+				$index++;
836
+			}
770 837
 		}
771 838
 
772 839
 		$pdf->SetTextColor(0, 0, 0);
@@ -794,7 +861,9 @@  discard block
 block discarded – undo
794 861
 
795 862
 		// Force to disable hidetop and hidebottom
796 863
 		$hidebottom = 0;
797
-		if ($hidetop) $hidetop = -1;
864
+		if ($hidetop) {
865
+			$hidetop = -1;
866
+		}
798 867
 
799 868
 		$default_font_size = pdf_getPDFFontSize($outputlangs);
800 869
 
@@ -880,7 +949,9 @@  discard block
 block discarded – undo
880 949
 
881 950
 		$atLeastOneBatch = false;
882 951
 
883
-		if (empty($conf->productbatch->enabled)) return false;
952
+		if (empty($conf->productbatch->enabled)) {
953
+			return false;
954
+		}
884 955
 
885 956
 		foreach ($object->lines as $line) {
886 957
 			if (!empty($line->batch)) {
@@ -1042,7 +1113,9 @@  discard block
 block discarded – undo
1042 1113
 
1043 1114
 				$pdf->SetFont('', '', $default_font_size - 2);
1044 1115
 				$text = $linkedobject->ref;
1045
-				if ($linkedobject->ref_client) $text .= ' ('.$linkedobject->ref_client.')';
1116
+				if ($linkedobject->ref_client) {
1117
+					$text .= ' ('.$linkedobject->ref_client.')';
1118
+				}
1046 1119
 				$Yoff = $Yoff + 8;
1047 1120
 				$pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff);
1048 1121
 				$pdf->MultiCell($w, 2, $outputlangs->transnoentities("RefOrder")." : ".$outputlangs->transnoentities($text), 0, 'R');
@@ -1067,18 +1140,28 @@  discard block
 block discarded – undo
1067 1140
 				$result = $object->fetch_contact($arrayidcontact[0]);
1068 1141
 			}
1069 1142
 
1070
-			if ($usecontact) $thirdparty = $object->contact;
1071
-			else $thirdparty = $this->emetteur;
1143
+			if ($usecontact) {
1144
+				$thirdparty = $object->contact;
1145
+			} else {
1146
+				$thirdparty = $this->emetteur;
1147
+			}
1072 1148
 
1073
-			if (!empty($thirdparty)) $carac_emetteur_name = pdfBuildThirdpartyName($thirdparty, $outputlangs);
1149
+			if (!empty($thirdparty)) {
1150
+				$carac_emetteur_name = pdfBuildThirdpartyName($thirdparty, $outputlangs);
1151
+			}
1074 1152
 
1075
-			if ($usecontact) $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, $object->contact, 1, 'targetwithdetails', $object);
1076
-			else $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object);
1153
+			if ($usecontact) {
1154
+				$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, $object->contact, 1, 'targetwithdetails', $object);
1155
+			} else {
1156
+				$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object);
1157
+			}
1077 1158
 
1078 1159
 			// Show sender
1079 1160
 			$posy = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42;
1080 1161
 			$posx = $this->marge_gauche;
1081
-			if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->page_largeur - $this->marge_droite - 80;
1162
+			if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
1163
+				$posx = $this->page_largeur - $this->marge_droite - 80;
1164
+			}
1082 1165
 
1083 1166
 			$hautcadre = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 38 : 40;
1084 1167
 			$widthrecbox = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 82;
@@ -1122,16 +1205,23 @@  discard block
 block discarded – undo
1122 1205
 				$thirdparty = $object->thirdparty;
1123 1206
 			}
1124 1207
 
1125
-			if (!empty($thirdparty)) $carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs);
1208
+			if (!empty($thirdparty)) {
1209
+				$carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs);
1210
+			}
1126 1211
 
1127 1212
 			$carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, (!empty($object->contact) ? $object->contact : null), $usecontact, 'targetwithdetails', $object);
1128 1213
 
1129 1214
 			// Show recipient
1130 1215
 			$widthrecbox = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 100;
1131
-			if ($this->page_largeur < 210) $widthrecbox = 84; // To work with US executive format
1216
+			if ($this->page_largeur < 210) {
1217
+				$widthrecbox = 84;
1218
+			}
1219
+			// To work with US executive format
1132 1220
 			$posy = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42;
1133 1221
 			$posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
1134
-			if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->marge_gauche;
1222
+			if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
1223
+				$posx = $this->marge_gauche;
1224
+			}
1135 1225
 
1136 1226
 			// Show recipient frame
1137 1227
 			$pdf->SetTextColor(0, 0, 0);
Please login to merge, or discard this patch.
htdocs/projet/list.php 1 patch
Braces   +8 added lines, -3 removed lines patch added patch discarded remove patch
@@ -397,8 +397,11 @@  discard block
 block discarded – undo
397 397
 $resql = $db->query($sql);
398 398
 if ($resql) {
399 399
 	while ($obj = $db->fetch_object($resql)) {
400
-		if ($obj->source == 'internal') $listofprojectcontacttype[$obj->rowid] = $obj->code;
401
-		else $listofprojectcontacttypeexternal[$obj->rowid] = $obj->code;
400
+		if ($obj->source == 'internal') {
401
+			$listofprojectcontacttype[$obj->rowid] = $obj->code;
402
+		} else {
403
+			$listofprojectcontacttypeexternal[$obj->rowid] = $obj->code;
404
+		}
402 405
 	}
403 406
 } else {
404 407
 	dol_print_error($db);
@@ -1759,7 +1762,9 @@  discard block
 block discarded – undo
1759 1762
 			print '<td class="center">';
1760 1763
 			print $obj->email_msgid;
1761 1764
 			print '</td>';
1762
-			if (!$i) $totalarray['nbfield']++;
1765
+			if (!$i) {
1766
+				$totalarray['nbfield']++;
1767
+			}
1763 1768
 		}
1764 1769
 		// Import key
1765 1770
 		if (!empty($arrayfields['p.import_key']['checked'])) {
Please login to merge, or discard this patch.
htdocs/projet/tasks/time.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -788,7 +788,9 @@  discard block
 block discarded – undo
788 788
 if ($action == 'confirm_generateinter') {
789 789
 	$langs->load('interventions');
790 790
 
791
-	if (!empty($projectstatic->socid)) $projectstatic->fetch_thirdparty();
791
+	if (!empty($projectstatic->socid)) {
792
+		$projectstatic->fetch_thirdparty();
793
+	}
792 794
 
793 795
 	if (!($projectstatic->thirdparty->id > 0)) {
794 796
 		setEventMessages($langs->trans("ThirdPartyRequiredToGenerateIntervention"), null, 'errors');
@@ -1561,7 +1563,9 @@  discard block
 block discarded – undo
1561 1563
 			if (empty($search_user)) {
1562 1564
 				$search_user = $user->id;
1563 1565
 			}
1564
-			if ($search_user > 0) $sql .= " AND t.fk_user = ".((int) $search_user);
1566
+			if ($search_user > 0) {
1567
+				$sql .= " AND t.fk_user = ".((int) $search_user);
1568
+			}
1565 1569
 		}
1566 1570
 
1567 1571
 		if ($search_note) {
Please login to merge, or discard this patch.