From b9008dd3adf88fad74546f447b376b73cf68024c Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Mon, 7 Nov 2005 16:12:41 +0000 Subject: [PATCH] fixed customfields returned as serialized array --- addressbook/inc/class.socontacts.inc.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/addressbook/inc/class.socontacts.inc.php b/addressbook/inc/class.socontacts.inc.php index 4db58b9ab5..292ae9b41f 100755 --- a/addressbook/inc/class.socontacts.inc.php +++ b/addressbook/inc/class.socontacts.inc.php @@ -57,20 +57,23 @@ class socontacts { if($GLOBALS['egw_info']['server']['contact_repository'] == 'sql' || !isset($GLOBALS['egw_info']['server']['contact_repository'])) { - $this->somain = CreateObject('etemplate.so_sql'); - $this->somain->so_sql('phpgwapi','phpgw_addressbook'); + $this->somain =& CreateObject('etemplate.so_sql','phpgwapi','phpgw_addressbook'); } else { - $this->somain = CreateObject('addressbook.so_'.$GLOBALS['egw_info']['server']['contact_repository']); + $this->somain =& CreateObject('addressbook.so_'.$GLOBALS['egw_info']['server']['contact_repository']); } $this->somain->contacts_id = 'id'; - $this->soextra = CreateObject('etemplate.so_sql'); + $this->soextra =& CreateObject('etemplate.so_sql'); $this->soextra->so_sql('phpgwapi',$this->extra_table); $custom =& CreateObject('admin.customfields',$contact_app); $this->customfields = $custom->get_customfields(); - + if ($this->customfields && !is_array($this->customfields)) + { + $this->customfields = unserialize($this->customfields); + } + if (!$this->customfields) $this->customfields = array(); } /** @@ -103,7 +106,7 @@ class socontacts $error_nr = $this->somain->save(); $contact['id'] = $this->somain->data['id']; if($error_nr) return $error_nr_main; - + // save customfields foreach ($this->customfields as $field => $options) {