Fixes to deal with customfields when LDAP is the backend

This commit is contained in:
Nathan Gray 2010-04-20 17:49:32 +00:00
parent 686ada2d40
commit b71e8899b3
2 changed files with 18 additions and 6 deletions

View File

@ -432,8 +432,9 @@ class addressbook_so
if ($this->somain->delete($where)) if ($this->somain->delete($where))
{ {
// delete customfields, can return 0 if there are no customfields // delete customfields, can return 0 if there are no customfields
if(!($this->somain instanceof addressbook_sql)) { if(!($this->somain instanceof addressbook_sql))
$this->soextra->delete(array($this->extra_id => $contact)); {
$this->soextra->delete_customfields(array($this->extra_id => $contact));
} }
// delete from distribution list(s) // delete from distribution list(s)
@ -504,8 +505,9 @@ class addressbook_so
if($error_nr) return $error_nr; if($error_nr) return $error_nr;
// save customfields, if not already done by somain->save(); // save customfields, if not already done by somain->save();
if(!($this->somain instanceof addressbook_sql)) { if(!($this->somain instanceof addressbook_sql))
$this->soextra->save($this->data2db($contact)); {
$this->soextra->save_customfields($this->data2db($contact));
} }
return false; // no error return false; // no error
} }
@ -737,8 +739,9 @@ class addressbook_so
if (!$new_owner) if (!$new_owner)
{ {
$this->somain->delete(array('owner' => $account_id)); $this->somain->delete(array('owner' => $account_id));
if(!($this->somain instanceof addressbook_sql)) { if(!($this->somain instanceof addressbook_sql))
$this->soextra->delete(array($this->extra_owner => $account_id)); {
$this->soextra->delete_customfields(array($this->extra_owner => $account_id));
} }
} }
else else

View File

@ -655,4 +655,13 @@ class addressbook_sql extends so_sql_cf
} }
return false; // no error 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__);
}
} }