The change to list_records didn't quite work. It seemed to work well 
until I did a search that returned multiple pages of results. It was 
possible to click on contacts in the first page and see the full 
details, but clicking on contacts on any subsequent pages caused it to 
report "Contact not found".

I changed show.inc back to get_result, and looked more carefully at all 
of the functions in program/include/rcube_ldap.php. The culprit is the 
_ldap2result function that looks for case-sensitive field maps in the 
LDAP results. If the ldap results return all lower case keys, then the 
function will exclude ones defined with mixed-case in main.inc.php.

I added an "elseif" to also check for the lower case key, and assign it 
if the case-sensitive check fails. LDAP attributes should be case 
insensitive, so there should never be separate values in "displayname" 
and "displayName". The "search_fields" and "*_field" values are assigned 
case-sensitive values in main.inc.php, and I get expected results for 
both the list and the contact details.

Kyle


-------------------------------------------------------------
   /**
    * @access private
    */
   function _ldap2result($rec)
   {
     $out = array();

     if ($rec['dn'])
       $out[$this->primary_key] = base64_encode($rec['dn']);

     foreach ($this->fieldmap as $rf => $lf)
     {
       if ($rec[$lf]['count'])
         $out[$rf] = $rec[$lf][0];
       elseif ($rec[strtolower($lf)]['count'])
         $out[$rf] = $rec[strtolower($lf)][0];
     }

     return $out;
   }
-------------------------------------------------------------


Terminal Addict wrote:
> Oops. :)
> 
> The change does indeed work, but it required the "*_field" values to be 
> all lower case. The values in "search_fields" seem to be 
> case-insensitive (which I believe they should be).
> 
> Kyle
> 
> Terminal Addict wrote:
>> Okay...
>>
>> program/steps/addressbook/show.inc uses $CONTACTS->get_result()
>>
>> program/steps/addressbook/list.inc uses $CONTACTS->list_records()
>>
>> I tried changing both to get_result() and it didn't work. Changed both 
>> to list_records() and both work fine (with case-sensitive fields 
>> specified for search_fields and name_field arrays.
>>
>> So, line 33 in show.inc changed to the following yields expected results.
>>
>>    if (!(($result = $CONTACTS->list_records()) && ($record = 
>> $result->first()))) {
>>
>> Kyle
>>
>> Terminal Addict wrote:
>>> LDAP being used is AD. name_field is 'displayName'.
>>>
>>> If I specify name_field as 'displayname', then it properly displays 
>>> names in the list (for search results), but it won't show the display 
>>> name in the contact details.
>>>
>>> If I specify name_field as 'displayName', then it displays empty (but 
>>> clickable) fields in the list, but the display name shows up properly in 
>>> the contact details.
>>>
>>> By dumping variables, I can see that the same is happening for 
>>> firstname_field (givenName in LDAP), but that isn't a big deal since 
>>> that isn't used in the listing, only in the details.
>>>
>>> Any thoughts?
>>>
>>> Kyle
>>> _______________________________________________
>>> List info: http://lists.roundcube.net/dev/
>> _______________________________________________
>> List info: http://lists.roundcube.net/dev/
> 
> _______________________________________________
> List info: http://lists.roundcube.net/dev/

_______________________________________________
List info: http://lists.roundcube.net/dev/

Reply via email to