From: hickert Date: Fri, 8 Apr 2011 09:20:40 +0000 (+0000) Subject: Updated class removeObject X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=9f95429edc21dbaa76e4d16431d728e5cf4dffff;p=gosa.git Updated class removeObject git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20665 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/include/class_remoteObject.inc b/gosa-core/include/class_remoteObject.inc index af03c423f..56d025765 100644 --- a/gosa-core/include/class_remoteObject.inc +++ b/gosa-core/include/class_remoteObject.inc @@ -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); }