Deletion of objects:

- automatic delete of mandatory ext keys, and if the option is set in the data model (I've set the "manual" option by default, and the "auto" option for links)
- automatic reset of optional ext keys (several keys could be updated on one single object)
- takes into account the user rights
- security against the use of page arguments when the automatic deletion is not allowed
Known limitations:
- does not check that resetting an ext key could affect the lifecycle consistency (e.g. delete a workgroup referenced by a ticket)
- does not check recursively on the automatic deletion, which should not be a problem given the current data model (TBC)

SVN:trunk[181]
This commit is contained in:
Romain Quetiez
2009-09-18 16:12:38 +00:00
parent 0454e7fa78
commit 048406ab47
20 changed files with 415 additions and 131 deletions

View File

@@ -17,6 +17,20 @@ define('EXTKEY_RELATIVE', 1);
*/
define('EXTKEY_ABSOLUTE', 2);
/**
* Propagation of the deletion through an external key - ask the user to delete the referencing object
*
* @package iTopORM
*/
define('DEL_MANUAL', 1);
/**
* Propagation of the deletion through an external key - ask the user to delete the referencing object
*
* @package iTopORM
*/
define('DEL_AUTO', 2);
/**
* Attribute definition API, implemented in and many flavours (Int, String, Enum, etc.)
@@ -805,7 +819,7 @@ class AttributeExternalKey extends AttributeDBFieldVoid
{
static protected function ListExpectedParams()
{
return array_merge(parent::ListExpectedParams(), array("targetclass", "is_null_allowed"));
return array_merge(parent::ListExpectedParams(), array("targetclass", "is_null_allowed", "on_target_delete"));
}
public function GetType() {return "Extkey";}
@@ -862,6 +876,11 @@ class AttributeExternalKey extends AttributeDBFieldVoid
return $oValSetDef->GetValues($aArgs, $sBeginsWith);
}
}
public function GetDeletionPropagationOption()
{
return $this->Get("on_target_delete");
}
}
/**