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

Problem with relationship API if all contacttypes

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Fixed/Completed
    • Affects Version/s: 3.0.2
    • Fix Version/s: 3.0.4
    • Component/s: CiviCRM API
    • Labels:
      None

      Description

      The relationship API returns an error if I try to establish a relation between an individual and an organization when the setup is All contacttypes.
      I have set up a relationship type called Partner (see attachment) with All Contacttypes.

      When I use the following code to add a relationship I get an error (Contact ID :3315 is not of contact type).
      Code:
      $params = array(
      'contact_id_a' => 3315,
      'contact_id_b' => 3314,
      'relationship_type_id' => 30,
      'start_date' => date("Y-m-d", strtotime("2010-01-14")),
      'is_active' => 1);

      // Call CiviCRM API functie to add relation:

      $rel = & civicrm_relationship_create( $params );

      /* write error if civicrm returns error */
      print_r($rel);

      The error disappears if I change the setup of the relationship to From Person To Organization. But I need this type as well between Organizations, and I assume this should work.

        Attachments

          Activity

            People

            • Assignee:
              rajan Rajan P Mayekar
              Reporter:
              erikhommel Erik Hommel
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: