Преглед изворни кода

Bug fix: when doing a bulk modify (or bulk apply stimulus) the external keys that were read-only in the edition form were displayed as "ClassName #id" instead of using their friendly name. This is now fixed, but requires a load of the target object.

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@1186 a333f486-631f-4898-b8df-5754b55c2be0
dflaven пре 14 година
родитељ
комит
9066d9a138
1 измењених фајлова са 5 додато и 1 уклоњено
  1. 5 1
      core/dbobject.class.php

+ 5 - 1
core/dbobject.class.php

@@ -524,7 +524,11 @@ abstract class DBObject
 		//
 		//
 		if (empty($sLabel))
 		if (empty($sLabel))
 		{
 		{
-			$sLabel = MetaModel::GetName($sObjClass)." #$sObjKey";
+			// If the object if not issued from a query but constructed programmatically
+			// the label may be empty. In this case run a query to get the object's friendly name
+			$oTmpObj = MetaModel::GetObject($sObjClass, $sObjKey);
+			$sLabel = $oTmpObj->GetName();
+			//$sLabel = MetaModel::GetName($sObjClass)." #$sObjKey";
 		}
 		}
 		$sHint = MetaModel::GetName($sObjClass)."::$sObjKey";
 		$sHint = MetaModel::GetName($sObjClass)."::$sObjKey";
 		return "<a href=\"{$sAbsoluteUrl}{$sPage}?operation=details&class=$sObjClass&id=$sObjKey&".$oAppContext->GetForLink()."\" title=\"$sHint\">$sLabel</a>";
 		return "<a href=\"{$sAbsoluteUrl}{$sPage}?operation=details&class=$sObjClass&id=$sObjKey&".$oAppContext->GetForLink()."\" title=\"$sHint\">$sLabel</a>";