namibia_516_1.cif 1.4 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 namibia_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' => 516,
  12. 'country_name' => 'Namibia',
  13. 'country_iso_code_2' => 'NA',
  14. 'country_iso_code_3' => 'NAM',
  15. 'version' => 1,
  16. ))
  17. ->execute();
  18. // Make the entries in the zones table.
  19. $zones = array(
  20. array(516, 'NA-CA', 'Caprivi'),
  21. array(516, 'NA-ER', 'Erongo'),
  22. array(516, 'NA-HA', 'Hardap'),
  23. array(516, 'NA-KA', 'Karas'),
  24. array(516, 'NA-KH', 'Khomas'),
  25. array(516, 'NA-KU', 'Kunene'),
  26. array(516, 'NA-OW', 'Ohangwena'),
  27. array(516, 'NA-OK', 'Okavango'),
  28. array(516, 'NA-OH', 'Omaheke'),
  29. array(516, 'NA-OS', 'Omusati'),
  30. array(516, 'NA-ON', 'Oshana'),
  31. array(516, 'NA-OT', 'Oshikoto'),
  32. array(516, 'NA-OD', 'Otjozondjupa'),
  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. 516,
  42. "!company\r\n" .
  43. "!first_name !last_name\r\n" .
  44. "!street1\r\n" .
  45. "!street2\r\n" .
  46. "!city, !zone_name !postal_code\r\n" .
  47. "!country_name_if"
  48. );
  49. }