Improve definition of composite address fields of LDAP contacts

pull/1/head
thomascube 13 years ago
parent abdf31486a
commit 1937f4638e

@ -107,7 +107,7 @@ class rcube_ldap extends rcube_addressbook
list($col, $type) = explode(':', $col); list($col, $type) = explode(':', $col);
if (!is_array($this->coltypes[$col])) { if (!is_array($this->coltypes[$col])) {
$subtypes = $type ? array($type) : null; $subtypes = $type ? array($type) : null;
$this->coltypes[$col] = array('limit' => 2, 'subtypes' => $subtypes); $this->coltypes[$col] = array('limit' => 1, 'subtypes' => $subtypes);
} }
elseif ($type) { elseif ($type) {
$this->coltypes[$col]['subtypes'][] = $type; $this->coltypes[$col]['subtypes'][] = $type;
@ -117,8 +117,12 @@ class rcube_ldap extends rcube_addressbook
$this->fieldmap[$col] = $lf; $this->fieldmap[$col] = $lf;
} }
if ($this->fieldmap['street'] && $this->fieldmap['locality']) // support for composite address
$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']);
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']) else if ($this->coltypes['address'])
$this->coltypes['address'] = array('type' => 'textarea', 'childs' => null, 'limit' => 1, 'size' => 40); $this->coltypes['address'] = array('type' => 'textarea', 'childs' => null, 'limit' => 1, 'size' => 40);

Loading…
Cancel
Save