summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2012-01-06 15:57:33 +0000
committerthomascube <thomas@roundcube.net>2012-01-06 15:57:33 +0000
commit49cdae95f6d6e9c2010008d4414389654bcbac7b (patch)
tree5e46027fea06a4f89f8a69511f415231f43d897b /program
parentfd654219041de0ba1228d2e284ef78bccf22519c (diff)
Migrate LDAP fieldmap fix from trunk
Diffstat (limited to 'program')
-rw-r--r--program/include/rcube_ldap.php13
1 files changed, 10 insertions, 3 deletions
diff --git a/program/include/rcube_ldap.php b/program/include/rcube_ldap.php
index a7ea62cfc..65ec46304 100644
--- a/program/include/rcube_ldap.php
+++ b/program/include/rcube_ldap.php
@@ -107,7 +107,7 @@ class rcube_ldap extends rcube_addressbook
list($col, $type) = explode(':', $col);
if (!is_array($this->coltypes[$col])) {
$subtypes = $type ? array($type) : null;
- $this->coltypes[$col] = array('limit' => 2, 'subtypes' => $subtypes);
+ $this->coltypes[$col] = array('limit' => 1, 'subtypes' => $subtypes);
}
elseif ($type) {
$this->coltypes[$col]['subtypes'][] = $type;
@@ -117,8 +117,15 @@ class rcube_ldap extends rcube_addressbook
$this->fieldmap[$col] = $lf;
}
- if ($this->fieldmap['street'] && $this->fieldmap['locality'])
- $this->coltypes['address'] = array('limit' => 1);
+ if ($this->fieldmap['street'] && $this->fieldmap['locality']) {
+ $this->coltypes['address'] = array('limit' => max(1, $this->coltypes['locality']['limit']), 'subtypes' => $this->coltypes['locality']['subtypes'], 'childs' => array());
+ foreach (array('street','locality','zipcode','region','country') as $childcol) {
+ if ($this->fieldmap[$childcol]) {
+ $this->coltypes['address']['childs'][$childcol] = array('type' => 'text');
+ unset($this->coltypes[$childcol]); // remove address child col from global coltypes list
+ }
+ }
+ }
else if ($this->coltypes['address'])
$this->coltypes['address'] = array('type' => 'textarea', 'childs' => null, 'limit' => 1, 'size' => 40);