CRM-17493 Issue with importing to checkbox type fields where label is the same as database value (may affect other types too)

    Details

    • Type: Bug
    • Status: Reopened
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 4.6.10, 4.7.13
    • Fix Version/s: 4.6.11
    • Component/s: None
    • Labels:
    • Versioning Impact:
      Patch (backwards-compatible bug fixes)
    • Documentation Required?:
      None
    • Funding Source:
      Contributed Code

      Description

      Hi Dave,

      Can you size up a fix for an issue with imports into checkboxes (but may affect other field widgets also).

      If you create a new custom field and in this case add it to activity. Make the field a checkbox and give it some options.

      Make the option label + the same+ as the option value. important!

      If you then attempt to import to the field through the importer, after import you will get error for all fields "'1' is not a valid option for field custom_XX"

      I set this up on the demo site http://d46.demo.civicrm.org/ - using new field called "Nature of enquiry / feedback".

      Please see example import attached and import errors doc.

      If you can size this up asap and then I can get the fix approved to be paid.

      Let me know if you need any more info.

      Many thanks

      nb - Dave if you want to include in costs adding tests to this stuff then please give both estimates. thanks

        Attachments

        1. Import_Errors (8).csv
          0.4 kB
          Jamie Novick
        2. Workbook1.csv
          0.2 kB
          Jamie Novick

          Activity

          [CRM-17493] Issue with importing to checkbox type fields where label is the same as database value (may affect other types too)
          David Greenberg added a comment -

          RE: "note: also there seems to be an issue with this field on the dev site in that the option values are not showing on this page for some reason: http://d46.demo.civicrm.org/civicrm/admin/custom/group/field/option?reset=1&action=browse&fid=13&gid=7 but they are definitely there as if I try and add them it says they already exist. Let me know if you want a separate ticket for the option values."

          Jamie Novick The 'Edit Multiple Choice Options' page is broken regardless of the contents of the option labels / values IF the default Display Preferences setting 'Enable Pop-up Forms' has been disabled. This is a separate (minor) issue unrelated to the above problem. Discussing a fix w/ Coleman Watts.

          Coleman Watts added a comment -
          Jamie Novick added a comment -

          Sorry coleman - does the fix fix the issue with the import or with the custom fields? thanks

          Coleman Watts added a comment -

          Neither, that was just the fix for the datatable not appearing when 'Enable Pop-up Forms' was disabled.

          Jamie McClelland added a comment -

          We encountered the same problem ("1" is not a valid option).

          I've just created a pull request:

          https://github.com/civicrm/civicrm-core/pull/7178

          Unfortunately, it involved touching one of those toxic functions - I haven't fixed the function. But at least I have only removed code from it (rather than adding code).

          I'm also not sure what other implications this change might have - however, it seems to work fine on the site affected.

          David Greenberg added a comment -

          Jamie Novick I don't think you've responded to our estimate on this - and it looks like Jamie McClelland has come up with a fix. The code he's removed has been in place since prior to our Github migration, so rationale for that conditional is not obvious. If your team can test out your scenario as well as the 'default' scenario where values are assigned integers, then we can go ahead and merge.

          Jamie Novick added a comment -

          On it.

          Jamie McClelland added a comment -

          I just updated the pull request - I realized that I had not made the needed change in all the functions that required it.

          David Greenberg added a comment -

          Awaiting QA by Compucorp team.

          David Greenberg added a comment -

          Per Phil Nelms - the PR fixes the problem.

          Erin Free added a comment -

          Is there a download for this patch or for 4.6.11? Where would I get it?

          David Greenberg added a comment -

          Hi Erin Free - Generally the Pull Requests for an issue are displayed (as above) in the Issue Links area. The PR for this fix is https://github.com/civicrm/civicrm-core/pull/7178 and you can always get a patch file by adding .patch to the end of the URL, loading the page, and clicking Save in your browser (e.g. https://github.com/civicrm/civicrm-core/pull/7178.patch).

          Eileen McNaughton added a comment -

          I am doing some code wrangling and it seems that this may not be in master/4.7 but only 4.6? I'm not sure but I suggest you test to check if you rely on this

          Jamie McClelland added a comment -

          As Eileen points out, this was never applied to 4.7

          Jamie McClelland added a comment -

          I've created a new pull request against master:

          https://github.com/civicrm/civicrm-core/pull/9393

            People

            • Assignee:
              Unassigned
              Reporter:
              Jamie Novick

              Dates

              • Created:
                Updated: