Passed
Branch develop (66e4de)
by Laurent
33:03
created
htdocs/barcode/codeinit.php 1 patch
Braces   +21 added lines, -7 removed lines patch added patch discarded remove patch
@@ -140,7 +140,9 @@  discard block
 block discarded – undo
140 140
 						$result = $productstatic->setValueFrom('barcode', $nextvalue, '', '', 'text', '', $user, 'PRODUCT_MODIFY');
141 141
 
142 142
 						$nbtry++;
143
-						if ($result > 0) $nbok++;
143
+						if ($result > 0) {
144
+							$nbok++;
145
+						}
144 146
 					}
145 147
 
146 148
 					$i++;
@@ -174,8 +176,12 @@  discard block
 block discarded – undo
174 176
  * View
175 177
  */
176 178
 
177
-if (!$user->admin) accessforbidden();
178
-if (empty($conf->barcode->enabled)) accessforbidden();
179
+if (!$user->admin) {
180
+	accessforbidden();
181
+}
182
+if (empty($conf->barcode->enabled)) {
183
+	accessforbidden();
184
+}
179 185
 
180 186
 $form = new Form($db);
181 187
 
@@ -211,7 +217,9 @@  discard block
 block discarded – undo
211 217
 	{
212 218
 		$obj = $db->fetch_object($resql);
213 219
 		$nbno = $obj->nb;
214
-	} else dol_print_error($db);
220
+	} else {
221
+		dol_print_error($db);
222
+	}
215 223
 
216 224
 	$sql = "SELECT count(rowid) as nb FROM ".MAIN_DB_PREFIX."societe";
217 225
 	$resql = $db->query($sql);
@@ -219,7 +227,9 @@  discard block
 block discarded – undo
219 227
 	{
220 228
 		$obj = $db->fetch_object($resql);
221 229
 		$nbtotal = $obj->nb;
222
-	} else dol_print_error($db);
230
+	} else {
231
+		dol_print_error($db);
232
+	}
223 233
 
224 234
 	print $langs->trans("CurrentlyNWithoutBarCode", $nbno, $nbtotal, $langs->transnoentitiesnoconv("ThirdParties")).'<br>'."\n";
225 235
 
@@ -263,7 +273,9 @@  discard block
 block discarded – undo
263 273
 
264 274
 			$i++;
265 275
 		}
266
-	} else dol_print_error($db);
276
+	} else {
277
+		dol_print_error($db);
278
+	}
267 279
 
268 280
 	$sql = "SELECT count(rowid) as nb FROM ".MAIN_DB_PREFIX."product";
269 281
 	$resql = $db->query($sql);
@@ -271,7 +283,9 @@  discard block
 block discarded – undo
271 283
 	{
272 284
 		$obj = $db->fetch_object($resql);
273 285
 		$nbtotal = $obj->nb;
274
-	} else dol_print_error($db);
286
+	} else {
287
+		dol_print_error($db);
288
+	}
275 289
 
276 290
 	print $langs->trans("CurrentlyNWithoutBarCode", $nbno, $nbtotal, $langs->transnoentitiesnoconv("ProductsOrServices")).'<br>'."\n";
277 291
 
Please login to merge, or discard this patch.
htdocs/barcode/printsheet.php 1 patch
Braces   +24 added lines, -8 removed lines patch added patch discarded remove patch
@@ -63,7 +63,9 @@  discard block
 block discarded – undo
63 63
 		$forbarcode = $producttmp->barcode;
64 64
 		$fk_barcode_type = $producttmp->barcode_type;
65 65
 
66
-		if (empty($fk_barcode_type) && !empty($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE)) $fk_barcode_type = $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE;
66
+		if (empty($fk_barcode_type) && !empty($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE)) {
67
+			$fk_barcode_type = $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE;
68
+		}
67 69
 
68 70
 		if (empty($forbarcode) || empty($fk_barcode_type))
69 71
 		{
@@ -80,7 +82,9 @@  discard block
 block discarded – undo
80 82
 		$forbarcode = $thirdpartytmp->barcode;
81 83
 		$fk_barcode_type = $thirdpartytmp->barcode_type_code;
82 84
 
83
-		if (empty($fk_barcode_type) && !empty($conf->global->GENBARCODE_BARCODETYPE_THIRDPARTY)) $fk_barcode_type = $conf->global->GENBARCODE_BARCODETYPE_THIRDPARTY;
85
+		if (empty($fk_barcode_type) && !empty($conf->global->GENBARCODE_BARCODETYPE_THIRDPARTY)) {
86
+			$fk_barcode_type = $conf->global->GENBARCODE_BARCODETYPE_THIRDPARTY;
87
+		}
84 88
 
85 89
 		if (empty($forbarcode) || empty($fk_barcode_type))
86 90
 		{
@@ -93,14 +97,18 @@  discard block
 block discarded – undo
93 97
 {
94 98
 	$result = 0; $error = 0;
95 99
 
96
-	if (empty($forbarcode))			// barcode value
100
+	if (empty($forbarcode)) {
101
+		// barcode value
97 102
 	{
98 103
 		setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BarcodeValue")), null, 'errors');
104
+	}
99 105
 		$error++;
100 106
 	}
101
-	if (empty($fk_barcode_type))		// barcode type = barcode encoding
107
+	if (empty($fk_barcode_type)) {
108
+		// barcode type = barcode encoding
102 109
 	{
103 110
 		setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BarcodeType")), null, 'errors');
111
+	}
104 112
 		$error++;
105 113
 	}
106 114
 
@@ -135,10 +143,14 @@  discard block
 block discarded – undo
135 143
 			$newdir = dol_osencode($dir);
136 144
 
137 145
 			// Check if directory exists (we do not use dol_is_dir to avoid loading files.lib.php)
138
-			if (!is_dir($newdir)) continue;
146
+			if (!is_dir($newdir)) {
147
+				continue;
148
+			}
139 149
 
140 150
 			$result = @include_once $newdir.$generator.'.modules.php';
141
-			if ($result) break;
151
+			if ($result) {
152
+				break;
153
+			}
142 154
 		}
143 155
 
144 156
 		// Load barcode class for generating barcode image
@@ -235,7 +247,9 @@  discard block
 block discarded – undo
235 247
 
236 248
 			$outfile = $langs->trans("BarCode").'_sheets_'.dol_print_date(dol_now(), 'dayhourlog').'.pdf';
237 249
 
238
-			if (!$mesg) $result = doc_label_pdf_create($db, $arrayofrecords, $modellabel, $outputlangs, $diroutput, $template, dol_sanitizeFileName($outfile));
250
+			if (!$mesg) {
251
+				$result = doc_label_pdf_create($db, $arrayofrecords, $modellabel, $outputlangs, $diroutput, $template, dol_sanitizeFileName($outfile));
252
+			}
239 253
 		}
240 254
 
241 255
 		if ($result <= 0)
@@ -256,7 +270,9 @@  discard block
 block discarded – undo
256 270
  * View
257 271
  */
258 272
 
259
-if (empty($conf->barcode->enabled)) accessforbidden();
273
+if (empty($conf->barcode->enabled)) {
274
+	accessforbidden();
275
+}
260 276
 
261 277
 $form = new Form($db);
262 278
 
Please login to merge, or discard this patch.
htdocs/opensurvey/index.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,7 +31,9 @@  discard block
 block discarded – undo
31 31
 $langs->load("opensurvey");
32 32
 
33 33
 // Security check
34
-if (!$user->rights->opensurvey->read) accessforbidden();
34
+if (!$user->rights->opensurvey->read) {
35
+	accessforbidden();
36
+}
35 37
 
36 38
 $hookmanager = new HookManager($db);
37 39
 
@@ -52,7 +54,9 @@  discard block
 block discarded – undo
52 54
 {
53 55
 	$obj = $db->fetch_object($resql);
54 56
 	$nbsondages = $obj->nb;
55
-} else dol_print_error($db, '');
57
+} else {
58
+	dol_print_error($db, '');
59
+}
56 60
 
57 61
 
58 62
 $title = $langs->trans("OpenSurveyArea");
Please login to merge, or discard this patch.
htdocs/opensurvey/wizard/choix_date.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -28,7 +28,9 @@  discard block
 block discarded – undo
28 28
 require_once DOL_DOCUMENT_ROOT."/opensurvey/fonctions.php";
29 29
 
30 30
 // Security check
31
-if (!$user->rights->opensurvey->write) accessforbidden();
31
+if (!$user->rights->opensurvey->write) {
32
+	accessforbidden();
33
+}
32 34
 
33 35
 // Survey type is DATE
34 36
 $_SESSION["formatsondage"] = "D";
@@ -220,9 +222,15 @@  discard block
 block discarded – undo
220 222
 $anneeAJ = date("Y");
221 223
 
222 224
 // Initialisation des jour, mois et année
223
-if (!isset($_SESSION['jour'])) $_SESSION['jour'] = date('j');
224
-if (!isset($_SESSION['mois'])) $_SESSION['mois'] = date('n');
225
-if (!isset($_SESSION['annee'])) $_SESSION['annee'] = date('Y');
225
+if (!isset($_SESSION['jour'])) {
226
+	$_SESSION['jour'] = date('j');
227
+}
228
+if (!isset($_SESSION['mois'])) {
229
+	$_SESSION['mois'] = date('n');
230
+}
231
+if (!isset($_SESSION['annee'])) {
232
+	$_SESSION['annee'] = date('Y');
233
+}
226 234
 
227 235
 //mise a jour des valeurs de session si bouton retour a aujourd'hui
228 236
 if (!issetAndNoEmpty('choixjourajout') && !issetAndNoEmpty('choixjourretrait') && (issetAndNoEmpty('retourmois') || issetAndNoEmpty('retourmois_x'))) {
Please login to merge, or discard this patch.
htdocs/opensurvey/exportcsv.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,7 +37,9 @@  discard block
 block discarded – undo
37 37
 
38 38
 $object = new Opensurveysondage($db);
39 39
 $result = $object->fetch(0, $numsondage);
40
-if ($result <= 0) dol_print_error('', 'Failed to get survey id '.$numsondage);
40
+if ($result <= 0) {
41
+	dol_print_error('', 'Failed to get survey id '.$numsondage);
42
+}
41 43
 
42 44
 
43 45
 /*
@@ -120,7 +122,9 @@  discard block
 block discarded – undo
120 122
 		$input .= "\r\n";
121 123
 		$i++;
122 124
 	}
123
-} else dol_print_error($db);
125
+} else {
126
+	dol_print_error($db);
127
+}
124 128
 
125 129
 
126 130
 $filesize = strlen($input);
Please login to merge, or discard this patch.
htdocs/user/home.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -45,7 +45,9 @@  discard block
 block discarded – undo
45 45
 
46 46
 // Security check (for external users)
47 47
 $socid = 0;
48
-if ($user->socid > 0) $socid = $user->socid;
48
+if ($user->socid > 0) {
49
+	$socid = $user->socid;
50
+}
49 51
 
50 52
 $companystatic = new Societe($db);
51 53
 $fuserstatic = new User($db);
@@ -116,7 +118,9 @@  discard block
 block discarded – undo
116 118
 } else {
117 119
 	$sql .= " WHERE u.entity IN (".getEntity('user').")";
118 120
 }
119
-if (!empty($socid)) $sql .= " AND u.fk_soc = ".$socid;
121
+if (!empty($socid)) {
122
+	$sql .= " AND u.fk_soc = ".$socid;
123
+}
120 124
 $sql .= $db->order("u.datec", "DESC");
121 125
 $sql .= $db->plimit($max);
122 126
 
@@ -231,7 +235,9 @@  discard block
 block discarded – undo
231 235
 	if ($resql)
232 236
 	{
233 237
 		$colspan = 1;
234
-		if (!empty($conf->multicompany->enabled)) $colspan++;
238
+		if (!empty($conf->multicompany->enabled)) {
239
+			$colspan++;
240
+		}
235 241
 		$num = $db->num_rows($resql);
236 242
 
237 243
 		print '<div class="div-table-responsive-no-min">';
Please login to merge, or discard this patch.
htdocs/user/ldap.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -35,7 +35,9 @@  discard block
 block discarded – undo
35 35
 
36 36
 // Security check
37 37
 $socid = 0;
38
-if ($user->socid > 0) $socid = $user->socid;
38
+if ($user->socid > 0) {
39
+	$socid = $user->socid;
40
+}
39 41
 $feature2 = (($socid && $user->rights->user->self->creer) ? '' : 'user');
40 42
 
41 43
 $result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
@@ -55,7 +57,9 @@  discard block
 block discarded – undo
55 57
 
56 58
 $parameters = array('id'=>$socid);
57 59
 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
58
-if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
60
+if ($reshook < 0) {
61
+	setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
62
+}
59 63
 
60 64
 if (empty($reshook))
61 65
 {
@@ -162,7 +166,9 @@  discard block
 block discarded – undo
162 166
 
163 167
 print "</div>\n";
164 168
 
165
-if ($conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap') print "<br>\n";
169
+if ($conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap') {
170
+	print "<br>\n";
171
+}
166 172
 
167 173
 
168 174
 
Please login to merge, or discard this patch.
htdocs/user/document.php 1 patch
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -64,12 +64,16 @@  discard block
 block discarded – undo
64 64
 
65 65
 // Security check
66 66
 $socid = 0;
67
-if ($user->socid > 0) $socid = $user->socid;
67
+if ($user->socid > 0) {
68
+	$socid = $user->socid;
69
+}
68 70
 $feature2 = 'user';
69 71
 
70 72
 $result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
71 73
 
72
-if ($user->id <> $id && !$canreaduser) accessforbidden();
74
+if ($user->id <> $id && !$canreaduser) {
75
+	accessforbidden();
76
+}
73 77
 
74 78
 // Get parameters
75 79
 $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
@@ -80,8 +84,12 @@  discard block
 block discarded – undo
80 84
 $offset = $limit * $page;
81 85
 $pageprev = $page - 1;
82 86
 $pagenext = $page + 1;
83
-if (!$sortorder) $sortorder = "ASC";
84
-if (!$sortfield) $sortfield = "position_name";
87
+if (!$sortorder) {
88
+	$sortorder = "ASC";
89
+}
90
+if (!$sortfield) {
91
+	$sortfield = "position_name";
92
+}
85 93
 
86 94
 $object = new User($db);
87 95
 if ($id > 0 || !empty($ref))
@@ -103,7 +111,9 @@  discard block
 block discarded – undo
103 111
 
104 112
 $parameters = array('id'=>$socid);
105 113
 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
106
-if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
114
+if ($reshook < 0) {
115
+	setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
116
+}
107 117
 
108 118
 if (empty($reshook)) {
109 119
 	include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
@@ -123,7 +133,9 @@  discard block
 block discarded – undo
123 133
 	/*
124 134
 	 * Affichage onglets
125 135
 	 */
126
-	if (!empty($conf->notification->enabled)) $langs->load("mails");
136
+	if (!empty($conf->notification->enabled)) {
137
+		$langs->load("mails");
138
+	}
127 139
 	$head = user_prepare_head($object);
128 140
 
129 141
 	$form = new Form($db);
Please login to merge, or discard this patch.
htdocs/expensereport/ajax/ajaxprojet.php 1 patch
Braces   +23 added lines, -7 removed lines patch added patch discarded remove patch
@@ -24,12 +24,25 @@  discard block
 block discarded – undo
24 24
  *       \brief      File to return Ajax response on third parties request
25 25
  */
26 26
 
27
-if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); // Disables token renewal
28
-if (!defined('NOREQUIREMENU'))  define('NOREQUIREMENU', '1');
29
-if (!defined('NOREQUIREHTML'))  define('NOREQUIREHTML', '1');
30
-if (!defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX', '1');
31
-if (!defined('NOREQUIRESOC'))   define('NOREQUIRESOC', '1');
32
-if (!defined('NOCSRFCHECK'))    define('NOCSRFCHECK', '1');
27
+if (!defined('NOTOKENRENEWAL')) {
28
+	define('NOTOKENRENEWAL', 1);
29
+}
30
+// Disables token renewal
31
+if (!defined('NOREQUIREMENU')) {
32
+	define('NOREQUIREMENU', '1');
33
+}
34
+if (!defined('NOREQUIREHTML')) {
35
+	define('NOREQUIREHTML', '1');
36
+}
37
+if (!defined('NOREQUIREAJAX')) {
38
+	define('NOREQUIREAJAX', '1');
39
+}
40
+if (!defined('NOREQUIRESOC')) {
41
+	define('NOREQUIRESOC', '1');
42
+}
43
+if (!defined('NOCSRFCHECK')) {
44
+	define('NOCSRFCHECK', '1');
45
+}
33 46
 
34 47
 $res = 0;
35 48
 require '../../main.inc.php';
@@ -59,7 +72,10 @@  discard block
 block discarded – undo
59 72
 	$sql = "SELECT p.rowid, p.ref, p.title, s.nom";
60 73
 	$sql .= " FROM ".MAIN_DB_PREFIX."projet as p";
61 74
 	$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON p.fk_soc = s.rowid";
62
-	if (!empty($_GET["fk_projet"])) $sql .= " WHERE p.ref LIKE '%".$db->escape($_GET["fk_projet"])."%' OR p.title LIKE '%".$db->escape($_GET["fk_projet"])."%' OR s.nom LIKE '%".$db->escape($_GET["fk_projet"])."%'"; // Add other filters
75
+	if (!empty($_GET["fk_projet"])) {
76
+		$sql .= " WHERE p.ref LIKE '%".$db->escape($_GET["fk_projet"])."%' OR p.title LIKE '%".$db->escape($_GET["fk_projet"])."%' OR s.nom LIKE '%".$db->escape($_GET["fk_projet"])."%'";
77
+	}
78
+	// Add other filters
63 79
 	$sql .= " ORDER BY p.ref ASC";
64 80
 
65 81
 	$resql = $db->query($sql);
Please login to merge, or discard this patch.