From 739abb491d07aca39d5aac8bf7f3fe7ab010f8d6 Mon Sep 17 00:00:00 2001 From: Gunnar Wrobel
Date: Wed, 29 Apr 2009 10:20:31 +0200 Subject: [PATCH] Fix the id generation for object modifications. --- .../lib/Horde/Kolab/Server/Object/Inetorgperson.php | 13 +++++++++++++ .../Kolab_Server/lib/Horde/Kolab/Server/Object/Person.php | 13 +++++++++++++ 2 files changed, 26 insertions(+) diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Inetorgperson.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Inetorgperson.php index a467df0d1..9d865fc47 100644 --- a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Inetorgperson.php +++ b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Inetorgperson.php @@ -377,6 +377,19 @@ class Horde_Kolab_Server_Object_Inetorgperson extends Horde_Kolab_Server_Object_ */ public function generateId($info) { + if ($this->exists()) { + if (!isset($info[self::ATTRIBUTE_GIVENNAME]) + && !isset($info[self::ATTRIBUTE_SN])) { + return false; + } + if (!isset($info[self::ATTRIBUTE_GIVENNAME])) { + $info[self::ATTRIBUTE_GIVENNAME] = $this->get(self::ATTRIBUTE_GIVENNAME); + } + if (!isset($info[self::ATTRIBUTE_SN])) { + $info[self::ATTRIBUTE_SN] = $this->get(self::ATTRIBUTE_SN); + } + } + $id_mapfields = array(self::ATTRIBUTE_GIVENNAME, self::ATTRIBUTE_SN); $id_format = self::ATTRIBUTE_CN . '=' . '%s %s'; diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Person.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Person.php index 8c9e51129..6ffad5a28 100644 --- a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Person.php +++ b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Person.php @@ -215,6 +215,19 @@ class Horde_Kolab_Server_Object_Person extends Horde_Kolab_Server_Object */ public function generateId($info) { + if ($this->exists()) { + if (!isset($info[self::ATTRIBUTE_CN]) + && !isset($info[self::ATTRIBUTE_SN])) { + return false; + } + if (!isset($info[self::ATTRIBUTE_CN])) { + $old = $this->get(self::ATTRIBUTE_CN); + if (!empty($old)) { + return false; + } + } + } + if (!empty($info[self::ATTRIBUTE_CN])) { $id = $info[self::ATTRIBUTE_CN]; } else { -- 2.11.0