peru_604_1.cif 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. /**
  3. * Implements hook_install() using the name of the country as the base of
  4. * the function name.
  5. */
  6. function peru_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' => 604,
  12. 'country_name' => 'Peru',
  13. 'country_iso_code_2' => 'PE',
  14. 'country_iso_code_3' => 'PER',
  15. 'version' => 1,
  16. ))
  17. ->execute();
  18. // Make the entries in the zones table.
  19. $zones = array(
  20. array(604, 'AMA', 'Amazonas'),
  21. array(604, 'ANC', 'Ancash'),
  22. array(604, 'APU', 'Apurímac'),
  23. array(604, 'ARE', 'Arequipa'),
  24. array(604, 'AYA', 'Ayacucho'),
  25. array(604, 'CAJ', 'Cajamarca'),
  26. array(604, 'CAL', 'Callao'),
  27. array(604, 'CUS', 'Cusco'),
  28. array(604, 'HUV', 'Huancavelica'),
  29. array(604, 'HUC', 'Huánuco'),
  30. array(604, 'ICA', 'Ica'),
  31. array(604, 'JUN', 'Junín'),
  32. array(604, 'LAL', 'La Libertad'),
  33. array(604, 'LAM', 'Lambayeque'),
  34. array(604, 'LIM', 'Lima'),
  35. array(604, 'LOR', 'Loreto'),
  36. array(604, 'MDD', 'Madre de Dios'),
  37. array(604, 'MOQ', 'Moquegua'),
  38. array(604, 'PAS', 'Pasco'),
  39. array(604, 'PIU', 'Piura'),
  40. array(604, 'PUN', 'Puno'),
  41. array(604, 'SAM', 'San Martín'),
  42. array(604, 'TAC', 'Tacna'),
  43. array(604, 'TUM', 'Tumbes'),
  44. array(604, 'UCA', 'Ucayali'),
  45. );
  46. $query = db_insert('uc_zones')->fields(array('zone_country_id', 'zone_code', 'zone_name'));
  47. foreach ($zones as $zone) {
  48. $query->values($zone);
  49. }
  50. $query->execute();
  51. // Set address format
  52. uc_set_address_format(
  53. 604,
  54. "!company\r\n" .
  55. "!first_name !last_name\r\n" .
  56. "!street1\r\n" .
  57. "!street2\r\n" .
  58. "!city !zone_code !postal_code\r\n" .
  59. "!country_name_if"
  60. );
  61. }