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

civicrm_custom_field_delete generates non-recoverable error in certain circumstances

    Details

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

      Description

      civicrm_custom_field_delete($parms) in civicrm/api/v2/CustomGroup.php generates non-recoverable error in certain circumstances.

      the problem appears to be something to do with indexing. i've only positively one set of circumstances which cause this error so far, but i'll add further comments if i identify more (i suspect there will be).

      if you use civicrm_custom_field_create(...) to add a custom field with these attributes:
      name="test1_field_name"
      label="test1_field_label"
      datatype="Memo"
      htmltype="TextArea"
      is_searchable=0

      ...then civicrm_custom_field_delete(...) successfully deletes the custom field.

      however if you use these attributes:
      name="test2_field_name"
      label="test2_field_label"
      datatype="Memo"
      htmltype="TextArea"
      is_searchable=1 [ Notice that is searchable is now set to 1 ]#

      ...then the civicrm_custom_field_delete(...) call generates a non-recoverable error with the following error message

      "Sorry. A non-recoverable error has occurred.
      Database Error Code: Can't DROP 'INDEX_test2_field_label'; check that column/key exists, 1091"

      i've attached some code which demonstrates this (and generates the above error)

        Attachments

        1. API_issue_demo.php
          4 kB
          Dougall Winship
        2. crm2932.php
          4 kB
          David Greenberg

          Activity

            People

            • Assignee:
              dgg David Greenberg
              Reporter:
              dougall Dougall Winship
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: