<?php
// $Id: andorra_20_1.cif,v 1.2.4.5 2010-11-02 06:42:17 tr Exp $

/**
 * Brought to you by teh doomed :)
 *
 * First implement hook_install() using the name of the country as the base of
 * the function name.
 */
function andorra_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} VALUES (20, 'Andorra', 'AD', 'AND', 1)");

  // Make the entries in the zones table.  Use %d for the zone_id and the
  // function uc_get_zone_ids($num) as the second argument for db_query() where
  // $num is the number of zones in the INSERT query.
  // VALUES = %d for ID, Parent Country ID, Zone Abbreviation, Zone Name
  db_query("INSERT INTO {uc_zones} VALUES "
          ."(%d, 20, 'CA', 'Canillo'),"
          ."(%d, 20, 'EN', 'Encamp'),"
          ."(%d, 20, 'MA', 'La Massana'),"
          ."(%d, 20, 'OR', 'Ordino'),"
          ."(%d, 20, 'JL', 'Sant Julià de Lòria'),"
          ."(%d, 20, 'AN', 'Andorra La Vella'),"
          ."(%d, 20, 'EE', 'Escaldes Engordany')",
           uc_get_zone_ids(7));

  // Use uc_set_address_format() with the country ID as the first argument and
  // an address format string as the second.
  uc_set_address_format(20,
               "!company\r\n!first_name !last_name\r\n!street1\r\n!street2"
              ."\r\n!city, !postal_code\r\n!country_name_if");
}
