Completed
Branch develop (266b7a)
by
unknown
15:37
created
htdocs/core/lib/modulebuilder.lib.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 				}
130 130
 				$texttoinsert .= ' "enabled"=>"'.($val['enabled'] !== '' ? dol_escape_php($val['enabled']) : 1).'",';
131 131
 				$texttoinsert .= " 'position'=>".($val['position'] !== '' ? (int) $val['position'] : 50).",";
132
-				$texttoinsert .= " 'notnull'=>".(empty($val['notnull']) ? 0 :(int) $val['notnull']).",";
132
+				$texttoinsert .= " 'notnull'=>".(empty($val['notnull']) ? 0 : (int) $val['notnull']).",";
133 133
 				$texttoinsert .= ' "visible"=>"'.($val['visible'] !== '' ? dol_escape_js($val['visible']) : -1).'",';
134 134
 				if (!empty($val['noteditable'])) {
135 135
 					$texttoinsert .= ' "noteditable"=>"'.dol_escape_php($val['noteditable']).'",';
@@ -271,22 +271,22 @@  discard block
 block discarded – undo
271 271
 	// Edit .sql file
272 272
 	if ($moduletype == 'internal') {
273 273
 		$pathoffiletoeditsrc = '/../install/mysql/tables/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql';
274
-		if (! dol_is_file($readdir.$pathoffiletoeditsrc)) {
274
+		if (!dol_is_file($readdir.$pathoffiletoeditsrc)) {
275 275
 			$pathoffiletoeditsrc = '/../install/mysql/tables/llx_'.strtolower($module).'_'.strtolower($objectname).'-'.strtolower($module).'.sql';
276
-			if (! dol_is_file($readdir.$pathoffiletoeditsrc)) {
276
+			if (!dol_is_file($readdir.$pathoffiletoeditsrc)) {
277 277
 				$pathoffiletoeditsrc = '/../install/mysql/tables/llx_'.strtolower($module).'-'.strtolower($module).'.sql';
278
-				if (! dol_is_file($readdir.$pathoffiletoeditsrc)) {
278
+				if (!dol_is_file($readdir.$pathoffiletoeditsrc)) {
279 279
 					$pathoffiletoeditsrc = '/../install/mysql/tables/llx_'.strtolower($module).'.sql';
280 280
 				}
281 281
 			}
282 282
 		}
283 283
 	} else {
284 284
 		$pathoffiletoeditsrc = '/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql';
285
-		if (! dol_is_file($readdir.$pathoffiletoeditsrc)) {
285
+		if (!dol_is_file($readdir.$pathoffiletoeditsrc)) {
286 286
 			$pathoffiletoeditsrc = '/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'-'.strtolower($module).'.sql';
287
-			if (! dol_is_file($readdir.$pathoffiletoeditsrc)) {
287
+			if (!dol_is_file($readdir.$pathoffiletoeditsrc)) {
288 288
 				$pathoffiletoeditsrc = '/sql/llx_'.strtolower($module).'-'.strtolower($module).'.sql';
289
-				if (! dol_is_file($readdir.$pathoffiletoeditsrc)) {
289
+				if (!dol_is_file($readdir.$pathoffiletoeditsrc)) {
290 290
 					$pathoffiletoeditsrc = '/sql/llx_'.strtolower($module).'.sql';
291 291
 				}
292 292
 			}
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
 			$objects[$fileobj['fullname']] = $objectnameloop;
444 444
 		}
445 445
 	}
446
-	if (count($objects)>0) {
446
+	if (count($objects) > 0) {
447 447
 		return $objects;
448 448
 	}
449 449
 
@@ -553,12 +553,12 @@  discard block
 block discarded – undo
553 553
 			}
554 554
 		}
555 555
 	} elseif ($action == -2 && !empty($objectname) && !empty($module)) {
556
-		$key= null;
556
+		$key = null;
557 557
 		$right = null;
558 558
 		$objectOfRights = array();
559 559
 		//check if object already declared in rights file
560 560
 		foreach ($permissions as $right) {
561
-			$objectOfRights[]= $right[4];
561
+			$objectOfRights[] = $right[4];
562 562
 		}
563 563
 		if (in_array(strtolower($objectname), $objectOfRights)) {
564 564
 			$error++;
@@ -585,7 +585,7 @@  discard block
 block discarded – undo
585 585
 	if (!$error) {
586 586
 		// prepare permissions array
587 587
 		$count_perms = count($permissions);
588
-		for ($i = 0;$i<$count_perms;$i++) {
588
+		for ($i = 0; $i < $count_perms; $i++) {
589 589
 			$permissions[$i][0] = "\$this->rights[\$r][0] = \$this->numero . sprintf('%02d', \$r + 1)";
590 590
 			$permissions[$i][1] = "\$this->rights[\$r][1] = '".$permissions[$i][1]."'";
591 591
 			$permissions[$i][4] = "\$this->rights[\$r][4] = '".$permissions[$i][4]."'";
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
 
606 606
 
607 607
 		// parcourir les objets
608
-		$o=0;
608
+		$o = 0;
609 609
 		foreach ($permissions as &$object) {
610 610
 			// récupérer la permission de l'objet
611 611
 			$p = 1;
@@ -700,7 +700,7 @@  discard block
 block discarded – undo
700 700
 {
701 701
 
702 702
 	// stock all properties in array
703
-	$attributesUnique = array ('type','label', 'enabled', 'position', 'notnull', 'visible', 'noteditable', 'index', 'default' , 'foreignkey', 'arrayofkeyval', 'alwayseditable','validate', 'searchall','comment', 'isameasure', 'css', 'cssview','csslist', 'help', 'showoncombobox','picto' );
703
+	$attributesUnique = array('type', 'label', 'enabled', 'position', 'notnull', 'visible', 'noteditable', 'index', 'default', 'foreignkey', 'arrayofkeyval', 'alwayseditable', 'validate', 'searchall', 'comment', 'isameasure', 'css', 'cssview', 'csslist', 'help', 'showoncombobox', 'picto');
704 704
 
705 705
 	$start = "public \$fields=array(";
706 706
 	$end = ");";
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
 	foreach ($attributesUnique as $attUnique) {
731 731
 		$table .= "|".$attUnique;
732 732
 	}
733
-	$table .="\n";
733
+	$table .= "\n";
734 734
 	$valuesModif = array();
735 735
 	foreach ($keys as $string) {
736 736
 		$string = trim($string, "'");
@@ -770,8 +770,8 @@  discard block
 block discarded – undo
770 770
 				$valuesModif[$attUnique] = $values[$attUnique];
771 771
 			}
772 772
 		}
773
-		$table .= "|*" . $field[0] . "*|";
774
-		$table .= implode("|", $valuesModif) . "\n";
773
+		$table .= "|*".$field[0]."*|";
774
+		$table .= implode("|", $valuesModif)."\n";
775 775
 	}
776 776
 
777 777
 	// end table
@@ -780,7 +780,7 @@  discard block
 block discarded – undo
780 780
 
781 781
 	//write in file
782 782
 	$writeInFile = dolReplaceInFile($destfile, array('== DATA SPECIFICATIONS' => $table));
783
-	if ($writeInFile<0) {
783
+	if ($writeInFile < 0) {
784 784
 		return -1;
785 785
 	}
786 786
 	return 1;
@@ -802,13 +802,13 @@  discard block
 block discarded – undo
802 802
 
803 803
 		$str = file_get_contents($file);
804 804
 
805
-		$search = '/' . preg_quote($start, '/') . '(.*?)' . preg_quote($end, '/') . '/s';
805
+		$search = '/'.preg_quote($start, '/').'(.*?)'.preg_quote($end, '/').'/s';
806 806
 		$new_contents = preg_replace($search, '', $str);
807 807
 		file_put_contents($file, $new_contents);
808 808
 
809 809
 		//perms If Exist
810 810
 		$perms = "|*".strtolower($objectname)."*|";
811
-		$search_pattern_perms = '/' . preg_quote($perms, '/') . '.*?\n/';
811
+		$search_pattern_perms = '/'.preg_quote($perms, '/').'.*?\n/';
812 812
 		$new_contents = preg_replace($search_pattern_perms, '', $new_contents);
813 813
 		file_put_contents($file, $new_contents);
814 814
 	}
@@ -865,7 +865,7 @@  discard block
 block discarded – undo
865 865
 	$string = "[options='header',grid=rows,width=60%,caption=Organisation]\n";
866 866
 	$string .= "|===\n";
867 867
 	// header for table
868
-	$header = array($langs->trans('Objects'),$langs->trans('Permission'));
868
+	$header = array($langs->trans('Objects'), $langs->trans('Permission'));
869 869
 	foreach ($header as $h) {
870 870
 		$string .= "|".$h;
871 871
 	}
@@ -892,7 +892,7 @@  discard block
 block discarded – undo
892 892
 	foreach ($permissions as $key => $element) {
893 893
 		$element = str_replace(" '", '', $element);
894 894
 		$element = trim($element, "'");
895
-		$permsN[] = substr($element, strpos($element, "=")+1);
895
+		$permsN[] = substr($element, strpos($element, "=") + 1);
896 896
 	}
897 897
 	array_pop($permsN);
898 898
 
@@ -922,7 +922,7 @@  discard block
 block discarded – undo
922 922
 	// end table
923 923
 	$string .= "\n|===\n";
924 924
 	$write = dolReplaceInFile($destfile, array('__DATA_PERMISSIONS__'=> $string));
925
-	if ($write<0) {
925
+	if ($write < 0) {
926 926
 		return -1;
927 927
 	}
928 928
 	return 1;
@@ -951,26 +951,26 @@  discard block
 block discarded – undo
951 951
 		if (strpos($lineContent, $varcomented) !== false) {
952 952
 			$lineContent = '';
953 953
 			foreach ($objects as $object) {
954
-				$lineContent .= "\t * @var ".$object." \$".strtolower($object)." {@type ".$object."}". PHP_EOL;
954
+				$lineContent .= "\t * @var ".$object." \$".strtolower($object)." {@type ".$object."}".PHP_EOL;
955 955
 			}
956 956
 			//var_dump($lineContent);exit;
957 957
 		}
958 958
 		if (strpos($lineContent, $props) !== false) {
959 959
 			$lineContent = '';
960 960
 			foreach ($objects as $object) {
961
-				$lineContent .= "\tpublic \$".strtolower($object).";". PHP_EOL;
961
+				$lineContent .= "\tpublic \$".strtolower($object).";".PHP_EOL;
962 962
 			}
963 963
 		}
964 964
 		if (strpos($lineContent, $constructObj) !== false) {
965 965
 			$lineContent = '';
966 966
 			foreach ($objects as $object) {
967
-				$lineContent .= "\t\t\$this->".strtolower($object)." = new ".$object."(\$this->db);". PHP_EOL;
967
+				$lineContent .= "\t\t\$this->".strtolower($object)." = new ".$object."(\$this->db);".PHP_EOL;
968 968
 			}
969 969
 		}
970 970
 		if (strpos($lineContent, $includeClass) !== false) {
971 971
 			$lineContent = '';
972 972
 			foreach ($objects as $object) {
973
-				$lineContent .= "dol_include_once('/".strtolower($modulename)."/class/".strtolower($object).".class.php');". PHP_EOL;
973
+				$lineContent .= "dol_include_once('/".strtolower($modulename)."/class/".strtolower($object).".class.php');".PHP_EOL;
974 974
 			}
975 975
 		}
976 976
 	}
@@ -980,10 +980,10 @@  discard block
 block discarded – undo
980 980
 	//add methods for each object
981 981
 	$allContent = getFromFile($file, '/*begin methods CRUD*/', '/*end methods CRUD*/');
982 982
 	foreach ($objects as $object) {
983
-		$contentReplaced =str_replace(["myobject","MyObject"], [strtolower($object),$object], $allContent);
983
+		$contentReplaced = str_replace(["myobject", "MyObject"], [strtolower($object), $object], $allContent);
984 984
 		dolReplaceInFile($file, array('/*end methods CRUD*/' => '/*CRUD FOR '.strtoupper($object).'*/'."\n".$contentReplaced."\n\t".'/*END CRUD FOR '.strtoupper($object).'*/'."\n\t".'/*end methods CRUD*/'));
985 985
 	}
986
-	dolReplaceInFile($file, array($allContent => '','MyModule' => ucfirst($modulename)));
986
+	dolReplaceInFile($file, array($allContent => '', 'MyModule' => ucfirst($modulename)));
987 987
 	return 1;
988 988
 }
989 989
 
@@ -1044,7 +1044,7 @@  discard block
 block discarded – undo
1044 1044
  */
1045 1045
 function reWriteAllMenus($file, $menus, $menuWantTo, $key, $action)
1046 1046
 {
1047
-	$errors =0;
1047
+	$errors = 0;
1048 1048
 	$counter = 0;
1049 1049
 	if (!file_exists($file)) {
1050 1050
 		return -1;
@@ -1057,7 +1057,7 @@  discard block
 block discarded – undo
1057 1057
 		array_push($menus, $menuWantTo);
1058 1058
 	} elseif ($action == 2 && !empty($key) && !empty($menuWantTo)) {
1059 1059
 		// update right from permissions array
1060
-		$urlCounter=0;
1060
+		$urlCounter = 0;
1061 1061
 		// check if the values already exists
1062 1062
 		foreach ($menus as $index => $menu) {
1063 1063
 			if ($index !== $key) {
@@ -1105,20 +1105,20 @@  discard block
 block discarded – undo
1105 1105
 				$next_val = empty($menus[$index + 1]) ? null : $menus[$index + 1];
1106 1106
 
1107 1107
 				$str_menu .= $start."\n";
1108
-				$str_menu.= "\t\t\$this->menu[\$r++]=array(\n";
1109
-				$str_menu.= "\t\t\t 'fk_menu' =>'".$menu['fk_menu']."',\n";
1110
-				$str_menu.= "\t\t\t 'type' =>'".$menu['type']."',\n";
1111
-				$str_menu.= "\t\t\t 'titre' =>'".$menu['titre']."',\n";
1112
-				$str_menu.= "\t\t\t 'mainmenu' =>'".$menu['mainmenu']."',\n";
1113
-				$str_menu.= "\t\t\t 'leftmenu' =>'".$menu['leftmenu']."',\n";
1114
-				$str_menu.= "\t\t\t 'url' =>'".$menu['url']."',\n";
1115
-				$str_menu.= "\t\t\t 'langs' =>'".$menu['langs']."',\n";
1116
-				$str_menu.= "\t\t\t 'position' =>".$menu['position'].",\n";
1117
-				$str_menu.= "\t\t\t 'enabled' =>'".$menu['enabled']."',\n";
1118
-				$str_menu.= "\t\t\t 'perms' =>'".$menu['perms']."',\n";
1119
-				$str_menu.= "\t\t\t 'target' =>'".$menu['target']."',\n";
1120
-				$str_menu.= "\t\t\t 'user' =>".$menu['user'].",\n";
1121
-				$str_menu.= "\t\t);\n";
1108
+				$str_menu .= "\t\t\$this->menu[\$r++]=array(\n";
1109
+				$str_menu .= "\t\t\t 'fk_menu' =>'".$menu['fk_menu']."',\n";
1110
+				$str_menu .= "\t\t\t 'type' =>'".$menu['type']."',\n";
1111
+				$str_menu .= "\t\t\t 'titre' =>'".$menu['titre']."',\n";
1112
+				$str_menu .= "\t\t\t 'mainmenu' =>'".$menu['mainmenu']."',\n";
1113
+				$str_menu .= "\t\t\t 'leftmenu' =>'".$menu['leftmenu']."',\n";
1114
+				$str_menu .= "\t\t\t 'url' =>'".$menu['url']."',\n";
1115
+				$str_menu .= "\t\t\t 'langs' =>'".$menu['langs']."',\n";
1116
+				$str_menu .= "\t\t\t 'position' =>".$menu['position'].",\n";
1117
+				$str_menu .= "\t\t\t 'enabled' =>'".$menu['enabled']."',\n";
1118
+				$str_menu .= "\t\t\t 'perms' =>'".$menu['perms']."',\n";
1119
+				$str_menu .= "\t\t\t 'target' =>'".$menu['target']."',\n";
1120
+				$str_menu .= "\t\t\t 'user' =>".$menu['user'].",\n";
1121
+				$str_menu .= "\t\t);\n";
1122 1122
 
1123 1123
 				if (is_null($next_val) || $val_actuel['leftmenu'] !== $next_val['leftmenu']) {
1124 1124
 					$str_menu .= $end."\n";
@@ -1155,21 +1155,21 @@  discard block
 block discarded – undo
1155 1155
 		$dicData .= "\t\t\t'$key'=>";
1156 1156
 
1157 1157
 		if ($key === 'tabcond') {
1158
-			$conditions = array_map(function ($val) use ($module) {
1158
+			$conditions = array_map(function($val) use ($module) {
1159 1159
 				return ($val === true || $val === false) ? "isModEnabled('$module')" : $val;
1160 1160
 			}, $value);
1161
-			$dicData .= "array(" . implode(",", $conditions) . ")";
1161
+			$dicData .= "array(".implode(",", $conditions).")";
1162 1162
 		} elseif ($key === 'tabhelp') {
1163 1163
 			$helpItems = array();
1164 1164
 			foreach ($value as $key => $helpValue) {
1165 1165
 				$helpItems[] = "array('code'=>\$langs->trans('".$helpValue['code']."'), 'field2' => 'field2tooltip')";
1166 1166
 			}
1167
-			$dicData .= "array(" . implode(",", $helpItems) . ")";
1167
+			$dicData .= "array(".implode(",", $helpItems).")";
1168 1168
 		} else {
1169 1169
 			if (is_array($value)) {
1170
-				$dicData .= "array(" . implode(",", array_map(function ($val) {
1170
+				$dicData .= "array(".implode(",", array_map(function($val) {
1171 1171
 					return "'$val'";
1172
-				}, $value)) . ")";
1172
+				}, $value)).")";
1173 1173
 			} else {
1174 1174
 				$dicData .= "'$value'";
1175 1175
 			}
@@ -1235,7 +1235,7 @@  discard block
 block discarded – undo
1235 1235
 		}
1236 1236
 	}
1237 1237
 	// check if tablename exist in Database and create it if not
1238
-	$query = "SHOW TABLES LIKE '" . MAIN_DB_PREFIX.strtolower($namedic) . "'";
1238
+	$query = "SHOW TABLES LIKE '".MAIN_DB_PREFIX.strtolower($namedic)."'";
1239 1239
 	$checkTable = $db->query($query);
1240 1240
 	if ($checkTable && $db->num_rows($checkTable) > 0) {
1241 1241
 		setEventMessages($langs->trans("ErrorTableExist", $namedic), null, 'errors');
@@ -1344,9 +1344,9 @@  discard block
 block discarded – undo
1344 1344
 
1345 1345
 	foreach ($allFilesAndDirs as $item) {
1346 1346
 		if ($item != '.' && $item != '..') {
1347
-			if ($type == 1 && is_file($path . DIRECTORY_SEPARATOR . $item) && strpos($item, '.back') === false) {
1347
+			if ($type == 1 && is_file($path.DIRECTORY_SEPARATOR.$item) && strpos($item, '.back') === false) {
1348 1348
 				$count++;
1349
-			} elseif ($type == 2 && is_dir($path . DIRECTORY_SEPARATOR . $item)) {
1349
+			} elseif ($type == 2 && is_dir($path.DIRECTORY_SEPARATOR.$item)) {
1350 1350
 				$count++;
1351 1351
 			}
1352 1352
 		}
Please login to merge, or discard this patch.
htdocs/modulebuilder/index.php 1 patch
Spacing   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -74,12 +74,12 @@  discard block
 block discarded – undo
74 74
 $modulename = dol_sanitizeFileName(GETPOST('modulename', 'alpha'));
75 75
 $objectname = dol_sanitizeFileName(GETPOST('objectname', 'alpha'));
76 76
 $dicname = dol_sanitizeFileName(GETPOST('dicname', 'alpha'));
77
-$editorname= GETPOST('editorname', 'alpha');
78
-$editorurl= GETPOST('editorurl', 'alpha');
79
-$version= GETPOST('version', 'alpha');
80
-$family= GETPOST('family', 'alpha');
81
-$picto= GETPOST('idpicto', 'alpha');
82
-$idmodule= GETPOST('idmodule', 'alpha');
77
+$editorname = GETPOST('editorname', 'alpha');
78
+$editorurl = GETPOST('editorurl', 'alpha');
79
+$version = GETPOST('version', 'alpha');
80
+$family = GETPOST('family', 'alpha');
81
+$picto = GETPOST('idpicto', 'alpha');
82
+$idmodule = GETPOST('idmodule', 'alpha');
83 83
 
84 84
 // Security check
85 85
 if (!isModEnabled('modulebuilder')) {
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 
249 249
 		// Copy last html.formsetup.class.php' to backport folder
250 250
 		$tryToCopyFromSetupClass = true;
251
-		$backportDest = $destdir .'/backport/v16/core/class';
251
+		$backportDest = $destdir.'/backport/v16/core/class';
252 252
 		$backportFileSrc = DOL_DOCUMENT_ROOT.'/core/class/html.formsetup.class.php';
253 253
 		$backportFileDest = $backportDest.'/html.formsetup.class.php';
254 254
 		$result = dol_mkdir($backportDest);
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 
392 392
 		clearstatcache(true);
393 393
 		if (function_exists('opcache_invalidate')) {
394
-			opcache_reset();	// remove the include cache hell !
394
+			opcache_reset(); // remove the include cache hell !
395 395
 		}
396 396
 
397 397
 		header("Location: ".$_SERVER["PHP_SELF"].'?module='.$modulename);
@@ -840,7 +840,7 @@  discard block
 block discarded – undo
840 840
 				}
841 841
 			}
842 842
 			$stringLog = implode("\n", $strreplace);
843
-			dolReplaceInFile($destfile, array('//include::ChangeLog.md[]' => '','__CHANGELOG__' => $stringLog));
843
+			dolReplaceInFile($destfile, array('//include::ChangeLog.md[]' => '', '__CHANGELOG__' => $stringLog));
844 844
 		}
845 845
 
846 846
 		// Delete old documentation files
@@ -1315,7 +1315,7 @@  discard block
 block discarded – undo
1315 1315
 			}
1316 1316
 			$rights = $moduleobj->rights;
1317 1317
 			$moduledescriptorfile = $destdir.'/core/modules/mod'.$module.'.class.php';
1318
-			$checkComment=checkExistComment($moduledescriptorfile, 1);
1318
+			$checkComment = checkExistComment($moduledescriptorfile, 1);
1319 1319
 			if ($checkComment < 0) {
1320 1320
 				setEventMessages($langs->trans("WarningCommentNotFound", $langs->trans("Permissions"), "mod".$module."class.php"), null, 'warnings');
1321 1321
 			} else {
@@ -1481,7 +1481,7 @@  discard block
 block discarded – undo
1481 1481
 			}
1482 1482
 		}
1483 1483
 			$menus = $moduleobj->menu;
1484
-			$counter = 0 ;
1484
+			$counter = 0;
1485 1485
 		foreach ($menus as $menu) {
1486 1486
 			if ($menu['leftmenu'] == strtolower($objectname)) {
1487 1487
 				$counter++;
@@ -1634,7 +1634,7 @@  discard block
 block discarded – undo
1634 1634
 		} else {
1635 1635
 			createNewDictionnary($module, $moduledescriptorfile, $newdicname, $dictionaries);
1636 1636
 			if (function_exists('opcache_invalidate')) {
1637
-				opcache_reset();	// remove the include cache hell !
1637
+				opcache_reset(); // remove the include cache hell !
1638 1638
 			}
1639 1639
 			clearstatcache(true);
1640 1640
 			header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=dictionaries&module='.$module.($forceddirread ? '@'.$dirread : ''));
@@ -1728,7 +1728,7 @@  discard block
 block discarded – undo
1728 1728
 				'isameasure'=>GETPOST('propisameasure', 'int'),
1729 1729
 				'comment'=>GETPOST('propcomment', 'alpha'),
1730 1730
 				'help'=>GETPOST('prophelp', 'alpha'),
1731
-				'css'=>GETPOST('propcss', 'alpha'),        // Can be 'maxwidth500 widthcentpercentminusxx' for example
1731
+				'css'=>GETPOST('propcss', 'alpha'), // Can be 'maxwidth500 widthcentpercentminusxx' for example
1732 1732
 				'cssview'=>GETPOST('propcssview', 'alpha'),
1733 1733
 				'csslist'=>GETPOST('propcsslist', 'alpha'),
1734 1734
 				'default'=>GETPOST('propdefault', 'restricthtml'),
@@ -1884,7 +1884,7 @@  discard block
 block discarded – undo
1884 1884
 
1885 1885
 			clearstatcache(true);
1886 1886
 			if (function_exists('opcache_invalidate')) {
1887
-				opcache_reset();	// remove the include cache hell !
1887
+				opcache_reset(); // remove the include cache hell !
1888 1888
 			}
1889 1889
 
1890 1890
 			header("Location: ".$_SERVER["PHP_SELF"].'?module=deletemodule');
@@ -1976,7 +1976,7 @@  discard block
 block discarded – undo
1976 1976
 
1977 1977
 			clearstatcache(true);
1978 1978
 			if (function_exists('opcache_invalidate')) {
1979
-				opcache_reset();	// remove the include cache hell !
1979
+				opcache_reset(); // remove the include cache hell !
1980 1980
 			}
1981 1981
 			$resultko = 0;
1982 1982
 			foreach ($filetodelete as $tmpfiletodelete) {
@@ -1996,7 +1996,7 @@  discard block
 block discarded – undo
1996 1996
 	}
1997 1997
 
1998 1998
 	$action = '';
1999
-	if (! $error) {
1999
+	if (!$error) {
2000 2000
 		$tabobj = 'newobject';
2001 2001
 	} else {
2002 2002
 		$tabobj = 'deleteobject';
@@ -2057,11 +2057,11 @@  discard block
 block discarded – undo
2057 2057
 	}
2058 2058
 
2059 2059
 	if (!empty(GETPOST('dictionnarykey'))) {
2060
-		$newdicname = $dicts['tabname'][GETPOST('dictionnarykey')-1];
2060
+		$newdicname = $dicts['tabname'][GETPOST('dictionnarykey') - 1];
2061 2061
 	}
2062 2062
 
2063 2063
 	//chercher la table dicname
2064
-	$query = "SHOW TABLES LIKE '" . MAIN_DB_PREFIX.strtolower($newdicname) . "'";
2064
+	$query = "SHOW TABLES LIKE '".MAIN_DB_PREFIX.strtolower($newdicname)."'";
2065 2065
 	$checkTable = $db->query($query);
2066 2066
 	if ($checkTable && $db->num_rows($checkTable) <= 0) {
2067 2067
 		$error++;
@@ -2100,7 +2100,7 @@  discard block
 block discarded – undo
2100 2100
 			setEventMessages($langs->trans("DictionaryDeleted", ucfirst(substr($newdicname, 2))), null);
2101 2101
 		}
2102 2102
 		if (function_exists('opcache_invalidate')) {
2103
-			opcache_reset();	// remove the include cache hell !
2103
+			opcache_reset(); // remove the include cache hell !
2104 2104
 		}
2105 2105
 		clearstatcache(true);
2106 2106
 		header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=dictionaries&module='.$module.($forceddirread ? '@'.$dirread : ''));
@@ -2108,7 +2108,7 @@  discard block
 block discarded – undo
2108 2108
 	}
2109 2109
 }
2110 2110
 if ($dirins && $action == 'updatedictionary' && GETPOST('dictionnarykey')) {
2111
-	$keydict = GETPOST('dictionnarykey') - 1 ;
2111
+	$keydict = GETPOST('dictionnarykey') - 1;
2112 2112
 
2113 2113
 	$pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath'];
2114 2114
 	$destdir = $dirins.'/'.strtolower($module);
@@ -2142,7 +2142,7 @@  discard block
 block discarded – undo
2142 2142
 				setEventMessages($langs->trans("DictionaryNameUpdated", ucfirst(GETPOST('tablib'))), null);
2143 2143
 			}
2144 2144
 			if (function_exists('opcache_invalidate')) {
2145
-				opcache_reset();	// remove the include cache hell !
2145
+				opcache_reset(); // remove the include cache hell !
2146 2146
 			}
2147 2147
 			clearstatcache(true);
2148 2148
 			header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=dictionaries&module='.$module.($forceddirread ? '@'.$dirread : ''));
@@ -2262,13 +2262,13 @@  discard block
 block discarded – undo
2262 2262
 
2263 2263
 	//check existing object permission
2264 2264
 	$counter = 0;
2265
-	$permsForObject =array();
2265
+	$permsForObject = array();
2266 2266
 	$permissions = $moduleobj->rights;
2267 2267
 	$allObject = array();
2268 2268
 
2269 2269
 	$countPerms = count($permissions);
2270 2270
 
2271
-	for ($i =0; $i<$countPerms; $i++) {
2271
+	for ($i = 0; $i < $countPerms; $i++) {
2272 2272
 		if ($permissions[$i][4] == $objectForPerms) {
2273 2273
 			$counter++;
2274 2274
 			if (count($permsForObject) < 3) {
@@ -2280,7 +2280,7 @@  discard block
 block discarded – undo
2280 2280
 
2281 2281
 	// check if label of object already exists
2282 2282
 	$countPermsObj = count($permsForObject);
2283
-	for ($j = 0; $j<$countPermsObj; $j++) {
2283
+	for ($j = 0; $j < $countPermsObj; $j++) {
2284 2284
 		if (in_array($crud, $permsForObject[$j])) {
2285 2285
 			$error++;
2286 2286
 			setEventMessages($langs->trans("ErrorExistingPermission", $langs->transnoentities($crud), $langs->transnoentities($objectForPerms)), null, 'errors');
@@ -2317,7 +2317,7 @@  discard block
 block discarded – undo
2317 2317
 
2318 2318
 		clearstatcache(true);
2319 2319
 		if (function_exists('opcache_invalidate')) {
2320
-			opcache_reset();	// remove the include cache hell !
2320
+			opcache_reset(); // remove the include cache hell !
2321 2321
 		}
2322 2322
 		header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=permissions&module='.$module);
2323 2323
 		exit;
@@ -2326,7 +2326,7 @@  discard block
 block discarded – undo
2326 2326
 
2327 2327
 
2328 2328
 // Update permission
2329
-if ($dirins && GETPOST('action') == 'update_right' && GETPOST('modifyright')&& empty($cancel)) {
2329
+if ($dirins && GETPOST('action') == 'update_right' && GETPOST('modifyright') && empty($cancel)) {
2330 2330
 	$error = 0;
2331 2331
 	// load class and check if right exist
2332 2332
 	$pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath'];
@@ -2369,21 +2369,21 @@  discard block
 block discarded – undo
2369 2369
 	}
2370 2370
 
2371 2371
 	$permissions = $moduleobj->rights;
2372
-	$key =(int) GETPOST('counter')-1;
2372
+	$key = (int) GETPOST('counter') - 1;
2373 2373
 	//get permission want to delete from permissions array
2374 2374
 	$x1 = $permissions[$key][1];
2375 2375
 	$x2 = $permissions[$key][4];
2376 2376
 	$x3 = $permissions[$key][5];
2377 2377
 		//check existing object permission
2378 2378
 		$counter = 0;
2379
-		$permsForObject =array();
2379
+		$permsForObject = array();
2380 2380
 		$permissions = $moduleobj->rights;
2381 2381
 		$firstRight = 0;
2382 2382
 		$existRight = 0;
2383 2383
 		$allObject = array();
2384 2384
 
2385 2385
 		$countPerms = count($permissions);
2386
-	for ($i =0; $i<$countPerms; $i++) {
2386
+	for ($i = 0; $i < $countPerms; $i++) {
2387 2387
 		if ($permissions[$i][4] == $objectForPerms) {
2388 2388
 			$counter++;
2389 2389
 			if (count($permsForObject) < 3) {
@@ -2395,7 +2395,7 @@  discard block
 block discarded – undo
2395 2395
 
2396 2396
 	if ($label != $x1 && $crud != $x3) {
2397 2397
 		$countPermsObj = count($permsForObject);
2398
-		for ($j = 0; $j<$countPermsObj; $j++) {
2398
+		for ($j = 0; $j < $countPermsObj; $j++) {
2399 2399
 			if (in_array($label, $permsForObject[$j])) {
2400 2400
 				$error++;
2401 2401
 				setEventMessages($langs->trans("ErrorExistingPermission", $langs->transnoentities($label), $langs->transnoentities($objectForPerms)), null, 'errors');
@@ -2423,7 +2423,7 @@  discard block
 block discarded – undo
2423 2423
 			setEventMessages($langs->trans('PermissionUpdatedSuccesfuly'), null);
2424 2424
 			clearstatcache(true);
2425 2425
 			if (function_exists('opcache_invalidate')) {
2426
-				opcache_reset();	// remove the include cache hell !
2426
+				opcache_reset(); // remove the include cache hell !
2427 2427
 			}
2428 2428
 			header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=permissions&module='.$module);
2429 2429
 			exit;
@@ -2447,7 +2447,7 @@  discard block
 block discarded – undo
2447 2447
 	}
2448 2448
 
2449 2449
 	$permissions = $moduleobj->rights;
2450
-	$key = (int) GETPOST('permskey', 'int')-1;
2450
+	$key = (int) GETPOST('permskey', 'int') - 1;
2451 2451
 
2452 2452
 	if (!$error) {
2453 2453
 		// check if module is enabled
@@ -2473,7 +2473,7 @@  discard block
 block discarded – undo
2473 2473
 
2474 2474
 			clearstatcache(true);
2475 2475
 			if (function_exists('opcache_invalidate')) {
2476
-				opcache_reset();	// remove the include cache hell !
2476
+				opcache_reset(); // remove the include cache hell !
2477 2477
 			}
2478 2478
 
2479 2479
 			header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=permissions&module='.$module);
@@ -2642,7 +2642,7 @@  discard block
 block discarded – undo
2642 2642
 
2643 2643
 		clearstatcache(true);
2644 2644
 		if (function_exists('opcache_invalidate')) {
2645
-			opcache_reset();	// remove the include cache hell !
2645
+			opcache_reset(); // remove the include cache hell !
2646 2646
 		}
2647 2647
 
2648 2648
 		setEventMessages($langs->trans('MenuDeletedSuccessfuly'), null);
@@ -2698,7 +2698,7 @@  discard block
 block discarded – undo
2698 2698
 		setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Url")), null, 'errors');
2699 2699
 	}
2700 2700
 	if (!empty(GETPOST('target'))) {
2701
-		$targets = array('_blank','_self','_parent','_top','');
2701
+		$targets = array('_blank', '_self', '_parent', '_top', '');
2702 2702
 		if (!in_array(GETPOST('target'), $targets)) {
2703 2703
 			$error++;
2704 2704
 			setEventMessages($langs->trans("ErrorFieldValue", $langs->transnoentities("target")), null, 'errors');
@@ -2732,7 +2732,7 @@  discard block
 block discarded – undo
2732 2732
 	 $objects = dolGetListOfObjectClasses($destdir);
2733 2733
 
2734 2734
 	if (GETPOST('type', 'alpha') == 'left') {
2735
-		if (empty(GETPOST('leftmenu')) && count($objects) >0) {
2735
+		if (empty(GETPOST('leftmenu')) && count($objects) > 0) {
2736 2736
 			$error++;
2737 2737
 			setEventMessages($langs->trans("ErrorCoherenceMenu", $langs->transnoentities("leftmenu"), $langs->transnoentities("type")), null, 'errors');
2738 2738
 		}
@@ -2795,7 +2795,7 @@  discard block
 block discarded – undo
2795 2795
 
2796 2796
 // modify a menu
2797 2797
 if ($dirins && $action == "modify_menu" && GETPOST('menukey', 'int') && GETPOST('tabobj')) {
2798
-	$objectname =  GETPOST('tabobj');
2798
+	$objectname = GETPOST('tabobj');
2799 2799
 	$dirins = $listofmodules[strtolower($module)]['moduledescriptorrootpath'];
2800 2800
 	$destdir = $dirins.'/'.strtolower($module);
2801 2801
 	$objects = dolGetListOfObjectClasses($destdir);
@@ -2880,7 +2880,7 @@  discard block
 block discarded – undo
2880 2880
 					}
2881 2881
 					if ($result < 0) {
2882 2882
 						setEventMessages($langs->trans('ErrorMenuExistValue'), null, 'errors');
2883
-						header("Location: ".$_SERVER["PHP_SELF"].'?action=editmenu&token='.newToken().'&menukey='.urlencode($key+1).'&tab='.urlencode($tab).'&module='.urlencode($module).'&tabobj='.($key+1));
2883
+						header("Location: ".$_SERVER["PHP_SELF"].'?action=editmenu&token='.newToken().'&menukey='.urlencode($key + 1).'&tab='.urlencode($tab).'&module='.urlencode($module).'&tabobj='.($key + 1));
2884 2884
 						exit;
2885 2885
 					}
2886 2886
 					setEventMessages($langs->trans('MenuUpdatedSuccessfuly'), null);
@@ -3333,7 +3333,7 @@  discard block
 block discarded – undo
3333 3333
 		$h++;
3334 3334
 
3335 3335
 		$head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=dictionaries&module='.$module.($forceddirread ? '@'.$dirread : '');
3336
-		$head2[$h][1] = ($countDictionaries == 0  ? $langs->trans("Dictionaries") : $langs->trans('Dictionaries').'<span class="marginleftonlyshort badge">'.$countDictionaries."</span>");
3336
+		$head2[$h][1] = ($countDictionaries == 0 ? $langs->trans("Dictionaries") : $langs->trans('Dictionaries').'<span class="marginleftonlyshort badge">'.$countDictionaries."</span>");
3337 3337
 		$head2[$h][2] = 'dictionaries';
3338 3338
 		$h++;
3339 3339
 
@@ -3844,7 +3844,7 @@  discard block
 block discarded – undo
3844 3844
 
3845 3845
 				print '</form>';
3846 3846
 			} elseif ($tabobj == 'createproperty') {
3847
-				$attributesUnique = array (
3847
+				$attributesUnique = array(
3848 3848
 					'proplabel' => $form->textwithpicto($langs->trans("Label"), $langs->trans("YouCanUseTranslationKey")),
3849 3849
 					'propname' => $form->textwithpicto($langs->trans("Code"), $langs->trans("PropertyDesc"), 1, 'help', 'extracss', 0, 3, 'propertyhelp'),
3850 3850
 					'proptype' => $form->textwithpicto($langs->trans("Type"), $langs->trans("TypeOfFieldsHelpIntro").'<br><br>'.$langs->trans("TypeOfFieldsHelp"), 1, 'help', 'extracss', 0, 3, 'typehelp'),
@@ -3912,8 +3912,8 @@  discard block
 block discarded – undo
3912 3912
 				}
3913 3913
 				print '</table><br>'."\n";
3914 3914
 				print '<div class="center">';
3915
-				print '<input type="submit" class="button button-save" name="add" value="' . dol_escape_htmltag($langs->trans('Create')) . '">';
3916
-				print '<input type="button" class="button button-cancel" name="cancel" value="' . dol_escape_htmltag($langs->trans('Cancel')) . '" onclick="goBack()">';
3915
+				print '<input type="submit" class="button button-save" name="add" value="'.dol_escape_htmltag($langs->trans('Create')).'">';
3916
+				print '<input type="button" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans('Cancel')).'" onclick="goBack()">';
3917 3917
 				print '</div>';
3918 3918
 				print '</form>';
3919 3919
 				// javascript
@@ -4036,7 +4036,7 @@  discard block
 block discarded – undo
4036 4036
 					// Print form confirm
4037 4037
 					print $formconfirm;
4038 4038
 				}
4039
-				if ($action != 'editfile' || empty($file) ) {
4039
+				if ($action != 'editfile' || empty($file)) {
4040 4040
 					try {
4041 4041
 						//$pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath'];
4042 4042
 
@@ -4076,16 +4076,16 @@  discard block
 block discarded – undo
4076 4076
 						// Define path for sql file
4077 4077
 						$pathtosql = strtolower($module).'/sql/llx_'.strtolower($module).'_'.strtolower($tabobj).'-'.strtolower($module).'.sql';
4078 4078
 						$result = dol_buildpath($pathtosql);
4079
-						if (! dol_is_file($result)) {
4079
+						if (!dol_is_file($result)) {
4080 4080
 							$pathtosql = strtolower($module).'/sql/llx_'.strtolower($module).'_'.strtolower($tabobj).'.sql';
4081 4081
 							$result = dol_buildpath($pathtosql);
4082
-							if (! dol_is_file($result)) {
4082
+							if (!dol_is_file($result)) {
4083 4083
 								$pathtosql = 'install/mysql/tables/llx_'.strtolower($module).'_'.strtolower($tabobj).'-'.strtolower($module).'.sql';
4084 4084
 								$result = dol_buildpath($pathtosql);
4085
-								if (! dol_is_file($result)) {
4085
+								if (!dol_is_file($result)) {
4086 4086
 									$pathtosql = 'install/mysql/tables/llx_'.strtolower($module).'-'.strtolower($module).'.sql';
4087 4087
 									$result = dol_buildpath($pathtosql);
4088
-									if (! dol_is_file($result)) {
4088
+									if (!dol_is_file($result)) {
4089 4089
 										$pathtosql = 'install/mysql/tables/llx_'.strtolower($module).'.sql';
4090 4090
 										$pathtosqlextra = 'install/mysql/tables/llx_'.strtolower($module).'_extrafields.sql';
4091 4091
 										$result = dol_buildpath($pathtosql);
@@ -4104,7 +4104,7 @@  discard block
 block discarded – undo
4104 4104
 						$pathtosqlroot = preg_replace('/\/llx_.*$/', '', $pathtosql);
4105 4105
 
4106 4106
 						$pathtosqlkey   = preg_replace('/\.sql$/', '.key.sql', $pathtosql);
4107
-						$pathtosqlextrakey   = preg_replace('/\.sql$/', '.key.sql', $pathtosqlextra);
4107
+						$pathtosqlextrakey = preg_replace('/\.sql$/', '.key.sql', $pathtosqlextra);
4108 4108
 
4109 4109
 						$pathtolib      = strtolower($module).'/lib/'.strtolower($module).'.lib.php';
4110 4110
 						$pathtoobjlib   = strtolower($module).'/lib/'.strtolower($module).'_'.strtolower($tabobj).'.lib.php';
@@ -4163,7 +4163,7 @@  discard block
 block discarded – undo
4163 4163
 
4164 4164
 						// API file
4165 4165
 						print '<br>';
4166
-						print '<span class="fa fa-file-o"></span> '.$langs->trans("ApiClassFile").' : <strong class="wordbreak">'.(dol_is_file($realpathtoapi) ? '' : '<strike><span class="opacitymedium">').preg_replace('/^'.strtolower($module).'\//', '', $pathtoapi).(dol_is_file($realpathtoapi)?'':'</span></strike>').'</strong>';
4166
+						print '<span class="fa fa-file-o"></span> '.$langs->trans("ApiClassFile").' : <strong class="wordbreak">'.(dol_is_file($realpathtoapi) ? '' : '<strike><span class="opacitymedium">').preg_replace('/^'.strtolower($module).'\//', '', $pathtoapi).(dol_is_file($realpathtoapi) ? '' : '</span></strike>').'</strong>';
4167 4167
 						if (dol_is_file($realpathtoapi)) {
4168 4168
 							$file = file_get_contents($realpathtoapi);
4169 4169
 							if (preg_match('/var '.$tabobj.'\s+([^\s]*)\s/ims', $file, $objs)) {
@@ -4185,7 +4185,7 @@  discard block
 block discarded – undo
4185 4185
 						}
4186 4186
 						// PHPUnit
4187 4187
 						print '<br>';
4188
-						print '<span class="fa fa-file-o"></span> '.$langs->trans("TestClassFile").' : <strong class="wordbreak">'.(dol_is_file($realpathtophpunit) ? '' : '<strike><span class="opacitymedium">').preg_replace('/^'.strtolower($module).'\//', '', $pathtophpunit).(dol_is_file($realpathtophpunit)?'':'</span></strike>').'</strong>';
4188
+						print '<span class="fa fa-file-o"></span> '.$langs->trans("TestClassFile").' : <strong class="wordbreak">'.(dol_is_file($realpathtophpunit) ? '' : '<strike><span class="opacitymedium">').preg_replace('/^'.strtolower($module).'\//', '', $pathtophpunit).(dol_is_file($realpathtophpunit) ? '' : '</span></strike>').'</strong>';
4189 4189
 						if (dol_is_file($realpathtophpunit)) {
4190 4190
 							print ' <a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.urlencode($tab).'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&token='.newToken().'&format=php&file='.urlencode($pathtophpunit).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
4191 4191
 							print ' ';
@@ -4374,26 +4374,26 @@  discard block
 block discarded – undo
4374 4374
 									$propname = $propkey;
4375 4375
 									$proplabel = $propval['label'];
4376 4376
 									$proptype = $propval['type'];
4377
-									$proparrayofkeyval = !empty($propval['arrayofkeyval'])?$propval['arrayofkeyval']:'';
4377
+									$proparrayofkeyval = !empty($propval['arrayofkeyval']) ? $propval['arrayofkeyval'] : '';
4378 4378
 									$propnotnull = !empty($propval['notnull']) ? $propval['notnull'] : '0';
4379
-									$propdefault = !empty($propval['default'])?$propval['default']:'';
4380
-									$propindex = !empty($propval['index'])?$propval['index']:'';
4381
-									$propforeignkey = !empty($propval['foreignkey'])?$propval['foreignkey']:'';
4379
+									$propdefault = !empty($propval['default']) ? $propval['default'] : '';
4380
+									$propindex = !empty($propval['index']) ? $propval['index'] : '';
4381
+									$propforeignkey = !empty($propval['foreignkey']) ? $propval['foreignkey'] : '';
4382 4382
 									$propposition = $propval['position'];
4383 4383
 									$propenabled = $propval['enabled'];
4384 4384
 									$propvisible = $propval['visible'];
4385
-									$propnoteditable = !empty($propval['noteditable'])?$propval['noteditable']:0;
4385
+									$propnoteditable = !empty($propval['noteditable']) ? $propval['noteditable'] : 0;
4386 4386
 									//$propalwayseditable = !empty($propval['alwayseditable'])?$propval['alwayseditable']:0;
4387
-									$propsearchall = !empty($propval['searchall'])?$propval['searchall']:0;
4388
-									$propisameasure = !empty($propval['isameasure'])?$propval['isameasure']:0;
4389
-									$propcss = !empty($propval['css'])?$propval['css']:'';
4390
-									$propcssview = !empty($propval['cssview'])?$propval['cssview']:'';
4391
-									$propcsslist = !empty($propval['csslist'])?$propval['csslist']:'';
4392
-									$prophelp = !empty($propval['help'])?$propval['help']:'';
4393
-									$propshowoncombobox = !empty($propval['showoncombobox'])?$propval['showoncombobox']:0;
4387
+									$propsearchall = !empty($propval['searchall']) ? $propval['searchall'] : 0;
4388
+									$propisameasure = !empty($propval['isameasure']) ? $propval['isameasure'] : 0;
4389
+									$propcss = !empty($propval['css']) ? $propval['css'] : '';
4390
+									$propcssview = !empty($propval['cssview']) ? $propval['cssview'] : '';
4391
+									$propcsslist = !empty($propval['csslist']) ? $propval['csslist'] : '';
4392
+									$prophelp = !empty($propval['help']) ? $propval['help'] : '';
4393
+									$propshowoncombobox = !empty($propval['showoncombobox']) ? $propval['showoncombobox'] : 0;
4394 4394
 									//$propdisabled=$propval['disabled'];
4395
-									$propvalidate = !empty($propval['validate'])?$propval['validate']:0;
4396
-									$propcomment = !empty($propval['comment'])?$propval['comment']:'';
4395
+									$propvalidate = !empty($propval['validate']) ? $propval['validate'] : 0;
4396
+									$propcomment = !empty($propval['comment']) ? $propval['comment'] : '';
4397 4397
 
4398 4398
 									print '<!-- line for object property -->'."\n";
4399 4399
 									print '<tr class="oddeven">';
@@ -4784,14 +4784,14 @@  discard block
 block discarded – undo
4784 4784
 						$i = 0;
4785 4785
 						$maxi = count($dicts['tabname']);
4786 4786
 						while ($i < $maxi) {
4787
-							if ($action == 'editdict' && $i == (int) GETPOST('dictionnarykey', 'int')-1) {
4787
+							if ($action == 'editdict' && $i == (int) GETPOST('dictionnarykey', 'int') - 1) {
4788 4788
 								print '<tr class="oddeven">';
4789 4789
 								print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
4790 4790
 								print '<input type="hidden" name="token" value="'.newToken().'">';
4791 4791
 								print '<input type="hidden" name="tab" value="dictionaries">';
4792 4792
 								print '<input type="hidden" name="module" value="'.dol_escape_htmltag($module).'">';
4793 4793
 								print '<input type="hidden" name="action" value="updatedictionary">';
4794
-								print '<input type="hidden" name="dictionnarykey" value="'.($i+1).'">';
4794
+								print '<input type="hidden" name="dictionnarykey" value="'.($i + 1).'">';
4795 4795
 
4796 4796
 								print '<td class="tdsticky tdstickygray">';
4797 4797
 								print ($i + 1);
@@ -4887,8 +4887,8 @@  discard block
 block discarded – undo
4887 4887
 								print '</td>';
4888 4888
 
4889 4889
 								print '<td class="center minwidth75 tdstickyright tdstickyghostwhite">';
4890
-								print '<a class="editfielda reposition marginleftonly marginrighttonly paddingright paddingleft" href="'.$_SERVER["PHP_SELF"].'?action=editdict&token='.newToken().'&dictionnarykey='.urlencode($i+1).'&tab='.urlencode($tab).'&module='.urlencode($module).'">'.img_edit().'</a>';
4891
-								print '<a class="marginleftonly marginrighttonly paddingright paddingleft" href="'.$_SERVER["PHP_SELF"].'?action=deletedict&token='.newToken().'&dictionnarykey='.urlencode($i+1).'&tab='.urlencode($tab).'&module='.urlencode($module).'">'.img_delete().'</a>';
4890
+								print '<a class="editfielda reposition marginleftonly marginrighttonly paddingright paddingleft" href="'.$_SERVER["PHP_SELF"].'?action=editdict&token='.newToken().'&dictionnarykey='.urlencode($i + 1).'&tab='.urlencode($tab).'&module='.urlencode($module).'">'.img_edit().'</a>';
4891
+								print '<a class="marginleftonly marginrighttonly paddingright paddingleft" href="'.$_SERVER["PHP_SELF"].'?action=deletedict&token='.newToken().'&dictionnarykey='.urlencode($i + 1).'&tab='.urlencode($tab).'&module='.urlencode($module).'">'.img_delete().'</a>';
4892 4892
 								print '</td>';
4893 4893
 
4894 4894
 								print '</tr>';
@@ -5095,7 +5095,7 @@  discard block
 block discarded – undo
5095 5095
 				print_liste_field_titre("", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, 'center ', $langs->trans(''));
5096 5096
 
5097 5097
 				print "</tr>\n";
5098
-				$r = count($menus)+1;
5098
+				$r = count($menus) + 1;
5099 5099
 				// for adding menu on module
5100 5100
 				print '<tr>';
5101 5101
 				print '<td class="center"><input type="hidden" readonly class="center maxwidth50" name="propenabled" value="#"></td>';
@@ -5119,7 +5119,7 @@  discard block
 block discarded – undo
5119 5119
 				print '<td class="left"><input id="url" type="text" class="left maxwidth50" name="url" value="'.dol_escape_htmltag(GETPOST('url', 'alpha')).'"></td>';
5120 5120
 				print '<td class="left"><input type="text" class="left maxwidth75" name="langs" value="'.strtolower($module).'@'.strtolower($module).'" readonly></td>';
5121 5121
 				// Position
5122
-				print '<td class="center"><input type="text" class="center maxwidth50 tdstickygray" name="position" value="'.(1000+$r).'" readonly></td>';
5122
+				print '<td class="center"><input type="text" class="center maxwidth50 tdstickygray" name="position" value="'.(1000 + $r).'" readonly></td>';
5123 5123
 				// Enabled
5124 5124
 				print '<td class="center">';
5125 5125
 				print '<input type="enabled" class="maxwidth125" value="'.dol_escape_htmltag(GETPOSTISSET('enabled') ? GETPOST('enabled') : 'isModEnabled(\''.$module.'\')').'">';
@@ -5172,7 +5172,7 @@  discard block
 block discarded – undo
5172 5172
 						$propMainmenu = !empty($menu['mainmenu']) ? $menu['mainmenu'] : GETPOST('mainmenu');
5173 5173
 						$propLeftmenu = !empty($menu['leftmenu']) ? $menu['leftmenu'] : GETPOST('leftmenu');
5174 5174
 						$propUrl = !empty($menu['url']) ? $menu['url'] : GETPOST('url', 'alpha');
5175
-						$propPerms = !empty($menu['perms']) ?  $menu['perms'] : GETPOST('perms');
5175
+						$propPerms = !empty($menu['perms']) ? $menu['perms'] : GETPOST('perms');
5176 5176
 						$propUser = !empty($menu['user']) ? $menu['user'] : GETPOST('user');
5177 5177
 						$propTarget = !empty($menu['target']) ? $menu['target'] : GETPOST('target');
5178 5178
 						$propEnabled = !empty($menu['enabled']) ? $menu['enabled'] : GETPOST('enabled');
@@ -5332,7 +5332,7 @@  discard block
 block discarded – undo
5332 5332
 							if (strpos($menu['perms'], "\$user->hasRight") !== 0) {
5333 5333
 								print '';
5334 5334
 							} else {
5335
-								print (dol_escape_htmltag($langs->trans($crud[$valPerms])) );
5335
+								print (dol_escape_htmltag($langs->trans($crud[$valPerms])));
5336 5336
 							}
5337 5337
 							print '</td>';
5338 5338
 
@@ -5354,7 +5354,7 @@  discard block
 block discarded – undo
5354 5354
 							print '<td class="center minwidth75 tdstickyright tdstickyghostwhite">';
5355 5355
 							if ($menu['titre'] != 'Module'.$module.'Name') {
5356 5356
 									print '<a class="editfielda reposition marginleftonly marginrighttonly paddingright paddingleft" href="'.$_SERVER["PHP_SELF"].'?action=editmenu&token='.newToken().'&menukey='.urlencode($i).'&tab='.urlencode($tab).'&module='.urlencode($module).'&tabobj='.urlencode($tabobj).'">'.img_edit().'</a>';
5357
-									print '<a class="marginleftonly marginrighttonly paddingright paddingleft" href="'.$_SERVER["PHP_SELF"].'?action=deletemenu&token='.newToken().'&menukey='.urlencode($i-1).'&tab='.urlencode($tab).'&module='.urlencode($module).'&tabobj='.urlencode($tabobj).'">'.img_delete().'</a>';
5357
+									print '<a class="marginleftonly marginrighttonly paddingright paddingleft" href="'.$_SERVER["PHP_SELF"].'?action=deletemenu&token='.newToken().'&menukey='.urlencode($i - 1).'&tab='.urlencode($tab).'&module='.urlencode($module).'&tabobj='.urlencode($tabobj).'">'.img_delete().'</a>';
5358 5358
 							}
5359 5359
 							print '</td>';
5360 5360
 						}
@@ -5380,7 +5380,7 @@  discard block
 block discarded – undo
5380 5380
 						}
5381 5381
 					  });
5382 5382
 
5383
-					var groupedRights = ' . $groupedRights_json . ';
5383
+					var groupedRights = ' . $groupedRights_json.';
5384 5384
 					var objectsSelect = $("select[id=\'objects\']");
5385 5385
 					var permsSelect = $("select[id=\'perms\']");
5386 5386
 
@@ -5451,7 +5451,7 @@  discard block
 block discarded – undo
5451 5451
 			$dir = $dirread.'/'.$modulelowercase.'/class';
5452 5452
 			$listofobject = dol_dir_list($dir, 'files', 0, '\.class\.php$');
5453 5453
 			$objects = array('myobject');
5454
-			$reg =array();
5454
+			$reg = array();
5455 5455
 			foreach ($listofobject as $fileobj) {
5456 5456
 				$tmpcontent = file_get_contents($fileobj['fullname']);
5457 5457
 				if (preg_match('/class\s+([^\s]*)\s+extends\s+CommonObject/ims', $tmpcontent, $reg)) {
@@ -5603,7 +5603,7 @@  discard block
 block discarded – undo
5603 5603
 							if (in_array($perm[5], array('lire', 'read', 'creer', 'write', 'effacer', 'delete'))) {
5604 5604
 								print dol_escape_htmltag(ucfirst($perm[4]));
5605 5605
 							} else {
5606
-								print '';	// No particular object
5606
+								print ''; // No particular object
5607 5607
 							}
5608 5608
 							print '</td>';
5609 5609
 
@@ -6443,9 +6443,9 @@  discard block
 block discarded – undo
6443 6443
 
6444 6444
 						print '<td>';
6445 6445
 						if ($tabName[0] === "+") {
6446
-							print '<span class="badge badge-status4 badge-status">' . dol_escape_htmltag($tabName) . '</span>';
6446
+							print '<span class="badge badge-status4 badge-status">'.dol_escape_htmltag($tabName).'</span>';
6447 6447
 						} else {
6448
-							print '<span class="badge badge-status8 badge-status">' . dol_escape_htmltag($tabName) . '</span>';
6448
+							print '<span class="badge badge-status8 badge-status">'.dol_escape_htmltag($tabName).'</span>';
6449 6449
 						}
6450 6450
 						print '</td>';
6451 6451
 
Please login to merge, or discard this patch.
htdocs/reception/dispatch.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 	print '<center>';
439 439
 
440 440
 	print '<br>';
441
-	$disabled = 0;	// This is used to disable or not the bulk selection of target warehouse. No reason to have it disabled so forced to 0.
441
+	$disabled = 0; // This is used to disable or not the bulk selection of target warehouse. No reason to have it disabled so forced to 0.
442 442
 
443 443
 	if ($object->statut == Reception::STATUS_DRAFT || ($object->statut == Reception::STATUS_VALIDATED && empty($conf->global->STOCK_CALCULATE_ON_RECEPTION))) {
444 444
 		require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
 				print '<td class="right">'.$langs->trans("SupplierRef").'</td>';
543 543
 				print '<td class="right">'.$langs->trans("QtyOrdered").'</td>';
544 544
 				if ($object->status == Reception::STATUS_DRAFT) {
545
-					print '<td class="right">'.$langs->trans("QtyToReceive");	// Qty to dispatch (sum for all lines of batch detail if there is)
545
+					print '<td class="right">'.$langs->trans("QtyToReceive"); // Qty to dispatch (sum for all lines of batch detail if there is)
546 546
 				} else {
547 547
 					print '<td class="right">'.$langs->trans("QtyDispatchedShort").'</td>';
548 548
 				}
@@ -598,7 +598,7 @@  discard block
 block discarded – undo
598 598
 				if (!$objp->fk_product > 0) {
599 599
 					$nbfreeproduct++;
600 600
 				} else {
601
-					$alreadydispatched = isset($products_dispatched[$objp->rowid])?$products_dispatched[$objp->rowid]:0;
601
+					$alreadydispatched = isset($products_dispatched[$objp->rowid]) ? $products_dispatched[$objp->rowid] : 0;
602 602
 					$remaintodispatch = price2num($objp->qty, 5); // Calculation of dispatched
603 603
 					if ($remaintodispatch < 0 && empty($conf->global->SUPPLIER_ORDER_ALLOW_NEGATIVE_QTY_FOR_SUPPLIER_ORDER_RETURN)) {
604 604
 						$remaintodispatch = 0;
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
 						print '<td></td>'; // Warehouse column
687 687
 
688 688
 						$sql = "SELECT cfd.rowid, cfd.qty, cfd.fk_entrepot, cfd.batch, cfd.eatby, cfd.sellby, cfd.fk_product";
689
-						$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as cfd";	// commande_fournisseur_dispatch should be named receptiondet_batch
689
+						$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as cfd"; // commande_fournisseur_dispatch should be named receptiondet_batch
690 690
 						$sql .= " WHERE cfd.fk_reception = ".((int) $object->id);
691 691
 						$sql .= " AND cfd.fk_commande = ".((int) $objectsrc->id);
692 692
 						$sql .= " AND cfd.fk_commandefourndet = ".(int) $objp->rowid;
@@ -808,10 +808,10 @@  discard block
 block discarded – undo
808 808
 								print '<td>';
809 809
 								if (isModEnabled('productbatch') && $objp->tobatch > 0) {
810 810
 									$type = 'batch';
811
-									print img_picto($langs->trans('AddStockLocationLine'), 'split.png', 'class="splitbutton" '.($numd != $j+1 ? 'style="display:none"' : '').' onClick="addDispatchLine('.$i.', \''.$type.'\')"');
811
+									print img_picto($langs->trans('AddStockLocationLine'), 'split.png', 'class="splitbutton" '.($numd != $j + 1 ? 'style="display:none"' : '').' onClick="addDispatchLine('.$i.', \''.$type.'\')"');
812 812
 								} else {
813 813
 									$type = 'dispatch';
814
-									print img_picto($langs->trans('AddStockLocationLine'), 'split.png', 'class="splitbutton" '.($numd != $j+1 ? 'style="display:none"' : '').' onClick="addDispatchLine('.$i.', \''.$type.'\')"');
814
+									print img_picto($langs->trans('AddStockLocationLine'), 'split.png', 'class="splitbutton" '.($numd != $j + 1 ? 'style="display:none"' : '').' onClick="addDispatchLine('.$i.', \''.$type.'\')"');
815 815
 								}
816 816
 
817 817
 								print '</td>';
Please login to merge, or discard this patch.