zimbabwe_716_1.cif 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. /**
  3. * Implements hook_install() using the name of the country as the base of
  4. * the function name.
  5. */
  6. function zimbabwe_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' => 716,
  12. 'country_name' => 'Zimbabwe',
  13. 'country_iso_code_2' => 'ZW',
  14. 'country_iso_code_3' => 'ZWE',
  15. 'version' => 1,
  16. ))
  17. ->execute();
  18. // Make the entries in the zones table. Use %d for the zone_id and the
  19. // function uc_get_zone_ids($num) as the second argument for db_query() where
  20. // $num is the number of zones in the INSERT query.
  21. // VALUES = %d for ID, Parent Country ID, Zone Abbreviation, Zone Name
  22. $zones = array(
  23. array(716, 'BW', 'Bulawayo'),
  24. array(716, 'HR', 'Harare'),
  25. array(716, 'MC', 'Manicaland'),
  26. array(716, 'MSC', 'Mashonaland Central'),
  27. array(716, 'MSE', 'Mashonaland East'),
  28. array(716, 'MSW', 'Mashonaland West'),
  29. array(716, 'MV', 'Masvingo'),
  30. array(716, 'MBN', 'Matabeleland North'),
  31. array(716, 'MBS', 'Matabeleland South'),
  32. array(716, 'ML', 'Midlands'),
  33. );
  34. $query = db_insert('uc_zones')->fields(array('zone_country_id', 'zone_code', 'zone_name'));
  35. foreach ($zones as $zone) {
  36. $query->values($zone);
  37. }
  38. $query->execute();
  39. // Set address format
  40. uc_set_address_format(
  41. 716,
  42. "!company\r\n".
  43. "!first_name !last_name\r\n".
  44. "!street1\r\n".
  45. "!street2\r\n".
  46. "!city\r\n".
  47. "!country_name_if"
  48. );
  49. }