mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 10:38:45 +02:00
N°2163 DB*Tracked methods : modifications after review with Romain
Previous commit : 24eb82d1
Use \CMDBObject::SetTrackInfo
Move \CMDBObject::SetCurrentChange calls at the top most level of the stacks
Restore old behaviors that were removed in previous commit
This commit is contained in:
@@ -43,9 +43,7 @@ class BenchmarkDataCreation
|
||||
var $m_oChange;
|
||||
public function __construct()
|
||||
{
|
||||
$this->m_oChange = MetaModel::NewObject("CMDBChange");
|
||||
$this->m_oChange->Set("date", time());
|
||||
$this->m_oChange->Set("userinfo", "Benchmark setup");
|
||||
CMDBObject::SetTrackInfo('Benchmark setup');
|
||||
}
|
||||
|
||||
public function PlanStructure($iPlannedContacts, $iPlannedContracts)
|
||||
@@ -147,7 +145,6 @@ class BenchmarkDataCreation
|
||||
$oMyObject->Set($sProp, $value);
|
||||
}
|
||||
|
||||
$oMyObject::SetCurrentChange($this->m_oChange);
|
||||
$iId = $oMyObject->DBInsertNoReload();
|
||||
|
||||
$sClassId = "$sClass ($sClassDesc)";
|
||||
|
||||
@@ -434,22 +434,13 @@ abstract class TestBizModel extends TestHandler
|
||||
}
|
||||
protected function ObjectToDB($oNew, $bReload = false)
|
||||
{
|
||||
if ($oNew instanceof CMDBObject)
|
||||
if ($bReload)
|
||||
{
|
||||
$oChange = $this->GetCurrentChange();
|
||||
$oNew::SetCurrentChange($oChange);
|
||||
$oNew->DBWrite();
|
||||
$iId = $oNew->DBInsert();
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($bReload)
|
||||
{
|
||||
$iId = $oNew->DBInsert();
|
||||
}
|
||||
else
|
||||
{
|
||||
$iId = $oNew->DBInsertNoReload();
|
||||
}
|
||||
$iId = $oNew->DBInsertNoReload();
|
||||
}
|
||||
return $iId;
|
||||
}
|
||||
|
||||
@@ -342,12 +342,9 @@ class TestMyBizModel extends TestBizModel
|
||||
self::DumpVariable($team->ListChanges());
|
||||
echo "New headcount = {$team->Get("headcount")}</br>\n";
|
||||
echo "Computed name = {$team->Get("name")}</br>\n";
|
||||
|
||||
$oMyChange = MetaModel::NewObject("CMDBChange");
|
||||
$oMyChange->Set("date", time());
|
||||
$oMyChange->Set("userinfo", "test_setattribute / Made by robot #".rand(1,100));
|
||||
|
||||
CMDBObject::SetTrackInfo('test_setattribute / Made by robot #'.rand(1, 100));
|
||||
//DBSearch::StartDebugQuery();
|
||||
$team::SetCurrentChange($oMyChange);
|
||||
$team->DBUpdate();
|
||||
//DBSearch::StopDebugQuery();
|
||||
|
||||
@@ -524,12 +521,8 @@ class TestMyBizModel extends TestBizModel
|
||||
echo "<h5>New workshops</h5>\n";
|
||||
$oSetWorkshopsCurr = $oObj->Get("myworkshops");
|
||||
$this->show_list($oSetWorkshopsCurr);
|
||||
|
||||
$oMyChange = MetaModel::NewObject("CMDBChange");
|
||||
$oMyChange->Set("date", time());
|
||||
$oMyChange->Set("userinfo", "test_linkedset / Made by robot #".rand(1,100));
|
||||
$iChangeId = $oMyChange->DBInsert();
|
||||
$oObj::SetCurrentChange($oMyChange);
|
||||
|
||||
CMDBObject::SetTrackInfo('test_linkedset / Made by robot #'.rand(1, 100));
|
||||
$oObj->DBUpdate();
|
||||
$oObj = MetaModel::GetObject("cmdbContact", 18);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user