mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-21 00:02:17 +02:00
🎨 \DBObject::DBDeleteSingleObject : isolate exit condition at the top
This commit is contained in:
@@ -3254,14 +3254,18 @@ abstract class DBObject implements iDisplay
|
||||
*/
|
||||
protected function DBDeleteSingleObject()
|
||||
{
|
||||
if (!MetaModel::DBIsReadOnly())
|
||||
if (MetaModel::DBIsReadOnly())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$this->OnDelete();
|
||||
|
||||
// Activate any existing trigger
|
||||
$sClass = get_class($this);
|
||||
$aParams = array('class_list' => MetaModel::EnumParentClasses($sClass, ENUM_PARENT_CLASSES_ALL));
|
||||
$oSet = new DBObjectSet(DBObjectSearch::FromOQL("SELECT TriggerOnObjectDelete AS t WHERE t.target_class IN (:class_list)"), array(), $aParams);
|
||||
$oSet = new DBObjectSet(DBObjectSearch::FromOQL("SELECT TriggerOnObjectDelete AS t WHERE t.target_class IN (:class_list)"), array(),
|
||||
$aParams);
|
||||
while ($oTrigger = $oSet->Fetch())
|
||||
{
|
||||
/** @var \Trigger $oTrigger */
|
||||
@@ -3316,7 +3320,6 @@ abstract class DBObject implements iDisplay
|
||||
// objects, reported as bug N°926)
|
||||
// Thought the key is not reset, using DBInsert or DBWrite will create an object having the same characteristics and a new ID. DBUpdate is protected
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete an object
|
||||
|
||||
Reference in New Issue
Block a user