Completed
Branch develop (0f69c7)
by
unknown
17:50
created
htdocs/core/modules/DolibarrModules.class.php 2 patches
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 
141 141
 	const KEY_ID = 0;
142 142
 	const KEY_LABEL = 1;
143
-	const KEY_TYPE = 2;	// deprecated
143
+	const KEY_TYPE = 2; // deprecated
144 144
 	const KEY_DEFAULT = 3;
145 145
 	const KEY_FIRST_LEVEL = 4;
146 146
 	const KEY_SECOND_LEVEL = 5;
@@ -624,7 +624,7 @@  discard block
 block discarded – undo
624 624
 				$moduleNameInConf = 'supplier_proposal';
625 625
 			}
626 626
 
627
-			unset($conf->modules[$moduleNameInConf]);	// Add this module in list of enabled modules so isModEnabled() will work (conf->module->enabled must no more be used)
627
+			unset($conf->modules[$moduleNameInConf]); // Add this module in list of enabled modules so isModEnabled() will work (conf->module->enabled must no more be used)
628 628
 
629 629
 			return 1;
630 630
 		} else {
@@ -720,7 +720,7 @@  discard block
 block discarded – undo
720 720
 		$pathoffile = $this->getDescLongReadmeFound();
721 721
 
722 722
 		if ($pathoffile) {     // Mostly for external modules
723
-			$content = file_get_contents($pathoffile, false, null, 0, 1024 * 1024);	// Max size loaded 1Mb
723
+			$content = file_get_contents($pathoffile, false, null, 0, 1024 * 1024); // Max size loaded 1Mb
724 724
 
725 725
 			if ((float) DOL_VERSION >= 6.0) {
726 726
 				@include_once DOL_DOCUMENT_ROOT.'/core/lib/parsemd.lib.php';
@@ -1485,7 +1485,7 @@  discard block
 block discarded – undo
1485 1485
 
1486 1486
 				$sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes_def";
1487 1487
 				$sql .= " WHERE file = '".$this->db->escape($file)."'";
1488
-				$sql .= " AND entity = ".$conf->entity;		// Do not use getEntity here, we want to delete only in current company
1488
+				$sql .= " AND entity = ".$conf->entity; // Do not use getEntity here, we want to delete only in current company
1489 1489
 
1490 1490
 				dol_syslog(get_class($this)."::delete_boxes", LOG_DEBUG);
1491 1491
 				$resql = $this->db->query($sql);
@@ -1908,9 +1908,9 @@  discard block
 block discarded – undo
1908 1908
 
1909 1909
 				// If the module is active
1910 1910
 				foreach ($this->rights as $key => $value) {
1911
-					$r_id = $this->rights[$key][self::KEY_ID];	// permission id in llx_rights_def (not unique because primary key is couple id-entity)
1911
+					$r_id = $this->rights[$key][self::KEY_ID]; // permission id in llx_rights_def (not unique because primary key is couple id-entity)
1912 1912
 					$r_label = $this->rights[$key][self::KEY_LABEL];
1913
-					$r_type	= $this->rights[$key][self::KEY_TYPE] ?? 'w';	// TODO deprecated
1913
+					$r_type = $this->rights[$key][self::KEY_TYPE] ?? 'w'; // TODO deprecated
1914 1914
 					$r_default = $this->rights[$key][self::KEY_DEFAULT] ?? 0;
1915 1915
 					$r_perms = $this->rights[$key][self::KEY_FIRST_LEVEL] ?? '';
1916 1916
 					$r_subperms = $this->rights[$key][self::KEY_SECOND_LEVEL] ?? '';
@@ -1934,7 +1934,7 @@  discard block
 block discarded – undo
1934 1934
 					}
1935 1935
 
1936 1936
 					// condition to show or hide a user right (default: 1) (eg isModEnabled('anothermodule') or ($conf->global->MAIN_FEATURES_LEVEL > 0) or etc..)
1937
-					$r_enabled	= $this->rights[$key][self::KEY_ENABLED] ?? '1';
1937
+					$r_enabled = $this->rights[$key][self::KEY_ENABLED] ?? '1';
1938 1938
 
1939 1939
 					// Search if perm already present
1940 1940
 					$sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."rights_def";
@@ -1951,7 +1951,7 @@  discard block
 block discarded – undo
1951 1951
 							$sql .= ", libelle";
1952 1952
 							$sql .= ", module";
1953 1953
 							$sql .= ", module_origin";
1954
-							$sql .= ", type";	// TODO deprecated
1954
+							$sql .= ", type"; // TODO deprecated
1955 1955
 							$sql .= ", bydefault";
1956 1956
 							$sql .= ", perms";
1957 1957
 							$sql .= ", subperms";
@@ -1962,12 +1962,12 @@  discard block
 block discarded – undo
1962 1962
 							$sql .= ", '".$this->db->escape($r_label)."'";
1963 1963
 							$sql .= ", '".$this->db->escape($r_module)."'";
1964 1964
 							$sql .= ", '".$this->db->escape($r_module_origin)."'";
1965
-							$sql .= ", '".$this->db->escape($r_type)."'";	// TODO deprecated
1965
+							$sql .= ", '".$this->db->escape($r_type)."'"; // TODO deprecated
1966 1966
 							$sql .= ", ".((int) $r_default);
1967 1967
 							$sql .= ", '".$this->db->escape($r_perms)."'";
1968 1968
 							$sql .= ", '".$this->db->escape($r_subperms)."'";
1969 1969
 							$sql .= ", '".$this->db->escape($r_enabled)."'";
1970
-							$sql.= ")";
1970
+							$sql .= ")";
1971 1971
 
1972 1972
 							$resqlinsert = $this->db->query($sql, 1);
1973 1973
 
@@ -2567,36 +2567,36 @@  discard block
 block discarded – undo
2567 2567
 		}
2568 2568
 
2569 2569
 		if ($this->isCoreOrExternalModule() == 'external' || preg_match('/development|experimental|deprecated/i', $version)) {
2570
-			$versionTitle =  $langs->trans("Version").' '.$this->getVersion(1);
2570
+			$versionTitle = $langs->trans("Version").' '.$this->getVersion(1);
2571 2571
 			if ($this->needUpdate) {
2572 2572
 				$versionTitle .= '<br>'.$langs->trans('ModuleUpdateAvailable').' : '.$this->lastVersion;
2573 2573
 			}
2574 2574
 
2575
-			$return .=  '<span class="info-box-icon-version'.($versiontrans ? ' '.$versiontrans : '').' classfortooltip" title="'.dol_escape_js($versionTitle).'" >';
2576
-			$return .=  $this->getVersion(1);
2577
-			$return .=  '</span>';
2575
+			$return .= '<span class="info-box-icon-version'.($versiontrans ? ' '.$versiontrans : '').' classfortooltip" title="'.dol_escape_js($versionTitle).'" >';
2576
+			$return .= $this->getVersion(1);
2577
+			$return .= '</span>';
2578 2578
 		}
2579 2579
 
2580
-		$return .=  '</div>
2580
+		$return .= '</div>
2581 2581
 	    <div class="info-box-content info-box-text-module'.(!getDolGlobalString($const_name) ? '' : ' info-box-module-enabled'.($versiontrans ? ' info-box-content-warning' : '')).'">
2582 2582
 	    <span class="info-box-title">'.$this->getName().'</span>
2583 2583
 	    <span class="info-box-desc twolinesmax opacitymedium" title="'.dol_escape_htmltag($this->getDesc()).'">'.nl2br($this->getDesc()).'</span>';
2584 2584
 
2585
-		$return .=  '<div class="valignmiddle inline-block info-box-more">';
2585
+		$return .= '<div class="valignmiddle inline-block info-box-more">';
2586 2586
 		//if ($versiontrans) print img_warning($langs->trans("Version").' '.$this->getVersion(1)).' ';
2587
-		$return .=  '<a class="valignmiddle inline-block" href="javascript:document_preview(\''.DOL_URL_ROOT.'/admin/modulehelp.php?id='.((int) $this->numero).'\',\'text/html\',\''.dol_escape_js($langs->trans("Module")).'\')">'.img_picto(($this->isCoreOrExternalModule() == 'external' ? $langs->trans("ExternalModule").' - ' : '').$langs->trans("ClickToShowDescription"), $imginfo).'</a>';
2588
-		$return .=  '</div><br>';
2589
-
2590
-		$return .=  '<div class="valignmiddle inline-block info-box-actions">';
2591
-		$return .=  '<div class="valignmiddle inline-block info-box-setup">';
2592
-		$return .=  $codetoconfig;
2593
-		$return .=  '</div>';
2594
-		$return .=  '<div class="valignmiddle inline-block marginleftonly marginrightonly">';
2595
-		$return .=  $codeenabledisable;
2596
-		$return .=  '</div>';
2597
-		$return .=  '</div>';
2598
-
2599
-		$return .=  '
2587
+		$return .= '<a class="valignmiddle inline-block" href="javascript:document_preview(\''.DOL_URL_ROOT.'/admin/modulehelp.php?id='.((int) $this->numero).'\',\'text/html\',\''.dol_escape_js($langs->trans("Module")).'\')">'.img_picto(($this->isCoreOrExternalModule() == 'external' ? $langs->trans("ExternalModule").' - ' : '').$langs->trans("ClickToShowDescription"), $imginfo).'</a>';
2588
+		$return .= '</div><br>';
2589
+
2590
+		$return .= '<div class="valignmiddle inline-block info-box-actions">';
2591
+		$return .= '<div class="valignmiddle inline-block info-box-setup">';
2592
+		$return .= $codetoconfig;
2593
+		$return .= '</div>';
2594
+		$return .= '<div class="valignmiddle inline-block marginleftonly marginrightonly">';
2595
+		$return .= $codeenabledisable;
2596
+		$return .= '</div>';
2597
+		$return .= '</div>';
2598
+
2599
+		$return .= '
2600 2600
 	    </div><!-- /.info-box-content -->
2601 2601
 	    </div><!-- /.info-box -->
2602 2602
 	    </div>';
@@ -2615,7 +2615,7 @@  discard block
 block discarded – undo
2615 2615
 	{
2616 2616
 		require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
2617 2617
 		if (!empty($this->url_last_version)) {
2618
-			$lastVersion = getURLContent($this->url_last_version, 'GET', '', 1, array(), array('http', 'https'), 0);	// Accept http or https links on external remote server only
2618
+			$lastVersion = getURLContent($this->url_last_version, 'GET', '', 1, array(), array('http', 'https'), 0); // Accept http or https links on external remote server only
2619 2619
 			if (isset($lastVersion['content']) && strlen($lastVersion['content']) < 30) {
2620 2620
 				// Security warning :  be careful with remote data content, the module editor could be hacked (or evil) so limit to a-z A-Z 0-9 _ . -
2621 2621
 				$this->lastVersion = preg_replace("/[^a-zA-Z0-9_\.\-]+/", "", $lastVersion['content']);
@@ -2655,7 +2655,7 @@  discard block
 block discarded – undo
2655 2655
 	{
2656 2656
 		$fields = array('name', 'lib', 'sql', 'sqlsort', 'field', 'fieldvalue', 'fieldinsert', 'rowid', 'cond', 'help', 'fieldcheck');
2657 2657
 		foreach ($fields as $field) {
2658
-			$this->dictionaries['tab' . $field][] = $dictionaryArray[$field];
2658
+			$this->dictionaries['tab'.$field][] = $dictionaryArray[$field];
2659 2659
 		}
2660 2660
 		if ($langs && !in_array($langs, $this->dictionaries[$langs])) $this->dictionaries['langs'][] = $langs;
2661 2661
 	}
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2657,6 +2657,8 @@
 block discarded – undo
2657 2657
 		foreach ($fields as $field) {
2658 2658
 			$this->dictionaries['tab' . $field][] = $dictionaryArray[$field];
2659 2659
 		}
2660
-		if ($langs && !in_array($langs, $this->dictionaries[$langs])) $this->dictionaries['langs'][] = $langs;
2660
+		if ($langs && !in_array($langs, $this->dictionaries[$langs])) {
2661
+			$this->dictionaries['langs'][] = $langs;
2662
+		}
2661 2663
 	}
2662 2664
 }
Please login to merge, or discard this patch.