<?php
// $Id: india_356_1.cif,v 1.2.2.7 2010/04/14 05:18:19 tr Exp $

/**
 * First implement hook_install() using the name of the country as the base of
 * the function name.
 */
function india_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} (country_id, country_name, country_iso_code_2, country_iso_code_3, version) VALUES ('356', 'India', 'IN', 'IND', 1)");

  // Make the entries in the zones table.
  $zones = array(
    array(356, 'AP', 'Andhra Pradesh'),
    array(356, 'AR', 'Arunachal Pradesh'),
    array(356, 'AS', 'Assam'),
    array(356, 'BR', 'Bihar'),
    array(356, 'CG', 'Chattisgarh'),
    array(356, 'GA', 'Goa'),
    array(356, 'GJ', 'Gujarat'),
    array(356, 'HR', 'Haryana'),
    array(356, 'HP', 'Himachal Pradesh'),
    array(356, 'JK', 'Jammu & Kashmir'),
    array(356, 'JH', 'Jharkhand'),
    array(356, 'KA', 'Karnataka'),
    array(356, 'KL', 'Kerala'),
    array(356, 'MP', 'Madhya Pradesh'),
    array(356, 'MH', 'Maharashtra'),
    array(356, 'MN', 'Manipur'),
    array(356, 'ML', 'Meghalaya'),
    array(356, 'MZ', 'Mizoram'),
    array(356, 'NL', 'Nagaland'),
    array(356, 'OR', 'Orissa'),
    array(356, 'PB', 'Punjab'),
    array(356, 'RJ', 'Rajasthan'),
    array(356, 'SK', 'Sikkim'),
    array(356, 'TN', 'Tamil Nadu'),
    array(356, 'TR', 'Tripura'),
    array(356, 'UA', 'Uttarakhand'),
    array(356, 'UP', 'Uttar Pradesh'),
    array(356, 'WB', 'West Bengal'),
    array(356, 'AN', 'Andaman & Nicobar'),
    array(356, 'CH', 'Chandigarh'),
    array(356, 'DN', 'Dadra and Nagar Haveli'),
    array(356, 'DD', 'Daman & Diu'),
    array(356, 'DL', 'Delhi'),
  );

  foreach ($zones as $zone) {
    db_query("INSERT INTO {uc_zones} (zone_country_id, zone_code, zone_name) VALUES (%d, '%s', '%s')", $zone);
  }

  // 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(356,
    "!company\r\n!first_name !last_name\r\n!street1\r\n!street2"
   ."\r\n!city - !postal_code\r\n!zone_code\r\n!country_name_if");
}
