diff --git a/local/conf/LSobjects/config.LSobjects.LSsupannEntite.php b/local/conf/LSobjects/config.LSobjects.LSsupannEntite.php index dee33bc..4467ceb 100644 --- a/local/conf/LSobjects/config.LSobjects.LSsupannEntite.php +++ b/local/conf/LSobjects/config.LSobjects.LSsupannEntite.php @@ -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, diff --git a/local/conf/LSobjects/config.LSobjects.LSsupannOrg.php b/local/conf/LSobjects/config.LSobjects.LSsupannOrg.php index 169d256..d7a8498 100644 --- a/local/conf/LSobjects/config.LSobjects.LSsupannOrg.php +++ b/local/conf/LSobjects/config.LSobjects.LSsupannOrg.php @@ -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,