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

js function copyFieldValues fails when "Options per Line" is set

    Details

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

      Description

      To reproduce on demo site (with current data):

      • To search, limit to individuals
      • select the first three individuals
      • select Batch update via profile
      • select Supporter profile
      • Place checkbox in one of the options for the field "What kind of beans do you like?"
      • click the copy icon

      (I created the custom data field "What kind of beans do you like?" - it can be re-create - the only thing needed to trigger the error is a non-null value for the options per line.

      Instead of copying the value all the way down, it unchecks the value.

      The culprit seems to be in CRM/common/batchCopy.tpl, in the copyFieldValues() function here:

      if ( elementType == 'radio' )

      { firstElementValue = elementId.filter(':checked').eq(0).val(); elementId.filter("[value=" + firstElementValue + "]").prop("checked",true); }

      else if ( elementType == 'checkbox' ) {
      // handle checkbox
      // get the entity id of first element
      var firstEntityId = firstElement.parent().parent().attr('entity_id');

      If we are displaying the values in columns, they are nested in a table, so we can't assume that we'll find the first entity with parent().parent(). Not sure the best way to find it though...

        Attachments

          Activity

            People

            • Assignee:
              jamie Jamie McClelland
              Reporter:
              jamie Jamie McClelland
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: