ireland_372_2.cif 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <?php
  2. // Note: Ireland does not currently have postal codes but it has been announced
  3. // that they will be implemented - so I left the postal code in the address
  4. // definition.
  5. // http://www.dcmnr.gov.ie/Press+Releases/Dempsey+announces+programme+to+introduce+postcodes+in+Ireland+by+1st+January+2008.htm
  6. //
  7. /**
  8. * Implements hook_install() using the name of the country as the base of
  9. * the function name.
  10. */
  11. function ireland_install() {
  12. // Make the entry in the country table.
  13. // VALUES = Country ID, Country Name, 2-digit Code, 3-digit Code, File Version
  14. db_insert('uc_countries')
  15. ->fields(array(
  16. 'country_id' => 372,
  17. 'country_name' => 'Ireland',
  18. 'country_iso_code_2' => 'IE',
  19. 'country_iso_code_3' => 'IRL',
  20. 'version' => 2,
  21. ))
  22. ->execute();
  23. // Make the entries in the zones table.
  24. $zones = array(
  25. array(372, 'CARLOW', 'Co. Carlow'),
  26. array(372, 'CAVAN', 'Co. Cavan'),
  27. array(372, 'CLARE', 'Co. Clare'),
  28. array(372, 'CORK', 'Co. Cork'),
  29. array(372, 'DONEGAL', 'Co. Donegal'),
  30. array(372, 'DUBLIN', 'Co. Dublin'),
  31. array(372, 'GALWAY', 'Co. Galway'),
  32. array(372, 'KERRY', 'Co. Kerry'),
  33. array(372, 'KILDARE', 'Co. Kildare'),
  34. array(372, 'KILKENNY', 'Co. Kilkenny'),
  35. array(372, 'LAOIS', 'Co. Laois'),
  36. array(372, 'LEITRIM', 'Co. Leitrim'),
  37. array(372, 'LIMERICK', 'Co. Limerick'),
  38. array(372, 'LONGFORD', 'Co. Longford'),
  39. array(372, 'LOUTH', 'Co. Louth'),
  40. array(372, 'MAYO', 'Co. Mayo'),
  41. array(372, 'MEATH', 'Co. Meath'),
  42. array(372, 'MONAGHAN', 'Co. Monaghan'),
  43. array(372, 'OFFALY', 'Co. Offaly'),
  44. array(372, 'ROSCOMMON', 'Co. Roscommon'),
  45. array(372, 'SLIGO', 'Co. Sligo'),
  46. array(372, 'TIPPERARY', 'Co. Tipperary'),
  47. array(372, 'WATERFORD', 'Co. Waterford'),
  48. array(372, 'WESTMEATH', 'Co. Westmeath'),
  49. array(372, 'WEXFORD', 'Co. Wexford'),
  50. array(372, 'WICKLOW', 'Co. Wicklow'),
  51. );
  52. $query = db_insert('uc_zones')->fields(array('zone_country_id', 'zone_code', 'zone_name'));
  53. foreach ($zones as $zone) {
  54. $query->values($zone);
  55. }
  56. $query->execute();
  57. // Set address format
  58. uc_set_address_format(
  59. 372,
  60. "!company\r\n" .
  61. "!first_name !last_name\r\n" .
  62. "!street1\r\n" .
  63. "!street2\r\n" .
  64. "!city, !zone_name !postal_code\r\n" .
  65. "!country_name_if"
  66. );
  67. }
  68. /**
  69. * Implements hook_update() with $version being the only argument.
  70. * Add a new case for each version update, and be sure to always include the
  71. * latest changes in the install function.
  72. */
  73. function ireland_update($version) {
  74. switch ($version) {
  75. case 2:
  76. uc_set_address_format(
  77. 372,
  78. "!company\r\n" .
  79. "!first_name !last_name\r\n" .
  80. "!street1\r\n" .
  81. "!street2\r\n" .
  82. "!city, !zone_name !postal_code\r\n" .
  83. "!country_name_if"
  84. );
  85. break;
  86. }
  87. }