denmark_208_2.cif 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. /**
  3. * Implements hook_install() using the name of the country as the base of
  4. * the function name.
  5. */
  6. function denmark_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' => 208,
  12. 'country_name' => 'Denmark',
  13. 'country_iso_code_2' => 'DK',
  14. 'country_iso_code_3' => 'DNK',
  15. 'version' => 2,
  16. ))
  17. ->execute();
  18. // Make the entries in the zones table.
  19. $zones = array(
  20. array(208, 'DK-84', 'Hovedstaden'),
  21. array(208, 'DK-82', 'Midtjylland'),
  22. array(208, 'DK-81', 'Nordjylland'),
  23. array(208, 'DK-85', 'Sjælland'),
  24. array(208, 'DK-83', 'Syddanmark'),
  25. );
  26. $query = db_insert('uc_zones')->fields(array('zone_country_id', 'zone_code', 'zone_name'));
  27. foreach ($zones as $zone) {
  28. $query->values($zone);
  29. }
  30. $query->execute();
  31. // Set address format
  32. uc_set_address_format(
  33. 208,
  34. "!company\r\n" .
  35. "!first_name !last_name\r\n" .
  36. "!street1\r\n" .
  37. "!street2\r\n" .
  38. "!postal_code !city\r\n" .
  39. "!country_name_if"
  40. );
  41. }
  42. /**
  43. * Implements hook_update() with $version being the only argument.
  44. * Add a new case for each version update, and be sure to always include the
  45. * latest changes in the install function.
  46. */
  47. function denmark_update($version) {
  48. switch ($version) {
  49. case 2:
  50. $zones = array(
  51. array(208, 'DK-84', 'Hovedstaden'),
  52. array(208, 'DK-82', 'Midtjylland'),
  53. array(208, 'DK-81', 'Nordjylland'),
  54. array(208, 'DK-85', 'Sjælland'),
  55. array(208, 'DK-83', 'Syddanmark'),
  56. );
  57. $query = db_insert('uc_zones')->fields(array('zone_country_id', 'zone_code', 'zone_name'));
  58. foreach ($zones as $zone) {
  59. $query->values($zone);
  60. }
  61. $query->execute();
  62. break;
  63. }
  64. }