Passed
Branch develop (66e4de)
by Laurent
33:03
created
htdocs/commande/class/api_orders.class.php 1 patch
Braces   +30 added lines, -11 removed lines patch added patch discarded remove patch
@@ -165,18 +165,33 @@  discard block
 block discarded – undo
165 165
 
166 166
 		// If the internal user must only see his customers, force searching by him
167 167
 		$search_sale = 0;
168
-		if (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) $search_sale = DolibarrApiAccess::$user->id;
168
+		if (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) {
169
+			$search_sale = DolibarrApiAccess::$user->id;
170
+		}
169 171
 
170 172
 		$sql = "SELECT t.rowid";
171
-		if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
173
+		if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) {
174
+			$sql .= ", sc.fk_soc, sc.fk_user";
175
+		}
176
+		// We need these fields in order to filter by sale (including the case where the user can only see his prospects)
172 177
 		$sql .= " FROM ".MAIN_DB_PREFIX."commande as t";
173 178
 
174
-		if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
179
+		if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) {
180
+			$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
181
+		}
182
+		// We need this table joined to the select in order to filter by sale
175 183
 
176 184
 		$sql .= ' WHERE t.entity IN ('.getEntity('commande').')';
177
-		if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= " AND t.fk_soc = sc.fk_soc";
178
-		if ($socids) $sql .= " AND t.fk_soc IN (".$socids.")";
179
-		if ($search_sale > 0) $sql .= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
185
+		if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) {
186
+			$sql .= " AND t.fk_soc = sc.fk_soc";
187
+		}
188
+		if ($socids) {
189
+			$sql .= " AND t.fk_soc IN (".$socids.")";
190
+		}
191
+		if ($search_sale > 0) {
192
+			$sql .= " AND t.rowid = sc.fk_soc";
193
+		}
194
+		// Join for the needed table to filter by sale
180 195
 		// Insert sale filter
181 196
 		if ($search_sale > 0)
182 197
 		{
@@ -606,14 +621,17 @@  discard block
 block discarded – undo
606 621
 			throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
607 622
 		}
608 623
 		foreach ($request_data as $field => $value) {
609
-			if ($field == 'id') continue;
624
+			if ($field == 'id') {
625
+				continue;
626
+			}
610 627
 			$this->commande->$field = $value;
611 628
 		}
612 629
 
613 630
 		// Update availability
614 631
 		if (!empty($this->commande->availability_id)) {
615
-			if ($this->commande->availability($this->commande->availability_id) < 0)
616
-			throw new RestException(400, 'Error while updating availability');
632
+			if ($this->commande->availability($this->commande->availability_id) < 0) {
633
+						throw new RestException(400, 'Error while updating availability');
634
+			}
617 635
 		}
618 636
 
619 637
 		if ($this->commande->update(DolibarrApiAccess::$user) > 0)
@@ -972,8 +990,9 @@  discard block
 block discarded – undo
972 990
 	{
973 991
 		$commande = array();
974 992
 		foreach (Orders::$FIELDS as $field) {
975
-			if (!isset($data[$field]))
976
-				throw new RestException(400, $field." field missing");
993
+			if (!isset($data[$field])) {
994
+							throw new RestException(400, $field." field missing");
995
+			}
977 996
 			$commande[$field] = $data[$field];
978 997
 		}
979 998
 		return $commande;
Please login to merge, or discard this patch.
htdocs/loan/class/paymentloan.class.php 1 patch
Braces   +99 added lines, -34 removed lines patch added patch discarded remove patch
@@ -133,23 +133,48 @@  discard block
 block discarded – undo
133 133
 		}
134 134
 
135 135
 		// Clean parameters
136
-		if (isset($this->fk_loan)) $this->fk_loan = (int) $this->fk_loan;
137
-		if (isset($this->amount_capital))	$this->amount_capital = price2num($this->amount_capital ? $this->amount_capital : 0);
138
-		if (isset($this->amount_insurance)) $this->amount_insurance = price2num($this->amount_insurance ? $this->amount_insurance : 0);
139
-		if (isset($this->amount_interest))	$this->amount_interest = price2num($this->amount_interest ? $this->amount_interest : 0);
140
-		if (isset($this->fk_typepayment)) $this->fk_typepayment = (int) $this->fk_typepayment;
141
-		if (isset($this->num_payment)) $this->num_payment = (int) $this->num_payment;
142
-		if (isset($this->note_private))     $this->note_private = trim($this->note_private);
143
-		if (isset($this->note_public))      $this->note_public = trim($this->note_public);
144
-		if (isset($this->fk_bank)) $this->fk_bank = (int) $this->fk_bank;
145
-		if (isset($this->fk_user_creat)) $this->fk_user_creat = (int) $this->fk_user_creat;
146
-		if (isset($this->fk_user_modif)) $this->fk_user_modif = (int) $this->fk_user_modif;
136
+		if (isset($this->fk_loan)) {
137
+			$this->fk_loan = (int) $this->fk_loan;
138
+		}
139
+		if (isset($this->amount_capital)) {
140
+			$this->amount_capital = price2num($this->amount_capital ? $this->amount_capital : 0);
141
+		}
142
+		if (isset($this->amount_insurance)) {
143
+			$this->amount_insurance = price2num($this->amount_insurance ? $this->amount_insurance : 0);
144
+		}
145
+		if (isset($this->amount_interest)) {
146
+			$this->amount_interest = price2num($this->amount_interest ? $this->amount_interest : 0);
147
+		}
148
+		if (isset($this->fk_typepayment)) {
149
+			$this->fk_typepayment = (int) $this->fk_typepayment;
150
+		}
151
+		if (isset($this->num_payment)) {
152
+			$this->num_payment = (int) $this->num_payment;
153
+		}
154
+		if (isset($this->note_private)) {
155
+			$this->note_private = trim($this->note_private);
156
+		}
157
+		if (isset($this->note_public)) {
158
+			$this->note_public = trim($this->note_public);
159
+		}
160
+		if (isset($this->fk_bank)) {
161
+			$this->fk_bank = (int) $this->fk_bank;
162
+		}
163
+		if (isset($this->fk_user_creat)) {
164
+			$this->fk_user_creat = (int) $this->fk_user_creat;
165
+		}
166
+		if (isset($this->fk_user_modif)) {
167
+			$this->fk_user_modif = (int) $this->fk_user_modif;
168
+		}
147 169
 
148 170
 		$totalamount = $this->amount_capital + $this->amount_insurance + $this->amount_interest;
149 171
 		$totalamount = price2num($totalamount);
150 172
 
151 173
 		// Check parameters
152
-		if ($totalamount == 0) return -1; // Negative amounts are accepted for reject prelevement but not null
174
+		if ($totalamount == 0) {
175
+			return -1;
176
+		}
177
+		// Negative amounts are accepted for reject prelevement but not null
153 178
 
154 179
 
155 180
 		$this->db->begin();
@@ -276,17 +301,39 @@  discard block
 block discarded – undo
276 301
 		$error = 0;
277 302
 
278 303
 		// Clean parameters
279
-		if (isset($this->fk_loan)) $this->fk_loan = (int) $this->fk_loan;
280
-		if (isset($this->amount_capital)) $this->amount_capital = trim($this->amount_capital);
281
-		if (isset($this->amount_insurance)) $this->amount_insurance = trim($this->amount_insurance);
282
-		if (isset($this->amount_interest)) $this->amount_interest = trim($this->amount_interest);
283
-		if (isset($this->fk_typepayment)) $this->fk_typepayment = (int) $this->fk_typepayment;
284
-		if (isset($this->num_payment)) $this->num_payment = (int) $this->num_payment;
285
-		if (isset($this->note_private)) $this->note = trim($this->note_private);
286
-		if (isset($this->note_public)) $this->note = trim($this->note_public);
287
-		if (isset($this->fk_bank)) $this->fk_bank = (int) $this->fk_bank;
288
-		if (isset($this->fk_user_creat)) $this->fk_user_creat = (int) $this->fk_user_creat;
289
-		if (isset($this->fk_user_modif)) $this->fk_user_modif = (int) $this->fk_user_modif;
304
+		if (isset($this->fk_loan)) {
305
+			$this->fk_loan = (int) $this->fk_loan;
306
+		}
307
+		if (isset($this->amount_capital)) {
308
+			$this->amount_capital = trim($this->amount_capital);
309
+		}
310
+		if (isset($this->amount_insurance)) {
311
+			$this->amount_insurance = trim($this->amount_insurance);
312
+		}
313
+		if (isset($this->amount_interest)) {
314
+			$this->amount_interest = trim($this->amount_interest);
315
+		}
316
+		if (isset($this->fk_typepayment)) {
317
+			$this->fk_typepayment = (int) $this->fk_typepayment;
318
+		}
319
+		if (isset($this->num_payment)) {
320
+			$this->num_payment = (int) $this->num_payment;
321
+		}
322
+		if (isset($this->note_private)) {
323
+			$this->note = trim($this->note_private);
324
+		}
325
+		if (isset($this->note_public)) {
326
+			$this->note = trim($this->note_public);
327
+		}
328
+		if (isset($this->fk_bank)) {
329
+			$this->fk_bank = (int) $this->fk_bank;
330
+		}
331
+		if (isset($this->fk_user_creat)) {
332
+			$this->fk_user_creat = (int) $this->fk_user_creat;
333
+		}
334
+		if (isset($this->fk_user_modif)) {
335
+			$this->fk_user_modif = (int) $this->fk_user_modif;
336
+		}
290 337
 
291 338
 		// Check parameters
292 339
 
@@ -445,7 +492,9 @@  discard block
 block discarded – undo
445 492
 			$acc->fetch($accountid);
446 493
 
447 494
 			$total = $this->amount_capital;
448
-			if ($mode == 'payment_loan') $total = -$total;
495
+			if ($mode == 'payment_loan') {
496
+				$total = -$total;
497
+			}
449 498
 
450 499
 			// Insert payment into llx_bank
451 500
 			$bank_line_id = $acc->addline(
@@ -473,7 +522,9 @@  discard block
 block discarded – undo
473 522
 
474 523
 				// Add link 'payment_loan' in bank_url between payment and bank transaction
475 524
 				$url = '';
476
-				if ($mode == 'payment_loan') $url = DOL_URL_ROOT.'/loan/payment/card.php?id=';
525
+				if ($mode == 'payment_loan') {
526
+					$url = DOL_URL_ROOT.'/loan/payment/card.php?id=';
527
+				}
477 528
 				if ($url)
478 529
 				{
479 530
 					$result = $acc->add_url_line($bank_line_id, $this->id, $url, '(payment)', $mode);
@@ -489,7 +540,9 @@  discard block
 block discarded – undo
489 540
 				if ($mode == 'payment_loan')
490 541
 				{
491 542
 					$result = $acc->add_url_line($bank_line_id, $fk_loan, DOL_URL_ROOT.'/loan/card.php?id=', ($this->label ? $this->label : ''), 'loan');
492
-					if ($result <= 0) dol_print_error($this->db);
543
+					if ($result <= 0) {
544
+						dol_print_error($this->db);
545
+					}
493 546
 				}
494 547
 			} else {
495 548
 				$this->error = $acc->error;
@@ -519,8 +572,7 @@  discard block
 block discarded – undo
519 572
 		{
520 573
 			$this->db->commit();
521 574
 			return 1;
522
-		}
523
-		else {
575
+		} else {
524 576
 			$this->db->rollback();
525 577
 			return -1;
526 578
 		}
@@ -565,27 +617,40 @@  discard block
 block discarded – undo
565 617
 	{
566 618
 		global $langs, $conf;
567 619
 
568
-		if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips
620
+		if (!empty($conf->dol_no_mouse_hover)) {
621
+			$notooltip = 1;
622
+		}
623
+		// Force disable tooltips
569 624
 
570 625
 		$result = '';
571 626
 		$label = '<u>'.$langs->trans("Loan").'</u>';
572 627
 		if (!empty($this->id)) {
573 628
 			$label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->id;
574 629
 		}
575
-		if ($moretitle) $label .= ' - '.$moretitle;
630
+		if ($moretitle) {
631
+			$label .= ' - '.$moretitle;
632
+		}
576 633
 
577 634
 		$url = DOL_URL_ROOT.'/loan/payment/card.php?id='.$this->id;
578 635
 
579 636
 		$add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
580
-		if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1;
581
-		if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1';
637
+		if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
638
+			$add_save_lastsearch_values = 1;
639
+		}
640
+		if ($add_save_lastsearch_values) {
641
+			$url .= '&save_lastsearch_values=1';
642
+		}
582 643
 
583 644
 		$linkstart = '<a href="'.$url.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
584 645
 		$linkend = '</a>';
585 646
 
586 647
 		$result .= $linkstart;
587
-		if ($withpicto) $result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
588
-		if ($withpicto != 2) $result .= $this->ref;
648
+		if ($withpicto) {
649
+			$result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
650
+		}
651
+		if ($withpicto != 2) {
652
+			$result .= $this->ref;
653
+		}
589 654
 		$result .= $linkend;
590 655
 
591 656
 		return $result;
Please login to merge, or discard this patch.
htdocs/core/lib/accounting.lib.php 1 patch
Braces   +34 added lines, -12 removed lines patch added patch discarded remove patch
@@ -94,9 +94,13 @@  discard block
 block discarded – undo
94 94
 {
95 95
 	global $conf;
96 96
 
97
-	if ($account < 0 || is_empty($account)) return '';
97
+	if ($account < 0 || is_empty($account)) {
98
+		return '';
99
+	}
98 100
 
99
-	if (!empty($conf->global->ACCOUNTING_MANAGE_ZERO)) return $account;
101
+	if (!empty($conf->global->ACCOUNTING_MANAGE_ZERO)) {
102
+		return $account;
103
+	}
100 104
 
101 105
 	$g = $conf->global->ACCOUNTING_LENGTH_GACCOUNT;
102 106
 	if (!is_empty($g)) {
@@ -129,9 +133,13 @@  discard block
 block discarded – undo
129 133
 {
130 134
 	global $conf;
131 135
 
132
-	if ($accounta < 0 || is_empty($accounta)) return '';
136
+	if ($accounta < 0 || is_empty($accounta)) {
137
+		return '';
138
+	}
133 139
 
134
-	if (!empty($conf->global->ACCOUNTING_MANAGE_ZERO)) return $accounta;
140
+	if (!empty($conf->global->ACCOUNTING_MANAGE_ZERO)) {
141
+		return $accounta;
142
+	}
135 143
 
136 144
 	$a = $conf->global->ACCOUNTING_LENGTH_AACCOUNT;
137 145
 	if (!is_empty($a)) {
@@ -177,7 +185,9 @@  discard block
 block discarded – undo
177 185
 
178 186
 	print "\n\n<!-- start banner journal -->\n";
179 187
 
180
-	if (!is_empty($varlink)) $varlink = '?'.$varlink;
188
+	if (!is_empty($varlink)) {
189
+		$varlink = '?'.$varlink;
190
+	}
181 191
 
182 192
 	$head = array();
183 193
 	$h = 0;
@@ -209,10 +219,15 @@  discard block
 block discarded – undo
209 219
 	{
210 220
 		print '<tr>';
211 221
 		print '<td width="110">'.$langs->trans("CalculationMode").'</td>';
212
-		if (!$variante) print '<td colspan="3">';
213
-		else print '<td>';
222
+		if (!$variante) {
223
+			print '<td colspan="3">';
224
+		} else {
225
+			print '<td>';
226
+		}
214 227
 		print $calcmode;
215
-		if ($variante) print '</td><td colspan="2">'.$variante;
228
+		if ($variante) {
229
+			print '</td><td colspan="2">'.$variante;
230
+		}
216 231
 		print '</td>';
217 232
 		print '</tr>';
218 233
 	}
@@ -220,10 +235,17 @@  discard block
 block discarded – undo
220 235
 	// Ligne de la periode d'analyse du rapport
221 236
 	print '<tr>';
222 237
 	print '<td>'.$langs->trans("ReportPeriod").'</td>';
223
-	if (!$periodlink) print '<td colspan="3">';
224
-	else print '<td>';
225
-	if ($period) print $period;
226
-	if ($periodlink) print '</td><td colspan="2">'.$periodlink;
238
+	if (!$periodlink) {
239
+		print '<td colspan="3">';
240
+	} else {
241
+		print '<td>';
242
+	}
243
+	if ($period) {
244
+		print $period;
245
+	}
246
+	if ($periodlink) {
247
+		print '</td><td colspan="2">'.$periodlink;
248
+	}
227 249
 	print '</td>';
228 250
 	print '</tr>';
229 251
 
Please login to merge, or discard this patch.
htdocs/core/class/coreobject.class.php 1 patch
Braces   +49 added lines, -19 removed lines patch added patch discarded remove patch
@@ -63,11 +63,17 @@  discard block
 block discarded – undo
63 63
 		{
64 64
 			foreach ($this->fields as $field=>$info)
65 65
 			{
66
-				if ($this->isDate($info)) $this->{$field} = time();
67
-				elseif ($this->isArray($info)) $this->{$field} = array();
68
-				elseif ($this->isInt($info)) $this->{$field} = (int) 0;
69
-				elseif ($this->isFloat($info)) $this->{$field} = (double) 0;
70
-				else $this->{$field} = '';
66
+				if ($this->isDate($info)) {
67
+					$this->{$field} = time();
68
+				} elseif ($this->isArray($info)) {
69
+					$this->{$field} = array();
70
+				} elseif ($this->isInt($info)) {
71
+					$this->{$field} = (int) 0;
72
+				} elseif ($this->isFloat($info)) {
73
+					$this->{$field} = (double) 0;
74
+				} else {
75
+					$this->{$field} = '';
76
+				}
71 77
 			}
72 78
 
73 79
 			$this->to_delete = false;
@@ -107,7 +113,9 @@  discard block
 block discarded – undo
107 113
 	{
108 114
 		$res = $this->fetchCommon($id);
109 115
 		if ($res > 0) {
110
-			if ($loadChild) $this->fetchChild();
116
+			if ($loadChild) {
117
+				$this->fetchChild();
118
+			}
111 119
 		}
112 120
 
113 121
 		return $res;
@@ -129,7 +137,9 @@  discard block
 block discarded – undo
129 137
 		{
130 138
 			foreach ($this->{$tabName} as $k=>&$object)
131 139
 			{
132
-				if ($object->{$key} === $id) return $k;
140
+				if ($object->{$key} === $id) {
141
+					return $k;
142
+				}
133 143
 			}
134 144
 		}
135 145
 
@@ -222,7 +232,9 @@  discard block
 block discarded – undo
222 232
 						$object->{$this->fk_element} = $this->id;
223 233
 
224 234
 						$object->update($user);
225
-						if ($this->unsetChildDeleted && isset($object->to_delete) && $object->to_delete == true) unset($this->{$className}[$i]);
235
+						if ($this->unsetChildDeleted && isset($object->to_delete) && $object->to_delete == true) {
236
+							unset($this->{$className}[$i]);
237
+						}
226 238
 					}
227 239
 				}
228 240
 			}
@@ -238,8 +250,13 @@  discard block
 block discarded – undo
238 250
 	 */
239 251
 	public function update(User &$user)
240 252
 	{
241
-		if (empty($this->id)) return $this->create($user); // To test, with that, no need to test on high level object, the core decide it, update just needed
242
-		elseif (isset($this->to_delete) && $this->to_delete == true) return $this->delete($user);
253
+		if (empty($this->id)) {
254
+			return $this->create($user);
255
+		}
256
+		// To test, with that, no need to test on high level object, the core decide it, update just needed
257
+		elseif (isset($this->to_delete) && $this->to_delete == true) {
258
+			return $this->delete($user);
259
+		}
243 260
 
244 261
 		$error = 0;
245 262
 		$this->db->begin();
@@ -248,8 +265,11 @@  discard block
 block discarded – undo
248 265
 		if ($res)
249 266
 		{
250 267
 			$result = $this->call_trigger(strtoupper($this->element).'_UPDATE', $user);
251
-			if ($result < 0) $error++;
252
-			else $this->saveChild($user);
268
+			if ($result < 0) {
269
+				$error++;
270
+			} else {
271
+				$this->saveChild($user);
272
+			}
253 273
 		} else {
254 274
 			$error++;
255 275
 			$this->error = $this->db->lasterror();
@@ -274,7 +294,9 @@  discard block
 block discarded – undo
274 294
 	 */
275 295
 	public function create(User $user)
276 296
 	{
277
-		if ($this->id > 0) return $this->update($user);
297
+		if ($this->id > 0) {
298
+			return $this->update($user);
299
+		}
278 300
 
279 301
 		$error = 0;
280 302
 		$this->db->begin();
@@ -285,8 +307,11 @@  discard block
 block discarded – undo
285 307
 			$this->id = $this->db->last_insert_id($this->table_element);
286 308
 
287 309
 			$result = $this->call_trigger(strtoupper($this->element).'_CREATE', $user);
288
-			if ($result < 0) $error++;
289
-			else $this->saveChild($user);
310
+			if ($result < 0) {
311
+				$error++;
312
+			} else {
313
+				$this->saveChild($user);
314
+			}
290 315
 		} else {
291 316
 			$error++;
292 317
 			$this->error = $this->db->lasterror();
@@ -311,13 +336,17 @@  discard block
 block discarded – undo
311 336
 	 */
312 337
 	public function delete(User &$user)
313 338
 	{
314
-		if ($this->id <= 0) return 0;
339
+		if ($this->id <= 0) {
340
+			return 0;
341
+		}
315 342
 
316 343
 		$error = 0;
317 344
 		$this->db->begin();
318 345
 
319 346
 		$result = $this->call_trigger(strtoupper($this->element).'_DELETE', $user);
320
-		if ($result < 0) $error++;
347
+		if ($result < 0) {
348
+			$error++;
349
+		}
321 350
 
322 351
 		if (!$error)
323 352
 		{
@@ -360,8 +389,9 @@  discard block
 block discarded – undo
360 389
 	 */
361 390
 	public function getDate($field, $format = '')
362 391
 	{
363
-		if (empty($this->{$field})) return '';
364
-		else {
392
+		if (empty($this->{$field})) {
393
+			return '';
394
+		} else {
365 395
 			return dol_print_date($this->{$field}, $format);
366 396
 		}
367 397
 	}
Please login to merge, or discard this patch.
htdocs/debugbar/class/autoloader.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@
 block discarded – undo
4 4
  * Simple autoloader, so we don't need Composer just for this.
5 5
  */
6 6
 
7
-spl_autoload_register(function ($class) {
7
+spl_autoload_register(function($class) {
8 8
 	if (preg_match('/^DebugBar/', $class)) {
9 9
 		$file = DOL_DOCUMENT_ROOT.'/includes/maximebf/debugbar/src/'.str_replace('\\', DIRECTORY_SEPARATOR, $class).'.php';
10 10
 		//var_dump($class.' - '.file_exists($file).' - '.$file);
Please login to merge, or discard this patch.
htdocs/variants/class/ProductCombination.class.php 1 patch
Braces   +6 added lines, -7 removed lines patch added patch discarded remove patch
@@ -167,8 +167,7 @@  discard block
 block discarded – undo
167 167
 			 */
168 168
 			if ($fk_price_level > 0) {
169 169
 				$combination_price_levels[$fk_price_level] = ProductCombinationLevel::createFromParent($this->db, $this, $fk_price_level);
170
-			}
171
-			else {
170
+			} else {
172 171
 				for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++) {
173 172
 					$combination_price_levels[$i] = ProductCombinationLevel::createFromParent($this->db, $this, $i);
174 173
 				}
@@ -220,8 +219,7 @@  discard block
 block discarded – undo
220 219
 
221 220
 		if ($error) {
222 221
 			return $error * -1;
223
-		}
224
-		else {
222
+		} else {
225 223
 			return 1;
226 224
 		}
227 225
 	}
@@ -320,7 +318,9 @@  discard block
 block discarded – undo
320 318
 		$resql = $this->db->query($sql);
321 319
 		if ($resql) {
322 320
 			$obj = $this->db->fetch_object($resql);
323
-			if ($obj) $nb = $obj->nb;
321
+			if ($obj) {
322
+				$nb = $obj->nb;
323
+			}
324 324
 		}
325 325
 
326 326
 		return $nb;
@@ -700,8 +700,7 @@  discard block
 block discarded – undo
700 700
 		//Final price impact
701 701
 		if (!is_array($forced_pricevar)) {
702 702
 			$price_impact[1] = (float) $forced_pricevar; // If false, return 0
703
-		}
704
-		else {
703
+		} else {
705 704
 			$price_impact = $forced_pricevar;
706 705
 		}
707 706
 
Please login to merge, or discard this patch.
htdocs/accountancy/admin/card.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -44,8 +44,12 @@
 block discarded – undo
44 44
 $accountingaccount = GETPOST('accountingaccount', 'alpha');
45 45
 
46 46
 // Security check
47
-if ($user->socid > 0) accessforbidden();
48
-if (!$user->rights->accounting->chartofaccount) accessforbidden();
47
+if ($user->socid > 0) {
48
+	accessforbidden();
49
+}
50
+if (!$user->rights->accounting->chartofaccount) {
51
+	accessforbidden();
52
+}
49 53
 
50 54
 
51 55
 $object = new AccountingAccount($db);
Please login to merge, or discard this patch.
htdocs/ticket/class/ticket.class.php 1 patch
Braces   +46 added lines, -15 removed lines patch added patch discarded remove patch
@@ -363,7 +363,9 @@  discard block
 block discarded – undo
363 363
 
364 364
 		// Clean parameters
365 365
 		$this->datec = dol_now();
366
-		if (empty($this->track_id)) $this->track_id = generate_random_id(16);
366
+		if (empty($this->track_id)) {
367
+			$this->track_id = generate_random_id(16);
368
+		}
367 369
 
368 370
 		// Check more parameters
369 371
 		// If error, this->errors[] is filled
@@ -944,7 +946,9 @@  discard block
 block discarded – undo
944 946
 		if (!$error) {
945 947
 			// Delete linked object
946 948
 			$res = $this->deleteObjectLinked();
947
-			if ($res < 0) $error++;
949
+			if ($res < 0) {
950
+				$error++;
951
+			}
948 952
 		}
949 953
 
950 954
 		// Removed extrafields
@@ -1265,7 +1269,10 @@  discard block
 block discarded – undo
1265 1269
 		global $dolibarr_main_authentication, $dolibarr_main_demo;
1266 1270
 		global $menumanager;
1267 1271
 
1268
-		if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips
1272
+		if (!empty($conf->dol_no_mouse_hover)) {
1273
+			$notooltip = 1;
1274
+		}
1275
+		// Force disable tooltips
1269 1276
 
1270 1277
 		$result = '';
1271 1278
 
@@ -1281,8 +1288,12 @@  discard block
 block discarded – undo
1281 1288
 		{
1282 1289
 			// Add param to save lastsearch_values or not
1283 1290
 			$add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
1284
-			if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1;
1285
-			if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1';
1291
+			if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
1292
+				$add_save_lastsearch_values = 1;
1293
+			}
1294
+			if ($add_save_lastsearch_values) {
1295
+				$url .= '&save_lastsearch_values=1';
1296
+			}
1286 1297
 		}
1287 1298
 
1288 1299
 		$linkclose = '';
@@ -1295,15 +1306,21 @@  discard block
 block discarded – undo
1295 1306
 			}
1296 1307
 			$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
1297 1308
 			$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
1298
-		} else $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
1309
+		} else {
1310
+			$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
1311
+		}
1299 1312
 
1300 1313
 		$linkstart = '<a href="'.$url.'"';
1301 1314
 		$linkstart .= $linkclose.'>';
1302 1315
 		$linkend = '</a>';
1303 1316
 
1304 1317
 		$result .= $linkstart;
1305
-		if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
1306
-		if ($withpicto != 2) $result .= $this->ref;
1318
+		if ($withpicto) {
1319
+			$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
1320
+		}
1321
+		if ($withpicto != 2) {
1322
+			$result .= $this->ref;
1323
+		}
1307 1324
 		$result .= $linkend;
1308 1325
 		//if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
1309 1326
 
@@ -2613,7 +2630,9 @@  discard block
 block discarded – undo
2613 2630
 								}
2614 2631
 
2615 2632
 								if ($info_sendto['email'] != '') {
2616
-									if (!empty($info_sendto['email'])) $sendto[] = trim($info_sendto['firstname']." ".$info_sendto['lastname'])." <".$info_sendto['email'].">";
2633
+									if (!empty($info_sendto['email'])) {
2634
+										$sendto[] = trim($info_sendto['firstname']." ".$info_sendto['lastname'])." <".$info_sendto['email'].">";
2635
+									}
2617 2636
 
2618 2637
 									//Contact type
2619 2638
 									$recipient = dolGetFirstLastname($info_sendto['firstname'], $info_sendto['lastname'], '-1').' ('.strtolower($info_sendto['libelle']).')';
@@ -2629,7 +2648,9 @@  discard block
 block discarded – undo
2629 2648
 
2630 2649
 							// Add global email address recipient
2631 2650
 							if ($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS && !in_array($conf->global->TICKET_NOTIFICATION_EMAIL_TO, $sendto)) {
2632
-								if (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO)) $sendto[] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO;
2651
+								if (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO)) {
2652
+									$sendto[] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO;
2653
+								}
2633 2654
 							}
2634 2655
 
2635 2656
 							// altairis: dont try to send email if no recipient
@@ -2687,7 +2708,9 @@  discard block
 block discarded – undo
2687 2708
 									}
2688 2709
 
2689 2710
 									if ($info_sendto['email'] != '' && $info_sendto['email'] != $object->origin_email) {
2690
-										if (!empty($info_sendto['email'])) $sendto[] = trim($info_sendto['firstname']." ".$info_sendto['lastname'])." <".$info_sendto['email'].">";
2711
+										if (!empty($info_sendto['email'])) {
2712
+											$sendto[] = trim($info_sendto['firstname']." ".$info_sendto['lastname'])." <".$info_sendto['email'].">";
2713
+										}
2691 2714
 
2692 2715
 										$recipient = dolGetFirstLastname($info_sendto['firstname'], $info_sendto['lastname'], '-1').' ('.strtolower($info_sendto['libelle']).')';
2693 2716
 										$message .= (!empty($recipient) ? $langs->trans('TicketNotificationRecipient').' : '.$recipient.'<br>' : '');
@@ -2712,12 +2735,16 @@  discard block
 block discarded – undo
2712 2735
 								if ($object->fk_soc > 0 && !in_array($object->origin_email, $sendto)) {
2713 2736
 									$object->socid = $object->fk_soc;
2714 2737
 									$object->fetch_thirdparty();
2715
-									if (!empty($object->thirdparty->email)) $sendto[] = $object->thirdparty->email;
2738
+									if (!empty($object->thirdparty->email)) {
2739
+										$sendto[] = $object->thirdparty->email;
2740
+									}
2716 2741
 								}
2717 2742
 
2718 2743
 								// altairis: Add global email address reciepient
2719 2744
 								if ($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS && !in_array($conf->global->TICKET_NOTIFICATION_EMAIL_TO, $sendto)) {
2720
-									if (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO)) $sendto[] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO;
2745
+									if (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO)) {
2746
+										$sendto[] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO;
2747
+									}
2721 2748
 								}
2722 2749
 
2723 2750
 								// altairis: dont try to send email when no recipient
@@ -2853,8 +2880,12 @@  discard block
 block discarded – undo
2853 2880
 			$clause = " AND";
2854 2881
 		}
2855 2882
 		$sql .= $clause." p.entity IN (".getEntity('ticket').")";
2856
-		if ($mode == 'opened') $sql .= " AND p.fk_statut NOT IN (".Ticket::STATUS_CLOSED.", ".Ticket::STATUS_CANCELED.")";
2857
-		if ($user->socid) $sql .= " AND p.fk_soc = ".$user->socid;
2883
+		if ($mode == 'opened') {
2884
+			$sql .= " AND p.fk_statut NOT IN (".Ticket::STATUS_CLOSED.", ".Ticket::STATUS_CANCELED.")";
2885
+		}
2886
+		if ($user->socid) {
2887
+			$sql .= " AND p.fk_soc = ".$user->socid;
2888
+		}
2858 2889
 
2859 2890
 		$resql = $this->db->query($sql);
2860 2891
 		if ($resql)
Please login to merge, or discard this patch.
htdocs/core/boxes/box_graph_product_distribution.php 1 patch
Braces   +47 added lines, -17 removed lines patch added patch discarded remove patch
@@ -102,17 +102,31 @@  discard block
 block discarded – undo
102 102
 			$showordernb = $tmparray['showordernb'];
103 103
 		}
104 104
 		if (empty($showinvoicenb) && empty($showpropalnb) && empty($showordernb)) { $showpropalnb = 1; $showinvoicenb = 1; $showordernb = 1; }
105
-		if (empty($conf->facture->enabled) || empty($user->rights->facture->lire)) $showinvoicenb = 0;
106
-		if (empty($conf->propal->enabled) || empty($user->rights->propale->lire)) $showpropalnb = 0;
107
-		if (empty($conf->commande->enabled) || empty($user->rights->commande->lire)) $showordernb = 0;
105
+		if (empty($conf->facture->enabled) || empty($user->rights->facture->lire)) {
106
+			$showinvoicenb = 0;
107
+		}
108
+		if (empty($conf->propal->enabled) || empty($user->rights->propale->lire)) {
109
+			$showpropalnb = 0;
110
+		}
111
+		if (empty($conf->commande->enabled) || empty($user->rights->commande->lire)) {
112
+			$showordernb = 0;
113
+		}
108 114
 
109 115
 		$nowarray = dol_getdate(dol_now(), true);
110
-		if (empty($year)) $year = $nowarray['year'];
116
+		if (empty($year)) {
117
+			$year = $nowarray['year'];
118
+		}
111 119
 
112 120
 		$nbofgraph = 0;
113
-		if ($showinvoicenb) $nbofgraph++;
114
-		if ($showpropalnb)  $nbofgraph++;
115
-		if ($showordernb)   $nbofgraph++;
121
+		if ($showinvoicenb) {
122
+			$nbofgraph++;
123
+		}
124
+		if ($showpropalnb) {
125
+			$nbofgraph++;
126
+		}
127
+		if ($showordernb) {
128
+			$nbofgraph++;
129
+		}
116 130
 
117 131
 		$text = $langs->trans("BoxProductDistribution", $max).' - '.$langs->trans("Year").': '.$year;
118 132
 		$this->info_box_head = array(
@@ -170,7 +184,9 @@  discard block
 block discarded – undo
170 184
 					$px2->SetData($data2);
171 185
 					unset($data2);
172 186
 
173
-					if ($nocolor) $px2->SetDataColor(array(array(220, 220, 220)));
187
+					if ($nocolor) {
188
+						$px2->SetDataColor(array(array(220, 220, 220)));
189
+					}
174 190
 					$px2->SetLegend($legend);
175 191
 					$px2->setShowLegend(2);
176 192
 					$px2->setShowPointValue($showpointvalue);
@@ -230,7 +246,9 @@  discard block
 block discarded – undo
230 246
 					$px3->SetData($data3);
231 247
 					unset($data3);
232 248
 
233
-					if ($nocolor) $px3->SetDataColor(array(array(220, 220, 220)));
249
+					if ($nocolor) {
250
+						$px3->SetDataColor(array(array(220, 220, 220)));
251
+					}
234 252
 					$px3->SetLegend($legend);
235 253
 					$px3->setShowLegend(2);
236 254
 					$px3->setShowPointValue($showpointvalue);
@@ -291,7 +309,9 @@  discard block
 block discarded – undo
291 309
 					$px1->SetData($data1);
292 310
 					unset($data1);
293 311
 
294
-					if ($nocolor) $px1->SetDataColor(array(array(220, 220, 220)));
312
+					if ($nocolor) {
313
+						$px1->SetDataColor(array(array(220, 220, 220)));
314
+					}
295 315
 					$px1->SetLegend($legend);
296 316
 					$px1->setShowLegend(2);
297 317
 					$px1->setShowPointValue($showpointvalue);
@@ -362,18 +382,28 @@  discard block
 block discarded – undo
362 382
 
363 383
 			if ($nbofgraph == 1)
364 384
 			{
365
-				if ($showpropalnb) $stringtoshow .= $px2->show();
366
-				elseif ($showordernb) $stringtoshow .= $px3->show();
367
-				else $stringtoshow .= $px1->show();
385
+				if ($showpropalnb) {
386
+					$stringtoshow .= $px2->show();
387
+				} elseif ($showordernb) {
388
+					$stringtoshow .= $px3->show();
389
+				} else {
390
+					$stringtoshow .= $px1->show();
391
+				}
368 392
 			}
369 393
 			if ($nbofgraph == 2)
370 394
 			{
371 395
 				$stringtoshow .= '<div class="fichecenter"><div class="containercenter"><div class="fichehalfleft">';
372
-				if ($showpropalnb) $stringtoshow .= $px2->show();
373
-				elseif ($showordernb) $stringtoshow .= $px3->show();
396
+				if ($showpropalnb) {
397
+					$stringtoshow .= $px2->show();
398
+				} elseif ($showordernb) {
399
+					$stringtoshow .= $px3->show();
400
+				}
374 401
 				$stringtoshow .= '</div><div class="fichehalfright">';
375
-				if ($showinvoicenb) $stringtoshow .= $px1->show();
376
-				elseif ($showordernb) $stringtoshow .= $px3->show();
402
+				if ($showinvoicenb) {
403
+					$stringtoshow .= $px1->show();
404
+				} elseif ($showordernb) {
405
+					$stringtoshow .= $px3->show();
406
+				}
377 407
 				$stringtoshow .= '</div></div></div>';
378 408
 			}
379 409
 			if ($nbofgraph == 3)
Please login to merge, or discard this patch.