From 84e790b091611c786665986c8ac12bcc97a13e9f Mon Sep 17 00:00:00 2001 From: Gunnar Wrobel
Date: Mon, 6 Apr 2009 08:11:20 +0200 Subject: [PATCH] Allow setting the id of a basic object. Fixed a typo. --- framework/Kolab_Server/lib/Horde/Kolab/Server/Object.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object.php index 52206e83d..e9af97305 100644 --- a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object.php +++ b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object.php @@ -401,6 +401,9 @@ class Horde_Kolab_Server_Object */ public static function generateId($info) { + if (!empty($info[self::ATTRIBUTE_ID])) { + return $info[self::ATTRIBUTE_ID]; + } return hash('sha256', uniqid(mt_rand(), true)); } @@ -428,7 +431,7 @@ class Horde_Kolab_Server_Object } if (!$this->exists()) { - foreach ($this->attribute_map['required'] as $attribute) { + foreach ($this->attribute_map['required'] as $key) { if (!in_array($key, array_keys($info)) || empty($info[$key])) { if (empty($this->attributes[$key]['default'])) { throw new Horde_Kolab_Server_Exception(sprintf(_("The value for \"%s\" is empty but required!"), -- 2.11.0