<?php
// $Id: new_zealand_554_3.cif,v 1.1.4.3 2010-11-02 06:42:17 tr Exp $

function new_zealand_install() {
  db_query("INSERT INTO {uc_countries} VALUES (554, 'New Zealand', 'NZ', 'NZL', 3)");

  db_query("INSERT INTO {uc_zones} VALUES "
          ."(%d, 554, 'AUK', 'Auckland'),"
          ."(%d, 554, 'BOP', 'Bay of Plenty'),"
          ."(%d, 554, 'CAN', 'Canterbury'),"
          ."(%d, 554, 'COR', 'Coromandel'),"
          ."(%d, 554, 'GIS', 'Gisborne'),"
          ."(%d, 554, 'FIO', 'Fiordland'),"
          ."(%d, 554, 'HKB', \"Hawke's Bay\"),"
          ."(%d, 554, 'MBH', 'Marlborough'),"
          ."(%d, 554, 'MWT', 'Manawatu-Wanganui'),"
          ."(%d, 554, 'MCM', 'Mt Cook-Mackenzie'),"
          ."(%d, 554, 'NSN', 'Nelson'),"
          ."(%d, 554, 'NTL', 'Northland'),"
          ."(%d, 554, 'OTA', 'Otago'),"
          ."(%d, 554, 'STL', 'Southland'),"
          ."(%d, 554, 'TKI', 'Taranaki'),"
          ."(%d, 554, 'WGN', 'Wellington'),"
          ."(%d, 554, 'WKO', 'Waikato'),"
          ."(%d, 554, 'WAI', 'Wairarapa'),"
          ."(%d, 554, 'WTC', 'West Coast')",
           uc_get_zone_ids(19));

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

function new_zealand_update($version) {
  switch ($version) {
    case 2:
      db_query("INSERT INTO {uc_zones} VALUES "
              ."(%d, 554, 'AUK', 'Auckland'),"
              ."(%d, 554, 'BOP', 'Bay of Plenty'),"
              ."(%d, 554, 'CAN', 'Canterbury'),"
              ."(%d, 554, 'COR', 'Coromandel'),"
              ."(%d, 554, 'GIS', 'Gisborne'),"
              ."(%d, 554, 'FIO', 'Fiordland'),"
              ."(%d, 554, 'HKB', \"Hawke's Bay\"),"
              ."(%d, 554, 'MBH', 'Marlborough'),"
              ."(%d, 554, 'MWT', 'Manawatu-Wanganui'),"
              ."(%d, 554, 'MCM', 'Mt Cook-Mackenzie'),"
              ."(%d, 554, 'NSN', 'Nelson'),"
              ."(%d, 554, 'NTL', 'Northland'),"
              ."(%d, 554, 'OTA', 'Otago'),"
              ."(%d, 554, 'STL', 'Southland'),"
              ."(%d, 554, 'TKI', 'Taranaki'),"
              ."(%d, 554, 'WGN', 'Wellington'),"
              ."(%d, 554, 'WKO', 'Waikato'),"
              ."(%d, 554, 'WAI', 'Wairarapa'),"
              ."(%d, 554, 'WTC', 'West Coast')",
               uc_get_zone_ids(19));
      break;
    case 3:
      db_query("UPDATE {uc_zones} SET zone_name = 'Wairarapa' WHERE zone_name = 'Wairprarapa'");
      break;
  }
}
