CRM-18100 It is no longer possible to have the default country not set

    Details

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

      Description

      In prior versions it was possible to set default country to "none". This is no longer possible and seems to be related to https://issues.civicrm.org/jira/browse/CRM-17977.

      Tested on Drupal demo site.

        Attachments

          Activity

          [CRM-18100] It is no longer possible to have the default country not set
          Joakim Särehag added a comment -

          Ok, I made an attempt to solve this, and thought i should leave my reflections here.

          I believe this was introduced in CRM-16373, in file CRM/Admin/Form/Setting/Localization.php, commit 8a61528e89f0a2c4ac1707c9b5a9fa53fb5fa10b, when this row was removed:

          $this->addElement('select', 'defaultContactCountry', ts('Default Country'), array('' => ts('- select -')) + $country);

          This was introduced with release 4.7. Current joomla demo environment does not have the issue.

          This row, row 122 in Setting.php is run to add the element instead.

          $this->addElement('select', $setting, ts($props['title']), $options['values'], CRM_Utils_array::value('html_attributes', $props));

          I tried simply adding the option here, which made the alternative to clear the box available, but made it behave badly in terms of saving and so on.

          I also tried modifying the Localization.setting.php, but could not find any dropdown this had been made for before.

          Romain Thouvenin added a comment -

          We also got this problem when migrating to 4.7.

          It is fairly annoying for us, because on some forms we set a default country depending on language, using an extension. But we do so only if the country is not already set, and therefore this does not work anymore because in 4.7 there is always a default country.

          I actually see 2 problems:

          • the admin form does not allow unsetting a default country.
          • even if unset using the API explorer, a hard-coded default country (US) coming from the setting metadata is used.

            People

            • Assignee:
              Unassigned
              Reporter:
              Howard Shand

              Dates

              • Created:
                Updated: