Passed
Branch develop (66e4de)
by Laurent
33:03
created
htdocs/theme/md/info-box.inc.php 1 patch
Braces   +19 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,5 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
2
+if (!defined('ISLOADEDBYSTEELSHEET')) {
3
+	die('Must be call by steelsheet');
4
+}
5
+?>
3 6
 /* <style type="text/css" > */
4 7
 
5 8
 
@@ -12,10 +15,16 @@  discard block
 block discarded – undo
12 15
 include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
13 16
 
14 17
 $prefix = '';
15
-if (!empty($conf->global->THEME_INFOBOX_COLOR_ON_BACKGROUND)) $prefix = 'background-';
18
+if (!empty($conf->global->THEME_INFOBOX_COLOR_ON_BACKGROUND)) {
19
+	$prefix = 'background-';
20
+}
16 21
 
17
-if (!isset($conf->global->THEME_SATURATE_RATIO)) $conf->global->THEME_SATURATE_RATIO = 0.7;
18
-if (GETPOSTISSET('THEME_SATURATE_RATIO')) $conf->global->THEME_SATURATE_RATIO = GETPOST('THEME_SATURATE_RATIO', 'int');
22
+if (!isset($conf->global->THEME_SATURATE_RATIO)) {
23
+	$conf->global->THEME_SATURATE_RATIO = 0.7;
24
+}
25
+if (GETPOSTISSET('THEME_SATURATE_RATIO')) {
26
+	$conf->global->THEME_SATURATE_RATIO = GETPOST('THEME_SATURATE_RATIO', 'int');
27
+}
19 28
 
20 29
 ?>
21 30
 
@@ -282,8 +291,12 @@  discard block
 block discarded – undo
282 291
 }
283 292
 <?php
284 293
 include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
285
-if (!isset($conf->global->THEME_SATURATE_RATIO)) $conf->global->THEME_SATURATE_RATIO = 0.7;
286
-if (GETPOSTISSET('THEME_SATURATE_RATIO')) $conf->global->THEME_SATURATE_RATIO = GETPOST('THEME_SATURATE_RATIO', 'int');
294
+if (!isset($conf->global->THEME_SATURATE_RATIO)) {
295
+	$conf->global->THEME_SATURATE_RATIO = 0.7;
296
+}
297
+if (GETPOSTISSET('THEME_SATURATE_RATIO')) {
298
+	$conf->global->THEME_SATURATE_RATIO = GETPOST('THEME_SATURATE_RATIO', 'int');
299
+}
287 300
 ?>
288 301
 .bg-infobox-project i.fa{
289 302
 	color: #605ca8 !important;
Please login to merge, or discard this patch.
htdocs/compta/prelevement/stats.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,9 @@
 block discarded – undo
33 33
 
34 34
 // Security check
35 35
 $socid = GETPOST('socid', 'int');
36
-if ($user->socid) $socid = $user->socid;
36
+if ($user->socid) {
37
+	$socid = $user->socid;
38
+}
37 39
 $result = restrictedArea($user, 'prelevement', '', '', 'bons');
38 40
 
39 41
 $type = GETPOST('type', 'aZ09');
Please login to merge, or discard this patch.
htdocs/fourn/facture/index.php 1 patch
Braces   +38 added lines, -16 removed lines patch added patch discarded remove patch
@@ -129,11 +129,17 @@  discard block
 block discarded – undo
129 129
 	$sql = "SELECT count(f.rowid), f.fk_statut";
130 130
 	$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
131 131
 	$sql .= ", ".MAIN_DB_PREFIX."facture_fourn as f";
132
-	if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
132
+	if (!$user->rights->societe->client->voir && !$socid) {
133
+		$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
134
+	}
133 135
 	$sql .= " WHERE f.fk_soc = s.rowid";
134 136
 	$sql .= " AND f.entity IN (".getEntity('facture_fourn').")";
135
-	if ($user->socid) $sql .= ' AND f.fk_soc = '.$user->socid;
136
-	if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
137
+	if ($user->socid) {
138
+		$sql .= ' AND f.fk_soc = '.$user->socid;
139
+	}
140
+	if (!$user->rights->societe->client->voir && !$socid) {
141
+		$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
142
+	}
137 143
 	$sql .= " GROUP BY f.fk_statut";
138 144
 
139 145
 	$resql = $db->query($sql);
@@ -229,12 +235,18 @@  discard block
 block discarded – undo
229 235
 	$sql = "SELECT f.rowid, f.ref, s.nom as socname, s.rowid as socid, s.canvas, s.client, f.total_ttc";
230 236
 	$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
231 237
 	$sql .= ", ".MAIN_DB_PREFIX."societe as s";
232
-	if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
238
+	if (!$user->rights->societe->client->voir && !$socid) {
239
+		$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
240
+	}
233 241
 	$sql .= " WHERE f.fk_soc = s.rowid";
234 242
 	$sql .= " AND f.entity IN (".getEntity('facture_fourn').")";
235 243
 	$sql .= " AND f.fk_statut = ".FactureFournisseur::STATUS_DRAFT;
236
-	if ($socid) $sql .= " AND f.fk_soc = ".$socid;
237
-	if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
244
+	if ($socid) {
245
+		$sql .= " AND f.fk_soc = ".$socid;
246
+	}
247
+	if (!$user->rights->societe->client->voir && !$socid) {
248
+		$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
249
+	}
238 250
 	$sql .= $db->plimit($maxCount, 0);
239 251
 
240 252
 	$resql = $db->query($sql);
@@ -298,8 +310,7 @@  discard block
 block discarded – undo
298 310
 		$result .= '<tr class="liste_total">';
299 311
 		$result .= '<td colspan="3" class="right">'.$langs->trans("XMoreLines", ($num - $nbofloop)).'</td>';
300 312
 		$result .= '</tr>';
301
-	}
302
-	elseif ($total > 0)
313
+	} elseif ($total > 0)
303 314
 	{
304 315
 		$result .= '<tr class="liste_total">';
305 316
 		$result .= '<td colspan="2" class="right">'.$langs->trans("Total").'</td>';
@@ -327,11 +338,17 @@  discard block
 block discarded – undo
327 338
 	$sql .= " f.datec";
328 339
 	$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
329 340
 	$sql .= ", ".MAIN_DB_PREFIX."societe as s";
330
-	if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
341
+	if (!$user->rights->societe->client->voir && !$socid) {
342
+		$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
343
+	}
331 344
 	$sql .= " WHERE f.fk_soc = s.rowid";
332 345
 	$sql .= " AND f.entity IN (".getEntity('facture_fourn').")";
333
-	if ($socid) $sql .= " AND f.fk_soc = ".$socid;
334
-	if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
346
+	if ($socid) {
347
+		$sql .= " AND f.fk_soc = ".$socid;
348
+	}
349
+	if (!$user->rights->societe->client->voir && !$socid) {
350
+		$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
351
+	}
335 352
 	$sql .= " ORDER BY f.tms DESC";
336 353
 	$sql .= $db->plimit($maxCount, 0);
337 354
 
@@ -423,12 +440,18 @@  discard block
 block discarded – undo
423 440
 	$sql .= ", f.datef as df, f.date_lim_reglement as datelimite";
424 441
 	$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
425 442
 	$sql .= ", ".MAIN_DB_PREFIX."facture_fourn as f";
426
-	if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
443
+	if (!$user->rights->societe->client->voir && !$socid) {
444
+		$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
445
+	}
427 446
 	$sql .= " WHERE f.fk_soc = s.rowid";
428 447
 	$sql .= " AND f.entity IN (".getEntity('facture_fourn').")";
429 448
 	$sql .= " AND f.fk_statut = ".FactureFournisseur::STATUS_VALIDATED;
430
-	if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
431
-	if ($socid) $sql .= " AND s.rowid = ".$socid;
449
+	if (!$user->rights->societe->client->voir && !$socid) {
450
+		$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
451
+	}
452
+	if ($socid) {
453
+		$sql .= " AND s.rowid = ".$socid;
454
+	}
432 455
 	$sql .= " ORDER BY f.rowid DESC";
433 456
 	$sql .= $db->plimit($maxCount, 0);
434 457
 
@@ -519,8 +542,7 @@  discard block
 block discarded – undo
519 542
 		$result .= '<tr class="liste_total">';
520 543
 		$result .= '<td colspan="4" class="right">'.$langs->trans("XMoreLines", ($num - $nbofloop)).'</td>';
521 544
 		$result .= '</tr>';
522
-	}
523
-	elseif ($total > 0)
545
+	} elseif ($total > 0)
524 546
 	{
525 547
 		$result .= '<tr class="liste_total">';
526 548
 		$result .= '<td colspan="2" class="right">'.$langs->trans("Total").'</td>';
Please login to merge, or discard this patch.
htdocs/compta/facture/index.php 1 patch
Braces   +38 added lines, -16 removed lines patch added patch discarded remove patch
@@ -129,11 +129,17 @@  discard block
 block discarded – undo
129 129
 	$sql = "SELECT count(f.rowid), f.fk_statut";
130 130
 	$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
131 131
 	$sql .= ", ".MAIN_DB_PREFIX."facture as f";
132
-	if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
132
+	if (!$user->rights->societe->client->voir && !$socid) {
133
+		$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
134
+	}
133 135
 	$sql .= " WHERE f.fk_soc = s.rowid";
134 136
 	$sql .= " AND f.entity IN (".getEntity('facture').")";
135
-	if ($user->socid) $sql .= ' AND f.fk_soc = '.$user->socid;
136
-	if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
137
+	if ($user->socid) {
138
+		$sql .= ' AND f.fk_soc = '.$user->socid;
139
+	}
140
+	if (!$user->rights->societe->client->voir && !$socid) {
141
+		$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
142
+	}
137 143
 	$sql .= " GROUP BY f.fk_statut";
138 144
 
139 145
 	$resql = $db->query($sql);
@@ -227,12 +233,18 @@  discard block
 block discarded – undo
227 233
 	$sql = "SELECT f.rowid, f.ref, s.nom as socname, s.rowid as socid, s.canvas, s.client, f.total as total_ttc";
228 234
 	$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
229 235
 	$sql .= ", ".MAIN_DB_PREFIX."societe as s";
230
-	if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
236
+	if (!$user->rights->societe->client->voir && !$socid) {
237
+		$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
238
+	}
231 239
 	$sql .= " WHERE f.fk_soc = s.rowid";
232 240
 	$sql .= " AND f.entity IN (".getEntity('facture').")";
233 241
 	$sql .= " AND f.fk_statut = ".Facture::STATUS_DRAFT;
234
-	if ($socid) $sql .= " AND f.fk_soc = ".$socid;
235
-	if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
242
+	if ($socid) {
243
+		$sql .= " AND f.fk_soc = ".$socid;
244
+	}
245
+	if (!$user->rights->societe->client->voir && !$socid) {
246
+		$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
247
+	}
236 248
 	$sql .= $db->plimit($maxCount, 0);
237 249
 
238 250
 	$resql = $db->query($sql);
@@ -296,8 +308,7 @@  discard block
 block discarded – undo
296 308
 		$result .= '<tr class="liste_total">';
297 309
 		$result .= '<td colspan="3" class="right">'.$langs->trans("XMoreLines", ($num - $nbofloop)).'</td>';
298 310
 		$result .= '</tr>';
299
-	}
300
-	elseif ($total > 0)
311
+	} elseif ($total > 0)
301 312
 	{
302 313
 		$result .= '<tr class="liste_total">';
303 314
 		$result .= '<td colspan="2" class="right">'.$langs->trans("Total").'</td>';
@@ -325,11 +336,17 @@  discard block
 block discarded – undo
325 336
 	$sql .= " f.datec";
326 337
 	$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
327 338
 	$sql .= ", ".MAIN_DB_PREFIX."societe as s";
328
-	if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
339
+	if (!$user->rights->societe->client->voir && !$socid) {
340
+		$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
341
+	}
329 342
 	$sql .= " WHERE f.fk_soc = s.rowid";
330 343
 	$sql .= " AND f.entity IN (".getEntity('facture').")";
331
-	if ($socid) $sql .= " AND f.fk_soc = ".$socid;
332
-	if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
344
+	if ($socid) {
345
+		$sql .= " AND f.fk_soc = ".$socid;
346
+	}
347
+	if (!$user->rights->societe->client->voir && !$socid) {
348
+		$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
349
+	}
333 350
 	$sql .= " ORDER BY f.tms DESC";
334 351
 	$sql .= $db->plimit($maxCount, 0);
335 352
 
@@ -421,12 +438,18 @@  discard block
 block discarded – undo
421 438
 	$sql .= ", f.datef as df, f.date_lim_reglement as datelimite";
422 439
 	$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
423 440
 	$sql .= ", ".MAIN_DB_PREFIX."facture as f";
424
-	if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
441
+	if (!$user->rights->societe->client->voir && !$socid) {
442
+		$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
443
+	}
425 444
 	$sql .= " WHERE f.fk_soc = s.rowid";
426 445
 	$sql .= " AND f.entity IN (".getEntity('facture').")";
427 446
 	$sql .= " AND f.fk_statut = ".Facture::STATUS_VALIDATED;
428
-	if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
429
-	if ($socid) $sql .= " AND s.rowid = ".$socid;
447
+	if (!$user->rights->societe->client->voir && !$socid) {
448
+		$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
449
+	}
450
+	if ($socid) {
451
+		$sql .= " AND s.rowid = ".$socid;
452
+	}
430 453
 	$sql .= " ORDER BY f.rowid DESC";
431 454
 	$sql .= $db->plimit($maxCount, 0);
432 455
 
@@ -518,8 +541,7 @@  discard block
 block discarded – undo
518 541
 		$result .= '<tr class="liste_total">';
519 542
 		$result .= '<td colspan="4" class="right">'.$langs->trans("XMoreLines", ($num - $nbofloop)).'</td>';
520 543
 		$result .= '</tr>';
521
-	}
522
-	elseif ($total > 0)
544
+	} elseif ($total > 0)
523 545
 	{
524 546
 		$result .= '<tr class="liste_total">';
525 547
 		$result .= '<td colspan="2" class="right">'.$langs->trans("Total").'</td>';
Please login to merge, or discard this patch.
htdocs/hrm/establishment/info.php 1 patch
Braces   +22 added lines, -8 removed lines patch added patch discarded remove patch
@@ -37,8 +37,10 @@  discard block
 block discarded – undo
37 37
 
38 38
 if (GETPOST('actioncode', 'array')) {
39 39
 	$actioncode = GETPOST('actioncode', 'array', 3);
40
-	if (!count($actioncode)) $actioncode = '0';
41
-} else {
40
+	if (!count($actioncode)) {
41
+		$actioncode = '0';
42
+	}
43
+	} else {
42 44
 	$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));
43 45
 }
44 46
 $search_agenda_label = GETPOST('search_agenda_label');
@@ -51,8 +53,12 @@  discard block
 block discarded – undo
51 53
 $offset = $limit * $page;
52 54
 $pageprev = $page - 1;
53 55
 $pagenext = $page + 1;
54
-if (!$sortfield) $sortfield = 'a.datep,a.id';
55
-if (!$sortorder) $sortorder = 'DESC,DESC';
56
+if (!$sortfield) {
57
+	$sortfield = 'a.datep,a.id';
58
+}
59
+if (!$sortorder) {
60
+	$sortorder = 'DESC,DESC';
61
+}
56 62
 
57 63
 // Initialize technical objects
58 64
 $object = new Establishment($db);
@@ -64,7 +70,9 @@  discard block
 block discarded – undo
64 70
 
65 71
 // Load object
66 72
 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
67
-if ($id > 0 || !empty($ref)) $upload_dir = $conf->hrm->multidir_output[$object->entity]."/".$object->id;
73
+if ($id > 0 || !empty($ref)) {
74
+	$upload_dir = $conf->hrm->multidir_output[$object->entity]."/".$object->id;
75
+}
68 76
 
69 77
 // Security check - Protection if external user
70 78
 //if ($user->socid > 0) accessforbidden();
@@ -80,7 +88,9 @@  discard block
 block discarded – undo
80 88
 
81 89
 $parameters = array('id'=>$id);
82 90
 $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');
91
+if ($reshook < 0) {
92
+	setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
93
+}
84 94
 
85 95
 if (empty($reshook))
86 96
 {
@@ -92,9 +102,11 @@  discard block
 block discarded – undo
92 102
 	}
93 103
 
94 104
 	// Purge search criteria
95
-	if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
105
+	if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
106
+		// All tests are required to be compatible with all browsers
96 107
 	{
97 108
 		$actioncode = '';
109
+	}
98 110
 		$search_agenda_label = '';
99 111
 	}
100 112
 }
@@ -114,7 +126,9 @@  discard block
 block discarded – undo
114 126
 	$help_url = '';
115 127
 	llxHeader('', $title, $help_url);
116 128
 
117
-	if (!empty($conf->notification->enabled)) $langs->load("mails");
129
+	if (!empty($conf->notification->enabled)) {
130
+		$langs->load("mails");
131
+	}
118 132
 	$head = establishment_prepare_head($object);
119 133
 
120 134
 
Please login to merge, or discard this patch.
htdocs/core/lib/modulebuilder.lib.php 1 patch
Braces   +88 added lines, -31 removed lines patch added patch discarded remove patch
@@ -41,8 +41,12 @@  discard block
 block discarded – undo
41 41
 {
42 42
 	global $db, $langs;
43 43
 
44
-	if (empty($objectname)) return -1;
45
-	if (empty($readdir)) $readdir = $destdir;
44
+	if (empty($objectname)) {
45
+		return -1;
46
+	}
47
+	if (empty($readdir)) {
48
+		$readdir = $destdir;
49
+	}
46 50
 
47 51
 	if (!empty($addfieldentry['arrayofkeyval']) && !is_array($addfieldentry['arrayofkeyval']))
48 52
 	{
@@ -85,8 +89,11 @@  discard block
 block discarded – undo
85 89
 
86 90
 	try {
87 91
 		include_once $pathoffiletoeditsrc;
88
-		if (class_exists($objectname)) $object = new $objectname($db);
89
-		else return -4;
92
+		if (class_exists($objectname)) {
93
+			$object = new $objectname($db);
94
+		} else {
95
+			return -4;
96
+		}
90 97
 
91 98
 		// Backup old file
92 99
 		dol_copy($pathoffiletoedittarget, $pathoffiletoedittarget.'.back', $newmask, 1);
@@ -130,30 +137,56 @@  discard block
 block discarded – undo
130 137
 				$texttoinsert .= " 'position'=>".($val['position'] !== '' ? $val['position'] : 50).",";
131 138
 				$texttoinsert .= " 'notnull'=>".(empty($val['notnull']) ? 0 : $val['notnull']).",";
132 139
 				$texttoinsert .= " 'visible'=>".($val['visible'] !== '' ? $val['visible'] : -1).",";
133
-				if ($val['noteditable'])    $texttoinsert .= " 'noteditable'=>'".$val['noteditable']."',";
134
-				if ($val['default'] || $val['default'] === '0')        $texttoinsert .= " 'default'=>'".$val['default']."',";
135
-				if ($val['index'])          $texttoinsert .= " 'index'=>".$val['index'].",";
136
-				if ($val['foreignkey'])     $texttoinsert .= " 'foreignkey'=>'".$val['foreignkey']."',";
137
-				if ($val['searchall'])      $texttoinsert .= " 'searchall'=>".$val['searchall'].",";
138
-				if ($val['isameasure'])     $texttoinsert .= " 'isameasure'=>'".$val['isameasure']."',";
139
-				if ($val['css'])            $texttoinsert .= " 'css'=>'".$val['css']."',";
140
-				if ($val['help'])           $texttoinsert .= " 'help'=>\"".preg_replace('/"/', '', $val['help'])."\",";
141
-				if ($val['showoncombobox']) $texttoinsert .= " 'showoncombobox'=>'".$val['showoncombobox']."',";
142
-				if ($val['disabled'])       $texttoinsert .= " 'disabled'=>'".$val['disabled']."',";
143
-				if ($val['autofocusoncreate']) $texttoinsert .= " 'autofocusoncreate'=>'".$val['autofocusoncreate']."',";
140
+				if ($val['noteditable']) {
141
+					$texttoinsert .= " 'noteditable'=>'".$val['noteditable']."',";
142
+				}
143
+				if ($val['default'] || $val['default'] === '0') {
144
+					$texttoinsert .= " 'default'=>'".$val['default']."',";
145
+				}
146
+				if ($val['index']) {
147
+					$texttoinsert .= " 'index'=>".$val['index'].",";
148
+				}
149
+				if ($val['foreignkey']) {
150
+					$texttoinsert .= " 'foreignkey'=>'".$val['foreignkey']."',";
151
+				}
152
+				if ($val['searchall']) {
153
+					$texttoinsert .= " 'searchall'=>".$val['searchall'].",";
154
+				}
155
+				if ($val['isameasure']) {
156
+					$texttoinsert .= " 'isameasure'=>'".$val['isameasure']."',";
157
+				}
158
+				if ($val['css']) {
159
+					$texttoinsert .= " 'css'=>'".$val['css']."',";
160
+				}
161
+				if ($val['help']) {
162
+					$texttoinsert .= " 'help'=>\"".preg_replace('/"/', '', $val['help'])."\",";
163
+				}
164
+				if ($val['showoncombobox']) {
165
+					$texttoinsert .= " 'showoncombobox'=>'".$val['showoncombobox']."',";
166
+				}
167
+				if ($val['disabled']) {
168
+					$texttoinsert .= " 'disabled'=>'".$val['disabled']."',";
169
+				}
170
+				if ($val['autofocusoncreate']) {
171
+					$texttoinsert .= " 'autofocusoncreate'=>'".$val['autofocusoncreate']."',";
172
+				}
144 173
 				if ($val['arrayofkeyval'])
145 174
 				{
146 175
 					$texttoinsert .= " 'arrayofkeyval'=>array(";
147 176
 					$i = 0;
148 177
 					foreach ($val['arrayofkeyval'] as $key2 => $val2)
149 178
 					{
150
-						if ($i) $texttoinsert .= ", ";
179
+						if ($i) {
180
+							$texttoinsert .= ", ";
181
+						}
151 182
 						$texttoinsert .= "'".$key2."'=>'".$val2."'";
152 183
 						$i++;
153 184
 					}
154 185
 					$texttoinsert .= "),";
155 186
 				}
156
-				if ($val['comment'])        $texttoinsert .= " 'comment'=>\"".preg_replace('/"/', '', $val['comment'])."\"";
187
+				if ($val['comment']) {
188
+					$texttoinsert .= " 'comment'=>\"".preg_replace('/"/', '', $val['comment'])."\"";
189
+				}
157 190
 
158 191
 				$texttoinsert .= "),\n";
159 192
 			}
@@ -217,8 +250,12 @@  discard block
 block discarded – undo
217 250
 
218 251
 	$error = 0;
219 252
 
220
-	if (empty($objectname)) return -1;
221
-	if (empty($readdir)) $readdir = $destdir;
253
+	if (empty($objectname)) {
254
+		return -1;
255
+	}
256
+	if (empty($readdir)) {
257
+		$readdir = $destdir;
258
+	}
222 259
 
223 260
 	$pathoffiletoclasssrc = $readdir.'/class/'.strtolower($objectname).'.class.php';
224 261
 
@@ -237,8 +274,11 @@  discard block
 block discarded – undo
237 274
 		if (!is_object($object))
238 275
 		{
239 276
 			include_once $pathoffiletoclasssrc;
240
-			if (class_exists($objectname)) $object = new $objectname($db);
241
-			else return -1;
277
+			if (class_exists($objectname)) {
278
+				$object = new $objectname($db);
279
+			} else {
280
+				return -1;
281
+			}
242 282
 		}
243 283
 	} catch (Exception $e)
244 284
 	{
@@ -261,22 +301,39 @@  discard block
 block discarded – undo
261 301
 			$type = $val['type'];
262 302
 			$type = preg_replace('/:.*$/', '', $type); // For case type = 'integer:Societe:societe/class/societe.class.php'
263 303
 
264
-			if ($type == 'html') $type = 'text'; // html modulebuilder type is a text type in database
265
-			elseif ($type == 'price') $type = 'double'; // html modulebuilder type is a text type in database
266
-			elseif (in_array($type, array('link', 'sellist', 'duration'))) $type = 'integer';
304
+			if ($type == 'html') {
305
+				$type = 'text';
306
+			}
307
+			// html modulebuilder type is a text type in database
308
+			elseif ($type == 'price') {
309
+				$type = 'double';
310
+			}
311
+			// html modulebuilder type is a text type in database
312
+			elseif (in_array($type, array('link', 'sellist', 'duration'))) {
313
+				$type = 'integer';
314
+			}
267 315
 			$texttoinsert .= "\t".$key." ".$type;
268
-			if ($key == 'rowid')  $texttoinsert .= ' AUTO_INCREMENT PRIMARY KEY';
269
-			if ($key == 'entity') $texttoinsert .= ' DEFAULT 1';
270
-			else {
316
+			if ($key == 'rowid') {
317
+				$texttoinsert .= ' AUTO_INCREMENT PRIMARY KEY';
318
+			}
319
+			if ($key == 'entity') {
320
+				$texttoinsert .= ' DEFAULT 1';
321
+			} else {
271 322
 				if ($val['default'] != '')
272 323
 				{
273
-					if (preg_match('/^null$/i', $val['default'])) $texttoinsert .= " DEFAULT NULL";
274
-					elseif (preg_match('/varchar/', $type)) $texttoinsert .= " DEFAULT '".$db->escape($val['default'])."'";
275
-					else $texttoinsert .= (($val['default'] > 0) ? ' DEFAULT '.$val['default'] : '');
324
+					if (preg_match('/^null$/i', $val['default'])) {
325
+						$texttoinsert .= " DEFAULT NULL";
326
+					} elseif (preg_match('/varchar/', $type)) {
327
+						$texttoinsert .= " DEFAULT '".$db->escape($val['default'])."'";
328
+					} else {
329
+						$texttoinsert .= (($val['default'] > 0) ? ' DEFAULT '.$val['default'] : '');
330
+					}
276 331
 				}
277 332
 			}
278 333
 			$texttoinsert .= (($val['notnull'] > 0) ? ' NOT NULL' : '');
279
-			if ($i < count($object->fields)) $texttoinsert .= ", ";
334
+			if ($i < count($object->fields)) {
335
+				$texttoinsert .= ", ";
336
+			}
280 337
 			$texttoinsert .= "\n";
281 338
 		}
282 339
 	}
Please login to merge, or discard this patch.
htdocs/takepos/genimg/qr.php 1 patch
Braces   +27 added lines, -10 removed lines patch added patch discarded remove patch
@@ -15,14 +15,32 @@  discard block
 block discarded – undo
15 15
  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 16
  */
17 17
 
18
-if (!defined("NOLOGIN"))       define("NOLOGIN", '1'); // If this page is public (can be called outside logged session)
19
-if (!defined('NOIPCHECK'))		define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
20
-if (!defined('NOREQUIRESOC'))		define('NOREQUIRESOC', '1');
21
-if (!defined('NOCSRFCHECK'))		define('NOCSRFCHECK', '1');
22
-if (!defined('NOTOKENRENEWAL'))	define('NOTOKENRENEWAL', '1');
23
-if (!defined('NOREQUIREMENU'))		define('NOREQUIREMENU', '1');
24
-if (!defined('NOREQUIREHTML'))		define('NOREQUIREHTML', '1');
25
-if (!defined('NOREQUIREAJAX'))		define('NOREQUIREAJAX', '1');
18
+if (!defined("NOLOGIN")) {
19
+	define("NOLOGIN", '1');
20
+}
21
+// If this page is public (can be called outside logged session)
22
+if (!defined('NOIPCHECK')) {
23
+	define('NOIPCHECK', '1');
24
+}
25
+// Do not check IP defined into conf $dolibarr_main_restrict_ip
26
+if (!defined('NOREQUIRESOC')) {
27
+	define('NOREQUIRESOC', '1');
28
+}
29
+if (!defined('NOCSRFCHECK')) {
30
+	define('NOCSRFCHECK', '1');
31
+}
32
+if (!defined('NOTOKENRENEWAL')) {
33
+	define('NOTOKENRENEWAL', '1');
34
+}
35
+if (!defined('NOREQUIREMENU')) {
36
+	define('NOREQUIREMENU', '1');
37
+}
38
+if (!defined('NOREQUIREHTML')) {
39
+	define('NOREQUIREHTML', '1');
40
+}
41
+if (!defined('NOREQUIREAJAX')) {
42
+	define('NOREQUIREAJAX', '1');
43
+}
26 44
 
27 45
 require '../../main.inc.php'; // Load $user and permissions
28 46
 require '../../core/modules/barcode/doc/tcpdfbarcode.modules.php';
@@ -34,8 +52,7 @@  discard block
 block discarded – undo
34 52
 	$key = GETPOST('key');
35 53
 	$module = new modTcpdfbarcode();
36 54
 	$result = $module->buildBarCode($urlwithroot."/takepos/public/auto_order.php?key=".$key, 'QRCODE', 'Y');
37
-}
38
-else {
55
+} else {
39 56
 	$module = new modTcpdfbarcode();
40 57
 	$result = $module->buildBarCode($urlwithroot."/takepos/public/menu.php", 'QRCODE', 'Y');
41 58
 }
Please login to merge, or discard this patch.
htdocs/theme/eldy/badges.inc.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet');
2
+if (!defined('ISLOADEDBYSTEELSHEET')) {
3
+	die('Must be call by steelsheet');
4
+}
3 5
 ?>
4 6
 /* Badge style is based on boostrap framework */
5 7
 
@@ -217,8 +219,12 @@  discard block
 block discarded – undo
217 219
 			$thisBadgeBackgroundColor = "#fff";
218 220
 		}
219 221
 
220
-		if (in_array((string) $statusName, array('0', '5', '9'))) $thisBadgeTextColor = '#999999';
221
-		if (in_array((string) $statusName, array('6'))) $thisBadgeTextColor = '#777777';
222
+		if (in_array((string) $statusName, array('0', '5', '9'))) {
223
+			$thisBadgeTextColor = '#999999';
224
+		}
225
+		if (in_array((string) $statusName, array('6'))) {
226
+			$thisBadgeTextColor = '#777777';
227
+		}
222 228
 
223 229
 		print $cssPrefix.".badge-status".$statusName." {\n";
224 230
 		print "        color: ".$thisBadgeTextColor." !important;\n";
Please login to merge, or discard this patch.
htdocs/modulebuilder/template/lib/mymodule_myobject.lib.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -44,11 +44,17 @@  discard block
 block discarded – undo
44 44
 	if (isset($object->fields['note_public']) || isset($object->fields['note_private']))
45 45
 	{
46 46
 		$nbNote = 0;
47
-		if (!empty($object->note_private)) $nbNote++;
48
-		if (!empty($object->note_public)) $nbNote++;
47
+		if (!empty($object->note_private)) {
48
+			$nbNote++;
49
+		}
50
+		if (!empty($object->note_public)) {
51
+			$nbNote++;
52
+		}
49 53
 		$head[$h][0] = dol_buildpath('/mymodule/myobject_note.php', 1).'?id='.$object->id;
50 54
 		$head[$h][1] = $langs->trans('Notes');
51
-		if ($nbNote > 0) $head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '<span class="badge marginleftonlyshort">'.$nbNote.'</span>' : '');
55
+		if ($nbNote > 0) {
56
+			$head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '<span class="badge marginleftonlyshort">'.$nbNote.'</span>' : '');
57
+		}
52 58
 		$head[$h][2] = 'note';
53 59
 		$h++;
54 60
 	}
@@ -60,7 +66,9 @@  discard block
 block discarded – undo
60 66
 	$nbLinks = Link::count($db, $object->element, $object->id);
61 67
 	$head[$h][0] = dol_buildpath("/mymodule/myobject_document.php", 1).'?id='.$object->id;
62 68
 	$head[$h][1] = $langs->trans('Documents');
63
-	if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>';
69
+	if (($nbFiles + $nbLinks) > 0) {
70
+		$head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>';
71
+	}
64 72
 	$head[$h][2] = 'document';
65 73
 	$h++;
66 74
 
Please login to merge, or discard this patch.