From 3cacf941fa30e8c02f3f7aebcc8747036d0d8d20 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Wed, 01 Jun 2011 09:44:51 -0400
Subject: [PATCH] - Add popup with basic fields selection for addressbook search

---
 program/include/rcube_contacts.php |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/program/include/rcube_contacts.php b/program/include/rcube_contacts.php
index 687b4b1..7c142f5 100644
--- a/program/include/rcube_contacts.php
+++ b/program/include/rcube_contacts.php
@@ -192,7 +192,7 @@
 
         // determine whether we have to parse the vcard or if only db cols are requested
         $read_vcard = !$cols || count(array_intersect($cols, $this->table_cols)) < count($cols);
-        
+
         while ($sql_result && ($sql_arr = $this->db->fetch_assoc($sql_result))) {
             $sql_arr['ID'] = $sql_arr[$this->primary_key];
 
@@ -255,17 +255,18 @@
                 $ids     = $this->db->array2list($ids, 'integer');
                 $where[] = 'c.' . $this->primary_key.' IN ('.$ids.')';
             }
-            else if ($strict) {
-                $where[] = $this->db->quoteIdentifier($col).' = '.$this->db->quote($value);
-            }
             else if ($col == '*') {
                 $words = array();
                 foreach(explode(" ", self::normalize_string($value)) as $word)
                     $words[] = $this->db->ilike('words', '%'.$word.'%');
                 $where[] = '(' . join(' AND ', $words) . ')';
-              }
-            else
+            }
+            else if ($strict) {
+                $where[] = $this->db->quoteIdentifier($col).' = '.$this->db->quote($value);
+            }
+            else if (in_array($col, $this->table_cols)) {
                 $where[] = $this->db->ilike($col, '%'.$value.'%');
+            }
         }
 
         foreach ($required as $col) {

--
Gitblit v1.9.1