brunei_darussalam_96_3.cif 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. /**
  3. * Implements hook_install() using the name of the country as the base of
  4. * the function name.
  5. */
  6. function brunei_darussalam_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' => 96,
  12. 'country_name' => 'Brunei Darussalam',
  13. 'country_iso_code_2' => 'BN',
  14. 'country_iso_code_3' => 'BRN',
  15. 'version' => 3,
  16. ))
  17. ->execute();
  18. // Make the entries in the zones table.
  19. $zones = array(
  20. array(96, 'BN-BE', 'Belait'),
  21. array(96, 'BN-BM', 'Brunei-Muara'),
  22. array(96, 'BN-TE', 'Temburong'),
  23. array(96, 'BN-TU', 'Tutong'),
  24. );
  25. $query = db_insert('uc_zones')->fields(array('zone_country_id', 'zone_code', 'zone_name'));
  26. foreach ($zones as $zone) {
  27. $query->values($zone);
  28. }
  29. $query->execute();
  30. // Set address format
  31. uc_set_address_format(
  32. 96,
  33. "!company\r\n" .
  34. "!first_name !last_name\r\n" .
  35. "!street1\r\n" .
  36. "!street2\r\n" .
  37. "!city !postal_code\r\n" .
  38. "!zone_name\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 brunei_darussalam_update($version) {
  48. switch ($version) {
  49. case 2:
  50. // Correct the address format
  51. uc_set_address_format(
  52. 96,
  53. "!company\r\n" .
  54. "!first_name !last_name\r\n" .
  55. "!street1\r\n" .
  56. "!street2\r\n" .
  57. "!city !postal_code\r\n" .
  58. "!zone_name\r\n" .
  59. "!country_name_if"
  60. );
  61. break;
  62. case 3:
  63. // Correct ISO-3166-1 country name
  64. db_update('uc_countries')
  65. ->fields(array('country_name' => 'Brunei Darussalam'))
  66. ->condition('country_id', 96)
  67. ->execute();
  68. break;
  69. }
  70. }