Bloque la suppression d'entité ou d'organisation ayant des filles

This commit is contained in:
Benjamin Dauvergne 2015-04-01 02:03:48 +02:00
parent e83c63e0de
commit afe35d65c6
2 changed files with 24 additions and 0 deletions

View File

@ -20,6 +20,15 @@
******************************************************************************/
function before_delete_entite($object) {
$entite = new LSsupannEntite();
if ($entite->listChildren($object)) {
LSerror::addErrorCode('Cette entité a des entités filles, vous ne pouvez pas la supprimer');
return false;
}
return $false;
}
$GLOBALS['LSobjects']['LSsupannEntite'] = array (
'objectclass' => array(
'supannEntite',
@ -31,6 +40,9 @@ $GLOBALS['LSobjects']['LSsupannEntite'] = array (
'label' => 'Entités',
'displayAttrName' => true,
// triggers
'before_delete' => 'before_delete_entite',
// LSform
'LSform' => array (
'ajaxSubmit' => 1,

View File

@ -20,6 +20,15 @@
******************************************************************************/
function before_delete_organization($object) {
$org = new LSsupannEntite();
if ($org->listChildren($object)) {
LSerror::addErrorCode('Cette organisation a des entités filles, vous ne pouvez pas la supprimer');
return false;
}
return $false;
}
$GLOBALS['LSobjects']['LSsupannOrg'] = array (
'objectclass' => array(
'organization',
@ -33,6 +42,9 @@ $GLOBALS['LSobjects']['LSsupannOrg'] = array (
'label' => 'Organisations',
'displayAttrName' => true,
// triggers
'before_delete' => 'before_delete_organization',
// LSform
'LSform' => array (
'ajaxSubmit' => 1,