6.0.0-RC7
6/29/26

[#3212] Searching "My Contacts" with Kolab2 doesn't work
Summary Searching "My Contacts" with Kolab2 doesn't work
Queue Kolab
Type Bug
State Resolved
Priority 2. Medium
Owners wrobel (at) horde (dot) org
Requester bestellung (at) schurkennetz (dot) de
Created 1/1/06 (7484 days ago)
Due
Updated 5/29/07 (6971 days ago)
Assigned 5/24/06 (7341 days ago)
Resolved 5/29/07 (6971 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch Yes

History
5110 Gunnar Wrobel Comment #16
State ⇒ Resolved
Reply to this comment
Should work with the new framework in CVS.
2510 Jan Schneider Assigned to Gunnar Wrobel
Taken from stuart
 
4211 vovan (at) planet (dot) nl Comment #15 Reply to this comment
Two patches work fine here. Only a quick note: In my opinion search 
should'n be case sensitive as it is at the moment..
5012 robin (at) medial-networks (dot) de Comment #14 Reply to this comment
Hello,

my name is  Hermann Robin. I am using Horde version 3.1.1 with turba 
version H3(2.1.1) and imp version H3(4.1.2) with Kolab version 2.0.3. 
I fixed some problems with the turba addressbook by using your patches 
   "fix_addressbook_search_one.patch"  and 
"fix_addressbook_search_two.patch". But after these,i have some 
further problems with the turba adressbook. First: i can't import any 
addresse from csv-files (for each entry an "Already exists" error 
message appears) and second: listing each entry  of the adressbook by 
composing a new message under the imp application, the listing in the 
addressbook window is always empty, although there are any existing 
entries for the users wich is currently logged in and a listing of the 
addressbook by using the turba apllication always succeeded (all 
entries will be displayed). I found out, that the imp apllication uses 
a different search type as the turba apllication does it by clicking 
on the Addressbook "List" Button from menu. Both searches are creating 
an array called $criteria for the search function. The turba 
apllication creates for a simple listing an simple array with the keys 
"[0] => 'owner' [1] => '=' [2] => 'mailaddr@domain.tld'. This array 
discribes what the search function should do. The imp apllication 
creates a more complex array with more criterias combined with the 
logical 'OR' operator. It seems to me, that these criterias combined 
by the 'OR' operator, will never take place and the result of this 
search is always empty. I fixed this problem by changing the 
_matchCriteria function in the turba/lib/Driver/kolab.php file  as 
followed:



     function _matchCriteria($contact, $criteria)

     {

         $values = array_values($criteria);

         $values = $values[0];

         $ok = true;



         for ($current = 0; $current < count($values); ++$current) {

             $temp = $values[$current];



             while (!empty($temp) && !array_key_exists('field', $temp)) {

                 $temp = array_values($temp);

                 $temp = $temp[0];

             }



             if (empty($temp)) {

                 continue;

             }



//-------------------------------------------------------------------------------------------------------------------------------------



             if (array_key_exists('OR', $values[1])) {

               if ( $temp['field'] == "full-name") {

                  continue;

               }

             }



//-----------------------------------------------------------------------------------------------------------------------



             $searchkey = $temp['field'];

             $searchval = $temp['test'];



             if (strstr($contact[$searchkey], $searchval) == false) {

                 $ok = $ok && false;

             } else {

                 $ok = $ok && true;

             }

         }



         return $ok;

     }



}



#############################################################################



This modification caused that, only and  whenever the imp apllication 
is searching in the adressbook by clicking on the "Addressbook" Button 
while composing a new message, the "for" loop will be continued if 
this specific search is carried out by the imp adressbook. search. So 
the result $ok of this function will return "true" an the entries will 
be display, the import of csv files will also work properly.



I hope, that the modification i made are okay. Anyhow everything 
works. Perhaps, someone still knows a better solution of this problem.
3912 wrobel (at) gentoo (dot) org Comment #13 Reply to this comment
Replacing the IMAP search with a php replacement looks fine, but I do 
not fully understand why the function "listObjectsInFolder" has been 
added to the kolab.php driver.



The search uses a call to "listFolders" which grabs all readable 
contact folders on the kolab server and will subsequently search each 
of them. This breaks the logic of a turba share in my eyes. If I 
understand it correctly, the turba driver should map one share to one 
addressbook (e.g. ONE kolab folder)



Each accessible shared folder should probably be represented by a 
source in sources.php. There is a corresponding TODO note in the 
sources file.



I'll create a patch that fixes the problem but if somebody has 
objections I'd like to know if my assumptions are wrong :)
145 Chuck Hagenbuch Comment #12
Assigned to stuart
Taken from Horde DevelopersHorde Developers
State ⇒ Assigned
Reply to this comment
Patches cleaned up and committed, along with an is_callable check. 
Giving back to the Kolab team for final fixes, tweaks, etc.
564 Jan Schneider Comment #11 Reply to this comment
We need another way, at least a check for that method. I can see Turba 
failing silently if the method doesn't exists as an alternative. 
Otherwise the solution should be implemented in Turba only.
104 Chuck Hagenbuch Comment #10
State ⇒ Feedback
Reply to this comment
The patches break BC by adding a new method to the Kolab class and 
then using it in the Turba driver. Do we consider that okay with 
Kolab, or does another way need to be found?
188 Jan Schneider Comment #9 Reply to this comment
Because it has a (more or less) working patch attached.
285 Chuck Hagenbuch Comment #8 Reply to this comment
Jan - why is this assigned to Horde devs, instead of to the Kolab folks?
539 t (dot) nintemann (at) medial-networks (dot) net Comment #7 Reply to this comment
Hi,

i have found another Problem with the Patches,

Wenn i try to add a Address from a Mail and it is the first Address, i 
wan´t to put in "My Adressbook" after the Patch, it works. But every 
Adress after that wont work, and i get the Information "Already 
Exists" in IMP.

It only works, if i set:

" } elseif ($result->count() > 1) { "

on Line 575 in turba/lib/api.php



Thomas Nintemann
02 t (dot) nintemann (at) medial-networks (dot) net Comment #6 Reply to this comment
Hi,

attached are two patches which replace the imap search by a php based search.
Hi Tobias,

Thanks for the Patches, they work great on my site.

The only thing i had to do with your "fix_adressbook_search_one.patch" 
was to uncomment the lines 96,97,98 then it works for me.



Thomas Nintemann
















513 Jan Schneider Priority ⇒ 2. Medium
 
4510 Jan Schneider Assigned to Horde DevelopersHorde Developers
Taken from stuart
 
4711 tokoe (at) kde (dot) org Comment #5
New Attachment: fix_addressbook_search_two.patch Download
Reply to this comment
second patch
611 tokoe (at) kde (dot) org Comment #4
New Attachment: fix_addressbook_search_one.patch Download
Reply to this comment
Hi,



attached are two patches which replace the imap search by a php based search.

I guess the IMAP search never worked correctly, because



1) IMAP can't search recursive, so a search on the INBOX will always 
return 0 entries

2) Using the 'BODY' search flag doesn't work with cyrus, either it 
doesn't search in parts where

mimetype != 'text/plain' or it can't search in mimeparts



Ciao,

Tobias
477 t (dot) nintemann (at) medial-networks (dot) net Comment #3 Reply to this comment

[Show Quoted Text - 12 lines]
Have the same problem with Horde 3.0.9, Turba H3 2.0.5 and IMP H3 4.04  stable

Releases. I use Kolab 2.0.3.
48 bestellung (at) schurkennetz (dot) de Comment #2 Reply to this comment
  Browsing "My Contacts" doesn't work at all.
Sorry, I have to add that browsing "My Contacs" from within turba does 
work as supposed, but browsing "My Contacts" from within IMP doesn't 
work. The window remains empty.



Kind regards
371 Chuck Hagenbuch Assigned to stuart
State ⇒ Assigned
 
11 Chuck Hagenbuch Version ⇒
Queue ⇒ Kolab
 
4910 bestellung (at) schurkennetz (dot) de Comment #1
Priority ⇒ 1. Low
State ⇒ Unconfirmed
Queue ⇒ Turba
Type ⇒ Bug
Summary ⇒ Searching "My Contacts" with Kolab2 doesn't work
Reply to this comment
Hi,



I'm using horde, turba and imp from CVS (turba shows version 2.2-CVS) 
together with Kolab 2.01.



When I try to search "My Contacts", the results are always empty. But 
browsing "My Contacts" works as supposed. Searching the global address 
book works as well.



When I try to use the address book from within IMP, it only works for 
the global addressbook. Browsing "My Contacts" doesn't work at all.



This is the turba-datatree:

-----------------------------------

Array

(

)

Array

(

   [0] => Array

   (

     [name] => perm_users

     [key] => manu@homebase.local

     [value] => 30

   )

   [1] => Array

   (

     [name] => name

     [key] =>

     [value] => Manuel's Address Book

   )

   [2] => Array

   (

     [name] => owner

     [key] =>

     [value] => manu@homebase.local

   )

)

------------------------------------------



Kind regards






Saved Queries