Skip to content

Commit

Permalink
Issue #2629392 by TR, longwave: Update india_356_2.cif
Browse files Browse the repository at this point in the history
  • Loading branch information
rohaly committed Dec 18, 2015
1 parent 5872512 commit 690fe4a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
function india_install() {
// Make the entry in the country table.
// VALUES = Country ID, Country Name, 2-digit Code, 3-digit Code, File Version
db_query("INSERT INTO {uc_countries} (country_id, country_name, country_iso_code_2, country_iso_code_3, version) VALUES ('356', 'India', 'IN', 'IND', 2)");
db_query("INSERT INTO {uc_countries} (country_id, country_name, country_iso_code_2, country_iso_code_3, version) VALUES ('356', 'India', 'IN', 'IND', 3)");

// Make the entries in the zones table.
$zones = array(
Expand All @@ -30,13 +30,14 @@ function india_install() {
array(356, 'ML', 'Meghalaya'),
array(356, 'MZ', 'Mizoram'),
array(356, 'NL', 'Nagaland'),
array(356, 'OR', 'Orissa'),
array(356, 'OR', 'Odisha'),
array(356, 'PB', 'Punjab'),
array(356, 'RJ', 'Rajasthan'),
array(356, 'SK', 'Sikkim'),
array(356, 'TG', 'Telangana'),
array(356, 'TN', 'Tamil Nadu'),
array(356, 'TR', 'Tripura'),
array(356, 'UL', 'Uttarakhand'),
array(356, 'UT', 'Uttarakhand'),
array(356, 'UP', 'Uttar Pradesh'),
array(356, 'WB', 'West Bengal'),
array(356, 'AN', 'Andaman and Nicobar'),
Expand Down Expand Up @@ -92,6 +93,30 @@ function india_update($version) {
db_query("UPDATE {uc_zones} SET zone_name = '%s', zone_code = '%s' WHERE zone_country_id = %d AND zone_code = '%s'", $zone[3], $zone[2], $zone[0], $zone[1]);
}

break;

case 3:
// Add some missing zones
$zones = array(
array(356, 'TG', 'Telangana'),
);

foreach ($zones as $zone) {
db_query("INSERT INTO {uc_zones} (zone_country_id, zone_code, zone_name) VALUES (%d, '%s', '%s')", $zone);
}

$zones = array(
// Correct zone name
array(356, 'OR', 'OR', 'Odisha'),

// Correct ISO-3166-2 code
array(356, 'UL', 'UT', 'Uttarakhand'),
);

foreach ($zones as $zone) {
db_query("UPDATE {uc_zones} SET zone_name = '%s', zone_code = '%s' WHERE zone_country_id = %d AND zone_code = '%s'", $zone[3], $zone[2], $zone[0], $zone[1]);
}

break;
}
}
2 changes: 1 addition & 1 deletion uc_store/uc_store.admin.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1146,7 +1146,7 @@ function uc_country_update($country_id, $version) {
if ($func_base !== FALSE) {
$func = $func_base .'_update';
if (function_exists($func)) {
for ($i = $country->version; $i <= $version; $i++) {
for ($i = $country->version + 1; $i <= $version; $i++) {
$func($i);
}
}
Expand Down

0 comments on commit 690fe4a

Please sign in to comment.