mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 02:58:43 +02:00
Improved the change tracking to simplify the development of plugins (1st step... still to be drastically simplified)
SVN:1.2[1847]
This commit is contained in:
@@ -93,6 +93,23 @@ abstract class CMDBObject extends DBObject
|
||||
protected static $m_oCurrChange = null;
|
||||
|
||||
|
||||
public static function SetCurrentChange(CMDBChange $oChange)
|
||||
{
|
||||
self::$m_oCurrChange = $oChange;
|
||||
}
|
||||
|
||||
//
|
||||
// Todo: simplify the APIs and do not pass the current change as an argument anymore
|
||||
// SetCurrentChange to be invoked in very few cases (UI.php, CSV import, Data synchro)
|
||||
// GetCurrentChange to be called ONCE (!) by CMDBChangeOp::OnInsert ($this->Set('change', ..GetCurrentChange())
|
||||
// GetCurrentChange to create a default change if not already done in the current context
|
||||
//
|
||||
public static function GetCurrentChange()
|
||||
{
|
||||
return self::$m_oCurrChange;
|
||||
}
|
||||
|
||||
|
||||
private function RecordObjCreation(CMDBChange $oChange)
|
||||
{
|
||||
$oMyChangeOp = MetaModel::NewObject("CMDBChangeOpCreate");
|
||||
|
||||
@@ -1303,6 +1303,11 @@ abstract class DBObject
|
||||
return $this->DBInsert();
|
||||
}
|
||||
|
||||
public function DBInsertTrackedNoReload(CMDBChange $oVoid)
|
||||
{
|
||||
return $this->DBInsertNoReload();
|
||||
}
|
||||
|
||||
// Creates a copy of the current object into the database
|
||||
// Returns the id of the newly created object
|
||||
public function DBClone($iNewKey = null)
|
||||
|
||||
@@ -304,6 +304,9 @@ try
|
||||
$sUserString .= ' (CSV)';
|
||||
$oMyChange->Set("userinfo", $sUserString);
|
||||
$iChangeId = $oMyChange->DBInsert();
|
||||
|
||||
// Todo - simplify that when reworking the change tracking
|
||||
CMDBObject::SetCurrentChange($oMyChange);
|
||||
}
|
||||
|
||||
$oBulk = new BulkChange(
|
||||
|
||||
Reference in New Issue
Block a user