From: Gunnar Wrobel
Date: Fri, 10 Apr 2009 11:00:55 +0000 (+0200) Subject: Fix the generation of IDs if on of the ID attributes has more than one value. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=e8e3ecc8a15fc49cbf436cce8aa93c3448427951;p=horde.git Fix the generation of IDs if on of the ID attributes has more than one value. Fixed change detection when saving the object. --- diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object.php index 2a7158512..2647a7efb 100644 --- a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object.php +++ b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object.php @@ -512,7 +512,12 @@ class Horde_Kolab_Server_Object public function generateId($info) { if (!empty($info[self::ATTRIBUTE_ID])) { - return $this->server->structure->quoteForUid($info[self::ATTRIBUTE_ID]); + if (is_array($info[self::ATTRIBUTE_ID])) { + $id = $info[self::ATTRIBUTE_ID][0]; + } else { + $id = $info[self::ATTRIBUTE_ID]; + } + return $this->server->structure->quoteForUid($id); } return $this->server->structure->quoteForUid(hash('sha256', uniqid(mt_rand(), true))); } @@ -602,10 +607,12 @@ class Horde_Kolab_Server_Object $info[$key] = $value; } if (!is_array($this->_cache[$key])) { - $changes = array_diff(array($this->_cache[$key]), $value); + $old = array($this->_cache[$key]); } else { - $changes = array_diff($this->_cache[$key], $value); + $old = $this->_cache[$key]; } + $changes = array_merge(array_diff($old, $value), + array_diff($value, $old)); if (empty($changes)) { // Unchanged value unset($info[$key]);