Passed
Branch develop (66e4de)
by Laurent
33:03
created
htdocs/compta/deplacement/card.php 1 patch
Braces   +30 added lines, -12 removed lines patch added patch discarded remove patch
@@ -40,7 +40,9 @@  discard block
 block discarded – undo
40 40
 
41 41
 // Security check
42 42
 $id = GETPOST('id', 'int');
43
-if ($user->socid) $socid = $user->socid;
43
+if ($user->socid) {
44
+	$socid = $user->socid;
45
+}
44 46
 $result = restrictedArea($user, 'deplacement', $id, '');
45 47
 
46 48
 $action = GETPOST('action', 'aZ09');
@@ -181,20 +183,26 @@  discard block
 block discarded – undo
181 183
 {
182 184
 	$object->fetch($id);
183 185
 	$result = $object->setProject(GETPOST('projectid', 'int'));
184
-	if ($result < 0) dol_print_error($db, $object->error);
185
-} // Set fields
186
+	if ($result < 0) {
187
+		dol_print_error($db, $object->error);
188
+	}
189
+	} // Set fields
186 190
 elseif ($action == 'setdated' && $user->rights->deplacement->creer)
187 191
 {
188 192
 	$dated = dol_mktime(GETPOST('datedhour', 'int'), GETPOST('datedmin', 'int'), GETPOST('datedsec', 'int'), GETPOST('datedmonth', 'int'), GETPOST('datedday', 'int'), GETPOST('datedyear', 'int'));
189 193
 	$object->fetch($id);
190 194
 	$result = $object->setValueFrom('dated', $dated, '', '', 'date', '', $user, 'DEPLACEMENT_MODIFY');
191
-	if ($result < 0) dol_print_error($db, $object->error);
192
-} elseif ($action == 'setkm' && $user->rights->deplacement->creer)
195
+	if ($result < 0) {
196
+		dol_print_error($db, $object->error);
197
+	}
198
+	} elseif ($action == 'setkm' && $user->rights->deplacement->creer)
193 199
 {
194 200
 	$object->fetch($id);
195 201
 	$result = $object->setValueFrom('km', GETPOST('km', 'int'), '', null, 'text', '', $user, 'DEPLACEMENT_MODIFY');
196
-	if ($result < 0) dol_print_error($db, $object->error);
197
-}
202
+	if ($result < 0) {
203
+		dol_print_error($db, $object->error);
204
+	}
205
+	}
198 206
 
199 207
 
200 208
 /*
@@ -392,7 +400,9 @@  discard block
 block discarded – undo
392 400
 			}
393 401
 
394 402
 			$soc = new Societe($db);
395
-			if ($object->socid) $soc->fetch($object->socid);
403
+			if ($object->socid) {
404
+				$soc->fetch($object->socid);
405
+			}
396 406
 
397 407
 			print '<table class="border centpercent">';
398 408
 
@@ -436,7 +446,9 @@  discard block
 block discarded – undo
436 446
 			// Where
437 447
 			print '<tr><td>'.$langs->trans("CompanyVisited").'</td>';
438 448
 			print '<td>';
439
-			if ($soc->id) print $soc->getNomUrl(1);
449
+			if ($soc->id) {
450
+				print $soc->getNomUrl(1);
451
+			}
440 452
 			print '</td></tr>';
441 453
 
442 454
 			// Project
@@ -489,31 +501,37 @@  discard block
 block discarded – undo
489 501
 
490 502
 			print '<div class="tabsAction">';
491 503
 
492
-			if ($object->statut < Deplacement::STATUS_REFUNDED) 	// if not refunded
504
+			if ($object->statut < Deplacement::STATUS_REFUNDED) {
505
+				// if not refunded
493 506
 			{
494 507
 				if ($user->rights->deplacement->creer)
495 508
 				{
496 509
 					print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id='.$id.'">'.$langs->trans('Modify').'</a>';
510
+			}
497 511
 				} else {
498 512
 					print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Modify').'</a>';
499 513
 				}
500 514
 			}
501 515
 
502
-			if ($object->statut == Deplacement::STATUS_DRAFT) 	// if draft
516
+			if ($object->statut == Deplacement::STATUS_DRAFT) {
517
+				// if draft
503 518
 			{
504 519
 				if ($user->rights->deplacement->creer)
505 520
 				{
506 521
 					print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=validate&id='.$id.'">'.$langs->trans('Validate').'</a>';
522
+			}
507 523
 				} else {
508 524
 					print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Validate').'</a>';
509 525
 				}
510 526
 			}
511 527
 
512
-			if ($object->statut == Deplacement::STATUS_VALIDATED) 	// if validated
528
+			if ($object->statut == Deplacement::STATUS_VALIDATED) {
529
+				// if validated
513 530
 			{
514 531
 				if ($user->rights->deplacement->creer)
515 532
 				{
516 533
 					print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=classifyrefunded&id='.$id.'">'.$langs->trans('ClassifyRefunded').'</a>';
534
+			}
517 535
 				} else {
518 536
 					print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('ClassifyRefunded').'</a>';
519 537
 				}
Please login to merge, or discard this patch.
htdocs/compta/bank/various_payment/card.php 1 patch
Braces   +30 added lines, -9 removed lines patch added patch discarded remove patch
@@ -57,7 +57,9 @@  discard block
 block discarded – undo
57 57
 
58 58
 // Security check
59 59
 $socid = GETPOST("socid", "int");
60
-if ($user->socid) $socid = $user->socid;
60
+if ($user->socid) {
61
+	$socid = $user->socid;
62
+}
61 63
 $result = restrictedArea($user, 'banque', '', '', '');
62 64
 
63 65
 $object = new PaymentVarious($db);
@@ -72,7 +74,9 @@  discard block
 block discarded – undo
72 74
 
73 75
 $parameters = array();
74 76
 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
75
-if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
77
+if ($reshook < 0) {
78
+	setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
79
+}
76 80
 
77 81
 if (empty($reshook))
78 82
 {
@@ -91,7 +95,9 @@  discard block
 block discarded – undo
91 95
 			header("Location: ".$urltogo);
92 96
 			exit;
93 97
 		}
94
-		if ($id > 0 || !empty($ref)) $ret = $object->fetch($id, $ref);
98
+		if ($id > 0 || !empty($ref)) {
99
+			$ret = $object->fetch($id, $ref);
100
+		}
95 101
 		$action = '';
96 102
 	}
97 103
 
@@ -101,7 +107,9 @@  discard block
 block discarded – undo
101 107
 
102 108
 		$datep = dol_mktime(12, 0, 0, GETPOST("datepmonth", 'int'), GETPOST("datepday", 'int'), GETPOST("datepyear", 'int'));
103 109
 		$datev = dol_mktime(12, 0, 0, GETPOST("datevmonth", 'int'), GETPOST("datevday", 'int'), GETPOST("datevyear", 'int'));
104
-		if (empty($datev)) $datev = $datep;
110
+		if (empty($datev)) {
111
+			$datev = $datep;
112
+		}
105 113
 
106 114
 		$object->ref = ''; // TODO
107 115
 		$object->accountid = GETPOST("accountid", 'int') > 0 ? GETPOST("accountid", "int") : 0;
@@ -189,7 +197,10 @@  discard block
 block discarded – undo
189 197
 				{
190 198
 					$accountline = new AccountLine($db);
191 199
 					$result = $accountline->fetch($object->fk_bank);
192
-					if ($result > 0) $result = $accountline->delete($user); // $result may be 0 if not found (when bank entry was deleted manually and fk_bank point to nothing)
200
+					if ($result > 0) {
201
+						$result = $accountline->delete($user);
202
+					}
203
+					// $result may be 0 if not found (when bank entry was deleted manually and fk_bank point to nothing)
193 204
 				}
194 205
 
195 206
 				if ($result >= 0)
@@ -249,7 +260,9 @@  discard block
 block discarded – undo
249 260
 
250 261
 		$newdatepayment = dol_mktime(0, 0, 0, GETPOST('clone_date_paymentmonth', 'int'), GETPOST('clone_date_paymentday', 'int'), GETPOST('clone_date_paymentyear', 'int'));
251 262
 		$newdatevalue = dol_mktime(0, 0, 0, GETPOST('clone_date_valuemonth', 'int'), GETPOST('clone_date_valueday', 'int'), GETPOST('clone_date_valueyear', 'int'));
252
-		if ($newdatepayment) $object->datep = $newdatepayment;
263
+		if ($newdatepayment) {
264
+			$object->datep = $newdatepayment;
265
+		}
253 266
 		if (!empty($newdatevalue)) {
254 267
 			$object->datev = $newdatevalue;
255 268
 		} else {
@@ -292,8 +305,12 @@  discard block
 block discarded – undo
292 305
 llxHeader("", $langs->trans("VariousPayment"));
293 306
 
294 307
 $form = new Form($db);
295
-if (!empty($conf->accounting->enabled)) $formaccounting = new FormAccounting($db);
296
-if (!empty($conf->projet->enabled)) $formproject = new FormProjets($db);
308
+if (!empty($conf->accounting->enabled)) {
309
+	$formaccounting = new FormAccounting($db);
310
+}
311
+if (!empty($conf->projet->enabled)) {
312
+	$formproject = new FormProjets($db);
313
+}
297 314
 
298 315
 if ($id)
299 316
 {
@@ -550,7 +567,11 @@  discard block
 block discarded – undo
550 567
 	print '</td></tr>';
551 568
 
552 569
 	// Debit / Credit
553
-	if ($object->sens == '1') $sens = $langs->trans("Credit"); else $sens = $langs->trans("Debit");
570
+	if ($object->sens == '1') {
571
+		$sens = $langs->trans("Credit");
572
+	} else {
573
+		$sens = $langs->trans("Debit");
574
+	}
554 575
 	print '<tr><td>'.$langs->trans("Sens").'</td><td>'.$sens.'</td></tr>';
555 576
 
556 577
 	print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($object->amount, 0, $outputlangs, 1, -1, -1, $conf->currency).'</td></tr>';
Please login to merge, or discard this patch.
htdocs/accountancy/admin/journals_list.php 1 patch
Braces   +127 added lines, -45 removed lines patch added patch discarded remove patch
@@ -22,7 +22,10 @@  discard block
 block discarded – undo
22 22
  * \brief		Setup page to configure journals
23 23
  */
24 24
 
25
-if (!defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
25
+if (!defined('CSRFCHECK_WITH_TOKEN')) {
26
+	define('CSRFCHECK_WITH_TOKEN', '1');
27
+}
28
+// Force use of CSRF protection with tokens even for GET
26 29
 
27 30
 require '../../main.inc.php';
28 31
 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
@@ -64,8 +67,12 @@  discard block
 block discarded – undo
64 67
 $offset = $listlimit * $page;
65 68
 $pageprev = $page - 1;
66 69
 $pagenext = $page + 1;
67
-if (empty($sortfield)) $sortfield = 'code';
68
-if (empty($sortorder)) $sortorder = 'ASC';
70
+if (empty($sortfield)) {
71
+	$sortfield = 'code';
72
+}
73
+if (empty($sortorder)) {
74
+	$sortorder = 'ASC';
75
+}
69 76
 
70 77
 $error = 0;
71 78
 
@@ -162,9 +169,15 @@  discard block
 block discarded – undo
162 169
 	$ok = 1;
163 170
 	foreach ($listfield as $f => $value)
164 171
 	{
165
-		if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label'))  $fieldnamekey = 'Label';
166
-		if ($fieldnamekey == 'code') $fieldnamekey = 'Code';
167
-		if ($fieldnamekey == 'nature') $fieldnamekey = 'NatureOfJournal';
172
+		if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) {
173
+			$fieldnamekey = 'Label';
174
+		}
175
+		if ($fieldnamekey == 'code') {
176
+			$fieldnamekey = 'Code';
177
+		}
178
+		if ($fieldnamekey == 'nature') {
179
+			$fieldnamekey = 'NatureOfJournal';
180
+		}
168 181
 	}
169 182
 	// Other checks
170 183
 	if (GETPOSTISSET("code"))
@@ -187,9 +200,18 @@  discard block
 block discarded – undo
187 200
 	}
188 201
 
189 202
 	// Clean some parameters
190
-	if ($_POST["accountancy_code"] <= 0) $_POST["accountancy_code"] = ''; // If empty, we force to null
191
-	if ($_POST["accountancy_code_sell"] <= 0) $_POST["accountancy_code_sell"] = ''; // If empty, we force to null
192
-	if ($_POST["accountancy_code_buy"] <= 0) $_POST["accountancy_code_buy"] = ''; // If empty, we force to null
203
+	if ($_POST["accountancy_code"] <= 0) {
204
+		$_POST["accountancy_code"] = '';
205
+	}
206
+	// If empty, we force to null
207
+	if ($_POST["accountancy_code_sell"] <= 0) {
208
+		$_POST["accountancy_code_sell"] = '';
209
+	}
210
+	// If empty, we force to null
211
+	if ($_POST["accountancy_code_buy"] <= 0) {
212
+		$_POST["accountancy_code_buy"] = '';
213
+	}
214
+	// If empty, we force to null
193 215
 
194 216
 	// Si verif ok et action add, on ajoute la ligne
195 217
 	if ($ok && GETPOST('actionadd', 'alpha'))
@@ -212,33 +234,44 @@  discard block
 block discarded – undo
212 234
 		// Add new entry
213 235
 		$sql = "INSERT INTO ".$tabname[$id]." (";
214 236
 		// List of fields
215
-		if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert))
216
-			$sql .= $tabrowid[$id].",";
237
+		if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert)) {
238
+					$sql .= $tabrowid[$id].",";
239
+		}
217 240
 		$sql .= $tabfieldinsert[$id];
218 241
 		$sql .= ",active,entity)";
219 242
 		$sql .= " VALUES(";
220 243
 
221 244
 		// List of values
222
-		if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert))
223
-			$sql .= $newid.",";
245
+		if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert)) {
246
+					$sql .= $newid.",";
247
+		}
224 248
 		$i = 0;
225 249
 		foreach ($listfieldinsert as $f => $value)
226 250
 		{
227 251
 			if ($value == 'entity') {
228 252
 				$_POST[$listfieldvalue[$i]] = $conf->entity;
229 253
 			}
230
-			if ($i) $sql .= ",";
231
-			if ($_POST[$listfieldvalue[$i]] == '') $sql .= "null"; // For vat, we want/accept code = ''
232
-			else $sql .= "'".$db->escape($_POST[$listfieldvalue[$i]])."'";
254
+			if ($i) {
255
+				$sql .= ",";
256
+			}
257
+			if ($_POST[$listfieldvalue[$i]] == '') {
258
+				$sql .= "null";
259
+			}
260
+			// For vat, we want/accept code = ''
261
+			else {
262
+				$sql .= "'".$db->escape($_POST[$listfieldvalue[$i]])."'";
263
+			}
233 264
 			$i++;
234 265
 		}
235 266
 		$sql .= ",1,".$conf->entity.")";
236 267
 
237 268
 		dol_syslog("actionadd", LOG_DEBUG);
238 269
 		$result = $db->query($sql);
239
-		if ($result)	// Add is ok
270
+		if ($result) {
271
+			// Add is ok
240 272
 		{
241 273
 			setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
274
+		}
242 275
 			$_POST = array('id'=>$id); // Clean $_POST array, we keep only
243 276
 		} else {
244 277
 			if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
@@ -270,10 +303,17 @@  discard block
 block discarded – undo
270 303
 			} elseif ($field == 'entity') {
271 304
 				$_POST[$listfieldvalue[$i]] = $conf->entity;
272 305
 			}
273
-			if ($i) $sql .= ",";
306
+			if ($i) {
307
+				$sql .= ",";
308
+			}
274 309
 			$sql .= $field."=";
275
-			if ($_POST[$listfieldvalue[$i]] == '' && !($listfieldvalue[$i] == 'code' && $id == 10)) $sql .= "null"; // For vat, we want/accept code = ''
276
-			else $sql .= "'".$db->escape($_POST[$listfieldvalue[$i]])."'";
310
+			if ($_POST[$listfieldvalue[$i]] == '' && !($listfieldvalue[$i] == 'code' && $id == 10)) {
311
+				$sql .= "null";
312
+			}
313
+			// For vat, we want/accept code = ''
314
+			else {
315
+				$sql .= "'".$db->escape($_POST[$listfieldvalue[$i]])."'";
316
+			}
277 317
 			$i++;
278 318
 		}
279 319
 		$sql .= " WHERE ".$rowidcol." = ".((int) $rowid);
@@ -295,9 +335,12 @@  discard block
 block discarded – undo
295 335
 //	$_GET["id"]=GETPOST('id', 'int');       // Force affichage dictionnaire en cours d'edition
296 336
 //}
297 337
 
298
-if ($action == 'confirm_delete' && $confirm == 'yes')       // delete
338
+if ($action == 'confirm_delete' && $confirm == 'yes') {
339
+	// delete
299 340
 {
300
-	if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; }
341
+	if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id];
342
+}
343
+} else { $rowidcol = "rowid"; }
301 344
 
302 345
 	$sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol." = ".((int) $rowid);
303 346
 	$sql .= " AND entity = ".$conf->entity;
@@ -391,7 +434,9 @@  discard block
 block discarded – undo
391 434
 	$sql .= " WHERE a.entity = ".$conf->entity;
392 435
 
393 436
 	// If sort order is "country", we use country_code instead
394
-	if ($sortfield == 'country') $sortfield = 'country_code';
437
+	if ($sortfield == 'country') {
438
+		$sortfield = 'country_code';
439
+	}
395 440
 	$sql .= $db->order($sortfield, $sortorder);
396 441
 	$sql .= $db->plimit($listlimit + 1, $offset);
397 442
 
@@ -432,12 +477,18 @@  discard block
 block discarded – undo
432 477
 
433 478
 			if ($valuetoshow != '') {
434 479
 				print '<td class="'.$class.'">';
435
-				if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
436
-				elseif (!empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
437
-				else print $valuetoshow;
480
+				if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) {
481
+					print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
482
+				} elseif (!empty($tabhelp[$id][$value])) {
483
+					print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
484
+				} else {
485
+					print $valuetoshow;
486
+				}
438 487
 				print '</td>';
439 488
 			}
440
-			if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') $alabelisused = 1;
489
+			if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') {
490
+				$alabelisused = 1;
491
+			}
441 492
 		}
442 493
 
443 494
 		print '<td>';
@@ -457,8 +508,9 @@  discard block
 block discarded – undo
457 508
 		{
458 509
 			foreach ($fieldlist as $key=>$val)
459 510
 			{
460
-				if (GETPOST($val) != '')
461
-					$obj->$val = GETPOST($val);
511
+				if (GETPOST($val) != '') {
512
+									$obj->$val = GETPOST($val);
513
+				}
462 514
 			}
463 515
 		}
464 516
 
@@ -491,11 +543,19 @@  discard block
 block discarded – undo
491 543
 		$i = 0;
492 544
 
493 545
 		$param = '&id='.$id;
494
-		if ($search_country_id > 0) $param .= '&search_country_id='.$search_country_id;
546
+		if ($search_country_id > 0) {
547
+			$param .= '&search_country_id='.$search_country_id;
548
+		}
495 549
 		$paramwithsearch = $param;
496
-		if ($sortorder) $paramwithsearch .= '&sortorder='.$sortorder;
497
-		if ($sortfield) $paramwithsearch .= '&sortfield='.$sortfield;
498
-		if (GETPOST('from', 'alpha')) $paramwithsearch .= '&from='.GETPOST('from', 'alpha');
550
+		if ($sortorder) {
551
+			$paramwithsearch .= '&sortorder='.$sortorder;
552
+		}
553
+		if ($sortfield) {
554
+			$paramwithsearch .= '&sortfield='.$sortfield;
555
+		}
556
+		if (GETPOST('from', 'alpha')) {
557
+			$paramwithsearch .= '&from='.GETPOST('from', 'alpha');
558
+		}
499 559
 
500 560
 		// There is several pages
501 561
 		if ($num > $listlimit)
@@ -576,7 +636,9 @@  discard block
 block discarded – undo
576 636
 					$error = $hookmanager->error; $errors = $hookmanager->errors;
577 637
 
578 638
 					// Show fields
579
-					if (empty($reshook)) fieldListJournal($fieldlist, $obj, $tabname[$id], 'edit');
639
+					if (empty($reshook)) {
640
+						fieldListJournal($fieldlist, $obj, $tabname[$id], 'edit');
641
+					}
580 642
 
581 643
 					print '<td class="center" colspan="4">';
582 644
 					print '<input type="hidden" name="page" value="'.$page.'">';
@@ -611,7 +673,9 @@  discard block
 block discarded – undo
611 673
 
612 674
 							$class = 'tddict';
613 675
 							// Show value for field
614
-							if ($showfield) print '<!-- '.$fieldlist[$field].' --><td class="'.$class.'">'.$valuetoshow.'</td>';
676
+							if ($showfield) {
677
+								print '<!-- '.$fieldlist[$field].' --><td class="'.$class.'">'.$valuetoshow.'</td>';
678
+							}
615 679
 						}
616 680
 					}
617 681
 
@@ -633,27 +697,39 @@  discard block
 block discarded – undo
633 697
 					$canbemodified = $iserasable;
634 698
 
635 699
 					$url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : '');
636
-					if ($param) $url .= '&'.$param;
700
+					if ($param) {
701
+						$url .= '&'.$param;
702
+					}
637 703
 					$url .= '&';
638 704
 
639 705
 					// Active
640 706
 					print '<td class="nowrap center">';
641
-					if ($canbedisabled) print '<a href="'.$url.'action='.$acts[$obj->active].'&token='.newToken().'">'.$actl[$obj->active].'</a>';
642
-					else print $langs->trans("AlwaysActive");
707
+					if ($canbedisabled) {
708
+						print '<a href="'.$url.'action='.$acts[$obj->active].'&token='.newToken().'">'.$actl[$obj->active].'</a>';
709
+					} else {
710
+						print $langs->trans("AlwaysActive");
711
+					}
643 712
 					print "</td>";
644 713
 
645 714
 					// Modify link
646
-					if ($canbemodified) print '<td class="center"><a class="reposition editfielda" href="'.$url.'action=edit&token='.newToken().'">'.img_edit().'</a></td>';
647
-					else print '<td>&nbsp;</td>';
715
+					if ($canbemodified) {
716
+						print '<td class="center"><a class="reposition editfielda" href="'.$url.'action=edit&token='.newToken().'">'.img_edit().'</a></td>';
717
+					} else {
718
+						print '<td>&nbsp;</td>';
719
+					}
648 720
 
649 721
 					// Delete link
650 722
 					if ($iserasable)
651 723
 					{
652 724
 						print '<td class="center">';
653
-						if ($user->admin) print '<a href="'.$url.'action=delete&token='.newToken().'">'.img_delete().'</a>';
725
+						if ($user->admin) {
726
+							print '<a href="'.$url.'action=delete&token='.newToken().'">'.img_delete().'</a>';
727
+						}
654 728
 						//else print '<a href="#">'.img_delete().'</a>';    // Some dictionary can be edited by other profile than admin
655 729
 						print '</td>';
656
-					} else print '<td>&nbsp;</td>';
730
+					} else {
731
+						print '<td>&nbsp;</td>';
732
+					}
657 733
 
658 734
 					print '<td></td>';
659 735
 
@@ -713,9 +789,15 @@  discard block
 block discarded – undo
713 789
 		} else {
714 790
 			print '<td>';
715 791
 			$size = ''; $class = '';
716
-			if ($fieldlist[$field] == 'code')  $class = 'maxwidth100';
717
-			if ($fieldlist[$field] == 'label') $class = 'quatrevingtpercent';
718
-			if ($fieldlist[$field] == 'sortorder' || $fieldlist[$field] == 'sens' || $fieldlist[$field] == 'category_type') $size = 'size="2" ';
792
+			if ($fieldlist[$field] == 'code') {
793
+				$class = 'maxwidth100';
794
+			}
795
+			if ($fieldlist[$field] == 'label') {
796
+				$class = 'quatrevingtpercent';
797
+			}
798
+			if ($fieldlist[$field] == 'sortorder' || $fieldlist[$field] == 'sens' || $fieldlist[$field] == 'category_type') {
799
+				$size = 'size="2" ';
800
+			}
719 801
 			print '<input type="text" '.$size.'class="flat'.($class ? ' '.$class : '').'" value="'.(isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">';
720 802
 			print '</td>';
721 803
 		}
Please login to merge, or discard this patch.
htdocs/api/class/api_setup.class.php 2 patches
Braces   +51 added lines, -17 removed lines patch added patch discarded remove patch
@@ -653,8 +653,12 @@  discard block
 block discarded – undo
653 653
 		$sql = "SELECT id, code, type, libelle as label, module";
654 654
 		$sql .= " FROM ".MAIN_DB_PREFIX."c_actioncomm as t";
655 655
 		$sql .= " WHERE t.active = ".$active;
656
-		if ($type) $sql .= " AND t.type LIKE '%".$this->db->escape($type)."%'";
657
-		if ($module)    $sql .= " AND t.module LIKE '%".$this->db->escape($module)."%'";
656
+		if ($type) {
657
+			$sql .= " AND t.type LIKE '%".$this->db->escape($type)."%'";
658
+		}
659
+		if ($module) {
660
+			$sql .= " AND t.module LIKE '%".$this->db->escape($module)."%'";
661
+		}
658 662
 		// Add sql filters
659 663
 		if ($sqlfilters)
660 664
 		{
@@ -717,7 +721,9 @@  discard block
 block discarded – undo
717 721
 		$sql = "SELECT id, code, label, accountancy_code, active, module, position";
718 722
 		$sql .= " FROM ".MAIN_DB_PREFIX."c_type_fees as t";
719 723
 		$sql .= " WHERE t.active = ".$active;
720
-		if ($module)    $sql .= " AND t.module LIKE '%".$this->db->escape($module)."%'";
724
+		if ($module) {
725
+			$sql .= " AND t.module LIKE '%".$this->db->escape($module)."%'";
726
+		}
721 727
 		// Add sql filters
722 728
 		if ($sqlfilters)
723 729
 		{
@@ -781,8 +787,12 @@  discard block
 block discarded – undo
781 787
 		$sql = "SELECT rowid, code, element as type, libelle as label, source, module, position";
782 788
 		$sql .= " FROM ".MAIN_DB_PREFIX."c_type_contact as t";
783 789
 		$sql .= " WHERE t.active = ".$active;
784
-		if ($type) $sql .= " AND type LIKE '%".$this->db->escape($type)."%'";
785
-		if ($module)    $sql .= " AND t.module LIKE '%".$this->db->escape($module)."%'";
790
+		if ($type) {
791
+			$sql .= " AND type LIKE '%".$this->db->escape($type)."%'";
792
+		}
793
+		if ($module) {
794
+			$sql .= " AND t.module LIKE '%".$this->db->escape($module)."%'";
795
+		}
786 796
 		// Add sql filters
787 797
 		if ($sqlfilters)
788 798
 		{
@@ -844,7 +854,9 @@  discard block
 block discarded – undo
844 854
 		$sql = "SELECT rowid, code, label, module";
845 855
 		$sql .= " FROM ".MAIN_DB_PREFIX."c_civility as t";
846 856
 		$sql .= " WHERE t.active = ".$active;
847
-		if ($module)    $sql .= " AND t.module LIKE '%".$this->db->escape($module)."%'";
857
+		if ($module) {
858
+			$sql .= " AND t.module LIKE '%".$this->db->escape($module)."%'";
859
+		}
848 860
 		// Add sql filters
849 861
 		if ($sqlfilters)
850 862
 		{
@@ -903,7 +915,9 @@  discard block
 block discarded – undo
903 915
 	{
904 916
 		$list = array();
905 917
 		$sql = "SELECT t.code_iso, t.label, t.unicode";
906
-		if (!empty($multicurrency)) $sql .= " , cr.date_sync, cr.rate ";
918
+		if (!empty($multicurrency)) {
919
+			$sql .= " , cr.date_sync, cr.rate ";
920
+		}
907 921
 		$sql .= " FROM ".MAIN_DB_PREFIX."c_currencies as t";
908 922
 		if (!empty($multicurrency)) {
909 923
 			$sql .= " JOIN ".MAIN_DB_PREFIX."multicurrency as m ON m.code=t.code_iso";
@@ -976,13 +990,19 @@  discard block
 block discarded – undo
976 990
 			throw new RestException(401, 'Only an admin user can get list of extrafields');
977 991
 		}
978 992
 
979
-		if ($type == 'thirdparty') $type = 'societe';
980
-		if ($type == 'contact') $type = 'socpeople';
993
+		if ($type == 'thirdparty') {
994
+			$type = 'societe';
995
+		}
996
+		if ($type == 'contact') {
997
+			$type = 'socpeople';
998
+		}
981 999
 
982 1000
 		$sql = "SELECT t.rowid, t.name, t.label, t.type, t.size, t.elementtype, t.fieldunique, t.fieldrequired, t.param, t.pos, t.alwayseditable, t.perms, t.list, t.fielddefault, t.fieldcomputed";
983 1001
 		$sql .= " FROM ".MAIN_DB_PREFIX."extrafields as t";
984 1002
 		$sql .= " WHERE t.entity IN (".getEntity('extrafields').")";
985
-		if (!empty($type)) $sql .= " AND t.elementtype = '".$this->db->escape($type)."'";
1003
+		if (!empty($type)) {
1004
+			$sql .= " AND t.elementtype = '".$this->db->escape($type)."'";
1005
+		}
986 1006
 		// Add sql filters
987 1007
 		if ($sqlfilters)
988 1008
 		{
@@ -1056,8 +1076,12 @@  discard block
 block discarded – undo
1056 1076
 		$sql = "SELECT rowid AS id, zip, town, fk_county, fk_pays AS fk_country";
1057 1077
 		$sql .= " FROM ".MAIN_DB_PREFIX."c_ziptown as t";
1058 1078
 		$sql .= " AND t.active = ".$active;
1059
-		if ($zipcode) $sql .= " AND t.zip LIKE '%".$this->db->escape($zipcode)."%'";
1060
-		if ($town)    $sql .= " AND t.town LIKE '%".$this->db->escape($town)."%'";
1079
+		if ($zipcode) {
1080
+			$sql .= " AND t.zip LIKE '%".$this->db->escape($zipcode)."%'";
1081
+		}
1082
+		if ($town) {
1083
+			$sql .= " AND t.town LIKE '%".$this->db->escape($town)."%'";
1084
+		}
1061 1085
 		// Add sql filters
1062 1086
 		if ($sqlfilters)
1063 1087
 		{
@@ -1617,10 +1641,16 @@  discard block
 block discarded – undo
1617 1641
 		$xmlfile = DOL_DOCUMENT_ROOT.$xmlshortfile;
1618 1642
 		// Remote file to compare to
1619 1643
 		$xmlremote = ($target == 'default' ? '' : $target);
1620
-		if (empty($xmlremote) && !empty($conf->global->MAIN_FILECHECK_URL)) $xmlremote = $conf->global->MAIN_FILECHECK_URL;
1644
+		if (empty($xmlremote) && !empty($conf->global->MAIN_FILECHECK_URL)) {
1645
+			$xmlremote = $conf->global->MAIN_FILECHECK_URL;
1646
+		}
1621 1647
 		$param = 'MAIN_FILECHECK_URL_'.DOL_VERSION;
1622
-		if (empty($xmlremote) && !empty($conf->global->$param)) $xmlremote = $conf->global->$param;
1623
-		if (empty($xmlremote)) $xmlremote = 'https://www.dolibarr.org/files/stable/signatures/filelist-'.DOL_VERSION.'.xml';
1648
+		if (empty($xmlremote) && !empty($conf->global->$param)) {
1649
+			$xmlremote = $conf->global->$param;
1650
+		}
1651
+		if (empty($xmlremote)) {
1652
+			$xmlremote = 'https://www.dolibarr.org/files/stable/signatures/filelist-'.DOL_VERSION.'.xml';
1653
+		}
1624 1654
 
1625 1655
 		if ($target == 'local')
1626 1656
 		{
@@ -1668,14 +1698,18 @@  discard block
 block discarded – undo
1668 1698
 				$out .= '</tr>'."\n";
1669 1699
 
1670 1700
 				$i = 0;
1671
-				foreach ($xml->dolibarr_constants[0]->constant as $constant)    // $constant is a simpleXMLElement
1701
+				foreach ($xml->dolibarr_constants[0]->constant as $constant) {
1702
+					// $constant is a simpleXMLElement
1672 1703
 				{
1673 1704
 					$constname = $constant['name'];
1705
+				}
1674 1706
 					$constvalue = (string) $constant;
1675 1707
 					$constvalue = (empty($constvalue) ? '0' : $constvalue);
1676 1708
 					// Value found
1677 1709
 					$value = '';
1678
-					if ($constname && $conf->global->$constname != '') $value = $conf->global->$constname;
1710
+					if ($constname && $conf->global->$constname != '') {
1711
+						$value = $conf->global->$constname;
1712
+					}
1679 1713
 					$valueforchecksum = (empty($value) ? '0' : $value);
1680 1714
 
1681 1715
 					$checksumconcat[] = $valueforchecksum;
Please login to merge, or discard this patch.
Indentation   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -111,70 +111,70 @@
 block discarded – undo
111 111
 		return $list;
112 112
 	}
113 113
 
114
-    /**
115
-     * Get the list of ordering origins.
116
-     *
117
-     * @param string    $sortfield  Sort field
118
-     * @param string    $sortorder  Sort order
119
-     * @param int       $limit      Number of items per page
120
-     * @param int       $page       Page number {@min 0}
121
-     * @param int       $active     Payment type is active or not {@min 0} {@max 1}
122
-     * @param string    $sqlfilters SQL criteria to filter with. Syntax example "(t.code:=:'OrderByWWW')"
123
-     *
124
-     * @url     GET dictionary/ordering_origins
125
-     *
126
-     * @return array [List of ordering reasons]
127
-     *
128
-     * @throws RestException 400
129
-     */
130
-    public function getOrderingOrigins($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
131
-    {
132
-        $list = array();
133
-
134
-        if (!DolibarrApiAccess::$user->rights->commande->lire) {
135
-            throw new RestException(401);
136
-        }
137
-
138
-        $sql = "SELECT rowid, code, label, module";
139
-        $sql .= " FROM ".MAIN_DB_PREFIX."c_input_reason as t";
140
-        $sql .= " WHERE t.active = ".$active;
141
-        // Add sql filters
142
-        if ($sqlfilters)
143
-        {
144
-            if (!DolibarrApi::_checkFilters($sqlfilters))
145
-            {
146
-                throw new RestException(400, 'error when validating parameter sqlfilters '.$sqlfilters);
147
-            }
148
-            $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
149
-            $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
150
-        }
151
-
152
-
153
-        $sql .= $this->db->order($sortfield, $sortorder);
154
-
155
-        if ($limit) {
156
-            if ($page < 0) {
157
-                $page = 0;
158
-            }
159
-            $offset = $limit * $page;
160
-
161
-            $sql .= $this->db->plimit($limit, $offset);
162
-        }
163
-
164
-        $result = $this->db->query($sql);
165
-
166
-        if ($result) {
167
-            $num = $this->db->num_rows($result);
168
-            $min = min($num, ($limit <= 0 ? $num : $limit));
169
-            for ($i = 0; $i < $min; $i++) {
170
-                $list[] = $this->db->fetch_object($result);
171
-            }
172
-        } else {
173
-            throw new RestException(400, $this->db->lasterror());
174
-        }
175
-
176
-        return $list;
177
-    }
114
+	/**
115
+	 * Get the list of ordering origins.
116
+	 *
117
+	 * @param string    $sortfield  Sort field
118
+	 * @param string    $sortorder  Sort order
119
+	 * @param int       $limit      Number of items per page
120
+	 * @param int       $page       Page number {@min 0}
121
+	 * @param int       $active     Payment type is active or not {@min 0} {@max 1}
122
+	 * @param string    $sqlfilters SQL criteria to filter with. Syntax example "(t.code:=:'OrderByWWW')"
123
+	 *
124
+	 * @url     GET dictionary/ordering_origins
125
+	 *
126
+	 * @return array [List of ordering reasons]
127
+	 *
128
+	 * @throws RestException 400
129
+	 */
130
+	public function getOrderingOrigins($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
131
+	{
132
+		$list = array();
133
+
134
+		if (!DolibarrApiAccess::$user->rights->commande->lire) {
135
+			throw new RestException(401);
136
+		}
137
+
138
+		$sql = "SELECT rowid, code, label, module";
139
+		$sql .= " FROM ".MAIN_DB_PREFIX."c_input_reason as t";
140
+		$sql .= " WHERE t.active = ".$active;
141
+		// Add sql filters
142
+		if ($sqlfilters)
143
+		{
144
+			if (!DolibarrApi::_checkFilters($sqlfilters))
145
+			{
146
+				throw new RestException(400, 'error when validating parameter sqlfilters '.$sqlfilters);
147
+			}
148
+			$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
149
+			$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
150
+		}
151
+
152
+
153
+		$sql .= $this->db->order($sortfield, $sortorder);
154
+
155
+		if ($limit) {
156
+			if ($page < 0) {
157
+				$page = 0;
158
+			}
159
+			$offset = $limit * $page;
160
+
161
+			$sql .= $this->db->plimit($limit, $offset);
162
+		}
163
+
164
+		$result = $this->db->query($sql);
165
+
166
+		if ($result) {
167
+			$num = $this->db->num_rows($result);
168
+			$min = min($num, ($limit <= 0 ? $num : $limit));
169
+			for ($i = 0; $i < $min; $i++) {
170
+				$list[] = $this->db->fetch_object($result);
171
+			}
172
+		} else {
173
+			throw new RestException(400, $this->db->lasterror());
174
+		}
175
+
176
+		return $list;
177
+	}
178 178
 
179 179
 	/**
180 180
 	 * Get the list of payments types.
Please login to merge, or discard this patch.
htdocs/resource/list.php 1 patch
Braces   +60 added lines, -20 removed lines patch added patch discarded remove patch
@@ -51,7 +51,9 @@  discard block
 block discarded – undo
51 51
 // fetch optionals attributes and labels
52 52
 $extrafields->fetch_name_optionals_label($object->table_element);
53 53
 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
54
-if (!is_array($search_array_options)) $search_array_options = array();
54
+if (!is_array($search_array_options)) {
55
+	$search_array_options = array();
56
+}
55 57
 $search_ref = GETPOST("search_ref", 'alpha');
56 58
 $search_type = GETPOST("search_type", 'alpha');
57 59
 
@@ -62,8 +64,12 @@  discard block
 block discarded – undo
62 64
 $filter = array();
63 65
 
64 66
 $param = '';
65
-if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&amp;contextpage='.urlencode($contextpage);
66
-if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&amp;limit='.urlencode($limit);
67
+if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
68
+	$param .= '&amp;contextpage='.urlencode($contextpage);
69
+}
70
+if ($limit > 0 && $limit != $conf->liste_limit) {
71
+	$param .= '&amp;limit='.urlencode($limit);
72
+}
67 73
 
68 74
 if ($search_ref != '') {
69 75
 	$param .= '&search_ref='.urlencode($search_ref);
@@ -84,21 +90,35 @@  discard block
 block discarded – undo
84 90
 		$param .= '&search_options_'.$tmpkey.'='.urlencode($val);
85 91
 	}
86 92
 	$mode_search = 0;
87
-	if (in_array($typ, array('int', 'double', 'real'))) $mode_search = 1; // Search on a numeric
88
-	if (in_array($typ, array('sellist', 'link')) && $crit != '0' && $crit != '-1') $mode_search = 2; // Search on a foreign key int
93
+	if (in_array($typ, array('int', 'double', 'real'))) {
94
+		$mode_search = 1;
95
+	}
96
+	// Search on a numeric
97
+	if (in_array($typ, array('sellist', 'link')) && $crit != '0' && $crit != '-1') {
98
+		$mode_search = 2;
99
+	}
100
+	// Search on a foreign key int
89 101
 	if ($crit != '' && (!in_array($typ, array('select', 'sellist')) || $crit != '0') && (!in_array($typ, array('link')) || $crit != '-1'))
90 102
 	{
91 103
 		$filter['ef.'.$tmpkey] = natural_search('ef.'.$tmpkey, $crit, $mode_search);
92 104
 	}
93 105
 }
94
-if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
106
+if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
107
+	$param .= '&contextpage='.urlencode($contextpage);
108
+}
95 109
 
96 110
 
97 111
 $hookmanager->initHooks(array('resourcelist'));
98 112
 
99
-if (empty($sortorder)) $sortorder = "ASC";
100
-if (empty($sortfield)) $sortfield = "t.ref";
101
-if (empty($arch)) $arch = 0;
113
+if (empty($sortorder)) {
114
+	$sortorder = "ASC";
115
+}
116
+if (empty($sortfield)) {
117
+	$sortfield = "t.ref";
118
+}
119
+if (empty($arch)) {
120
+	$arch = 0;
121
+}
102 122
 
103 123
 $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
104 124
 $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
@@ -125,8 +145,9 @@  discard block
 block discarded – undo
125 145
 {
126 146
 	foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val)
127 147
 	{
128
-		if (!empty($extrafields->attributes[$object->table_element]['list'][$key]))
129
-			$arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
148
+		if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) {
149
+					$arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
150
+		}
130 151
 	}
131 152
 }
132 153
 $object->fields = dol_sort_array($object->fields, 'position');
@@ -136,9 +157,11 @@  discard block
 block discarded – undo
136 157
 include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
137 158
 
138 159
 // Do we click on purge search criteria ?
139
-if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // Both test are required to be compatible with all browsers
160
+if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
161
+	// Both test are required to be compatible with all browsers
140 162
 {
141 163
 	$search_ref = "";
164
+}
142 165
 	$search_type = "";
143 166
 	$search_array_options = array();
144 167
 	$filter = array();
@@ -151,7 +174,9 @@  discard block
 block discarded – undo
151 174
 
152 175
 $parameters = array();
153 176
 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
154
-if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
177
+if ($reshook < 0) {
178
+	setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
179
+}
155 180
 
156 181
 
157 182
 /*
@@ -173,7 +198,9 @@  discard block
 block discarded – undo
173 198
 $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage);
174 199
 
175 200
 print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
176
-if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
201
+if ($optioncss != '') {
202
+	print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
203
+}
177 204
 print '<input type="hidden" name="token" value="'.newToken().'">';
178 205
 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
179 206
 print '<input type="hidden" name="action" value="list">';
@@ -235,8 +262,12 @@  discard block
 block discarded – undo
235 262
 print "</tr>\n";
236 263
 
237 264
 print '<tr class="liste_titre">';
238
-if (!empty($arrayfields['t.ref']['checked'])) print_liste_field_titre($arrayfields['t.ref']['label'], $_SERVER["PHP_SELF"], "t.ref", "", $param, "", $sortfield, $sortorder);
239
-if (!empty($arrayfields['ty.label']['checked'])) print_liste_field_titre($arrayfields['ty.label']['label'], $_SERVER["PHP_SELF"], "ty.label", "", $param, "", $sortfield, $sortorder);
265
+if (!empty($arrayfields['t.ref']['checked'])) {
266
+	print_liste_field_titre($arrayfields['t.ref']['label'], $_SERVER["PHP_SELF"], "t.ref", "", $param, "", $sortfield, $sortorder);
267
+}
268
+if (!empty($arrayfields['ty.label']['checked'])) {
269
+	print_liste_field_titre($arrayfields['ty.label']['label'], $_SERVER["PHP_SELF"], "ty.label", "", $param, "", $sortfield, $sortorder);
270
+}
240 271
 // Extra fields
241 272
 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
242 273
 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
@@ -254,7 +285,9 @@  discard block
 block discarded – undo
254 285
 			print '<td>';
255 286
 			print $resource->getNomUrl(5);
256 287
 			print '</td>';
257
-			if (!$i) $totalarray['nbfield']++;
288
+			if (!$i) {
289
+				$totalarray['nbfield']++;
290
+			}
258 291
 		}
259 292
 
260 293
 		if (!empty($arrayfields['ty.label']['checked']))
@@ -262,7 +295,9 @@  discard block
 block discarded – undo
262 295
 			print '<td>';
263 296
 			print $resource->type_label;
264 297
 			print '</td>';
265
-			if (!$i) $totalarray['nbfield']++;
298
+			if (!$i) {
299
+				$totalarray['nbfield']++;
300
+			}
266 301
 		}
267 302
 		// Extra fields
268 303
 		$obj = (Object) $resource->array_options;
@@ -277,13 +312,18 @@  discard block
 block discarded – undo
277 312
 		print img_delete('', 'class="marginleftonly"');
278 313
 		print '</a>';
279 314
 		print '</td>';
280
-		if (!$i) $totalarray['nbfield']++;
315
+		if (!$i) {
316
+			$totalarray['nbfield']++;
317
+		}
281 318
 
282 319
 		print '</tr>';
283 320
 	}
284 321
 } else {
285 322
 	$colspan = 1;
286
-	foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; }
323
+	foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) {
324
+		$colspan++;
325
+	}
326
+	}
287 327
 	print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
288 328
 }
289 329
 
Please login to merge, or discard this patch.
htdocs/website/websiteaccount_card.php 1 patch
Braces   +30 added lines, -11 removed lines patch added patch discarded remove patch
@@ -55,10 +55,14 @@  discard block
 block discarded – undo
55 55
 $search = array();
56 56
 foreach ($object->fields as $key => $val)
57 57
 {
58
-	if (GETPOST('search_'.$key, 'alpha')) $search[$key] = GETPOST('search_'.$key, 'alpha');
59
-}
58
+	if (GETPOST('search_'.$key, 'alpha')) {
59
+		$search[$key] = GETPOST('search_'.$key, 'alpha');
60
+	}
61
+	}
60 62
 
61
-if (empty($action) && empty($id) && empty($ref)) $action = 'view';
63
+if (empty($action) && empty($id) && empty($ref)) {
64
+	$action = 'view';
65
+}
62 66
 
63 67
 // Security check - Protection if external user
64 68
 //if ($user->socid > 0) accessforbidden();
@@ -80,7 +84,9 @@  discard block
 block discarded – undo
80 84
 
81 85
 $parameters = array();
82 86
 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
83
-if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
87
+if ($reshook < 0) {
88
+	setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
89
+}
84 90
 
85 91
 if (empty($reshook))
86 92
 {
@@ -196,7 +202,9 @@  discard block
 block discarded – undo
196 202
 // Part to show record
197 203
 if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create')))
198 204
 {
199
-	if ($object->fk_soc > 0 && empty($socid)) $socid = $object->fk_soc;
205
+	if ($object->fk_soc > 0 && empty($socid)) {
206
+		$socid = $object->fk_soc;
207
+	}
200 208
 
201 209
 	$res = $object->fetch_optionals();
202 210
 
@@ -213,8 +221,11 @@  discard block
 block discarded – undo
213 221
 	// Call Hook formConfirm
214 222
 	$parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid);
215 223
 	$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
216
-	if (empty($reshook)) $formconfirm .= $hookmanager->resPrint;
217
-	elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint;
224
+	if (empty($reshook)) {
225
+		$formconfirm .= $hookmanager->resPrint;
226
+	} elseif ($reshook > 0) {
227
+		$formconfirm = $hookmanager->resPrint;
228
+	}
218 229
 
219 230
 	// Print form confirm
220 231
 	print $formconfirm;
@@ -223,8 +234,12 @@  discard block
 block discarded – undo
223 234
 	// Object card
224 235
 	// ------------------------------------------------------------
225 236
 	$linkback = '';
226
-	if ($socid) $linkback = '<a href="'.DOL_URL_ROOT.'/societe/website.php?socid='.$socid.'&restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToListForThirdParty").'</a>';
227
-	if ($fk_website) $linkback = '<a href="'.DOL_URL_ROOT.'/website/website_card.php?fk_website='.$fk_website.'&restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
237
+	if ($socid) {
238
+		$linkback = '<a href="'.DOL_URL_ROOT.'/societe/website.php?socid='.$socid.'&restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToListForThirdParty").'</a>';
239
+	}
240
+	if ($fk_website) {
241
+		$linkback = '<a href="'.DOL_URL_ROOT.'/website/website_card.php?fk_website='.$fk_website.'&restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
242
+	}
228 243
 
229 244
 	$morehtmlref = '<div class="refidno">';
230 245
 	/*
@@ -270,7 +285,9 @@  discard block
 block discarded – undo
270 285
 	*/
271 286
 	$morehtmlref .= '</div>';
272 287
 
273
-	if ($socid > 0) $object->next_prev_filter = 'te.fk_soc = '.$socid;
288
+	if ($socid > 0) {
289
+		$object->next_prev_filter = 'te.fk_soc = '.$socid;
290
+	}
274 291
 
275 292
 	dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'rowid', $morehtmlref);
276 293
 
@@ -301,7 +318,9 @@  discard block
 block discarded – undo
301 318
 		print '<div class="tabsAction">'."\n";
302 319
 		$parameters = array();
303 320
 		$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
304
-		if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
321
+		if ($reshook < 0) {
322
+			setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
323
+		}
305 324
 
306 325
 		if (empty($reshook))
307 326
 		{
Please login to merge, or discard this patch.
htdocs/categories/traduction.php 1 patch
Braces   +23 added lines, -8 removed lines patch added patch discarded remove patch
@@ -60,7 +60,10 @@  discard block
 block discarded – undo
60 60
 	dol_print_error($db, $object->error); exit;
61 61
 }
62 62
 
63
-if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
63
+if (is_numeric($type)) {
64
+	$type = Categorie::$MAP_ID_TO_CODE[$type];
65
+}
66
+// For backward compatibility
64 67
 
65 68
 /*
66 69
  * Actions
@@ -110,7 +113,9 @@  discard block
 block discarded – undo
110 113
 
111 114
 			// sauvegarde en base
112 115
 			$res = $object->setMultiLangs($user);
113
-			if ($res < 0) $error++;
116
+			if ($res < 0) {
117
+				$error++;
118
+			}
114 119
 		}
115 120
 	}
116 121
 
@@ -130,9 +135,11 @@  discard block
 block discarded – undo
130 135
 	$object->fetch($id);
131 136
 	$current_lang = $langs->getDefaultLang();
132 137
 
133
-	foreach ($object->multilangs as $key => $value) // enregistrement des nouvelles valeurs dans l'objet
138
+	foreach ($object->multilangs as $key => $value) {
139
+		// enregistrement des nouvelles valeurs dans l'objet
134 140
 	{
135 141
 		$libelle = GETPOST('libelle-'.$key, 'alpha');
142
+	}
136 143
 		$desc = GETPOST('desc-'.$key);
137 144
 
138 145
 		if (empty($libelle)) {
@@ -151,7 +158,9 @@  discard block
 block discarded – undo
151 158
 
152 159
 	if (!$error) {
153 160
 		$res = $object->setMultiLangs($user);
154
-		if ($res < 0)   $error++;
161
+		if ($res < 0) {
162
+			$error++;
163
+		}
155 164
 	}
156 165
 
157 166
 	if ($error) {
@@ -241,7 +250,9 @@  discard block
 block discarded – undo
241 250
 	if ($user->rights->produit->creer || $user->rights->service->creer)
242 251
 	{
243 252
 		print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=add&id='.$object->id.'&type='.$type.'">'.$langs->trans('Add').'</a>';
244
-		if ($cnt_trans > 0) print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&id='.$object->id.'&type='.$type.'">'.$langs->trans('Update').'</a>';
253
+		if ($cnt_trans > 0) {
254
+			print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&id='.$object->id.'&type='.$type.'">'.$langs->trans('Update').'</a>';
255
+		}
245 256
 	}
246 257
 }
247 258
 
@@ -293,7 +304,9 @@  discard block
 block discarded – undo
293 304
 	print '</form>';
294 305
 } elseif ($action != 'add')
295 306
 {
296
-	if ($cnt_trans) print '<div class="underbanner clearboth"></div>';
307
+	if ($cnt_trans) {
308
+		print '<div class="underbanner clearboth"></div>';
309
+	}
297 310
 
298 311
 	if (!empty($object->multilangs))
299 312
 	{
@@ -311,8 +324,10 @@  discard block
 block discarded – undo
311 324
 			print '</table>';
312 325
 		}
313 326
 	}
314
-	if (!$cnt_trans && $action != 'add') print '<div class="opacitymedium">'.$langs->trans('NoTranslation').'</div>';
315
-}
327
+	if (!$cnt_trans && $action != 'add') {
328
+		print '<div class="opacitymedium">'.$langs->trans('NoTranslation').'</div>';
329
+	}
330
+	}
316 331
 
317 332
 
318 333
 /*
Please login to merge, or discard this patch.
htdocs/categories/photos.php 1 patch
Braces   +16 added lines, -5 removed lines patch added patch discarded remove patch
@@ -62,7 +62,10 @@  discard block
 block discarded – undo
62 62
 }
63 63
 $upload_dir = $conf->categorie->multidir_output[$object->entity];
64 64
 
65
-if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
65
+if (is_numeric($type)) {
66
+	$type = Categorie::$MAP_ID_TO_CODE[$type];
67
+}
68
+// For backward compatibility
66 69
 
67 70
 /*
68 71
  * Actions
@@ -220,8 +223,12 @@  discard block
 block discarded – undo
220 223
 			{
221 224
 				$nbphoto++;
222 225
 
223
-				if ($nbbyrow && ($nbphoto % $nbbyrow == 1)) print '<tr align=center valign=middle border=1>';
224
-				if ($nbbyrow) print '<td width="'.ceil(100 / $nbbyrow).'%" class="photo">';
226
+				if ($nbbyrow && ($nbphoto % $nbbyrow == 1)) {
227
+					print '<tr align=center valign=middle border=1>';
228
+				}
229
+				if ($nbbyrow) {
230
+					print '<td width="'.ceil(100 / $nbbyrow).'%" class="photo">';
231
+				}
225 232
 
226 233
 				print '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart=category&entity='.$object->entity.'&file='.urlencode($pdir.$obj['photo']).'" alt="Taille origine" target="_blank">';
227 234
 
@@ -257,8 +264,12 @@  discard block
 block discarded – undo
257 264
 					print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delete&amp;token='.newToken().'&amp;type='.$type.'&amp;file='.urlencode($pdir.$viewfilename).'">';
258 265
 					print img_delete().'</a>';
259 266
 				}
260
-				if ($nbbyrow) print '</td>';
261
-				if ($nbbyrow && ($nbphoto % $nbbyrow == 0)) print '</tr>';
267
+				if ($nbbyrow) {
268
+					print '</td>';
269
+				}
270
+				if ($nbbyrow && ($nbphoto % $nbbyrow == 0)) {
271
+					print '</tr>';
272
+				}
262 273
 			}
263 274
 
264 275
 			// Ferme tableau
Please login to merge, or discard this patch.
htdocs/zapier/hook_card.php 1 patch
Braces   +23 added lines, -9 removed lines patch added patch discarded remove patch
@@ -56,10 +56,14 @@  discard block
 block discarded – undo
56 56
 $search_all = GETPOST("search_all", 'alpha');
57 57
 $search = array();
58 58
 foreach ($object->fields as $key => $val) {
59
-	if (GETPOST('search_'.$key, 'alpha')) $search[$key] = GETPOST('search_'.$key, 'alpha');
60
-}
59
+	if (GETPOST('search_'.$key, 'alpha')) {
60
+		$search[$key] = GETPOST('search_'.$key, 'alpha');
61
+	}
62
+	}
61 63
 
62
-if (empty($action) && empty($id) && empty($ref)) $action = 'view';
64
+if (empty($action) && empty($id) && empty($ref)) {
65
+	$action = 'view';
66
+}
63 67
 
64 68
 // Load object
65 69
 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
@@ -79,7 +83,9 @@  discard block
 block discarded – undo
79 83
 
80 84
 $parameters = array();
81 85
 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
82
-if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
86
+if ($reshook < 0) {
87
+	setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
88
+}
83 89
 
84 90
 if (empty($reshook)) {
85 91
 	$error = 0;
@@ -88,8 +94,11 @@  discard block
 block discarded – undo
88 94
 	$permissiontodelete = $user->rights->mymodule->delete || ($permissiontoadd && $object->status == 0);
89 95
 	$backurlforlist = dol_buildpath('/mymodule/myobject_list.php', 1);
90 96
 	if (empty($backtopage)) {
91
-		if (empty($id)) $backtopage = $backurlforlist;
92
-		else $backtopage = dol_buildpath('/mymodule/myobject_card.php', 1).($id > 0 ? $id : '__ID__');
97
+		if (empty($id)) {
98
+			$backtopage = $backurlforlist;
99
+		} else {
100
+			$backtopage = dol_buildpath('/mymodule/myobject_card.php', 1).($id > 0 ? $id : '__ID__');
101
+		}
93 102
 	}
94 103
 	$triggermodname = 'MYMODULE_MYOBJECT_MODIFY'; // Name of trigger action code to execute when we modify record
95 104
 
@@ -242,8 +251,11 @@  discard block
 block discarded – undo
242 251
 	// Call Hook formConfirm
243 252
 	$parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid);
244 253
 	$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
245
-	if (empty($reshook)) $formconfirm .= $hookmanager->resPrint;
246
-	elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint;
254
+	if (empty($reshook)) {
255
+		$formconfirm .= $hookmanager->resPrint;
256
+	} elseif ($reshook > 0) {
257
+		$formconfirm = $hookmanager->resPrint;
258
+	}
247 259
 
248 260
 	// Print form confirm
249 261
 	print $formconfirm;
@@ -323,7 +335,9 @@  discard block
 block discarded – undo
323 335
 		print '<div class="tabsAction">'."\n";
324 336
 		$parameters = array();
325 337
 		$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
326
-		if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
338
+		if ($reshook < 0) {
339
+			setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
340
+		}
327 341
 
328 342
 		if (empty($reshook)) {
329 343
 			// Modify
Please login to merge, or discard this patch.