switzerland_756_1.cif 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. /**
  3. * Implements hook_install() using the name of the country as the base of
  4. * the function name.
  5. */
  6. function switzerland_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' => 756,
  12. 'country_name' => 'Switzerland',
  13. 'country_iso_code_2' => 'CH',
  14. 'country_iso_code_3' => 'CHE',
  15. 'version' => 1,
  16. ))
  17. ->execute();
  18. // Make the entries in the zones table.
  19. $zones = array(
  20. array(756, 'AG', 'Aargau'),
  21. array(756, 'AI', 'Appenzell Innerrhoden'),
  22. array(756, 'AR', 'Appenzell Ausserrhoden'),
  23. array(756, 'BS', 'Basel-Stadt'),
  24. array(756, 'BL', 'Basel-Landschaft'),
  25. array(756, 'BE', 'Bern'),
  26. array(756, 'FR', 'Fribourg'),
  27. array(756, 'GE', 'Geneva'),
  28. array(756, 'GL', 'Glarus'),
  29. array(756, 'GR', 'Graubünden'),
  30. array(756, 'JU', 'Jura'),
  31. array(756, 'LU', 'Luzern'),
  32. array(756, 'NE', 'Neuchâtel'),
  33. array(756, 'NW', 'Nidwalden'),
  34. array(756, 'OW', 'Obwalden'),
  35. array(756, 'SH', 'Schaffhausen'),
  36. array(756, 'SZ', 'Schwyz'),
  37. array(756, 'SO', 'Solothurn'),
  38. array(756, 'SG', 'St. Gallen'),
  39. array(756, 'TG', 'Thurgau'),
  40. array(756, 'TI', 'Ticino'),
  41. array(756, 'UR', 'Uri'),
  42. array(756, 'VS', 'Valais'),
  43. array(756, 'VD', 'Vaud'),
  44. array(756, 'ZG', 'Zug'),
  45. array(756, 'ZH', 'Zürich'),
  46. );
  47. $query = db_insert('uc_zones')->fields(array('zone_country_id', 'zone_code', 'zone_name'));
  48. foreach ($zones as $zone) {
  49. $query->values($zone);
  50. }
  51. $query->execute();
  52. // Set address format
  53. uc_set_address_format(
  54. 756,
  55. "!company\r\n" .
  56. "!first_name !last_name\r\n" .
  57. "!street1\r\n" .
  58. "!street2\r\n" .
  59. "!postal_code !city\r\n" .
  60. "!country_name_if"
  61. );
  62. }