Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-712

crm_contact_create does not recognize compound fields with the new location-dependent Profiles

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Fixed/Completed
    • Affects Version/s: 1.3
    • Fix Version/s: 1.3
    • Labels:
      None

      Description

      This is an issue with the API for contact creation. There is a work-around, but it requires a lot of undocumented info to work around; I expect that any Drupal code written to the 1.3 API would break in the near future.

      Suppose that your site's default location type is "Work" (as it is out of the box). Suppose that you want to use a specific profile that contains records like phone or email records. If you create a new profile in 1.3, and look in the <form> html, you'll see that:

      • You have to choose which location you use when you create the profile. You can't have a phone or email field without a location in 1.3.
      • In html, you'll find that the base name of your fields are something like "email-2", and "phone-2" (the "2" stands for "Work")
      • Here's the bug: if you want to create or save the field, you don't use the variable name ("email-2", "phone-2") to create the $param array for crm_create_contact(); you have to use "email" and "phone", and specify in addition a "location_type_id" value of "2". I believe you need to do this for search as well.

      This is pretty messy, and if you need to create a profile that writes to more than one location type, it isn't clear what to do.

      I'm coding around this issue now, and will have some sample code of what it takes to code around this. It's nasty.

        Attachments

          Activity

            People

            • Assignee:
              dgg David Greenberg
              Reporter:
              torenware Rob Thorne
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: