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

Cannot programatically alter "PHP" custom fields

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 2.2.9, 3.0, 3.0.1, 3.0.2, 3.0.3, 3.1
    • Fix Version/s: 4.3.0
    • Component/s: CiviCRM API, Core CiviCRM
    • Labels:
      None

      Description

      In CRM-1594 we added the ability to make custom fields view-only so as to be modified by PHP only. This works fine if you are altering the field during a form hook (I think). But it doesn't work if you attempt to alter the field via the API. The problem is a little chunk of code in CRM/Core/BAO/CustomField.php line 1232:

      // return if field is a 'code' field
      if ( CRM_Utils_Array::value( 'is_view', $customFields[$customFieldId] ) )

      { return; }

      This was added in r1482 as part of CRM-1594
      http://fisheye2.atlassian.com/browse/CiviCRM/trunk/CRM/Core/BAO/CustomField.php?r=14842#l919

      If I remove this chunk it all works out fine, but I'm unsure if there's any other repercussions to this change. The field isn't shown on the main contact edit form, so it appears safe to me.

        Attachments

          Activity

            People

            • Assignee:
              lobo Donald A. Lobo
              Reporter:
              dalin dave hansen-lange
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: