diff --git a/addressbook/inc/class.addressbook_sql.inc.php b/addressbook/inc/class.addressbook_sql.inc.php index 2a8490fd49..8f76b5d431 100644 --- a/addressbook/inc/class.addressbook_sql.inc.php +++ b/addressbook/inc/class.addressbook_sql.inc.php @@ -742,13 +742,6 @@ class addressbook_sql extends so_sql_cf } $contact = parent::read($keys,$extra_cols,$join); - // Change autoinc_id to match $this->db_cols - $this->autoinc_id = $this->db_cols[$this->autoinc_id]; - if(($id = (int)$this->data[$this->autoinc_id]) && $cfs = $this->read_customfields($keys)) { - if (is_array($cfs[$id])) $contact = array_merge($contact,$cfs[$id]); - } - $this->autoinc_id = array_search($this->autoinc_id, $this->db_cols); - // enforce a minium uid strength if (is_array($contact) && (!isset($contact['uid']) || strlen($contact['uid']) < $minimum_uid_length)) { diff --git a/etemplate/inc/class.so_sql_cf.inc.php b/etemplate/inc/class.so_sql_cf.inc.php index 1dba60208d..3e923dbbc2 100644 --- a/etemplate/inc/class.so_sql_cf.inc.php +++ b/etemplate/inc/class.so_sql_cf.inc.php @@ -283,7 +283,7 @@ class so_sql_cf extends so_sql { return false; } - if (($id = (int)$this->data[$this->autoinc_id]) && $this->customfields && + if (($id = (int)$this->data[$this->db_key_cols[$this->autoinc_id]]) && $this->customfields && ($cfs = $this->read_customfields($id))) { $this->data = array_merge($this->data,$cfs[$id]); @@ -378,7 +378,7 @@ class so_sql_cf extends so_sql $id2keys = array(); foreach($rows as $key => $row) { - $id2keys[$row[$this->autoinc_id]] = $key; + $id2keys[$row[$this->db_key_cols[$this->autoinc_id]]] = $key; } // check if only certain cf's to show if (!in_array('customfields', $selectcols))