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

CLONE -CRM_Core_BAO_CustomValueTable::setValues doesn't let you set ContactReference values

    Details

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

      Description

      When you try to set a ContactReference custom field's value to a contact_id using CRM_Core_BAO_CustomValueTable::setValues, you get a fatal error from CRM_Utils_Type::escape saying "Cannot recognize ContactReference for [contact_id]" because it doesn't know how to handle ContactReference types.

      Is the fix just to add a ContactReference case to the Integer / Int case? If so, I can do that easily enough.

      Steps to replicate:
      1. Run this code ('custom_3' must be a custom field of ContactReference type, 123 should be the id of a Contribution object, and 456 should be a valid Contact id):
      $params = array( 'entityID' => 123, 'custom_3' => 456);
      require_once 'CRM/Core/BAO/CustomValueTable.php';
      CRM_Core_BAO_CustomValueTable::setValues( $params );

      A fatal error will be generated by CRM_Utils_Type::escape when the ContactReference type falls through the switch to the default case.

        Attachments

          Activity

            People

            • Assignee:
              priya Priya Prajapati
              Reporter:
              marty Marty Wright
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: