<?php
// $Id: turkey_792_2.cif,v 1.5 2010-04-14 14:20:56 islandusurper Exp $

/**
* Implements hook_install() using the name of the country as the base of
* the function name.
*/
function turkey_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' => 792,
      'country_name' => 'Turkey',
      'country_iso_code_2' => 'TR',
      'country_iso_code_3' => 'TUR',
      'version' => 2,
    ))
    ->execute();

  // Set address format
  uc_set_address_format(
    792,
    "!company\r\n".
    "!first_name !last_name\r\n".
    "!street1\r\n".
    "!street2\r\n".
    "!postal_code, !city\r\n\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 turkey_update($version) {
  switch ($version) {
    case 2:
      db_update('uc_countries')
        ->fields(array('country_iso_code_2' => 'TR'))
        ->condition('country_id', 792)
        ->execute();
      break;
  }
}
