From b71e8899b377aea6aaa1b212f6577f32171bf213 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Tue, 20 Apr 2010 17:49:32 +0000 Subject: [PATCH] Fixes to deal with customfields when LDAP is the backend --- addressbook/inc/class.addressbook_so.inc.php | 15 +++++++++------ addressbook/inc/class.addressbook_sql.inc.php | 9 +++++++++ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/addressbook/inc/class.addressbook_so.inc.php b/addressbook/inc/class.addressbook_so.inc.php index e724f17d35..fb35818286 100755 --- a/addressbook/inc/class.addressbook_so.inc.php +++ b/addressbook/inc/class.addressbook_so.inc.php @@ -432,8 +432,9 @@ class addressbook_so if ($this->somain->delete($where)) { // delete customfields, can return 0 if there are no customfields - if(!($this->somain instanceof addressbook_sql)) { - $this->soextra->delete(array($this->extra_id => $contact)); + if(!($this->somain instanceof addressbook_sql)) + { + $this->soextra->delete_customfields(array($this->extra_id => $contact)); } // delete from distribution list(s) @@ -504,8 +505,9 @@ class addressbook_so if($error_nr) return $error_nr; // save customfields, if not already done by somain->save(); - if(!($this->somain instanceof addressbook_sql)) { - $this->soextra->save($this->data2db($contact)); + if(!($this->somain instanceof addressbook_sql)) + { + $this->soextra->save_customfields($this->data2db($contact)); } return false; // no error } @@ -737,8 +739,9 @@ class addressbook_so if (!$new_owner) { $this->somain->delete(array('owner' => $account_id)); - if(!($this->somain instanceof addressbook_sql)) { - $this->soextra->delete(array($this->extra_owner => $account_id)); + if(!($this->somain instanceof addressbook_sql)) + { + $this->soextra->delete_customfields(array($this->extra_owner => $account_id)); } } else diff --git a/addressbook/inc/class.addressbook_sql.inc.php b/addressbook/inc/class.addressbook_sql.inc.php index 1f96ea135b..d7cb4b48a1 100644 --- a/addressbook/inc/class.addressbook_sql.inc.php +++ b/addressbook/inc/class.addressbook_sql.inc.php @@ -655,4 +655,13 @@ class addressbook_sql extends so_sql_cf } return false; // no error } + + /** + * Deletes custom field data + * Implemented to deal with LDAP backend, which saves CFs in SQL, but the account record is in LDAP + */ + function delete_customfields($data) + { + $this->db->delete($this->extra_table,$data,__LINE__,__FILE__); + } }