<?php

function moldova_install() {
  // Make the entry in the country table.
  db_query("INSERT INTO {uc_countries} (country_id, country_name, country_iso_code_2, country_iso_code_3, version) VALUES (498, 'Moldova, Republic of', 'MD', 'MDA', 1)");

  // Make the entries in the zones table.
  $zones = array(
    array(498, 'GA', 'Găgăuzia, Unitatea teritorială autonomă (UTAG)'),
    array(498, 'BA', 'Bălţi'),
    array(498, 'BD', 'Tighina'),
    array(498, 'CU', 'Chişinău'),
    array(498, 'AN', 'Anenii Noi'),
    array(498, 'BS', 'Basarabeasca'),
    array(498, 'BR', 'Briceni'),
    array(498, 'CA', 'Cahul'),
    array(498, 'CT', 'Cantemir'),
    array(498, 'CL', 'Călăraşi'),
    array(498, 'CS', 'Căuşeni'),
    array(498, 'CM', 'Cimişlia'),
    array(498, 'CR', 'Criuleni'),
    array(498, 'DO', 'Donduşeni'),
    array(498, 'DR', 'Drochia'),
    array(498, 'DU', 'Dubăsari'),
    array(498, 'ED', 'Edineţ'),
    array(498, 'FA', 'Făleşti'),
    array(498, 'FL', 'Floreşti'),
    array(498, 'GL', 'Glodeni'),
    array(498, 'HI', 'Hînceşti'),
    array(498, 'IA', 'Ialoveni'),
    array(498, 'LE', 'Leova'),
    array(498, 'NI', 'Nisporeni'),
    array(498, 'OC', 'Ocniţa'),
    array(498, 'OR', 'Orhei'),
    array(498, 'RE', 'Rezina'),
    array(498, 'RI', 'Rîşcani'),
    array(498, 'SI', 'Sîngerei'),
    array(498, 'SO', 'Soroca'),
    array(498, 'ST', 'Străşeni'),
    array(498, 'SD', 'Şoldăneşti'),
    array(498, 'SV', 'Ştefan Vodă'),
    array(498, 'TA', 'Taraclia'),
    array(498, 'TE', 'Teleneşti'),
    array(498, 'UN', 'Ungheni'),
    array(498, 'SN', 'Stînga Nistrului, unitatea teritorială din'),
  );

  foreach ($zones as $zone) {
    db_query("INSERT INTO {uc_zones} (zone_country_id, zone_code, zone_name) VALUES (%d, '%s', '%s')", $zone);
  }

  uc_set_address_format(498, "!company\r\n!first_name !last_name\r\n!zone_name, !country_name_if\r\n!city, !postal_code\r\n!street1\r\n!street2");
}
