<?php
// $Id: ireland_372_2.cif,v 1.1.2.7 2009/07/21 14:51:20 islandusurper Exp $

// Note: Ireland does not currently have postal codes but it has been announced
// that they will be implemented - so I left the postal code in the address definition.
// http://www.dcmnr.gov.ie/Press+Releases/Dempsey+announces+programme+to+introduce+postcodes+in+Ireland+by+1st+January+2008.htm
//

function ireland_install() {
  // VALUES = Country ID, Country Name, 2-digit Code, 3-digit Code, File Version
  db_query("INSERT INTO {uc_countries} VALUES ('372', 'Ireland', 'IE', 'IRL', 2)");

  // Make the entries in the zones table.
  $zones = array(
    array(372, 'CARLOW', 'Co. Carlow'),
    array(372, 'CAVAN', 'Co. Cavan'),
    array(372, 'CLARE', 'Co. Clare'),
    array(372, 'CORK', 'Co. Cork'),
    array(372, 'DONEGAL', 'Co. Donegal'),
    array(372, 'DUBLIN', 'Co. Dublin'),
    array(372, 'GALWAY', 'Co. Galway'),
    array(372, 'KERRY', 'Co. Kerry'),
    array(372, 'KILDARE', 'Co. Kildare'),
    array(372, 'KILKENNY', 'Co. Kilkenny'),
    array(372, 'LAOIS', 'Co. Laois'),
    array(372, 'LEITRIM', 'Co. Leitrim'),
    array(372, 'LIMERICK', 'Co. Limerick'),
    array(372, 'LONGFORD', 'Co. Longford'),
    array(372, 'LOUTH', 'Co. Louth'),
    array(372, 'MAYO', 'Co. Mayo'),
    array(372, 'MEATH', 'Co. Meath'),
    array(372, 'MONAGHAN', 'Co. Monaghan'),
    array(372, 'OFFALY', 'Co. Offaly'),
    array(372, 'ROSCOMMON', 'Co. Roscommon'),
    array(372, 'SLIGO', 'Co. Sligo'),
    array(372, 'TIPPERARY', 'Co. Tipperary'),
    array(372, 'WATERFORD', 'Co. Waterford'),
    array(372, 'WESTMEATH', 'Co. Westmeath'),
    array(372, 'WEXFORD', 'Co. Wexford'),
    array(372, 'WICKLOW', 'Co. Wicklow'),
  );

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

function ireland_update($version) {
  switch ($version) {
    case 2:
      uc_set_address_format(372,
        "!company\r\n!first_name !last_name\r\n!street1\r\n!street2"
       ."\r\n!city, !zone_name !postal_code\r\n!country_name_if");
      break;
  }
}

function ireland_uninstall() {
}
