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

Ensure that is_primary is set to TRUE whenever we create a phone, email, IM, openID record IF it is the only record for that contact

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Fixed/Completed
    • Affects Version/s: 2.2.8
    • Fix Version/s: 3.0
    • Component/s: Core CiviCRM
    • Labels:
      None

      Description

      Currently you can insert a phone record (for example) via API (and I think also via Profile) - and the is_primary flag is set to 0 even though it's the only phone record for that contact. This causes problems in the EDIT Contact UI (as well as other interfaces). We should ensure that is_primary is always set TRUE for all these objects if they are the only one for a contact.

      -----------
      EXAMPLE: Using the location_create API insert a phone number for a contact that does not yet have a phone record...

      require_once 'api/v2/Location.php';

      $workPhone =array('phone' => '02327276048',
      'phone_type' => 'Phone');

      $phones = array ($workPhone);

      $workEmailFirst = array('email' => 'xyz@indiatimes.com');

      $workEmailSecond = array('email' => 'abcdef@hotmail.com');

      $emails = array($workEmailFirst,$workEmailSecond);

      $params = array(
      'phone' => $phones,
      'city' => 'Mumbai',
      'email' => $emails,
      'contact_id' => $contactID,
      'location_type_id' => 3
      );

      $locationAdd =& civicrm_location_add( $params );

        Attachments

          Activity

            People

            • Assignee:
              rajan Rajan P Mayekar
              Reporter:
              dgg David Greenberg
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: