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

Integer custom fields with select/radio controls - multiple issues

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 4.7.8
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Versioning Impact:
      Patch (backwards-compatible bug fixes)
    • Documentation Required?:
      None
    • Funding Source:
      Needs Funding

      Description

      1. Importing field labels to integer custom fields raises a validation error.
      When importing into custom field that uses a radio/select control, one should be able to import both keys and values (see
      https://book.civicrm.org/user/current/common-workflows/importing-data/ - "your data source can use either the label [...] or value")

      This does work when importing labels into a field defined with alphanumeric storage. However, when the field uses integer storage, the labels are validated against the integer (timestamp) field type, and a fatal error is raised:
      One of parameters (value: Yes) is not of the type Timestamp

      I'm attaching the backtrace. After fixing this for integer fields, it may be worth testing this behaviour against Yes/No fields as well.

      2. Searching by integer fields with key-value maps yields no results
      However, searching in fields with alphanumeric storage does work

      3. Exporting integer fields with key-value maps results in a integer key values being exported

      4. related - alphanumeric field with key-value maps (1=>"I would like to receive mailings"), fields are truncated to the database field length on export. So, if I set a field length of 5, when exporting I get "I woul" in the CSV. The problem might also apply to integer fields once #3 is solved.

        Attachments

        1. contact - int and alphanum field.png
          33 kB
          Rares P
        2. search-alphanum field.png
          48 kB
          Rares P
        3. search-int field.png
          104 kB
          Rares P
        4. stacktrace.txt
          4 kB
          Rares P

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              rares Rares P
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: