niger_562_1.cif 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. * Implements hook_install() using the name of the country as the base of
  4. * the function name.
  5. */
  6. function niger_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' => 562,
  12. 'country_name' => 'Niger',
  13. 'country_iso_code_2' => 'NE',
  14. 'country_iso_code_3' => 'NER',
  15. 'version' => 1,
  16. ))
  17. ->execute();
  18. // Make the entries in the zones table.
  19. $zones = array(
  20. array(562, 'NE-8', 'Niamey'),
  21. array(562, 'NE-1', 'Agadez'),
  22. array(562, 'NE-2', 'Diffa'),
  23. array(562, 'NE-3', 'Dosso'),
  24. array(562, 'NE-4', 'Maradi'),
  25. array(562, 'NE-5', 'Tahoua '),
  26. array(562, 'NE-6', 'Tillabéri'),
  27. array(562, 'NE-7', 'Zinder'),
  28. );
  29. $query = db_insert('uc_zones')->fields(array('zone_country_id', 'zone_code', 'zone_name'));
  30. foreach ($zones as $zone) {
  31. $query->values($zone);
  32. }
  33. $query->execute();
  34. // Set address format
  35. uc_set_address_format(
  36. 562,
  37. "!company\r\n" .
  38. "!first_name !last_name\r\n" .
  39. "!street1\r\n" .
  40. "!street2\r\n" .
  41. "!city, !zone_name !postal_code\r\n" .
  42. "!country_name_if"
  43. );
  44. }