mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
Data synchro: if the object is deleted from within iTop, do cleanup sync table and replica as well
SVN:trunk[1223]
This commit is contained in:
@@ -1300,13 +1300,20 @@ class SynchroReplica extends DBObject implements iDisplay
|
||||
|
||||
// Overload the deletion -> the replica has been created by the mean of a trigger,
|
||||
// it will be deleted by the mean of a trigger too
|
||||
public function DBDelete(&$oDeletionPlan = null)
|
||||
protected function DBDeleteSingleObject()
|
||||
{
|
||||
$oDataSource = MetaModel::GetObject('SynchroDataSource', $this->Get('sync_source_id'));
|
||||
$sTable = $oDataSource->GetDataTable();
|
||||
$this->OnDelete();
|
||||
|
||||
$sSQL = "DELETE FROM `$sTable` WHERE id = '{$this->GetKey()}'";
|
||||
CMDBSource::Query($sSQL);
|
||||
if (!MetaModel::DBIsReadOnly())
|
||||
{
|
||||
$oDataSource = MetaModel::GetObject('SynchroDataSource', $this->Get('sync_source_id'));
|
||||
$sTable = $oDataSource->GetDataTable();
|
||||
|
||||
$sSQL = "DELETE FROM `$sTable` WHERE id = '{$this->GetKey()}'";
|
||||
CMDBSource::Query($sSQL);
|
||||
}
|
||||
|
||||
$this->AfterDelete();
|
||||
|
||||
$this->m_bIsInDB = false;
|
||||
$this->m_iKey = null;
|
||||
|
||||
Reference in New Issue
Block a user