<?php
// $Id: taiwan_158_1.cif,v 1.2.2.7 2010/04/14 05:18:19 tr Exp $

/**
* First implement hook_install() using the name of the country as the base of
* the function name.
*/
function taiwan_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 (158, 'Taiwan', 'TW', 'TWN', 1)");

  // Make the entries in the zones table.
  $zones = array(
    array(158, '01', 'ChangHua County'),
    array(158, '02', 'ChiaYi City'),
    array(158, '03', 'ChiaYi County'),
    array(158, '04', 'HsinChu City'),
    array(158, '05', 'HsinChu County'),
    array(158, '06', 'HuaLien County'),
    array(158, '07', 'KaoHsiung City'),
    array(158, '08', 'KaoHsiung County'),
    array(158, '09', 'KeeLung City '),
    array(158, '10', 'KinMen County'),
    array(158, '11', 'LienChiang County'),
    array(158, '12', 'MiaoLi County'),
    array(158, '13', 'NanHai'),
    array(158, '14', 'NanTou County'),
    array(158, '15', 'PengHu County'),
    array(158, '16', 'PingTung County'),
    array(158, '17', 'TaiChung City'),
    array(158, '18', 'TaiChung County'),
    array(158, '19', 'TaiNan City'),
    array(158, '20', 'TaiNan County'),
    array(158, '21', 'Taipei City'),
    array(158, '22', 'Taipei County'),
    array(158, '23', 'TaiTung County'),
    array(158, '24', 'TaoYuan County'),
    array(158, '25', 'Yilan County'),
    array(158, '26', 'YunLin County'),
    array(158, '27', '南投縣'),
    array(158, '28', '南海諸島'),
    array(158, '29', '嘉義市'),
    array(158, '30', '嘉義縣'),
    array(158, '31', '基隆市'),
    array(158, '32', '宜蘭縣'),
    array(158, '33', '屏東縣'),
    array(158, '34', '彰化縣'),
    array(158, '35', '新竹市'),
    array(158, '36', '新竹縣'),
    array(158, '37', '桃園縣'),
    array(158, '38', '澎湖縣'),
    array(158, '39', '臺中市'),
    array(158, '40', '臺中縣'),
    array(158, '41', '臺北市'),
    array(158, '42', '臺北縣'),
    array(158, '43', '臺南市'),
    array(158, '44', '臺南縣'),
    array(158, '45', '臺東縣'),
    array(158, '46', '花蓮縣'),
    array(158, '47', '苗栗縣'),
    array(158, '48', '連江縣'),
    array(158, '49', '金門縣'),
    array(158, '50', '雲林縣'),
    array(158, '51', '高雄市'),
    array(158, '52', '高雄縣'),
  );

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

  uc_set_address_format(158,
    "!company\r\n!last_name !first_name\r\n!street1\r\n!street2\r\n"
    ."!city, !zone_name !postal_code\r\n!country_name_if");
}
