123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- <?php
- /**
- * Implements hook_install() using the name of the country as the base of
- * the function name.
- */
- function romania_install() {
- // Make the entry in the country table.
- // VALUES = Country ID, Country Name, 2-digit Code, 3-digit Code, File Version
- db_insert('uc_countries')
- ->fields(array(
- 'country_id' => 642,
- 'country_name' => 'Romania',
- 'country_iso_code_2' => 'RO',
- 'country_iso_code_3' => 'ROU',
- 'version' => 2,
- ))
- ->execute();
- // VALUES = %d for ID, Parent Country ID, Zone Abbreviation, Zone Name
- $zones = array(
- array(642, 'AB', 'Alba'),
- array(642, 'AR', 'Arad'),
- array(642, 'AG', 'Arges'),
- array(642, 'BC', 'Bacau'),
- array(642, 'BH', 'Bihor'),
- array(642, 'BN', 'Bistrita-Nasaud'),
- array(642, 'BT', 'Botosani'),
- array(642, 'BV', 'Brasov'),
- array(642, 'BR', 'Braila'),
- array(642, 'B', 'Bucuresti'),
- array(642, 'BZ', 'Buzau'),
- array(642, 'CS', 'Caras-Severin'),
- array(642, 'CL', 'Calarasi'),
- array(642, 'CJ', 'Cluj'),
- array(642, 'CT', 'Constanta'),
- array(642, 'CV', 'Covasna'),
- array(642, 'DB', 'Dimbovita'),
- array(642, 'DJ', 'Dolj'),
- array(642, 'GL', 'Galati'),
- array(642, 'GR', 'Giurgiu'),
- array(642, 'GJ', 'Gorj'),
- array(642, 'HR', 'Harghita'),
- array(642, 'HD', 'Hunedoara'),
- array(642, 'IL', 'Ialomita'),
- array(642, 'IS', 'Iasi'),
- array(642, 'IF', 'Ilfov'),
- array(642, 'MM', 'Maramures'),
- array(642, 'MH', 'Mehedinti'),
- array(642, 'MS', 'Mures'),
- array(642, 'NT', 'Neamt'),
- array(642, 'OT', 'Olt'),
- array(642, 'PH', 'Prahova'),
- array(642, 'SM', 'Satu-Mare'),
- array(642, 'SJ', 'Salaj'),
- array(642, 'SB', 'Sibiu'),
- array(642, 'SV', 'Suceava'),
- array(642, 'TR', 'Teleorman'),
- array(642, 'TM', 'Timis'),
- array(642, 'TL', 'Tulcea'),
- array(642, 'VS', 'Vaslui'),
- array(642, 'VL', 'Valcea'),
- array(642, 'VN', 'Vrancea'),
- );
- $query = db_insert('uc_zones')->fields(array('zone_country_id', 'zone_code', 'zone_name'));
- foreach ($zones as $zone) {
- $query->values($zone);
- }
- $query->execute();
- // Set address format
- uc_set_address_format(
- 642,
- "!company\r\n" .
- "!first_name !last_name\r\n" .
- "!street1\r\n" .
- "!street2\r\n" .
- "!city, !postal_code\r\n" .
- "!zone_name, !country_name_if"
- );
- }
- /**
- * Implements hook_update() with $version being the only argument.
- * Add a new case for each version update, and be sure to always include the
- * latest changes in the install function.
- */
- function romania_update($version) {
- switch ($version) {
- case 2:
- // Correct ISO-3166-1 country name
- db_update('uc_countries')
- ->fields(array('country_iso_code_3' => 'ROU'))
- ->condition('country_id', 642)
- ->execute();
- break;
- }
- }
|