Code

Updated macro editing
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 9 Apr 2010 15:07:41 +0000 (15:07 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 9 Apr 2010 15:07:41 +0000 (15:07 +0000)
-Save LDAP entries even if mysql-transactions fails ... else we loss all macro changes.

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@17569 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/gofon/gofon/macro/class_gofonMacro.inc

index 64c36bf49c85f350e15071876e4dea6deed751bd..725df304a553e49057f863af206e1bd0a998fa13 100644 (file)
@@ -508,35 +508,35 @@ class macro extends plugin
     $str = $this->add_to_database(true);
     if($str){
       msg_dialog::display(_("Error"), $str, ERROR_DIALOG);
-    }else{
-      /* Write back to ldap */
-      $ldap= $this->config->get_ldap_link();
-      $ldap->cat($this->dn, array('dn'));
-      $a= $ldap->fetch();
+    }
+
+    /* Write back to ldap */
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cat($this->dn, array('dn'));
+    $a= $ldap->fetch();
 
-      if (count($a)){
+    if (count($a)){
         $ldap->cd($this->dn);
         $this->cleanup();
         $ldap->modify ($this->attrs); 
 
         $this->handle_post_events("modify");
-      } else {
+    } else {
         $ldap->cd($this->config->current['BASE']);
         $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
         $ldap->cd($this->dn);
         $ldap->add($this->attrs);
         $this->handle_post_events("add");
-      }
-      if (!$ldap->success()){
+    }
+    if (!$ldap->success()){
         msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, 0, get_class()));
-      }
+    }
 
-      /* Log last action */
-      if($this->initially_was_account){
+    /* Log last action */
+    if($this->initially_was_account){
         new log("modify","gofonmacro/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-      }else{
+    }else{
         new log("create","gofonmacro/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-      }
     }
   }