From 5148d388ea954ccb0320bd5b2e963c9018820938 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Fri, 03 Jun 2011 09:02:30 -0400
Subject: [PATCH] - Small fix for advanced searching

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

diff --git a/program/include/rcube_contacts.php b/program/include/rcube_contacts.php
index 6af4382..38a1f37 100644
--- a/program/include/rcube_contacts.php
+++ b/program/include/rcube_contacts.php
@@ -321,7 +321,7 @@
                 $this->list_records(null, $i, true);
                 while ($row = $this->result->next()) {
                     $id = $row[$this->primary_key];
-                    $found = 0;
+                    $found = array();
                     foreach (preg_grep($regexp, array_keys($row)) as $col) {
                         $pos     = strpos($col, ':');
                         $colname = $pos ? substr($col, 0, $pos) : $col;
@@ -333,13 +333,13 @@
                             }
                             $value = mb_strtolower($value);
                             if (($strict && $value == $search) || (!$strict && strpos($value, $search) !== false)) {
-                                $found++;
+                                $found[$colname] = true;
                                 break;
                             }
                         }
                     }
                     // all fields match
-                    if ($found >= $scnt) {
+                    if (count($found) >= $scnt) {
                         $ids[] = $id;
                     }
                 }

--
Gitblit v1.9.1