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

DB Error saving an address when Google geocoding is on and locale uses different decimal point

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.2.7
    • Fix Version/s: 4.3.0
    • Component/s: Internationalisation
    • Labels:
      None

      Description

      In my civicrm.settings.php I would like to set the locale "de_AT" which is necessary for correctly working date formats (month names!):

      setlocale(LC_ALL, 'de_AT.utf8');

      But: This leads to the following error when trying to save an address:

      Sorry but we are not able to provide this at the moment.
      DB Error: syntax error

      Searching for the reason, I found out that the error is due to the geocoding latitude and longitude values containing a comma - which leads to a broken SQL syntax. The Germen speaking countries (like some other European countries) do not use a dot as decimal point, but rather a comma.

      I think that this problem should be solved by always storing the latitude and longitude values in the English format, because if we would store the localized value format, the values would be invalid as soon as somebody changes the locale.

      The first one of the attached patches stores the langitude and latitude values without converting them to the locale format. This patch is only for the Google geocoding - I haven't tested Yahoo geocoding and do not know if the problem exists there, too.

      The second patch fixes the problem for the map view. In this case the latitude and longitude values of the map viewport are calculated, so we cannot use strings - but we can replace the localized decimal point by a dot after the calculation.

        Attachments

          Activity

            People

            • Assignee:
              lobo Donald A. Lobo
              Reporter:
              chrdr Christoph Drexler
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 15 minutes
                15m
                Remaining:
                Remaining Estimate - 15 minutes
                15m
                Logged:
                Time Spent - Not Specified
                Not Specified