CRM-10736 Contact API broken if contact type labels are re-named

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.2.0
    • Fix Version/s: 4.2.6
    • Component/s: CiviCRM API
    • Labels:
      None

      Description

      Validation in api/utils.php is making the erroneous assumption that every string passed in must be a label and not a value.
      Fixing for 4.2.1

        Attachments

          Activity

          [CRM-10736] Contact API broken if contact type labels are re-named
          Eileen McNaughton added a comment -

          (10:31:15 AM) eileen: colemanw - look at http://drupal.demo.civicrm.org/civicrm/api/explorer#/civicrm/ajax/rest?json=1&sequential=1&debug=1&&entity=Contact&action=getfields&api_action=get
          (10:32:05 AM) eileen: are you saying you see "Org":"Organization" on yours rather than "Organization":"Organization" like in that link (contactType, options)

          if you are seeing Org:Organization then it is just within the utils bit of code (yay)

          Eileen McNaughton added a comment - - edited

          Hi Coleman

          We have been finding this now broken when the contact_type DOES equal Individual (incl on webform)

          Eileen McNaughton added a comment -

          Opps - just found something else your patch broke...

          $params[$fieldname] = $numericvalue;
          was changed to $value = $numericvalue;

          (& I didn't spot this when I tidyied up the function in trunk & removed $value = $numericvalue; since it wasn't achieving anything). So, need to fix again in trunk & then figure out if the fixed version is backportable.

          Eileen McNaughton added a comment -

          However, just thinking it through - there aren't many fields affected - so we can probably ignore that & re-add it when we have clear tests on it.

          Eileen McNaughton added a comment -

          Hi Coleman,

          I have committed the simpler version now running on trunk (which works off whether getfields has rendered the options) rather than the details of the specs.

          There is a swap that is not happening now (from your fix) - but there are not many fields affected so I'm inclined to leave it out until I identify some tests.

          Anyway - maybe you could eyeball this for sanity since it's for a point release. It seems to mostly be the contact_type fields that are affected.

          Deepak Srivastava added a comment -

          After discussion with Eileen, i reverted commits related to this issue from 4.2 branch, as they were breaking all tests, and 4.2.3 could go out without them.

          We should do a check on 4.2 if / when we try to apply them back.

          Eileen McNaughton added a comment -

          Trunk has changed quite a bit since this & no-one is reporting in 4.2 now so I think it is fixed after all

            People

            • Assignee:
              Coleman Watts
              Reporter:
              Coleman Watts

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 45 minutes
                45m