Passed
Branch develop (f95612)
by
unknown
98:25
created
htdocs/public/emailing/mailing-unsubscribe.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -45,11 +45,11 @@  discard block
 block discarded – undo
45 45
 if (!defined("NOSESSION")) {
46 46
 	define("NOSESSION", '1');
47 47
 }
48
-if (! defined('NOREQUIREHTML')) {
49
-	define('NOREQUIREHTML', '1');				// If we don't need to load the html.form.class.php
48
+if (!defined('NOREQUIREHTML')) {
49
+	define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
50 50
 }
51
-if (! defined('NOREQUIREAJAX')) {
52
-	define('NOREQUIREAJAX', '1');       	  	// Do not load ajax.lib.php library
51
+if (!defined('NOREQUIREAJAX')) {
52
+	define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library
53 53
 }
54 54
 
55 55
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 
61 61
 $langs->loadLangs(array("main", "mails"));
62 62
 
63
-$tag = GETPOST('tag');	// To retreive the emailing, and recipient
63
+$tag = GETPOST('tag'); // To retreive the emailing, and recipient
64 64
 $unsuscrib = GETPOST('unsuscrib');
65 65
 $securitykey = GETPOST('securitykey');
66 66
 
Please login to merge, or discard this patch.
htdocs/product/stock/stocktransfer/stocktransfer_note.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,9 @@
 block discarded – undo
51 51
 
52 52
 // Load object
53 53
 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
54
-if ($id > 0 || !empty($ref)) $upload_dir = $conf->stocktransfer->multidir_output[$object->entity]."/".$object->id;
54
+if ($id > 0 || !empty($ref)) {
55
+	$upload_dir = $conf->stocktransfer->multidir_output[$object->entity]."/".$object->id;
56
+}
55 57
 
56 58
 $permissionnote = $user->rights->stocktransfer->stocktransfer->write; // Used by the include of actions_setnotes.inc.php
57 59
 $permissiontoadd = $user->rights->stocktransfer->stocktransfer->write; // Used by the include of actions_addupdatedelete.inc.php
Please login to merge, or discard this patch.
htdocs/product/stock/stocktransfer/stocktransfer_contact.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,7 +35,9 @@  discard block
 block discarded – undo
35 35
 $action = GETPOST('action', 'alpha');
36 36
 
37 37
 // Security check
38
-if ($user->socid) $socid = $user->socid;
38
+if ($user->socid) {
39
+	$socid = $user->socid;
40
+}
39 41
 
40 42
 $result = restrictedArea($user, 'stocktransfer', $id, '', 'stocktransfer');
41 43
 
@@ -175,7 +177,9 @@  discard block
 block discarded – undo
175 177
 	$dirtpls = array_merge($conf->modules_parts['tpl'], array('/core/tpl'));
176 178
 	foreach ($dirtpls as $reldir) {
177 179
 		$res = @include dol_buildpath($reldir.'/contacts.tpl.php');
178
-		if ($res) break;
180
+		if ($res) {
181
+			break;
182
+		}
179 183
 	}
180 184
 }
181 185
 
Please login to merge, or discard this patch.
htdocs/product/stock/stocktransfer/stocktransfer_document.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -48,8 +48,12 @@  discard block
 block discarded – undo
48 48
 $offset = $limit * $page;
49 49
 $pageprev = $page - 1;
50 50
 $pagenext = $page + 1;
51
-if (!$sortorder) $sortorder = "ASC";
52
-if (!$sortfield) $sortfield = "name";
51
+if (!$sortorder) {
52
+	$sortorder = "ASC";
53
+}
54
+if (!$sortfield) {
55
+	$sortfield = "name";
56
+}
53 57
 //if (! $sortfield) $sortfield="position_name";
54 58
 
55 59
 // Initialize technical objects
@@ -64,7 +68,9 @@  discard block
 block discarded – undo
64 68
 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
65 69
 
66 70
 //if ($id > 0 || ! empty($ref)) $upload_dir = $conf->stocktransfer->multidir_output[$object->entity?$object->entity:$conf->entity] . "/stocktransfer/" . dol_sanitizeFileName($object->id);
67
-if ($id > 0 || !empty($ref)) $upload_dir = $conf->stocktransfer->multidir_output[$object->entity ? $object->entity : $conf->entity]."/stocktransfer/".dol_sanitizeFileName($object->ref);
71
+if ($id > 0 || !empty($ref)) {
72
+	$upload_dir = $conf->stocktransfer->multidir_output[$object->entity ? $object->entity : $conf->entity]."/stocktransfer/".dol_sanitizeFileName($object->ref);
73
+}
68 74
 
69 75
 // Security check - Protection if external user
70 76
 //if ($user->socid > 0) accessforbidden();
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
@@ -42,8 +42,10 @@  discard block
 block discarded – undo
42 42
 
43 43
 if (GETPOST('actioncode', 'array')) {
44 44
 	$actioncode = GETPOST('actioncode', 'array', 3);
45
-	if (!count($actioncode)) $actioncode = '0';
46
-} else {
45
+	if (!count($actioncode)) {
46
+		$actioncode = '0';
47
+	}
48
+	} else {
47 49
 	$actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT));
48 50
 }
49 51
 $search_agenda_label = GETPOST('search_agenda_label');
@@ -56,8 +58,12 @@  discard block
 block discarded – undo
56 58
 $offset = $limit * $page;
57 59
 $pageprev = $page - 1;
58 60
 $pagenext = $page + 1;
59
-if (!$sortfield) $sortfield = 'a.datep,a.id';
60
-if (!$sortorder) $sortorder = 'DESC,DESC';
61
+if (!$sortfield) {
62
+	$sortfield = 'a.datep,a.id';
63
+}
64
+if (!$sortorder) {
65
+	$sortorder = 'DESC,DESC';
66
+}
61 67
 
62 68
 // Initialize technical objects
63 69
 $object = new StockTransfer($db);
@@ -69,7 +75,9 @@  discard block
 block discarded – undo
69 75
 
70 76
 // Load object
71 77
 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
72
-if ($id > 0 || !empty($ref)) $upload_dir = $conf->stocktransfer->multidir_output[$object->entity]."/".$object->id;
78
+if ($id > 0 || !empty($ref)) {
79
+	$upload_dir = $conf->stocktransfer->multidir_output[$object->entity]."/".$object->id;
80
+}
73 81
 
74 82
 // Security check - Protection if external user
75 83
 //if ($user->socid > 0) accessforbidden();
@@ -85,7 +93,9 @@  discard block
 block discarded – undo
85 93
 
86 94
 $parameters = array('id'=>$id);
87 95
 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
88
-if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
96
+if ($reshook < 0) {
97
+	setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
98
+}
89 99
 
90 100
 if (empty($reshook)) {
91 101
 	// Cancel
@@ -115,7 +125,9 @@  discard block
 block discarded – undo
115 125
 	$help_url = '';
116 126
 	llxHeader('', $title, $help_url);
117 127
 
118
-	if (!empty($conf->notification->enabled)) $langs->load("mails");
128
+	if (!empty($conf->notification->enabled)) {
129
+		$langs->load("mails");
130
+	}
119 131
 	$head = stocktransferPrepareHead($object);
120 132
 
121 133
 
@@ -189,7 +201,9 @@  discard block
 block discarded – undo
189 201
 	$permok = $user->rights->agenda->myactions->create;
190 202
 	if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
191 203
 		//$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
192
-		if (get_class($objthirdparty) == 'Societe') $out .= '&amp;socid='.$objthirdparty->id;
204
+		if (get_class($objthirdparty) == 'Societe') {
205
+			$out .= '&amp;socid='.$objthirdparty->id;
206
+		}
193 207
 		$out .= (!empty($objcon->id) ? '&amp;contactid='.$objcon->id : '').'&amp;backtopage=1&amp;percentage=-1';
194 208
 		//$out.=$langs->trans("AddAnAction").' ';
195 209
 		//$out.=img_picto($langs->trans("AddAnAction"),'filenew');
@@ -211,8 +225,12 @@  discard block
 block discarded – undo
211 225
 
212 226
 	if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
213 227
 		$param = '&id='.$object->id.'&socid='.$socid;
214
-		if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
215
-		if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
228
+		if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
229
+			$param .= '&contextpage='.urlencode($contextpage);
230
+		}
231
+		if ($limit > 0 && $limit != $conf->liste_limit) {
232
+			$param .= '&limit='.urlencode($limit);
233
+		}
216 234
 
217 235
 
218 236
 		//print load_fiche_titre($langs->trans("ActionsOnStockTransfer"), '', '');
Please login to merge, or discard this patch.
htdocs/product/stock/stocktransfer/stocktransfer_card.php 1 patch
Braces   +129 added lines, -49 removed lines patch added patch discarded remove patch
@@ -36,7 +36,9 @@  discard block
 block discarded – undo
36 36
 
37 37
 // Load translation files required by the page
38 38
 $langs->loadLangs(array("stocks", "other", "productbatch", "companies"));
39
- if (!empty($conf->incoterm->enabled)) $langs->load('incoterm');
39
+ if (!empty($conf->incoterm->enabled)) {
40
+ 	$langs->load('incoterm');
41
+ }
40 42
 
41 43
 // Get parameters
42 44
 $id = GETPOST('id', 'int');
@@ -71,10 +73,14 @@  discard block
 block discarded – undo
71 73
 $search_all = trim(GETPOST("search_all", 'alpha'));
72 74
 $search = array();
73 75
 foreach ($object->fields as $key => $val) {
74
-	if (GETPOST('search_'.$key, 'alpha')) $search[$key] = GETPOST('search_'.$key, 'alpha');
75
-}
76
+	if (GETPOST('search_'.$key, 'alpha')) {
77
+		$search[$key] = GETPOST('search_'.$key, 'alpha');
78
+	}
79
+	}
76 80
 
77
-if (empty($action) && empty($id) && empty($ref)) $action = 'view';
81
+if (empty($action) && empty($id) && empty($ref)) {
82
+	$action = 'view';
83
+}
78 84
 
79 85
 // Load object
80 86
 include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
@@ -93,7 +99,9 @@  discard block
 block discarded – undo
93 99
 //$isdraft = (($object->statut == $object::STATUS_DRAFT) ? 1 : 0);
94 100
 //$result = restrictedArea($user, 'stocktransfer', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
95 101
 
96
-if (!$permissiontoread || ($action === 'create' && !$permissiontoadd)) accessforbidden();
102
+if (!$permissiontoread || ($action === 'create' && !$permissiontoadd)) {
103
+	accessforbidden();
104
+}
97 105
 
98 106
 
99 107
 /*
@@ -106,7 +114,9 @@  discard block
 block discarded – undo
106 114
 
107 115
 $parameters = array();
108 116
 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
109
-if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
117
+if ($reshook < 0) {
118
+	setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
119
+}
110 120
 
111 121
 if (empty($reshook)) {
112 122
 	$error = 0;
@@ -115,8 +125,11 @@  discard block
 block discarded – undo
115 125
 
116 126
 	if (empty($backtopage) || ($cancel && empty($id))) {
117 127
 		if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
118
-			if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) $backtopage = $backurlforlist;
119
-			else $backtopage = dol_buildpath('/product/stock/stocktransfer/stocktransfer_card.php', 1).'?id='.($id > 0 ? $id : '__ID__');
128
+			if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
129
+				$backtopage = $backurlforlist;
130
+			} else {
131
+				$backtopage = dol_buildpath('/product/stock/stocktransfer/stocktransfer_card.php', 1).'?id='.($id > 0 ? $id : '__ID__');
132
+			}
120 133
 		}
121 134
 	}
122 135
 	$triggermodname = 'STOCKTRANSFER_STOCKTRANSFER_MODIFY'; // Name of trigger action code to execute when we modify record
@@ -183,7 +196,9 @@  discard block
 block discarded – undo
183 196
 		if (empty($error)) {
184 197
 			$line = new StockTransferLine($db);
185 198
 			$records = $line->fetchAll('', '', 0, 0, array('customsql'=>' fk_stocktransfer = '.((int) $id).' AND fk_product = '.((int) $fk_product).' AND fk_warehouse_source = '.((int) $fk_warehouse_source).' AND fk_warehouse_destination = '.((int) $fk_warehouse_destination).' AND ('.(empty($batch) ? 'batch = "" or batch IS NULL' : "batch = '".$db->escape($batch)."'" ).')'));
186
-			if (!empty($records[key($records)])) $line = $records[key($records)];
199
+			if (!empty($records[key($records)])) {
200
+				$line = $records[key($records)];
201
+			}
187 202
 			$line->fk_stocktransfer = $id;
188 203
 			$line->qty += $qty;
189 204
 			$line->fk_warehouse_source = $fk_warehouse_source;
@@ -192,8 +207,9 @@  discard block
 block discarded – undo
192 207
 			$line->batch = $batch;
193 208
 
194 209
 			$line->pmp = $prod->pmp;
195
-			if ($line->id > 0) $line->update($user);
196
-			else {
210
+			if ($line->id > 0) {
211
+				$line->update($user);
212
+			} else {
197 213
 				$line->rang = count($object->lines) + 1;
198 214
 				$line->create($user);
199 215
 			}
@@ -256,10 +272,15 @@  discard block
 block discarded – undo
256 272
 				$db->begin();
257 273
 				foreach ($lines as $line) {
258 274
 					$res = $line->doStockMovement($label, $code_inv, $line->fk_warehouse_source);
259
-					if ($res <= 0) $error++;
275
+					if ($res <= 0) {
276
+						$error++;
277
+					}
278
+				}
279
+				if (empty($error)) {
280
+					$db->commit();
281
+				} else {
282
+					$db->rollback();
260 283
 				}
261
-				if (empty($error)) $db->commit();
262
-				else $db->rollback();
263 284
 			}
264 285
 			if (empty($error)) {
265 286
 				$object->setStatut($object::STATUS_TRANSFERED, $id);
@@ -277,10 +298,15 @@  discard block
 block discarded – undo
277 298
 				$db->begin();
278 299
 				foreach ($lines as $line) {
279 300
 					$res = $line->doStockMovement($label, $code_inv, $line->fk_warehouse_source, 0);
280
-					if ($res <= 0) $error++;
301
+					if ($res <= 0) {
302
+						$error++;
303
+					}
304
+				}
305
+				if (empty($error)) {
306
+					$db->commit();
307
+				} else {
308
+					$db->rollback();
281 309
 				}
282
-				if (empty($error)) $db->commit();
283
-				else $db->rollback();
284 310
 			}
285 311
 			if (empty($error)) {
286 312
 				$object->setStatut($object::STATUS_VALIDATED, $id);
@@ -298,10 +324,15 @@  discard block
 block discarded – undo
298 324
 				$db->begin();
299 325
 				foreach ($lines as $line) {
300 326
 					$res = $line->doStockMovement($label, $code_inv, $line->fk_warehouse_destination, 0);
301
-					if ($res <= 0) $error++;
327
+					if ($res <= 0) {
328
+						$error++;
329
+					}
330
+				}
331
+				if (empty($error)) {
332
+					$db->commit();
333
+				} else {
334
+					$db->rollback();
302 335
 				}
303
-				if (empty($error)) $db->commit();
304
-				else $db->rollback();
305 336
 			}
306 337
 			if (empty($error)) {
307 338
 				$object->setStatut($object::STATUS_CLOSED, $id);
@@ -319,10 +350,15 @@  discard block
 block discarded – undo
319 350
 				$db->begin();
320 351
 				foreach ($lines as $line) {
321 352
 					$res = $line->doStockMovement($label, $code_inv, $line->fk_warehouse_destination);
322
-					if ($res <= 0) $error++;
353
+					if ($res <= 0) {
354
+						$error++;
355
+					}
356
+				}
357
+				if (empty($error)) {
358
+					$db->commit();
359
+				} else {
360
+					$db->rollback();
323 361
 				}
324
-				if (empty($error)) $db->commit();
325
-				else $db->rollback();
326 362
 			}
327 363
 			if (empty($error)) {
328 364
 				$object->setStatut($object::STATUS_TRANSFERED, $id);
@@ -367,7 +403,9 @@  discard block
 block discarded – undo
367 403
 // Affichage alerte date prévue de départ si transfert concerné
368 404
 $date_prevue_depart = $object->date_prevue_depart;
369 405
 $date_prevue_depart_plus_delai = $date_prevue_depart;
370
-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');
406
+if ($object->lead_time_for_warning > 0) {
407
+	$date_prevue_depart_plus_delai = strtotime(date('Y-m-d', $date_prevue_depart) . ' + '.$object->lead_time_for_warning.' day');
408
+}
371 409
 if (!empty($date_prevue_depart) && $date_prevue_depart_plus_delai < strtotime(date('Y-m-d'))) {
372 410
 	print "$('.valuefield.fieldname_date_prevue_depart').append('";
373 411
 	print img_warning($langs->trans('Alert').' - '.$langs->trans('Late'));
@@ -385,8 +423,12 @@  discard block
 block discarded – undo
385 423
 	print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
386 424
 	print '<input type="hidden" name="token" value="'.newToken().'">';
387 425
 	print '<input type="hidden" name="action" value="add">';
388
-	if ($backtopage) print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
389
-	if ($backtopageforcancel) print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
426
+	if ($backtopage) {
427
+		print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
428
+	}
429
+	if ($backtopageforcancel) {
430
+		print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
431
+	}
390 432
 
391 433
 	print dol_get_fiche_head(array(), '');
392 434
 
@@ -442,8 +484,12 @@  discard block
 block discarded – undo
442 484
 	print '<input type="hidden" name="token" value="' . newToken() . '">';
443 485
 	print '<input type="hidden" name="action" value="update">';
444 486
 	print '<input type="hidden" name="id" value="' . $object->id . '">';
445
-	if ($backtopage) print '<input type="hidden" name="backtopage" value="' . $backtopage . '">';
446
-	if ($backtopageforcancel) print '<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . '">';
487
+	if ($backtopage) {
488
+		print '<input type="hidden" name="backtopage" value="' . $backtopage . '">';
489
+	}
490
+	if ($backtopageforcancel) {
491
+		print '<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . '">';
492
+	}
447 493
 
448 494
 	print dol_get_fiche_head();
449 495
 
@@ -544,8 +590,11 @@  discard block
 block discarded – undo
544 590
 	// Call Hook formConfirm
545 591
 	$parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid);
546 592
 	$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
547
-	if (empty($reshook)) $formconfirm .= $hookmanager->resPrint;
548
-	elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint;
593
+	if (empty($reshook)) {
594
+		$formconfirm .= $hookmanager->resPrint;
595
+	} elseif ($reshook > 0) {
596
+		$formconfirm = $hookmanager->resPrint;
597
+	}
549 598
 
550 599
 	// Print form confirm
551 600
 	print $formconfirm;
@@ -615,8 +664,11 @@  discard block
 block discarded – undo
615 664
 		print '<table width="100%" class="nobordernopadding"><tr><td>';
616 665
 		print $langs->trans('IncotermLabel');
617 666
 		print '<td><td class="right">';
618
-		if ($permissiontoadd && $action != 'editincoterm') print '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=editincoterm">'.img_edit().'</a>';
619
-		else print '&nbsp;';
667
+		if ($permissiontoadd && $action != 'editincoterm') {
668
+			print '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=editincoterm">'.img_edit().'</a>';
669
+		} else {
670
+			print '&nbsp;';
671
+		}
620 672
 		print '</td></tr></table>';
621 673
 		print '</td>';
622 674
 		print '<td>';
@@ -705,7 +757,9 @@  discard block
 block discarded – undo
705 757
 		<input type="hidden" name="mode" value="">
706 758
 		<input type="hidden" name="id" value="' . $object->id.'">
707 759
 		';
708
-	if ($lineid > 0) print '<input type="hidden" name="lineid" value="'.$lineid.'" />';
760
+	if ($lineid > 0) {
761
+		print '<input type="hidden" name="lineid" value="'.$lineid.'" />';
762
+	}
709 763
 	print '<table id="tablelines" class="liste centpercent">';
710 764
 	//print '<div class="tagtable centpercent">';
711 765
 
@@ -752,32 +806,48 @@  discard block
 block discarded – undo
752 806
 
753 807
 		print '<tr id="row-'.$line->id.'" class="drag drop oddeven" '.$domData.'>';
754 808
 		print '<td class="titlefield">';
755
-		if ($action === 'editline' && $line->id == $lineid) $form->select_produits($line->fk_product, 'fk_product', $filtertype, $limit, 0, -1, 2, '', 0, array(), 0, 0, 0, 'minwidth200imp maxwidth300', 1);
756
-		else print $productstatic->getNomUrl(1).' - '.$productstatic->label;
809
+		if ($action === 'editline' && $line->id == $lineid) {
810
+			$form->select_produits($line->fk_product, 'fk_product', $filtertype, $limit, 0, -1, 2, '', 0, array(), 0, 0, 0, 'minwidth200imp maxwidth300', 1);
811
+		} else {
812
+			print $productstatic->getNomUrl(1).' - '.$productstatic->label;
813
+		}
757 814
 		print '</td>';
758 815
 		if (isModEnabled('productbatch')) {
759 816
 			print '<td>';
760
-			if ($action === 'editline' && $line->id == $lineid) print '<input type="text" value="'.$line->batch.'" name="batch" class="flat maxwidth50"/>';
761
-			else {
817
+			if ($action === 'editline' && $line->id == $lineid) {
818
+				print '<input type="text" value="'.$line->batch.'" name="batch" class="flat maxwidth50"/>';
819
+			} else {
762 820
 				$productlot = new Productlot($db);
763 821
 				if ($productlot->fetch(0, $line->fk_product, $line->batch) > 0) {
764 822
 					print $productlot->getNomUrl(1);
765
-				} elseif (!empty($line->batch)) print $line->batch.'&nbsp;'.img_warning($langs->trans('BatchNotFound'));;
823
+				} elseif (!empty($line->batch)) {
824
+					print $line->batch.'&nbsp;'.img_warning($langs->trans('BatchNotFound'));
825
+				}
826
+				;
766 827
 			}
767 828
 			print '</td>';
768 829
 		}
769 830
 
770 831
 		print '<td>';
771 832
 
772
-		if ($action === 'editline' && $line->id == $lineid) print $formproduct->selectWarehouses($line->fk_warehouse_source, 'fk_warehouse_source', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'minwidth200imp maxwidth200', $TExcludedWarehouseSource);
773
-		else print $warehousestatics->getNomUrl(1);
833
+		if ($action === 'editline' && $line->id == $lineid) {
834
+			print $formproduct->selectWarehouses($line->fk_warehouse_source, 'fk_warehouse_source', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'minwidth200imp maxwidth200', $TExcludedWarehouseSource);
835
+		} else {
836
+			print $warehousestatics->getNomUrl(1);
837
+		}
774 838
 		print '</td>';
775 839
 		print '<td>';
776
-		if ($action === 'editline' && $line->id == $lineid) print $formproduct->selectWarehouses($line->fk_warehouse_destination, 'fk_warehouse_destination', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'minwidth200imp maxwidth200', $TExcludedWarehouseDestination);
777
-		else print $warehousestatict->getNomUrl(1);
840
+		if ($action === 'editline' && $line->id == $lineid) {
841
+			print $formproduct->selectWarehouses($line->fk_warehouse_destination, 'fk_warehouse_destination', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'minwidth200imp maxwidth200', $TExcludedWarehouseDestination);
842
+		} else {
843
+			print $warehousestatict->getNomUrl(1);
844
+		}
778 845
 		print '</td>';
779
-		if ($action === 'editline' && $line->id == $lineid) print '<td class="center"><input type="text" class="flat maxwidth50" name="qty" value="'.$line->qty.'"></td>';
780
-		else print '<td class="center">'.$line->qty.'</td>';
846
+		if ($action === 'editline' && $line->id == $lineid) {
847
+			print '<td class="center"><input type="text" class="flat maxwidth50" name="qty" value="'.$line->qty.'"></td>';
848
+		} else {
849
+			print '<td class="center">'.$line->qty.'</td>';
850
+		}
781 851
 
782 852
 		if ($conf->global->PRODUCT_USE_UNITS) {
783 853
 			print '<td class="linecoluseunit nowrap left">';
@@ -839,7 +909,9 @@  discard block
 block discarded – undo
839 909
 		// Product
840 910
 		print '<td class="titlefield">';
841 911
 		$filtertype = 0;
842
-		if (!empty($conf->global->STOCK_SUPPORTS_SERVICES)) $filtertype = '';
912
+		if (!empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
913
+			$filtertype = '';
914
+		}
843 915
 		if ($conf->global->PRODUIT_LIMIT_SIZE <= 0) {
844 916
 			$limit = '';
845 917
 		} else {
@@ -863,7 +935,9 @@  discard block
 block discarded – undo
863 935
 			$source_ent = new Entrepot($db);
864 936
 			$source_ent->fetch($object->fk_warehouse_source);
865 937
 			foreach ($formproduct->cache_warehouses as $TDataCacheWarehouse) {
866
-				if (strpos($TDataCacheWarehouse['full_label'], $source_ent->label) === false) $TExcludedWarehouseSource[] = $TDataCacheWarehouse['id'];
938
+				if (strpos($TDataCacheWarehouse['full_label'], $source_ent->label) === false) {
939
+					$TExcludedWarehouseSource[] = $TDataCacheWarehouse['id'];
940
+				}
867 941
 			}
868 942
 		}
869 943
 
@@ -873,7 +947,9 @@  discard block
 block discarded – undo
873 947
 			$dest_ent = new Entrepot($db);
874 948
 			$dest_ent->fetch($object->fk_warehouse_destination);
875 949
 			foreach ($formproduct->cache_warehouses as $TDataCacheWarehouse) {
876
-				if (strpos($TDataCacheWarehouse['full_label'], $dest_ent->label) === false) $TExcludedWarehouseDestination[] = $TDataCacheWarehouse['id'];
950
+				if (strpos($TDataCacheWarehouse['full_label'], $dest_ent->label) === false) {
951
+					$TExcludedWarehouseDestination[] = $TDataCacheWarehouse['id'];
952
+				}
877 953
 			}
878 954
 		}
879 955
 
@@ -918,7 +994,9 @@  discard block
 block discarded – undo
918 994
 		print '<div class="tabsAction">'."\n";
919 995
 		$parameters = array();
920 996
 		$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
921
-		if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
997
+		if ($reshook < 0) {
998
+			setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
999
+		}
922 1000
 
923 1001
 		if (empty($reshook)) {
924 1002
 			// Send
@@ -1048,7 +1126,9 @@  discard block
 block discarded – undo
1048 1126
 	}
1049 1127
 
1050 1128
 	//Select mail models is same action as presend
1051
-	if (GETPOST('modelselected')) $action = 'presend';
1129
+	if (GETPOST('modelselected')) {
1130
+		$action = 'presend';
1131
+	}
1052 1132
 
1053 1133
 	// Presend form
1054 1134
 	$modelmail = 'stocktransfer';
Please login to merge, or discard this patch.
htdocs/product/stock/stocktransfer/stocktransfer_list.php 1 patch
Braces   +159 added lines, -60 removed lines patch added patch discarded remove patch
@@ -68,28 +68,39 @@  discard block
 block discarded – undo
68 68
 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
69 69
 
70 70
 // Default sort order (if not yet defined by previous GETPOST)
71
-if (!$sortfield) $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition.
72
-if (!$sortorder) $sortorder = "ASC";
71
+if (!$sortfield) {
72
+	$sortfield = "t.".key($object->fields);
73
+}
74
+// Set here default search field. By default 1st field in definition.
75
+if (!$sortorder) {
76
+	$sortorder = "ASC";
77
+}
73 78
 
74 79
 // Initialize array of search criterias
75 80
 $search_all = GETPOST('search_all', 'alphanohtml') ? trim(GETPOST('search_all', 'alphanohtml')) : trim(GETPOST('sall', 'alphanohtml'));
76 81
 $search = array();
77 82
 foreach ($object->fields as $key => $val) {
78
-	if (GETPOST('search_'.$key, 'alpha') !== '') $search[$key] = GETPOST('search_'.$key, 'alpha');
79
-}
83
+	if (GETPOST('search_'.$key, 'alpha') !== '') {
84
+		$search[$key] = GETPOST('search_'.$key, 'alpha');
85
+	}
86
+	}
80 87
 
81 88
 // List of fields to search into when doing a "search in all"
82 89
 $fieldstosearchall = array();
83 90
 foreach ($object->fields as $key => $val) {
84
-	if ($val['searchall']) $fieldstosearchall['t.'.$key] = $val['label'];
85
-}
91
+	if ($val['searchall']) {
92
+		$fieldstosearchall['t.'.$key] = $val['label'];
93
+	}
94
+	}
86 95
 
87 96
 // Definition of fields for list
88 97
 $arrayfields = array();
89 98
 foreach ($object->fields as $key => $val) {
90 99
 	// If $val['visible']==0, then we never show the field
91
-	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']);
92
-}
100
+	if (!empty($val['visible'])) {
101
+		$arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>(verifCond($val['enabled']) && ($val['visible'] != 3)), 'position'=>$val['position']);
102
+	}
103
+	}
93 104
 //var_dump($object->fields);
94 105
 // Extra fields
95 106
 if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) {
@@ -113,14 +124,18 @@  discard block
 block discarded – undo
113 124
 $permissiontodelete = $user->rights->stocktransfer->stocktransfer->delete;
114 125
 
115 126
 // Security check
116
-if (empty($conf->stocktransfer->enabled)) accessforbidden('Module not enabled');
127
+if (empty($conf->stocktransfer->enabled)) {
128
+	accessforbidden('Module not enabled');
129
+}
117 130
 $socid = 0;
118 131
 if ($user->socid > 0) {	// Protection if external user
119 132
 	//$socid = $user->socid;
120 133
 	accessforbidden();
121 134
 }
122 135
 //$result = restrictedArea($user, 'stocktransfer', $id, '');
123
-if (!$permissiontoread) accessforbidden();
136
+if (!$permissiontoread) {
137
+	accessforbidden();
138
+}
124 139
 
125 140
 
126 141
 
@@ -133,7 +148,9 @@  discard block
 block discarded – undo
133 148
 
134 149
 $parameters = array();
135 150
 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
136
-if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
151
+if ($reshook < 0) {
152
+	setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
153
+}
137 154
 
138 155
 if (empty($reshook)) {
139 156
 	// Selection of new fields
@@ -182,27 +199,42 @@  discard block
 block discarded – undo
182 199
 }
183 200
 // Add fields from extrafields
184 201
 if (!empty($extrafields->attributes[$object->table_element]['label'])) {
185
-	foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key." as options_".$key.', ' : '');
186
-}
202
+	foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
203
+		$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key." as options_".$key.', ' : '');
204
+	}
205
+	}
187 206
 // Add fields from hooks
188 207
 $parameters = array();
189 208
 $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
190 209
 $sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
191 210
 $sql = preg_replace('/,\s*$/', '', $sql);
192 211
 $sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
193
-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)";
194
-if ($object->ismultientitymanaged == 1) $sql .= " WHERE t.entity IN (".getEntity($object->element).")";
195
-else $sql .= " WHERE 1 = 1";
212
+if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
213
+	$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
214
+}
215
+if ($object->ismultientitymanaged == 1) {
216
+	$sql .= " WHERE t.entity IN (".getEntity($object->element).")";
217
+} else {
218
+	$sql .= " WHERE 1 = 1";
219
+}
196 220
 foreach ($search as $key => $val) {
197
-	if ($key == 'status' && $search[$key] == -1) continue;
221
+	if ($key == 'status' && $search[$key] == -1) {
222
+		continue;
223
+	}
198 224
 	$mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
199 225
 	if (strpos($object->fields[$key]['type'], 'integer:') === 0) {
200
-		if ($search[$key] == '-1') $search[$key] = '';
226
+		if ($search[$key] == '-1') {
227
+			$search[$key] = '';
228
+		}
201 229
 		$mode_search = 2;
202 230
 	}
203
-	if ($search[$key] != '') $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search));
231
+	if ($search[$key] != '') {
232
+		$sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search));
233
+	}
234
+	}
235
+if ($search_all) {
236
+	$sql .= natural_search(array_keys($fieldstosearchall), $search_all);
204 237
 }
205
-if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
206 238
 //$sql.= dolSqlDateFilter("t.field", $search_xxxday, $search_xxxmonth, $search_xxxyear);
207 239
 // Add where from extra fields
208 240
 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
@@ -244,7 +276,9 @@  discard block
 block discarded – undo
244 276
 if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) {
245 277
 	$num = $nbtotalofrecords;
246 278
 } else {
247
-	if ($limit) $sql .= $db->plimit($limit + 1, $offset);
279
+	if ($limit) {
280
+		$sql .= $db->plimit($limit + 1, $offset);
281
+	}
248 282
 
249 283
 	$resql = $db->query($sql);
250 284
 	if (!$resql) {
@@ -287,13 +321,22 @@  discard block
 block discarded – undo
287 321
 $arrayofselected = is_array($toselect) ? $toselect : array();
288 322
 
289 323
 $param = '';
290
-if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
291
-if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
324
+if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
325
+	$param .= '&contextpage='.urlencode($contextpage);
326
+}
327
+if ($limit > 0 && $limit != $conf->liste_limit) {
328
+	$param .= '&limit='.urlencode($limit);
329
+}
292 330
 foreach ($search as $key => $val) {
293
-	if (is_array($search[$key]) && count($search[$key])) foreach ($search[$key] as $skey) $param .= '&search_'.$key.'[]='.urlencode($skey);
294
-	else $param .= '&search_'.$key.'='.urlencode($search[$key]);
331
+	if (is_array($search[$key]) && count($search[$key])) {
332
+		foreach ($search[$key] as $skey) $param .= '&search_'.$key.'[]='.urlencode($skey);
333
+	} else {
334
+		$param .= '&search_'.$key.'='.urlencode($search[$key]);
335
+	}
336
+	}
337
+if ($optioncss != '') {
338
+	$param .= '&optioncss='.urlencode($optioncss);
295 339
 }
296
-if ($optioncss != '')     $param .= '&optioncss='.urlencode($optioncss);
297 340
 // Add $param from extra fields
298 341
 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
299 342
 
@@ -304,12 +347,18 @@  discard block
 block discarded – undo
304 347
 	//'builddoc'=>$langs->trans("PDFMerge"),
305 348
 	//'presend'=>$langs->trans("SendByMail"),
306 349
 );
307
-if ($permissiontodelete) $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
308
-if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array();
350
+if ($permissiontodelete) {
351
+	$arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
352
+}
353
+if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
354
+	$arrayofmassactions = array();
355
+}
309 356
 $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
310 357
 
311 358
 print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
312
-if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
359
+if ($optioncss != '') {
360
+	print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
361
+}
313 362
 print '<input type="hidden" name="token" value="'.newToken().'">';
314 363
 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
315 364
 print '<input type="hidden" name="action" value="list">';
@@ -330,7 +379,9 @@  discard block
 block discarded – undo
330 379
 include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
331 380
 
332 381
 if ($search_all) {
333
-	foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val);
382
+	foreach ($fieldstosearchall as $key => $val) {
383
+		$fieldstosearchall[$key] = $langs->trans($val);
384
+	}
334 385
 	print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>';
335 386
 }
336 387
 
@@ -341,8 +392,11 @@  discard block
 block discarded – undo
341 392
 
342 393
 $parameters = array();
343 394
 $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
344
-if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
345
-else $moreforfilter = $hookmanager->resPrint;
395
+if (empty($reshook)) {
396
+	$moreforfilter .= $hookmanager->resPrint;
397
+} else {
398
+	$moreforfilter = $hookmanager->resPrint;
399
+}
346 400
 
347 401
 if (!empty($moreforfilter)) {
348 402
 	print '<div class="liste_titre liste_titre_bydiv centpercent">';
@@ -363,16 +417,24 @@  discard block
 block discarded – undo
363 417
 print '<tr class="liste_titre">';
364 418
 foreach ($object->fields as $key => $val) {
365 419
 	$cssforfield = (empty($val['css']) ? '' : $val['css']);
366
-	if ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center';
367
-	elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
368
-	elseif (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
369
-	elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield .= ($cssforfield ? ' ' : '').'right';
420
+	if ($key == 'status') {
421
+		$cssforfield .= ($cssforfield ? ' ' : '').'center';
422
+	} elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
423
+		$cssforfield .= ($cssforfield ? ' ' : '').'center';
424
+	} elseif (in_array($val['type'], array('timestamp'))) {
425
+		$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
426
+	} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') {
427
+		$cssforfield .= ($cssforfield ? ' ' : '').'right';
428
+	}
370 429
 	if (!empty($arrayfields['t.'.$key]['checked'])) {
371 430
 		print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
372
-		if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75');
373
-		elseif (strpos($val['type'], 'integer:') === 0) {
431
+		if (is_array($val['arrayofkeyval'])) {
432
+			print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75');
433
+		} elseif (strpos($val['type'], 'integer:') === 0) {
374 434
 			print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1);
375
-		} elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
435
+		} elseif (!preg_match('/^(date|timestamp)/', $val['type'])) {
436
+			print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
437
+		}
376 438
 		print '</td>';
377 439
 	}
378 440
 }
@@ -396,10 +458,15 @@  discard block
 block discarded – undo
396 458
 print '<tr class="liste_titre">';
397 459
 foreach ($object->fields as $key => $val) {
398 460
 	$cssforfield = (empty($val['css']) ? '' : $val['css']);
399
-	if ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center';
400
-	elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
401
-	elseif (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
402
-	elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield .= ($cssforfield ? ' ' : '').'right';
461
+	if ($key == 'status') {
462
+		$cssforfield .= ($cssforfield ? ' ' : '').'center';
463
+	} elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
464
+		$cssforfield .= ($cssforfield ? ' ' : '').'center';
465
+	} elseif (in_array($val['type'], array('timestamp'))) {
466
+		$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
467
+	} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') {
468
+		$cssforfield .= ($cssforfield ? ' ' : '').'right';
469
+	}
403 470
 	if (!empty($arrayfields['t.'.$key]['checked'])) {
404 471
 		print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n";
405 472
 	}
@@ -419,7 +486,10 @@  discard block
 block discarded – undo
419 486
 $needToFetchEachLine = 0;
420 487
 if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
421 488
 	foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
422
-		if (preg_match('/\$object/', $val)) $needToFetchEachLine++; // There is at least one compute field that use $object
489
+		if (preg_match('/\$object/', $val)) {
490
+			$needToFetchEachLine++;
491
+		}
492
+		// There is at least one compute field that use $object
423 493
 	}
424 494
 }
425 495
 
@@ -430,7 +500,10 @@  discard block
 block discarded – undo
430 500
 $totalarray = array();
431 501
 while ($i < ($limit ? min($num, $limit) : $num)) {
432 502
 	$obj = $db->fetch_object($resql);
433
-	if (empty($obj)) break; // Should not happen
503
+	if (empty($obj)) {
504
+		break;
505
+	}
506
+	// Should not happen
434 507
 
435 508
 	// Store properties in $object
436 509
 	$object->setVarsFromFetchObj($obj);
@@ -439,31 +512,48 @@  discard block
 block discarded – undo
439 512
 	print '<tr class="oddeven">';
440 513
 	foreach ($object->fields as $key => $val) {
441 514
 		$cssforfield = (empty($val['css']) ? '' : $val['css']);
442
-		if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
443
-		elseif ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center';
515
+		if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
516
+			$cssforfield .= ($cssforfield ? ' ' : '').'center';
517
+		} elseif ($key == 'status') {
518
+			$cssforfield .= ($cssforfield ? ' ' : '').'center';
519
+		}
444 520
 
445
-		if (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
446
-		elseif ($key == 'ref') $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
521
+		if (in_array($val['type'], array('timestamp'))) {
522
+			$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
523
+		} elseif ($key == 'ref') {
524
+			$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
525
+		}
447 526
 
448
-		if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'status') $cssforfield .= ($cssforfield ? ' ' : '').'right';
527
+		if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'status') {
528
+			$cssforfield .= ($cssforfield ? ' ' : '').'right';
529
+		}
449 530
 		//if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
450 531
 
451 532
 		if (!empty($arrayfields['t.'.$key]['checked'])) {
452 533
 			print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>';
453
-			if ($key == 'status') print $object->getLibStatut(5);
454
-			else {
534
+			if ($key == 'status') {
535
+				print $object->getLibStatut(5);
536
+			} else {
455 537
 				print $object->showOutputField($val, $key, $object->$key, '');
456 538
 				if ($key === 'date_prevue_depart' && $object->lead_time_for_warning > 0 && $object->$key > 0) {
457 539
 					$date_prevue_depart = $object->$key;
458 540
 					$date_prevue_depart_plus_delai = $date_prevue_depart;
459
-					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');
460
-					if ($date_prevue_depart_plus_delai < strtotime(date('Y-m-d'))) print img_warning($langs->trans('Alert').' - '.$langs->trans('Late'));
541
+					if ($object->lead_time_for_warning > 0) {
542
+						$date_prevue_depart_plus_delai = strtotime(date('Y-m-d', $date_prevue_depart) . ' + '.$object->lead_time_for_warning.' day');
543
+					}
544
+					if ($date_prevue_depart_plus_delai < strtotime(date('Y-m-d'))) {
545
+						print img_warning($langs->trans('Alert').' - '.$langs->trans('Late'));
546
+					}
461 547
 				}
462 548
 			}
463 549
 			print '</td>';
464
-			if (!$i) $totalarray['nbfield']++;
550
+			if (!$i) {
551
+				$totalarray['nbfield']++;
552
+			}
465 553
 			if (!empty($val['isameasure'])) {
466
-				if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
554
+				if (!$i) {
555
+					$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
556
+				}
467 557
 				$totalarray['val']['t.'.$key] += $object->$key;
468 558
 			}
469 559
 		}
@@ -478,11 +568,15 @@  discard block
 block discarded – undo
478 568
 	print '<td class="nowrap center">';
479 569
 	if ($massactionbutton || $massaction) {   // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
480 570
 		$selected = 0;
481
-		if (in_array($object->id, $arrayofselected)) $selected = 1;
571
+		if (in_array($object->id, $arrayofselected)) {
572
+			$selected = 1;
573
+		}
482 574
 		print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
483 575
 	}
484 576
 	print '</td>';
485
-	if (!$i) $totalarray['nbfield']++;
577
+	if (!$i) {
578
+		$totalarray['nbfield']++;
579
+	}
486 580
 
487 581
 	print '</tr>'."\n";
488 582
 
@@ -495,7 +589,10 @@  discard block
 block discarded – undo
495 589
 // If no record found
496 590
 if ($num == 0) {
497 591
 	$colspan = 1;
498
-	foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; }
592
+	foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) {
593
+		$colspan++;
594
+	}
595
+	}
499 596
 	print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
500 597
 }
501 598
 
@@ -513,7 +610,9 @@  discard block
 block discarded – undo
513 610
 
514 611
 if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
515 612
 	$hidegeneratedfilelistifempty = 1;
516
-	if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty = 0;
613
+	if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
614
+		$hidegeneratedfilelistifempty = 0;
615
+	}
517 616
 
518 617
 	require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
519 618
 	$formfile = new FormFile($db);
Please login to merge, or discard this patch.
htdocs/accountancy/admin/defaultaccounts.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 print '<tr class="oddeven value">';
259 259
 // Param
260 260
 print '<td>';
261
-print img_picto('', 'bill', 'class="pictofixedwidth"') . $langs->trans('ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT');
261
+print img_picto('', 'bill', 'class="pictofixedwidth"').$langs->trans('ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT');
262 262
 print '</td>';
263 263
 // Value
264 264
 print '<td class="right">'; // Do not force class=right, or it align also the content of the select box
@@ -268,13 +268,13 @@  discard block
 block discarded – undo
268 268
 
269 269
 if (isModEnabled('societe') && getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT') && getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT') != '-1') {
270 270
 	print '<tr class="oddeven">';
271
-	print '<td>' . img_picto('', 'bill', 'class="pictofixedwidth"') . $langs->trans("UseAuxiliaryAccountOnCustomerDeposit") . '</td>';
271
+	print '<td>'.img_picto('', 'bill', 'class="pictofixedwidth"').$langs->trans("UseAuxiliaryAccountOnCustomerDeposit").'</td>';
272 272
 	if (getDolGlobalInt('ACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT')) {
273
-		print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?token=' . newToken() . '&action=setACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT&value=0">';
273
+		print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT&value=0">';
274 274
 		print img_picto($langs->trans("Activated"), 'switch_on', '', false, 0, 0, '', 'warning');
275 275
 		print '</a></td>';
276 276
 	} else {
277
-		print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?token=' . newToken() . '&action=setACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT&value=1">';
277
+		print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT&value=1">';
278 278
 		print img_picto($langs->trans("Disabled"), 'switch_off');
279 279
 		print '</a></td>';
280 280
 	}
Please login to merge, or discard this patch.
htdocs/bom/class/bom.class.php 1 patch
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -671,11 +671,11 @@
 block discarded – undo
671 671
 			$rankToUse = (int) $position;
672 672
 			if ($rankToUse != $line->oldcopy->position) { // check if position have a new value
673 673
 				foreach ($this->lines as $bl) {
674
-					if ($bl->position >= $rankToUse AND $bl->position < ($line->oldcopy->position + 1)) { // move rank up
674
+					if ($bl->position >= $rankToUse and $bl->position < ($line->oldcopy->position + 1)) { // move rank up
675 675
 						$bl->position++;
676 676
 						$bl->update($user);
677 677
 					}
678
-					if ($bl->position <= $rankToUse AND $bl->position > ($line->oldcopy->position)) { // move rank down
678
+					if ($bl->position <= $rankToUse and $bl->position > ($line->oldcopy->position)) { // move rank down
679 679
 						$bl->position--;
680 680
 						$bl->update($user);
681 681
 					}
Please login to merge, or discard this patch.