summaryrefslogtreecommitdiff
path: root/program/steps/addressbook/save.inc
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2011-05-12 20:18:19 +0000
committerthomascube <thomas@roundcube.net>2011-05-12 20:18:19 +0000
commite848180aaa9640de871796ca1a3e4f8110701fd6 (patch)
tree8691c816c9c8ddd4ad8ef733cc61a8bc52541cc3 /program/steps/addressbook/save.inc
parentcaedd52361f8ba15aa6bfbc00cab7f55525f5edf (diff)
Improve display name composition when saving contacts (#1487143), with plugin-support; allow empty names in sql address book, fall back to e-mail address in listing and vcard export
Diffstat (limited to 'program/steps/addressbook/save.inc')
-rw-r--r--program/steps/addressbook/save.inc7
1 files changed, 5 insertions, 2 deletions
diff --git a/program/steps/addressbook/save.inc b/program/steps/addressbook/save.inc
index 88fe98cd1..253609780 100644
--- a/program/steps/addressbook/save.inc
+++ b/program/steps/addressbook/save.inc
@@ -129,9 +129,9 @@ foreach ($GLOBALS['CONTACT_COLTYPES'] as $col => $colprop) {
}
}
+// let a dedicated function or a plugin compose the full name if empty
if (empty($a_record['name'])) {
- // TODO: let a dedicated function or a plugin compose the full name
- $a_record['name'] = join(' ', array_filter(array($a_record['prefix'], $a_record['firstname'], $a_record['middlename'], $a_record['surname'], $a_record['suffix'],)));
+ $a_record['name'] = rcube_addressbook::compose_display_name($a_record);
}
@@ -185,6 +185,9 @@ if (!empty($cid))
// define list of cols to be displayed
$a_js_cols = array();
$record = $CONTACTS->get_record($newcid ? $newcid : $cid, true);
+ $record['email'] = reset($CONTACTS->get_col_values('email', $record, true));
+ if (!$record['name'])
+ $record['name'] = $record['email'];
foreach (array('name', 'email') as $col)
$a_js_cols[] = (string)$record[$col];