norway_578_1.cif 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. /**
  3. * Implements hook_install() using the name of the country as the base of
  4. * the function name.
  5. */
  6. function norway_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' => 578,
  12. 'country_name' => 'Norway',
  13. 'country_iso_code_2' => 'NO',
  14. 'country_iso_code_3' => 'NOR',
  15. 'version' => 1,
  16. ))
  17. ->execute();
  18. // Make the entries in the zones table.
  19. $zones = array(
  20. array(578, 'AK', 'Akershus'),
  21. array(578, 'AA', 'Aust-Agder'),
  22. array(578, 'BU', 'Buskerud'),
  23. array(578, 'FM', 'Finnmark'),
  24. array(578, 'HM', 'Hedmark'),
  25. array(578, 'HL', 'Hordaland'),
  26. array(578, 'MR', 'More og Romdal'),
  27. array(578, 'NT', 'Nord-Trondelag'),
  28. array(578, 'NL', 'Nordland'),
  29. array(578, 'OF', 'Ostfold'),
  30. array(578, 'OP', 'Oppland'),
  31. array(578, 'OL', 'Oslo'),
  32. array(578, 'RL', 'Rogaland'),
  33. array(578, 'ST', 'Sor-Trondelag'),
  34. array(578, 'SJ', 'Sogn og Fjordane'),
  35. array(578, 'SV', 'Svalbard'),
  36. array(578, 'TM', 'Telemark'),
  37. array(578, 'TR', 'Troms'),
  38. array(578, 'VA', 'Vest-Agder'),
  39. array(578, 'VF', 'Vestfold'),
  40. );
  41. $query = db_insert('uc_zones')->fields(array('zone_country_id', 'zone_code', 'zone_name'));
  42. foreach ($zones as $zone) {
  43. $query->values($zone);
  44. }
  45. $query->execute();
  46. // Set address format
  47. uc_set_address_format(
  48. 578,
  49. "!company\r\n".
  50. "!first_name !last_name\r\n".
  51. "!street1\r\n".
  52. "!street2\r\n".
  53. "!postal_code !city\r\n".
  54. "!country_name_if"
  55. );
  56. }