samoa_882_1.cif 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /**
  3. * Implements hook_install() using the name of the country as the base of
  4. * the function name.
  5. */
  6. function samoa_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' => 882,
  12. 'country_name' => 'Samoa',
  13. 'country_iso_code_2' => 'WS',
  14. 'country_iso_code_3' => 'WSM',
  15. 'version' => 1,
  16. ))
  17. ->execute();
  18. // Make the entries in the zones table.
  19. $zones = array(
  20. array(882, 'WS-AA', "A'ana"),
  21. array(882, 'WS-AL', 'Aiga-i-le-Tai'),
  22. array(882, 'WS-AT', 'Atua'),
  23. array(882, 'WS-FA', "Fa'asaleleaga"),
  24. array(882, 'WS-GE', "Gaga'emauga"),
  25. array(882, 'WS-GI', 'Gagaifomauga'),
  26. array(882, 'WS-PA', 'Palauli'),
  27. array(882, 'WS-SA', "Satupa'itea"),
  28. array(882, 'WS-TU', 'Tuamasaga'),
  29. array(882, 'WS-VF', "Va'a-o-Fonoti"),
  30. array(882, 'WS-VS', 'Vaisigano'),
  31. );
  32. $query = db_insert('uc_zones')->fields(array('zone_country_id', 'zone_code', 'zone_name'));
  33. foreach ($zones as $zone) {
  34. $query->values($zone);
  35. }
  36. $query->execute();
  37. // Set address format
  38. uc_set_address_format(
  39. 882,
  40. "!company\r\n" .
  41. "!first_name !last_name\r\n" .
  42. "!street1\r\n" .
  43. "!street2\r\n" .
  44. "!city, !zone_name !postal_code\r\n" .
  45. "!country_name_if"
  46. );
  47. }