summaryrefslogtreecommitdiff
path: root/roundcubemail/program/include
diff options
context:
space:
mode:
authorthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2011-10-30 15:30:59 +0000
committerthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2011-10-30 15:30:59 +0000
commit503d294b45207e87f24b9fee4d7e021f322cfe4d (patch)
treec92ff4a7afff2d8b08b6764b721cce98121d7a87 /roundcubemail/program/include
parent6b0dab16efeb4c003aa4e8c927738bd40945de1d (diff)
Improve definition of composite address fields of LDAP contacts
git-svn-id: https://svn.roundcube.net/trunk@5377 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/include')
-rw-r--r--roundcubemail/program/include/rcube_ldap.php10
1 files changed, 7 insertions, 3 deletions
diff --git a/roundcubemail/program/include/rcube_ldap.php b/roundcubemail/program/include/rcube_ldap.php
index facc735d4..5563475ee 100644
--- a/roundcubemail/program/include/rcube_ldap.php
+++ b/roundcubemail/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,12 @@ class rcube_ldap extends rcube_addressbook
$this->fieldmap[$col] = $lf;
}
- if ($this->fieldmap['street'] && $this->fieldmap['locality'])
- $this->coltypes['address'] = array('limit' => 1);
+ // support for composite address
+ if ($this->fieldmap['street'] && $this->fieldmap['locality']) {
+ $this->coltypes['address'] = array('limit' => max(1, $this->coltypes['locality']['limit']), 'subtypes' => $this->coltypes['locality']['subtypes']);
+ foreach (array('street','locality','zipcode','region','country') as $childcol)
+ 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);