Code

Only store application scripts if ! empty
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 5 Sep 2006 04:10:46 +0000 (04:10 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 5 Sep 2006 04:10:46 +0000 (04:10 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4587 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/applications/class_applicationGeneric.inc

index 967eaaf634992091264694944290d529e0881e14..94c6a831f372c879c2619e598b03b7a932bae9a6 100644 (file)
@@ -398,6 +398,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;
 
@@ -407,11 +410,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);