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

Case Activity sometimes shows custom data twice on form errors / CRM.buildCustomData question

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Trivial
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.3.5
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      I'm having a very weird, hard to reproduce bug in CiviCase activities, but hopefully the fix will make sense:

      What happens: I have a huge case activity form with lots of fields. If I fill the form, and leave a mandatory field empty, the form will reload with an error message. However, my custom fields are duplicated on screen.

      What seems to fix the issue for me is in: ./templates/CRM/Case/Form/Activity.tpl

      {literal}
      <script type="text/javascript">
      cj(function() {
      {/literal}
      CRM.buildCustomData( '{$customDataType}' );
      {if $customDataSubType}
      CRM.buildCustomData( '{$customDataType}', {$customDataSubType} );
      {/if}

      Compared with: ./templates/CRM/Activity/Form/Activity.tpl

      {literal}

      <script type="text/javascript">
      cj(function() {

      {/literal} {if $customDataSubType}

      CRM.buildCustomData( '{$customDataType}', {$customDataSubType} );

      {else}

      CRM.buildCustomData( '{$customDataType}' );

      {/if}

      I applied the same code to the Case Activity.tpl, and it solved my problem.

      In the Firefox network log, it also shows two ajax queries to fetch the custom fields for both the activity, and the activity sub-type. The output of the first ajax query (activity, without subType) doesn't seem useful at all, since it is just a subset of the ajax query response for the subType.

        Attachments

          Activity

            People

            • Assignee:
              mlutfy Mathieu Lutfy
              Reporter:
              mlutfy Mathieu Lutfy
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: