From e8e3ecc8a15fc49cbf436cce8aa93c3448427951 Mon Sep 17 00:00:00 2001 From: Gunnar Wrobel
Date: Fri, 10 Apr 2009 13:00:55 +0200 Subject: [PATCH] Fix the generation of IDs if on of the ID attributes has more than one value. Fixed change detection when saving the object. --- framework/Kolab_Server/lib/Horde/Kolab/Server/Object.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) 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]); -- 2.11.0