2

I first posted this issue under another question (after upgrade, can't edit Contact Details fields (Custom Addressee and de-selected subtypes errors)) thinking two separate issues were related. But apparently they aren't. Since a kind soul correctly solved one of my issues, I marked his answer accepted. But one issue still isn't resolved, I decided to open a new question just for it.

I have upgraded a site from an older CiviCRM version (4.4) to 4.7.29. And now I can't edit the Contact Detail fields for any record with a specific custom subtype.

I have a type named "Member", which is a subtype of the "Individual" contact type. When I open one of these records in the backend, I get the following warning:

"One or more contact subtypes have been de-selected from the list for this contact. Any custom data associated with de-selected subtype will be removed as long as the contact does not have a contact subtype still selected. Click OK to proceed, or Cancel to review your changes before saving."

If I click "OK" to continue saving, the record does save -- but all of the data associated with the custom subtype "Member" is deleted.

Here's what I know so far:

-- This problem only occurs with the one custom subtype I've created. Other custom subtypes under "Organization" don't have this problem.

-- This problem only occurs in the administrative backend contact record screens. Profiles that are used in the website frontend update all details for this contact subtype without problems.

-- The custom subtype does appear correctly in the "Contact Type" field for the record.

-- Searching for contacts with this contact subtype works correctly and returns all the right data.

-- Creating a new record of this subtype works just fine. However, afterwards trying to save the new record has the same problem.

-- I've confirmed this error is thrown by the file /civicrm/templates/CRM/Contact/Form/Contact.tpl where the Javascript does this check at line 228:

{if $oldSubtypes}{literal}
    $('input[name=_qf_Contact_upload_view], input[name=_qf_Contact_upload_new]').click(function() {
      var submittedSubtypes = $('#contact_sub_type').val();
      var oldSubtypes = {/literal}{$oldSubtypes}{literal};

      var warning = false;
      $.each(oldSubtypes, function(index, subtype) {
        if ( $.inArray(subtype, submittedSubtypes) < 0 ) {
          warning = true;
        }
      });
      if ( warning ) {
        return confirm({/literal}'{ts escape="js"}One or more contact subtypes have been de-selected from the list for this contact. Any custom data associated with de-selected subtype will be removed as long as the contact does not have a contact subtype still selected. Click OK to proceed, or Cancel to review your changes before saving.{/ts}'{literal});
      }
      return true;
    });
    {/literal}{/if}

So.....it seems that one of my legacy custom contact types is no longer recognized by some part of CiviCRM, but it IS still recognized by some parts of CiviCRM? Help!

0

It seems to be problem with data how its saved in database. The settings for Custom group might have been corrupted during upgrade or some scenario are not being handle during upgrade. To debug or fix this you will need to do some troubleshooting

  1. Check each Individual and sub types custom groups and re save the settings for each such custom groups so that the settings are saved correctly.

  2. Check when updating contacts does the data from all custom data gets deleted or only the subtypes

  3. Check if Contact subtype are pre populated correctly on edit screen of contact and also Custom group fieldsets gets loaded of subtype and non subtype.

  4. Put debug statements to check what values are loaded in smarty variables for $oldSubtypes

HTH

Pradeep

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.