Index: civicrm/trunk/sites/all/modules/queue2civicrm/queue2civicrm.module |
— | — | @@ -266,7 +266,11 @@ |
267 | 267 | * When passing CiviCRM a state abbreviation, odd things can happen - like getting the right abbreviation, but the wrong state |
268 | 268 | * So we'll pull back the correct state/province name based off of a user's country/state abbreviation |
269 | 269 | */ |
270 | | - $query = "SELECT s.name AS state_name FROM civicrm_country c, civicrm_state_province s WHERE s.country_id=c.id AND c.name='" . addslashes( $msg['country'] ) . "' AND s.abbreviation='" . addslashes( $msg['state_province'] ) . "'"; |
| 270 | + if ( strlen( $msg['country'] ) == 2 ) { |
| 271 | + $query = "SELECT s.name AS state_name FROM civicrm_country c, civicrm_state_province s WHERE s.country_id=c.id AND c.iso_code='" . addslashes( $msg['country'] ) . "' AND s.abbreviation='" . addslashes( $msg['state_province'] ) . "'"; |
| 272 | + } else { |
| 273 | + $query = "SELECT s.name AS state_name FROM civicrm_country c, civicrm_state_province s WHERE s.country_id=c.id AND c.name='" . addslashes( $msg['country'] ) . "' AND s.abbreviation='" . addslashes( $msg['state_province'] ) . "'"; |
| 274 | + } |
271 | 275 | $dao = CRM_Core_DAO::executeQuery( $query ); |
272 | 276 | while ( $dao->fetch() ) { |
273 | 277 | $state = $dao->state_name; |