<?php

function malawi_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 ('454', 'Malawi', 'MW', 'MWI', 1)");

  // Make the entries in the zones table.
  $zones = array(
    array(454, 'MW-BA', 'Balaka'),
    array(454, 'MW-BL', 'Blantyre'),
    array(454, 'MW-CK', 'Chikwawa'),
    array(454, 'MW-CR', 'Chiradzulu'),
    array(454, 'MW-CT', 'Chitipa'),
    array(454, 'MW-DE', 'Dedza'),
    array(454, 'MW-DO', 'Dowa'),
    array(454, 'MW-KR', 'Karonga'),
    array(454, 'MW-KS', 'Kasungu'),
    array(454, 'MW-LK', 'Likoma'),
    array(454, 'MW-LI', 'Lilongwe'),
    array(454, 'MW-MH', 'Machinga'),
    array(454, 'MW-MG', 'Mangochi'),
    array(454, 'MW-MC', 'Mchinji'),
    array(454, 'MW-MU', 'Mulanje'),
    array(454, 'MW-MW', 'Mwanza'),
    array(454, 'MW-MZ', 'Mzimba'),
    array(454, 'MW-NE', 'Neno'),
    array(454, 'MW-NB', 'Nkhata Bay'),
    array(454, 'MW-NK', 'Nkhotakota'),
    array(454, 'MW-NS', 'Nsanje'),
    array(454, 'MW-NU', 'Ntcheu'),
    array(454, 'MW-NI', 'Ntchisi'),
    array(454, 'MW-PH', 'Phalombe'),
    array(454, 'MW-RU', 'Rumphi'),
    array(454, 'MW-SA', 'Salima'),
    array(454, 'MW-TH', 'Thyolo'),
    array(454, 'MW-ZO', 'Zomba'),
  );

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

  // Use uc_set_address_format() with the country ID as the first argument and
  // an address format string as the second.  Documentation on address formats
  // is available at:
  // http://www.ubercart.org/ubercart_users_guide/country_settings#address_format_docs
  uc_set_address_format(454,
    "!company\r\n!first_name !last_name\r\n!street1\r\n!street2"
   ."\r\n!city, !zone_code !postal_code\r\n!country_name_if");
}
