6.0.0-beta1
7/7/25

[#14719] Turba_Api::search() option 'returnFields' does not get honored
Summary Turba_Api::search() option 'returnFields' does not get honored
Queue Turba
Queue Version Git master
Type Bug
State Resolved
Priority 1. Low
Owners mrubinsk (at) horde (dot) org
Requester birnbacs (at) gmail (dot) com
Created 10/26/2017 (2811 days ago)
Due
Updated 10/29/2017 (2808 days ago)
Assigned 10/28/2017 (2809 days ago)
Resolved 10/29/2017 (2808 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch No

History
10/29/2017 07:03:01 PM Michael Rubinsky State ⇒ Resolved
 
10/29/2017 07:02:53 PM Michael Rubinsky Comment #7 Reply to this comment
Fixed for 4.2.22
10/29/2017 07:00:19 PM Git Commit Comment #6 Reply to this comment
Changes have been made in Git (master):

commit 1a79f02f61287123ce68ac85c27d07144bf3b3c6
Author: Michael J Rubinsky <mrubinsk@horde.org>
Date:   Sun, 29 Oct 2017 12:58:55 -0400

Bug: 14719 Fix filtering on returnFields.

  M lib/Api.php

https://github.com/horde/turba/commit/1a79f02f61287123ce68ac85c27d07144bf3b3c6
10/29/2017 05:07:55 PM Git Commit Comment #5 Reply to this comment
Changes have been made in Git (FRAMEWORK_5_2):

commit ff2a01d301042b36df1c50c04a5a023ade03f496
Author: Michael J Rubinsky <mrubinsk@horde.org>
Date:   Sun, 29 Oct 2017 13:02:45 -0400

Bug: 14719 Fix filtering on returnFields.

  M lib/Api.php

https://github.com/horde/turba/commit/ff2a01d301042b36df1c50c04a5a023ade03f496
10/28/2017 10:30:27 PM Michael Rubinsky Comment #4
Assigned to Michael Rubinsky
State ⇒ Assigned
Reply to this comment
Confirmed.
10/27/2017 11:59:05 AM birnbacs (at) gmail (dot) com Comment #3
New Attachment: backends.local.php.txt Download
Reply to this comment
Update: function works partially.

It seems like all fields are returned always but some unrequested 
fields are not set to values (like workPhone in above example).

On the other hand, some not requested fields will always be returned 
(e.g. department and company).

It seems like this method was highly optimized for email use only.

For completeness sake I have my backends.local.php attached.
10/26/2017 02:34:19 PM birnbacs (at) gmail (dot) com Comment #2 Reply to this comment
My code:


                $opts = array(
                        'returnFields' => array ('fax', 'firstname', 'lastname'), // works not
                        'fields' => array ('lastname'), // works
                        //'count_only' => true, // works
                );

                $result = $GLOBALS['registry']->contacts->search('searchstring', $opts);

The output invariably comprises entries with all available fields, 
regardless of their name and content.

10/26/2017 02:28:14 PM birnbacs (at) gmail (dot) com Comment #1
Priority ⇒ 1. Low
Type ⇒ Bug
Summary ⇒ Turba_Api::search() option 'returnFields' does not get honored
Queue ⇒ Turba
Milestone ⇒
Patch ⇒ No
State ⇒ Unconfirmed
Reply to this comment
Turba's API has a search() method that accepts a number of different 
parameters. However, setting the 'returnFields' does not change the 
returned fields.

Saved Queries