summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2011-10-30 15:30:59 +0000
committerthomascube <thomas@roundcube.net>2011-10-30 15:30:59 +0000
commit1937f4638e27d13ab1892d37df97dafe4dc7b696 (patch)
tree3913ad581748dafc22ca00cce4d3e8af54440667
parentabdf31486a946d63623c3047d08e7730926c4d86 (diff)
Improve definition of composite address fields of LDAP contacts
-rw-r--r--program/include/rcube_ldap.php10
1 files changed, 7 insertions, 3 deletions
diff --git a/program/include/rcube_ldap.php b/program/include/rcube_ldap.php
index facc735d4..5563475ee 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,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);