Hello everybody,
This is a simple patch for the LDAP address book implementation, for roundcube.
The patch extract first name and last name to create new entry into the address book.
Some email addresses are written using the notation
This simple patch create defaults values for first name and last name, and use them when not specified, instead of using email for default first name/last name.
421,437d420 < // Create a default value for first name and last name < // if the cn field contains ',' or ' ' < $defValues = array() ; < if ( strpos($newentry['cn'],',') !== false ) { < list($lastName,$firstName) = array_filter(explode(',',$newentry['cn'])); < $defValues['sn'] = trim($lastName) ; < $defValues['givenName'] = trim($firstName) ; < < # Reorder first and last name < $newentry['cn'] = "$firstName $lastName" ; < } < elseif ( strpos($newentry['cn'],' ') !== false ) { < list($firstName,$lastName) = array_filter(explode(' ',$newentry['cn'], 2)); < $defValues['sn'] = trim($lastName) ; < $defValues['givenName'] = trim($firstName) ; < } < 443,446c426 < if ( isset($defValues[$fld]) ) < $newentry[$fld] = $defValues[$fld] ; < else
$newentry[$fld] = $newentry[$this->_map_field("email")]
I hope it will be useful for somebody as it is for me.
André. _______________________________________________ List info: http://lists.roundcube.net/dev/