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

CLI import doesn't allow single-column CSVs

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Trivial
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.7.23
    • Fix Version/s: 4.7.25
    • Component/s: CiviCRM API, Import
    • Labels:
      None
    • Versioning Impact:
      Patch (backwards-compatible bug fixes)
    • Documentation Required?:
      None
    • Funding Source:
      Contributed Code
    • Verified?:
      No
    • Overview:
      Hide
      Run the following command:
      php <civiroot>/bin/csv/import.php -e Setting --file /path/to/file/cli_allowed_countries.csv

      "cli_allowed_countries" should have the following contents:
      ```
      "countryLimit"
      "1039, 1076, 1085, 1109, 1228"
      ```
      Show
      Run the following command: php <civiroot>/bin/csv/import.php -e Setting --file /path/to/file/cli_allowed_countries.csv "cli_allowed_countries" should have the following contents: ``` "countryLimit" "1039, 1076, 1085, 1109, 1228" ```
    • How it works currently:
      Hide
      Get an error:
      Invalid file format for /path/to/file/cli_allowed_countries.csv. It must be a valid csv with separator ',' or ';'
      Show
      Get an error: Invalid file format for /path/to/file/cli_allowed_countries.csv. It must be a valid csv with separator ',' or ';'
    • How it should work:
      Hide
      You should receive:
      line 2: created Setting id: 1
      Show
      You should receive: line 2: created Setting id: 1
    • Acceptance Criteria:
      Hide
      After running the command in "Overview", you should have the following Allowed Countries in **Administer » Localization » Languages, Currency, Location** for "Allowed Countries": Canada, France, Greece, Japan, United States.

      Show
      After running the command in "Overview", you should have the following Allowed Countries in **Administer » Localization » Languages, Currency, Location** for "Allowed Countries": Canada, France, Greece, Japan, United States.

      Description

      The CLI API CSV import has a check to ensure that there are multiple columns in the CSV, to short-circuit the import of malformed CSVs.

      This is a good idea, but there are several use cases for importing single-column CSVs.

      • Importing a Setting entity
      • Importing a list of contact IDs to force recalculation of greetings
      • Importing a list of membership IDs to force end date recalculation

      Probably some others I've forgotten.

      I'm guessing that most folks who use will be able to recognize an error due to malformed CSVs when they see it, and I can't imagine the scenario where data would actually be changed by a malformed CSV, so I'm removing this check.

        Attachments

          Activity

            People

            • Assignee:
              palantejon Jon K Goldberg
              Reporter:
              palantejon Jon K Goldberg
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: