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

/**
* First implement hook_install() using the name of the country as the base of
* the function name.
*/
function spain_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 ('724', 'Spain', 'ES', 'ESP', 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, 724, 'CA','A Coruña'),"
          ."(%d, 724, 'AL','Álava'),"
          ."(%d, 724, 'AB','Albacete'),"
          ."(%d, 724, 'AC','Alicante'),"
          ."(%d, 724, 'AM','Almería'),"
          ."(%d, 724, 'AS','Asturias'),"
          ."(%d, 724, 'AV','Ávila'),"
          ."(%d, 724, 'BJ','Badajoz'),"
          ."(%d, 724, 'IB','Baleares'),"
          ."(%d, 724, 'BA','Barcelona'),"
          ."(%d, 724, 'BU','Burgos'),"
          ."(%d, 724, 'CC','Cáceres'),"
          ."(%d, 724, 'CZ','Cádiz'),"
          ."(%d, 724, 'CT','Cantabria'),"
          ."(%d, 724, 'CL','Castellón'),"
          ."(%d, 724, 'CE','Ceuta'),"
          ."(%d, 724, 'CR','Ciudad Real'),"
          ."(%d, 724, 'CD','Córdoba'),"
          ."(%d, 724, 'CU','Cuenca'),"
          ."(%d, 724, 'GI','Girona'),"
          ."(%d, 724, 'GD','Granada'),"
          ."(%d, 724, 'GJ','Guadalajara'),"
          ."(%d, 724, 'GP','Guipúzcoa'),"
          ."(%d, 724, 'HL','Huelva'),"
          ."(%d, 724, 'HS','Huesca'),"
          ."(%d, 724, 'JN','Jaén'),"
          ."(%d, 724, 'RJ','La Rioja'),"
          ."(%d, 724, 'PM','Las Palmas'),"
          ."(%d, 724, 'LE','León'),"
          ."(%d, 724, 'LL','Lleida'),"
          ."(%d, 724, 'LG','Lugo'),"
          ."(%d, 724, 'MD','Madrid'),"
          ."(%d, 724, 'MA','Málaga'),"
          ."(%d, 724, 'ML','Melilla'),"
          ."(%d, 724, 'MU','Murcia'),"
          ."(%d, 724, 'NV','Navarra'),"
          ."(%d, 724, 'OU','Ourense'),"
          ."(%d, 724, 'PL','Palencia'),"
          ."(%d, 724, 'PO','Pontevedra'),"
          ."(%d, 724, 'SL','Salamanca'),"
          ."(%d, 724, 'SC','Santa Cruz de Tenerife'),"
          ."(%d, 724, 'SG','Segovia'),"
          ."(%d, 724, 'SV','Sevilla'),"
          ."(%d, 724, 'SO','Soria'),"
          ."(%d, 724, 'TA','Tarragona'),"
          ."(%d, 724, 'TE','Teruel'),"
          ."(%d, 724, 'TO','Toledo'),"
          ."(%d, 724, 'VC','Valencia'),"
          ."(%d, 724, 'VD','Valladolid'),"
          ."(%d, 724, 'VZ','Vizcaya'),"
          ."(%d, 724, 'ZM','Zamora'),"
          ."(%d, 724, 'ZR','Zaragoza')",
     uc_get_zone_ids(52));

  // Use uc_set_address_format() with the country ID as the first argument and
  // an address format string as the second.  Documentation on address formats
  // is available at:
  // http://www.ubercart.org/ubercart_users_guide/country_settings#address_format_docs
  uc_set_address_format(724,
          "!company\n!first_name !last_name\n!street1\n!street2"
          ."\n!postal_code !city\n!country_name_if");
}
