فهرست منبع

Historisation of attachments: added/removed attachments must be tracked within the same change as for other attributes.

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@3777 a333f486-631f-4898-b8df-5754b55c2be0
romainq 9 سال پیش
والد
کامیت
4c5a46589e
1فایلهای تغییر یافته به همراه5 افزوده شده و 11 حذف شده
  1. 5 11
      datamodels/2.x/itop-attachments/main.attachments.php

+ 5 - 11
datamodels/2.x/itop-attachments/main.attachments.php

@@ -476,15 +476,6 @@ EOF
 			}
 			if (count($aActions) > 0)
 			{
-				if ($oChange == null)
-				{
-					// Let's create a change if non is supplied
-					$oChange = MetaModel::NewObject("CMDBChange");
-					$oChange->Set("date", time());
-					$sUserString = CMDBChange::GetCurrentUserName();
-					$oChange->Set("userinfo", $sUserString);
-					$iChangeId = $oChange->DBInsert();							
-				}
 				foreach($aActions as $oChangeOp)
 				{
 					self::RecordHistory($oChange, $oObject, $oChangeOp);
@@ -571,9 +562,12 @@ EOF
 	}
 	
 	/////////////////////////////////////////////////////////////////////////
-	private static function RecordHistory(CMDBChange $oChange, $oTargetObject, $oMyChangeOp)
+	private static function RecordHistory($oChange, $oTargetObject, $oMyChangeOp)
 	{
-		$oMyChangeOp->Set("change", $oChange->GetKey());
+		if (!is_null($oChange))
+		{
+			$oMyChangeOp->Set("change", $oChange->GetKey());
+		}
 		$oMyChangeOp->Set("objclass", get_class($oTargetObject));
 		$oMyChangeOp->Set("objkey", $oTargetObject->GetKey());
 		$iId = $oMyChangeOp->DBInsertNoReload();