diff options
author | alecpl <alec@alec.pl> | 2011-07-27 10:52:38 +0000 |
---|---|---|
committer | alecpl <alec@alec.pl> | 2011-07-27 10:52:38 +0000 |
commit | 1e36b718387359a9eb37bddb621c22b90e915d88 (patch) | |
tree | f23f0f3c7d91202611f01c317c8a6abf7e1c4e6e /program/steps/addressbook | |
parent | 31f05cc9a4231295c7438e92155df0c29978e33c (diff) |
- Generate display name before record validation
Diffstat (limited to 'program/steps/addressbook')
-rw-r--r-- | program/steps/addressbook/save.inc | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/program/steps/addressbook/save.inc b/program/steps/addressbook/save.inc index ef1b9f90d..d5d4537f6 100644 --- a/program/steps/addressbook/save.inc +++ b/program/steps/addressbook/save.inc @@ -136,6 +136,13 @@ foreach ($GLOBALS['CONTACT_COLTYPES'] as $col => $colprop) { } } +// Generate contact's display name (must be before validation) +if (empty($a_record['name'])) { + $a_record['name'] = rcube_addressbook::compose_display_name($a_record, true); + // Reset it if equals to email address (from compose_display_name()) + if ($a_record['name'] == $a_record['email'][0]) + $a_record['name'] = ''; +} // do input checks (delegated to $CONTACTS instance) if (!$CONTACTS->validate($a_record)) { @@ -164,14 +171,6 @@ if (isset($a_record['photo'])) { $RCMAIL->session->remove('contacts'); } -// Generate contact's display name -if (empty($a_record['name'])) { - $a_record['name'] = rcube_addressbook::compose_display_name($a_record, true); - // Reset it if equals to email address (from compose_display_name()) - if ($a_record['name'] == $a_record['email'][0]) - $a_record['name'] = ''; -} - // update an existing contact if (!empty($cid)) |