Browse Source

Better (?) handling of deletion issues during the synchro...

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@1368 a333f486-631f-4898-b8df-5754b55c2be0
dflaven 14 years ago
parent
commit
fb2a3ae0ea
1 changed files with 13 additions and 3 deletions
  1. 13 3
      synchro/synchrodatasource.class.inc.php

+ 13 - 3
synchro/synchrodatasource.class.inc.php

@@ -1761,9 +1761,19 @@ class SynchroReplica extends DBObject implements iDisplay
 			try
 			{
 				$oDestObj = MetaModel::GetObject($this->Get('dest_class'), $this->Get('dest_id'));
-				$oDestObj->DBDeleteTracked($oChange);
-				$this->DBDeleteTracked($oChange);
-				$oStatLog->Inc('stats_nb_obj_deleted');
+				$oCheckDeletionPlan = new DeletionPlan();
+				if ($oDestObj->CheckToDelete($oCheckDeletionPlan))
+				{
+					$oActualDeletionPlan = new DeletionPlan();
+					$oDestObj->DBDeleteTracked($oChange, null, $oActualDeletionPlan);
+					$this->DBDeleteTracked($oChange);
+					$oStatLog->Inc('stats_nb_obj_deleted');
+				}
+				else
+				{
+					$sIssues = implode("\n", $oCheckDeletionPlan->GetIssues());
+					throw(new Exception($sIssues));
+				}
 			}
 			catch(Exception $e)
 			{