Passed
Branch develop (66e4de)
by Laurent
33:03
created
htdocs/expensereport/class/expensereport_rule.class.php 1 patch
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -182,8 +182,11 @@
 block discarded – undo
182 182
 			while ($obj = $db->fetch_object($resql))
183 183
 			{
184 184
 				$rule = new ExpenseReportRule($db);
185
-				if ($rule->fetch($obj->rowid) > 0) $rules[$rule->id] = $rule;
186
-				else dol_print_error($db);
185
+				if ($rule->fetch($obj->rowid) > 0) {
186
+					$rules[$rule->id] = $rule;
187
+				} else {
188
+					dol_print_error($db);
189
+				}
187 190
 			}
188 191
 		} else {
189 192
 			dol_print_error($db);
Please login to merge, or discard this patch.
htdocs/expensereport/class/expensereport_ik.class.php 1 patch
Braces   +25 added lines, -9 removed lines patch added patch discarded remove patch
@@ -111,8 +111,11 @@  discard block
 block discarded – undo
111 111
 		$sql = 'SELECT rowid, label, entity, active';
112 112
 		$sql .= ' FROM '.MAIN_DB_PREFIX.'c_exp_tax_cat';
113 113
 		$sql .= ' WHERE entity IN ('.getEntity('c_exp_tax_cat').')';
114
-		if ($mode == 1) $sql .= ' AND active = 1';
115
-		elseif ($mode == 2) $sql .= 'AND active = 0';
114
+		if ($mode == 1) {
115
+			$sql .= ' AND active = 1';
116
+		} elseif ($mode == 2) {
117
+			$sql .= 'AND active = 0';
118
+		}
116 119
 
117 120
 		dol_syslog(get_called_class().'::getTaxCategories sql='.$sql, LOG_DEBUG);
118 121
 		$resql = $db->query($sql);
@@ -142,8 +145,11 @@  discard block
 block discarded – undo
142 145
 		$ranges = self::getRangesByCategory($fk_c_exp_tax_cat);
143 146
 
144 147
 		// substract 1 because array start from 0
145
-		if (empty($ranges) || !isset($ranges[$default_range - 1])) return false;
146
-		else return $ranges[$default_range - 1];
148
+		if (empty($ranges) || !isset($ranges[$default_range - 1])) {
149
+			return false;
150
+		} else {
151
+			return $ranges[$default_range - 1];
152
+		}
147 153
 	}
148 154
 
149 155
 	/**
@@ -160,9 +166,13 @@  discard block
 block discarded – undo
160 166
 		$ranges = array();
161 167
 
162 168
 		$sql = 'SELECT r.rowid FROM '.MAIN_DB_PREFIX.'c_exp_tax_range r';
163
-		if ($active) $sql .= ' INNER JOIN '.MAIN_DB_PREFIX.'c_exp_tax_cat c ON (r.fk_c_exp_tax_cat = c.rowid)';
169
+		if ($active) {
170
+			$sql .= ' INNER JOIN '.MAIN_DB_PREFIX.'c_exp_tax_cat c ON (r.fk_c_exp_tax_cat = c.rowid)';
171
+		}
164 172
 		$sql .= ' WHERE r.fk_c_exp_tax_cat = '.$fk_c_exp_tax_cat;
165
-		if ($active) $sql .= ' AND r.active = 1 AND c.active = 1';
173
+		if ($active) {
174
+			$sql .= ' AND r.active = 1 AND c.active = 1';
175
+		}
166 176
 		$sql .= ' ORDER BY r.range_ik';
167 177
 
168 178
 		dol_syslog(get_called_class().'::getRangesByCategory sql='.$sql, LOG_DEBUG);
@@ -212,10 +222,14 @@  discard block
 block discarded – undo
212 222
 			while ($obj = $db->fetch_object($resql))
213 223
 			{
214 224
 				$ik = new ExpenseReportIk($db);
215
-				if ($obj->fk_expense_ik > 0) $ik->fetch($obj->fk_expense_ik);
225
+				if ($obj->fk_expense_ik > 0) {
226
+					$ik->fetch($obj->fk_expense_ik);
227
+				}
216 228
 				$obj->ik = $ik;
217 229
 
218
-				if (!isset($ranges[$obj->fk_c_exp_tax_cat])) $ranges[$obj->fk_c_exp_tax_cat] = array('label' => $obj->label, 'active' => $obj->cat_active, 'ranges' => array());
230
+				if (!isset($ranges[$obj->fk_c_exp_tax_cat])) {
231
+					$ranges[$obj->fk_c_exp_tax_cat] = array('label' => $obj->label, 'active' => $obj->cat_active, 'ranges' => array());
232
+				}
219 233
 				$ranges[$obj->fk_c_exp_tax_cat]['ranges'][] = $obj;
220 234
 			}
221 235
 		} else {
@@ -239,7 +253,9 @@  discard block
 block discarded – undo
239 253
 		$sql .= ' SELECT COUNT(*) as counted';
240 254
 		$sql .= ' FROM '.MAIN_DB_PREFIX.'c_exp_tax_range r';
241 255
 		$sql .= ' WHERE r.entity IN (0, '.$conf->entity.')';
242
-		if ($default_c_exp_tax_cat > 0) $sql .= ' AND r.fk_c_exp_tax_cat = '.$default_c_exp_tax_cat;
256
+		if ($default_c_exp_tax_cat > 0) {
257
+			$sql .= ' AND r.fk_c_exp_tax_cat = '.$default_c_exp_tax_cat;
258
+		}
243 259
 		$sql .= ' GROUP BY r.fk_c_exp_tax_cat';
244 260
 		$sql .= ') as counts';
245 261
 
Please login to merge, or discard this patch.
htdocs/expensereport/payment/card.php 1 patch
Braces   +13 added lines, -5 removed lines patch added patch discarded remove patch
@@ -26,7 +26,9 @@  discard block
 block discarded – undo
26 26
 require_once DOL_DOCUMENT_ROOT.'/expensereport/class/paymentexpensereport.class.php';
27 27
 require_once DOL_DOCUMENT_ROOT.'/core/modules/expensereport/modules_expensereport.php';
28 28
 require_once DOL_DOCUMENT_ROOT.'/core/lib/expensereport.lib.php';
29
-if (!empty($conf->banque->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
29
+if (!empty($conf->banque->enabled)) {
30
+	require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
31
+}
30 32
 
31 33
 // Load translation files required by the page
32 34
 $langs->loadLangs(array('bills', 'banks', 'companies', 'trips'));
@@ -36,7 +38,9 @@  discard block
 block discarded – undo
36 38
 $confirm = GETPOST('confirm');
37 39
 
38 40
 // Security check
39
-if ($user->socid) $socid = $user->socid;
41
+if ($user->socid) {
42
+	$socid = $user->socid;
43
+}
40 44
 // TODO Add rule to restrict access payment
41 45
 //$result = restrictedArea($user, 'facture', $id,'');
42 46
 
@@ -45,8 +49,10 @@  discard block
 block discarded – undo
45 49
 if ($id > 0)
46 50
 {
47 51
 	$result = $object->fetch($id);
48
-	if (!$result) dol_print_error($db, 'Failed to get payment id '.$id);
49
-}
52
+	if (!$result) {
53
+		dol_print_error($db, 'Failed to get payment id '.$id);
54
+	}
55
+	}
50 56
 
51 57
 
52 58
 /*
@@ -261,9 +267,11 @@  discard block
 block discarded – undo
261 267
 
262 268
 			print "</tr>\n";
263 269
 
264
-			if ($objp->paid == 1)	// If at least one invoice is paid, disable delete
270
+			if ($objp->paid == 1) {
271
+				// If at least one invoice is paid, disable delete
265 272
 			{
266 273
 				$disable_delete = 2;
274
+			}
267 275
 				$title_button = $langs->trans("CantRemovePaymentWithOneInvoicePaid");
268 276
 			}
269 277
 			$total = $total + $objp->amount;
Please login to merge, or discard this patch.
htdocs/expensereport/payment/payment.php 1 patch
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -314,8 +314,11 @@
 block discarded – undo
314 314
 		{
315 315
 			$namef = "amount_".$objp->id;
316 316
 			$nameRemain = "remain_".$objp->id; // autofill remainder amount
317
-			if (!empty($conf->use_javascript_ajax)) // autofill remainder amount
318
-					print img_picto("Auto fill", 'rightarrow', "class='AutoFillAmount' data-rowid='".$namef."' data-value='".($objp->total_ttc - $sumpaid)."'"); // autofill remainder amount
317
+			if (!empty($conf->use_javascript_ajax)) {
318
+				// autofill remainder amount
319
+					print img_picto("Auto fill", 'rightarrow', "class='AutoFillAmount' data-rowid='".$namef."' data-value='".($objp->total_ttc - $sumpaid)."'");
320
+			}
321
+			// autofill remainder amount
319 322
 			$remaintopay = $objp->total_ttc - $sumpaid; // autofill remainder amount
320 323
 			print '<input type=hidden class="sum_remain" name="'.$nameRemain.'" value="'.$remaintopay.'">'; // autofill remainder amount
321 324
 			print '<input type="text" size="8" name="'.$namef.'" id="'.$namef.'">';
Please login to merge, or discard this patch.
htdocs/ticket/document.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -56,8 +56,12 @@
 block discarded – undo
56 56
 $offset = $limit * $page;
57 57
 $pageprev = $page - 1;
58 58
 $pagenext = $page + 1;
59
-if (!$sortorder) $sortorder = "ASC";
60
-if (!$sortfield) $sortfield = "position_name";
59
+if (!$sortorder) {
60
+	$sortorder = "ASC";
61
+}
62
+if (!$sortfield) {
63
+	$sortfield = "position_name";
64
+}
61 65
 
62 66
 $object = new Ticket($db);
63 67
 $result = $object->fetch($id, $ref, $track_id);
Please login to merge, or discard this patch.
htdocs/mrp/ajax/ajax_bom.php 1 patch
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -22,13 +22,25 @@
 block discarded – undo
22 22
 
23 23
 //if (! defined('NOREQUIREUSER'))	define('NOREQUIREUSER','1');	// Not disabled cause need to load personalized language
24 24
 //if (! defined('NOREQUIREDB'))		define('NOREQUIREDB','1');		// Not disabled cause need to load personalized language
25
-if (!defined('NOREQUIRESOC'))		define('NOREQUIRESOC', '1');
25
+if (!defined('NOREQUIRESOC')) {
26
+	define('NOREQUIRESOC', '1');
27
+}
26 28
 //if (! defined('NOREQUIRETRAN'))		define('NOREQUIRETRAN','1');
27
-if (!defined('NOCSRFCHECK'))		define('NOCSRFCHECK', '1');
28
-if (!defined('NOTOKENRENEWAL'))	define('NOTOKENRENEWAL', '1');
29
-if (!defined('NOREQUIREMENU'))		define('NOREQUIREMENU', '1');
30
-if (!defined('NOREQUIREHTML'))		define('NOREQUIREHTML', '1');
31
-if (!defined('NOREQUIREAJAX'))		define('NOREQUIREAJAX', '1');
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
+}
32 44
 
33 45
 require '../../main.inc.php'; // Load $user and permissions
34 46
 require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php';
Please login to merge, or discard this patch.
htdocs/fourn/index.php 1 patch
Braces   +36 added lines, -12 removed lines patch added patch discarded remove patch
@@ -32,7 +32,9 @@  discard block
 block discarded – undo
32 32
 
33 33
 // Security check
34 34
 $socid = GETPOST("socid", 'int');
35
-if ($user->socid) $socid = $user->socid;
35
+if ($user->socid) {
36
+	$socid = $user->socid;
37
+}
36 38
 $result = restrictedArea($user, 'societe', $socid, '');
37 39
 
38 40
 
@@ -58,9 +60,13 @@  discard block
 block discarded – undo
58 60
 $sql = "SELECT count(cf.rowid), cf.fk_statut";
59 61
 $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as cf,";
60 62
 $sql .= " ".MAIN_DB_PREFIX."societe as s";
61
-if (!$user->rights->societe->client->voir && !$socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
63
+if (!$user->rights->societe->client->voir && !$socid) {
64
+	$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
65
+}
62 66
 $sql .= " WHERE cf.fk_soc = s.rowid ";
63
-if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND sc.fk_user = ".$user->id;
67
+if (!$user->rights->societe->client->voir && !$socid) {
68
+	$sql .= " AND sc.fk_user = ".$user->id;
69
+}
64 70
 $sql .= " AND cf.entity = ".$conf->entity;
65 71
 $sql .= " GROUP BY cf.fk_statut";
66 72
 
@@ -103,12 +109,18 @@  discard block
 block discarded – undo
103 109
 	$sql .= " s.nom as name, s.rowid as socid";
104 110
 	$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as cf";
105 111
 	$sql .= ", ".MAIN_DB_PREFIX."societe as s";
106
-	if (!$user->rights->societe->client->voir && !$socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
112
+	if (!$user->rights->societe->client->voir && !$socid) {
113
+		$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
114
+	}
107 115
 	$sql .= " WHERE cf.fk_soc = s.rowid";
108
-	if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND sc.fk_user = ".$user->id;
116
+	if (!$user->rights->societe->client->voir && !$socid) {
117
+		$sql .= " AND sc.fk_user = ".$user->id;
118
+	}
109 119
 	$sql .= " AND cf.entity = ".$conf->entity;
110 120
 	$sql .= " AND cf.fk_statut = 0";
111
-	if ($socid) $sql .= " AND cf.fk_soc = ".$socid;
121
+	if ($socid) {
122
+		$sql .= " AND cf.fk_soc = ".$socid;
123
+	}
112 124
 
113 125
 	$resql = $db->query($sql);
114 126
 	if ($resql)
@@ -158,12 +170,18 @@  discard block
 block discarded – undo
158 170
 	$sql .= ", s.nom as name, s.rowid as socid";
159 171
 	$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as ff";
160 172
 	$sql .= ", ".MAIN_DB_PREFIX."societe as s";
161
-	if (!$user->rights->societe->client->voir && !$socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
173
+	if (!$user->rights->societe->client->voir && !$socid) {
174
+		$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
175
+	}
162 176
 	$sql .= " WHERE s.rowid = ff.fk_soc";
163
-	if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND sc.fk_user = ".$user->id;
177
+	if (!$user->rights->societe->client->voir && !$socid) {
178
+		$sql .= " AND sc.fk_user = ".$user->id;
179
+	}
164 180
 	$sql .= " AND ff.entity = ".$conf->entity;
165 181
 	$sql .= " AND ff.fk_statut = 0";
166
-	if ($socid)	$sql .= " AND f.fk_soc = ".$socid;
182
+	if ($socid) {
183
+		$sql .= " AND f.fk_soc = ".$socid;
184
+	}
167 185
 
168 186
 	$resql = $db->query($sql);
169 187
 
@@ -226,12 +244,18 @@  discard block
 block discarded – undo
226 244
 $sql .= ", st.libelle as stcomm";
227 245
 $sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
228 246
 $sql .= ", ".MAIN_DB_PREFIX."c_stcomm as st";
229
-if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
247
+if (!$user->rights->societe->client->voir && !$socid) {
248
+	$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
249
+}
230 250
 $sql .= " WHERE s.fk_stcomm = st.id";
231 251
 $sql .= " AND s.fournisseur = 1";
232 252
 $sql .= " AND s.entity IN (".getEntity('societe').")";
233
-if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
234
-if ($socid) $sql .= " AND s.rowid = ".$socid;
253
+if (!$user->rights->societe->client->voir && !$socid) {
254
+	$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
255
+}
256
+if ($socid) {
257
+	$sql .= " AND s.rowid = ".$socid;
258
+}
235 259
 $sql .= " ORDER BY s.tms DESC";
236 260
 $sql .= $db->plimit($max, 0);
237 261
 
Please login to merge, or discard this patch.
htdocs/fourn/commande/note.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/fourn/commande/document.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -47,7 +47,9 @@  discard block
 block discarded – undo
47 47
 $confirm = GETPOST('confirm', 'alpha');
48 48
 
49 49
 // Security check
50
-if ($user->socid) $socid = $user->socid;
50
+if ($user->socid) {
51
+	$socid = $user->socid;
52
+}
51 53
 $result = restrictedArea($user, 'fournisseur', $id, 'commande_fournisseur', 'commande');
52 54
 
53 55
 // Get parameters
@@ -59,8 +61,12 @@  discard block
 block discarded – undo
59 61
 $offset = $limit * $page;
60 62
 $pageprev = $page - 1;
61 63
 $pagenext = $page + 1;
62
-if (!$sortorder) $sortorder = "ASC";
63
-if (!$sortfield) $sortfield = "name";
64
+if (!$sortorder) {
65
+	$sortorder = "ASC";
66
+}
67
+if (!$sortfield) {
68
+	$sortfield = "name";
69
+}
64 70
 
65 71
 
66 72
 $object = new CommandeFournisseur($db);
Please login to merge, or discard this patch.