CiviCRM
  1. CiviCRM
  2. CRM-5686

Cannot programatically alter "PHP" custom fields

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major 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.

        Activity

        Hide
        Harry Levinson added a comment -
        This bug is still present in 3.1.1

        Also, the test code doesn't test certain cases related to adding/updating custom data for Individual contacts:

        http://svn.civicrm.org/civicrm/trunk/tests/phpunit/api/v2/CustomValueContactTypeTest.php

        See Forum topic

        http://forum.civicrm.org/index.php/topic,11993.0.html

        Show
        Harry Levinson added a comment - This bug is still present in 3.1.1 Also, the test code doesn't test certain cases related to adding/updating custom data for Individual contacts: http://svn.civicrm.org/civicrm/trunk/tests/phpunit/api/v2/CustomValueContactTypeTest.php See Forum topic http://forum.civicrm.org/index.php/topic,11993.0.html
        Hide
        Donald A. Lobo added a comment -
        These 448 issues have not been worked on for the past 18 months.

        Doing a bulk close of old issues to make the issue queue more manageable. We should do this on a periodic basis.
        Show
        Donald A. Lobo added a comment - These 448 issues have not been worked on for the past 18 months. Doing a bulk close of old issues to make the issue queue more manageable. We should do this on a periodic basis.

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development