saint_barthelemy_652_2.cif 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. /**
  3. * Implements hook_install() using the name of the country as the base of
  4. * the function name.
  5. */
  6. function saint_barthelemy_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' => 652,
  12. 'country_name' => 'Saint Barthélemy',
  13. 'country_iso_code_2' => 'BL',
  14. 'country_iso_code_3' => 'BLM',
  15. 'version' => 2,
  16. ))
  17. ->execute();
  18. // No zones
  19. // Set address format
  20. uc_set_address_format(
  21. 652,
  22. "!company\r\n" .
  23. "!first_name !last_name\r\n" .
  24. "!street1\r\n" .
  25. "!street2\r\n" .
  26. "!city !postal_code\r\n" .
  27. "!country_name_if"
  28. );
  29. }
  30. /**
  31. * Implements hook_update() with $version being the only argument.
  32. * Add a new case for each version update, and be sure to always include the
  33. * latest changes in the install function.
  34. */
  35. function saint_barthelemy_update($version) {
  36. switch ($version) {
  37. case 2:
  38. // Correct ISO-3166-1 country name
  39. db_update('uc_countries')
  40. ->fields(array('country_name' => 'Saint Barthélemy'))
  41. ->condition('country_id', 652)
  42. ->execute();
  43. break;
  44. }
  45. }