malaysia_458_1.cif 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /**
  3. * Implements hook_install() using the name of the country as the base of
  4. * the function name.
  5. */
  6. function malaysia_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' => 458,
  12. 'country_name' => 'Malaysia',
  13. 'country_iso_code_2' => 'MY',
  14. 'country_iso_code_3' => 'MYS',
  15. 'version' => 1,
  16. ))
  17. ->execute();
  18. // Make the entries in the zones table.
  19. $zones = array(
  20. array(458, 'JHR', 'Johor'),
  21. array(458, 'KDH', 'Kedah'),
  22. array(458, 'KTN', 'Kelantan'),
  23. array(458, 'MLK', 'Melaka'),
  24. array(458, 'NSN', 'Negeri Sembilan'),
  25. array(458, 'PHG', 'Pahang'),
  26. array(458, 'PNG', 'Pulau Pinang'),
  27. array(458, 'PRK', 'Perak'),
  28. array(458, 'PLS', 'Perlis'),
  29. array(458, 'SGR', 'Selangor'),
  30. array(458, 'TRG', 'Terengganu'),
  31. array(458, 'SBH', 'Sabah'),
  32. array(458, 'SRW', 'Sarawak'),
  33. array(458, 'KUL', 'Kuala Lumpur'),
  34. array(458, 'LBN', 'Labuan'),
  35. array(458, 'PJY', 'Putrajaya'),
  36. );
  37. $query = db_insert('uc_zones')->fields(array('zone_country_id', 'zone_code', 'zone_name'));
  38. foreach ($zones as $zone) {
  39. $query->values($zone);
  40. }
  41. $query->execute();
  42. // Set address format
  43. uc_set_address_format(
  44. 458,
  45. "!company\r\n" .
  46. "!first_name !last_name\r\n" .
  47. "!street1\r\n" .
  48. "!street2\r\n" .
  49. "!city, !zone_code !postal_code\r\n" .
  50. "!country_name_if"
  51. );
  52. }