CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Discussion (deprecated) »
  • Alpha and Beta Release Testing »
  • 3.1 Release Testing »
  • API contact search stops returning custom data when required changed on 1 field
Pages: [1]

Author Topic: API contact search stops returning custom data when required changed on 1 field  (Read 3465 times)

davej

  • Ask me questions
  • ****
  • Posts: 404
  • Karma: 21
API contact search stops returning custom data when required changed on 1 field
January 18, 2010, 09:11:35 am
Hi,

With 3.1.beta5, had a problem earlier where a call to civicrm_contact_search with following params:

Code: [Select]
(
    [contact_id] => 202          -- (or whatever)
    [return.contact_id] => 1
    [return.custom_8] => 1
    [return.custom_5] => 1
    [return.custom_2] => 1
    [return.custom_3] => 1
    [return.custom_25] => 1
    [return.custom_26] => 1
    [return.custom_28] => 1
)

- which had been working fine, suddenly started returning only the contact id. I tracked it down to one of the custom fields, a Yes/No field, having been changed in the UI from Required to Not Required. Changing it back again solved the problem. I don't think there was data loss, it just stopped the API call from returning any of the custom fields.

An example return value from the API call when the problem was occurring (after the Yes/No field was changed to Not Required):

Code: [Select]
Array
(
    [400] => Array
        (
            [contact_id] => 400
        )
)

An example return value from the API call when the problem stopped occurring (after the Yes/No field was changed back to Required):

Code: [Select]
Array
(
    [400] => Array
        (
            [contact_id] => 400
            [civicrm_value_eoi_section_c_current_technology_2_id] => 64
            [custom_2] => 0
            [custom_25] =>
            [custom_26] =>
            [custom_28] =>
            [civicrm_value_eoi_section_a_applying_service_p_3_id] => 144
            [custom_5] => 0
        )
)

Further info: the above was with beta5 modified to work around this issue: http://forum.civicrm.org/index.php/topic,11656.0.html - viz applying this change:

Code: [Select]
--- CRM/Profile/Form/Edit.php.orig      2010-01-13 08:34:31.000000000 +0000
+++ CRM/Profile/Form/Edit.php   2010-01-19 12:41:29.000000000 +0000
@@ -75,7 +75,7 @@
 
         if ( $this->get( 'edit' ) ) {
             //this is edit mode.
-            $this->_mode = CRM_Profile_Form::MODE_EDIT;
+            #$this->_mode = CRM_Profile_Form::MODE_EDIT;
             
             // make sure we have right permission to edit this user
             $session =& CRM_Core_Session::singleton();

I've been unable to replicate the issue on a dev site identical to the site where it occurred. :(

Another problem occurred at the same time as the above issue: we have a profile that includes the above fields and while the civicrm_contact_search problem was happening, we had a recurrence of Yes or No field in profile: No value lost on profile edit form for the Yes/No field that had been changed to Not Required. This problem disappeared when the Yes/No field was changed back to Required.

I wonder if the issues may have been due to old stuff left under templates_c - does this get cleared by the upgrade script? If not, should it be?

Dave J
« Last Edit: January 19, 2010, 05:03:59 am by davej »

Yashodha Chaku

  • Forum Godess / God
  • Ask me questions
  • *****
  • Posts: 755
  • Karma: 57
    • CiviCRM
Re: API contact search stops returning custom data when required changed on 1 field
January 21, 2010, 06:03:01 am
I could not replicate the behavior with Yes/No custom field, checked w/ required and not required.
You might want to check the same w/ beta6 which should be released later this week.

-Yashodha
Found this reply helpful? Contribute NOW and help us improve CiviCRM with the Make it Happen! initiative.

davej

  • Ask me questions
  • ****
  • Posts: 404
  • Karma: 21
Re: API contact search stops returning custom data when required changed on 1 field
February 01, 2010, 04:13:26 am
Had another occurrence on beta5 of the same problem with civicrm_contact_search failing to return custom data but in slightly different circumstances:

- I altered and added fields in a custom group that was flagged inactive. The custom group is configured for a sub-type X of Organization.
- Made the custom group active.
- Edited an org of sub-type X, filled in data for the fields in this custom group, saved.
- Verified that the custom data was now present on this org's contact view page.
- Ran the civicrm_contact_search query (as in original post) and got no custom data back. Repeated a few times.
- Made a null edit to one of the fields in the custom group.
- Ran the civicrm_contact_search query again - now it worked.

Maybe a caching issue, possibly involving contact subtypes? Not currently able to upgrade this site to 3.1.1 but will do when I get a window.

Dave

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Discussion (deprecated) »
  • Alpha and Beta Release Testing »
  • 3.1 Release Testing »
  • API contact search stops returning custom data when required changed on 1 field

This forum was archived on 2017-11-26.