Passed
Branch develop (66e4de)
by Laurent
33:03
created
htdocs/core/boxes/box_services_contracts.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -96,10 +96,14 @@  discard block
 block discarded – undo
96 96
 			$sql .= " INNER JOIN ".MAIN_DB_PREFIX."contrat as c ON s.rowid = c.fk_soc";
97 97
 			$sql .= " INNER JOIN ".MAIN_DB_PREFIX."contratdet as cd ON c.rowid = cd.fk_contrat";
98 98
 			$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid";
99
-			if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
99
+			if (!$user->rights->societe->client->voir && !$user->socid) {
100
+				$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
101
+			}
100 102
 			$sql .= ")";
101 103
 			$sql .= " WHERE c.entity = ".$conf->entity;
102
-			if ($user->socid) $sql .= " AND s.rowid = ".$user->socid;
104
+			if ($user->socid) {
105
+				$sql .= " AND s.rowid = ".$user->socid;
106
+			}
103 107
 			$sql .= $this->db->order("c.tms", "DESC");
104 108
 			$sql .= $this->db->plimit($max, 0);
105 109
 
@@ -144,7 +148,9 @@  discard block
 block discarded – undo
144 148
 					$thirdpartytmp->code_compta_fournisseur = $objp->code_compta_fournisseur;
145 149
 
146 150
 					$dateline = $this->db->jdate($objp->date_line);
147
-					if ($contractstatic->statut == Contrat::STATUS_VALIDATED && $objp->contractline_status == ContratLigne::STATUS_OPEN && !empty($dateline) && ($dateline + $conf->contrat->services->expires->warning_delay) < $now) $late = img_warning($langs->trans("Late"));
151
+					if ($contractstatic->statut == Contrat::STATUS_VALIDATED && $objp->contractline_status == ContratLigne::STATUS_OPEN && !empty($dateline) && ($dateline + $conf->contrat->services->expires->warning_delay) < $now) {
152
+						$late = img_warning($langs->trans("Late"));
153
+					}
148 154
 
149 155
 					// Label
150 156
 					if ($objp->product_id > 0)
@@ -211,10 +217,12 @@  discard block
 block discarded – undo
211 217
 
212 218
 					$i++;
213 219
 				}
214
-				if ($num == 0) $this->info_box_contents[$i][0] = array(
220
+				if ($num == 0) {
221
+					$this->info_box_contents[$i][0] = array(
215 222
 					'td' => 'class="center opacitymedium"',
216 223
 					'text'=>$langs->trans("NoContractedProducts")
217 224
 				);
225
+				}
218 226
 
219 227
 				$this->db->free($result);
220 228
 			} else {
Please login to merge, or discard this patch.
htdocs/admin/system/modules.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -260,13 +260,13 @@
 block discarded – undo
260 260
 print '</tr>';
261 261
 
262 262
 // sort list
263
-if ($sortfield == "name" && $sortorder == "asc") usort($moduleList, function (stdClass $a, stdClass $b) {
263
+if ($sortfield == "name" && $sortorder == "asc") usort($moduleList, function(stdClass $a, stdClass $b) {
264 264
 	return strcasecmp($a->name, $b->name); });
265
-if ($sortfield == "name" && $sortorder == "desc") usort($moduleList, function (stdClass $a, stdClass $b) {
265
+if ($sortfield == "name" && $sortorder == "desc") usort($moduleList, function(stdClass $a, stdClass $b) {
266 266
 	return strcasecmp($b->name, $a->name); });
267
-if ($sortfield == "version" && $sortorder == "asc") usort($moduleList, function (stdClass $a, stdClass $b) {
267
+if ($sortfield == "version" && $sortorder == "asc") usort($moduleList, function(stdClass $a, stdClass $b) {
268 268
 	return strcasecmp($a->version, $b->version); });
269
-if ($sortfield == "version" && $sortorder == "desc") usort($moduleList, function (stdClass $a, stdClass $b) {
269
+if ($sortfield == "version" && $sortorder == "desc") usort($moduleList, function(stdClass $a, stdClass $b) {
270 270
 	return strcasecmp($b->version, $a->version); });
271 271
 if ($sortfield == "id" && $sortorder == "asc") usort($moduleList, "compareIdAsc");
272 272
 if ($sortfield == "id" && $sortorder == "desc") usort($moduleList, "compareIdDesc");
Please login to merge, or discard this patch.
Braces   +95 added lines, -40 removed lines patch added patch discarded remove patch
@@ -43,8 +43,12 @@  discard block
 block discarded – undo
43 43
 $sortfield			= GETPOST("sortfield", 'alpha');
44 44
 $sortorder			= GETPOST("sortorder", 'alpha');
45 45
 
46
-if (!$sortfield) $sortfield = "id";
47
-if (!$sortorder) $sortorder = "asc";
46
+if (!$sortfield) {
47
+	$sortfield = "id";
48
+}
49
+if (!$sortorder) {
50
+	$sortorder = "asc";
51
+}
48 52
 
49 53
 // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array of hooks
50 54
 $hookmanager->initHooks(array('moduleoverview'));
@@ -69,7 +73,9 @@  discard block
 block discarded – undo
69 73
 
70 74
 $parameters = array();
71 75
 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
72
-if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
76
+if ($reshook < 0) {
77
+	setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
78
+}
73 79
 
74 80
 if (empty($reshook)) {
75 81
 	// Selection of new fields
@@ -97,8 +103,7 @@  discard block
 block discarded – undo
97 103
 					if (in_array($file, $modules_files)) {
98 104
 						// File duplicate
99 105
 						print "Warning duplicate file found : ".$file." (Found ".$dir.$file.", already found ".$modules_fullpath[$file].")<br>";
100
-					}
101
-					else {
106
+					} else {
102 107
 						// File to load
103 108
 						$res = include_once $dir.$file;
104 109
 						if (class_exists($modName)) {
@@ -108,12 +113,10 @@  discard block
 block discarded – undo
108 113
 								$modules[$objMod->numero] = $objMod;
109 114
 								$modules_files[$objMod->numero] = $file;
110 115
 								$modules_fullpath[$file] = $dir.$file;
111
-							}
112
-							catch (Exception $e) {
116
+							} catch (Exception $e) {
113 117
 								dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR);
114 118
 							}
115
-						}
116
-						else {
119
+						} else {
117 120
 							print "Warning bad descriptor file : ".$dir.$file." (Class ".$modName." not found into file)<br>";
118 121
 						}
119 122
 					}
@@ -136,10 +139,12 @@  discard block
 block discarded – undo
136 139
 	$alt = $module->name.' - '.$modules_files[$key];
137 140
 
138 141
 	if (!empty($module->picto)) {
139
-		if (preg_match('/^\//', $module->picto)) $newModule->picto = img_picto($alt, $module->picto, 'width="14px"', 1);
140
-		else $newModule->picto = img_object($alt, $module->picto, 'width="14px"');
141
-	}
142
-	else {
142
+		if (preg_match('/^\//', $module->picto)) {
143
+			$newModule->picto = img_picto($alt, $module->picto, 'width="14px"', 1);
144
+		} else {
145
+			$newModule->picto = img_object($alt, $module->picto, 'width="14px"');
146
+		}
147
+	} else {
143 148
 		$newModule->picto = img_object($alt, 'generic', 'width="14px"');
144 149
 	}
145 150
 
@@ -159,9 +164,15 @@  discard block
 block discarded – undo
159 164
 	$newModule->permission = $permission;
160 165
 
161 166
 	// pre-filter list
162
-	if ($search_name && !stristr($newModule->name, $search_name))			continue;
163
-	if ($search_version && !stristr($newModule->version, $search_version))	continue;
164
-	if ($search_id && !stristr($newModule->id, $search_id))					continue;
167
+	if ($search_name && !stristr($newModule->name, $search_name)) {
168
+		continue;
169
+	}
170
+	if ($search_version && !stristr($newModule->version, $search_version)) {
171
+		continue;
172
+	}
173
+	if ($search_id && !stristr($newModule->id, $search_id)) {
174
+		continue;
175
+	}
165 176
 
166 177
 	if ($search_permission) {
167 178
 		$found = false;
@@ -173,7 +184,9 @@  discard block
 block discarded – undo
173 184
 			}
174 185
 		}
175 186
 
176
-		if (!$found) continue;
187
+		if (!$found) {
188
+			continue;
189
+		}
177 190
 	}
178 191
 
179 192
 	$moduleList[] = $newModule;
@@ -188,7 +201,9 @@  discard block
 block discarded – undo
188 201
 llxHeader();
189 202
 
190 203
 print '<form action="'.$_SERVER["PHP_SELF"].'" method="post" name="formulaire">';
191
-if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
204
+if ($optioncss != '') {
205
+	print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
206
+}
192 207
 print '<input type="hidden" name="token" value="'.newToken().'">';
193 208
 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
194 209
 print '<input type="hidden" name="action" value="list">';
@@ -270,18 +285,38 @@  discard block
 block discarded – undo
270 285
 print '</tr>';
271 286
 
272 287
 // sort list
273
-if ($sortfield == "name" && $sortorder == "asc") usort($moduleList, function (stdClass $a, stdClass $b) {
274
-	return strcasecmp($a->name, $b->name); });
275
-if ($sortfield == "name" && $sortorder == "desc") usort($moduleList, function (stdClass $a, stdClass $b) {
276
-	return strcasecmp($b->name, $a->name); });
277
-if ($sortfield == "version" && $sortorder == "asc") usort($moduleList, function (stdClass $a, stdClass $b) {
278
-	return strcasecmp($a->version, $b->version); });
279
-if ($sortfield == "version" && $sortorder == "desc") usort($moduleList, function (stdClass $a, stdClass $b) {
280
-	return strcasecmp($b->version, $a->version); });
281
-if ($sortfield == "id" && $sortorder == "asc") usort($moduleList, "compareIdAsc");
282
-if ($sortfield == "id" && $sortorder == "desc") usort($moduleList, "compareIdDesc");
283
-if ($sortfield == "permission" && $sortorder == "asc") usort($moduleList, "comparePermissionIdsAsc");
284
-if ($sortfield == "permission" && $sortorder == "desc") usort($moduleList, "comparePermissionIdsDesc");
288
+if ($sortfield == "name" && $sortorder == "asc") {
289
+	usort($moduleList, function (stdClass $a, stdClass $b) {
290
+	return strcasecmp($a->name, $b->name);
291
+}
292
+});
293
+if ($sortfield == "name" && $sortorder == "desc") {
294
+	usort($moduleList, function (stdClass $a, stdClass $b) {
295
+	return strcasecmp($b->name, $a->name);
296
+}
297
+});
298
+if ($sortfield == "version" && $sortorder == "asc") {
299
+	usort($moduleList, function (stdClass $a, stdClass $b) {
300
+	return strcasecmp($a->version, $b->version);
301
+}
302
+});
303
+if ($sortfield == "version" && $sortorder == "desc") {
304
+	usort($moduleList, function (stdClass $a, stdClass $b) {
305
+	return strcasecmp($b->version, $a->version);
306
+}
307
+});
308
+if ($sortfield == "id" && $sortorder == "asc") {
309
+	usort($moduleList, "compareIdAsc");
310
+}
311
+if ($sortfield == "id" && $sortorder == "desc") {
312
+	usort($moduleList, "compareIdDesc");
313
+}
314
+if ($sortfield == "permission" && $sortorder == "asc") {
315
+	usort($moduleList, "comparePermissionIdsAsc");
316
+}
317
+if ($sortfield == "permission" && $sortorder == "desc") {
318
+	usort($moduleList, "comparePermissionIdsDesc");
319
+}
285 320
 
286 321
 $moduleList = dol_sort_array($moduleList, 'module_position');
287 322
 
@@ -359,7 +394,9 @@  discard block
 block discarded – undo
359 394
   */
360 395
 function compareIdAsc(stdClass $a, stdClass $b)
361 396
 {
362
-	if ($a->id == $b->id) return 0;
397
+	if ($a->id == $b->id) {
398
+		return 0;
399
+	}
363 400
 
364 401
 	return $a->id > $b->id ? -1 : 1;
365 402
 }
@@ -373,7 +410,9 @@  discard block
 block discarded – undo
373 410
   */
374 411
 function compareIdDesc(stdClass $a, stdClass $b)
375 412
 {
376
-	if ($a->id == $b->id) return 0;
413
+	if ($a->id == $b->id) {
414
+		return 0;
415
+	}
377 416
 
378 417
 	return $b->id > $a->id ? -1 : 1;
379 418
 }
@@ -387,12 +426,20 @@  discard block
 block discarded – undo
387 426
   */
388 427
 function comparePermissionIdsAsc(stdClass $a, stdClass $b)
389 428
 {
390
-	if (empty($a->permission) && empty($b->permission)) return compareIdAsc($a, $b);
429
+	if (empty($a->permission) && empty($b->permission)) {
430
+		return compareIdAsc($a, $b);
431
+	}
391 432
 
392
-	if (empty($a->permission)) return 1;
393
-	if (empty($b->permission)) return -1;
433
+	if (empty($a->permission)) {
434
+		return 1;
435
+	}
436
+	if (empty($b->permission)) {
437
+		return -1;
438
+	}
394 439
 
395
-	if ($a->permission[0] == $b->permission[0]) return 0;
440
+	if ($a->permission[0] == $b->permission[0]) {
441
+		return 0;
442
+	}
396 443
 
397 444
 	return $a->permission[0] > $b->permission[0] ? -1 : 1;
398 445
 }
@@ -406,12 +453,20 @@  discard block
 block discarded – undo
406 453
   */
407 454
 function comparePermissionIdsDesc(stdClass $a, stdClass $b)
408 455
 {
409
-	if (empty($a->permission) && empty($b->permission)) return compareIdDesc($a, $b);
456
+	if (empty($a->permission) && empty($b->permission)) {
457
+		return compareIdDesc($a, $b);
458
+	}
410 459
 
411
-	if (empty($a->permission)) return -1;
412
-	if (empty($b->permission)) return 1;
460
+	if (empty($a->permission)) {
461
+		return -1;
462
+	}
463
+	if (empty($b->permission)) {
464
+		return 1;
465
+	}
413 466
 
414
-	if ($a->permission[0] == $b->permission[0]) return 0;
467
+	if ($a->permission[0] == $b->permission[0]) {
468
+		return 0;
469
+	}
415 470
 
416 471
 	return $a->permission[0] > $b->permission[0] ? 1 : -1;
417 472
 }
Please login to merge, or discard this patch.
htdocs/core/class/commonobjectline.class.php 1 patch
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -80,15 +80,21 @@
 block discarded – undo
80 80
 		$label_type = 'label';
81 81
 
82 82
 		$label_type = 'label';
83
-		if ($type == 'short') $label_type = 'short_label';
84
-		elseif ($type == 'code') $label_type = 'code';
83
+		if ($type == 'short') {
84
+			$label_type = 'short_label';
85
+		} elseif ($type == 'code') {
86
+			$label_type = 'code';
87
+		}
85 88
 
86 89
 		$sql = 'select '.$label_type.', code from '.MAIN_DB_PREFIX.'c_units where rowid='.$this->fk_unit;
87 90
 		$resql = $this->db->query($sql);
88 91
 		if ($resql && $this->db->num_rows($resql) > 0) {
89 92
 			$res = $this->db->fetch_array($resql);
90
-			if ($label_type == 'code') $label = 'unit'.$res['code'];
91
-			else $label = $res[$label_type];
93
+			if ($label_type == 'code') {
94
+				$label = 'unit'.$res['code'];
95
+			} else {
96
+				$label = $res[$label_type];
97
+			}
92 98
 			$this->db->free($resql);
93 99
 			return $label;
94 100
 		} else {
Please login to merge, or discard this patch.
htdocs/fourn/commande/contact.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,9 @@
 block discarded – undo
40 40
 $action = GETPOST('action', 'aZ09');
41 41
 
42 42
 // Security check
43
-if ($user->socid) $socid = $user->socid;
43
+if ($user->socid) {
44
+	$socid = $user->socid;
45
+}
44 46
 $result = restrictedArea($user, 'fournisseur', $id, 'commande_fournisseur', 'commande');
45 47
 
46 48
 $object = new CommandeFournisseur($db);
Please login to merge, or discard this patch.
htdocs/modulebuilder/admin/setup.php 1 patch
Braces   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -26,8 +26,9 @@  discard block
 block discarded – undo
26 26
 global $conf, $langs, $user, $db;
27 27
 $langs->loadLangs(array("admin", "other", "modulebuilder"));
28 28
 
29
-if (!$user->admin || empty($conf->modulebuilder->enabled))
29
+if (!$user->admin || empty($conf->modulebuilder->enabled)) {
30 30
 	accessforbidden();
31
+}
31 32
 
32 33
 $action = GETPOST('action', 'aZ09');
33 34
 $backtopage = GETPOST('backtopage', 'alpha');
@@ -58,8 +59,9 @@  discard block
 block discarded – undo
58 59
 if (preg_match('/set_(.*)/', $action, $reg)) {
59 60
 	$code = $reg[1];
60 61
 	$values = GETPOST($code);
61
-	if (is_array($values))
62
-		$values = implode(',', $values);
62
+	if (is_array($values)) {
63
+			$values = implode(',', $values);
64
+	}
63 65
 
64 66
 	if (dolibarr_set_const($db, $code, $values, 'chaine', 0, '', $conf->entity) > 0) {
65 67
 		header("Location: ".$_SERVER["PHP_SELF"]);
Please login to merge, or discard this patch.
htdocs/modulebuilder/template/admin/myobject_extrafields.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,13 +39,17 @@
 block discarded – undo
39 39
 // List of supported format
40 40
 $tmptype2label = ExtraFields::$type2label;
41 41
 $type2label = array('');
42
-foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->transnoentitiesnoconv($val);
42
+foreach ($tmptype2label as $key => $val) {
43
+	$type2label[$key] = $langs->transnoentitiesnoconv($val);
44
+}
43 45
 
44 46
 $action = GETPOST('action', 'aZ09');
45 47
 $attrname = GETPOST('attrname', 'alpha');
46 48
 $elementtype = 'mymodule_myobject'; //Must be the $table_element of the class that manage extrafield
47 49
 
48
-if (!$user->admin) accessforbidden();
50
+if (!$user->admin) {
51
+	accessforbidden();
52
+}
49 53
 
50 54
 
51 55
 /*
Please login to merge, or discard this patch.
htdocs/modulebuilder/template/admin/about.php 1 patch
Braces   +21 added lines, -7 removed lines patch added patch discarded remove patch
@@ -25,16 +25,28 @@  discard block
 block discarded – undo
25 25
 // Load Dolibarr environment
26 26
 $res = 0;
27 27
 // Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
28
-if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
28
+if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
29
+	$res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
30
+}
29 31
 // Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
30 32
 $tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
31 33
 while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; }
32
-if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
33
-if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
34
+if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
35
+	$res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
36
+}
37
+if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
38
+	$res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
39
+}
34 40
 // Try main.inc.php using relative path
35
-if (!$res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php";
36
-if (!$res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php";
37
-if (!$res) die("Include of main fails");
41
+if (!$res && file_exists("../../main.inc.php")) {
42
+	$res = @include "../../main.inc.php";
43
+}
44
+if (!$res && file_exists("../../../main.inc.php")) {
45
+	$res = @include "../../../main.inc.php";
46
+}
47
+if (!$res) {
48
+	die("Include of main fails");
49
+}
38 50
 
39 51
 // Libraries
40 52
 require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
@@ -45,7 +57,9 @@  discard block
 block discarded – undo
45 57
 $langs->loadLangs(array("errors", "admin", "mymodule@mymodule"));
46 58
 
47 59
 // Access control
48
-if (!$user->admin) accessforbidden();
60
+if (!$user->admin) {
61
+	accessforbidden();
62
+}
49 63
 
50 64
 // Parameters
51 65
 $action = GETPOST('action', 'aZ09');
Please login to merge, or discard this patch.
htdocs/blockedlog/admin/blockedlog.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,7 +30,9 @@  discard block
 block discarded – undo
30 30
 // Load translation files required by the page
31 31
 $langs->loadLangs(array("admin", "other", "blockedlog"));
32 32
 
33
-if (!$user->admin || empty($conf->blockedlog->enabled)) accessforbidden();
33
+if (!$user->admin || empty($conf->blockedlog->enabled)) {
34
+	accessforbidden();
35
+}
34 36
 
35 37
 $action = GETPOST('action', 'aZ09');
36 38
 $backtopage = GETPOST('backtopage', 'alpha');
@@ -45,7 +47,9 @@  discard block
 block discarded – undo
45 47
 {
46 48
 	$code = $reg[1];
47 49
 	$values = GETPOST($code);
48
-	if (is_array($values)) $values = implode(',', $values);
50
+	if (is_array($values)) {
51
+		$values = implode(',', $values);
52
+	}
49 53
 
50 54
 	if (dolibarr_set_const($db, $code, $values, 'chaine', 0, '', $conf->entity) > 0)
51 55
 	{
Please login to merge, or discard this patch.
htdocs/blockedlog/admin/blockedlog_list.php 1 patch
Braces   +84 added lines, -29 removed lines patch added patch discarded remove patch
@@ -33,7 +33,9 @@  discard block
 block discarded – undo
33 33
 // Load translation files required by the page
34 34
 $langs->loadLangs(array("admin", "other", "blockedlog", "bills"));
35 35
 
36
-if ((!$user->admin && !$user->rights->blockedlog->read) || empty($conf->blockedlog->enabled)) accessforbidden();
36
+if ((!$user->admin && !$user->rights->blockedlog->read) || empty($conf->blockedlog->enabled)) {
37
+	accessforbidden();
38
+}
37 39
 
38 40
 $action = GETPOST('action', 'aZ09');
39 41
 $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'blockedloglist'; // To manage different context of search
@@ -41,18 +43,26 @@  discard block
 block discarded – undo
41 43
 $optioncss  = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
42 44
 
43 45
 $search_showonlyerrors = GETPOST('search_showonlyerrors', 'int');
44
-if ($search_showonlyerrors < 0) $search_showonlyerrors = 0;
46
+if ($search_showonlyerrors < 0) {
47
+	$search_showonlyerrors = 0;
48
+}
45 49
 
46 50
 $search_fk_user = GETPOST('search_fk_user', 'intcomma');
47 51
 $search_start = -1;
48
-if (GETPOST('search_startyear') != '') $search_start = dol_mktime(0, 0, 0, GETPOST('search_startmonth'), GETPOST('search_startday'), GETPOST('search_startyear'));
52
+if (GETPOST('search_startyear') != '') {
53
+	$search_start = dol_mktime(0, 0, 0, GETPOST('search_startmonth'), GETPOST('search_startday'), GETPOST('search_startyear'));
54
+}
49 55
 $search_end = -1;
50
-if (GETPOST('search_endyear') != '') $search_end = dol_mktime(23, 59, 59, GETPOST('search_endmonth'), GETPOST('search_endday'), GETPOST('search_endyear'));
56
+if (GETPOST('search_endyear') != '') {
57
+	$search_end = dol_mktime(23, 59, 59, GETPOST('search_endmonth'), GETPOST('search_endday'), GETPOST('search_endyear'));
58
+}
51 59
 $search_code = GETPOST('search_code', 'alpha');
52 60
 $search_ref = GETPOST('search_ref', 'alpha');
53 61
 $search_amount = GETPOST('search_amount', 'alpha');
54 62
 
55
-if (($search_start == -1 || empty($search_start)) && !GETPOSTISSET('search_startmonth')) $search_start = dol_time_plus_duree(dol_now(), '-1', 'w');
63
+if (($search_start == -1 || empty($search_start)) && !GETPOSTISSET('search_startmonth')) {
64
+	$search_start = dol_time_plus_duree(dol_now(), '-1', 'w');
65
+}
56 66
 
57 67
 // Load variable for pagination
58 68
 $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
@@ -64,8 +74,12 @@  discard block
 block discarded – undo
64 74
 $pageprev = $page - 1;
65 75
 $pagenext = $page + 1;
66 76
 
67
-if (empty($sortfield)) $sortfield = 'rowid';
68
-if (empty($sortorder)) $sortorder = 'DESC';
77
+if (empty($sortfield)) {
78
+	$sortfield = 'rowid';
79
+}
80
+if (empty($sortorder)) {
81
+	$sortorder = 'DESC';
82
+}
69 83
 
70 84
 $block_static = new BlockedLog($db);
71 85
 
@@ -78,9 +92,11 @@  discard block
 block discarded – undo
78 92
  */
79 93
 
80 94
 // Purge search criteria
81
-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
95
+if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
96
+	// All tests are required to be compatible with all browsers
82 97
 {
83 98
 	$search_fk_user = '';
99
+}
84 100
 	$search_start = -1;
85 101
 	$search_end = -1;
86 102
 	$search_code = '';
@@ -205,8 +221,11 @@  discard block
 block discarded – undo
205 221
 				if ($checksignature)
206 222
 				{
207 223
 					$statusofrecord = 'Valid';
208
-					if ($loweridinerror > 0) $statusofrecordnote = 'ValidButFoundAPreviousKO';
209
-					else $statusofrecordnote = '';
224
+					if ($loweridinerror > 0) {
225
+						$statusofrecordnote = 'ValidButFoundAPreviousKO';
226
+					} else {
227
+						$statusofrecordnote = '';
228
+					}
210 229
 				} else {
211 230
 					$statusofrecord = 'KO';
212 231
 					$statusofrecordnote = 'LineCorruptedOrNotMatchingPreviousOne';
@@ -294,18 +313,42 @@  discard block
 block discarded – undo
294 313
 print '<br>';
295 314
 
296 315
 $param = '';
297
-if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
298
-if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
299
-if ($search_fk_user > 0)    $param .= '&search_fk_user='.urlencode($search_fk_user);
300
-if ($search_startyear > 0)  $param .= '&search_startyear='.urlencode(GETPOST('search_startyear', 'int'));
301
-if ($search_startmonth > 0) $param .= '&search_startmonth='.urlencode(GETPOST('search_startmonth', 'int'));
302
-if ($search_startday > 0)   $param .= '&search_startday='.urlencode(GETPOST('search_startday', 'int'));
303
-if ($search_endyear > 0)    $param .= '&search_endyear='.urlencode(GETPOST('search_endyear', 'int'));
304
-if ($search_endmonth > 0)   $param .= '&search_endmonth='.urlencode(GETPOST('search_endmonth', 'int'));
305
-if ($search_endday > 0)     $param .= '&search_endday='.urlencode(GETPOST('search_endday', 'int'));
306
-if ($search_showonlyerrors > 0) $param .= '&search_showonlyerrors='.urlencode($search_showonlyerrors);
307
-if ($optioncss != '')       $param .= '&optioncss='.urlencode($optioncss);
308
-if (GETPOST('withtab', 'alpha')) $param .= '&withtab='.urlencode(GETPOST('withtab', 'alpha'));
316
+if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
317
+	$param .= '&contextpage='.urlencode($contextpage);
318
+}
319
+if ($limit > 0 && $limit != $conf->liste_limit) {
320
+	$param .= '&limit='.urlencode($limit);
321
+}
322
+if ($search_fk_user > 0) {
323
+	$param .= '&search_fk_user='.urlencode($search_fk_user);
324
+}
325
+if ($search_startyear > 0) {
326
+	$param .= '&search_startyear='.urlencode(GETPOST('search_startyear', 'int'));
327
+}
328
+if ($search_startmonth > 0) {
329
+	$param .= '&search_startmonth='.urlencode(GETPOST('search_startmonth', 'int'));
330
+}
331
+if ($search_startday > 0) {
332
+	$param .= '&search_startday='.urlencode(GETPOST('search_startday', 'int'));
333
+}
334
+if ($search_endyear > 0) {
335
+	$param .= '&search_endyear='.urlencode(GETPOST('search_endyear', 'int'));
336
+}
337
+if ($search_endmonth > 0) {
338
+	$param .= '&search_endmonth='.urlencode(GETPOST('search_endmonth', 'int'));
339
+}
340
+if ($search_endday > 0) {
341
+	$param .= '&search_endday='.urlencode(GETPOST('search_endday', 'int'));
342
+}
343
+if ($search_showonlyerrors > 0) {
344
+	$param .= '&search_showonlyerrors='.urlencode($search_showonlyerrors);
345
+}
346
+if ($optioncss != '') {
347
+	$param .= '&optioncss='.urlencode($optioncss);
348
+}
349
+if (GETPOST('withtab', 'alpha')) {
350
+	$param .= '&withtab='.urlencode(GETPOST('withtab', 'alpha'));
351
+}
309 352
 
310 353
 // Add $param from extra fields
311 354
 //include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
@@ -330,7 +373,9 @@  discard block
 block discarded – undo
330 373
 print '<input type="text" name="yeartoexport" class="valignmiddle maxwidth50imp" value="'.GETPOST('yeartoexport', 'int').'">';
331 374
 print '<input type="hidden" name="withtab" value="'.GETPOST('withtab', 'alpha').'">';
332 375
 print '<input type="submit" name="downloadcsv" class="button" value="'.$langs->trans('DownloadLogCSV').'">';
333
-if (!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY)) print ' | <a href="?action=downloadblockchain'.(GETPOST('withtab', 'alpha') ? '&withtab='.GETPOST('withtab', 'alpha') : '').'">'.$langs->trans('DownloadBlockChain').'</a>';
376
+if (!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY)) {
377
+	print ' | <a href="?action=downloadblockchain'.(GETPOST('withtab', 'alpha') ? '&withtab='.GETPOST('withtab', 'alpha') : '').'">'.$langs->trans('DownloadBlockChain').'</a>';
378
+}
334 379
 print ' </div><br>';
335 380
 
336 381
 print '</form>';
@@ -339,7 +384,9 @@  discard block
 block discarded – undo
339 384
 
340 385
 print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
341 386
 
342
-if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
387
+if ($optioncss != '') {
388
+	print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
389
+}
343 390
 print '<input type="hidden" name="token" value="'.newToken().'">';
344 391
 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
345 392
 print '<input type="hidden" name="action" value="list">';
@@ -440,8 +487,11 @@  discard block
 block discarded – undo
440 487
 			$checkresult[$block->id] = $checksignature; // false if error
441 488
 			if (!$checksignature)
442 489
 			{
443
-				if (empty($loweridinerror)) $loweridinerror = $block->id;
444
-				else $loweridinerror = min($loweridinerror, $block->id);
490
+				if (empty($loweridinerror)) {
491
+					$loweridinerror = $block->id;
492
+				} else {
493
+					$loweridinerror = min($loweridinerror, $block->id);
494
+				}
445 495
 			}
446 496
 		}
447 497
 	}
@@ -492,10 +542,13 @@  discard block
 block discarded – undo
492 542
 
493 543
 		   	// Status
494 544
 		   	print '<td class="center">';
495
-		   	if (!$checkresult[$block->id] || ($loweridinerror && $block->id >= $loweridinerror))	// If error
545
+		   	if (!$checkresult[$block->id] || ($loweridinerror && $block->id >= $loweridinerror)) {
546
+		   		// If error
496 547
 		   	{
497 548
 		   		if ($checkresult[$block->id]) print img_picto($langs->trans('OkCheckFingerprintValidityButChainIsKo'), 'statut4');
498
-		   		else print img_picto($langs->trans('KoCheckFingerprintValidity'), 'statut8');
549
+		   	} else {
550
+		   			print img_picto($langs->trans('KoCheckFingerprintValidity'), 'statut8');
551
+		   		}
499 552
 		   	} else {
500 553
 		   		print img_picto($langs->trans('OkCheckFingerprintValidity'), 'statut4');
501 554
 		   	}
@@ -504,10 +557,12 @@  discard block
 block discarded – undo
504 557
 
505 558
 		   	// Note
506 559
 		   	print '<td class="center">';
507
-		   	if (!$checkresult[$block->id] || ($loweridinerror && $block->id >= $loweridinerror))	// If error
560
+		   	if (!$checkresult[$block->id] || ($loweridinerror && $block->id >= $loweridinerror)) {
561
+		   		// If error
508 562
 		   	{
509 563
 		   		if ($checkresult[$block->id]) print $form->textwithpicto('', $langs->trans('OkCheckFingerprintValidityButChainIsKo'));
510 564
 		   	}
565
+		   	}
511 566
 
512 567
 		   	if (!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY) && !empty($conf->global->BLOCKEDLOG_AUTHORITY_URL)) {
513 568
 		   		print ' '.($block->certified ? img_picto($langs->trans('AddedByAuthority'), 'info') : img_picto($langs->trans('NotAddedByAuthorityYet'), 'info_black'));
Please login to merge, or discard this patch.