romania_642_2.cif 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <?php
  2. /**
  3. * Implements hook_install() using the name of the country as the base of
  4. * the function name.
  5. */
  6. function romania_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' => 642,
  12. 'country_name' => 'Romania',
  13. 'country_iso_code_2' => 'RO',
  14. 'country_iso_code_3' => 'ROU',
  15. 'version' => 2,
  16. ))
  17. ->execute();
  18. // VALUES = %d for ID, Parent Country ID, Zone Abbreviation, Zone Name
  19. $zones = array(
  20. array(642, 'AB', 'Alba'),
  21. array(642, 'AR', 'Arad'),
  22. array(642, 'AG', 'Arges'),
  23. array(642, 'BC', 'Bacau'),
  24. array(642, 'BH', 'Bihor'),
  25. array(642, 'BN', 'Bistrita-Nasaud'),
  26. array(642, 'BT', 'Botosani'),
  27. array(642, 'BV', 'Brasov'),
  28. array(642, 'BR', 'Braila'),
  29. array(642, 'B', 'Bucuresti'),
  30. array(642, 'BZ', 'Buzau'),
  31. array(642, 'CS', 'Caras-Severin'),
  32. array(642, 'CL', 'Calarasi'),
  33. array(642, 'CJ', 'Cluj'),
  34. array(642, 'CT', 'Constanta'),
  35. array(642, 'CV', 'Covasna'),
  36. array(642, 'DB', 'Dimbovita'),
  37. array(642, 'DJ', 'Dolj'),
  38. array(642, 'GL', 'Galati'),
  39. array(642, 'GR', 'Giurgiu'),
  40. array(642, 'GJ', 'Gorj'),
  41. array(642, 'HR', 'Harghita'),
  42. array(642, 'HD', 'Hunedoara'),
  43. array(642, 'IL', 'Ialomita'),
  44. array(642, 'IS', 'Iasi'),
  45. array(642, 'IF', 'Ilfov'),
  46. array(642, 'MM', 'Maramures'),
  47. array(642, 'MH', 'Mehedinti'),
  48. array(642, 'MS', 'Mures'),
  49. array(642, 'NT', 'Neamt'),
  50. array(642, 'OT', 'Olt'),
  51. array(642, 'PH', 'Prahova'),
  52. array(642, 'SM', 'Satu-Mare'),
  53. array(642, 'SJ', 'Salaj'),
  54. array(642, 'SB', 'Sibiu'),
  55. array(642, 'SV', 'Suceava'),
  56. array(642, 'TR', 'Teleorman'),
  57. array(642, 'TM', 'Timis'),
  58. array(642, 'TL', 'Tulcea'),
  59. array(642, 'VS', 'Vaslui'),
  60. array(642, 'VL', 'Valcea'),
  61. array(642, 'VN', 'Vrancea'),
  62. );
  63. $query = db_insert('uc_zones')->fields(array('zone_country_id', 'zone_code', 'zone_name'));
  64. foreach ($zones as $zone) {
  65. $query->values($zone);
  66. }
  67. $query->execute();
  68. // Set address format
  69. uc_set_address_format(
  70. 642,
  71. "!company\r\n" .
  72. "!first_name !last_name\r\n" .
  73. "!street1\r\n" .
  74. "!street2\r\n" .
  75. "!city, !postal_code\r\n" .
  76. "!zone_name, !country_name_if"
  77. );
  78. }
  79. /**
  80. * Implements hook_update() with $version being the only argument.
  81. * Add a new case for each version update, and be sure to always include the
  82. * latest changes in the install function.
  83. */
  84. function romania_update($version) {
  85. switch ($version) {
  86. case 2:
  87. // Correct ISO-3166-1 country name
  88. db_update('uc_countries')
  89. ->fields(array('country_iso_code_3' => 'ROU'))
  90. ->condition('country_id', 642)
  91. ->execute();
  92. break;
  93. }
  94. }