portugal_620_1.cif 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. function portugal_install() {
  3. // Make the entry in the country table.
  4. // VALUES = Country ID, Country Name, 2-digit Code, 3-digit Code, File Version
  5. db_insert('uc_countries')
  6. ->fields(array(
  7. 'country_id' => 620,
  8. 'country_name' => 'Portugal',
  9. 'country_iso_code_2' => 'PT',
  10. 'country_iso_code_3' => 'PRT',
  11. 'version' => 1,
  12. ))
  13. ->execute();
  14. // Make the entries in the zones table. Use %d for the zone_id and the
  15. // function uc_get_zone_ids($num) as the second argument for db_query() where
  16. // $num is the number of zones in the INSERT query.
  17. // VALUES = %d for ID, Parent Country ID, Zone Abbreviation, Zone Name
  18. $zones = array(
  19. array(620, 'AVE', 'Aveiro'),
  20. array(620, 'BEJ', 'Beja'),
  21. array(620, 'BRA', 'Braga'),
  22. array(620, 'BGA', 'Bragança'),
  23. array(620, 'CAB', 'Castelo Branco'),
  24. array(620, 'COI', 'Coimbra'),
  25. array(620, 'EVO', 'Évora'),
  26. array(620, 'FAR', 'Faro'),
  27. array(620, 'GUA', 'Guarda'),
  28. array(620, 'LEI', 'Leiria'),
  29. array(620, 'LIS', 'Lisboa'),
  30. array(620, 'PTL', 'Portalegre'),
  31. array(620, 'POR', 'Porto'),
  32. array(620, 'STR', 'Santarém'),
  33. array(620, 'SET', 'Setúbal'),
  34. array(620, 'VIC', 'Viana do Castelo'),
  35. array(620, 'VIR', 'Vila Real'),
  36. array(620, 'VIS', 'Viseu'),
  37. array(620, 'ACO', 'Reg. Autónoma Açores'),
  38. array(620, 'MAD', 'Reg. Autónoma Madeira'),
  39. );
  40. $query = db_insert('uc_zones')->fields(array('zone_country_id', 'zone_code', 'zone_name'));
  41. foreach ($zones as $zone) {
  42. $query->values($zone);
  43. }
  44. $query->execute();
  45. // Set address format
  46. uc_set_address_format(
  47. 620,
  48. "!company\r\n".
  49. "!first_name !last_name\r\n".
  50. "!street1\r\n".
  51. "!street2\r\n".
  52. "!city, !zone_name\r\n".
  53. "!country_name"
  54. );
  55. }