From 7fb577bc8f7c0fd24c7d6119bdf87f3cee4a1418 Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Wed, 01 Feb 2012 02:33:45 -0500
Subject: [PATCH] Swiss German translation for markasjunk plugin

---
 program/include/rcube_ldap.php |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/program/include/rcube_ldap.php b/program/include/rcube_ldap.php
index a7ea62c..978c4e7 100644
--- a/program/include/rcube_ldap.php
+++ b/program/include/rcube_ldap.php
@@ -107,7 +107,7 @@
             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 @@
                 $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);
 
@@ -1227,9 +1234,9 @@
                 $attrs, 0, (int)$this->prop['sizelimit'], (int)$this->prop['timelimit'])
             ) {
                 $entries_count = ldap_count_entries($this->conn, $this->ldap_result);
-                $this->_debug("S: $count_entries record(s)");
+                $this->_debug("S: $entries_count record(s)");
 
-                return $count ? $count_entries : true;
+                return $count ? $entries_count : true;
             }
             else {
                 $this->_debug("S: ".ldap_error($this->conn));

--
Gitblit v1.9.1