<?php
// $Id: guinea_324_1.cif,v 1.1 2011-02-23 10:24:28 tr Exp $

function guinea_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' => 324,
      'country_name' => 'Guinea',
      'country_iso_code_2' => 'GN',
      'country_iso_code_3' => 'GIN',
      'version' => 1,
    ))
    ->execute();

  // Make the entries in the zones table.
  $zones = array(
    array(324, 'GN-BE', 'Beyla'),
    array(324, 'GN-BF', 'Boffa'),
    array(324, 'GN-BK', 'Boké'),
    array(324, 'GN-CO', 'Coyah'),
    array(324, 'GN-DB', 'Dabola'),
    array(324, 'GN-DL', 'Dalaba'),
    array(324, 'GN-DI', 'Dinguiraye'),
    array(324, 'GN-DU', 'Dubréka'),
    array(324, 'GN-FA', 'Faranah'),
    array(324, 'GN-FO', 'Forécariah'),
    array(324, 'GN-FR', 'Fria'),
    array(324, 'GN-GA', 'Gaoual'),
    array(324, 'GN-GU', 'Guékédou'),
    array(324, 'GN-KA', 'Kankan'),
    array(324, 'GN-KE', 'Kérouané'),
    array(324, 'GN-KD', 'Kindia'),
    array(324, 'GN-KS', 'Kissidougou'),
    array(324, 'GN-KB', 'Koubia'),
    array(324, 'GN-KN', 'Koundara'),
    array(324, 'GN-KO', 'Kouroussa'),
    array(324, 'GN-LA', 'Labé'),
    array(324, 'GN-LE', 'Lélouma'),
    array(324, 'GN-LO', 'Lola'),
    array(324, 'GN-MC', 'Macenta'),
    array(324, 'GN-ML', 'Mali'),
    array(324, 'GN-MM', 'Mamou'),
    array(324, 'GN-MD', 'Mandiana'),
    array(324, 'GN-NZ', 'Nzérékor'),
    array(324, 'GN-PI', 'Pita'),
    array(324, 'GN-SI', 'Siguiri'),
    array(324, 'GN-TE', 'Télimélé'),
    array(324, 'GN-TO', 'Tougué'),
    array(324, 'GN-YO', 'Yomou'),
  );

  $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(
    324,
    "!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"
  );
}
