Bläddra i källkod

Fixed Trac #410: added translation for ticket status (and other enum fields) when displaying the History tab.

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@1376 a333f486-631f-4898-b8df-5754b55c2be0
dflaven 14 år sedan
förälder
incheckning
c1b41e8355
1 ändrade filer med 16 tillägg och 2 borttagningar
  1. 16 2
      core/cmdbchangeop.class.inc.php

+ 16 - 2
core/cmdbchangeop.class.inc.php

@@ -212,13 +212,27 @@ class CMDBChangeOpSetAttributeScalar extends CMDBChangeOpSetAttribute
 		$oMonoObjectSet = new DBObjectSet($oTargetSearch);
 		if (UserRights::IsActionAllowedOnAttribute($this->Get('objclass'), $this->Get('attcode'), UR_ACTION_READ, $oMonoObjectSet) == UR_ALLOWED_YES)
 		{
-			if (!MetaModel::IsValidAttCode($this->Get('objclass'), $this->Get('attcode'))) return ''; // Protects against renammed attributes...
+			if (!MetaModel::IsValidAttCode($this->Get('objclass'), $this->Get('attcode'))) return ''; // Protects against renamed attributes...
 
 			$oAttDef = MetaModel::GetAttributeDef($this->Get('objclass'), $this->Get('attcode'));
 			$sAttName = $oAttDef->GetLabel();
 			$sNewValue = $this->Get('newvalue');
 			$sOldValue = $this->Get('oldvalue');
-			if ( (($oAttDef->GetType() == 'String') || ($oAttDef->GetType() == 'Text')) &&
+			if ($oAttDef instanceof AttributeEnum)
+			{
+				// translate the enum values
+				$sOldValue = $oAttDef->GetAsHTML($sOldValue);
+				$sNewValue = $oAttDef->GetAsHTML($sNewValue);
+				if (strlen($sOldValue) == 0)
+				{
+					$sResult = Dict::Format('Change:AttName_SetTo', $sAttName, $sNewValue);
+				}
+				else
+				{
+					$sResult = Dict::Format('Change:AttName_SetTo_NewValue_PreviousValue_OldValue', $sAttName, $sNewValue, $sOldValue);
+				}				
+			}
+			elseif ( (($oAttDef->GetType() == 'String') || ($oAttDef->GetType() == 'Text')) &&
 				 (strlen($sNewValue) > strlen($sOldValue)) )
 			{
 				// Check if some text was not appended to the field