From: hickert Date: Tue, 28 Jun 2005 05:44:10 +0000 (+0000) Subject: check for already existing dn, when creating new macro X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=a871661c245ec8b93f6d32897c318df905ab9587;p=gosa.git check for already existing dn, when creating new macro git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@882 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/gofon/macro/class_gofonMacro.inc b/plugins/gofon/macro/class_gofonMacro.inc index 5aa085b11..ee480dd6c 100755 --- a/plugins/gofon/macro/class_gofonMacro.inc +++ b/plugins/gofon/macro/class_gofonMacro.inc @@ -33,6 +33,7 @@ class macro extends plugin /* This is always an account */ $this->is_account= TRUE; + /* Edit or new one ?*/ if ($this->dn == "new"){ $ui= get_userinfo(); @@ -132,6 +133,14 @@ class macro extends plugin { $message = array(); + if($this->dn=="new"){ + $ldap = $this->config->get_ldap_link(); + $ldap->search("(&(objectClass=goFonMacro)(cn=".$this->cn."))",array("cn")); + if($ldap->count()>0){ + $message[]=sprintf(_("The given cn '%s' already exists."),$this->cn); + } + } + if(empty($this->displayName)){ $message[] = _("You must specify the 'Display Name' in order to save this macro"); } @@ -163,7 +172,6 @@ class macro extends plugin $this->execute(); plugin::save(); - unset($this->attrs['base']); /* Write back to ldap */ diff --git a/plugins/gofon/macro/tabs_macros.inc b/plugins/gofon/macro/tabs_macros.inc index 6cf8a2271..27047c7bc 100755 --- a/plugins/gofon/macro/tabs_macros.inc +++ b/plugins/gofon/macro/tabs_macros.inc @@ -14,7 +14,7 @@ class macrotabs extends tabs /* Check for new 'dn', in order to propagate the 'dn' to all plugins */ - $new_dn= "cn=".$baseobject->cn.",".$baseobject->base; + $new_dn= "cn=".$baseobject->cn.",ou=macros,ou=asterisk,ou=config,".$baseobject->base; /* Move group? */ if ($this->dn != $new_dn){