Code

Updated class removeObject
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 8 Apr 2011 09:20:40 +0000 (09:20 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 8 Apr 2011 09:20:40 +0000 (09:20 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20665 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/include/class_remoteObject.inc

index af03c423fb4d444ff1bcf68cadafc023ca5b284c..56d025765e0cf2eb5defa750ff8a91d389339747 100644 (file)
@@ -92,27 +92,40 @@ class remoteObject
      */
     function __call($name, $args)
     {
+
         // Check if such an attribute is registered
-        if(preg_match("/^get_/", $name)){
-            $varName = preg_replace("/^get_/","", $name);
+        if(preg_match("/^get/", $name)){
+            $varName = ucfirst(preg_replace("/^get/","", $name));
+            $varName2 = lcfirst($varName);
             if(in_array($varName, $this->properties)){
                 $force = isset($args[0]) && $args[0];
                 return($this->__getProperty($varName, $force));
+            }elseif(in_array($varName2, $this->properties)){
+                $force = isset($args[0]) && $args[0];
+                return($this->__getProperty($varName2, $force));
             } 
-        }elseif(preg_match("/^set_/", $name)){
-            $varName = preg_replace("/^set_/","", $name);
+        }elseif(preg_match("/^set/", $name)){
+            $varName = ucfirst(preg_replace("/^set/","", $name));
+            $varName2 = lcfirst($varName);
             if(in_array($varName, $this->properties)){
                 return($this->__setProperty($varName, $args[0]));
+            }elseif(in_array($varName2, $this->properties)){
+                return($this->__setProperty($varName2, $args[0]));
             }
         }
 
         // Forward to the call to the backend.
-        $fArgs = array();
-        $fArgs[] = $this->ref_id;
-        $fArgs[] = $name;
-        $fArgs = array_merge($fArgs, $args);
-        $res = call_user_func_array(array($this->rpcHandle,"dispatchObjectMethod"), $fArgs);
-        return($res);
+        if(in_array($name, $this->methods)){
+            $fArgs = array();
+            $fArgs[] = $this->ref_id;
+            $fArgs[] = $name;
+            $fArgs = array_merge($fArgs, $args);
+            $res = call_user_func_array(array($this->rpcHandle,"dispatchObjectMethod"), $fArgs);
+            return($res);
+        }
+
+        // Show an error, we do not know what to to with this..
+        trigger_error("Unknown method '{$name}' called for {$this->object_id}!");
     }
 
 
@@ -269,7 +282,7 @@ class remoteObject
     function commit($saveUntouchedPropertiesToo = FALSE)
     {
         foreach($this->properties as $prop){
-            if($this->__propIsCached($prop)) continue;
+            if(!$this->__propIsCached($prop)) continue;
             if($saveUntouchedPropertiesToo || $this->values[$prop] != $this->__getPropFromCache($prop)){
                 $this->__setProperty($prop, $this->__getPropFromCache($prop), TRUE);
             }