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

Geocoding using Ziptable fails/throws errors

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Critical
    • Resolution: Fixed/Completed
    • Affects Version/s: 1.5
    • Fix Version/s: 1.5
    • Labels:
      None

      Description

      Let me set the stage:
      Drupal 4.7.3, CiviCRM 1.5 rev 6927, PHP 5.0.4
      Presumably other versions are affected too.

      civicrm.settings.php, 410;
      define('CIVICRM_GEOCODE_METHOD', 'CRM_Utils_Geocode_ZipTable' );

      Attempting to geocode using a zipcode I get the following error (and the changes are not saved);

      • warning: Missing argument 2 for CRM_Core_DAO::executeQuery() in /mnt/server/drupal.bachusii/htdocs/modules/civicrm/CRM/Core/DAO.php on line 592.
      • warning: Invalid argument supplied for foreach() in /mnt/server/drupal.bachusii/htdocs/modules/civicrm/CRM/Core/DAO.php on line 625.

      onherstelbare fout
      Sorry, er is een onherstelbare fout opgetreden.

      Database foutcode : Unknown column 'MYZIPCODE' in 'where clause', 1054
      Terug naar CiviCRM menu.

      error
      Array
      (
      [callback] => Array
      (
      [0] => CRM_Core_Error
      [1] => handle
      )
      [code] => -19
      [message] => DB Error: no such field
      [mode] => 16
      [debug_info] => SELECT latitude, longitude FROM zipcodes WHERE zip = MYZIPCODE [nativecode=1054 ** Unknown column 'MYZIPCODE' in 'where clause']
      [type] => DB_Error
      [user_info] => SELECT latitude, longitude FROM zipcodes WHERE zip = MYZIPCODE [nativecode=1054 ** Unknown column 'MYZIPCODE' in 'where clause']
      [to_string] => [db_error: message="DB Error: no such field" code=-19 mode=callback callback=CRM_Core_Error::handle prefix="" info="SELECT latitude, longitude FROM zipcodes WHERE zip = MYZIPCODE [nativecode=1054 ** Unknown column 'MYZIPCODE' in 'where clause']"]
      )

      civicrm/CRM/Utils/Geocode/ZipTable.php, 74;
      $query = 'SELECT latitude, longitude FROM zipcodes WHERE zip = ' .
      CRM_Utils_Type::escape( $postalCode, 'String' );

      Changing the line above to read;
      $query = 'SELECT latitude, longitude FROM zipcodes WHERE zip = \'' .
      CRM_Utils_Type::escape( $postalCode, 'String' ) . '\'';

      lessens the error to (The changes are saved now, and geocoding succeeds.):

      • warning: Missing argument 2 for CRM_Core_DAO::executeQuery() in /mnt/server/drupal.bachusii/htdocs/modules/civicrm/CRM/Core/DAO.php on line 592.
      • warning: Invalid argument supplied for foreach() in /mnt/server/drupal.bachusii/htdocs/modules/civicrm/CRM/Core/DAO.php on line 625.

      Line 76 in ZipTable.php calls that function
      $dao =& CRM_Core_DAO::executeQuery( $query );
      Obviously without the expected second parameter.

        Attachments

          Activity

            People

            • Assignee:
              lobo Donald A. Lobo
              Reporter:
              bagger BachusII
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: