6.0.0-RC7
6/21/26

[#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/17 (3160 days ago)
Due
Updated 10/29/17 (3157 days ago)
Assigned 10/28/17 (3158 days ago)
Resolved 10/29/17 (3157 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch No

History
17 Michael Rubinsky State ⇒ Resolved
 
537 Michael Rubinsky Comment #7 Reply to this comment
Fixed for 4.2.22
197 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
555 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
2710 Michael Rubinsky Comment #4
Assigned to Michael Rubinsky
State ⇒ Assigned
Reply to this comment
Confirmed.
511 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.
192 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.

142 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