jamaica_388_2.cif 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?php
  2. /**
  3. * Implements hook_install() using the name of the country as the base of
  4. * the function name.
  5. */
  6. function jamaica_install() {
  7. // Make the entry in the country table.
  8. // VALUES = Country ID, Country Name, 2-digit Code, 3-digit Code, File Version
  9. db_insert('uc_countries')
  10. ->fields(array(
  11. 'country_id' => 388,
  12. 'country_name' => 'Jamaica',
  13. 'country_iso_code_2' => 'JM',
  14. 'country_iso_code_3' => 'JAM',
  15. 'version' => 2,
  16. ))
  17. ->execute();
  18. // Make the entries in the zones table.
  19. $zones = array(
  20. array(388, 'JM-13', 'Clarendon'),
  21. array(388, 'JM-09', 'Hanover'),
  22. array(388, 'JM-01', 'Kingston'),
  23. array(388, 'JM-12', 'Manchester'),
  24. array(388, 'JM-04', 'Portland'),
  25. array(388, 'JM-02', 'Saint Andrew'),
  26. array(388, 'JM-06', 'Saint Ann'),
  27. array(388, 'JM-14', 'Saint Catherine'),
  28. array(388, 'JM-11', 'Saint Elizabeth'),
  29. array(388, 'JM-08', 'Saint James'),
  30. array(388, 'JM-05', 'Saint Mary'),
  31. array(388, 'JM-03', 'Saint Thomas'),
  32. array(388, 'JM-07', 'Trelawny'),
  33. array(388, 'JM-10', 'Westmoreland'),
  34. );
  35. $query = db_insert('uc_zones')->fields(array('zone_country_id', 'zone_code', 'zone_name'));
  36. foreach ($zones as $zone) {
  37. $query->values($zone);
  38. }
  39. $query->execute();
  40. // Set address format
  41. uc_set_address_format(
  42. 388,
  43. "!company\r\n" .
  44. "!first_name !last_name\r\n" .
  45. "!street1\r\n" .
  46. "!street2\r\n" .
  47. "!city - !postal_code\r\n" .
  48. "!country_name_if"
  49. );
  50. }
  51. /**
  52. * Implements hook_update() with $version being the only argument.
  53. * Add a new case for each version update, and be sure to always include the
  54. * latest changes in the install function.
  55. */
  56. function jamaica_update($version) {
  57. switch ($version) {
  58. case 2:
  59. $zones = array(
  60. array(388, 'JM-13', 'Clarendon'),
  61. array(388, 'JM-09', 'Hanover'),
  62. array(388, 'JM-01', 'Kingston'),
  63. array(388, 'JM-12', 'Manchester'),
  64. array(388, 'JM-04', 'Portland'),
  65. array(388, 'JM-02', 'Saint Andrew'),
  66. array(388, 'JM-06', 'Saint Ann'),
  67. array(388, 'JM-14', 'Saint Catherine'),
  68. array(388, 'JM-11', 'Saint Elizabeth'),
  69. array(388, 'JM-08', 'Saint James'),
  70. array(388, 'JM-05', 'Saint Mary'),
  71. array(388, 'JM-03', 'Saint Thomas'),
  72. array(388, 'JM-07', 'Trelawny'),
  73. array(388, 'JM-10', 'Westmoreland'),
  74. );
  75. $query = db_insert('uc_zones')->fields(array('zone_country_id', 'zone_code', 'zone_name'));
  76. foreach ($zones as $zone) {
  77. $query->values($zone);
  78. }
  79. $query->execute();
  80. break;
  81. }
  82. }