venezuela_862_2.cif 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <?php
  2. /**
  3. * Implements hook_install() using the name of the country as the base of
  4. * the function name.
  5. */
  6. function venezuela_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' => 862,
  12. 'country_name' => 'Venezuela, Bolivarian Republic of',
  13. 'country_iso_code_2' => 'VE',
  14. 'country_iso_code_3' => 'VEN',
  15. 'version' => 2,
  16. ))
  17. ->execute();
  18. // Make the entries in the zones table.
  19. $zones = array(
  20. array(862, 'AM', 'Amazonas'),
  21. array(862, 'AN', 'Anzoátegui'),
  22. array(862, 'AP', 'Apure'),
  23. array(862, 'AR', 'Aragua'),
  24. array(862, 'BA', 'Barinas'),
  25. array(862, 'BO', 'Bolívar'),
  26. array(862, 'CA', 'Carabobo'),
  27. array(862, 'CO', 'Cojedes'),
  28. array(862, 'DA', 'Delta Amacuro'),
  29. array(862, 'DF', 'Dependencias Federales'),
  30. array(862, 'DC', 'Distrito Capital'),
  31. array(862, 'FA', 'Falcón'),
  32. array(862, 'GU', 'Guárico'),
  33. array(862, 'LA', 'Lara'),
  34. array(862, 'ME', 'Mérida'),
  35. array(862, 'MI', 'Miranda'),
  36. array(862, 'MO', 'Monagas'),
  37. array(862, 'NE', 'Nueva Esparta'),
  38. array(862, 'PO', 'Portuguesa'),
  39. array(862, 'SU', 'Sucre'),
  40. array(862, 'TA', 'Táchira'),
  41. array(862, 'TR', 'Trujillo'),
  42. array(862, 'VA', 'Vargas'),
  43. array(862, 'YA', 'Yaracuy'),
  44. array(862, 'ZU', 'Zulia'),
  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. 862,
  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. }
  62. /**
  63. * Implements hook_update() with $version being the only argument.
  64. * Add a new case for each version update, and be sure to always include the
  65. * latest changes in the install function.
  66. */
  67. function venezuela_update($version) {
  68. switch ($version) {
  69. case 2:
  70. // Correct ISO-3166-1 country name
  71. db_update('uc_countries')
  72. ->fields(array('country_name' => 'Venezuela, Bolivarian Republic of'))
  73. ->condition('country_id', 862)
  74. ->execute();
  75. break;
  76. }
  77. }