Ver Fonte

Dehardcoded against 'ticket_log', allowing for several case log attributes

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@1270 a333f486-631f-4898-b8df-5754b55c2be0
romainq há 14 anos atrás
pai
commit
2d500c5aa3
1 ficheiros alterados com 7 adições e 9 exclusões
  1. 7 9
      application/cmdbabstract.class.inc.php

+ 7 - 9
application/cmdbabstract.class.inc.php

@@ -209,12 +209,11 @@ abstract class cmdbAbstractObject extends CMDBObject implements iDisplay
 		$oPage->add($this->GetBareProperties($oPage, $bEditMode));		
 
 		// Special case to display the case log, if any...
-		if (MetaModel::IsValidAttCode(get_class($this), 'ticket_log'))
+		foreach(MetaModel::ListAttributeDefs(get_class($this)) as $sAttCode => $oAttDef)
 		{
-			$oAttDef = MetaModel::GetAttributeDef(get_class($this), 'ticket_log');
 			if ($oAttDef instanceof AttributeCaseLog)
 			{
-				$this->DisplayCaseLog($oPage, 'ticket_log', '', '', false);
+				$this->DisplayCaseLog($oPage, $sAttCode, '', '', false);
 			}
 		}
 
@@ -1650,15 +1649,14 @@ EOF
 		}
 
 		// Special case to display the case log, if any...
-		if (MetaModel::IsValidAttCode($sClass, 'ticket_log'))
+		foreach(MetaModel::ListAttributeDefs($sClass) as $sAttCode => $oAttDef)
 		{
-			$oAttDef = MetaModel::GetAttributeDef($sClass, 'ticket_log');
 			if ($oAttDef instanceof AttributeCaseLog)
 			{
-				$sComments = isset($aFieldsComments['ticket_log']) ? $aFieldsComments['ticket_log'] : ' ';
-				$this->DisplayCaseLog($oPage, 'ticket_log', $sComments, $sPrefix, true);
-				$sInputId = $this->m_iFormId.'_ticket_log';
-				$aFieldsMap['ticket_log'] = $sInputId;
+				$sComments = isset($aFieldsComments[$sAttCode]) ? $aFieldsComments[$sAttCode] : ' ';
+				$this->DisplayCaseLog($oPage, $sAttCode, $sComments, $sPrefix, true);
+				$sInputId = $this->m_iFormId.'_'.$sAttCode;
+				$aFieldsMap[$sAttCode] = $sInputId;
 			}
 		}
 		// Now display the relations, one tab per relation