If the imported country code is not in the iso format then it is not imported. The problem occurrs because location_standardize_country_code($val) passes $val by reference and will set $val to 'xx' if $val is longer than two characters. With $val set to 'xx' the look-up in the iso3166 list obviously fails. Solution, take a local copy of $val to pass to location_standardize_country_code().

CommentFileSizeAuthor
#3 location_feeds-877650-3.patch639 bytesjohn.money

Comments

elliotttf’s picture

I would need to investigate this a bit more, but from my early testing I seem to recall that if a country was not in ISO format the location module would not store it to the database.

Have you tried your changes out and confirmed they work? If so can you roll a patch so I can test?

dippers’s picture

I'm sorry, I have no idea how to roll a patch. I don 't use Drupal under CVS.

The changes do work and allow you to import 'Mongolia' as well as 'MN'.

john.money’s picture

Status: Active » Needs review
StatusFileSize
new639 bytes

Confirmed... the else @ line 205 will never fire with $var = 'Country' because location_standardize_country_code(...) sets $val to 'xx' with pass by reference.

Attached is patch which implements a new var to pass to location_standardize_country_code(...). The expected behavior that if a valid country code is not passed in, then attempt to match the country name now works.

elliotttf’s picture

Status: Needs review » Fixed

Fixed. Thanks guys for finding and patching this. Will release a new version shortly.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.