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

crm_get_contact returns contact without contact_type_object

    Details

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

      Description

      My code does:

      global $user;
      $params = array('email' => $user->mail);
      $contact =& crm_get_contact($params);

      And returns the object below with [contact_type_object] not set. This causes problems when I pass it to crm_add_group_contacts(). The error returned by crm_add_group_contacts is 8000 "Invalid Contact Object passed in". The complete error object from the crm_add_group_contacts() is shown below the Contact Object. I retested with Drupal 4.7 and CiviCRM 1.5 and it works fine there.

      I have CiviCRM 1.6 build 8052 with php5 on windows. I have a new Drupal database and a new CiviCRM 1.6 database. I am upgrading a module from Drupal 4.7 -> 5.0: http://cvs.drupal.org/viewcvs/drupal/contributions/modules/civicrm_activeuser/civicrm_activeuser.module

      CRM_Contact_BAO_Contact Object
      (
      [nick_name] =>
      [domain_id] => 1
      [contact_type] => Individual
      [do_not_email] => 0
      [do_not_phone] => 0
      [do_not_mail] => 0
      [contact_sub_type] =>
      [legal_identifier] =>
      [external_identifier] =>
      [sort_name] => douggreen@douggreenconsulting.com
      [display_name] => douggreen@douggreenconsulting.com
      [home_URL] =>
      [image_URL] =>
      [preferred_communication_method] =>
      [preferred_mail_format] => Both
      [do_not_trade] => 0
      [hash] => d40e38705c22b186d5a863502930b9e5
      [is_opt_out] => 0
      [id] => 1
      [source] =>
      [_DB_DataObject_version] => 1.8.4
      [__table] => civicrm_contact
      [N] => 1
      [_database_dsn] =>
      [_database_dsn_md5] => 3a14c94fa8a939ffab43eb70f8e15f5f
      [_database] => doug_civicrm16
      [_DB_resultid] => 34
      [_resultFields] =>
      [_link_loaded] =>
      [_join] =>
      [_lastError] =>
      [_query] => Array
      (
      [condition] =>
      [group_by] =>
      [order_by] =>
      [having] =>
      [limit_start] =>
      [limit_count] =>
      [data_select] => *
      )

      [contact_id] => 1
      [contact_type_object] =>
      [location] => Array
      (
      [1] => CRM_Core_BAO_Location Object
      (
      [id] => 1
      [entity_table] => civicrm_contact
      [entity_id] => 1
      [location_type_id] => 1
      [is_primary] => 1
      [name] =>
      [_DB_DataObject_version] => 1.8.4
      [__table] => civicrm_location
      [N] => 1
      [_database_dsn] =>
      [_database_dsn_md5] => 3a14c94fa8a939ffab43eb70f8e15f5f
      [_database] => doug_civicrm16
      [_DB_resultid] => 36
      [_resultFields] =>
      [_link_loaded] =>
      [_join] =>
      [_lastError] =>
      [address] =>
      [phone] => Array
      (
      )

      [email] => Array
      (
      [1] => CRM_Core_BAO_Email Object
      (
      [id] => 1
      [location_id] => 1
      [email] => douggreen@douggreenconsulting.com
      [is_primary] => 1
      [on_hold] => 0
      [hold_date] =>
      [reset_date] =>
      [_DB_DataObject_version] => 1.8.4
      [__table] => civicrm_email
      [N] => 1
      [_database_dsn] =>
      [_database_dsn_md5] => 3a14c94fa8a939ffab43eb70f8e15f5f
      [_database] => doug_civicrm16
      [_DB_resultid] => 39
      [_resultFields] =>
      [_link_loaded] =>
      [_join] =>
      [_lastError] =>
      )

      )

      [im] => Array
      (
      )

      )

      )

      [custom_values] => Array
      (
      )

      )

      CRM_Core_Error Object
      (
      [_errors] => Array
      (
      [0] => Array
      (
      [code] => 8000
      [params] => Array
      (
      [0] =>
      )

      [package] => CRM
      [level] => Fatal
      [time] => 1167478504.7529
      [context] => Array
      (
      [file] => C:\wamp\data\apache\htdocs\doug5\sites\doug5.civicactions.net\modules\civicrm\CRM\Core\Error.php
      [line] => 477
      [function] => createError
      [class] => CRM_Core_Error
      )

      [message] => Invalid contact object passed in
      )

      )

      [_errorsByLevel] => Array
      (
      [Fatal] => Array
      (
      [0] => Array
      (
      [code] => 8000
      [params] => Array
      (
      [0] =>
      )

      [package] => CRM
      [level] => Fatal
      [time] => 1167478504.7529
      [context] => Array
      (
      [file] => C:\wamp\data\apache\htdocs\doug5\sites\doug5.civicactions.net\modules\civicrm\CRM\Core\Error.php
      [line] => 477
      [function] => createError
      [class] => CRM_Core_Error
      )

      [message] => Invalid contact object passed in
      )

      )

      )

      [_package] => CRM
      [_compat] =>
      [_msgCallback] => Array
      (
      [0] => CRM_Core_Error Object
      RECURSION
      [1] => getErrorMessage
      )

      [_contextCallback] => Array
      (
      [0] => CRM_Core_Error Object
      RECURSION
      [1] => getFileLine
      )

      [_errorCallback] => Array
      (
      )

      [_logger] => Log_display Object
      (
      [_error_prepend] =>
      [_error_append] =>
      [_linebreak] => <br />

      [_opened] =>
      [_id] => 2f4edadb416c6d0f29135ef4aeae19e5
      [_ident] =>
      [_priority] => 6
      [_mask] => 255
      [_listeners] => Array
      (
      )

      [_formatMap] => Array
      (
      [%

      {timestamp}

      ] => %1$s
      [%

      {ident}

      ] => %2$s
      [%

      {priority}

      ] => %3$s
      [%

      {message}

      ] => %4$s
      [%

      {file}

      ] => %5$s
      [%

      {line}

      ] => %6$s
      [%

      {function}

      ] => %7$s
      [%\{] => %%{
      )

      )

      [_errorMsgs] => Array
      (
      )

      )

        Attachments

          Activity

            People

            • Assignee:
              rupam Rupam Jaiswal
              Reporter:
              douggreen Doug Green
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: