<?php
// $Id: yemen_887_1.cif,v 1.1 2011-02-23 10:25:48 tr Exp $

function yemen_install() {
  // Make the entry in the country table.
  // VALUES = Country ID, Country Name, 2-digit Code, 3-digit Code, File Version
  db_insert('uc_countries')
    ->fields(array(
      'country_id' => 887,
      'country_name' => 'Yemen',
      'country_iso_code_2' => 'YE',
      'country_iso_code_3' => 'YEM',
      'version' => 1,
    ))
    ->execute();

  // Make the entries in the zones table.
  $zones = array(
    array(887, 'YE-SA', "Şan‘ā' [city]"),
    array(887, 'YE-AB', 'Abyān'),
    array(887, 'YE-AD', "'Adan"),
    array(887, 'YE-DA', "Aḑ Ḑāli'"),
    array(887, 'YE-BA', "Al Bayḑā'"),
    array(887, 'YE-HU', 'Al Ḩudaydah'),
    array(887, 'YE-JA', 'Al Jawf'),
    array(887, 'YE-MR', 'Al Mahrah'),
    array(887, 'YE-MW', 'Al Maḩwīt'),
    array(887, 'YE-AM', "'Amrān"),
    array(887, 'YE-DH', 'Dhamār'),
    array(887, 'YE-HD', 'Ḩaḑramawt'),
    array(887, 'YE-HJ', 'Ḩajjah'),
    array(887, 'YE-IB', 'Ibb'),
    array(887, 'YE-LA', 'Laḩij'),
    array(887, 'YE-MA', "Ma'rib"),
    array(887, 'YE-RA', 'Raymah'),
    array(887, 'YE-SD', 'Şā‘dah'),
    array(887, 'YE-SN', "Şan‘ā'"),
    array(887, 'YE-SH', 'Shabwah'),
    array(887, 'YE-TA', 'Tā‘izz'),
  );

  $query = db_insert('uc_zones')->fields(array('zone_country_id', 'zone_code', 'zone_name'));
  foreach ($zones as $zone) {
    $query->values($zone);
  }
  $query->execute();

  // Set address format
  uc_set_address_format(
    887,
    "!company\r\n".
    "!first_name !last_name\r\n".
    "!street1\r\n".
    "!street2\r\n".
    "!city, !zone_name  !postal_code\r\n".
    "!country_name_if"
  );
}
