12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- <?php
- /**
- * Implements hook_install() using the name of the country as the base of
- * the function name.
- */
- function jamaica_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' => 388,
- 'country_name' => 'Jamaica',
- 'country_iso_code_2' => 'JM',
- 'country_iso_code_3' => 'JAM',
- 'version' => 2,
- ))
- ->execute();
- // Make the entries in the zones table.
- $zones = array(
- array(388, 'JM-13', 'Clarendon'),
- array(388, 'JM-09', 'Hanover'),
- array(388, 'JM-01', 'Kingston'),
- array(388, 'JM-12', 'Manchester'),
- array(388, 'JM-04', 'Portland'),
- array(388, 'JM-02', 'Saint Andrew'),
- array(388, 'JM-06', 'Saint Ann'),
- array(388, 'JM-14', 'Saint Catherine'),
- array(388, 'JM-11', 'Saint Elizabeth'),
- array(388, 'JM-08', 'Saint James'),
- array(388, 'JM-05', 'Saint Mary'),
- array(388, 'JM-03', 'Saint Thomas'),
- array(388, 'JM-07', 'Trelawny'),
- array(388, 'JM-10', 'Westmoreland'),
- );
- $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(
- 388,
- "!company\r\n" .
- "!first_name !last_name\r\n" .
- "!street1\r\n" .
- "!street2\r\n" .
- "!city - !postal_code\r\n" .
- "!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 jamaica_update($version) {
- switch ($version) {
- case 2:
- $zones = array(
- array(388, 'JM-13', 'Clarendon'),
- array(388, 'JM-09', 'Hanover'),
- array(388, 'JM-01', 'Kingston'),
- array(388, 'JM-12', 'Manchester'),
- array(388, 'JM-04', 'Portland'),
- array(388, 'JM-02', 'Saint Andrew'),
- array(388, 'JM-06', 'Saint Ann'),
- array(388, 'JM-14', 'Saint Catherine'),
- array(388, 'JM-11', 'Saint Elizabeth'),
- array(388, 'JM-08', 'Saint James'),
- array(388, 'JM-05', 'Saint Mary'),
- array(388, 'JM-03', 'Saint Thomas'),
- array(388, 'JM-07', 'Trelawny'),
- array(388, 'JM-10', 'Westmoreland'),
- );
- $query = db_insert('uc_zones')->fields(array('zone_country_id', 'zone_code', 'zone_name'));
- foreach ($zones as $zone) {
- $query->values($zone);
- }
- $query->execute();
- break;
- }
- }
|