Completed
Branch develop (05c624)
by
unknown
25:12
created
htdocs/modulebuilder/index.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 if (empty($tab)) {
77 77
 	$tab = 'description';
78 78
 }
79
-'@phan-var-force string $tab';  // Workaround 'empty()' bug of phan
79
+'@phan-var-force string $tab'; // Workaround 'empty()' bug of phan
80 80
 if (empty($tabobj)) {
81 81
 	$tabobj = 'newobjectifnoobj';
82 82
 }
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 $family = (string) GETPOST('family', 'alpha');
96 96
 $picto = (string) GETPOST('idpicto', 'alpha');
97 97
 $idmodule = (string) GETPOST('idmodule', 'alpha');
98
-$format = '';  // Prevent undefined in css tab
98
+$format = ''; // Prevent undefined in css tab
99 99
 
100 100
 // Security check
101 101
 if (!isModEnabled('modulebuilder')) {
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 		// Copy last 'html.formsetup.class.php' to backport folder
307 307
 		if (getDolGlobalInt('MODULEBUILDER_SUPPORT_COMPATIBILITY_V16')) {
308 308
 			$tryToCopyFromSetupClass = true;
309
-			$backportDest = $destdir .'/backport/v16/core/class';
309
+			$backportDest = $destdir.'/backport/v16/core/class';
310 310
 			$backportFileSrc = DOL_DOCUMENT_ROOT.'/core/class/html.formsetup.class.php';
311 311
 			$backportFileDest = $backportDest.'/html.formsetup.class.php';
312 312
 			$result = dol_mkdir($backportDest);
@@ -414,11 +414,11 @@  discard block
 block discarded – undo
414 414
 			);
415 415
 
416 416
 			if (getDolGlobalString('MODULEBUILDER_SPECIFIC_AUTHOR')) {
417
-				$arrayreplacement['---Replace with your own copyright and developer email---'] = dol_print_date($now, '%Y')."\t\t" . getDolGlobalString('MODULEBUILDER_SPECIFIC_AUTHOR');
417
+				$arrayreplacement['---Replace with your own copyright and developer email---'] = dol_print_date($now, '%Y')."\t\t".getDolGlobalString('MODULEBUILDER_SPECIFIC_AUTHOR');
418 418
 			}
419 419
 
420 420
 			// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
421
-			$result = dolReplaceInFile($phpfileval['fullname'], $arrayreplacement);  // @phpstan-ignore-line
421
+			$result = dolReplaceInFile($phpfileval['fullname'], $arrayreplacement); // @phpstan-ignore-line
422 422
 			//var_dump($result);
423 423
 			if ($result < 0) {
424 424
 				setEventMessages($langs->trans("ErrorFailToMakeReplacementInto", $phpfileval['fullname']), null, 'errors');
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
 
444 444
 		clearstatcache(true);
445 445
 		if (function_exists('opcache_invalidate')) {
446
-			opcache_reset();	// remove the include cache hell !
446
+			opcache_reset(); // remove the include cache hell !
447 447
 		}
448 448
 
449 449
 		header("Location: ".$_SERVER["PHP_SELF"].'?module='.$modulename);
@@ -451,9 +451,9 @@  discard block
 block discarded – undo
451 451
 	}
452 452
 }
453 453
 
454
-$destdir = '/not_set/';  // Initialize (for static analysis)
455
-$destfile = '/not_set/';  // Initialize (for static analysis)
456
-$srcfile = '/not_set/';  // Initialize (for static analysis)
454
+$destdir = '/not_set/'; // Initialize (for static analysis)
455
+$destfile = '/not_set/'; // Initialize (for static analysis)
456
+$srcfile = '/not_set/'; // Initialize (for static analysis)
457 457
 
458 458
 // init API, PHPUnit
459 459
 if ($dirins && in_array($action, array('initapi', 'initphpunit', 'initpagecontact', 'initpagedocument', 'initpagenote', 'initpageagenda')) && !empty($module) /* && $user->hasRight("modulebuilder", "run") // already checked */) {
@@ -924,7 +924,7 @@  discard block
 block discarded – undo
924 924
 			}
925 925
 			$stringLog = implode("\n", $strreplace);
926 926
 			// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
927
-			dolReplaceInFile($destfile, array('//include::ChangeLog.md[]' => '','__CHANGELOG__' => $stringLog));
927
+			dolReplaceInFile($destfile, array('//include::ChangeLog.md[]' => '', '__CHANGELOG__' => $stringLog));
928 928
 		}
929 929
 
930 930
 		// Delete old documentation files
@@ -1384,7 +1384,7 @@  discard block
 block discarded – undo
1384 1384
 		}
1385 1385
 	}
1386 1386
 
1387
-	$filetogenerate = array();  // For static analysis
1387
+	$filetogenerate = array(); // For static analysis
1388 1388
 	if (!$error) {
1389 1389
 		// Copy some files
1390 1390
 		$filetogenerate = array(
@@ -1624,7 +1624,7 @@  discard block
 block discarded – undo
1624 1624
 		} else {
1625 1625
 			$menus = array();
1626 1626
 		}
1627
-		$counter = 0 ;
1627
+		$counter = 0;
1628 1628
 		foreach ($menus as $menu) {
1629 1629
 			if ($menu['leftmenu'] == strtolower($objectname)) {
1630 1630
 				$counter++;
@@ -1666,10 +1666,10 @@  discard block
 block discarded – undo
1666 1666
 			);
1667 1667
 
1668 1668
 			if (getDolGlobalString('MODULEBUILDER_SPECIFIC_AUTHOR')) {
1669
-				$arrayreplacement['---Replace with your own copyright and developer email---'] = dol_print_date($now, '%Y').' ' . getDolGlobalString('MODULEBUILDER_SPECIFIC_AUTHOR');
1669
+				$arrayreplacement['---Replace with your own copyright and developer email---'] = dol_print_date($now, '%Y').' '.getDolGlobalString('MODULEBUILDER_SPECIFIC_AUTHOR');
1670 1670
 			}
1671 1671
 
1672
-			$result = dolReplaceInFile($phpfileval['fullname'], $arrayreplacement);  // @phpstan-ignore-line
1672
+			$result = dolReplaceInFile($phpfileval['fullname'], $arrayreplacement); // @phpstan-ignore-line
1673 1673
 			//var_dump($result);
1674 1674
 			if ($result < 0) {
1675 1675
 				setEventMessages($langs->trans("ErrorFailToMakeReplacementInto", $phpfileval['fullname']), null, 'errors');
@@ -1768,7 +1768,7 @@  discard block
 block discarded – undo
1768 1768
 		} else {
1769 1769
 			createNewDictionnary($module, $moduledescriptorfile, $newdicname, $dictionaries);
1770 1770
 			if (function_exists('opcache_invalidate')) {
1771
-				opcache_reset();	// remove the include cache hell !
1771
+				opcache_reset(); // remove the include cache hell !
1772 1772
 			}
1773 1773
 			clearstatcache(true);
1774 1774
 			header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=dictionaries&module='.$module.($forceddirread ? '@'.$dirread : ''));
@@ -1856,7 +1856,7 @@  discard block
 block discarded – undo
1856 1856
 				'name' => GETPOST('propname', 'aZ09'),
1857 1857
 				'label' => GETPOST('proplabel', 'alpha'),
1858 1858
 				'type' => strtolower(GETPOST('proptype', 'alpha')),
1859
-				'arrayofkeyval' => GETPOST('proparrayofkeyval', 'nohtml'), 	// Example json string '{"0":"Draft","1":"Active","-1":"Cancel"}'
1859
+				'arrayofkeyval' => GETPOST('proparrayofkeyval', 'nohtml'), // Example json string '{"0":"Draft","1":"Active","-1":"Cancel"}'
1860 1860
 				'visible' => GETPOST('propvisible', 'alphanohtml'),
1861 1861
 				'enabled' => GETPOST('propenabled', 'alphanohtml'),
1862 1862
 				'position' => GETPOSTINT('propposition'),
@@ -1867,7 +1867,7 @@  discard block
 block discarded – undo
1867 1867
 				'isameasure' => GETPOSTINT('propisameasure'),
1868 1868
 				'comment' => GETPOST('propcomment', 'alpha'),
1869 1869
 				'help' => GETPOST('prophelp', 'alpha'),
1870
-				'css' => GETPOST('propcss', 'alpha'),        // Can be 'maxwidth500 widthcentpercentminusxx' for example
1870
+				'css' => GETPOST('propcss', 'alpha'), // Can be 'maxwidth500 widthcentpercentminusxx' for example
1871 1871
 				'cssview' => GETPOST('propcssview', 'alpha'),
1872 1872
 				'csslist' => GETPOST('propcsslist', 'alpha'),
1873 1873
 				'default' => GETPOST('propdefault', 'restricthtml'),
@@ -2024,7 +2024,7 @@  discard block
 block discarded – undo
2024 2024
 
2025 2025
 			clearstatcache(true);
2026 2026
 			if (function_exists('opcache_invalidate')) {
2027
-				opcache_reset();	// remove the include cache hell !
2027
+				opcache_reset(); // remove the include cache hell !
2028 2028
 			}
2029 2029
 
2030 2030
 			header("Location: ".$_SERVER["PHP_SELF"].'?module=deletemodule');
@@ -2081,7 +2081,7 @@  discard block
 block discarded – undo
2081 2081
 		$pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath'];
2082 2082
 		dol_include_once($pathtofile);
2083 2083
 		$class = 'mod'.$module;
2084
-		$moduleobj =  null;
2084
+		$moduleobj = null;
2085 2085
 		if (class_exists($class)) {
2086 2086
 			try {
2087 2087
 				$moduleobj = new $class($db);
@@ -2124,7 +2124,7 @@  discard block
 block discarded – undo
2124 2124
 
2125 2125
 			clearstatcache(true);
2126 2126
 			if (function_exists('opcache_invalidate')) {
2127
-				opcache_reset();	// remove the include cache hell !
2127
+				opcache_reset(); // remove the include cache hell !
2128 2128
 			}
2129 2129
 			$resultko = 0;
2130 2130
 			foreach ($filetodelete as $tmpfiletodelete) {
@@ -2144,7 +2144,7 @@  discard block
 block discarded – undo
2144 2144
 	}
2145 2145
 
2146 2146
 	$action = '';
2147
-	if (! $error) {
2147
+	if (!$error) {
2148 2148
 		$tabobj = 'newobject';
2149 2149
 	} else {
2150 2150
 		$tabobj = 'deleteobject';
@@ -2255,7 +2255,7 @@  discard block
 block discarded – undo
2255 2255
 			setEventMessages($langs->trans("DictionaryDeleted", ucfirst(substr($newdicname, 2))), null);
2256 2256
 		}
2257 2257
 		if (function_exists('opcache_invalidate')) {
2258
-			opcache_reset();	// remove the include cache hell !
2258
+			opcache_reset(); // remove the include cache hell !
2259 2259
 		}
2260 2260
 		clearstatcache(true);
2261 2261
 		header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=dictionaries&module='.$module.($forceddirread ? '@'.$dirread : ''));
@@ -2263,7 +2263,7 @@  discard block
 block discarded – undo
2263 2263
 	}
2264 2264
 }
2265 2265
 if ($dirins && $action == 'updatedictionary' && GETPOST('dictionnarykey') /* && $user->hasRight("modulebuilder", "run") // already checked */) {
2266
-	$keydict = GETPOSTINT('dictionnarykey') - 1 ;
2266
+	$keydict = GETPOSTINT('dictionnarykey') - 1;
2267 2267
 
2268 2268
 	$pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath'];
2269 2269
 	$destdir = $dirins.'/'.strtolower($module);
@@ -2299,7 +2299,7 @@  discard block
 block discarded – undo
2299 2299
 				setEventMessages($langs->trans("DictionaryNameUpdated", ucfirst(GETPOST('tablib'))), null);
2300 2300
 			}
2301 2301
 			if (function_exists('opcache_invalidate')) {
2302
-				opcache_reset();	// remove the include cache hell !
2302
+				opcache_reset(); // remove the include cache hell !
2303 2303
 			}
2304 2304
 			clearstatcache(true);
2305 2305
 			header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=dictionaries&module='.$module.($forceddirread ? '@'.$dirread : ''));
@@ -2481,7 +2481,7 @@  discard block
 block discarded – undo
2481 2481
 
2482 2482
 			clearstatcache(true);
2483 2483
 			if (function_exists('opcache_invalidate')) {
2484
-				opcache_reset();	// remove the include cache hell !
2484
+				opcache_reset(); // remove the include cache hell !
2485 2485
 			}
2486 2486
 			header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=permissions&module='.$module);
2487 2487
 			exit;
@@ -2597,12 +2597,12 @@  discard block
 block discarded – undo
2597 2597
 		if ($rewrite < 0) {
2598 2598
 			setEventMessages($langs->trans("WarningCommentNotFound", $langs->trans("Permissions"), "mod".$module."class.php"), null, 'warnings');
2599 2599
 		} else {
2600
-			$rightUpdated = null;  // I not set at this point
2600
+			$rightUpdated = null; // I not set at this point
2601 2601
 			reWriteAllPermissions($moduledescriptorfile, $permissions, $key, $rightUpdated, '', '', 2);
2602 2602
 			setEventMessages($langs->trans('PermissionUpdatedSuccesfuly'), null);
2603 2603
 			clearstatcache(true);
2604 2604
 			if (function_exists('opcache_invalidate')) {
2605
-				opcache_reset();	// remove the include cache hell !
2605
+				opcache_reset(); // remove the include cache hell !
2606 2606
 			}
2607 2607
 			header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=permissions&module='.$module);
2608 2608
 			exit;
@@ -2655,7 +2655,7 @@  discard block
 block discarded – undo
2655 2655
 
2656 2656
 			clearstatcache(true);
2657 2657
 			if (function_exists('opcache_invalidate')) {
2658
-				opcache_reset();	// remove the include cache hell !
2658
+				opcache_reset(); // remove the include cache hell !
2659 2659
 			}
2660 2660
 
2661 2661
 			header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=permissions&module='.$module);
@@ -2821,7 +2821,7 @@  discard block
 block discarded – undo
2821 2821
 
2822 2822
 		clearstatcache(true);
2823 2823
 		if (function_exists('opcache_invalidate')) {
2824
-			opcache_reset();	// remove the include cache hell !
2824
+			opcache_reset(); // remove the include cache hell !
2825 2825
 		}
2826 2826
 
2827 2827
 		setEventMessages($langs->trans('MenuDeletedSuccessfuly'), null);
@@ -2881,7 +2881,7 @@  discard block
 block discarded – undo
2881 2881
 		setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Url")), null, 'errors');
2882 2882
 	}
2883 2883
 	if (!empty(GETPOST('target'))) {
2884
-		$targets = array('_blank','_self','_parent','_top','');
2884
+		$targets = array('_blank', '_self', '_parent', '_top', '');
2885 2885
 		if (!in_array(GETPOST('target'), $targets)) {
2886 2886
 			$error++;
2887 2887
 			setEventMessages($langs->trans("ErrorFieldValue", $langs->transnoentities("target")), null, 'errors');
@@ -2987,7 +2987,7 @@  discard block
 block discarded – undo
2987 2987
 
2988 2988
 // Modify a menu entry
2989 2989
 if ($dirins && $action == "update_menu" && GETPOSTINT('menukey') && GETPOST('tabobj') /* && $user->hasRight("modulebuilder", "run") // already checked */) {
2990
-	$objectname =  GETPOST('tabobj');
2990
+	$objectname = GETPOST('tabobj');
2991 2991
 	$dirins = $listofmodules[strtolower($module)]['moduledescriptorrootpath'];
2992 2992
 	$destdir = $dirins.'/'.strtolower($module);
2993 2993
 	$objects = dolGetListOfObjectClasses($destdir);
@@ -3086,7 +3086,7 @@  discard block
 block discarded – undo
3086 3086
 			}
3087 3087
 		}
3088 3088
 	} else {
3089
-		$_POST['type'] = '';	// TODO Use a var here and later
3089
+		$_POST['type'] = ''; // TODO Use a var here and later
3090 3090
 		$_POST['titre'] = '';
3091 3091
 		$_POST['fk_menu'] = '';
3092 3092
 		$_POST['leftmenu'] = '';
@@ -3144,10 +3144,10 @@  discard block
 block discarded – undo
3144 3144
 
3145 3145
 	if (isset($propertyToUpdate) && !empty(GETPOST('propsmodule'))) {
3146 3146
 		$newValue = GETPOST('propsmodule');
3147
-		$patternToFindLine = '^\s*\$this->'.$propertyToUpdate.'\s*=';			// Must be a regex string
3148
-		$newLine = "\t\t\$this->$propertyToUpdate = '$newValue';\n";			// Must a real string
3147
+		$patternToFindLine = '^\s*\$this->'.$propertyToUpdate.'\s*='; // Must be a regex string
3148
+		$newLine = "\t\t\$this->$propertyToUpdate = '$newValue';\n"; // Must a real string
3149 3149
 
3150
-		$fileLines = file($moduledescriptorfile);	// Get each line of file into an array
3150
+		$fileLines = file($moduledescriptorfile); // Get each line of file into an array
3151 3151
 		$error = 0;
3152 3152
 		$changedone = 0;
3153 3153
 		foreach ($fileLines as &$line) {
@@ -3504,7 +3504,7 @@  discard block
 block discarded – undo
3504 3504
 	print '<input type="text" name="editorurl" value="'.(GETPOSTISSET('editorurl') ? GETPOST('editorurl') : getDolGlobalString('MODULEBUILDER_SPECIFIC_EDITOR_URL', $mysoc->url)).'" placeholder="'.dol_escape_htmltag($langs->trans("EditorUrl")).'"><br>';
3505 3505
 	print '</div></div>';
3506 3506
 
3507
-	print '</div>';	// End div tagtable
3507
+	print '</div>'; // End div tagtable
3508 3508
 
3509 3509
 	print '<br><center>';
3510 3510
 	print '<input type="submit" class="button" name="create" value="'.dol_escape_htmltag($langs->trans("Create")).'"'.($dirins ? '' : ' disabled="disabled"').'>';
@@ -4222,8 +4222,8 @@  discard block
 block discarded – undo
4222 4222
 				}
4223 4223
 				print '</table><br>'."\n";
4224 4224
 				print '<div class="center">';
4225
-				print '<input type="submit" class="button button-save" name="add" value="' . dol_escape_htmltag($langs->trans('Create')) . '">';
4226
-				print '<input type="button" class="button button-cancel" name="cancel" value="' . dol_escape_htmltag($langs->trans('Cancel')) . '" onclick="goBack()">';
4225
+				print '<input type="submit" class="button button-save" name="add" value="'.dol_escape_htmltag($langs->trans('Create')).'">';
4226
+				print '<input type="button" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans('Cancel')).'" onclick="goBack()">';
4227 4227
 				print '</div>';
4228 4228
 				print '</form>';
4229 4229
 				// javascript
@@ -4329,16 +4329,16 @@  discard block
 block discarded – undo
4329 4329
 						// Define path for sql file
4330 4330
 						$pathtosql = strtolower($module).'/sql/llx_'.strtolower($module).'_'.strtolower($tabobj).'-'.strtolower($module).'.sql';
4331 4331
 						$result = dol_buildpath($pathtosql);
4332
-						if (! dol_is_file($result)) {
4332
+						if (!dol_is_file($result)) {
4333 4333
 							$pathtosql = strtolower($module).'/sql/llx_'.strtolower($module).'_'.strtolower($tabobj).'.sql';
4334 4334
 							$result = dol_buildpath($pathtosql);
4335
-							if (! dol_is_file($result)) {
4335
+							if (!dol_is_file($result)) {
4336 4336
 								$pathtosql = 'install/mysql/tables/llx_'.strtolower($module).'_'.strtolower($tabobj).'-'.strtolower($module).'.sql';
4337 4337
 								$result = dol_buildpath($pathtosql);
4338
-								if (! dol_is_file($result)) {
4338
+								if (!dol_is_file($result)) {
4339 4339
 									$pathtosql = 'install/mysql/tables/llx_'.strtolower($module).'-'.strtolower($module).'.sql';
4340 4340
 									$result = dol_buildpath($pathtosql);
4341
-									if (! dol_is_file($result)) {
4341
+									if (!dol_is_file($result)) {
4342 4342
 										$pathtosql = 'install/mysql/tables/llx_'.strtolower($module).'.sql';
4343 4343
 										$pathtosqlextra = 'install/mysql/tables/llx_'.strtolower($module).'_extrafields.sql';
4344 4344
 										$result = dol_buildpath($pathtosql);
@@ -4357,12 +4357,12 @@  discard block
 block discarded – undo
4357 4357
 						$pathtosqlroot = preg_replace('/\/llx_.*$/', '', $pathtosql);
4358 4358
 
4359 4359
 						$pathtosqlkey   = preg_replace('/\.sql$/', '.key.sql', $pathtosql);
4360
-						$pathtosqlextrakey   = preg_replace('/\.sql$/', '.key.sql', $pathtosqlextra);
4360
+						$pathtosqlextrakey = preg_replace('/\.sql$/', '.key.sql', $pathtosqlextra);
4361 4361
 
4362 4362
 						$pathtolib      = strtolower($module).'/lib/'.strtolower($module).'.lib.php';
4363 4363
 						$pathtoobjlib   = strtolower($module).'/lib/'.strtolower($module).'_'.strtolower($tabobj).'.lib.php';
4364 4364
 
4365
-						$tmpobject = $tmpobject ?? null;  // @phan-suppress-current-line PhanPluginDuplicateExpressionAssignmentOperation
4365
+						$tmpobject = $tmpobject ?? null; // @phan-suppress-current-line PhanPluginDuplicateExpressionAssignmentOperation
4366 4366
 						if (is_object($tmpobject) && property_exists($tmpobject, 'picto')) {
4367 4367
 							$pathtopicto = $tmpobject->picto;
4368 4368
 							$realpathtopicto = '';
@@ -5728,7 +5728,7 @@  discard block
 block discarded – undo
5728 5728
 						}
5729 5729
 					  });
5730 5730
 
5731
-					var groupedRights = ' . $groupedRights_json . ';
5731
+					var groupedRights = ' . $groupedRights_json.';
5732 5732
 					var objectsSelect = $("select[id=\'objects\']");
5733 5733
 					var permsSelect = $("select[id=\'perms\']");
5734 5734
 
@@ -5952,7 +5952,7 @@  discard block
 block discarded – undo
5952 5952
 							if (in_array($perm[5], array('lire', 'read', 'creer', 'write', 'effacer', 'delete'))) {
5953 5953
 								print dol_escape_htmltag(ucfirst($perm[4]));
5954 5954
 							} else {
5955
-								print '';	// No particular object
5955
+								print ''; // No particular object
5956 5956
 							}
5957 5957
 							print '</td>';
5958 5958
 
@@ -6856,9 +6856,9 @@  discard block
 block discarded – undo
6856 6856
 
6857 6857
 						print '<td>';
6858 6858
 						if ($tabName[0] === "+") {
6859
-							print '<span class="badge badge-status4 badge-status">' . dol_escape_htmltag($tabName) . '</span>';
6859
+							print '<span class="badge badge-status4 badge-status">'.dol_escape_htmltag($tabName).'</span>';
6860 6860
 						} else {
6861
-							print '<span class="badge badge-status8 badge-status">' . dol_escape_htmltag($tabName) . '</span>';
6861
+							print '<span class="badge badge-status8 badge-status">'.dol_escape_htmltag($tabName).'</span>';
6862 6862
 						}
6863 6863
 						print '</td>';
6864 6864
 
Please login to merge, or discard this patch.
htdocs/ticket/card.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -180,31 +180,31 @@  discard block
 block discarded – undo
180 180
 		$search_agenda_label = '';
181 181
 	}
182 182
 
183
-	$backurlforlist = DOL_URL_ROOT . '/ticket/list.php';
183
+	$backurlforlist = DOL_URL_ROOT.'/ticket/list.php';
184 184
 
185 185
 	if (empty($backtopage) || ($cancel && empty($id))) {
186 186
 		if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
187 187
 			if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
188 188
 				$backtopage = $backurlforlist;
189 189
 			} else {
190
-				$backtopage = DOL_URL_ROOT . '/ticket/card.php?id=' . ((!empty($id) && $id > 0) ? $id : '__ID__');
190
+				$backtopage = DOL_URL_ROOT.'/ticket/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__');
191 191
 			}
192 192
 		}
193 193
 	}
194 194
 
195 195
 	if ($cancel) {
196 196
 		if (!empty($backtopageforcancel)) {
197
-			header("Location: " . $backtopageforcancel);
197
+			header("Location: ".$backtopageforcancel);
198 198
 			exit;
199 199
 		} elseif (!empty($backtopage)) {
200
-			header("Location: " . $backtopage);
200
+			header("Location: ".$backtopage);
201 201
 			exit;
202 202
 		}
203 203
 		$action = 'view';
204 204
 	}
205 205
 
206 206
 	if ((($action == 'add' && GETPOST('save', 'alpha')) || ($action == 'update' && $object->status < Ticket::STATUS_CLOSED)) && $permissiontoadd) {
207
-		$ifErrorAction = ($action == 'add' ? 'create' : 'edit');	// Test on permission not required here
207
+		$ifErrorAction = ($action == 'add' ? 'create' : 'edit'); // Test on permission not required here
208 208
 		if ($action == 'add') {		// Test on permission already done
209 209
 			$object->track_id = null;
210 210
 		}
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 
338 338
 				if (!$error) {
339 339
 					// File transfer
340
-					$object->copyFilesForTicket('');        // trackid is forced to '' because files were uploaded when no id for ticket exists yet and trackid was ''
340
+					$object->copyFilesForTicket(''); // trackid is forced to '' because files were uploaded when no id for ticket exists yet and trackid was ''
341 341
 				}
342 342
 			}
343 343
 			if (!$error) {
@@ -347,13 +347,13 @@  discard block
 block discarded – undo
347 347
 					if (empty($id)) {
348 348
 						$url = $backtopage;
349 349
 					} else {
350
-						$url = 'card.php?track_id=' . urlencode($object->track_id);
350
+						$url = 'card.php?track_id='.urlencode($object->track_id);
351 351
 					}
352 352
 				} else {
353
-					$url = 'card.php?track_id=' . urlencode($object->track_id);
353
+					$url = 'card.php?track_id='.urlencode($object->track_id);
354 354
 				}
355 355
 
356
-				header("Location: " . $url);
356
+				header("Location: ".$url);
357 357
 				exit;
358 358
 			} else {
359 359
 				$db->rollback();
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 		if ($object->markAsRead($user) > 0) {
372 372
 			setEventMessages($langs->trans('TicketMarkedAsRead'), null, 'mesgs');
373 373
 
374
-			header("Location: card.php?track_id=" . $object->track_id);
374
+			header("Location: card.php?track_id=".$object->track_id);
375 375
 			exit;
376 376
 		} else {
377 377
 			setEventMessages($object->error, $object->errors, 'errors');
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
 			$object->fetch_user($usertoassign);
428 428
 
429 429
 			setEventMessages($langs->trans('TicketAssigned'), null, 'mesgs');
430
-			header("Location: card.php?track_id=" . $object->track_id);
430
+			header("Location: card.php?track_id=".$object->track_id);
431 431
 			exit;
432 432
 		} else {
433 433
 			array_push($object->errors, $object->error);
@@ -444,10 +444,10 @@  discard block
 block discarded – undo
444 444
 			if (!empty($backtopage)) {
445 445
 				$url = $backtopage;
446 446
 			} else {
447
-				$url = 'card.php?track_id=' . urlencode($object->track_id);
447
+				$url = 'card.php?track_id='.urlencode($object->track_id);
448 448
 			}
449 449
 
450
-			header("Location: " . $url);
450
+			header("Location: ".$url);
451 451
 			exit;
452 452
 		} else {
453 453
 			setEventMessages($object->error, $object->errors, 'errors');
@@ -464,8 +464,8 @@  discard block
 block discarded – undo
464 464
 		if ($object->close($user, ($action == "confirm_abandon" ? 1 : 0))) {	// Test on pemrission already done
465 465
 			setEventMessages($langs->trans('TicketMarkedAsClosed'), null, 'mesgs');
466 466
 
467
-			$url = 'card.php?track_id=' . GETPOST('track_id', 'alpha');
468
-			header("Location: " . $url);
467
+			$url = 'card.php?track_id='.GETPOST('track_id', 'alpha');
468
+			header("Location: ".$url);
469 469
 			exit;
470 470
 		} else {
471 471
 			$action = '';
@@ -480,10 +480,10 @@  discard block
 block discarded – undo
480 480
 
481 481
 			$object->close($user);
482 482
 
483
-			setEventMessages('<div class="confirm">' . $langs->trans('TicketMarkedAsClosed') . '</div>', null, 'mesgs');
483
+			setEventMessages('<div class="confirm">'.$langs->trans('TicketMarkedAsClosed').'</div>', null, 'mesgs');
484 484
 
485
-			$url = 'card.php?track_id=' . GETPOST('track_id', 'alpha');
486
-			header("Location: " . $url);
485
+			$url = 'card.php?track_id='.GETPOST('track_id', 'alpha');
486
+			header("Location: ".$url);
487 487
 			exit;
488 488
 		} else {
489 489
 			setEventMessages($object->error, $object->errors, 'errors');
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
 		if ($object->fetch(GETPOSTINT('id'), '', GETPOST('track_id', 'alpha')) >= 0) {
496 496
 			$newid = $object->createFromClone($user, $object->id);
497 497
 			if ($newid > 0) {
498
-				header("Location: " . DOL_URL_ROOT . "/ticket/card.php?id=".$newid);
498
+				header("Location: ".DOL_URL_ROOT."/ticket/card.php?id=".$newid);
499 499
 				exit;
500 500
 			} else {
501 501
 				setEventMessages($object->error, $object->errors, 'errors');
@@ -507,12 +507,12 @@  discard block
 block discarded – undo
507 507
 	if ($action == 'confirm_delete_ticket' && GETPOST('confirm', 'alpha') == "yes" && $permissiontodelete) {
508 508
 		if ($object->fetch(GETPOSTINT('id'), '', GETPOST('track_id', 'alpha')) >= 0) {
509 509
 			if ($object->delete($user) > 0) {
510
-				setEventMessages('<div class="confirm">' . $langs->trans('TicketDeletedSuccess') . '</div>', null, 'mesgs');
511
-				header("Location: " . DOL_URL_ROOT . "/ticket/list.php");
510
+				setEventMessages('<div class="confirm">'.$langs->trans('TicketDeletedSuccess').'</div>', null, 'mesgs');
511
+				header("Location: ".DOL_URL_ROOT."/ticket/list.php");
512 512
 				exit;
513 513
 			} else {
514 514
 				$langs->load("errors");
515
-				$mesg = '<div class="error">' . $langs->trans($object->error) . '</div>';
515
+				$mesg = '<div class="error">'.$langs->trans($object->error).'</div>';
516 516
 				$action = '';
517 517
 			}
518 518
 		}
@@ -522,8 +522,8 @@  discard block
 block discarded – undo
522 522
 	if ($action == 'set_thirdparty' && $user->hasRight('ticket', 'write')) {
523 523
 		if ($object->fetch(GETPOSTINT('id'), '', GETPOST('track_id', 'alpha')) >= 0) {
524 524
 			$result = $object->setCustomer(GETPOSTINT('editcustomer'));
525
-			$url = $_SERVER["PHP_SELF"] . '?track_id=' . GETPOST('track_id', 'alpha');
526
-			header("Location: " . $url);
525
+			$url = $_SERVER["PHP_SELF"].'?track_id='.GETPOST('track_id', 'alpha');
526
+			header("Location: ".$url);
527 527
 			exit();
528 528
 		}
529 529
 	}
@@ -533,8 +533,8 @@  discard block
 block discarded – undo
533 533
 		if ($object->fetch(GETPOSTINT('id'), '', GETPOST('track_id', 'alpha')) >= 0) {
534 534
 			$result = $object->setProgression(GETPOSTINT('progress'));
535 535
 
536
-			$url = 'card.php?track_id=' . $object->track_id;
537
-			header("Location: " . $url);
536
+			$url = 'card.php?track_id='.$object->track_id;
537
+			header("Location: ".$url);
538 538
 			exit();
539 539
 		}
540 540
 	}
@@ -544,8 +544,8 @@  discard block
 block discarded – undo
544 544
 		if ($object->fetch(GETPOSTINT('id'), '', GETPOST('track_id', 'alpha')) >= 0) {
545 545
 			$result = $object->setCategories(GETPOST('categories', 'array'));
546 546
 
547
-			$url = 'card.php?track_id=' . $object->track_id;
548
-			header("Location: " . $url);
547
+			$url = 'card.php?track_id='.$object->track_id;
548
+			header("Location: ".$url);
549 549
 			exit();
550 550
 		}
551 551
 	}
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
 				}
570 570
 			}
571 571
 
572
-			header("Location: " . $_SERVER['PHP_SELF'] . "?track_id=" . $object->track_id);
572
+			header("Location: ".$_SERVER['PHP_SELF']."?track_id=".$object->track_id);
573 573
 			exit;
574 574
 		}
575 575
 	}
@@ -584,8 +584,8 @@  discard block
 block discarded – undo
584 584
 					$res = $object->setStatut(Ticket::STATUS_NOT_READ, null, '', $triggermodname);
585 585
 				}
586 586
 				if ($res) {
587
-					$url = 'card.php?track_id=' . $object->track_id;
588
-					header("Location: " . $url);
587
+					$url = 'card.php?track_id='.$object->track_id;
588
+					header("Location: ".$url);
589 589
 					exit();
590 590
 				} else {
591 591
 					$error++;
@@ -597,16 +597,16 @@  discard block
 block discarded – undo
597 597
 		// Categorisation dans projet
598 598
 		if ($object->fetch(GETPOSTINT('id'), '', GETPOST('track_id', 'alpha')) >= 0) {
599 599
 			$object->setProject($projectid);
600
-			$url = 'card.php?track_id=' . $object->track_id;
601
-			header("Location: " . $url);
600
+			$url = 'card.php?track_id='.$object->track_id;
601
+			header("Location: ".$url);
602 602
 			exit();
603 603
 		}
604 604
 	} elseif ($action == 'setcontract' && $permissiontoadd) {
605 605
 		// Categorisation dans contrat
606 606
 		if ($object->fetch(GETPOSTINT('id'), '', GETPOST('track_id', 'alpha')) >= 0) {
607 607
 			$object->setContract(GETPOSTINT('contractid'));
608
-			$url = 'card.php?track_id=' . $object->track_id;
609
-			header("Location: " . $url);
608
+			$url = 'card.php?track_id='.$object->track_id;
609
+			header("Location: ".$url);
610 610
 			exit();
611 611
 		}
612 612
 	} elseif ($action == "set_message" && $user->hasRight('ticket', 'manage')) {
@@ -637,8 +637,8 @@  discard block
 block discarded – undo
637 637
 			//$old_status = $object->status;
638 638
 			$res = $object->setStatut($new_status);
639 639
 			if ($res) {
640
-				$url = 'card.php?track_id=' . $object->track_id;
641
-				header("Location: " . $url);
640
+				$url = 'card.php?track_id='.$object->track_id;
641
+				header("Location: ".$url);
642 642
 				exit();
643 643
 			} else {
644 644
 				$error++;
@@ -690,17 +690,17 @@  discard block
 block discarded – undo
690 690
 
691 691
 
692 692
 	$permissiondellink = $user->hasRight('ticket', 'write');
693
-	include DOL_DOCUMENT_ROOT . '/core/actions_dellink.inc.php'; // Must be 'include', not 'include_once'
693
+	include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be 'include', not 'include_once'
694 694
 
695 695
 	// Actions to build doc
696
-	include DOL_DOCUMENT_ROOT . '/core/actions_builddoc.inc.php';
696
+	include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
697 697
 
698 698
 	// Actions to send emails
699 699
 	$triggersendname = 'TICKET_SENTBYMAIL';
700 700
 	$paramname = 'id';
701 701
 	$autocopy = 'MAIN_MAIL_AUTOCOPY_TICKET_TO'; // used to know the automatic BCC to add
702
-	$trackid = 'tic' . $object->id;
703
-	include DOL_DOCUMENT_ROOT . '/core/actions_sendmails.inc.php';
702
+	$trackid = 'tic'.$object->id;
703
+	include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
704 704
 
705 705
 	// Set $action to correct value for the case we used presend action to add a message
706 706
 	if (GETPOSTISSET('actionbis') && $action == 'presend') {	// Test on permission not required here
@@ -736,7 +736,7 @@  discard block
 block discarded – undo
736 736
 
737 737
 	print load_fiche_titre($langs->trans('NewTicket'), '', 'ticket');
738 738
 
739
-	$formticket->trackid = '';		// TODO Use a unique key 'tic' to avoid conflict in upload file feature
739
+	$formticket->trackid = ''; // TODO Use a unique key 'tic' to avoid conflict in upload file feature
740 740
 	$formticket->withfromsocid = $socid ? $socid : $user->socid;
741 741
 	$formticket->withfromcontactid = $contactid ? $contactid : '';
742 742
 	$formticket->withtitletopic = 1;
@@ -769,7 +769,7 @@  discard block
 block discarded – undo
769 769
 
770 770
 	print dol_get_fiche_head($head, 'tabTicket', $langs->trans('Ticket'), -1, 'ticket');
771 771
 
772
-	$formticket->trackid = $object->track_id;        // TODO Use a unique key 'tic' to avoid conflict in upload file feature
772
+	$formticket->trackid = $object->track_id; // TODO Use a unique key 'tic' to avoid conflict in upload file feature
773 773
 	$formticket->withfromsocid = $object->socid;
774 774
 	$formticket->withtitletopic = 1;
775 775
 	//  $formticket->withnotifytiersatcreate = ($notifyTiers ? 1 : (getDolGlobalString('TICKET_CHECK_NOTIFY_THIRDPARTY_AT_CREATION') ? 1 : 0));
@@ -804,7 +804,7 @@  discard block
 block discarded – undo
804 804
 				'-3' => $langs->trans('TicketNotNotifyTiersAtClose')
805 805
 			);
806 806
 			foreach ($thirdparty_contacts as $thirdparty_contact) {
807
-				$contacts_select[$thirdparty_contact['id']] = $thirdparty_contact['civility'] . ' ' . $thirdparty_contact['lastname'] . ' ' . $thirdparty_contact['firstname'];
807
+				$contacts_select[$thirdparty_contact['id']] = $thirdparty_contact['civility'].' '.$thirdparty_contact['lastname'].' '.$thirdparty_contact['firstname'];
808 808
 			}
809 809
 
810 810
 			// Default select all or no contact
@@ -1059,8 +1059,8 @@  discard block
 block discarded – undo
1059 1059
 						$morehtmlref .= $formcontract->formSelectContract($_SERVER["PHP_SELF"].'?id='.$object->id, $object->socid, $object->fk_contract, 'contratid', 0, 1, 1, 1);
1060 1060
 					} else {
1061 1061
 						$morehtmlref .= '<a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edit_contrat&token='.newToken().'&id='.$object->id.'">';
1062
-						$morehtmlref .=  img_edit($langs->trans('SetContract'));
1063
-						$morehtmlref .=  '</a>';
1062
+						$morehtmlref .= img_edit($langs->trans('SetContract'));
1063
+						$morehtmlref .= '</a>';
1064 1064
 					}
1065 1065
 				} else {
1066 1066
 					if (!empty($object->fk_contract)) {
@@ -1502,10 +1502,10 @@  discard block
 block discarded – undo
1502 1502
 				// Link to create an intervention
1503 1503
 				// socid is needed otherwise fichinter ask it and forgot origin after form submit :\
1504 1504
 				if (!$object->fk_soc && $user->hasRight("ficheinter", "creer")) {
1505
-					print dolGetButtonAction($langs->trans('UnableToCreateInterIfNoSocid'), $langs->trans('TicketAddIntervention'), 'default', $_SERVER['PHP_SELF']. '#', '', false);
1505
+					print dolGetButtonAction($langs->trans('UnableToCreateInterIfNoSocid'), $langs->trans('TicketAddIntervention'), 'default', $_SERVER['PHP_SELF'].'#', '', false);
1506 1506
 				}
1507 1507
 				if ($object->fk_soc > 0 && isset($object->status) && $object->status < Ticket::STATUS_CLOSED && $user->hasRight('ficheinter', 'creer')) {
1508
-					print dolGetButtonAction('', $langs->trans('TicketAddIntervention'), 'default', DOL_URL_ROOT.'/fichinter/card.php?action=create&token='.newToken().'&socid='. $object->fk_soc.'&origin=ticket_ticket&originid='. $object->id, '');
1508
+					print dolGetButtonAction('', $langs->trans('TicketAddIntervention'), 'default', DOL_URL_ROOT.'/fichinter/card.php?action=create&token='.newToken().'&socid='.$object->fk_soc.'&origin=ticket_ticket&originid='.$object->id, '');
1509 1509
 				}
1510 1510
 
1511 1511
 				// Close ticket if status is read
Please login to merge, or discard this patch.
htdocs/societe/card.php 1 patch
Spacing   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -161,10 +161,10 @@  discard block
 block discarded – undo
161 161
 }
162 162
 
163 163
 // Permissions
164
-$permissiontoread 	= $user->hasRight('societe', 'lire');
165
-$permissiontoadd 	= $user->hasRight('societe', 'creer'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
164
+$permissiontoread = $user->hasRight('societe', 'lire');
165
+$permissiontoadd = $user->hasRight('societe', 'creer'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
166 166
 $permissiontodelete = $user->hasRight('societe', 'supprimer') || ($permissiontoadd && isset($object->status) && $object->status == 0);
167
-$permissionnote 	= $user->hasRight('societe', 'creer'); // Used by the include of actions_setnotes.inc.php
167
+$permissionnote = $user->hasRight('societe', 'creer'); // Used by the include of actions_setnotes.inc.php
168 168
 $permissiondellink 	= $user->hasRight('societe', 'creer'); // Used by the include of actions_dellink.inc.php
169 169
 $permissiontoeditextra = $permissiontoadd;
170 170
 if (GETPOST('attribute', 'aZ09') && isset($extrafields->attributes[$object->table_element]['perms'][GETPOST('attribute', 'aZ09')])) {
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 	$permissiontoeditextra = dol_eval((string) $extrafields->attributes[$object->table_element]['perms'][GETPOST('attribute', 'aZ09')]);
173 173
 }
174 174
 
175
-$upload_dir 		= $conf->societe->multidir_output[isset($object->entity) ? $object->entity : 1];
175
+$upload_dir = $conf->societe->multidir_output[isset($object->entity) ? $object->entity : 1];
176 176
 
177 177
 // Security check
178 178
 $result = restrictedArea($user, 'societe', $object->id, '&societe', '', 'fk_soc', 'rowid', 0);
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 			if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
202 202
 				$backtopage = $backurlforlist;
203 203
 			} else {
204
-				$backtopage = DOL_URL_ROOT.'/societe/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__') . (!empty($canvas) ? "&canvas=" . $canvas : "");
204
+				$backtopage = DOL_URL_ROOT.'/societe/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__').(!empty($canvas) ? "&canvas=".$canvas : "");
205 205
 			}
206 206
 		}
207 207
 	}
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 
220 220
 	if ($action == 'confirm_merge' && $confirm == 'yes' && $permissiontoadd) {
221 221
 		$soc_origin_id = GETPOSTINT('soc_origin');
222
-		$soc_origin = new Societe($db);		// The thirdparty that we will delete
222
+		$soc_origin = new Societe($db); // The thirdparty that we will delete
223 223
 
224 224
 		if ($soc_origin_id <= 0) {
225 225
 			$langs->load('errors');
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 	if ($action == 'update_extras' && $permissiontoeditextra) {
268 268
 		$object->fetch($socid);
269 269
 
270
-		$object->oldcopy = dol_clone($object, 2);  // @phan-suppress-current-line PhanTypeMismatchProperty
270
+		$object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty
271 271
 
272 272
 		$attribute_name = GETPOST('attribute', 'aZ09');
273 273
 
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 		if (!$error) {
324 324
 			if ($action == 'update') {	// Test on permission not required here
325 325
 				$ret = $object->fetch($socid);
326
-				$object->oldcopy = clone $object;  // @phan-suppress-current-line PhanTypeMismatchProperty
326
+				$object->oldcopy = clone $object; // @phan-suppress-current-line PhanTypeMismatchProperty
327 327
 			} else {
328 328
 				$object->canvas = $canvas;
329 329
 			}
@@ -333,21 +333,21 @@  discard block
 block discarded – undo
333 333
 
334 334
 				$object->name = dolGetFirstLastname(GETPOST('firstname', 'alphanohtml'), GETPOST('name', 'alphanohtml'));
335 335
 				$object->civility_id		= GETPOST('civility_id', 'alphanohtml'); // Note: civility id is a code, not an int
336
-				$object->civility_code		= GETPOST('civility_id', 'alphanohtml'); // Note: civility id is a code, not an int
336
+				$object->civility_code = GETPOST('civility_id', 'alphanohtml'); // Note: civility id is a code, not an int
337 337
 				// Add non official properties
338
-				$object->name_bis			= GETPOST('name', 'alphanohtml');
339
-				$object->firstname			= GETPOST('firstname', 'alphanohtml');
338
+				$object->name_bis = GETPOST('name', 'alphanohtml');
339
+				$object->firstname = GETPOST('firstname', 'alphanohtml');
340 340
 			} else {
341
-				$object->name				= GETPOST('name', 'alphanohtml');
341
+				$object->name = GETPOST('name', 'alphanohtml');
342 342
 			}
343 343
 			$object->entity					= ((GETPOSTISSET('entity') && GETPOST('entity') != '') ? GETPOSTINT('entity') : $conf->entity);
344
-			$object->name_alias				= GETPOST('name_alias', 'alphanohtml');
344
+			$object->name_alias = GETPOST('name_alias', 'alphanohtml');
345 345
 			$object->parent					= GETPOSTISSET('parent_company_id') ? GETPOSTINT('parent_company_id') : $object->parent;
346 346
 			$object->address				= GETPOST('address', 'alphanohtml');
347
-			$object->zip					= GETPOST('zipcode', 'alphanohtml');
348
-			$object->town					= GETPOST('town', 'alphanohtml');
349
-			$object->country_id				= GETPOSTINT('country_id');
350
-			$object->state_id				= GETPOSTINT('state_id');
347
+			$object->zip = GETPOST('zipcode', 'alphanohtml');
348
+			$object->town = GETPOST('town', 'alphanohtml');
349
+			$object->country_id = GETPOSTINT('country_id');
350
+			$object->state_id = GETPOSTINT('state_id');
351 351
 
352 352
 			$object->socialnetworks = array();
353 353
 			if (isModEnabled('socialnetworks')) {
@@ -359,10 +359,10 @@  discard block
 block discarded – undo
359 359
 			}
360 360
 
361 361
 			$object->phone					= GETPOST('phone', 'alpha');
362
-			$object->phone_mobile 			= (string) GETPOST("phone_mobile", 'alpha');
362
+			$object->phone_mobile = (string) GETPOST("phone_mobile", 'alpha');
363 363
 			$object->fax					= GETPOST('fax', 'alpha');
364 364
 			$object->email					= trim(GETPOST('email', 'email'));
365
-			$object->no_email 				= GETPOSTINT("no_email");
365
+			$object->no_email = GETPOSTINT("no_email");
366 366
 			$object->url					= trim(GETPOST('url', 'url'));
367 367
 			$object->idprof1				= trim(GETPOST('idprof1', 'alphanohtml'));
368 368
 			$object->idprof2				= trim(GETPOST('idprof2', 'alphanohtml'));
@@ -372,13 +372,13 @@  discard block
 block discarded – undo
372 372
 			$object->idprof6				= trim(GETPOST('idprof6', 'alphanohtml'));
373 373
 			$object->prefix_comm			= GETPOST('prefix_comm', 'alphanohtml');
374 374
 			$object->code_client			= GETPOSTISSET('customer_code') ? GETPOST('customer_code', 'alpha') : GETPOST('code_client', 'alpha');
375
-			$object->code_fournisseur		= GETPOSTISSET('supplier_code') ? GETPOST('supplier_code', 'alpha') : GETPOST('code_fournisseur', 'alpha');
376
-			$object->capital				= GETPOST('capital');	// Can be null or 0 or a float value
375
+			$object->code_fournisseur = GETPOSTISSET('supplier_code') ? GETPOST('supplier_code', 'alpha') : GETPOST('code_fournisseur', 'alpha');
376
+			$object->capital				= GETPOST('capital'); // Can be null or 0 or a float value
377 377
 			$object->barcode				= GETPOST('barcode', 'alphanohtml');
378 378
 
379 379
 			$object->tva_intra				= GETPOST('tva_intra', 'alphanohtml');
380 380
 			$object->tva_assuj				= GETPOSTINT('assujtva_value');
381
-			$object->vat_reverse_charge		= GETPOST('vat_reverse_charge') == 'on' ? 1 : 0;
381
+			$object->vat_reverse_charge = GETPOST('vat_reverse_charge') == 'on' ? 1 : 0;
382 382
 			$object->status = GETPOSTINT('status');
383 383
 
384 384
 			// Local Taxes
@@ -388,11 +388,11 @@  discard block
 block discarded – undo
388 388
 			$object->localtax1_value		= GETPOST('lt1', 'alpha');
389 389
 			$object->localtax2_value		= GETPOST('lt2', 'alpha');
390 390
 
391
-			$object->forme_juridique_code	= GETPOSTINT('forme_juridique_code');
392
-			$object->birth				= dol_mktime(0, 0, 0, GETPOSTINT('birthmonth'), GETPOSTINT('birthday'), GETPOSTINT('birthyear'));
391
+			$object->forme_juridique_code = GETPOSTINT('forme_juridique_code');
392
+			$object->birth = dol_mktime(0, 0, 0, GETPOSTINT('birthmonth'), GETPOSTINT('birthday'), GETPOSTINT('birthyear'));
393 393
 
394 394
 			$object->effectif_id			= GETPOSTINT('effectif_id');
395
-			$object->typent_id				= GETPOSTINT('typent_id');
395
+			$object->typent_id = GETPOSTINT('typent_id');
396 396
 
397 397
 			$object->typent_code			= dol_getIdFromCode($db, $object->typent_id, 'c_typent', 'id', 'code'); // Force typent_code too so check in verify() will be done on new type
398 398
 
@@ -401,8 +401,8 @@  discard block
 block discarded – undo
401 401
 			$prospect = (GETPOSTINT('prospect') > 0 ? 2 : 0);
402 402
 			$prospectcustomer = $customer + $prospect;
403 403
 
404
-			$object->client					= $prospectcustomer;
405
-			$object->fournisseur			= (GETPOSTINT('supplier') > 0 ? 1 : 0);
404
+			$object->client = $prospectcustomer;
405
+			$object->fournisseur = (GETPOSTINT('supplier') > 0 ? 1 : 0);
406 406
 
407 407
 			if ($action == 'add') {		// Test on permission already done
408 408
 				// for prospect, customer or supplier
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 					}
423 423
 
424 424
 					if ($object->fournisseur > 0) {
425
-						$object->cond_reglement_supplier_id	= $paymentTermId;
425
+						$object->cond_reglement_supplier_id = $paymentTermId;
426 426
 
427 427
 						$filterPaymentTypeIdArr = array(1, 2, 3); // allow payment type for supplier (filter is "DBIT" in "Form::select_types_paiements()" method)
428 428
 						if (!empty($form->cache_types_paiements[$paymentTypeId]) && isset($form->cache_types_paiements[$paymentTypeId]['type']) && in_array($form->cache_types_paiements[$paymentTypeId]['type'], $filterPaymentTypeIdArr)) {
@@ -432,15 +432,15 @@  discard block
 block discarded – undo
432 432
 				}
433 433
 			}
434 434
 
435
-			$object->commercial_id			= GETPOSTINT('commercial_id');
436
-			$object->default_lang			= GETPOST('default_lang');
435
+			$object->commercial_id = GETPOSTINT('commercial_id');
436
+			$object->default_lang = GETPOST('default_lang');
437 437
 
438 438
 			// Webservices url/key
439 439
 			$object->webservices_url		= GETPOST('webservices_url', 'url');
440 440
 			$object->webservices_key		= GETPOST('webservices_key', 'san_alpha');
441 441
 
442 442
 			if (GETPOSTISSET('accountancy_code_sell')) {
443
-				$accountancy_code_sell		= GETPOST('accountancy_code_sell', 'alpha');
443
+				$accountancy_code_sell = GETPOST('accountancy_code_sell', 'alpha');
444 444
 
445 445
 				if (empty($accountancy_code_sell) || $accountancy_code_sell == '-1') {
446 446
 					$object->accountancy_code_sell = '';
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
 				}
450 450
 			}
451 451
 			if (GETPOSTISSET('accountancy_code_buy')) {
452
-				$accountancy_code_buy		= GETPOST('accountancy_code_buy', 'alpha');
452
+				$accountancy_code_buy = GETPOST('accountancy_code_buy', 'alpha');
453 453
 
454 454
 				if (empty($accountancy_code_buy) || $accountancy_code_buy == '-1') {
455 455
 					$object->accountancy_code_buy = '';
@@ -835,7 +835,7 @@  discard block
 block discarded – undo
835 835
 	// Delete third party
836 836
 	if ($action == 'confirm_delete' && $confirm == 'yes' && $user->hasRight('societe', 'supprimer')) {
837 837
 		$object->fetch($socid);
838
-		$object->oldcopy = clone $object;  // @phan-suppress-current-line PhanTypeMismatchProperty
838
+		$object->oldcopy = clone $object; // @phan-suppress-current-line PhanTypeMismatchProperty
839 839
 		$result = $object->delete($socid, $user);
840 840
 
841 841
 		if ($result > 0) {
@@ -913,7 +913,7 @@  discard block
 block discarded – undo
913 913
 				} else {
914 914
 					$db->commit();
915 915
 					$db->close();
916
-					header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
916
+					header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
917 917
 					exit;
918 918
 				}
919 919
 			} else {
@@ -1095,21 +1095,21 @@  discard block
 block discarded – undo
1095 1095
 		}
1096 1096
 
1097 1097
 		$object->phone				= GETPOST('phone', 'alpha');
1098
-		$object->phone_mobile       = (string) GETPOST("phone_mobile", 'alpha');
1098
+		$object->phone_mobile = (string) GETPOST("phone_mobile", 'alpha');
1099 1099
 		$object->fax				= GETPOST('fax', 'alpha');
1100 1100
 		$object->email				= GETPOST('email', 'email');
1101 1101
 		$object->url				= GETPOST('url', 'url');
1102
-		$object->capital			= GETPOST('capital');	// can be null or 0 or a float value
1102
+		$object->capital = GETPOST('capital'); // can be null or 0 or a float value
1103 1103
 		$paymentTermId = GETPOSTINT('cond_reglement_id'); // can be set by default values on create page and not already in get or post variables
1104 1104
 		if (empty($paymentTermId) && !GETPOSTISSET('cond_reglement_id')) {
1105 1105
 			$paymentTermId = getDolGlobalString('MAIN_DEFAULT_PAYMENT_TERM_ID');
1106 1106
 		}
1107
-		$object->cond_reglement_id	= $paymentTermId;
1107
+		$object->cond_reglement_id = $paymentTermId;
1108 1108
 		$paymentTypeId = GETPOSTINT('mode_reglement_id'); // can be set by default values on create page and not already in get or post variables
1109 1109
 		if (empty($paymentTypeId) && !GETPOSTISSET('mode_reglement_id')) {
1110 1110
 			$paymentTypeId = getDolGlobalString('MAIN_DEFAULT_PAYMENT_TYPE_ID');
1111 1111
 		}
1112
-		$object->mode_reglement_id 	= $paymentTypeId;
1112
+		$object->mode_reglement_id = $paymentTypeId;
1113 1113
 		$object->barcode			= GETPOST('barcode', 'alphanohtml');
1114 1114
 		$object->idprof1			= GETPOST('idprof1', 'alphanohtml');
1115 1115
 		$object->idprof2			= GETPOST('idprof2', 'alphanohtml');
@@ -1122,7 +1122,7 @@  discard block
 block discarded – undo
1122 1122
 		$object->civility_id		= GETPOST('civility_id', 'alpha');
1123 1123
 
1124 1124
 		$object->tva_assuj = GETPOSTINT('assujtva_value');
1125
-		$object->vat_reverse_charge	= GETPOST('vat_reverse_charge') == 'on' ? 1 : 0;
1125
+		$object->vat_reverse_charge = GETPOST('vat_reverse_charge') == 'on' ? 1 : 0;
1126 1126
 		$object->status = GETPOSTINT('status');
1127 1127
 
1128 1128
 		//Local Taxes
@@ -1138,7 +1138,7 @@  discard block
 block discarded – undo
1138 1138
 		$object->default_lang = GETPOST('default_lang');
1139 1139
 
1140 1140
 		if (GETPOSTISSET('accountancy_code_sell')) {
1141
-			$accountancy_code_sell  = GETPOST('accountancy_code_sell', 'alpha');
1141
+			$accountancy_code_sell = GETPOST('accountancy_code_sell', 'alpha');
1142 1142
 
1143 1143
 			if (empty($accountancy_code_sell) || $accountancy_code_sell == '-1') {
1144 1144
 				$object->accountancy_code_sell = '';
@@ -1147,7 +1147,7 @@  discard block
 block discarded – undo
1147 1147
 			}
1148 1148
 		}
1149 1149
 		if (GETPOSTISSET('accountancy_code_buy')) {
1150
-			$accountancy_code_buy   = GETPOST('accountancy_code_buy', 'alpha');
1150
+			$accountancy_code_buy = GETPOST('accountancy_code_buy', 'alpha');
1151 1151
 
1152 1152
 			if (empty($accountancy_code_buy) || $accountancy_code_buy == '-1') {
1153 1153
 				$object->accountancy_code_buy = '';
@@ -1272,7 +1272,7 @@  discard block
 block discarded – undo
1272 1272
 
1273 1273
 			print '<script type="text/javascript">';
1274 1274
 			print '$(document).ready(function () {
1275
-					var canHaveCustomerCategoryIfNotCustomerProspectSupplier = ' . (!getDolGlobalString('THIRDPARTY_CAN_HAVE_CUSTOMER_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT') ? '0' : '1') . ';
1275
+					var canHaveCustomerCategoryIfNotCustomerProspectSupplier = ' . (!getDolGlobalString('THIRDPARTY_CAN_HAVE_CUSTOMER_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT') ? '0' : '1').';
1276 1276
 
1277 1277
 					init_customer_categ();
1278 1278
 			  		$("#customerprospect").change(function() {
@@ -1344,7 +1344,7 @@  discard block
 block discarded – undo
1344 1344
 			print '</td><td'.(getDolGlobalString('SOCIETE_USEPREFIX') ? '' : ' colspan="3"').'>';
1345 1345
 
1346 1346
 			print '<input type="text" class="minwidth300" maxlength="128" name="name" id="name" value="'.dol_escape_htmltag($object->name).'" autofocus="autofocus" spellcheck="false">';
1347
-			print $form->widgetForTranslation("name", $object, $permissiontoadd, 'string', 'alphanohtml', 'minwidth300');	// For some countries that need the company name in 2 languages
1347
+			print $form->widgetForTranslation("name", $object, $permissiontoadd, 'string', 'alphanohtml', 'minwidth300'); // For some countries that need the company name in 2 languages
1348 1348
 			// This implementation of the feature to search already existing company has been disabled. It must be implemented by keeping the "input text" and we must call the search ajax societe/ajax/ajaxcompanies.php
1349 1349
 			// on a keydown of the input. We should show data about a duplicate found if we found less than 5 answers into a div under the input.
1350 1350
 			/*
@@ -1466,8 +1466,8 @@  discard block
 block discarded – undo
1466 1466
 
1467 1467
 			// Prospect/Customer/Supplier
1468 1468
 			$selected = $object->client;
1469
-			$selectedcustomer = ((getDolGlobalInt('THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT')==1 && GETPOST("type", 'aZ') != 'p' && GETPOST("type", 'aZ') != 'f') || (getDolGlobalInt('THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT')==3 && GETPOST("type", 'aZ') != 'p' && GETPOST("type", 'aZ') != 'f') ? 1 : 0);
1470
-			$selectedprospect = ((getDolGlobalInt('THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT')==2 && GETPOST("type", 'aZ') != 'c' && GETPOST("type", 'aZ') != 'f') || (getDolGlobalInt('THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT')==3 && GETPOST("type", 'aZ') != 'c' && GETPOST("type", 'aZ') != 'f') ? 1 : 0);
1469
+			$selectedcustomer = ((getDolGlobalInt('THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT') == 1 && GETPOST("type", 'aZ') != 'p' && GETPOST("type", 'aZ') != 'f') || (getDolGlobalInt('THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT') == 3 && GETPOST("type", 'aZ') != 'p' && GETPOST("type", 'aZ') != 'f') ? 1 : 0);
1470
+			$selectedprospect = ((getDolGlobalInt('THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT') == 2 && GETPOST("type", 'aZ') != 'c' && GETPOST("type", 'aZ') != 'f') || (getDolGlobalInt('THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT') == 3 && GETPOST("type", 'aZ') != 'c' && GETPOST("type", 'aZ') != 'f') ? 1 : 0);
1471 1471
 			switch ($selected) {
1472 1472
 				case 1:
1473 1473
 					$selectedcustomer = 1;
@@ -1718,7 +1718,7 @@  discard block
 block discarded – undo
1718 1718
 					print '<td></td>';
1719 1719
 					print '<td></td>';
1720 1720
 				}
1721
-				print '<td class="individualline noemail">'.$form->editfieldkey($langs->trans('No_Email') .' ('.$langs->trans('Contact').')', 'contact_no_email', '', $object, 0).'</td>';
1721
+				print '<td class="individualline noemail">'.$form->editfieldkey($langs->trans('No_Email').' ('.$langs->trans('Contact').')', 'contact_no_email', '', $object, 0).'</td>';
1722 1722
 				print '<td class="individualline" '.(($conf->browser->layout == 'phone') || !isModEnabled('mailing') ? ' colspan="3"' : '').'>'.$form->selectyesno('contact_no_email', (GETPOSTISSET("contact_no_email") ? GETPOST("contact_no_email", 'alpha') : (empty($object->no_email) ? 0 : 1)), 1, false, 1).'</td>';
1723 1723
 				print '</tr>';
1724 1724
 			}
@@ -1766,7 +1766,7 @@  discard block
 block discarded – undo
1766 1766
 			// Vat is used
1767 1767
 			print '<tr><td><label for="assujtva_value">'.$form->editfieldkey('VATIsUsed', 'assujtva_value', '', $object, 0).'</label></td>';
1768 1768
 			print '<td>';
1769
-			print '<input id="assujtva_value" name="assujtva_value" type="checkbox" ' . (GETPOSTISSET('assujtva_value') ? (GETPOST('assujtva_value', 'alpha') != '' ? ' checked="checked"' : '') : 'checked="checked"') . ' value="1">'; // Assujeti par default en creation
1769
+			print '<input id="assujtva_value" name="assujtva_value" type="checkbox" '.(GETPOSTISSET('assujtva_value') ? (GETPOST('assujtva_value', 'alpha') != '' ? ' checked="checked"' : '') : 'checked="checked"').' value="1">'; // Assujeti par default en creation
1770 1770
 			print '</td>';
1771 1771
 			if ($conf->browser->layout == 'phone') {
1772 1772
 				print '</tr><tr>';
@@ -1807,7 +1807,7 @@  discard block
 block discarded – undo
1807 1807
 
1808 1808
 			// VAT reverse charge by default
1809 1809
 			if (getDolGlobalString('ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE')) {
1810
-				print '<tr><td><label for="vat_reverse_charge">' . $form->editfieldkey('VATReverseChargeByDefault', 'vat_reverse_charge', '', $object, 0) . '</label></td><td colspan="3">';
1810
+				print '<tr><td><label for="vat_reverse_charge">'.$form->editfieldkey('VATReverseChargeByDefault', 'vat_reverse_charge', '', $object, 0).'</label></td><td colspan="3">';
1811 1811
 				print '<input type="checkbox" name="vat_reverse_charge" id="vat_reverse_charge" '.($object->vat_reverse_charge == '1' ? ' checked' : '').'>';
1812 1812
 				print '</td></tr>';
1813 1813
 			}
@@ -1816,21 +1816,21 @@  discard block
 block discarded – undo
1816 1816
 			// TODO: Place into a function to control showing by country or study better option
1817 1817
 			if ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj == "1") {
1818 1818
 				print '<tr><td>'.$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code).'</td><td>';
1819
-				print '<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . (isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX1) ? 'checked="checked"' : '') . ' value="1">';
1819
+				print '<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" '.(isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX1) ? 'checked="checked"' : '').' value="1">';
1820 1820
 				print '</td>';
1821 1821
 				if ($conf->browser->layout == 'phone') {
1822 1822
 					print '</tr><tr>';
1823 1823
 				}
1824 1824
 				print '<td>'.$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code).'</td><td>';
1825
-				print '<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . (isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX2) ? 'checked="checked"' : '') . ' value="1">';
1825
+				print '<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" '.(isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX2) ? 'checked="checked"' : '').' value="1">';
1826 1826
 				print '</td></tr>';
1827 1827
 			} elseif ($mysoc->localtax1_assuj == "1") {
1828 1828
 				print '<tr><td>'.$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code).'</td><td colspan="3">';
1829
-				print '<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . (isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX1) ? 'checked="checked"' : '') . ' value="1">';
1829
+				print '<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" '.(isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX1) ? 'checked="checked"' : '').' value="1">';
1830 1830
 				print '</td></tr>';
1831 1831
 			} elseif ($mysoc->localtax2_assuj == "1") {
1832 1832
 				print '<tr><td>'.$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code).'</td><td colspan="3">';
1833
-				print '<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . (isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX2) ? 'checked="checked"' : '') . ' value="1">';
1833
+				print '<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" '.(isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX2) ? 'checked="checked"' : '').' value="1">';
1834 1834
 				print '</td></tr>';
1835 1835
 			}
1836 1836
 
@@ -2077,7 +2077,7 @@  discard block
 block discarded – undo
2077 2077
 				$prefixSupplierIsUsed = false;
2078 2078
 			}
2079 2079
 
2080
-			$object->oldcopy = clone $object;  // @phan-suppress-current-line PhanTypeMismatchProperty
2080
+			$object->oldcopy = clone $object; // @phan-suppress-current-line PhanTypeMismatchProperty
2081 2081
 
2082 2082
 			if (GETPOSTISSET('name')) {
2083 2083
 				// We overwrite with values if posted
@@ -2105,12 +2105,12 @@  discard block
 block discarded – undo
2105 2105
 				}
2106 2106
 
2107 2107
 				$object->phone					= GETPOST('phone', 'alpha');
2108
-				$object->phone_mobile			= (string) GETPOST('phone_mobile', 'alpha');
2108
+				$object->phone_mobile = (string) GETPOST('phone_mobile', 'alpha');
2109 2109
 				$object->fax					= GETPOST('fax', 'alpha');
2110 2110
 				$object->email					= GETPOST('email', 'email');
2111
-				$object->no_email				= GETPOSTINT("no_email");
2111
+				$object->no_email = GETPOSTINT("no_email");
2112 2112
 				$object->url					= GETPOST('url', 'url');
2113
-				$object->capital				= GETPOST('capital');	// Can be null or 0 or a float value
2113
+				$object->capital				= GETPOST('capital'); // Can be null or 0 or a float value
2114 2114
 				$object->idprof1				= GETPOST('idprof1', 'alphanohtml');
2115 2115
 				$object->idprof2				= GETPOST('idprof2', 'alphanohtml');
2116 2116
 				$object->idprof3				= GETPOST('idprof3', 'alphanohtml');
@@ -2124,16 +2124,16 @@  discard block
 block discarded – undo
2124 2124
 				$object->default_lang = GETPOST('default_lang', 'alpha');
2125 2125
 
2126 2126
 				$object->tva_assuj				= GETPOSTINT('assujtva_value');
2127
-				$object->vat_reverse_charge		= GETPOST('vat_reverse_charge') == 'on' ? 1 : 0;
2127
+				$object->vat_reverse_charge = GETPOST('vat_reverse_charge') == 'on' ? 1 : 0;
2128 2128
 				$object->tva_intra				= GETPOST('tva_intra', 'alphanohtml');
2129
-				$object->status =				GETPOSTINT('status');
2129
+				$object->status = GETPOSTINT('status');
2130 2130
 
2131 2131
 				// Webservices url/key
2132 2132
 				$object->webservices_url        = GETPOST('webservices_url', 'url');
2133 2133
 				$object->webservices_key        = GETPOST('webservices_key', 'san_alpha');
2134 2134
 
2135 2135
 				if (GETPOSTISSET('accountancy_code_sell')) {
2136
-					$accountancy_code_sell  = GETPOST('accountancy_code_sell', 'alpha');
2136
+					$accountancy_code_sell = GETPOST('accountancy_code_sell', 'alpha');
2137 2137
 
2138 2138
 					if (empty($accountancy_code_sell) || $accountancy_code_sell == '-1') {
2139 2139
 						$object->accountancy_code_sell = '';
@@ -2142,7 +2142,7 @@  discard block
 block discarded – undo
2142 2142
 					}
2143 2143
 				}
2144 2144
 				if (GETPOSTISSET('accountancy_code_buy')) {
2145
-					$accountancy_code_buy   = GETPOST('accountancy_code_buy', 'alpha');
2145
+					$accountancy_code_buy = GETPOST('accountancy_code_buy', 'alpha');
2146 2146
 
2147 2147
 					if (empty($accountancy_code_buy) || $accountancy_code_buy == '-1') {
2148 2148
 						$object->accountancy_code_buy = '';
@@ -2224,7 +2224,7 @@  discard block
 block discarded – undo
2224 2224
     				}
2225 2225
     			});
2226 2226
 
2227
-				var canHaveCustomerCategoryIfNotCustomerProspect = ' . (getDolGlobalInt('THIRDPARTY_CAN_HAVE_CUSTOMER_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT') ? '1' : '0') . ';
2227
+				var canHaveCustomerCategoryIfNotCustomerProspect = ' . (getDolGlobalInt('THIRDPARTY_CAN_HAVE_CUSTOMER_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT') ? '1' : '0').';
2228 2228
 
2229 2229
 				init_customer_categ();
2230 2230
 	  			$("#customerprospect").change(function() {
@@ -2413,7 +2413,7 @@  discard block
 block discarded – undo
2413 2413
 					$colspan = 3;
2414 2414
 				}
2415 2415
 
2416
-				print '<tr><td>'.$form->editfieldkey('CustomerCode', 'customer_code', '', $object, 0).'</td><td'.($colspan ? ' colspan="'.$colspan.'"': '').'>';
2416
+				print '<tr><td>'.$form->editfieldkey('CustomerCode', 'customer_code', '', $object, 0).'</td><td'.($colspan ? ' colspan="'.$colspan.'"' : '').'>';
2417 2417
 				print '<table class="nobordernopadding"><tr><td>';
2418 2418
 				$tmpcode = $object->code_client ?? '';
2419 2419
 				if (empty($tmpcode) && !empty($modCodeClient->code_auto)) {
@@ -2430,7 +2430,7 @@  discard block
 block discarded – undo
2430 2430
 					print '</tr><tr>';
2431 2431
 				}
2432 2432
 
2433
-				print '<td>'.$form->editfieldkey('SupplierCode', 'supplier_code', '', $object, 0).'</td><td'.($colspan ? ' colspan="'.$colspan.'"': '').'>';
2433
+				print '<td>'.$form->editfieldkey('SupplierCode', 'supplier_code', '', $object, 0).'</td><td'.($colspan ? ' colspan="'.$colspan.'"' : '').'>';
2434 2434
 
2435 2435
 				if ((isModEnabled("fournisseur") && $user->hasRight('fournisseur', 'lire') && !getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD')) || (isModEnabled("supplier_order") && $user->hasRight('supplier_order', 'lire')) || (isModEnabled("supplier_invoice") && $user->hasRight('supplier_invoice', 'lire'))) {
2436 2436
 					print '<table class="nobordernopadding"><tr><td>';
@@ -2611,14 +2611,14 @@  discard block
 block discarded – undo
2611 2611
 
2612 2612
 				// VAT is used
2613 2613
 				print '<tr><td>'.$form->editfieldkey('VATIsUsed', 'assujtva_value', '', $object, 0).'</td><td colspan="3">';
2614
-				print '<input id="assujtva_value" name="assujtva_value" type="checkbox" ' . ($object->tva_assuj ? 'checked="checked"' : '') . ' value="1">';
2614
+				print '<input id="assujtva_value" name="assujtva_value" type="checkbox" '.($object->tva_assuj ? 'checked="checked"' : '').' value="1">';
2615 2615
 				print '</td></tr>';
2616 2616
 
2617 2617
 				// Local Taxes
2618 2618
 				//TODO: Place into a function to control showing by country or study better option
2619 2619
 				if ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj == "1") {
2620 2620
 					print '<tr><td>'.$form->editfieldkey($langs->transcountry("LocalTax1IsUsed", $mysoc->country_code), 'localtax1assuj_value', '', $object, 0).'</td><td>';
2621
-					print '<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . ($object->localtax1_assuj ? 'checked="checked"' : '') . ' value="1">';
2621
+					print '<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" '.($object->localtax1_assuj ? 'checked="checked"' : '').' value="1">';
2622 2622
 					if (!isOnlyOneLocalTax(1)) {
2623 2623
 						print '<span class="cblt1">     '.$langs->transcountry("Type", $mysoc->country_code).': ';
2624 2624
 						$formcompany->select_localtax(1, (float) $object->localtax1_value, "lt1");
@@ -2627,7 +2627,7 @@  discard block
 block discarded – undo
2627 2627
 					print '</td>';
2628 2628
 					print '</tr><tr>';
2629 2629
 					print '<td>'.$form->editfieldkey($langs->transcountry("LocalTax2IsUsed", $mysoc->country_code), 'localtax2assuj_value', '', $object, 0).'</td><td>';
2630
-					print '<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . ($object->localtax2_assuj ? 'checked="checked"' : '') . ' value="1"></td></tr>';
2630
+					print '<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" '.($object->localtax2_assuj ? 'checked="checked"' : '').' value="1"></td></tr>';
2631 2631
 					if (!isOnlyOneLocalTax(2)) {
2632 2632
 						print '<span class="cblt2">     '.$langs->transcountry("Type", $mysoc->country_code).': ';
2633 2633
 						$formcompany->select_localtax(2, (float) $object->localtax2_value, "lt2");
@@ -2636,7 +2636,7 @@  discard block
 block discarded – undo
2636 2636
 					print '</td></tr>';
2637 2637
 				} elseif ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj != "1") {
2638 2638
 					print '<tr><td>'.$form->editfieldkey($langs->transcountry("LocalTax1IsUsed", $mysoc->country_code), 'localtax1assuj_value', '', $object, 0).'</td><td colspan="3">';
2639
-					print '<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . ($object->localtax1_assuj ? 'checked="checked"' : '') . ' value="1">';
2639
+					print '<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" '.($object->localtax1_assuj ? 'checked="checked"' : '').' value="1">';
2640 2640
 					if (!isOnlyOneLocalTax(1)) {
2641 2641
 						print '<span class="cblt1">     '.$langs->transcountry("Type", $mysoc->country_code).': ';
2642 2642
 						$formcompany->select_localtax(1, (float) $object->localtax1_value, "lt1");
@@ -2645,7 +2645,7 @@  discard block
 block discarded – undo
2645 2645
 					print '</td></tr>';
2646 2646
 				} elseif ($mysoc->localtax2_assuj == "1" && $mysoc->localtax1_assuj != "1") {
2647 2647
 					print '<tr><td>'.$form->editfieldkey($langs->transcountry("LocalTax2IsUsed", $mysoc->country_code), 'localtax2assuj_value', '', $object, 0).'</td><td colspan="3">';
2648
-					print '<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . ($object->localtax2_assuj ? 'checked="checked"' : '') . ' value="1">';
2648
+					print '<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" '.($object->localtax2_assuj ? 'checked="checked"' : '').' value="1">';
2649 2649
 					if (!isOnlyOneLocalTax(2)) {
2650 2650
 						print '<span class="cblt2">     '.$langs->transcountry("Type", $mysoc->country_code).': ';
2651 2651
 						$formcompany->select_localtax(2, (float) $object->localtax2_value, "lt2");
@@ -2656,7 +2656,7 @@  discard block
 block discarded – undo
2656 2656
 
2657 2657
 				// VAT reverse charge by default
2658 2658
 				if (getDolGlobalString('ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE')) {
2659
-					print '<tr><td>' . $form->editfieldkey('VATReverseChargeByDefault', 'vat_reverse_charge', '', $object, 0) . '</td><td colspan="3">';
2659
+					print '<tr><td>'.$form->editfieldkey('VATReverseChargeByDefault', 'vat_reverse_charge', '', $object, 0).'</td><td colspan="3">';
2660 2660
 					print '<input type="checkbox" name="vat_reverse_charge" '.($object->vat_reverse_charge == '1' ? ' checked' : '').'>';
2661 2661
 					print '</td></tr>';
2662 2662
 				}
@@ -2822,7 +2822,7 @@  discard block
 block discarded – undo
2822 2822
 					$maxfilesizearray = getMaxFileSizeArray();
2823 2823
 					$maxmin = $maxfilesizearray['maxmin'];
2824 2824
 					if ($maxmin > 0) {
2825
-						print '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">';	// MAX_FILE_SIZE must precede the field type=file
2825
+						print '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file
2826 2826
 					}
2827 2827
 					print '<input type="file" class="flat" name="photo" id="photoinput">';
2828 2828
 					print '</td></tr>';
@@ -3058,7 +3058,7 @@  discard block
 block discarded – undo
3058 3058
 					print '<tr><td>';
3059 3059
 					print $form->textwithpicto($langs->trans('VATReverseChargeByDefault'), $langs->trans('VATReverseChargeByDefaultDesc'));
3060 3060
 					print '</td><td>';
3061
-					print '<input type="checkbox" name="vat_reverse_charge" ' . ($object->vat_reverse_charge == '1' ? ' checked' : '') . ' disabled>';
3061
+					print '<input type="checkbox" name="vat_reverse_charge" '.($object->vat_reverse_charge == '1' ? ' checked' : '').' disabled>';
3062 3062
 					print '</td>';
3063 3063
 					print '</tr>';
3064 3064
 				}
Please login to merge, or discard this patch.
htdocs/blockedlog/class/blockedlog.class.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
 			'linkedObjectsIds',
524 524
 			'linkedObjects',
525 525
 			'fk_delivery_address',
526
-			'projet',          // There is already ->fk_project
526
+			'projet', // There is already ->fk_project
527 527
 			'restrictiononfksoc',
528 528
 			'specimen',
529 529
 		);
@@ -874,18 +874,18 @@  discard block
 block discarded – undo
874 874
 		if ($resql) {
875 875
 			$obj = $this->db->fetch_object($resql);
876 876
 			if ($obj) {
877
-				$this->id 				= $obj->rowid;
878
-				$this->entity 			= $obj->entity;
877
+				$this->id = $obj->rowid;
878
+				$this->entity = $obj->entity;
879 879
 
880
-				$this->date_creation 	= $this->db->jdate($obj->date_creation);	// TODO Use gmt ?
881
-				$this->date_modification = $this->db->jdate($obj->tms);				// TODO Use gmt ?
880
+				$this->date_creation = $this->db->jdate($obj->date_creation); // TODO Use gmt ?
881
+				$this->date_modification = $this->db->jdate($obj->tms); // TODO Use gmt ?
882 882
 
883 883
 				$this->amounts			= (float) $obj->amounts;
884 884
 				$this->action 			= $obj->action;
885 885
 				$this->element			= $obj->element;
886 886
 
887 887
 				$this->fk_object = $obj->fk_object;
888
-				$this->date_object = $this->db->jdate($obj->date_object);			// TODO Use gmt ?
888
+				$this->date_object = $this->db->jdate($obj->date_object); // TODO Use gmt ?
889 889
 				$this->ref_object = $obj->ref_object;
890 890
 
891 891
 				$this->fk_user = $obj->fk_user;
@@ -1014,17 +1014,17 @@  discard block
 block discarded – undo
1014 1014
 
1015 1015
 		$this->object_version = DOL_VERSION;
1016 1016
 		// The object_format define the formatting rules into buildKeyForSignature and buildFirstPartOfKeyForSignature and buildFinalSignatureHash
1017
-		$this->object_format = 'V1';	// TODO Switch to V2 when v2 support is complete
1017
+		$this->object_format = 'V1'; // TODO Switch to V2 when v2 support is complete
1018 1018
 
1019 1019
 		try {
1020 1020
 			$previoushash = $this->getPreviousHash(1, 0); // This get last record and lock database until insert is done and transaction closed
1021 1021
 
1022
-			$concatenatedata = $this->buildKeyForSignature();	// All the information for the hash (meta data + data saved)
1022
+			$concatenatedata = $this->buildKeyForSignature(); // All the information for the hash (meta data + data saved)
1023 1023
 
1024
-			$this->signature = $this->buildFinalSignatureHash($previoushash.$concatenatedata);	// Build the hmac signature
1024
+			$this->signature = $this->buildFinalSignatureHash($previoushash.$concatenatedata); // Build the hmac signature
1025 1025
 
1026 1026
 			// For debug:
1027
-			$this->debuginfo = $this->buildFirstPartOfKeyForSignature();	// Not used
1027
+			$this->debuginfo = $this->buildFirstPartOfKeyForSignature(); // Not used
1028 1028
 		} catch (Exception $e) {
1029 1029
 			$this->error = $e->getMessage();
1030 1030
 
@@ -1055,7 +1055,7 @@  discard block
 block discarded – undo
1055 1055
 		$sql .= " fk_user,";
1056 1056
 		$sql .= " user_fullname,";
1057 1057
 		$sql .= " entity,";
1058
-		$sql .= " debuginfo";	// Only stored
1058
+		$sql .= " debuginfo"; // Only stored
1059 1059
 		$sql .= ") VALUES (";
1060 1060
 		$sql .= "'".$this->db->idate($this->date_creation)."',";
1061 1061
 		$sql .= "'".$this->db->escape($this->action)."',";
Please login to merge, or discard this patch.
htdocs/install/upgrade2.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 			$conf->global->SYSLOG_FILE = constant('SYSLOG_FILE');
309 309
 		}
310 310
 
311
-		$conf->global->MAIN_ENABLE_LOG_TO_HTML = 1;		// Add also log into conf->logbuffer.
311
+		$conf->global->MAIN_ENABLE_LOG_TO_HTML = 1; // Add also log into conf->logbuffer.
312 312
 
313 313
 		$versiontoarray = array();
314 314
 		$versionranarray = array();
@@ -771,7 +771,7 @@  discard block
 block discarded – undo
771 771
 
772 772
 	if (!$error) {
773 773
 		// Set constant to ask to remake a new ping to inform about upgrade (if ping was already done and OK)
774
-		$sql = 'UPDATE '.MAIN_DB_PREFIX."const SET VALUE = 'torefresh' WHERE name = 'MAIN_FIRST_PING_OK_ID'";	// This should be useless now because constant is uniqueid+' v'+version
774
+		$sql = 'UPDATE '.MAIN_DB_PREFIX."const SET VALUE = 'torefresh' WHERE name = 'MAIN_FIRST_PING_OK_ID'"; // This should be useless now because constant is uniqueid+' v'+version
775 775
 		$db->query($sql, 1);
776 776
 	}
777 777
 
@@ -4369,7 +4369,7 @@  discard block
 block discarded – undo
4369 4369
 
4370 4370
 	if (!is_object($user)) {
4371 4371
 		include_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
4372
-		$user = new User($db);	// To avoid error during migration
4372
+		$user = new User($db); // To avoid error during migration
4373 4373
 	}
4374 4374
 
4375 4375
 	dolibarr_install_syslog("upgrade2::migrate_reload_modules force=".$force.", listofmodule=".implode(',', array_keys($listofmodule)), LOG_NOTICE);
@@ -4540,7 +4540,7 @@  discard block
 block discarded – undo
4540 4540
 
4541 4541
 	if (!is_object($user)) {
4542 4542
 		include_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
4543
-		$user = new User($db);	// To avoid error during migration
4543
+		$user = new User($db); // To avoid error during migration
4544 4544
 	}
4545 4545
 
4546 4546
 	print '<tr><td colspan="4">';
@@ -4551,7 +4551,7 @@  discard block
 block discarded – undo
4551 4551
 	$resql = $db->query($sql);
4552 4552
 
4553 4553
 	if ($resql) {
4554
-		$modulepart="product_batch";
4554
+		$modulepart = "product_batch";
4555 4555
 
4556 4556
 		$lot = new Productlot($db);
4557 4557
 
@@ -4565,7 +4565,7 @@  discard block
 block discarded – undo
4565 4565
 
4566 4566
 			if ($dir) {
4567 4567
 				$lot->id = $obj->rowid;
4568
-				$lot->ref = $obj->id;		// No ref for the moment
4568
+				$lot->ref = $obj->id; // No ref for the moment
4569 4569
 				$lot->batch = $obj->batch;
4570 4570
 				$lot->entity = $obj->entity;
4571 4571
 				$lot->fk_product = $obj->fk_product;
@@ -4573,10 +4573,10 @@  discard block
 block discarded – undo
4573 4573
 				$savref = $lot->ref;
4574 4574
 
4575 4575
 				$lot->ref = $obj->batch;
4576
-				$origin = $dir . '/' . get_exdir(0, 0, 0, 1, $lot, $modulepart);
4576
+				$origin = $dir.'/'.get_exdir(0, 0, 0, 1, $lot, $modulepart);
4577 4577
 
4578
-				$lot->ref = $savref;		// So restore the id
4579
-				$destin = $dir . '/' . get_exdir(0, 0, 0, 1, $lot, $modulepart);
4578
+				$lot->ref = $savref; // So restore the id
4579
+				$destin = $dir.'/'.get_exdir(0, 0, 0, 1, $lot, $modulepart);
4580 4580
 
4581 4581
 				//var_dump($origin.' -> '.$destin.' '.$lot->batch.' dir origin is '.dol_is_dir($origin));exit;
4582 4582
 
@@ -5263,7 +5263,7 @@  discard block
 block discarded – undo
5263 5263
 				$error++;
5264 5264
 			}
5265 5265
 
5266
-			$current_contract =  $obj->cid;
5266
+			$current_contract = $obj->cid;
5267 5267
 		}
5268 5268
 	} else {
5269 5269
 		$error++;
@@ -5298,7 +5298,7 @@  discard block
 block discarded – undo
5298 5298
 	print '<tr class="trforrunsql"><td colspan="4">';
5299 5299
 	print '<b>'.$langs->trans('InvoiceExportModelsMigration')."</b>: \n";
5300 5300
 
5301
-	if (! $migrationNeeded) {
5301
+	if (!$migrationNeeded) {
5302 5302
 		print $langs->trans("AlreadyDone");
5303 5303
 		print '</td></tr>';
5304 5304
 		dolibarr_set_const($db, 'MIGRATION_FLAG_INVOICE_MODELS_V20', 1, 'chaine', 0, 'To flag the upgrade of invoice template has been set', 0);
@@ -5312,7 +5312,7 @@  discard block
 block discarded – undo
5312 5312
 
5313 5313
 	$resql1 = $db->query($sql1);
5314 5314
 
5315
-	if (! $resql1) {
5315
+	if (!$resql1) {
5316 5316
 		dol_print_error($db);
5317 5317
 		$db->rollback();
5318 5318
 		print '</td></tr>';
@@ -5329,7 +5329,7 @@  discard block
 block discarded – undo
5329 5329
 
5330 5330
 	$resql2 = $db->query($sql2);
5331 5331
 
5332
-	if (! $resql2) {
5332
+	if (!$resql2) {
5333 5333
 		dol_print_error($db);
5334 5334
 		$db->rollback();
5335 5335
 		print '</td></tr>';
@@ -5386,7 +5386,7 @@  discard block
 block discarded – undo
5386 5386
 
5387 5387
 		$resql = $db->query($sql);
5388 5388
 
5389
-		require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
5389
+		require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
5390 5390
 		$bookkeeping = new BookKeeping($db);
5391 5391
 		if ($resql) {
5392 5392
 			while ($obj = $db->fetch_object($resql)) {
@@ -5528,9 +5528,9 @@  discard block
 block discarded – undo
5528 5528
 	$hmac_encoded_secret_key = getDolGlobalString('BLOCKEDLOG_HMAC_KEY');
5529 5529
 	if (empty($hmac_encoded_secret_key)) {
5530 5530
 		// Add key
5531
-		$hmac_secret_key = 'BLOCKEDLOGHMAC'.getRandomPassword(true);		// This is using random_int for 32 chars
5531
+		$hmac_secret_key = 'BLOCKEDLOGHMAC'.getRandomPassword(true); // This is using random_int for 32 chars
5532 5532
 
5533
-		$result = dolibarr_set_const($db, 'BLOCKEDLOG_HMAC_KEY', $hmac_secret_key, 'chaine', 0, 'The secret key for HMAC used for blockedlog record', 0);	// Will encrypt the value using dolCrypt and store it.
5533
+		$result = dolibarr_set_const($db, 'BLOCKEDLOG_HMAC_KEY', $hmac_secret_key, 'chaine', 0, 'The secret key for HMAC used for blockedlog record', 0); // Will encrypt the value using dolCrypt and store it.
5534 5534
 
5535 5535
 		if ($result < 0) {
5536 5536
 			dol_print_error($db);
@@ -5545,7 +5545,7 @@  discard block
 block discarded – undo
5545 5545
 		// Decode the HMAC key
5546 5546
 		$hmac_secret_key = dolDecrypt($hmac_encoded_secret_key);
5547 5547
 
5548
-		if (! preg_match('/^BLOCKEDLOGHMAC/', $hmac_secret_key)) {
5548
+		if (!preg_match('/^BLOCKEDLOGHMAC/', $hmac_secret_key)) {
5549 5549
 			print 'Error: Failed to decode the crypted value of the parameter BLOCKEDLOG_HMAC_KEY using the $dolibarr_main_crypt_key. A value was found in config parameters in database but decoding failed. May be the database data were restored onto another environment and the coding/decoding key $dolibarr_main_dolcrypt_key was not restored with the same value in conf.php file.';
5550 5550
 			print 'Restore the value of $dolibarr_main_crypt_key that was used for encryption in database and restart the migration.';
5551 5551
 			print 'If you don\'t use the Unalterable Log module, you can also remove the BLOCKEDLOG_HMAC_KEY entry from llx_const table. If you use the Unalterable Log, this is not possible because this will invalidate all past record.';
Please login to merge, or discard this patch.
htdocs/user/perms.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -309,15 +309,15 @@  discard block
 block discarded – undo
309 309
 // Read the permissions of a user inherited by its groups
310 310
 $permsgroupbyentity = array();
311 311
 
312
-$sql = "SELECT DISTINCT gr.fk_id, gu.entity";	// fk_id are permission id and entity is entity of the group
312
+$sql = "SELECT DISTINCT gr.fk_id, gu.entity"; // fk_id are permission id and entity is entity of the group
313 313
 $sql .= " FROM ".MAIN_DB_PREFIX."usergroup_rights as gr,";
314
-$sql .= " ".MAIN_DB_PREFIX."usergroup_user as gu";	// all groups of a user
314
+$sql .= " ".MAIN_DB_PREFIX."usergroup_user as gu"; // all groups of a user
315 315
 $sql .= " WHERE gr.entity = ".((int) $entity); // it's very important, don't change please !
316 316
 // The entity on the table gu=usergroup_user should be useless and should never be used because it is already into gr and r.
317 317
 // but when using MULTICOMPANY_TRANSVERSE_MODE, we may have inserted record that make rubbish result here due to the duplicate record of
318 318
 // other entities, so we are forced to add a filter on gu here
319 319
 if (getDolGlobalString("MULTICOMPANY_TRANSVERSE_MODE_FIX_WHEN_GU_CONTAINS_0")) {
320
-	$sql .= " AND gu.entity IN (0,". ((int) $entity).")";
320
+	$sql .= " AND gu.entity IN (0,".((int) $entity).")";
321 321
 } else {
322 322
 	$sql .= " AND gu.entity = ".((int) $entity);
323 323
 }
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
 // Get list of all permissions
464 464
 $sql = "SELECT r.id, r.libelle as label, r.module, r.perms, r.subperms, r.module_position, r.bydefault, r.family, r.family_position";
465 465
 $sql .= " FROM ".MAIN_DB_PREFIX."rights_def as r";
466
-$sql .= " WHERE r.libelle NOT LIKE 'tou%'";  // We ignore permission "tous les tiers". Why ?
466
+$sql .= " WHERE r.libelle NOT LIKE 'tou%'"; // We ignore permission "tous les tiers". Why ?
467 467
 $sql .= " AND r.entity = ".((int) $entity);
468 468
 if (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) {
469 469
 	$sql .= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is not enabled
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
 	} else {
556 556
 		$ishidden = 0;
557 557
 	}
558
-		$isexpanded = ! $ishidden;
558
+		$isexpanded = !$ishidden;
559 559
 		//var_dump("isexpanded=".$isexpanded);
560 560
 
561 561
 		$permsgroupbyentitypluszero = array();
@@ -579,7 +579,7 @@  discard block
 block discarded – undo
579 579
 		} else {
580 580
 			$ishidden = 0;
581 581
 		}
582
-		$isexpanded = ! $ishidden;
582
+		$isexpanded = !$ishidden;
583 583
 		//var_dump('$obj->module='.$obj->module.' isexpanded='.$isexpanded);
584 584
 
585 585
 		// Break detected, we get objMod
Please login to merge, or discard this patch.
htdocs/main.inc.php 1 patch
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 //@ini_set('memory_limit', '128M');	// This may be useless if memory is hard limited by your PHP
43 43
 
44 44
 // For optional tuning. Enabled if environment variable MAIN_SHOW_TUNING_INFO is defined.
45
-$micro_start_time = 0;	// Used as global var into printCommonFooter()
45
+$micro_start_time = 0; // Used as global var into printCommonFooter()
46 46
 if (!empty($_SERVER['MAIN_SHOW_TUNING_INFO'])) {
47 47
 	list($usec, $sec) = explode(" ", microtime());
48 48
 	$micro_start_time = ((float) $usec + (float) $sec);
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 		session_set_cookie_params($sessioncookieparams);
132 132
 	}
133 133
 	session_name($sessionname);
134
-	dol_session_start();	// This call the open and read of session handler
134
+	dol_session_start(); // This call the open and read of session handler
135 135
 	//exit;	// this exist generates a call to write and close
136 136
 }
137 137
 
@@ -176,12 +176,12 @@  discard block
 block discarded – undo
176 176
 	if (!$ok) {
177 177
 		if (session_id() && isset($_SESSION["dol_login"]) && !in_array($_SESSION["dol_login"], explode(';', getDolGlobalString('MAIN_ONLY_LOGIN_ALLOWED')))) {
178 178
 			print 'Sorry, your application is offline.'."\n";
179
-			print 'You are logged with user "'.$_SESSION["dol_login"].'" and only administrator users (' . str_replace(';', ', ', getDolGlobalString('MAIN_ONLY_LOGIN_ALLOWED')).') is allowed to connect for the moment.'."\n";
180
-			$nexturl = dolBuildUrl(DOL_URL_ROOT . '/user/logout.php', [], true);
179
+			print 'You are logged with user "'.$_SESSION["dol_login"].'" and only administrator users ('.str_replace(';', ', ', getDolGlobalString('MAIN_ONLY_LOGIN_ALLOWED')).') is allowed to connect for the moment.'."\n";
180
+			$nexturl = dolBuildUrl(DOL_URL_ROOT.'/user/logout.php', [], true);
181 181
 			print 'Please try later or <a href="'.$nexturl.'">click here to disconnect and change login user</a>...'."\n";
182 182
 		} else {
183
-			print 'Sorry, your application is offline. Only administrator users (' . str_replace(';', ', ', getDolGlobalString('MAIN_ONLY_LOGIN_ALLOWED')).') is allowed to connect for the moment.'."\n";
184
-			$nexturl = dolBuildUrl(DOL_URL_ROOT . '/');
183
+			print 'Sorry, your application is offline. Only administrator users ('.str_replace(';', ', ', getDolGlobalString('MAIN_ONLY_LOGIN_ALLOWED')).') is allowed to connect for the moment.'."\n";
184
+			$nexturl = dolBuildUrl(DOL_URL_ROOT.'/');
185 185
 			print 'Please try later or <a href="'.$nexturl.'">click here to change login user</a>...'."\n";
186 186
 		}
187 187
 		exit;
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 					print "Access to this page this way (POST method or GET with a sensible value for 'action' parameter) is refused by CSRF protection in main.inc.php. Token not provided.\n";
397 397
 					print "If you access your server behind a proxy using url rewriting and the parameter is provided by caller, you might check that all HTTP header are propagated (or add the line \$dolibarr_nocsrfcheck=1 into your conf.php file or MAIN_SECURITY_CSRF_WITH_TOKEN to 0";
398 398
 					if (getDolGlobalString('MAIN_SECURITY_CSRF_WITH_TOKEN')) {
399
-						print " instead of " . getDolGlobalString('MAIN_SECURITY_CSRF_WITH_TOKEN');
399
+						print " instead of ".getDolGlobalString('MAIN_SECURITY_CSRF_WITH_TOKEN');
400 400
 					}
401 401
 					print " into setup).\n";
402 402
 				}
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
 		unset($_GET['action']);
425 425
 		unset($_GET['confirmmassaction']);
426 426
 		unset($_GET['massaction']);
427
-		unset($_GET['token']);			// TODO Make a redirect if we have a token in url to remove it ?
427
+		unset($_GET['token']); // TODO Make a redirect if we have a token in url to remove it ?
428 428
 		if (isset($savid)) {
429 429
 			$_POST['id'] = ((int) $savid);
430 430
 		}
@@ -446,18 +446,18 @@  discard block
 block discarded – undo
446 446
 	foreach ($disabled_modules as $module) {
447 447
 		if ($module) {
448 448
 			if (empty($conf->$module)) {
449
-				$conf->$module = new stdClass(); 	// To avoid warnings
449
+				$conf->$module = new stdClass(); // To avoid warnings
450 450
 			}
451 451
 
452
-			$conf->$module->enabled = false;		// Old usage
452
+			$conf->$module->enabled = false; // Old usage
453 453
 			unset($conf->modules[$module]);
454 454
 
455 455
 			foreach ($modulepartkeys as $modulepartkey) {
456 456
 				unset($conf->modules_parts[$modulepartkey][$module]);
457 457
 			}
458 458
 			if ($module == 'fournisseur') {		// Special case
459
-				$conf->supplier_order->enabled = 0;		// Old usage
460
-				$conf->supplier_invoice->enabled = 0;	// Old usage
459
+				$conf->supplier_order->enabled = 0; // Old usage
460
+				$conf->supplier_invoice->enabled = 0; // Old usage
461 461
 				unset($conf->modules['supplier_order']);
462 462
 				unset($conf->modules['supplier_invoice']);
463 463
 			}
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
 				if ($dol_use_jmobile) {
555 555
 					$query += ['dol_use_jmobile='.$dol_use_jmobile];
556 556
 				}
557
-				header("Location: " . dolBuildUrl(DOL_URL_ROOT . '/public/demo/index.php', $query));
557
+				header("Location: ".dolBuildUrl(DOL_URL_ROOT.'/public/demo/index.php', $query));
558 558
 				exit;
559 559
 			}
560 560
 		}
@@ -602,12 +602,12 @@  discard block
 block discarded – undo
602 602
 					if (is_object($captchaobj) && method_exists($captchaobj, 'validateCodeAfterLoginSubmit')) {
603 603
 						$ok = $captchaobj->validateCodeAfterLoginSubmit(); // @phan-suppress-current-line PhanUndeclaredMethod
604 604
 					} else {
605
-						$_SESSION["dol_loginmesg"] =  'Error, the captcha handler '.get_class($captchaobj).' does not have any method validateCodeAfterLoginSubmit()';
605
+						$_SESSION["dol_loginmesg"] = 'Error, the captcha handler '.get_class($captchaobj).' does not have any method validateCodeAfterLoginSubmit()';
606 606
 						$test = false;
607 607
 						$error++;
608 608
 					}
609 609
 				} else {
610
-					$_SESSION["dol_loginmesg"] =  'Error, the captcha handler class '.$classname.' was not found after the include';
610
+					$_SESSION["dol_loginmesg"] = 'Error, the captcha handler class '.$classname.' was not found after the include';
611 611
 					$test = false;
612 612
 					$error++;
613 613
 				}
@@ -651,7 +651,7 @@  discard block
 block discarded – undo
651 651
 
652 652
 		$allowedmethodtopostusername = 3;
653 653
 		if (defined('MAIN_AUTHENTICATION_POST_METHOD')) {
654
-			$allowedmethodtopostusername = constant('MAIN_AUTHENTICATION_POST_METHOD');	// Note a value of 2 is not compatible with some authentication methods that put username as GET parameter
654
+			$allowedmethodtopostusername = constant('MAIN_AUTHENTICATION_POST_METHOD'); // Note a value of 2 is not compatible with some authentication methods that put username as GET parameter
655 655
 		}
656 656
 		// TODO Remove use of $_COOKIE['login_dolibarr'] by replacing line with $usertotest = GETPOST("username", "alpha", $allowedmethodtopostusername); ?
657 657
 		$usertotest = (!empty($_COOKIE['login_dolibarr']) ? preg_replace('/[^a-zA-Z0-9_@\-\.]/', '', $_COOKIE['login_dolibarr']) : GETPOST("username", "alpha", $allowedmethodtopostusername));
@@ -800,7 +800,7 @@  discard block
 block discarded – undo
800 800
 				}
801 801
 
802 802
 				// Show login form
803
-				dol_loginfunction($langs, $conf, (!empty($mysoc) ? $mysoc : ''));	// This include http headers
803
+				dol_loginfunction($langs, $conf, (!empty($mysoc) ? $mysoc : '')); // This include http headers
804 804
 			}
805 805
 			exit;
806 806
 		}
@@ -861,7 +861,7 @@  discard block
 block discarded – undo
861 861
 			if (GETPOST('lang', 'aZ09')) {
862 862
 				$paramsurl += ['lang' => (string) GETPOST('lang', 'aZ09')];
863 863
 			}
864
-			header('Location: '.dolBuildUrl(DOL_URL_ROOT . '/index.php', $paramsurl));
864
+			header('Location: '.dolBuildUrl(DOL_URL_ROOT.'/index.php', $paramsurl));
865 865
 			exit;
866 866
 		} else {
867 867
 			// User is loaded, we may need to change language for him according to its choice
@@ -1158,7 +1158,7 @@  discard block
 block discarded – undo
1158 1158
 } else {
1159 1159
 	// We may have NOLOGIN set, but NOREQUIREUSER not
1160 1160
 	if (!empty($user) && method_exists($user, 'loadDefaultValues') && !defined('NODEFAULTVALUES')) {
1161
-		$user->loadDefaultValues();		// Load default values for everybody (works even if $user->id = 0
1161
+		$user->loadDefaultValues(); // Load default values for everybody (works even if $user->id = 0
1162 1162
 	}
1163 1163
 }
1164 1164
 
@@ -1221,7 +1221,7 @@  discard block
 block discarded – undo
1221 1221
 	$conf->dol_optimize_smallscreen = 1;
1222 1222
 
1223 1223
 	if (getDolGlobalInt('PRODUIT_DESC_IN_FORM') == 1) {
1224
-		$conf->global->PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE = 0;	// This was set to PRODUIT_DESC_IN_FORM and is forced to 0 if smartphone in this case
1224
+		$conf->global->PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE = 0; // This was set to PRODUIT_DESC_IN_FORM and is forced to 0 if smartphone in this case
1225 1225
 	}
1226 1226
 }
1227 1227
 // Replace themes bugged with jmobile with eldy
@@ -1324,7 +1324,7 @@  discard block
 block discarded – undo
1324 1324
 	define('ROWS_9', 8);
1325 1325
 }
1326 1326
 
1327
-$heightforframes = 52;	// Used by frames.php page
1327
+$heightforframes = 52; // Used by frames.php page
1328 1328
 
1329 1329
 // Init menu manager
1330 1330
 if (!defined('NOREQUIREMENU')) {
@@ -1364,7 +1364,7 @@  discard block
 block discarded – undo
1364 1364
 
1365 1365
 if (!empty(GETPOST('seteventmessages', 'alpha'))) {
1366 1366
 	$message = GETPOST('seteventmessages', 'alpha');
1367
-	$messages  = explode(',', $message);
1367
+	$messages = explode(',', $message);
1368 1368
 	foreach ($messages as $key => $msg) {
1369 1369
 		$tmp = explode(':', $msg);
1370 1370
 		setEventMessages($tmp[0], null, !empty($tmp[1]) ? $tmp[1] : 'mesgs');
@@ -1703,7 +1703,7 @@  discard block
 block discarded – undo
1703 1703
 		}
1704 1704
 
1705 1705
 		if (getDolGlobalString('THEME_ELDY_TOPMENU_BACK1')) {
1706
-			print '<meta name="theme-color" content="rgb(' . getDolGlobalString('THEME_ELDY_TOPMENU_BACK1').')">'."\n";
1706
+			print '<meta name="theme-color" content="rgb('.getDolGlobalString('THEME_ELDY_TOPMENU_BACK1').')">'."\n";
1707 1707
 		}
1708 1708
 
1709 1709
 		// Auto refresh page
@@ -1752,7 +1752,7 @@  discard block
 block discarded – undo
1752 1752
 
1753 1753
 		$themeparam = '?lang='.$langs->defaultlang.'&amp;theme='.$conf->theme.(GETPOST('optioncss', 'aZ09') ? '&amp;optioncss='.GETPOST('optioncss', 'aZ09', 1) : '').(empty($user->id) ? '' : ('&amp;userid='.$user->id)).'&amp;entity='.$conf->entity;
1754 1754
 
1755
-		$themeparam .= '&' .$ext . '&revision='.getDolGlobalInt("MAIN_IHM_PARAMS_REV");
1755
+		$themeparam .= '&'.$ext.'&revision='.getDolGlobalInt("MAIN_IHM_PARAMS_REV");
1756 1756
 		if (GETPOSTISSET('dol_hide_topmenu')) {
1757 1757
 			$themeparam .= '&amp;dol_hide_topmenu='.GETPOSTINT('dol_hide_topmenu');
1758 1758
 		}
@@ -1792,24 +1792,24 @@  discard block
 block discarded – undo
1792 1792
 					$jquerytheme = getDolGlobalString('MAIN_USE_JQUERY_THEME');
1793 1793
 				}
1794 1794
 				if (constant('JS_JQUERY_UI')) {
1795
-					print '<link rel="stylesheet" type="text/css" href="' . JS_JQUERY_UI . 'css/' . $jquerytheme . '/jquery-ui.min.css?' . $ext . '">' . "\n"; // Forced JQuery
1795
+					print '<link rel="stylesheet" type="text/css" href="'.JS_JQUERY_UI.'css/'.$jquerytheme.'/jquery-ui.min.css?'.$ext.'">'."\n"; // Forced JQuery
1796 1796
 				} else {
1797
-					print '<link rel="stylesheet" type="text/css" href="' . DOL_URL_ROOT . '/includes/jquery/css/' . $jquerytheme . '/jquery-ui.css?' . $ext . '">' . "\n"; // JQuery
1797
+					print '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/includes/jquery/css/'.$jquerytheme.'/jquery-ui.css?'.$ext.'">'."\n"; // JQuery
1798 1798
 				}
1799 1799
 			}
1800 1800
 			if (!defined('DISABLE_JQUERY_JNOTIFY')) {
1801
-				print '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/includes/jquery/plugins/jnotify/jquery.jnotify-alt.min.css?' . $ext . '">'."\n"; // JNotify
1801
+				print '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/includes/jquery/plugins/jnotify/jquery.jnotify-alt.min.css?'.$ext.'">'."\n"; // JNotify
1802 1802
 			}
1803 1803
 			if (!defined('DISABLE_SELECT2') && (getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT'))) {     // jQuery plugin "mutiselect", "multiple-select", "select2"...
1804 1804
 				$tmpplugin = !getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') ? constant('REQUIRE_JQUERY_MULTISELECT') : getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT');
1805
-				print '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/includes/jquery/plugins/'.$tmpplugin.'/dist/css/'.$tmpplugin.'.css?' . $ext . '">'."\n";
1805
+				print '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/includes/jquery/plugins/'.$tmpplugin.'/dist/css/'.$tmpplugin.'.css?'.$ext.'">'."\n";
1806 1806
 			}
1807 1807
 		}
1808 1808
 
1809 1809
 		if (!defined('DISABLE_FONT_AWSOME')) {
1810 1810
 			print '<!-- Includes CSS for font awesome -->'."\n";
1811 1811
 			$fontawesome_directory = getDolGlobalString('MAIN_FONTAWESOME_DIRECTORY', '/theme/common/fontawesome-5');
1812
-			print '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.$fontawesome_directory.'/css/all.min.css?' . $ext . '">'."\n";
1812
+			print '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.$fontawesome_directory.'/css/all.min.css?'.$ext.'">'."\n";
1813 1813
 		}
1814 1814
 
1815 1815
 		// Output style sheets (optioncss='print' or ''). Note: $conf->css looks like '/theme/eldy/style.css.php'
@@ -1827,7 +1827,7 @@  discard block
 block discarded – undo
1827 1827
 
1828 1828
 		if (!defined('DISABLE_CSS_DEFAULT_THEME')) {
1829 1829
 			print '<!-- Includes CSS for Dolibarr theme -->'."\n";
1830
-			print '<link rel="stylesheet" type="text/css" href="' . $themepath . $themeparam . '">' . "\n";
1830
+			print '<link rel="stylesheet" type="text/css" href="'.$themepath.$themeparam.'">'."\n";
1831 1831
 		}
1832 1832
 
1833 1833
 		// To fix old chrome bug
@@ -1839,8 +1839,8 @@  discard block
 block discarded – undo
1839 1839
 
1840 1840
 		// LEAFLET AND GEOMAN
1841 1841
 		if (getDolGlobalString('MAIN_USE_GEOPHP')) {
1842
-			print '<link rel="stylesheet" href="'.DOL_URL_ROOT.'/includes/leaflet/leaflet.css?' . $ext . "\">\n";
1843
-			print '<link rel="stylesheet" href="'.DOL_URL_ROOT.'/includes/leaflet/leaflet-geoman.css?' . $ext . "\">\n";
1842
+			print '<link rel="stylesheet" href="'.DOL_URL_ROOT.'/includes/leaflet/leaflet.css?'.$ext."\">\n";
1843
+			print '<link rel="stylesheet" href="'.DOL_URL_ROOT.'/includes/leaflet/leaflet-geoman.css?'.$ext."\">\n";
1844 1844
 		}
1845 1845
 
1846 1846
 		// CSS forced by modules (relative url starting with /)
@@ -1887,7 +1887,7 @@  discard block
 block discarded – undo
1887 1887
 		// Custom CSS
1888 1888
 		if (getDolGlobalString('MAIN_IHM_CUSTOM_CSS')) {
1889 1889
 			// If a custom CSS was set, we add link to the custom css php file
1890
-			print '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/theme/custom.css.php?' . $ext . '&amp;revision='.getDolGlobalInt("MAIN_IHM_PARAMS_REV").'">'."\n";
1890
+			print '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/theme/custom.css.php?'.$ext.'&amp;revision='.getDolGlobalInt("MAIN_IHM_PARAMS_REV").'">'."\n";
1891 1891
 		}
1892 1892
 
1893 1893
 		// Output standard javascript links
@@ -1895,36 +1895,36 @@  discard block
 block discarded – undo
1895 1895
 			// JQuery. Must be before other includes
1896 1896
 			print '<!-- Includes JS for JQuery -->'."\n";
1897 1897
 			if (defined('JS_JQUERY') && constant('JS_JQUERY')) {
1898
-				print '<script nonce="'.getNonce().'" src="'.JS_JQUERY.'jquery.min.js?' . $ext . '"></script>'."\n";
1898
+				print '<script nonce="'.getNonce().'" src="'.JS_JQUERY.'jquery.min.js?'.$ext.'"></script>'."\n";
1899 1899
 			} else {
1900
-				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/includes/jquery/js/jquery.min.js?' . $ext . '"></script>'."\n";
1900
+				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/includes/jquery/js/jquery.min.js?'.$ext.'"></script>'."\n";
1901 1901
 			}
1902 1902
 			if (!defined('DISABLE_JQUERY_UI')) {
1903 1903
 				if (defined('JS_JQUERY_UI') && constant('JS_JQUERY_UI')) {
1904
-					print '<script nonce="' . getNonce() . '" src="' . JS_JQUERY_UI . 'jquery-ui.min.js?' . $ext . '"></script>' . "\n";
1904
+					print '<script nonce="'.getNonce().'" src="'.JS_JQUERY_UI.'jquery-ui.min.js?'.$ext.'"></script>'."\n";
1905 1905
 				} else {
1906
-					print '<script nonce="' . getNonce() . '" src="' . DOL_URL_ROOT . '/includes/jquery/js/jquery-ui.min.js?' . $ext . '"></script>' . "\n";
1906
+					print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/includes/jquery/js/jquery-ui.min.js?'.$ext.'"></script>'."\n";
1907 1907
 				}
1908 1908
 			}
1909 1909
 			// jQuery jnotify
1910 1910
 			if (!getDolGlobalString('MAIN_DISABLE_JQUERY_JNOTIFY') && !defined('DISABLE_JQUERY_JNOTIFY')) {
1911
-				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jnotify/jquery.jnotify.min.js?' . $ext . '"></script>'."\n";
1911
+				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jnotify/jquery.jnotify.min.js?'.$ext.'"></script>'."\n";
1912 1912
 			}
1913 1913
 			// Table drag and drop lines
1914 1914
 			if (empty($disableforlogin) && !defined('DISABLE_JQUERY_TABLEDND')) {
1915
-				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/tablednd/jquery.tablednd.min.js?' . $ext . '"></script>'."\n";
1915
+				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/tablednd/jquery.tablednd.min.js?'.$ext.'"></script>'."\n";
1916 1916
 			}
1917 1917
 			// Chart
1918 1918
 			if (empty($disableforlogin) && (!getDolGlobalString('MAIN_JS_GRAPH') || getDolGlobalString('MAIN_JS_GRAPH') == 'chart') && !defined('DISABLE_JS_GRAPH')) {
1919
-				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/includes/nnnick/chartjs/dist/chart.min.js?' . $ext . '"></script>'."\n";
1919
+				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/includes/nnnick/chartjs/dist/chart.min.js?'.$ext.'"></script>'."\n";
1920 1920
 			}
1921 1921
 
1922 1922
 			// jQuery jeditable for Edit In Place features
1923 1923
 			if (getDolGlobalString('MAIN_USE_JQUERY_JEDITABLE') && !defined('DISABLE_JQUERY_JEDITABLE')) {
1924 1924
 				print '<!-- JS to manage editInPlace feature -->'."\n";
1925
-				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jeditable/jquery.jeditable.js?' . $ext . '"></script>'."\n";
1926
-				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jeditable/jquery.jeditable.ui-datepicker.js?' . $ext . '"></script>'."\n";
1927
-				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jeditable/jquery.jeditable.ui-autocomplete.js?' . $ext . '"></script>'."\n";
1925
+				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jeditable/jquery.jeditable.js?'.$ext.'"></script>'."\n";
1926
+				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jeditable/jquery.jeditable.ui-datepicker.js?'.$ext.'"></script>'."\n";
1927
+				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jeditable/jquery.jeditable.ui-autocomplete.js?'.$ext.'"></script>'."\n";
1928 1928
 				print '<script>'."\n";
1929 1929
 				print 'var urlSaveInPlace = \''.DOL_URL_ROOT.'/core/ajax/saveinplace.php\';'."\n";
1930 1930
 				print 'var urlLoadInPlace = \''.DOL_URL_ROOT.'/core/ajax/loadinplace.php\';'."\n";
@@ -1935,16 +1935,16 @@  discard block
 block discarded – undo
1935 1935
 				print 'var indicatorInPlace = \'<img src="'.DOL_URL_ROOT."/theme/".$conf->theme."/img/working.gif".'">\';'."\n";
1936 1936
 				print 'var withInPlace = 300;'; // width in pixel for default string edit
1937 1937
 				print '</script>'."\n";
1938
-				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/core/js/editinplace.js?' . $ext . '"></script>'."\n";
1939
-				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jeditable/jquery.jeditable.ckeditor.js?' . $ext . '"></script>'."\n";
1938
+				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/core/js/editinplace.js?'.$ext.'"></script>'."\n";
1939
+				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jeditable/jquery.jeditable.ckeditor.js?'.$ext.'"></script>'."\n";
1940 1940
 			}
1941 1941
 			if (!defined('DISABLE_SELECT2') && (getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT'))) {
1942 1942
 				// jQuery plugin "mutiselect", "multiple-select", "select2", ...
1943 1943
 				$tmpplugin = !getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') ? constant('REQUIRE_JQUERY_MULTISELECT') : getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT');
1944
-				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/'.$tmpplugin.'/dist/js/'.$tmpplugin.'.full.min.js?' . $ext . '"></script>'."\n"; // We include full because we need the support of containerCssClass
1944
+				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/'.$tmpplugin.'/dist/js/'.$tmpplugin.'.full.min.js?'.$ext.'"></script>'."\n"; // We include full because we need the support of containerCssClass
1945 1945
 			}
1946 1946
 			if (!defined('DISABLE_MULTISELECT')) {     // jQuery plugin "mutiselect" to select with checkboxes. Can be removed once we have an enhanced search tool
1947
-				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/multiselect/jquery.multi-select.js?' . $ext . '"></script>'."\n";
1947
+				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/multiselect/jquery.multi-select.js?'.$ext.'"></script>'."\n";
1948 1948
 			}
1949 1949
 		}
1950 1950
 
@@ -1961,11 +1961,11 @@  discard block
 block discarded – undo
1961 1961
 				print '<script nonce="'.getNonce().'">';
1962 1962
 				print '/* enable ckeditor by main.inc.php */';
1963 1963
 				print 'var CKEDITOR_BASEPATH = \''.dol_escape_js($pathckeditor).'\';'."\n";
1964
-				print 'var ckeditorConfig = \''.dol_escape_js(dol_buildpath($themesubdir.'/theme/'.$conf->theme.'/ckeditor/config.js?' . $ext, 1)).'\';'."\n"; // $themesubdir='' in standard usage
1964
+				print 'var ckeditorConfig = \''.dol_escape_js(dol_buildpath($themesubdir.'/theme/'.$conf->theme.'/ckeditor/config.js?'.$ext, 1)).'\';'."\n"; // $themesubdir='' in standard usage
1965 1965
 				print 'var ckeditorFilebrowserBrowseUrl = \''.DOL_URL_ROOT.'/core/filemanagerdol/browser/default/browser.php?Connector='.DOL_URL_ROOT.'/core/filemanagerdol/connectors/php/connector.php\';'."\n";
1966 1966
 				print 'var ckeditorFilebrowserImageBrowseUrl = \''.DOL_URL_ROOT.'/core/filemanagerdol/browser/default/browser.php?Type=Image&Connector='.DOL_URL_ROOT.'/core/filemanagerdol/connectors/php/connector.php\';'."\n";
1967 1967
 				print '</script>'."\n";
1968
-				print '<script src="'.$pathckeditor.$jsckeditor. '?' . $ext . '"></script>'."\n";
1968
+				print '<script src="'.$pathckeditor.$jsckeditor.'?'.$ext.'"></script>'."\n";
1969 1969
 				print '<script>';
1970 1970
 				if (GETPOST('mode', 'aZ09') == 'Full_inline') {
1971 1971
 					print 'CKEDITOR.disableAutoInline = false;'."\n";
@@ -1986,20 +1986,20 @@  discard block
 block discarded – undo
1986 1986
 				}
1987 1987
 				if ($enablebrowsernotif) {
1988 1988
 					print '<!-- Includes JS of Dolibarr (browser layout = '.$conf->browser->layout.')-->'."\n";
1989
-					print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/core/js/lib_notification.js.php?lang='.$langs->defaultlang. '&' . $ext . '"></script>'."\n";
1989
+					print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/core/js/lib_notification.js.php?lang='.$langs->defaultlang.'&'.$ext.'"></script>'."\n";
1990 1990
 				}
1991 1991
 			}
1992 1992
 
1993 1993
 			// Global js function
1994 1994
 			print '<!-- Includes JS of Dolibarr -->'."\n";
1995 1995
 			if (!defined('DISABLE_LIB_HEAD_JS')) {
1996
-				print '<script nonce="' . getNonce() . '" src="' . DOL_URL_ROOT . '/core/js/lib_head.js.php?lang=' . $langs->defaultlang . '&' . $ext . '"></script>' . "\n";
1996
+				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/core/js/lib_head.js.php?lang='.$langs->defaultlang.'&'.$ext.'"></script>'."\n";
1997 1997
 			}
1998 1998
 
1999 1999
 			// Leaflet
2000 2000
 			if (getDolGlobalString('MAIN_USE_GEOPHP')) {
2001
-				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/includes/leaflet/leaflet.js?' . $ext . '"></script>'."\n";
2002
-				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/includes/leaflet/leaflet-geoman.min.js?' . $ext . '"></script>'."\n";
2001
+				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/includes/leaflet/leaflet.js?'.$ext.'"></script>'."\n";
2002
+				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/includes/leaflet/leaflet-geoman.min.js?'.$ext.'"></script>'."\n";
2003 2003
 			}
2004 2004
 
2005 2005
 			// JS forced by modules (relative url starting with /)
@@ -2036,7 +2036,7 @@  discard block
 block discarded – undo
2036 2036
 		if (getDolGlobalString('ALLOW_THEME_JS')) {
2037 2037
 			$theme_js = dol_buildpath('/theme/'.$conf->theme.'/'.$conf->theme.'.js', 0);
2038 2038
 			if (file_exists($theme_js)) {
2039
-				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/'.$conf->theme.'.js?' . $ext . '"></script>'."\n";
2039
+				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/'.$conf->theme.'.js?'.$ext.'"></script>'."\n";
2040 2040
 			}
2041 2041
 		}
2042 2042
 
@@ -2044,7 +2044,7 @@  discard block
 block discarded – undo
2044 2044
 			print $head."\n";
2045 2045
 		}
2046 2046
 		if (getDolGlobalString('MAIN_HTML_HEADER')) {
2047
-			print getDolGlobalString('MAIN_HTML_HEADER') . "\n";
2047
+			print getDolGlobalString('MAIN_HTML_HEADER')."\n";
2048 2048
 		}
2049 2049
 
2050 2050
 		$parameters = array();
@@ -2172,7 +2172,7 @@  discard block
 block discarded – undo
2172 2172
 
2173 2173
 		$toprightmenu .= '</div>';
2174 2174
 
2175
-		$toprightmenu .= '</div>'."\n";		 // end div class="login_block_tools"
2175
+		$toprightmenu .= '</div>'."\n"; // end div class="login_block_tools"
2176 2176
 
2177 2177
 
2178 2178
 		// Add block for other tools
@@ -2193,7 +2193,7 @@  discard block
 block discarded – undo
2193 2193
 
2194 2194
 		// Link to module builder
2195 2195
 		if (isModEnabled('modulebuilder')) {
2196
-			$text = '<a href="' . dolBuildUrl(DOL_URL_ROOT . '/modulebuilder/index.php', ['mainmenu' => 'home', 'leftmenu' => 'admintools']) .'" target="modulebuilder">';
2196
+			$text = '<a href="'.dolBuildUrl(DOL_URL_ROOT.'/modulebuilder/index.php', ['mainmenu' => 'home', 'leftmenu' => 'admintools']).'" target="modulebuilder">';
2197 2197
 			//$text.= img_picto(":".$langs->trans("ModuleBuilder"), 'printer_top.png', 'class="printer"');
2198 2198
 			$text .= '<span class="fa fa-bug atoplogin valignmiddle"></span>';
2199 2199
 			$text .= '</a>';
@@ -2473,7 +2473,7 @@  discard block
 block discarded – undo
2473 2473
 	}
2474 2474
 
2475 2475
 	if (empty($urllogout)) {
2476
-		$urllogout = dolBuildUrl(DOL_URL_ROOT . '/user/logout.php', [], true);
2476
+		$urllogout = dolBuildUrl(DOL_URL_ROOT.'/user/logout.php', [], true);
2477 2477
 	}
2478 2478
 
2479 2479
 	// Defined the links for bottom of card
@@ -2882,7 +2882,7 @@  discard block
 block discarded – undo
2882 2882
 		$langs->load(explode('@', $item['name'])[1]);
2883 2883
 		$dropDownQuickAddHtml .= '
2884 2884
 			<a class="dropdown-item quickadd-item" href="'.DOL_URL_ROOT.$item['url'].'" title="'.$langs->trans(explode('@', $item['title'])[0]).'">
2885
-			'. img_picto('', $item['picto'], 'style="width:18px;"') . ' ' . $langs->trans(explode('@', $item['name'])[0]) . '</a>
2885
+			'. img_picto('', $item['picto'], 'style="width:18px;"').' '.$langs->trans(explode('@', $item['name'])[0]).'</a>
2886 2886
 		';
2887 2887
 	}
2888 2888
 
@@ -2987,7 +2987,7 @@  discard block
 block discarded – undo
2987 2987
  */
2988 2988
 function top_menu_search()
2989 2989
 {
2990
-	global $langs, $conf, $db, $user, $hookmanager;	// used by htdocs/core/ajax/selectsearchbox.php
2990
+	global $langs, $conf, $db, $user, $hookmanager; // used by htdocs/core/ajax/selectsearchbox.php
2991 2991
 
2992 2992
 	$html = '';
2993 2993
 
@@ -3675,7 +3675,7 @@  discard block
 block discarded – undo
3675 3675
 
3676 3676
 		if (!empty($conf->use_javascript_ajax)) {
3677 3677
 			print "\n".'<!-- Includes JS Footer of Dolibarr -->'."\n";
3678
-			print '<script src="'.DOL_URL_ROOT.'/core/js/lib_foot.js.php?lang='.$langs->defaultlang . '&' . $ext .'"></script>'."\n";
3678
+			print '<script src="'.DOL_URL_ROOT.'/core/js/lib_foot.js.php?lang='.$langs->defaultlang.'&'.$ext.'"></script>'."\n";
3679 3679
 		}
3680 3680
 
3681 3681
 		// JS wrapper to add log when clicking on download or preview
@@ -3727,7 +3727,7 @@  discard block
 block discarded – undo
3727 3727
 		$forceping = GETPOSTINT('forceping');
3728 3728
 
3729 3729
 		if (($_SERVER["PHP_SELF"] == DOL_URL_ROOT.'/index.php') || $forceping) {
3730
-			$hash_unique_id = dol_hash('dolibarr'.$conf->file->instance_unique_id, 'sha256');	// Note: if the global salt changes, this hash changes too so ping may be counted twice. We don't mind. It is for statistics purpose only.
3730
+			$hash_unique_id = dol_hash('dolibarr'.$conf->file->instance_unique_id, 'sha256'); // Note: if the global salt changes, this hash changes too so ping may be counted twice. We don't mind. It is for statistics purpose only.
3731 3731
 			$constanttosavelastko = 'MAIN_LAST_PING_KO_DATE';
3732 3732
 			$constanttosavefirstok = 'MAIN_FIRST_PING_OK_DATE';
3733 3733
 			$constanttosavefirstokid = 'MAIN_FIRST_PING_OK_ID';
@@ -3766,7 +3766,7 @@  discard block
 block discarded – undo
3766 3766
 			} elseif (!isRegistrationRecorded()) {
3767 3767
 				print "\n<!-- NO JS CODE TO ENABLE the registration. Registration data not saved -->\n";
3768 3768
 			} else {
3769
-				$hash_unique_id = dol_hash('dolibarr'.$conf->file->instance_unique_id, 'sha256');	// Note: if the global salt changes, this hash changes too so ping may be counted twice. We don't mind. It is for statistics purpose only.
3769
+				$hash_unique_id = dol_hash('dolibarr'.$conf->file->instance_unique_id, 'sha256'); // Note: if the global salt changes, this hash changes too so ping may be counted twice. We don't mind. It is for statistics purpose only.
3770 3770
 				$constanttosavelastko = 'MAIN_LAST_REGISTRATION_KO_DATE';
3771 3771
 				$constanttosavefirstok = 'MAIN_FIRST_REGISTRATION_OK_DATE';
3772 3772
 				$constanttosavefirstokid = 'MAIN_FIRST_REGISTRATION_OK_ID';
Please login to merge, or discard this patch.
htdocs/product/stock/replenish.php 1 patch
Spacing   +103 added lines, -103 removed lines patch added patch discarded remove patch
@@ -31,11 +31,11 @@  discard block
 block discarded – undo
31 31
 
32 32
 // Load Dolibarr environment
33 33
 require '../../main.inc.php';
34
-require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
35
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
36
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.form.class.php';
37
-require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.commande.class.php';
38
-require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php';
34
+require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
35
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
36
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
37
+require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
38
+require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
39 39
 require_once './lib/replenishment.lib.php';
40 40
 
41 41
 /**
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 $fk_entrepot = GETPOSTINT('fk_entrepot');
79 79
 
80 80
 // List all visible warehouses
81
-$resWar = $db->query("SELECT rowid FROM " . MAIN_DB_PREFIX . "entrepot WHERE entity IN (" . $db->sanitize(getEntity('stock')) . ")");
81
+$resWar = $db->query("SELECT rowid FROM ".MAIN_DB_PREFIX."entrepot WHERE entity IN (".$db->sanitize(getEntity('stock')).")");
82 82
 $listofqualifiedwarehousesid = "";
83 83
 $lastWarehouseID = 0;
84 84
 $count = 0;
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 		$db->begin();
177 177
 
178 178
 		$suppliers = array();
179
-		require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.product.class.php';
179
+		require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
180 180
 		$productsupplier = new ProductFournisseur($db);
181 181
 		for ($i = 0; $i < $linecount; $i++) {
182 182
 			if (GETPOST('choose'.$i) === 'on' && GETPOSTINT('fourn'.$i) > 0) {
@@ -216,10 +216,10 @@  discard block
 block discarded – undo
216 216
 
217 217
 						// If we use multicurrency
218 218
 						if (isModEnabled('multicurrency') && !empty($productsupplier->fourn_multicurrency_code) && $productsupplier->fourn_multicurrency_code != $conf->currency) {
219
-							$line->multicurrency_code 		= $productsupplier->fourn_multicurrency_code;
220
-							$line->fk_multicurrency 		= (int) $productsupplier->fourn_multicurrency_id;
219
+							$line->multicurrency_code = $productsupplier->fourn_multicurrency_code;
220
+							$line->fk_multicurrency = (int) $productsupplier->fourn_multicurrency_id;
221 221
 							$line->multicurrency_subprice 	= $productsupplier->fourn_multicurrency_unitprice;
222
-							$line->multicurrency_total_ht	= $line->multicurrency_subprice * $qty;
222
+							$line->multicurrency_total_ht = $line->multicurrency_subprice * $qty;
223 223
 							$line->multicurrency_total_tva	= $line->multicurrency_total_ht * $tva;
224 224
 							$line->multicurrency_total_ttc	= $line->multicurrency_total_ht + $line->multicurrency_total_tva;
225 225
 						}
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 						$line->total_tva = $line->total_ht * $tva;
229 229
 						$line->total_ttc = $line->total_ht + $line->total_tva;
230 230
 						$line->remise_percent = (float) $productsupplier->remise_percent;
231
-						$line->ref_fourn = $productsupplier->ref_supplier;	// deprecated
231
+						$line->ref_fourn = $productsupplier->ref_supplier; // deprecated
232 232
 						$line->ref_supplier = $productsupplier->ref_supplier;
233 233
 						$line->type = $productsupplier->type;
234 234
 						$line->fk_unit = $productsupplier->fk_unit;
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 					dol_print_error($db);
243 243
 				}
244 244
 
245
-				unset($_POST['fourn' . $i]);
245
+				unset($_POST['fourn'.$i]);
246 246
 			}
247 247
 			unset($_POST[$i]);
248 248
 		}
@@ -251,15 +251,15 @@  discard block
 block discarded – undo
251 251
 		$i = 0;
252 252
 		$fail = 0;
253 253
 		$orders = array();
254
-		$suppliersid = array_keys($suppliers);	// array of ids of suppliers
254
+		$suppliersid = array_keys($suppliers); // array of ids of suppliers
255 255
 		foreach ($suppliers as $supplier) {
256 256
 			$order = new CommandeFournisseur($db);
257 257
 
258 258
 			// Check if an order for the supplier exists
259
-			$sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "commande_fournisseur";
260
-			$sql .= " WHERE fk_soc = " . ((int) $suppliersid[$i]);
261
-			$sql .= " AND source = " . ((int) $order::SOURCE_ID_REPLENISHMENT) . " AND fk_statut = " . ((int) $order::STATUS_DRAFT);
262
-			$sql .= " AND entity IN (" . getEntity('commande_fournisseur') . ")";
259
+			$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."commande_fournisseur";
260
+			$sql .= " WHERE fk_soc = ".((int) $suppliersid[$i]);
261
+			$sql .= " AND source = ".((int) $order::SOURCE_ID_REPLENISHMENT)." AND fk_statut = ".((int) $order::STATUS_DRAFT);
262
+			$sql .= " AND entity IN (".getEntity('commande_fournisseur').")";
263 263
 			$sql .= " ORDER BY date_creation DESC";
264 264
 			$resql = $db->query($sql);
265 265
 			if ($resql && $db->num_rows($resql) > 0) {
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 				}
298 298
 				if ($result < 0) {
299 299
 					$fail++;
300
-					$msg = $langs->trans('OrderFail') . "&nbsp;:&nbsp;";
300
+					$msg = $langs->trans('OrderFail')."&nbsp;:&nbsp;";
301 301
 					$msg .= $order->error;
302 302
 					setEventMessages($msg, null, 'errors');
303 303
 				} else {
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 				$id = $order->create($user);
325 325
 				if ($id < 0) {
326 326
 					$fail++;
327
-					$msg = $langs->trans('OrderFail') . "&nbsp;:&nbsp;";
327
+					$msg = $langs->trans('OrderFail')."&nbsp;:&nbsp;";
328 328
 					$msg .= $order->error;
329 329
 					setEventMessages($msg, null, 'errors');
330 330
 				}
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
 if (getDolGlobalString('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) {
378 378
 	$sql .= ' pse.desiredstock as desiredstockpse, pse.seuil_stock_alerte as seuil_stock_alertepse,';
379 379
 }
380
-$sql .= " " . $sqldesiredtock . " as desiredstockcombined, " . $sqlalertstock . " as seuil_stock_alertecombined,";
380
+$sql .= " ".$sqldesiredtock." as desiredstockcombined, ".$sqlalertstock." as seuil_stock_alertecombined,";
381 381
 $sql .= ' s.fk_product,';
382 382
 $sql .= " SUM(".$db->ifsql("s.reel IS NULL", "0", "s.reel").') as stock_physique';
383 383
 if (getDolGlobalString('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) {
@@ -391,12 +391,12 @@  discard block
 block discarded – undo
391 391
 
392 392
 $list_warehouse = (empty($listofqualifiedwarehousesid) ? '0' : $listofqualifiedwarehousesid);
393 393
 
394
-$sql .= ' FROM ' . MAIN_DB_PREFIX . 'product as p';
395
-$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'product_stock as s ON p.rowid = s.fk_product';
396
-$sql .= ' AND s.fk_entrepot  IN (' . $db->sanitize($list_warehouse) . ')';
394
+$sql .= ' FROM '.MAIN_DB_PREFIX.'product as p';
395
+$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as s ON p.rowid = s.fk_product';
396
+$sql .= ' AND s.fk_entrepot  IN ('.$db->sanitize($list_warehouse).')';
397 397
 
398 398
 $list_warehouse_selected = ($fk_entrepot < 0 || empty($fk_entrepot)) ? $list_warehouse : $fk_entrepot;
399
-$sql .= ' AND s.fk_entrepot  IN (' . $db->sanitize($list_warehouse_selected) . ')';
399
+$sql .= ' AND s.fk_entrepot  IN ('.$db->sanitize($list_warehouse_selected).')';
400 400
 
401 401
 
402 402
 //$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot AS ent ON s.fk_entrepot = ent.rowid AND ent.entity IN('.getEntity('stock').')';
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
 $reshook = $hookmanager->executeHooks('printFieldListJoin', $parameters); // Note that $action and $object may have been modified by hook
409 409
 $sql .= $hookmanager->resPrint;
410 410
 
411
-$sql .= ' WHERE p.entity IN (' . getEntity('product') . ')';
411
+$sql .= ' WHERE p.entity IN ('.getEntity('product').')';
412 412
 if ($sall) {
413 413
 	$sql .= natural_search(array('p.ref', 'p.label', 'p.description', 'p.note'), $sall);
414 414
 }
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 	$sql .= ' AND p.rowid NOT IN (SELECT pac.fk_product_parent FROM '.MAIN_DB_PREFIX.'product_attribute_combination as pac WHERE pac.entity IN ('.getEntity('product').'))';
432 432
 }
433 433
 if ($fk_supplier > 0) {
434
-	$sql .= ' AND EXISTS (SELECT pfp.rowid FROM ' . MAIN_DB_PREFIX . 'product_fournisseur_price as pfp WHERE pfp.fk_product = p.rowid AND pfp.fk_soc = ' . ((int) $fk_supplier) . ' AND pfp.entity IN (' . getEntity('productsupplierprice') . '))';
434
+	$sql .= ' AND EXISTS (SELECT pfp.rowid FROM '.MAIN_DB_PREFIX.'product_fournisseur_price as pfp WHERE pfp.fk_product = p.rowid AND pfp.fk_soc = '.((int) $fk_supplier).' AND pfp.entity IN ('.getEntity('productsupplierprice').'))';
435 435
 }
436 436
 // Add where from hooks
437 437
 $parameters = array();
@@ -476,9 +476,9 @@  discard block
 block discarded – undo
476 476
 	}
477 477
 
478 478
 	if (isModEnabled("supplier_order")) {
479
-		$sqlCommandesFourn = "(SELECT " . $db->ifsql("SUM(cd3.qty) IS NULL", "0", "SUM(cd3.qty)") . " as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL
480
-		$sqlCommandesFourn .= " FROM " . MAIN_DB_PREFIX . "commande_fournisseurdet as cd3,";
481
-		$sqlCommandesFourn .= " " . MAIN_DB_PREFIX . "commande_fournisseur as c3";
479
+		$sqlCommandesFourn = "(SELECT ".$db->ifsql("SUM(cd3.qty) IS NULL", "0", "SUM(cd3.qty)")." as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL
480
+		$sqlCommandesFourn .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as cd3,";
481
+		$sqlCommandesFourn .= " ".MAIN_DB_PREFIX."commande_fournisseur as c3";
482 482
 		$sqlCommandesFourn .= " WHERE c3.rowid = cd3.fk_commande";
483 483
 		$sqlCommandesFourn .= " AND c3.entity IN (".getEntity(getDolGlobalString('STOCK_CALCULATE_VIRTUAL_STOCK_TRANSVERSE_MODE') ? 'stock' : 'supplier_order').")";
484 484
 		$sqlCommandesFourn .= " AND cd3.fk_product = p.rowid";
@@ -517,15 +517,15 @@  discard block
 block discarded – undo
517 517
 	}
518 518
 
519 519
 	$sql .= ' HAVING (';
520
-	$sql .= " (" . $sqldesiredtock . " >= 0 AND (" . $sqldesiredtock . " > SUM(" . $db->ifsql("s.reel IS NULL", "0", "s.reel") . ')';
521
-	$sql .= " - (" . $sqlCommandesCli . " - " . $sqlExpeditionsCli . ") + (" . $sqlCommandesFourn . " - " . $sqlReceptionFourn . ") + (" . $sqlProductionToProduce . " - " . $sqlProductionToConsume . ")))";
520
+	$sql .= " (".$sqldesiredtock." >= 0 AND (".$sqldesiredtock." > SUM(".$db->ifsql("s.reel IS NULL", "0", "s.reel").')';
521
+	$sql .= " - (".$sqlCommandesCli." - ".$sqlExpeditionsCli.") + (".$sqlCommandesFourn." - ".$sqlReceptionFourn.") + (".$sqlProductionToProduce." - ".$sqlProductionToConsume.")))";
522 522
 	$sql .= ' OR';
523 523
 	if ($includeproductswithoutdesiredqty == 'on') {
524
-		$sql .= " ((" . $sqlalertstock . " >= 0 OR " . $sqlalertstock . " IS NULL) AND (" . $db->ifsql($sqlalertstock . " IS NULL", "0", $sqlalertstock) . " > SUM(" . $db->ifsql("s.reel IS NULL", "0", "s.reel") . ")";
524
+		$sql .= " ((".$sqlalertstock." >= 0 OR ".$sqlalertstock." IS NULL) AND (".$db->ifsql($sqlalertstock." IS NULL", "0", $sqlalertstock)." > SUM(".$db->ifsql("s.reel IS NULL", "0", "s.reel").")";
525 525
 	} else {
526
-		$sql .= " (" . $sqlalertstock . " >= 0 AND (" . $sqlalertstock . " > SUM(" . $db->ifsql("s.reel IS NULL", "0", "s.reel") . ')';
526
+		$sql .= " (".$sqlalertstock." >= 0 AND (".$sqlalertstock." > SUM(".$db->ifsql("s.reel IS NULL", "0", "s.reel").')';
527 527
 	}
528
-	$sql .= " - (" . $sqlCommandesCli . " - " . $sqlExpeditionsCli . ") + (" . $sqlCommandesFourn . " - " . $sqlReceptionFourn . ") + (" . $sqlProductionToProduce . " - " . $sqlProductionToConsume . ")))";
528
+	$sql .= " - (".$sqlCommandesCli." - ".$sqlExpeditionsCli.") + (".$sqlCommandesFourn." - ".$sqlReceptionFourn.") + (".$sqlProductionToProduce." - ".$sqlProductionToConsume.")))";
529 529
 	$sql .= ")";
530 530
 	if (getDolGlobalString('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) {
531 531
 		$sql .= " AND (";
@@ -535,22 +535,22 @@  discard block
 block discarded – undo
535 535
 	if ($salert == 'on') {    // Option to see when stock is lower than alert
536 536
 		$sql .= ' AND (';
537 537
 		if ($includeproductswithoutdesiredqty == 'on') {
538
-			$sql .= "(" . $sqlalertstock . " >= 0 OR " . $sqlalertstock . " IS NULL) AND (" . $db->ifsql($sqlalertstock . " IS NULL", "0", $sqlalertstock) . " > SUM(" . $db->ifsql("s.reel IS NULL", "0", "s.reel") . ")";
538
+			$sql .= "(".$sqlalertstock." >= 0 OR ".$sqlalertstock." IS NULL) AND (".$db->ifsql($sqlalertstock." IS NULL", "0", $sqlalertstock)." > SUM(".$db->ifsql("s.reel IS NULL", "0", "s.reel").")";
539 539
 		} else {
540
-			$sql .= $sqlalertstock . " >= 0 AND (" . $sqlalertstock . " > SUM(" . $db->ifsql("s.reel IS NULL", "0", "s.reel") . ")";
540
+			$sql .= $sqlalertstock." >= 0 AND (".$sqlalertstock." > SUM(".$db->ifsql("s.reel IS NULL", "0", "s.reel").")";
541 541
 		}
542
-		$sql .= " - (" . $sqlCommandesCli . " - " . $sqlExpeditionsCli . ") + (" . $sqlCommandesFourn . " - " . $sqlReceptionFourn . ")  + (" . $sqlProductionToProduce . " - " . $sqlProductionToConsume . "))";
542
+		$sql .= " - (".$sqlCommandesCli." - ".$sqlExpeditionsCli.") + (".$sqlCommandesFourn." - ".$sqlReceptionFourn.")  + (".$sqlProductionToProduce." - ".$sqlProductionToConsume."))";
543 543
 		$sql .= ")";
544 544
 		$alertchecked = 'checked';
545 545
 	}
546 546
 } else {
547 547
 	$sql .= ' HAVING (';
548
-	$sql .= "(" . $sqldesiredtock . " >= 0 AND (" . $sqldesiredtock . " > SUM(" . $db->ifsql("s.reel IS NULL", "0", "s.reel") . ")))";
548
+	$sql .= "(".$sqldesiredtock." >= 0 AND (".$sqldesiredtock." > SUM(".$db->ifsql("s.reel IS NULL", "0", "s.reel").")))";
549 549
 	$sql .= ' OR';
550 550
 	if ($includeproductswithoutdesiredqty == 'on') {
551
-		$sql .= " ((" . $sqlalertstock . " >= 0 OR " . $sqlalertstock . " IS NULL) AND (" . $db->ifsql($sqlalertstock . " IS NULL", "0", $sqlalertstock) . " > SUM(" . $db->ifsql("s.reel IS NULL", "0", "s.reel") . ')))';
551
+		$sql .= " ((".$sqlalertstock." >= 0 OR ".$sqlalertstock." IS NULL) AND (".$db->ifsql($sqlalertstock." IS NULL", "0", $sqlalertstock)." > SUM(".$db->ifsql("s.reel IS NULL", "0", "s.reel").')))';
552 552
 	} else {
553
-		$sql .= " (" . $sqlalertstock . " >= 0 AND (" . $sqlalertstock . " > SUM(" . $db->ifsql("s.reel IS NULL", "0", "s.reel") . ')))';
553
+		$sql .= " (".$sqlalertstock." >= 0 AND (".$sqlalertstock." > SUM(".$db->ifsql("s.reel IS NULL", "0", "s.reel").')))';
554 554
 	}
555 555
 	$sql .= ')';
556 556
 	if (getDolGlobalString('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) {
@@ -561,9 +561,9 @@  discard block
 block discarded – undo
561 561
 	if ($salert == 'on') {    // Option to see when stock is lower than alert
562 562
 		$sql .= " AND (";
563 563
 		if ($includeproductswithoutdesiredqty == 'on') {
564
-			$sql .= " (" . $sqlalertstock . " >= 0 OR " . $sqlalertstock . " IS NULL) AND (" . $db->ifsql($sqlalertstock . " IS NULL", "0", $sqlalertstock) . " > SUM(" . $db->ifsql("s.reel IS NULL", "0", "s.reel") . "))";
564
+			$sql .= " (".$sqlalertstock." >= 0 OR ".$sqlalertstock." IS NULL) AND (".$db->ifsql($sqlalertstock." IS NULL", "0", $sqlalertstock)." > SUM(".$db->ifsql("s.reel IS NULL", "0", "s.reel")."))";
565 565
 		} else {
566
-			$sql .= " " . $sqlalertstock . " >= 0 AND (" . $sqlalertstock . " > SUM(" . $db->ifsql("s.reel IS NULL", "0", "s.reel") . '))';
566
+			$sql .= " ".$sqlalertstock." >= 0 AND (".$sqlalertstock." > SUM(".$db->ifsql("s.reel IS NULL", "0", "s.reel").'))';
567 567
 		}
568 568
 		$sql .= ')';
569 569
 		$alertchecked = 'checked';
@@ -605,11 +605,11 @@  discard block
 block discarded – undo
605 605
 
606 606
 $head = array();
607 607
 
608
-$head[0][0] = DOL_URL_ROOT . '/product/stock/replenish.php';
608
+$head[0][0] = DOL_URL_ROOT.'/product/stock/replenish.php';
609 609
 $head[0][1] = $title;
610 610
 $head[0][2] = 'replenish';
611 611
 
612
-$head[1][0] = DOL_URL_ROOT . '/product/stock/replenishorders.php';
612
+$head[1][0] = DOL_URL_ROOT.'/product/stock/replenishorders.php';
613 613
 $head[1][1] = $langs->trans("ReplenishmentOrders");
614 614
 $head[1][2] = 'replenishorders';
615 615
 
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
 
619 619
 print dol_get_fiche_head($head, 'replenish', '', -1, '');
620 620
 
621
-print '<span class="opacitymedium">' . $langs->trans("ReplenishmentStatusDesc") . '</span>' . "\n";
621
+print '<span class="opacitymedium">'.$langs->trans("ReplenishmentStatusDesc").'</span>'."\n";
622 622
 
623 623
 //$link = '<a title=' .$langs->trans("MenuNewWarehouse"). ' href="'.DOL_URL_ROOT.'/product/stock/card.php?action=create">'.$langs->trans("MenuNewWarehouse").'</a>';
624 624
 
@@ -627,39 +627,39 @@  discard block
 block discarded – undo
627 627
 }
628 628
 print '<br><br>';
629 629
 if ($usevirtualstock == 1) {
630
-	print $langs->trans("CurentSelectionMode") . ': ';
631
-	print '<span class="a-mesure">' . $langs->trans("UseVirtualStock") . '</span>';
632
-	print ' <a class="a-mesure-disabled" href="' . $_SERVER["PHP_SELF"] . '?mode=physical' . ($fk_supplier > 0 ? '&fk_supplier=' . $fk_supplier : '') . ($fk_entrepot > 0 ? '&fk_entrepot=' . $fk_entrepot : '') . '">' . $langs->trans("UsePhysicalStock") . '</a>';
630
+	print $langs->trans("CurentSelectionMode").': ';
631
+	print '<span class="a-mesure">'.$langs->trans("UseVirtualStock").'</span>';
632
+	print ' <a class="a-mesure-disabled" href="'.$_SERVER["PHP_SELF"].'?mode=physical'.($fk_supplier > 0 ? '&fk_supplier='.$fk_supplier : '').($fk_entrepot > 0 ? '&fk_entrepot='.$fk_entrepot : '').'">'.$langs->trans("UsePhysicalStock").'</a>';
633 633
 	print '<br>';
634 634
 }
635 635
 if ($usevirtualstock == 0) {
636
-	print $langs->trans("CurentSelectionMode") . ': ';
637
-	print '<a class="a-mesure-disabled" href="' . $_SERVER["PHP_SELF"] . '?mode=virtual' . ($fk_supplier > 0 ? '&fk_supplier=' . $fk_supplier : '') . ($fk_entrepot > 0 ? '&fk_entrepot=' . $fk_entrepot : '') . '">' . $langs->trans("UseVirtualStock") . '</a>';
638
-	print ' <span class="a-mesure">' . $langs->trans("UsePhysicalStock") . '</span>';
636
+	print $langs->trans("CurentSelectionMode").': ';
637
+	print '<a class="a-mesure-disabled" href="'.$_SERVER["PHP_SELF"].'?mode=virtual'.($fk_supplier > 0 ? '&fk_supplier='.$fk_supplier : '').($fk_entrepot > 0 ? '&fk_entrepot='.$fk_entrepot : '').'">'.$langs->trans("UseVirtualStock").'</a>';
638
+	print ' <span class="a-mesure">'.$langs->trans("UsePhysicalStock").'</span>';
639 639
 	print '<br>';
640 640
 }
641
-print '<br>' . "\n";
641
+print '<br>'."\n";
642 642
 
643
-print '<form name="formFilterWarehouse" method="POST" action="' . $_SERVER["PHP_SELF"] . '">';
644
-print '<input type="hidden" name="token" value="' . newToken() . '">';
643
+print '<form name="formFilterWarehouse" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
644
+print '<input type="hidden" name="token" value="'.newToken().'">';
645 645
 print '<input type="hidden" name="action" value="filter">';
646
-print '<input type="hidden" name="search_ref" value="' . $search_ref . '">';
647
-print '<input type="hidden" name="search_label" value="' . $search_label . '">';
648
-print '<input type="hidden" name="salert" value="' . $salert . '">';
649
-print '<input type="hidden" name="includeproductswithoutdesiredqty" value="' . $includeproductswithoutdesiredqty . '">';
650
-print '<input type="hidden" name="draftorder" value="' . $draftorder . '">';
651
-print '<input type="hidden" name="mode" value="' . $mode . '">';
646
+print '<input type="hidden" name="search_ref" value="'.$search_ref.'">';
647
+print '<input type="hidden" name="search_label" value="'.$search_label.'">';
648
+print '<input type="hidden" name="salert" value="'.$salert.'">';
649
+print '<input type="hidden" name="includeproductswithoutdesiredqty" value="'.$includeproductswithoutdesiredqty.'">';
650
+print '<input type="hidden" name="draftorder" value="'.$draftorder.'">';
651
+print '<input type="hidden" name="mode" value="'.$mode.'">';
652 652
 if ($limit > 0 && $limit != $conf->liste_limit) {
653
-	print '<input type="hidden" name="limit" value="' . $limit . '">';
653
+	print '<input type="hidden" name="limit" value="'.$limit.'">';
654 654
 }
655 655
 if (getDolGlobalString('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE')) {
656 656
 	print '<div class="inline-block valignmiddle" style="padding-right: 20px;">';
657
-	print $langs->trans('Warehouse') . ' ' . $formproduct->selectWarehouses((int) $fk_entrepot, 'fk_entrepot', '', 1);
657
+	print $langs->trans('Warehouse').' '.$formproduct->selectWarehouses((int) $fk_entrepot, 'fk_entrepot', '', 1);
658 658
 	print '</div>';
659 659
 }
660 660
 print '<div class="inline-block valignmiddle" style="padding-right: 20px;">';
661 661
 $filter = '(fournisseur:=:1)';
662
-print $langs->trans('Supplier') . ' ' . $form->select_company($fk_supplier, 'fk_supplier', $filter, 1);
662
+print $langs->trans('Supplier').' '.$form->select_company($fk_supplier, 'fk_supplier', $filter, 1);
663 663
 print '</div>';
664 664
 
665 665
 $parameters = array();
@@ -669,29 +669,29 @@  discard block
 block discarded – undo
669 669
 }
670 670
 
671 671
 print '<div class="inline-block valignmiddle">';
672
-print '<input type="submit" class="button smallpaddingimp" name="valid" value="' . $langs->trans('ToFilter') . '">';
672
+print '<input type="submit" class="button smallpaddingimp" name="valid" value="'.$langs->trans('ToFilter').'">';
673 673
 print '</div>';
674 674
 
675 675
 print '</form>';
676 676
 
677
-print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="formulaire">';
678
-print '<input type="hidden" name="token" value="' . newToken() . '">';
679
-print '<input type="hidden" name="fk_supplier" value="' . $fk_supplier . '">';
680
-print '<input type="hidden" name="fk_entrepot" value="' . $fk_entrepot . '">';
681
-print '<input type="hidden" name="sortfield" value="' . $sortfield . '">';
682
-print '<input type="hidden" name="sortorder" value="' . $sortorder . '">';
683
-print '<input type="hidden" name="type" value="' . $type . '">';
684
-print '<input type="hidden" name="linecount" value="' . $num . '">';
677
+print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formulaire">';
678
+print '<input type="hidden" name="token" value="'.newToken().'">';
679
+print '<input type="hidden" name="fk_supplier" value="'.$fk_supplier.'">';
680
+print '<input type="hidden" name="fk_entrepot" value="'.$fk_entrepot.'">';
681
+print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
682
+print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
683
+print '<input type="hidden" name="type" value="'.$type.'">';
684
+print '<input type="hidden" name="linecount" value="'.$num.'">';
685 685
 print '<input type="hidden" name="action" value="order">';
686
-print '<input type="hidden" name="mode" value="' . $mode . '">';
686
+print '<input type="hidden" name="mode" value="'.$mode.'">';
687 687
 
688 688
 
689 689
 if ($search_ref || $search_label || $sall || $salert || $draftorder || GETPOST('search', 'alpha')) {
690
-	$filters = '&search_ref=' . urlencode($search_ref) . '&search_label=' . urlencode($search_label);
691
-	$filters .= '&sall=' . urlencode($sall);
692
-	$filters .= '&salert=' . urlencode($salert);
693
-	$filters .= '&draftorder=' . urlencode($draftorder);
694
-	$filters .= '&mode=' . urlencode($mode);
690
+	$filters = '&search_ref='.urlencode($search_ref).'&search_label='.urlencode($search_label);
691
+	$filters .= '&sall='.urlencode($sall);
692
+	$filters .= '&salert='.urlencode($salert);
693
+	$filters .= '&draftorder='.urlencode($draftorder);
694
+	$filters .= '&mode='.urlencode($mode);
695 695
 	if ($fk_supplier > 0) {
696 696
 		$filters .= '&fk_supplier='.urlencode((string) ($fk_supplier));
697 697
 	}
@@ -713,7 +713,7 @@  discard block
 block discarded – undo
713 713
 	}
714 714
 }
715 715
 if ($limit > 0 && $limit != $conf->liste_limit) {
716
-	$filters .= '&limit=' . ((int) $limit);
716
+	$filters .= '&limit='.((int) $limit);
717 717
 }
718 718
 if (!empty($includeproductswithoutdesiredqty)) {
719 719
 	$filters .= '&includeproductswithoutdesiredqty='.urlencode($includeproductswithoutdesiredqty);
@@ -793,12 +793,12 @@  discard block
 block discarded – undo
793 793
 // Fields title search
794 794
 print '<tr class="liste_titre_filter">';
795 795
 print '<td class="liste_titre">&nbsp;</td>';
796
-print '<td class="liste_titre"><input class="flat" type="text" name="search_ref" size="8" value="' . dol_escape_htmltag($search_ref) . '"></td>';
797
-print '<td class="liste_titre"><input class="flat" type="text" name="search_label" size="8" value="' . dol_escape_htmltag($search_label) . '"></td>';
796
+print '<td class="liste_titre"><input class="flat" type="text" name="search_ref" size="8" value="'.dol_escape_htmltag($search_ref).'"></td>';
797
+print '<td class="liste_titre"><input class="flat" type="text" name="search_label" size="8" value="'.dol_escape_htmltag($search_label).'"></td>';
798 798
 if (isModEnabled("service") && $type == 1) {
799 799
 	print '<td class="liste_titre">&nbsp;</td>';
800 800
 }
801
-print '<td class="liste_titre right">' . $form->textwithpicto($langs->trans('IncludeEmptyDesiredStock'), $langs->trans('IncludeProductWithUndefinedAlerts')) . '&nbsp;<input type="checkbox" id="includeproductswithoutdesiredqty" name="includeproductswithoutdesiredqty" ' . (!empty($includeproductswithoutdesiredqtychecked) ? $includeproductswithoutdesiredqtychecked : '') . '></td>';
801
+print '<td class="liste_titre right">'.$form->textwithpicto($langs->trans('IncludeEmptyDesiredStock'), $langs->trans('IncludeProductWithUndefinedAlerts')).'&nbsp;<input type="checkbox" id="includeproductswithoutdesiredqty" name="includeproductswithoutdesiredqty" '.(!empty($includeproductswithoutdesiredqtychecked) ? $includeproductswithoutdesiredqtychecked : '').'></td>';
802 802
 print '<td class="liste_titre right"></td>';
803 803
 print '<td class="liste_titre right">'.$langs->trans('AlertOnly').'&nbsp;<input type="checkbox" id="salert" name="salert" '.(!empty($alertchecked) ? $alertchecked : '').'></td>';
804 804
 if (getDolGlobalString('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) {
@@ -861,9 +861,9 @@  discard block
 block discarded – undo
861 861
 		// Multilangs
862 862
 		if (getDolGlobalInt('MAIN_MULTILANGS')) {
863 863
 			$sql = 'SELECT label,description';
864
-			$sql .= ' FROM ' . MAIN_DB_PREFIX . 'product_lang';
865
-			$sql .= ' WHERE fk_product = ' . ((int) $objp->rowid);
866
-			$sql .= " AND lang = '" . $db->escape($langs->getDefaultLang()) . "'";
864
+			$sql .= ' FROM '.MAIN_DB_PREFIX.'product_lang';
865
+			$sql .= ' WHERE fk_product = '.((int) $objp->rowid);
866
+			$sql .= " AND lang = '".$db->escape($langs->getDefaultLang())."'";
867 867
 			$sql .= ' LIMIT 1';
868 868
 
869 869
 			$resqlm = $db->query($sql);
@@ -915,11 +915,11 @@  discard block
 block discarded – undo
915 915
 
916 916
 		$warning = '';
917 917
 		if ($alertstock && ($stock < $alertstock)) {
918
-			$warning = img_warning($langs->trans('StockTooLow')) . ' ';
918
+			$warning = img_warning($langs->trans('StockTooLow')).' ';
919 919
 		}
920 920
 		$warningwarehouse = '';
921 921
 		if ($alertstockwarehouse && ($stockwarehouse < $alertstockwarehouse)) {
922
-			$warningwarehouse = img_warning($langs->trans('StockTooLow')) . ' ';
922
+			$warningwarehouse = img_warning($langs->trans('StockTooLow')).' ';
923 923
 		}
924 924
 
925 925
 		//depending on conf, use either physical stock or
@@ -952,38 +952,38 @@  discard block
 block discarded – undo
952 952
 		print '<tr class="oddeven">';
953 953
 
954 954
 		// Select field
955
-		print '<td><input type="checkbox" class="check" name="choose' . $i . '"></td>';
955
+		print '<td><input type="checkbox" class="check" name="choose'.$i.'"></td>';
956 956
 
957
-		print '<td class="nowrap">' . $prod->getNomUrl(1, 'stock') . '</td>';
957
+		print '<td class="nowrap">'.$prod->getNomUrl(1, 'stock').'</td>';
958 958
 
959
-		print '<td class="tdoverflowmax200" title="' . dol_escape_htmltag($objp->label) . '">';
959
+		print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($objp->label).'">';
960 960
 		print dol_escape_htmltag($objp->label);
961
-		print '<input type="hidden" name="desc' . $i . '" value="' . dol_escape_htmltag($objp->description) . '">'; // TODO Remove this and make a fetch to get description when creating order instead of a GETPOST
961
+		print '<input type="hidden" name="desc'.$i.'" value="'.dol_escape_htmltag($objp->description).'">'; // TODO Remove this and make a fetch to get description when creating order instead of a GETPOST
962 962
 		print '</td>';
963 963
 
964 964
 		if (isModEnabled("service") && $type == 1) {
965 965
 			$regs = array();
966 966
 			if (preg_match('/([0-9]+)y/i', $objp->duration, $regs)) {
967
-				$duration = $regs[1] . ' ' . $langs->trans('DurationYear');
967
+				$duration = $regs[1].' '.$langs->trans('DurationYear');
968 968
 			} elseif (preg_match('/([0-9]+)m/i', $objp->duration, $regs)) {
969
-				$duration = $regs[1] . ' ' . $langs->trans('DurationMonth');
969
+				$duration = $regs[1].' '.$langs->trans('DurationMonth');
970 970
 			} elseif (preg_match('/([0-9]+)d/i', $objp->duration, $regs)) {
971
-				$duration = $regs[1] . ' ' . $langs->trans('DurationDay');
971
+				$duration = $regs[1].' '.$langs->trans('DurationDay');
972 972
 			} else {
973 973
 				$duration = $objp->duration;
974 974
 			}
975
-			print '<td class="center">' . $duration . '</td>';
975
+			print '<td class="center">'.$duration.'</td>';
976 976
 		}
977 977
 
978 978
 		// Desired stock
979
-		print '<td class="right">'.((getDolGlobalString('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) > 0 ? ($objp->desiredstockpse ? $desiredstockwarehouse : img_info($langs->trans('ProductValuesUsedBecauseNoValuesForThisWarehouse')) . '0') : $desiredstock).'</td>';
979
+		print '<td class="right">'.((getDolGlobalString('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) > 0 ? ($objp->desiredstockpse ? $desiredstockwarehouse : img_info($langs->trans('ProductValuesUsedBecauseNoValuesForThisWarehouse')).'0') : $desiredstock).'</td>';
980 980
 
981 981
 		// Limit stock for alert
982
-		print '<td class="right">'.((getDolGlobalString('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) > 0 ? ($objp->seuil_stock_alertepse ? $alertstockwarehouse : img_info($langs->trans('ProductValuesUsedBecauseNoValuesForThisWarehouse')) . '0') : $alertstock).'</td>';
982
+		print '<td class="right">'.((getDolGlobalString('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) > 0 ? ($objp->seuil_stock_alertepse ? $alertstockwarehouse : img_info($langs->trans('ProductValuesUsedBecauseNoValuesForThisWarehouse')).'0') : $alertstock).'</td>';
983 983
 
984 984
 		// Current stock (all warehouses)
985
-		print '<td class="right">' . $warning . price(price2num($stock, 'MS'));
986
-		print '<!-- stock returned by main sql is ' . $objp->stock_physique . ' -->';
985
+		print '<td class="right">'.$warning.price(price2num($stock, 'MS'));
986
+		print '<!-- stock returned by main sql is '.$objp->stock_physique.' -->';
987 987
 		print '</td>';
988 988
 
989 989
 		// Current stock (warehouse selected only)
@@ -992,7 +992,7 @@  discard block
 block discarded – undo
992 992
 		}
993 993
 
994 994
 		// Already ordered
995
-		print '<td class="right"><a href="replenishorders.php?search_product=' . $prod->id . '">' . $ordered . '</a> ' . $picto . '</td>';
995
+		print '<td class="right"><a href="replenishorders.php?search_product='.$prod->id.'">'.$ordered.'</a> '.$picto.'</td>';
996 996
 
997 997
 		// To order
998 998
 		$tobuy = ((getDolGlobalString('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) > 0 ? $stocktobuywarehouse : $stocktobuy);
@@ -1000,7 +1000,7 @@  discard block
 block discarded – undo
1000 1000
 
1001 1001
 		// Supplier
1002 1002
 		print '<td class="right">';
1003
-		print $form->select_product_fourn_price($prod->id, 'fourn' . $i, $fk_supplier);
1003
+		print $form->select_product_fourn_price($prod->id, 'fourn'.$i, $fk_supplier);
1004 1004
 		print '</td>';
1005 1005
 
1006 1006
 		// Fields from hook
@@ -1021,7 +1021,7 @@  discard block
 block discarded – undo
1021 1021
 	if (getDolGlobalString('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) {
1022 1022
 		$colspan++;
1023 1023
 	}
1024
-	print '<tr><td colspan="' . $colspan . '">';
1024
+	print '<tr><td colspan="'.$colspan.'">';
1025 1025
 	print '<span class="opacitymedium">';
1026 1026
 	print $langs->trans("None");
1027 1027
 	print '</span>';
@@ -1041,7 +1041,7 @@  discard block
 block discarded – undo
1041 1041
 
1042 1042
 
1043 1043
 $value = $langs->trans("CreateOrders");
1044
-print '<div class="center"><input type="submit" class="button" name="valid" value="' . $value . '"></div>';
1044
+print '<div class="center"><input type="submit" class="button" name="valid" value="'.$value.'"></div>';
1045 1045
 
1046 1046
 
1047 1047
 print '</form>';
Please login to merge, or discard this patch.
htdocs/webhook/triggerhistory_list.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
54 54
 $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
55 55
 $mode = GETPOST('mode', 'aZ'); // The display mode ('list', 'kanban', 'hierarchy', 'calendar', 'gantt', ...)
56
-$groupby = GETPOST('groupby', 'aZ09');	// Example: $groupby = 'p.fk_opp_status' or $groupby = 'p.fk_statut'
56
+$groupby = GETPOST('groupby', 'aZ09'); // Example: $groupby = 'p.fk_opp_status' or $groupby = 'p.fk_statut'
57 57
 
58 58
 $id = GETPOSTINT('id');
59 59
 $ref = GETPOST('ref', 'alpha');
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 $object = new TriggerHistory($db);
76 76
 $extrafields = new ExtraFields($db);
77 77
 $diroutputmassaction = $conf->webhook->dir_output.'/temp/massgeneration/'.$user->id;
78
-$hookmanager->initHooks(array($contextpage)); 	// Note that conf->hooks_modules contains array of activated contexes
78
+$hookmanager->initHooks(array($contextpage)); // Note that conf->hooks_modules contains array of activated contexes
79 79
 
80 80
 // Fetch optionals attributes and labels
81 81
 $extrafields->fetch_name_optionals_label($object->table_element);
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 
86 86
 // Default sort order (if not yet defined by previous GETPOST)
87 87
 if (!$sortfield) {
88
-	reset($object->fields);					// Reset is required to avoid key() to return null.
88
+	reset($object->fields); // Reset is required to avoid key() to return null.
89 89
 	$sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition.
90 90
 }
91 91
 if (!$sortorder) {
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 // Output page
414 414
 // --------------------------------------------------------------------
415 415
 
416
-llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'mod-webhook page-list bodyforlist');	// Can use also classforhorizontalscrolloftabs instead of bodyforlist for a horizontal scroll in the table instead of page
416
+llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'mod-webhook page-list bodyforlist'); // Can use also classforhorizontalscrolloftabs instead of bodyforlist for a horizontal scroll in the table instead of page
417 417
 
418 418
 if ($mode == 'modulesetup') {
419 419
 	require_once DOL_DOCUMENT_ROOT.'/webhook/lib/webhook.lib.php';
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
 }
565 565
 
566 566
 $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
567
-$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, $conf->main_checkbox_left_column);  // This also change content of $arrayfields with user setup
567
+$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, $conf->main_checkbox_left_column); // This also change content of $arrayfields with user setup
568 568
 $selectedfields = (($mode != 'kanban' && $mode != 'kanbangroupby') ? $htmlofselectarray : '');
569 569
 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
570 570
 
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
 			$formadmin = new FormAdmin($db);
616 616
 			print $formadmin->select_language((isset($search[$key]) ? $search[$key] : ''), 'search_lang', 0, array(), 1, 0, 0, 'minwidth100imp maxwidth125', 2);
617 617
 		} elseif ($val['type'] === 'boolean') {
618
-			print $form->selectyesno('search_' . $key, $search[$key] ?? '', 1, false, 1);
618
+			print $form->selectyesno('search_'.$key, $search[$key] ?? '', 1, false, 1);
619 619
 		} else {
620 620
 			print '<input type="text" class="flat maxwidth'.(in_array($val['type'], array('integer', 'price')) ? '50' : '75').'" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
621 621
 		}
@@ -663,7 +663,7 @@  discard block
 block discarded – undo
663 663
 	} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('id', 'rowid', 'ref', 'status')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
664 664
 		$cssforfield .= ($cssforfield ? ' ' : '').'right';
665 665
 	}
666
-	$cssforfield = preg_replace('/small\s*/', '', $cssforfield);	// the 'small' css must not be used for the title label
666
+	$cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label
667 667
 	if (!empty($arrayfields['t.'.$key]['checked'])) {
668 668
 		print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''), 0, (empty($val['helplist']) ? '' : $val['helplist']))."\n";
669 669
 		$totalarray['nbfield']++;
Please login to merge, or discard this patch.