My first patch here. Tried to add a new province in Thailand into Ubercart.

Comments

abx’s picture

StatusFileSize
new473 bytes

Here is the patch

abx’s picture

Version: 6.x-2.x-dev » 7.x-3.x-dev
StatusFileSize
new537 bytes

d7 patch

tr’s picture

Status: Needs review » Needs work

Thanks for doing this. Is this a recent change to ISO 3166-2? The .cif files should have the same provinces as the ISO standard. The Thailand .cif file is very old and should be reviewed to make sure it agrees with the standard.

The .cif files are used for two purposes, 1) to install the country information, and 2) to update the country information for existing Ubercart sites. Your patch does 1) correctly for this new province, but doesn't do 2).

What needs to be done is to create a new version, thailand_764_3.cif with an update function that will add the new province for people who had the old thailand_764_2.cif installed. You can use bahrain_48_3.cif as an example of how to write an update function - that .cif has an update function that add new zones, renames zones, deletes zones, etc.

longwave’s picture

According to http://en.wikipedia.org/wiki/Bueng_Kan_Province this province was created in 2011, and it does not yet have an official ISO 3166-2 code - but the Thailand CIF does not use the correct codes anyway.

I also think "Bueng Kan" is the romanized name we should use if/when #1069950: Romanization of country zones is fixed.

abx’s picture

Version: 7.x-3.x-dev » 6.x-2.x-dev
Status: Needs work » Needs review
StatusFileSize
new10.58 KB

I do not know how to change the filename from thailand_764_2.cif - > thailand_764_3.cif. I also don't know how to test the script I modified. There is no update available there when I ran site.com/update.php.

What I did is to change everything to match this page -> http://en.wikipedia.org/wiki/ISO_3166-2:TH. Also, I'm pretty sure Bueng Kan has the code TH-38 since their postal code already available in Thailand. (Postal code based on ISO code)

I also wondering that with Romanization thing, I, then, need to translate those into Thai in the translate Interfae? I mean my store is mainly for Thai who may only be able to read only Thai. With English, they may not know what it is.

Please let me know if I need to change anything.

abx’s picture

Version: 6.x-2.x-dev » 7.x-3.x-dev
StatusFileSize
new23.11 KB
longwave’s picture

Status: Needs review » Fixed

Thanks for the patches. Committed to both branches, with coding standards fixes in 6.x and a simpler update query in 7.x.

Country files are updated from the "Countries and addresses" admin page; click "update" next to the country name. However, this does mean that Thai zones will be romanized if you update. This is the correct thing to do; all strings in Drupal should be coded in their English form, then translated as necessary.

Status: Fixed » Closed (fixed)

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