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

multi custom data: after sorting, unable to edit

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.7.8
    • Fix Version/s: 4.7.9
    • Component/s: None
    • Labels:
    • Documentation Required?:
      None
    • Funding Source:
      Core Team Funds

      Description

      to reproduce:

      1. create a custom data set, enable multi values, and display as tab with table
      2. create a text field in the set
      3. visit a contact and add about 15 records
      4. visit a second contact and add about 15 records
      5. in the second contact, click the field column to resort the values.
      6. click the edit link. the form opens but is blank. (depending on how many records you created, you may need to click a few links before you get a broken one). also, you may need to set the display count to 10 to trigger the error.

      I've traced it to this line:
      https://github.com/civicrm/civicrm-core/blob/master/CRM/Profile/Page/MultipleRecordFieldsListing.php#L392

      here's what happens:
      1. all records are retrieved initially and an array is built with a key of cgcount and array of values, including the record ID. that initial array is fine – each row has a unique cgcount.
      2. after sorting, the above line in the code changes the cgcount value from a count key to the record ID. that completely breaks things.

      the line referenced above is clearly broken. it's using two completely different values to determine the cgcount value which is then passed via the url to the edit form.

      but I think the broader issue is that using the row count is a lousy way to reference the row. we should be using the record ID, which is always unique.

        Attachments

          Activity

            People

            • Assignee:
              monish.deb Monish Deb
              Reporter:
              lcdweb Brian Shaughnessy
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 3 hours, 30 minutes
                3h 30m