summaryrefslogtreecommitdiff
path: root/roundcubemail
diff options
context:
space:
mode:
authorthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2011-11-28 17:32:33 +0000
committerthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2011-11-28 17:32:33 +0000
commitbe79e990870ee751bd0cf7a423432d8adfe4460a (patch)
treef8d9dfd7f11469974c77f2d055e6432b7b6d0997 /roundcubemail
parente60de8c970477666b733d9821dbb92f3d5b5bf75 (diff)
Fix saving of composite fields in LDAP
git-svn-id: https://svn.roundcube.net/trunk@5505 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail')
-rw-r--r--roundcubemail/program/include/rcube_ldap.php26
1 files changed, 16 insertions, 10 deletions
diff --git a/roundcubemail/program/include/rcube_ldap.php b/roundcubemail/program/include/rcube_ldap.php
index cc122e706..6a8ddb9bb 100644
--- a/roundcubemail/program/include/rcube_ldap.php
+++ b/roundcubemail/program/include/rcube_ldap.php
@@ -1051,17 +1051,9 @@ class rcube_ldap extends rcube_addressbook
$replacedata = array();
$deletedata = array();
- // flatten composite fields in $record
- if (is_array($record['address'])) {
- foreach ($record['address'] as $i => $struct) {
- foreach ($struct as $col => $val) {
- $record[$col][$i] = $val;
- }
- }
- }
-
+ $ldap_data = $this->_map_data($save_cols);
foreach ($this->fieldmap as $col => $fld) {
- $val = $save_cols[$col];
+ $val = $ldap_data[$fld];
if ($fld) {
// remove empty array values
if (is_array($val))
@@ -1353,6 +1345,20 @@ class rcube_ldap extends rcube_addressbook
*/
private function _map_data($save_cols)
{
+ // flatten composite fields first
+ foreach ($this->coltypes as $col => $colprop) {
+ if (is_array($colprop['childs']) && ($values = $this->get_col_values($col, $save_cols, false))) {
+ foreach ($values as $subtype => $childs) {
+ $subtype = $subtype ? ':'.$subtype : '';
+ foreach ($childs as $i => $child_values) {
+ foreach ((array)$child_values as $childcol => $value) {
+ $save_cols[$childcol.$subtype][$i] = $value;
+ }
+ }
+ }
+ }
+ }
+
$ldap_data = array();
foreach ($this->fieldmap as $col => $fld) {
$val = $save_cols[$col];