<?php

/**
 * First implement hook_install() using the name of the country as the base of
 * the function name.
 */
function uruguay_install() {
  db_query("INSERT INTO {uc_countries} (country_id, country_name, country_iso_code_2, country_iso_code_3, version) VALUES (858, 'Uruguay', 'UY', 'URY', 1)");

  // Make the entries in the zones table.
  $zones = array(
    array(858, 'AR', 'Artigas'),
    array(858, 'CA', 'Canelones'),
    array(858, 'CL', 'Cerro Largo'),
    array(858, 'CO', 'Colonia'),
    array(858, 'DU', 'Durazno'),
    array(858, 'FS', 'Flores'),
    array(858, 'FD', 'Florida'),
    array(858, 'LA', 'Lavalleja'),
    array(858, 'MA', 'Maldonado'),
    array(858, 'MO', 'Montevideo'),
    array(858, 'PA', 'Paysandu'),
    array(858, 'RN', 'Rio Negro'),
    array(858, 'RV', 'Rivera'),
    array(858, 'RO', 'Rocha'),
    array(858, 'SA', 'Salto'),
    array(858, 'SJ', 'San Jose'),
    array(858, 'SO', 'Soriano'),
    array(858, 'TA', 'Tacuarembo'),
    array(858, 'TT', 'Treinta y Tres'),
  );

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