瀏覽代碼

entity coloring, multicompanyextrafiekds fixes

szollosil 9 月之前
父節點
當前提交
dab7eca215
共有 2 個文件被更改,包括 55 次插入18 次删除
  1. 53 16
      core/class/extrafields.class.php
  2. 2 2
      custom/multicompany/css/multicompany.css.php

+ 53 - 16
core/class/extrafields.class.php

@@ -43,6 +43,30 @@ class ExtraFields
 	 */
 	public $db;
 
+	/**
+	 * @var array Array with type of the extra field
+	 * @deprecated
+	 */
+	public $attribute_type;
+
+	/**
+	 * @var array Array with label of extra field
+	 * @deprecated
+	 */
+	public $attribute_label;
+
+	/**
+	 * @var array Array with list of possible values for some types of extra fields
+	 * @deprecated
+	 */
+	public $attribute_choice;
+
+	/**
+	 * @var array array to store extrafields definition
+	 * @deprecated
+	 */
+	public $attribute_list;
+	
 	/**
 	 * @var array New array to store extrafields definition
 	 */
@@ -108,6 +132,9 @@ class ExtraFields
 		$this->error = '';
 		$this->errors = array();
 		$this->attributes = array();
+		
+		$this->attribute_type = array();
+		$this->attribute_label = array();
 	}
 
 	/**
@@ -875,6 +902,10 @@ class ExtraFields
 						$array_name_label[$tab->name] = $tab->label;
 					}
 
+					// Old usage
+					$this->attribute_type[$tab->name] = $tab->type;
+					$this->attribute_label[$tab->name] = $tab->label;
+
 					$this->attributes[$tab->elementtype]['type'][$tab->name] = $tab->type;
 					$this->attributes[$tab->elementtype]['label'][$tab->name] = $tab->label;
 					$this->attributes[$tab->elementtype]['size'][$tab->name] = $tab->size;
@@ -949,22 +980,28 @@ class ExtraFields
 			dol_syslog(get_class($this).'::showInputField extrafieldsobjectkey required', LOG_ERR);
 			return 'BadValueForParamExtraFieldsObjectKey';
 		}
-
-		$label = $this->attributes[$extrafieldsobjectkey]['label'][$key];
-		$type = $this->attributes[$extrafieldsobjectkey]['type'][$key];
-		$size = $this->attributes[$extrafieldsobjectkey]['size'][$key];
-		$default = $this->attributes[$extrafieldsobjectkey]['default'][$key];
-		$computed = $this->attributes[$extrafieldsobjectkey]['computed'][$key];
-		$unique = $this->attributes[$extrafieldsobjectkey]['unique'][$key];
-		$required = $this->attributes[$extrafieldsobjectkey]['required'][$key];
-		$param = $this->attributes[$extrafieldsobjectkey]['param'][$key];
-		$perms = dol_eval($this->attributes[$extrafieldsobjectkey]['perms'][$key], 1, 1, '1');
-		$langfile = $this->attributes[$extrafieldsobjectkey]['langfile'][$key];
-		$list = dol_eval($this->attributes[$extrafieldsobjectkey]['list'][$key], 1, 1, '1');
-		$totalizable = $this->attributes[$extrafieldsobjectkey]['totalizable'][$key];
-		$help = $this->attributes[$extrafieldsobjectkey]['help'][$key];
-		$hidden = (empty($list) ? 1 : 0); // If empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller)
-
+		if (!empty($extrafieldsobjectkey)) {
+			$label = $this->attributes[$extrafieldsobjectkey]['label'][$key];
+			$type = $this->attributes[$extrafieldsobjectkey]['type'][$key];
+			$size = $this->attributes[$extrafieldsobjectkey]['size'][$key];
+			$default = $this->attributes[$extrafieldsobjectkey]['default'][$key];
+			$computed = $this->attributes[$extrafieldsobjectkey]['computed'][$key];
+			$unique = $this->attributes[$extrafieldsobjectkey]['unique'][$key];
+			$required = $this->attributes[$extrafieldsobjectkey]['required'][$key];
+			$param = $this->attributes[$extrafieldsobjectkey]['param'][$key];
+			$perms = dol_eval($this->attributes[$extrafieldsobjectkey]['perms'][$key], 1, 1, '1');
+			$langfile = $this->attributes[$extrafieldsobjectkey]['langfile'][$key];
+			$list = dol_eval($this->attributes[$extrafieldsobjectkey]['list'][$key], 1, 1, '1');
+			$totalizable = $this->attributes[$extrafieldsobjectkey]['totalizable'][$key];
+			$help = $this->attributes[$extrafieldsobjectkey]['help'][$key];
+			$hidden = (empty($list) ? 1 : 0); // If empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller)
+		} else {
+			// Old usage
+			$label = $this->attribute_label[$key];
+			$type = $this->attribute_type[$key];
+			$list = $this->attribute_list[$key];
+			$hidden = (empty($list) ? 1 : 0); // If empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller)
+		}
 		if ($computed) {
 			if (!preg_match('/^search_/', $keyprefix)) {
 				return '<span class="opacitymedium">'.$langs->trans("AutomaticallyCalculated").'</span>';

+ 2 - 2
custom/multicompany/css/multicompany.css.php

@@ -374,7 +374,7 @@ tr.multiselect-separator td {
 }
 
 <?php
-/* if (($conf->global->MAIN_THEME === 'eldy' && empty($conf->global->MULTICOMPANY_DROPDOWN_MENU_DISABLED) && ! GETPOSTISSET('theme')) || (GETPOSTISSET('theme') && GETPOST('theme', 'aZ', 1) === 'eldy')) {
+if (($conf->global->MAIN_THEME === 'eldy' && empty($conf->global->MULTICOMPANY_DROPDOWN_MENU_DISABLED) && ! GETPOSTISSET('theme')) || (GETPOSTISSET('theme') && GETPOST('theme', 'aZ', 1) === 'eldy')) {
 	include dol_buildpath('/multicompany/css/dropdown.inc.php');
 }
 
@@ -404,7 +404,7 @@ a.tmenusel:link, a.tmenusel:visited, a.tmenusel:hover, a.tmenusel:active{
 	color: #'.$colors[3].' !important;
 }
 	';
-} */
+}
 $usedropdownmenu = false;
 if (empty($conf->global->MULTICOMPANY_DROPDOWN_MENU_DISABLED)) {
 	// For theme test link