united_states_840_1.cif 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <?php
  2. /**
  3. * Implements hook_install() using the name of the country as the base of
  4. * the function name.
  5. */
  6. function united_states_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' => 840,
  12. 'country_name' => 'United States',
  13. 'country_iso_code_2' => 'US',
  14. 'country_iso_code_3' => 'USA',
  15. 'version' => 1,
  16. ))
  17. ->execute();
  18. // Make the entries in the zones table.
  19. $zones = array(
  20. array(840, 'AL', 'Alabama'),
  21. array(840, 'AK', 'Alaska'),
  22. array(840, 'AS', 'American Samoa'),
  23. array(840, 'AZ', 'Arizona'),
  24. array(840, 'AR', 'Arkansas'),
  25. array(840, 'AF', 'Armed Forces Africa'),
  26. array(840, 'AA', 'Armed Forces Americas'),
  27. array(840, 'AC', 'Armed Forces Canada'),
  28. array(840, 'AE', 'Armed Forces Europe'),
  29. array(840, 'AM', 'Armed Forces Middle East'),
  30. array(840, 'AP', 'Armed Forces Pacific'),
  31. array(840, 'CA', 'California'),
  32. array(840, 'CO', 'Colorado'),
  33. array(840, 'CT', 'Connecticut'),
  34. array(840, 'DE', 'Delaware'),
  35. array(840, 'DC', 'District of Columbia'),
  36. array(840, 'FM', 'Federated States Of Micronesia'),
  37. array(840, 'FL', 'Florida'),
  38. array(840, 'GA', 'Georgia'),
  39. array(840, 'GU', 'Guam'),
  40. array(840, 'HI', 'Hawaii'),
  41. array(840, 'ID', 'Idaho'),
  42. array(840, 'IL', 'Illinois'),
  43. array(840, 'IN', 'Indiana'),
  44. array(840, 'IA', 'Iowa'),
  45. array(840, 'KS', 'Kansas'),
  46. array(840, 'KY', 'Kentucky'),
  47. array(840, 'LA', 'Louisiana'),
  48. array(840, 'ME', 'Maine'),
  49. array(840, 'MH', 'Marshall Islands'),
  50. array(840, 'MD', 'Maryland'),
  51. array(840, 'MA', 'Massachusetts'),
  52. array(840, 'MI', 'Michigan'),
  53. array(840, 'MN', 'Minnesota'),
  54. array(840, 'MS', 'Mississippi'),
  55. array(840, 'MO', 'Missouri'),
  56. array(840, 'MT', 'Montana'),
  57. array(840, 'NE', 'Nebraska'),
  58. array(840, 'NV', 'Nevada'),
  59. array(840, 'NH', 'New Hampshire'),
  60. array(840, 'NJ', 'New Jersey'),
  61. array(840, 'NM', 'New Mexico'),
  62. array(840, 'NY', 'New York'),
  63. array(840, 'NC', 'North Carolina'),
  64. array(840, 'ND', 'North Dakota'),
  65. array(840, 'MP', 'Northern Mariana Islands'),
  66. array(840, 'OH', 'Ohio'),
  67. array(840, 'OK', 'Oklahoma'),
  68. array(840, 'OR', 'Oregon'),
  69. array(840, 'PW', 'Palau'),
  70. array(840, 'PA', 'Pennsylvania'),
  71. array(840, 'PR', 'Puerto Rico'),
  72. array(840, 'RI', 'Rhode Island'),
  73. array(840, 'SC', 'South Carolina'),
  74. array(840, 'SD', 'South Dakota'),
  75. array(840, 'TN', 'Tennessee'),
  76. array(840, 'TX', 'Texas'),
  77. array(840, 'UT', 'Utah'),
  78. array(840, 'VT', 'Vermont'),
  79. array(840, 'VI', 'Virgin Islands'),
  80. array(840, 'VA', 'Virginia'),
  81. array(840, 'WA', 'Washington'),
  82. array(840, 'WV', 'West Virginia'),
  83. array(840, 'WI', 'Wisconsin'),
  84. array(840, 'WY', 'Wyoming'),
  85. );
  86. $query = db_insert('uc_zones')->fields(array('zone_country_id', 'zone_code', 'zone_name'));
  87. foreach ($zones as $zone) {
  88. $query->values($zone);
  89. }
  90. $query->execute();
  91. // Set address format
  92. // Have to call variable_set() instead of uc_set_address_format()
  93. // because the Canada .cif file is loaded during the installation
  94. // of the uc_store module, before uc_set_address_format() is available
  95. // to use.
  96. variable_set(
  97. 'uc_address_format_840',
  98. "!company\r\n" .
  99. "!first_name !last_name\r\n" .
  100. "!street1\r\n" .
  101. "!street2\r\n" .
  102. "!city, !zone_code !postal_code\r\n" .
  103. "!country_name_if"
  104. );
  105. }