bosnia_herzegovina_70_2.cif 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. /**
  3. * Implements hook_install() using the name of the country as the base of
  4. * the function name.
  5. */
  6. function bosnia_herzegovina_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' => 70,
  12. 'country_name' => 'Bosnia and Herzegovina',
  13. 'country_iso_code_2' => 'BA',
  14. 'country_iso_code_3' => 'BIH',
  15. 'version' => 2,
  16. ))
  17. ->execute();
  18. // Make the entries in the zones table.
  19. $zones = array(
  20. array(70, 'BIH', 'Federacija Bosna i Hercegovina'),
  21. array(70, 'SRP', 'Republika Srpska'),
  22. array(70, '05', 'Bosansko-Podrinjski Kanton'),
  23. array(70, '10', 'Hercegovacko-Bosanski Kanton'),
  24. array(70, '07', 'Hercegovacko-Neretvanski Kanton'),
  25. array(70, '09', 'Kanton Sarajevo'),
  26. array(70, '02', 'Posavski Kanton'),
  27. array(70, '06', 'Srednjobosanski Kanton'),
  28. array(70, '03', 'Tuzlanski Kanton'),
  29. array(70, '01', 'Unsko-Sanski Kanton'),
  30. array(70, '08', 'Zapadno-Hercegovacki Kanton'),
  31. array(70, '04', 'Zenicko-Dobojski Kanton'),
  32. );
  33. $query = db_insert('uc_zones')->fields(array('zone_country_id', 'zone_code', 'zone_name'));
  34. foreach ($zones as $zone) {
  35. $query->values($zone);
  36. }
  37. $query->execute();
  38. // Set address format
  39. uc_set_address_format(
  40. 70,
  41. "!company\r\n".
  42. "!first_name !last_name\r\n".
  43. "!street1\r\n".
  44. "!street2\r\n".
  45. "!city !zone_code !postal_code\r\n".
  46. "!country_name_if"
  47. );
  48. }
  49. function bosnia_herzegovina_update($version) {
  50. switch ($version) {
  51. case 2:
  52. // Correct ISO-3166-1 country name
  53. db_update('uc_countries')
  54. ->fields(array('country_name' => 'Bosnia and Herzegovina'))
  55. ->condition('country_id', 70)
  56. ->execute();
  57. break;
  58. }
  59. }