diff --git a/addressbook/inc/class.bocontacts.inc.php b/addressbook/inc/class.bocontacts.inc.php index b654a2ecd6..64fc5078d6 100755 --- a/addressbook/inc/class.bocontacts.inc.php +++ b/addressbook/inc/class.bocontacts.inc.php @@ -143,10 +143,10 @@ class bocontacts extends socontacts ($contact['n_family'] ? ' '.$contact['n_family'] : ''). ($contact['n_suffix'] ? ' '.$contact['n_suffix'] : ''); // for some bad historical reasons we mainfileds saved in cf :-((( - $data['#ophone'] = $data['ophone']; unset($data['ophone']); - $data['#address2'] = $data['address2']; unset($data['address2']); - $data['#address3'] = $data['address3']; unset($data['address3']); - + $contact['#ophone'] = $contact['ophone']; unset($contact['ophone']); + $contact['#address2'] = $contact['address2']; unset($contact['address2']); + $contact['#address3'] = $contact['address3']; unset($contact['address3']); + $error_nr = parent::save($contact); if(!$error_nr) @@ -159,9 +159,10 @@ class bocontacts extends socontacts } // for some bad historical reasons we mainfileds saved in cf :-((( - $data['ophone'] = $data['#ophone']; unset($data['#ophone']); - $data['address2'] = $data['#address2']; unset($data['#address2']); - $data['address3'] = $data['#address3']; unset($data['#address3']); + $contact['ophone'] = $contact['#ophone']; unset($contact['#ophone']); + $contact['address2'] = $contact['#address2']; unset($contact['#address2']); + $contact['address3'] = $contact['#address3']; unset($contact['#address3']); + $contact['msg'] = $error_nr ? lang('Something went wrong by saving this contact. Errorcode %1',$error_nr) : lang('Contact saved'); @@ -250,4 +251,4 @@ class bocontacts extends socontacts $access = $access ? $access : 'public'; return $access == 'private' ? false : $this->grants[$owner] & $needed; } -} \ No newline at end of file +} diff --git a/addressbook/inc/class.socontacts.inc.php b/addressbook/inc/class.socontacts.inc.php index ddc5fc97c1..e2102ef393 100755 --- a/addressbook/inc/class.socontacts.inc.php +++ b/addressbook/inc/class.socontacts.inc.php @@ -108,7 +108,7 @@ class socontacts if($error_nr) return $error_nr_main; // save customfields - foreach ($this->customfields as $field => $options) + foreach ((array)$this->customfields + array('ophone' => '', 'address2' => '' , 'address3' => '') as $field => $options) { $value = $contact['#'.$field]; $data = array(