CiviCRM
  1. CiviCRM
  2. CRM-3026

Cannot modify the primary location using civicrm_contact_add()

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 2.0, 2.1
    • Fix Version/s: 2.1
    • Component/s: Core CiviCRM
    • Labels:
      None

      Description

      For example all values (other than contact_id and contact_type) are different from what currently exists in CiviCRM:
      $contact = array (
        'contact_id' => '310764',
        'first_name' => 'DAVE',
        'last_name' => 'HANSEN-LANGE',
        'street_address' => '42 2/F',
        'city' => 'SHA',
        'postal_code' => '12345',
        'state_province_id' => NULL,
        'country_id' => '1098',
        'contact_type' => 'Individual',
      );
      civicrm_contact_add($contact);

      No errors are returned. The name fields are updated as expected, but the other fields aren't.

      I'm looking more into where things go wrong and why.

        Activity

        Hide
        James Saxon added a comment -
        Whoops, I guess that was Dave hansen-lange's code.
        Show
        James Saxon added a comment - Whoops, I guess that was Dave hansen-lange's code.
        Hide
        James Saxon added a comment -
        Should users be using this approach instead: civicrm_location_add, and civicrm_location_update:

        http://wiki.civicrm.org/confluence/display/CRMDOC/Location+APIs

        James
        Show
        James Saxon added a comment - Should users be using this approach instead: civicrm_location_add, and civicrm_location_update: http://wiki.civicrm.org/confluence/display/CRMDOC/Location+APIs James
        Hide
        Kurund Jalmi added a comment -
        James:

        What approach are you talking about? Please use http://forum.civicrm.org for queries/discussions.

        Kurund
        Show
        Kurund Jalmi added a comment - James: What approach are you talking about? Please use http://forum.civicrm.org for queries/discussions. Kurund
        Hide
        James Saxon added a comment -
        Hi Kurund,

        Instead of using civicrm_contact_update($params) where the documentation says that the default address information and phone information can be included, doing what it says at this link which I just implemented and it did update the address:

        http://wiki.civicrm.org/confluence/display/CRMDOC/Location+APIs

        In particular, the method described under civicrm_location_update.

        James
        Show
        James Saxon added a comment - Hi Kurund, Instead of using civicrm_contact_update($params) where the documentation says that the default address information and phone information can be included, doing what it says at this link which I just implemented and it did update the address: http://wiki.civicrm.org/confluence/display/CRMDOC/Location+APIs In particular, the method described under civicrm_location_update. James
        Hide
        dave hansen-lange added a comment -
        The problem with using the location API is that its a bit broken too:

        http://issues.civicrm.org/jira/browse/CRM-3307
        Show
        dave hansen-lange added a comment - The problem with using the location API is that its a bit broken too: http://issues.civicrm.org/jira/browse/CRM-3307

          People

          • Assignee:
            Kurund Jalmi
            Reporter:
            dave hansen-lange
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development