<?php
// $Id: brazil_76_1.cif,v 1.4.2.3 2010/02/21 03:43:00 tr Exp $

function brazil_install() {
  // 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 (076, 'Brazil', 'BR', 'BRA', 1)");

  // Make the entries in the zones table.
  $zones = array(
    array(76, 'AC', 'Acre'),
    array(76, 'AL', 'Alagoas'),
    array(76, 'AP', 'Amapá'),
    array(76, 'AM', 'Amazonas'),
    array(76, 'BA', 'Bahia'),
    array(76, 'CE', 'Ceará'),
    array(76, 'DF', 'Distrito Federal'),
    array(76, 'ES', 'Espírito Santo'),
    array(76, 'GO', 'Goiás'),
    array(76, 'MA', 'Maranhão'),
    array(76, 'MT', 'Mato Grosso'),
    array(76, 'MS', 'Mato Grosso do Sul'),
    array(76, 'MG', 'Minas Gerais'),
    array(76, 'PA', 'Pará'),
    array(76, 'PB', 'Paraíba'),
    array(76, 'PR', 'Paraná'),
    array(76, 'PE', 'Pernambuco'),
    array(76, 'PI', 'Piauí'),
    array(76, 'RJ', 'Rio de Janeiro'),
    array(76, 'RN', 'Rio Grande do Norte'),
    array(76, 'RS', 'Rio Grande do Sul'),
    array(76, 'RO', 'Rondônia'),
    array(76, 'RR', 'Roraima'),
    array(76, 'SC', 'Santa Catarina'),
    array(76, 'SP', 'São Paulo'),
    array(76, 'SE', 'Sergipe'),
    array(76, 'TO', 'Tocantins'),
  );

  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(76, "!company\r\n!first_name !last_name\r\n!street1\r\n!street2"
                           ."\r\n!city, !postal_code\r\n!zone_name, !country_name");
}
