libya_434_2.cif 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. function libya_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' => 434,
  8. 'country_name' => 'Libya',
  9. 'country_iso_code_2' => 'LY',
  10. 'country_iso_code_3' => 'LBY',
  11. 'version' => 2,
  12. ))
  13. ->execute();
  14. // Make the entries in the zones table.
  15. $zones = array(
  16. array(434, 'LY-BU', 'Al Buţnān'),
  17. array(434, 'LY-JA', 'Al Jabal al Akhḑar'),
  18. array(434, 'LY-JG', 'Al Jabal al Gharbī'),
  19. array(434, 'LY-JI', 'Al Jifārah'),
  20. array(434, 'LY-JU', 'Al Jufrah'),
  21. array(434, 'LY-KF', 'Al Kufrah'),
  22. array(434, 'LY-MJ', 'Al Marj'),
  23. array(434, 'LY-MB', 'Al Marqab'),
  24. array(434, 'LY-WA', 'Al Wāḩāt'),
  25. array(434, 'LY-NQ', 'An Nuqaţ al Khams'),
  26. array(434, 'LY-ZA', 'Az Zāwiyah'),
  27. array(434, 'LY-BA', 'Banghāzī'),
  28. array(434, 'LY-DR', 'Darnah'),
  29. array(434, 'LY-GT', 'Ghāt'),
  30. array(434, 'LY-MI', 'Mişrātah'),
  31. array(434, 'LY-MQ', 'Murzuq'),
  32. array(434, 'LY-NL', 'Nālūt'),
  33. array(434, 'LY-SB', 'Sabhā'),
  34. array(434, 'LY-SR', 'Surt'),
  35. array(434, 'LY-TB', 'Tarābulus'),
  36. array(434, 'LY-WD', 'Wādī al Ḩayāt'),
  37. array(434, 'LY-WS', 'Wādī ash Shāţiʾ'),
  38. );
  39. $query = db_insert('uc_zones')->fields(array('zone_country_id', 'zone_code', 'zone_name'));
  40. foreach ($zones as $zone) {
  41. $query->values($zone);
  42. }
  43. $query->execute();
  44. // Set address format
  45. uc_set_address_format(
  46. 434,
  47. "!company\r\n".
  48. "!first_name !last_name\r\n".
  49. "!street1\r\n".
  50. "!street2\r\n".
  51. "!city, !zone_name !postal_code\r\n".
  52. "!country_name_if"
  53. );
  54. }
  55. function libya_update($version) {
  56. switch ($version) {
  57. case 2:
  58. // Correct ISO-3166-1 country name
  59. db_update('uc_countries')
  60. ->fields(array('country_name' => 'Libya'))
  61. ->condition('country_id', 434)
  62. ->execute();
  63. break;
  64. }
  65. }