Completed
Branch develop (404fac)
by
unknown
20:18
created
htdocs/product/inventory/inventory.php 1 patch
Braces   +23 added lines, -9 removed lines patch added patch discarded remove patch
@@ -198,7 +198,9 @@  discard block
 block discarded – undo
198 198
 						//$inventorycode = 'INV'.$object->id;
199 199
 						$inventorycode = 'INV-'.$object->ref;
200 200
 						$price = 0;
201
-						if (!empty($line->pmp_real) && !empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) $price = $line->pmp_real;
201
+						if (!empty($line->pmp_real) && !empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) {
202
+							$price = $line->pmp_real;
203
+						}
202 204
 
203 205
 						$idstockmove = $stockmovment->_create($user, $line->fk_product, $line->fk_warehouse, $stock_movement_qty, $movement_type, $price, $langs->trans('LabelOfInventoryMovemement', $object->ref), $inventorycode, $datemovement, '', '', $line->batch);
204 206
 						if ($idstockmove < 0) {
@@ -1083,8 +1085,11 @@  discard block
 block discarded – undo
1083 1085
 
1084 1086
 			if (!empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) {
1085 1087
 				//PMP Expected
1086
-				if (!empty($obj->pmp_expected)) $pmp_expected = $obj->pmp_expected;
1087
-				else $pmp_expected = $product_static->pmp;
1088
+				if (!empty($obj->pmp_expected)) {
1089
+					$pmp_expected = $obj->pmp_expected;
1090
+				} else {
1091
+					$pmp_expected = $product_static->pmp;
1092
+				}
1088 1093
 				$pmp_valuation = $pmp_expected * $valuetoshow;
1089 1094
 				print '<td class="right">';
1090 1095
 				print price($pmp_expected);
@@ -1105,8 +1110,11 @@  discard block
 block discarded – undo
1105 1110
 				print '<td class="right">';
1106 1111
 
1107 1112
 
1108
-				if (!empty($obj->pmp_real)) $pmp_real = $obj->pmp_real;
1109
-				else $pmp_real = $product_static->pmp;
1113
+				if (!empty($obj->pmp_real)) {
1114
+					$pmp_real = $obj->pmp_real;
1115
+				} else {
1116
+					$pmp_real = $product_static->pmp;
1117
+				}
1110 1118
 				$pmp_valuation_real = $pmp_real * $qty_view;
1111 1119
 				print '<input type="text" class="maxwidth75 right realpmp'.$obj->fk_product.'" name="realpmp_'.$obj->rowid.'" id="id_'.$obj->rowid.'_input_pmp" value="'.price2num($pmp_real).'">';
1112 1120
 				print '</td>';
@@ -1134,8 +1142,11 @@  discard block
 block discarded – undo
1134 1142
 		} else {
1135 1143
 			if (!empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) {
1136 1144
 				//PMP Expected
1137
-				if (!empty($obj->pmp_expected)) $pmp_expected = $obj->pmp_expected;
1138
-				else $pmp_expected = $product_static->pmp;
1145
+				if (!empty($obj->pmp_expected)) {
1146
+					$pmp_expected = $obj->pmp_expected;
1147
+				} else {
1148
+					$pmp_expected = $product_static->pmp;
1149
+				}
1139 1150
 				$pmp_valuation = $pmp_expected * $valuetoshow;
1140 1151
 				print '<td class="right">';
1141 1152
 				print price($pmp_expected);
@@ -1150,8 +1161,11 @@  discard block
 block discarded – undo
1150 1161
 
1151 1162
 				//PMP Real
1152 1163
 				print '<td class="right">';
1153
-				if (!empty($obj->pmp_real)) $pmp_real = $obj->pmp_real;
1154
-				else $pmp_real = $product_static->pmp;
1164
+				if (!empty($obj->pmp_real)) {
1165
+					$pmp_real = $obj->pmp_real;
1166
+				} else {
1167
+					$pmp_real = $product_static->pmp;
1168
+				}
1155 1169
 				$pmp_valuation_real = $pmp_real * $obj->qty_view;
1156 1170
 				print price($pmp_real);
1157 1171
 				print '</td>';
Please login to merge, or discard this patch.
htdocs/product/stock/stocktransfer/stocktransfer_list.php 1 patch
Braces   +151 added lines, -57 removed lines patch added patch discarded remove patch
@@ -69,28 +69,39 @@  discard block
 block discarded – undo
69 69
 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
70 70
 
71 71
 // Default sort order (if not yet defined by previous GETPOST)
72
-if (!$sortfield) $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition.
73
-if (!$sortorder) $sortorder = "ASC";
72
+if (!$sortfield) {
73
+	$sortfield = "t.".key($object->fields);
74
+}
75
+// Set here default search field. By default 1st field in definition.
76
+if (!$sortorder) {
77
+	$sortorder = "ASC";
78
+}
74 79
 
75 80
 // Initialize array of search criterias
76 81
 $search_all = GETPOST('search_all', 'alphanohtml') ? trim(GETPOST('search_all', 'alphanohtml')) : trim(GETPOST('sall', 'alphanohtml'));
77 82
 $search = array();
78 83
 foreach ($object->fields as $key => $val) {
79
-	if (GETPOST('search_'.$key, 'alpha') !== '') $search[$key] = GETPOST('search_'.$key, 'alpha');
80
-}
84
+	if (GETPOST('search_'.$key, 'alpha') !== '') {
85
+		$search[$key] = GETPOST('search_'.$key, 'alpha');
86
+	}
87
+	}
81 88
 
82 89
 // List of fields to search into when doing a "search in all"
83 90
 $fieldstosearchall = array();
84 91
 foreach ($object->fields as $key => $val) {
85
-	if ($val['searchall']) $fieldstosearchall['t.'.$key] = $val['label'];
86
-}
92
+	if ($val['searchall']) {
93
+		$fieldstosearchall['t.'.$key] = $val['label'];
94
+	}
95
+	}
87 96
 
88 97
 // Definition of fields for list
89 98
 $arrayfields = array();
90 99
 foreach ($object->fields as $key => $val) {
91 100
 	// If $val['visible']==0, then we never show the field
92
-	if (!empty($val['visible'])) $arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>(verifCond($val['enabled']) && ($val['visible'] != 3)), 'position'=>$val['position']);
93
-}
101
+	if (!empty($val['visible'])) {
102
+		$arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>(verifCond($val['enabled']) && ($val['visible'] != 3)), 'position'=>$val['position']);
103
+	}
104
+	}
94 105
 //var_dump($object->fields);
95 106
 // Extra fields
96 107
 if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) {
@@ -114,14 +125,18 @@  discard block
 block discarded – undo
114 125
 $permissiontodelete = $user->rights->stocktransfer->stocktransfer->delete;
115 126
 
116 127
 // Security check
117
-if (empty($conf->stocktransfer->enabled)) accessforbidden('Module not enabled');
128
+if (empty($conf->stocktransfer->enabled)) {
129
+	accessforbidden('Module not enabled');
130
+}
118 131
 $socid = 0;
119 132
 if ($user->socid > 0) {	// Protection if external user
120 133
 	//$socid = $user->socid;
121 134
 	accessforbidden();
122 135
 }
123 136
 //$result = restrictedArea($user, 'stocktransfer', $id, '');
124
-if (!$permissiontoread) accessforbidden();
137
+if (!$permissiontoread) {
138
+	accessforbidden();
139
+}
125 140
 
126 141
 
127 142
 
@@ -134,7 +149,9 @@  discard block
 block discarded – undo
134 149
 
135 150
 $parameters = array();
136 151
 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
137
-if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
152
+if ($reshook < 0) {
153
+	setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
154
+}
138 155
 
139 156
 if (empty($reshook)) {
140 157
 	// Selection of new fields
@@ -191,19 +208,32 @@  discard block
 block discarded – undo
191 208
 $sql .= $hookmanager->resPrint;
192 209
 $sql = preg_replace('/,\s*$/', '', $sql);
193 210
 $sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
194
-if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
195
-if ($object->ismultientitymanaged == 1) $sql .= " WHERE t.entity IN (".getEntity($object->element).")";
196
-else $sql .= " WHERE 1 = 1";
211
+if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
212
+	$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
213
+}
214
+if ($object->ismultientitymanaged == 1) {
215
+	$sql .= " WHERE t.entity IN (".getEntity($object->element).")";
216
+} else {
217
+	$sql .= " WHERE 1 = 1";
218
+}
197 219
 foreach ($search as $key => $val) {
198
-	if ($key == 'status' && $search[$key] == -1) continue;
220
+	if ($key == 'status' && $search[$key] == -1) {
221
+		continue;
222
+	}
199 223
 	$mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
200 224
 	if (strpos($object->fields[$key]['type'], 'integer:') === 0) {
201
-		if ($search[$key] == '-1') $search[$key] = '';
225
+		if ($search[$key] == '-1') {
226
+			$search[$key] = '';
227
+		}
202 228
 		$mode_search = 2;
203 229
 	}
204
-	if ($search[$key] != '') $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search));
230
+	if ($search[$key] != '') {
231
+		$sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search));
232
+	}
233
+	}
234
+if ($search_all) {
235
+	$sql .= natural_search(array_keys($fieldstosearchall), $search_all);
205 236
 }
206
-if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
207 237
 //$sql.= dolSqlDateFilter("t.field", $search_xxxday, $search_xxxmonth, $search_xxxyear);
208 238
 // Add where from extra fields
209 239
 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
@@ -245,7 +275,9 @@  discard block
 block discarded – undo
245 275
 if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) {
246 276
 	$num = $nbtotalofrecords;
247 277
 } else {
248
-	if ($limit) $sql .= $db->plimit($limit + 1, $offset);
278
+	if ($limit) {
279
+		$sql .= $db->plimit($limit + 1, $offset);
280
+	}
249 281
 
250 282
 	$resql = $db->query($sql);
251 283
 	if (!$resql) {
@@ -288,13 +320,22 @@  discard block
 block discarded – undo
288 320
 $arrayofselected = is_array($toselect) ? $toselect : array();
289 321
 
290 322
 $param = '';
291
-if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
292
-if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.((int) $limit);
323
+if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
324
+	$param .= '&contextpage='.urlencode($contextpage);
325
+}
326
+if ($limit > 0 && $limit != $conf->liste_limit) {
327
+	$param .= '&limit='.((int) $limit);
328
+}
293 329
 foreach ($search as $key => $val) {
294
-	if (is_array($search[$key]) && count($search[$key])) foreach ($search[$key] as $skey) $param .= '&search_'.$key.'[]='.urlencode($skey);
295
-	else $param .= '&search_'.$key.'='.urlencode($search[$key]);
330
+	if (is_array($search[$key]) && count($search[$key])) {
331
+		foreach ($search[$key] as $skey) $param .= '&search_'.$key.'[]='.urlencode($skey);
332
+	} else {
333
+		$param .= '&search_'.$key.'='.urlencode($search[$key]);
334
+	}
335
+	}
336
+if ($optioncss != '') {
337
+	$param .= '&optioncss='.urlencode($optioncss);
296 338
 }
297
-if ($optioncss != '')     $param .= '&optioncss='.urlencode($optioncss);
298 339
 // Add $param from extra fields
299 340
 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
300 341
 
@@ -305,12 +346,18 @@  discard block
 block discarded – undo
305 346
 	//'builddoc'=>$langs->trans("PDFMerge"),
306 347
 	//'presend'=>$langs->trans("SendByMail"),
307 348
 );
308
-if ($permissiontodelete) $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
309
-if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array();
349
+if ($permissiontodelete) {
350
+	$arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
351
+}
352
+if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
353
+	$arrayofmassactions = array();
354
+}
310 355
 $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
311 356
 
312 357
 print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
313
-if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
358
+if ($optioncss != '') {
359
+	print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
360
+}
314 361
 print '<input type="hidden" name="token" value="'.newToken().'">';
315 362
 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
316 363
 print '<input type="hidden" name="action" value="list">';
@@ -331,7 +378,9 @@  discard block
 block discarded – undo
331 378
 include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
332 379
 
333 380
 if ($search_all) {
334
-	foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val);
381
+	foreach ($fieldstosearchall as $key => $val) {
382
+		$fieldstosearchall[$key] = $langs->trans($val);
383
+	}
335 384
 	print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>';
336 385
 }
337 386
 
@@ -342,8 +391,11 @@  discard block
 block discarded – undo
342 391
 
343 392
 $parameters = array();
344 393
 $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
345
-if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
346
-else $moreforfilter = $hookmanager->resPrint;
394
+if (empty($reshook)) {
395
+	$moreforfilter .= $hookmanager->resPrint;
396
+} else {
397
+	$moreforfilter = $hookmanager->resPrint;
398
+}
347 399
 
348 400
 if (!empty($moreforfilter)) {
349 401
 	print '<div class="liste_titre liste_titre_bydiv centpercent">';
@@ -364,16 +416,24 @@  discard block
 block discarded – undo
364 416
 print '<tr class="liste_titre">';
365 417
 foreach ($object->fields as $key => $val) {
366 418
 	$cssforfield = (empty($val['css']) ? '' : $val['css']);
367
-	if ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center';
368
-	elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
369
-	elseif (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
370
-	elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield .= ($cssforfield ? ' ' : '').'right';
419
+	if ($key == 'status') {
420
+		$cssforfield .= ($cssforfield ? ' ' : '').'center';
421
+	} elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
422
+		$cssforfield .= ($cssforfield ? ' ' : '').'center';
423
+	} elseif (in_array($val['type'], array('timestamp'))) {
424
+		$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
425
+	} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') {
426
+		$cssforfield .= ($cssforfield ? ' ' : '').'right';
427
+	}
371 428
 	if (!empty($arrayfields['t.'.$key]['checked'])) {
372 429
 		print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
373
-		if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75');
374
-		elseif (strpos($val['type'], 'integer:') === 0) {
430
+		if (is_array($val['arrayofkeyval'])) {
431
+			print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75');
432
+		} elseif (strpos($val['type'], 'integer:') === 0) {
375 433
 			print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1);
376
-		} elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
434
+		} elseif (!preg_match('/^(date|timestamp)/', $val['type'])) {
435
+			print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
436
+		}
377 437
 		print '</td>';
378 438
 	}
379 439
 }
@@ -397,10 +457,15 @@  discard block
 block discarded – undo
397 457
 print '<tr class="liste_titre">';
398 458
 foreach ($object->fields as $key => $val) {
399 459
 	$cssforfield = (empty($val['css']) ? '' : $val['css']);
400
-	if ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center';
401
-	elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
402
-	elseif (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
403
-	elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield .= ($cssforfield ? ' ' : '').'right';
460
+	if ($key == 'status') {
461
+		$cssforfield .= ($cssforfield ? ' ' : '').'center';
462
+	} elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
463
+		$cssforfield .= ($cssforfield ? ' ' : '').'center';
464
+	} elseif (in_array($val['type'], array('timestamp'))) {
465
+		$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
466
+	} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') {
467
+		$cssforfield .= ($cssforfield ? ' ' : '').'right';
468
+	}
404 469
 	if (!empty($arrayfields['t.'.$key]['checked'])) {
405 470
 		print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n";
406 471
 	}
@@ -433,7 +498,10 @@  discard block
 block discarded – undo
433 498
 $totalarray = array();
434 499
 while ($i < ($limit ? min($num, $limit) : $num)) {
435 500
 	$obj = $db->fetch_object($resql);
436
-	if (empty($obj)) break; // Should not happen
501
+	if (empty($obj)) {
502
+		break;
503
+	}
504
+	// Should not happen
437 505
 
438 506
 	// Store properties in $object
439 507
 	$object->setVarsFromFetchObj($obj);
@@ -442,31 +510,48 @@  discard block
 block discarded – undo
442 510
 	print '<tr class="oddeven">';
443 511
 	foreach ($object->fields as $key => $val) {
444 512
 		$cssforfield = (empty($val['css']) ? '' : $val['css']);
445
-		if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
446
-		elseif ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center';
513
+		if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
514
+			$cssforfield .= ($cssforfield ? ' ' : '').'center';
515
+		} elseif ($key == 'status') {
516
+			$cssforfield .= ($cssforfield ? ' ' : '').'center';
517
+		}
447 518
 
448
-		if (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
449
-		elseif ($key == 'ref') $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
519
+		if (in_array($val['type'], array('timestamp'))) {
520
+			$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
521
+		} elseif ($key == 'ref') {
522
+			$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
523
+		}
450 524
 
451
-		if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'status') $cssforfield .= ($cssforfield ? ' ' : '').'right';
525
+		if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'status') {
526
+			$cssforfield .= ($cssforfield ? ' ' : '').'right';
527
+		}
452 528
 		//if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
453 529
 
454 530
 		if (!empty($arrayfields['t.'.$key]['checked'])) {
455 531
 			print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>';
456
-			if ($key == 'status') print $object->getLibStatut(5);
457
-			else {
532
+			if ($key == 'status') {
533
+				print $object->getLibStatut(5);
534
+			} else {
458 535
 				print $object->showOutputField($val, $key, $object->$key, '');
459 536
 				if ($key === 'date_prevue_depart' && $object->lead_time_for_warning > 0 && $object->$key > 0) {
460 537
 					$date_prevue_depart = $object->$key;
461 538
 					$date_prevue_depart_plus_delai = $date_prevue_depart;
462
-					if ($object->lead_time_for_warning > 0) $date_prevue_depart_plus_delai = strtotime(date('Y-m-d', $date_prevue_depart) . ' + '.$object->lead_time_for_warning.' day');
463
-					if ($date_prevue_depart_plus_delai < strtotime(date('Y-m-d'))) print img_warning($langs->trans('Alert').' - '.$langs->trans('Late'));
539
+					if ($object->lead_time_for_warning > 0) {
540
+						$date_prevue_depart_plus_delai = strtotime(date('Y-m-d', $date_prevue_depart) . ' + '.$object->lead_time_for_warning.' day');
541
+					}
542
+					if ($date_prevue_depart_plus_delai < strtotime(date('Y-m-d'))) {
543
+						print img_warning($langs->trans('Alert').' - '.$langs->trans('Late'));
544
+					}
464 545
 				}
465 546
 			}
466 547
 			print '</td>';
467
-			if (!$i) $totalarray['nbfield']++;
548
+			if (!$i) {
549
+				$totalarray['nbfield']++;
550
+			}
468 551
 			if (!empty($val['isameasure'])) {
469
-				if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
552
+				if (!$i) {
553
+					$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
554
+				}
470 555
 				$totalarray['val']['t.'.$key] += $object->$key;
471 556
 			}
472 557
 		}
@@ -481,11 +566,15 @@  discard block
 block discarded – undo
481 566
 	print '<td class="nowrap center">';
482 567
 	if ($massactionbutton || $massaction) {   // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
483 568
 		$selected = 0;
484
-		if (in_array($object->id, $arrayofselected)) $selected = 1;
569
+		if (in_array($object->id, $arrayofselected)) {
570
+			$selected = 1;
571
+		}
485 572
 		print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
486 573
 	}
487 574
 	print '</td>';
488
-	if (!$i) $totalarray['nbfield']++;
575
+	if (!$i) {
576
+		$totalarray['nbfield']++;
577
+	}
489 578
 
490 579
 	print '</tr>'."\n";
491 580
 
@@ -498,7 +587,10 @@  discard block
 block discarded – undo
498 587
 // If no record found
499 588
 if ($num == 0) {
500 589
 	$colspan = 1;
501
-	foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; }
590
+	foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) {
591
+		$colspan++;
592
+	}
593
+	}
502 594
 	print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
503 595
 }
504 596
 
@@ -516,7 +608,9 @@  discard block
 block discarded – undo
516 608
 
517 609
 if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
518 610
 	$hidegeneratedfilelistifempty = 1;
519
-	if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty = 0;
611
+	if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
612
+		$hidegeneratedfilelistifempty = 0;
613
+	}
520 614
 
521 615
 	require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
522 616
 	$formfile = new FormFile($db);
Please login to merge, or discard this patch.
htdocs/product/stock/stocktransfer/stocktransfer_agenda.php 1 patch
Braces   +28 added lines, -10 removed lines patch added patch discarded remove patch
@@ -43,8 +43,10 @@  discard block
 block discarded – undo
43 43
 
44 44
 if (GETPOST('actioncode', 'array')) {
45 45
 	$actioncode = GETPOST('actioncode', 'array', 3);
46
-	if (!count($actioncode)) $actioncode = '0';
47
-} else {
46
+	if (!count($actioncode)) {
47
+		$actioncode = '0';
48
+	}
49
+	} else {
48 50
 	$actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT'));
49 51
 }
50 52
 $search_rowid = GETPOST('search_rowid');
@@ -58,8 +60,12 @@  discard block
 block discarded – undo
58 60
 $offset = $limit * $page;
59 61
 $pageprev = $page - 1;
60 62
 $pagenext = $page + 1;
61
-if (!$sortfield) $sortfield = 'a.datep,a.id';
62
-if (!$sortorder) $sortorder = 'DESC,DESC';
63
+if (!$sortfield) {
64
+	$sortfield = 'a.datep,a.id';
65
+}
66
+if (!$sortorder) {
67
+	$sortorder = 'DESC,DESC';
68
+}
63 69
 
64 70
 // Initialize technical objects
65 71
 $object = new StockTransfer($db);
@@ -71,7 +77,9 @@  discard block
 block discarded – undo
71 77
 
72 78
 // Load object
73 79
 include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once  // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
74
-if ($id > 0 || !empty($ref)) $upload_dir = $conf->stocktransfer->multidir_output[$object->entity]."/".$object->id;
80
+if ($id > 0 || !empty($ref)) {
81
+	$upload_dir = $conf->stocktransfer->multidir_output[$object->entity]."/".$object->id;
82
+}
75 83
 
76 84
 // Security check - Protection if external user
77 85
 //if ($user->socid > 0) accessforbidden();
@@ -87,7 +95,9 @@  discard block
 block discarded – undo
87 95
 
88 96
 $parameters = array('id'=>$id);
89 97
 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
90
-if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
98
+if ($reshook < 0) {
99
+	setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
100
+}
91 101
 
92 102
 if (empty($reshook)) {
93 103
 	// Cancel
@@ -117,7 +127,9 @@  discard block
 block discarded – undo
117 127
 	$help_url = '';
118 128
 	llxHeader('', $title, $help_url);
119 129
 
120
-	if (isModEnabled('notification')) $langs->load("mails");
130
+	if (isModEnabled('notification')) {
131
+		$langs->load("mails");
132
+	}
121 133
 	$head = stocktransferPrepareHead($object);
122 134
 
123 135
 
@@ -191,7 +203,9 @@  discard block
 block discarded – undo
191 203
 	$permok = $user->hasRight('agenda', 'myactions', 'create');
192 204
 	if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
193 205
 		//$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
194
-		if (get_class($objthirdparty) == 'Societe') $out .= '&amp;socid='.$objthirdparty->id;
206
+		if (get_class($objthirdparty) == 'Societe') {
207
+			$out .= '&amp;socid='.$objthirdparty->id;
208
+		}
195 209
 		$out .= (!empty($objcon->id) ? '&amp;contactid='.$objcon->id : '').'&amp;backtopage=1';
196 210
 		//$out.=$langs->trans("AddAnAction").' ';
197 211
 		//$out.=img_picto($langs->trans("AddAnAction"),'filenew');
@@ -213,8 +227,12 @@  discard block
 block discarded – undo
213 227
 
214 228
 	if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) {
215 229
 		$param = '&id='.$object->id.'&socid='.$socid;
216
-		if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
217
-		if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.((int) $limit);
230
+		if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
231
+			$param .= '&contextpage='.urlencode($contextpage);
232
+		}
233
+		if ($limit > 0 && $limit != $conf->liste_limit) {
234
+			$param .= '&limit='.((int) $limit);
235
+		}
218 236
 
219 237
 
220 238
 		//print load_fiche_titre($langs->trans("ActionsOnStockTransfer"), '', '');
Please login to merge, or discard this patch.
htdocs/product/stock/stats/reception.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -81,7 +81,9 @@
 block discarded – undo
81 81
 	$search_year = '';
82 82
 }
83 83
 
84
-if (!$user->hasRight('produit', 'lire')) accessforbidden();
84
+if (!$user->hasRight('produit', 'lire')) {
85
+	accessforbidden();
86
+}
85 87
 
86 88
 
87 89
 /*
Please login to merge, or discard this patch.
htdocs/product/stock/replenish.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -672,8 +672,12 @@  discard block
 block discarded – undo
672 672
 if ($limit > 0 && $limit != $conf->liste_limit) {
673 673
 	$filters .= '&limit='.((int) $limit);
674 674
 }
675
-if (!empty($includeproductswithoutdesiredqty)) $filters .= '&includeproductswithoutdesiredqty='.urlencode($includeproductswithoutdesiredqty);
676
-if (!empty($salert)) $filters .= '&salert='.urlencode($salert);
675
+if (!empty($includeproductswithoutdesiredqty)) {
676
+	$filters .= '&includeproductswithoutdesiredqty='.urlencode($includeproductswithoutdesiredqty);
677
+}
678
+if (!empty($salert)) {
679
+	$filters .= '&salert='.urlencode($salert);
680
+}
677 681
 
678 682
 $param = (isset($type) ? '&type='.urlencode($type) : '');
679 683
 $param .= '&fourn_id='.urlencode($fourn_id).'&search_label='.urlencode($search_label).'&includeproductswithoutdesiredqty='.urlencode($includeproductswithoutdesiredqty).'&salert='.urlencode($salert).'&draftorder='.urlencode($draftorder);
@@ -681,8 +685,12 @@  discard block
 block discarded – undo
681 685
 $param .= '&mode='.urlencode($mode);
682 686
 $param .= '&fk_supplier='.urlencode($fk_supplier);
683 687
 $param .= '&fk_entrepot='.urlencode($fk_entrepot);
684
-if (!empty($includeproductswithoutdesiredqty)) $param .= '&includeproductswithoutdesiredqty='.urlencode($includeproductswithoutdesiredqty);
685
-if (!empty($salert)) $param .= '&salert='.urlencode($salert);
688
+if (!empty($includeproductswithoutdesiredqty)) {
689
+	$param .= '&includeproductswithoutdesiredqty='.urlencode($includeproductswithoutdesiredqty);
690
+}
691
+if (!empty($salert)) {
692
+	$param .= '&salert='.urlencode($salert);
693
+}
686 694
 
687 695
 $stocklabel = $langs->trans('Stock');
688 696
 $stocklabelbis = $langs->trans('Stock');
Please login to merge, or discard this patch.
htdocs/product/stock/tpl/extrafields_add.tpl.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,9 @@
 block discarded – undo
36 36
 <?php
37 37
 
38 38
 // Other attributes
39
-if (!isset($parameters)) $parameters = array();
39
+if (!isset($parameters)) {
40
+	$parameters = array();
41
+}
40 42
 
41 43
 $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
42 44
 print $hookmanager->resPrint;
Please login to merge, or discard this patch.
htdocs/contrat/ticket.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,8 +49,9 @@
 block discarded – undo
49 49
 
50 50
 // Security check
51 51
 $socid=0;
52
-if ($user->socid > 0)
52
+if ($user->socid > 0) {
53 53
 	$socid=$user->socid;
54
+}
54 55
 
55 56
 $result=restrictedArea($user, 'contrat', $id);
56 57
 
Please login to merge, or discard this patch.
install/doctemplates/websites/website_template-noimg/containers/index.php 1 patch
Braces   +5 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 // File generated to wrap the alias page - DO NOT MODIFY - It is just a wrapper to real page
3 3
 global $dolibarr_main_data_root;
4
-if (empty($dolibarr_main_data_root)) require './page80.tpl.php'; else require $dolibarr_main_data_root.'/website/'.$website->ref.'/page80.tpl.php';
4
+if (empty($dolibarr_main_data_root)) {
5
+	require './page80.tpl.php';
6
+} else {
7
+	require $dolibarr_main_data_root.'/website/'.$website->ref.'/page80.tpl.php';
8
+}
Please login to merge, or discard this patch.
doctemplates/websites/website_template-noimg/containers/master.inc.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 // File generated to link to the master file - DO NOT MODIFY - It is just an include
3 3
 if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) {
4
-	if (! defined('USEEXTERNALSERVER')) define('USEEXTERNALSERVER', 1);
4
+	if (! defined('USEEXTERNALSERVER')) {
5
+		define('USEEXTERNALSERVER', 1);
6
+	}
5 7
 	require_once '/var/www/html/dolibarr_dev/htdocs/master.inc.php';
6 8
 }
Please login to merge, or discard this patch.