<?php
// $Id: morocco_504_1.cif,v 1.1.2.3 2010-04-14 05:18:19 tr Exp $ 1.0.0

/**
 * First implement hook_install() using the name of the country as the base of
 * the function name.
 */
function morocco_install() {
  db_query("INSERT INTO {uc_countries} (country_id, country_name, country_iso_code_2, country_iso_code_3, version) VALUES (504, 'Morocco', 'MA', 'MAR', 1)");

  // Make the entries in the zones table.
  $zones = array(
    array(504, '09', 'Chaouia-Ouardigha'),
    array(504, '10', 'Doukkala-Abda'),
    array(504, '05', 'Fes-Boulemane'),
    array(504, '02', 'Gharb-Chrarda-Beni Hssen'),
    array(504, '08', 'Grand Casablanca'),
    array(504, '14', 'Guelmim-Es Smara'),
    array(504, '15', 'Laayoune-Boujdour-Sakia el Hamra'),
    array(504, '04', 'L-Oriental'),
    array(504, '11', 'Marrakech-Tensift-Al Haouz'),
    array(504, '06', 'Meknes-Tafilalet'),
    array(504, '16', 'Oued ed Dahab-Lagouira'),
    array(504, '07', 'Rabat-Sale-Zemmour-Zaer'),
    array(504, '13', 'Sous-Massa-Draa'),
    array(504, '12', 'Tadla-Azilal'),
    array(504, '01', 'Tanger-Tetouan'),
    array(504, '03', 'Taza-Al Hoceima-Taounate'),
    array(504, 'CHE', 'Chefchaouene'),
    array(504, 'LAR', 'Larache'),
    array(504, 'TNG', 'Tanger'),
    array(504, 'TET', 'Tetouan'),
    array(504, 'KEN', 'Kenitra'),
    array(504, 'SIK', 'Sidi Kacem'),
    array(504, 'HOC', 'AL Hoceima'),
    array(504, 'TAO', 'Taounate'),
    array(504, 'TAZ', 'Taza'),
    array(504, 'BER', 'Berkane'),
    array(504, 'FIG', 'Figuig'),
    array(504, 'JRA', 'Jerada'),
    array(504, 'NAD', 'Nador'),
    array(504, 'OUJ', 'Oujda'),
    array(504, 'BOM', 'Boulemane'),
    array(504, 'FES', 'Fes'),
    array(504, 'SEF', 'Sefrou'),
    array(504, 'HAJ', 'El Hajeb'),
    array(504, 'ERR', 'Errachidia'),
    array(504, 'IFR', 'Ifrane'),
    array(504, 'KHN', 'Khenifra'),
    array(504, 'MEK', 'Meknes'),
    array(504, 'KHE', 'Khemisset'),
    array(504, 'RBA', 'Rabat-Sale'),
    array(504, 'CAS', 'Casablanca'),
    array(504, 'CAS', 'Dar el Beida'),
    array(504, 'BES', 'Ben Slimane'),
    array(504, 'KHO', 'Khouribga'),
    array(504, 'SET', 'Settat'),
    array(504, 'JDI', 'El Jadida'),
    array(504, 'SAF', 'Safi'),
    array(504, 'HAO', 'Al Haouz'),
    array(504, 'CHI', 'Chichaoua'),
    array(504, 'ESI', 'Essaouira'),
    array(504, 'KES', 'Kelaat Sraghna'),
    array(504, 'MAR', 'Marrakech'),
    array(504, 'AZI', 'Azilal'),
    array(504, 'BEM', 'Beni Mellal'),
    array(504, 'AGD', 'Agadir'),
    array(504, 'BAH', 'Ait Baha'),
    array(504, 'MEL', 'Ait Melloul'),
    array(504, 'OUA', 'Ouarzazate'),
    array(504, 'TAR', 'Taroudannt'),
    array(504, 'TIZ', 'Tiznit'),
    array(504, 'ASZ', 'Assa-Zaq'),
    array(504, 'ESM', 'Es Smara'),
    array(504, 'GUE', 'Guelmim'),
    array(504, 'TNT', 'Tan-Tan'),
    array(504, 'TAT', 'Tata'),
    array(504, 'BOD', 'Boujdour'),
    array(504, 'LAA', 'Laayoune'),
    array(504, 'OUD', 'Oued ed Dahab'),
  );

  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(504,
    "!company\r\n!first_name !last_name\r\n!street1\r\n!street2"
   ."\r\n!city !zone_code !postal_code\r\n!country_name_if");
}
