From: hickert Date: Tue, 5 Sep 2006 03:52:14 +0000 (+0000) Subject: Only store application scripts if ! empty X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=24e80dc1e706cf9b0cfb1b81fa37d008dff78dbe;p=gosa.git Only store application scripts if ! empty git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@4586 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/admin/applications/class_applicationGeneric.inc b/plugins/admin/applications/class_applicationGeneric.inc index 92da9a56b..42626b91e 100644 --- a/plugins/admin/applications/class_applicationGeneric.inc +++ b/plugins/admin/applications/class_applicationGeneric.inc @@ -406,6 +406,9 @@ class application extends plugin /* Save to LDAP */ function save() { + /* Get application script without header part, to check if we must save the script itself */ + $script = preg_replace('/.*### END HEADER ###/s', '', $this->gotoLogonScript); + plugin::save(); $this->attrs["gosaApplicationIcon"]= $this->gosaApplicationIcon; @@ -415,11 +418,23 @@ class application extends plugin $a= $ldap->fetch(); if (count($a)){ + + /* Remove gotoLogonScript if it is empty */ + if(empty($script)) { + $this->attrs['gotoLogonScript'] = array(); + } + $ldap->cd($this->dn); $this->cleanup(); $ldap->modify ($this->attrs); $this->handle_post_events("modify"); } else { + + /* Remove gotoLogonScript if it is empty */ + if(empty($script)) { + unset($this->attrs['gotoLogonScript']); + } + $ldap->cd($this->config->current['BASE']); $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn)); $ldap->cd($this->dn);