6.0.0-git
2019-03-22

[#9554] store multiple email addresses as separate 'mail' attributes in LDAP
Summary store multiple email addresses as separate 'mail' attributes in LDAP
Queue Turba
Queue Version Git master
Type Enhancement
State Accepted
Priority 1. Low
Owners
Requester tgpfeiffer (at) web (dot) de
Created 2011-01-30 (2973 days ago)
Due
Updated 2016-11-02 (870 days ago)
Assigned 2011-02-01 (2971 days ago)
Resolved
Milestone
Patch No

History
2016-11-02 21:42:40 oliverafg (at) gmx (dot) de Comment #6 Reply to this comment
1) The email form field always returns a single value, though we 
could of course split this up again, or add an option to return an 
array instead.
2) But more important, there isn't any way in Turba to store one 
field into several attributes. We do have composite fields, but 
these store in a *fixed* number of *different* attributes, not in a 
*variable* number of the *same* attribute. There is no 
infrastructure for that at all, so this is a larger undertaking.
Is this necessary at all?
As far as I can say, the emails (multi_value) field works fine with 
IMP and ActiveSync.

It works with ActiveSync in the expected way, the first three email 
addresses from emails are provided as email1, email2 and email3 to an 
activesync device and read this way from the device. (three email 
address are the limit of activesync)

this happens ins turba/lib/Driver.php at line 2690:
             case 'emails':
                 $address = 1;
                 foreach (explode(',', $value) as $email) {
                     while ($address <= 3 &&
                            $message->{'email' . $address . 'address'}) {
                         $address++;
                     }
                     if ($address > 3) {
                         break;
                     }
                     $message->{'email' . $address . 'address'} = $email;
                     $address++;
                 }
                 break;

A smiliar code snippet is there for vcards.

For LDAP I find the "array_merge" inside the _read function off 
Ldap.php. In funtion _write, there is nothing.

My suggestions:

1) generic version
at line 304:
if source is comma seperated array and target mutli value
for i in array ...
this one might be dangerous with other fields als children/child

2)
Or a hardcoded version just for "emails"
somehow ugly but works and no side effects

3)
in backends.local.php the opportunity/example for 2)

My php skills are just not good enough at the moment :(
2012-07-07 10:58:50 mehmet (at) giritli (dot) eu Comment #5 Reply to this comment
Seeing the first alpha releases of the horde apps, I was wondering if 
this is gonna be addressed in the next version or not. Multiple emails 
is a must for many many people I guess. Currently, it is the biggest 
limitation I have to live with when using horde....
2011-07-01 17:24:30 Jan Schneider Comment #4
Taken from Horde DevelopersHorde Developers
Version ⇒ Git master
Reply to this comment
The problem is that:
1) The email form field always returns a single value, though we could 
of course split this up again, or add an option to return an array 
instead.
2) But more important, there isn't any way in Turba to store one field 
into several attributes. We do have composite fields, but these store 
in a *fixed* number of *different* attributes, not in a *variable* 
number of the *same* attribute. There is no infrastructure for that at 
all, so this is a larger undertaking.
2011-07-01 17:20:11 Jan Schneider Type ⇒ Enhancement
State ⇒ Accepted
Priority ⇒ 1. Low
 
2011-02-01 09:10:03 Jan Schneider Assigned to Horde DevelopersHorde Developers
State ⇒ Assigned
Priority ⇒ 2. Medium
 
2011-01-30 17:20:56 tgpfeiffer (at) web (dot) de Comment #3 Reply to this comment
The behavior of using 'emails' is identical to using 'email' with 
'allow_multi'=true for me, i.e. multiple addresses get stored as a 
comma-separated string in the 'mail' attribute in LDAP.
2011-01-30 17:12:05 Jan Schneider State ⇒ Feedback
 
2011-01-30 17:11:57 Jan Schneider Comment #2 Reply to this comment
Try using the 'emails' instead of 'email' attribute.
2011-01-30 15:29:54 tgpfeiffer (at) web (dot) de Comment #1
Type ⇒ Bug
State ⇒ Unconfirmed
Priority ⇒ 1. Low
Summary ⇒ store multiple email addresses as separate 'mail' attributes in LDAP
Queue ⇒ Turba
Milestone ⇒
Patch ⇒ No
Reply to this comment
My Turba uses an LDAP backend, and I wondered how people could have 
more than one email address. Obviously, LDAP supports multiple 'mail' 
attributes per inetOrgPerson and when setting

   'allow_multi' => true

in turba/config/attributes.php, they are also treated as separate 
email addresses and each 'mail' entry results in a separate 
mailto-link in Turba.

However, when editing the email field, there is a comma-separated list 
of addresses which is written back into LDAP *as is*. This causes 
problems, because, for example, it's not possible any more to do an 
LDAP query with "(mail=address1@host.com)". Instead, the LDAP backend 
- just as it converts multiple 'mail' attribute values to a PHP array 
- should act the same when saving, i.e. converting the PHP array (or 
the comma-separated string) into multiple LDAP attributes.

Saved Queries