Completed
Branch develop (6cdb7c)
by
unknown
19:03
created
htdocs/comm/propal/class/api_proposals.class.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -411,7 +411,9 @@
 block discarded – undo
411 411
 		$this->db->begin();
412 412
 
413 413
 		foreach ($request_data as $TData) {
414
-			if (empty($TData[0])) $TData = array($TData);
414
+			if (empty($TData[0])) {
415
+				$TData = array($TData);
416
+			}
415 417
 
416 418
 			foreach ($TData as $lineData) {
417 419
 				$line = (object) $lineData;
Please login to merge, or discard this patch.
htdocs/product/admin/stock_mouvement_extrafields.php 1 patch
Braces   +24 added lines, -8 removed lines patch added patch discarded remove patch
@@ -29,16 +29,28 @@  discard block
 block discarded – undo
29 29
 // Load Dolibarr environment
30 30
 $res = 0;
31 31
 // Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
32
-if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
32
+if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
33
+	$res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
34
+}
33 35
 // Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
34 36
 $tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
35 37
 while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; }
36
-if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
37
-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";
38
+if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
39
+	$res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
40
+}
41
+if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
42
+	$res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
43
+}
38 44
 // Try main.inc.php using relative path
39
-if (!$res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php";
40
-if (!$res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php";
41
-if (!$res) die("Include of main fails");
45
+if (!$res && file_exists("../../main.inc.php")) {
46
+	$res = @include "../../main.inc.php";
47
+}
48
+if (!$res && file_exists("../../../main.inc.php")) {
49
+	$res = @include "../../../main.inc.php";
50
+}
51
+if (!$res) {
52
+	die("Include of main fails");
53
+}
42 54
 
43 55
 require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
44 56
 require_once DOL_DOCUMENT_ROOT.'/core/lib/stock.lib.php';
@@ -52,13 +64,17 @@  discard block
 block discarded – undo
52 64
 // List of supported format
53 65
 $tmptype2label = ExtraFields::$type2label;
54 66
 $type2label = array('');
55
-foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->transnoentitiesnoconv($val);
67
+foreach ($tmptype2label as $key => $val) {
68
+	$type2label[$key] = $langs->transnoentitiesnoconv($val);
69
+}
56 70
 
57 71
 $action = GETPOST('action', 'aZ09');
58 72
 $attrname = GETPOST('attrname', 'alpha');
59 73
 $elementtype = 'stock_mouvement'; //Must be the $table_element of the class that manage extrafield
60 74
 
61
-if (!$user->admin) accessforbidden();
75
+if (!$user->admin) {
76
+	accessforbidden();
77
+}
62 78
 
63 79
 
64 80
 /*
Please login to merge, or discard this patch.
htdocs/takepos/index.php 1 patch
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -444,7 +444,10 @@
 block discarded – undo
444 444
 		if (idproduct=="") return;
445 445
 		// Call page invoice.php to generate the section with product lines
446 446
 		$("#poslines").load("invoice.php?action=addline&token=<?php echo newToken() ?>&place="+place+"&idproduct="+idproduct+"&selectedline="+selectedline+"&qty="+qty, function() {
447
-			<?php if (!empty($conf->global->TAKEPOS_CUSTOMER_DISPLAY)) echo "CustomerDisplay();";?>
447
+			<?php if (!empty($conf->global->TAKEPOS_CUSTOMER_DISPLAY)) {
448
+	echo "CustomerDisplay();";
449
+}
450
+?>
448 451
 		});
449 452
 	}
450 453
 
Please login to merge, or discard this patch.
htdocs/reception/class/reception.class.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -740,7 +740,9 @@
 block discarded – undo
740 740
 				$this->fetch_origin();
741 741
 				if (empty($this->commandeFournisseur->lines)) {
742 742
 					$res = $this->commandeFournisseur->fetch_lines();
743
-					if ($res < 0)	return $res;
743
+					if ($res < 0) {
744
+						return $res;
745
+					}
744 746
 				}
745 747
 			}
746 748
 
Please login to merge, or discard this patch.
htdocs/product/admin/inventory_extrafields.php 1 patch
Braces   +24 added lines, -8 removed lines patch added patch discarded remove patch
@@ -29,16 +29,28 @@  discard block
 block discarded – undo
29 29
 // Load Dolibarr environment
30 30
 $res = 0;
31 31
 // Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
32
-if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
32
+if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
33
+	$res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
34
+}
33 35
 // Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
34 36
 $tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
35 37
 while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; }
36
-if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
37
-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";
38
+if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
39
+	$res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
40
+}
41
+if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
42
+	$res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
43
+}
38 44
 // Try main.inc.php using relative path
39
-if (!$res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php";
40
-if (!$res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php";
41
-if (!$res) die("Include of main fails");
45
+if (!$res && file_exists("../../main.inc.php")) {
46
+	$res = @include "../../main.inc.php";
47
+}
48
+if (!$res && file_exists("../../../main.inc.php")) {
49
+	$res = @include "../../../main.inc.php";
50
+}
51
+if (!$res) {
52
+	die("Include of main fails");
53
+}
42 54
 
43 55
 require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
44 56
 require_once DOL_DOCUMENT_ROOT.'/core/lib/stock.lib.php';
@@ -52,13 +64,17 @@  discard block
 block discarded – undo
52 64
 // List of supported format
53 65
 $tmptype2label = ExtraFields::$type2label;
54 66
 $type2label = array('');
55
-foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->transnoentitiesnoconv($val);
67
+foreach ($tmptype2label as $key => $val) {
68
+	$type2label[$key] = $langs->transnoentitiesnoconv($val);
69
+}
56 70
 
57 71
 $action = GETPOST('action', 'aZ09');
58 72
 $attrname = GETPOST('attrname', 'alpha');
59 73
 $elementtype = 'inventory'; //Must be the $table_element of the class that manage extrafield
60 74
 
61
-if (!$user->admin) accessforbidden();
75
+if (!$user->admin) {
76
+	accessforbidden();
77
+}
62 78
 
63 79
 
64 80
 /*
Please login to merge, or discard this patch.
htdocs/asset/model/note.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -55,12 +55,20 @@
 block discarded – undo
55 55
 $permissionnote = $permissiontoadd; // Used by the include of actions_setnotes.inc.php
56 56
 
57 57
 // Security check (enable the most restrictive one)
58
-if ($user->socid > 0) accessforbidden();
59
-if ($user->socid > 0) $socid = $user->socid;
58
+if ($user->socid > 0) {
59
+	accessforbidden();
60
+}
61
+if ($user->socid > 0) {
62
+	$socid = $user->socid;
63
+}
60 64
 $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
61 65
 restrictedArea($user, 'asset', $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
62
-if (empty($conf->asset->enabled)) accessforbidden();
63
-if (!$permissiontoread) accessforbidden();
66
+if (empty($conf->asset->enabled)) {
67
+	accessforbidden();
68
+}
69
+if (!$permissiontoread) {
70
+	accessforbidden();
71
+}
64 72
 
65 73
 
66 74
 /*
Please login to merge, or discard this patch.
htdocs/asset/class/asset.class.php 1 patch
Braces   +38 added lines, -13 removed lines patch added patch discarded remove patch
@@ -225,14 +225,20 @@  discard block
 block discarded – undo
225 225
 	 */
226 226
 	public function create(User $user, $notrigger = false)
227 227
 	{
228
-		if (!isset($this->date_start) || $this->date_start === "") $this->date_start = $this->date_acquisition;
228
+		if (!isset($this->date_start) || $this->date_start === "") {
229
+			$this->date_start = $this->date_acquisition;
230
+		}
229 231
 
230 232
 		$this->db->begin();
231 233
 
232 234
 		$result = $result_create = $this->createCommon($user, $notrigger);
233
-		if ($result > 0 && $this->fk_asset_model > 0) $result = $this->setDataFromAssetModel($user, $notrigger);
235
+		if ($result > 0 && $this->fk_asset_model > 0) {
236
+			$result = $this->setDataFromAssetModel($user, $notrigger);
237
+		}
234 238
 		if ($result > 0) {
235
-			if ($this->supplier_invoice_id > 0) $this->add_object_linked('invoice_supplier', $this->supplier_invoice_id);
239
+			if ($this->supplier_invoice_id > 0) {
240
+				$this->add_object_linked('invoice_supplier', $this->supplier_invoice_id);
241
+			}
236 242
 		}
237 243
 
238 244
 		if ($result < 0) {
@@ -355,7 +361,9 @@  discard block
 block discarded – undo
355 361
 	{
356 362
 		$result = $this->fetchCommon($id, $ref);
357 363
 		if ($result > 0) {
358
-			if (!empty($this->table_element_line)) $this->fetchLines();
364
+			if (!empty($this->table_element_line)) {
365
+				$this->fetchLines();
366
+			}
359 367
 
360 368
 			$res = $this->hasDepreciationLinesInBookkeeping();
361 369
 			if ($res < 0) {
@@ -474,7 +482,9 @@  discard block
 block discarded – undo
474 482
 	 */
475 483
 	public function update(User $user, $notrigger = false)
476 484
 	{
477
-		if (!isset($this->date_start) || $this->date_start === "") $this->date_start = $this->date_acquisition;
485
+		if (!isset($this->date_start) || $this->date_start === "") {
486
+			$this->date_start = $this->date_acquisition;
487
+		}
478 488
 
479 489
 		$this->db->begin();
480 490
 
@@ -669,7 +679,9 @@  discard block
 block discarded – undo
669 679
 		}
670 680
 
671 681
 		while ($obj = $this->db->fetch_object($resql)) {
672
-			if (!isset($this->depreciation_lines[$obj->depreciation_mode])) $this->depreciation_lines[$obj->depreciation_mode] = array();
682
+			if (!isset($this->depreciation_lines[$obj->depreciation_mode])) {
683
+				$this->depreciation_lines[$obj->depreciation_mode] = array();
684
+			}
673 685
 			$this->depreciation_lines[$obj->depreciation_mode][] = array(
674 686
 				'id' => $obj->rowid,
675 687
 				'ref' => $obj->ref,
@@ -907,7 +919,9 @@  discard block
 block discarded – undo
907 919
 				$sql .= " WHERE " . MAIN_DB_PREFIX . "asset_depreciation.fk_asset = " . (int) $this->id;
908 920
 				$sql .= " AND " . MAIN_DB_PREFIX . "asset_depreciation.depreciation_mode = '" . $this->db->escape($mode_key) . "'";
909 921
 				$sql .= " AND ab.fk_docdet IS NULL";
910
-				if ($last_depreciation_date !== "") $sql .= " AND " . MAIN_DB_PREFIX . "asset_depreciation.ref != ''";
922
+				if ($last_depreciation_date !== "") {
923
+					$sql .= " AND " . MAIN_DB_PREFIX . "asset_depreciation.ref != ''";
924
+				}
911 925
 				$resql = $this->db->query($sql);
912 926
 				if (!$resql) {
913 927
 					$this->errors[] = $langs->trans('AssetErrorClearDepreciationLines') . ': ' . $this->db->lasterror();
@@ -985,7 +999,9 @@  discard block
 block discarded – undo
985 999
 				do {
986 1000
 					// Loop security
987 1001
 					$idx_loop++;
988
-					if ($idx_loop > $max_loop) break;
1002
+					if ($idx_loop > $max_loop) {
1003
+						break;
1004
+					}
989 1005
 
990 1006
 					if ($last_depreciation_date < $fiscal_period_end && ($first_period_date <= $start_date || $first_period_found)) {
991 1007
 						// Disposal not depreciated
@@ -1152,10 +1168,14 @@  discard block
 block discarded – undo
1152 1168
 			$this->fields[$field]['notnull'] = 0;
1153 1169
 		}
1154 1170
 		if ($result > 0) {
1155
-			if ($disposal_invoice_id > 0) $this->add_object_linked('facture', $disposal_invoice_id);
1171
+			if ($disposal_invoice_id > 0) {
1172
+				$this->add_object_linked('facture', $disposal_invoice_id);
1173
+			}
1156 1174
 			$result = $this->setStatusCommon($user, self::STATUS_DISPOSED, $notrigger, 'ASSET_DISPOSED');
1157 1175
 		}
1158
-		if ($result > 0) $result = $this->calculationDepreciation();
1176
+		if ($result > 0) {
1177
+			$result = $this->calculationDepreciation();
1178
+		}
1159 1179
 
1160 1180
 		if ($result < 0) {
1161 1181
 			$this->db->rollback();
@@ -1218,7 +1238,9 @@  discard block
 block discarded – undo
1218 1238
 			$this->deleteObjectLinked(null, 'facture');
1219 1239
 			$result = $this->setStatusCommon($user, self::STATUS_DRAFT, $notrigger, 'ASSET_REOPEN');
1220 1240
 		}
1221
-		if ($result > 0) $result = $this->calculationDepreciation();
1241
+		if ($result > 0) {
1242
+			$result = $this->calculationDepreciation();
1243
+		}
1222 1244
 
1223 1245
 		if ($result < 0) {
1224 1246
 			$this->db->rollback();
@@ -1352,8 +1374,11 @@  discard block
 block discarded – undo
1352 1374
 
1353 1375
 		if ($withpicto != 2) {
1354 1376
 			$name = $this->ref;
1355
-			if ($option == 'label') $name = $this->label;
1356
-			elseif ($option == 'with_label') $name .= ' - ' . $this->label;
1377
+			if ($option == 'label') {
1378
+				$name = $this->label;
1379
+			} elseif ($option == 'with_label') {
1380
+				$name .= ' - ' . $this->label;
1381
+			}
1357 1382
 			$result .= dol_escape_htmltag($maxlen ? dol_trunc($name, $maxlen) : $name);
1358 1383
 		}
1359 1384
 
Please login to merge, or discard this patch.
htdocs/asset/class/assetaccountancycodes.class.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -90,7 +90,9 @@  discard block
 block discarded – undo
90 90
 			$this->accountancy_codes[$mode_key] = array();
91 91
 			foreach ($mode_info['fields'] as $field_key => $field_info) {
92 92
 				$accountancy_code = GETPOST($mode_key . '_' . $field_key, 'aZ09');
93
-				if (empty($accountancy_code) || $accountancy_code == '-1') $accountancy_code = '';
93
+				if (empty($accountancy_code) || $accountancy_code == '-1') {
94
+					$accountancy_code = '';
95
+				}
94 96
 				$this->accountancy_codes[$mode_key][$field_key] = $accountancy_code;
95 97
 			}
96 98
 		}
@@ -251,7 +253,9 @@  discard block
 block discarded – undo
251 253
 			require_once DOL_DOCUMENT_ROOT . '/asset/class/asset.class.php';
252 254
 			$asset = new Asset($this->db);
253 255
 			$result = $asset->fetch($asset_id);
254
-			if ($result > 0) $result = $asset->calculationDepreciation();
256
+			if ($result > 0) {
257
+				$result = $asset->calculationDepreciation();
258
+			}
255 259
 			if ($result < 0) {
256 260
 				$this->errors[] = $langs->trans('AssetErrorCalculationDepreciationLines');
257 261
 				$this->errors[] = $asset->errorsToString();
Please login to merge, or discard this patch.
htdocs/asset/class/assetdepreciationoptions.class.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -352,7 +352,9 @@  discard block
 block discarded – undo
352 352
 				$error++;
353 353
 			} elseif ($result > 0) {
354 354
 				foreach ($this->fields as $field_key => $field_info) {
355
-					if (in_array($field_key, array('rowid', 'fk_asset', 'fk_asset_model', 'tms', 'fk_user_modif'))) continue;
355
+					if (in_array($field_key, array('rowid', 'fk_asset', 'fk_asset_model', 'tms', 'fk_user_modif'))) {
356
+						continue;
357
+					}
356 358
 					$deprecation_options[$mode_key][$field_key] = $this->{$field_key};
357 359
 				}
358 360
 			}
@@ -504,7 +506,9 @@  discard block
 block discarded – undo
504 506
 			require_once DOL_DOCUMENT_ROOT . '/asset/class/asset.class.php';
505 507
 			$asset = new Asset($this->db);
506 508
 			$result = $asset->fetch($this->fk_asset);
507
-			if ($result > 0) $result = $asset->calculationDepreciation();
509
+			if ($result > 0) {
510
+				$result = $asset->calculationDepreciation();
511
+			}
508 512
 			if ($result < 0) {
509 513
 				$this->errors[] = $langs->trans('AssetErrorCalculationDepreciationLines');
510 514
 				$this->errors[] = $asset->errorsToString();
Please login to merge, or discard this patch.