From a97d0941a993eae244201020083023c1b627ff16 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@users.sourceforge.net>
Date: Fri, 3 Jul 2009 22:52:49 +0000
Subject: [PATCH] Added US states

---
 htdocs/admin/dict.php           | 62 ++++++++++++++--------
 htdocs/langs/en_US/admin.lang   |  2 +-
 mysql/data/data.sql             | 94 ++++++++++++++++++++++++++-------
 mysql/migration/2.6.0-2.7.0.sql | 55 +++++++++++++++++++
 4 files changed, 170 insertions(+), 43 deletions(-)

diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php
index c6940a90b08..040bb6291be 100644
--- a/htdocs/admin/dict.php
+++ b/htdocs/admin/dict.php
@@ -1,6 +1,6 @@
 <?php
 /* Copyright (C) 2004      Rodolphe Quiedeville <rodolphe@quiedeville.org>
- * Copyright (C) 2004-2008 Laurent Destailleur  <eldy@users.sourceforge.net>
+ * Copyright (C) 2004-2009 Laurent Destailleur  <eldy@users.sourceforge.net>
  * Copyright (C) 2004      Benoit Mortier       <benoit.mortier@opensides.be>
  * Copyright (C) 2005-2009 Regis Houssin        <regis@dolibarr.fr>
  *
@@ -92,8 +92,8 @@ $tablib[18]= $langs->trans("DictionnarySendingMethods");
 
 // Requete pour extraction des donnees des dictionnaires
 $tabsql[1] = "SELECT f.rowid as rowid, f.code, f.libelle, p.libelle as pays, f.active FROM ".MAIN_DB_PREFIX."c_forme_juridique as f, ".MAIN_DB_PREFIX."c_pays as p WHERE f.fk_pays=p.rowid";
-$tabsql[2] = "SELECT d.rowid as rowid, d.code_departement as code , d.nom as libelle, d.fk_region as region_id, r.nom as region, p.libelle as pays, d.active FROM ".MAIN_DB_PREFIX."c_departements as d, ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_pays as p WHERE d.fk_region=r.code_region and r.fk_pays=p.rowid and r.active=1 and p.active=1";
-$tabsql[3] = "SELECT r.rowid as rowid, code_region as code , nom as libelle, r.fk_pays as pays_id, p.libelle as pays, r.active FROM ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_pays as p WHERE r.fk_pays=p.rowid and p.active=1";
+$tabsql[2] = "SELECT d.rowid as rowid, d.code_departement as code, d.nom as libelle, d.fk_region as region_id, r.nom as region, p.code as pays_code, p.libelle as pays, d.active FROM ".MAIN_DB_PREFIX."c_departements as d, ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_pays as p WHERE d.fk_region=r.code_region and r.fk_pays=p.rowid and r.active=1 and p.active=1";
+$tabsql[3] = "SELECT r.rowid as rowid, code_region as code, nom as libelle, r.fk_pays as pays_id, p.code as pays_code, p.libelle as pays, r.active FROM ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_pays as p WHERE r.fk_pays=p.rowid and p.active=1";
 $tabsql[4] = "SELECT rowid   as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_pays";
 $tabsql[5] = "SELECT c.rowid as rowid, c.code as code, c.civilite AS libelle, c.active FROM ".MAIN_DB_PREFIX."c_civilite AS c";
 $tabsql[6] = "SELECT a.id    as rowid, a.code as code, a.libelle AS libelle, a.type, a.active FROM ".MAIN_DB_PREFIX."c_actioncomm AS a";
@@ -114,7 +114,7 @@ $tabsql[18]= "SELECT rowid   as rowid, code, libelle, active FROM ".MAIN_DB_PREF
 $tabsqlsort[1] ="pays, code ASC";
 $tabsqlsort[2] ="pays, code ASC";
 $tabsqlsort[3] ="pays, code ASC";
-$tabsqlsort[4] ="libelle ASC";
+$tabsqlsort[4] ="code ASC";
 $tabsqlsort[5] ="libelle ASC";
 $tabsqlsort[6] ="a.type ASC, a.code ASC";
 $tabsqlsort[7] ="a.libelle ASC";
@@ -132,7 +132,7 @@ $tabsqlsort[18]="code ASC, libelle ASC";
 
 // Nom des champs en resultat de select pour affichage du dictionnaire
 $tabfield[1] = "code,libelle,pays";
-$tabfield[2] = "code,libelle,region_id,region";   // "code,libelle,region"
+$tabfield[2] = "code,libelle,region_id,region,pays";   // "code,libelle,region,pays_code-pays"
 $tabfield[3] = "code,libelle,pays_id,pays";
 $tabfield[4] = "code,libelle";
 $tabfield[5] = "code,libelle";
@@ -150,7 +150,7 @@ $tabfield[16]= "code,libelle";
 $tabfield[17]= "code,libelle";
 $tabfield[18]= "code,libelle";
 
-// Nom des champs d'edition pour modification du dictionnaire
+// Nom des champs d'edition pour modification d'un enregistrement
 $tabfieldvalue[1] = "code,libelle,pays";
 $tabfieldvalue[2] = "code,libelle,region";   // "code,libelle,region"
 $tabfieldvalue[3] = "code,libelle,pays";
@@ -246,10 +246,16 @@ if ($_POST["actionadd"] || $_POST["actionmodify"])
 	$listfieldmodify=split(',',$tabfieldinsert[$_POST["id"]]);
 	$listfieldvalue=split(',',$tabfieldvalue[$_POST["id"]]);
 
-	// Verifie que tous les champs sont renseign�s
+	// Check that all fields are filled
 	$ok=1;
-	foreach ($listfield as $f => $value) {
-		if (! isset($_POST[$value]) || $_POST[$value]=='') {
+	foreach ($listfield as $f => $value)
+	{
+		if ($value == 'pays')
+		{
+			if (in_array('region_id',$listfield)) { continue; }		// For region page, we do not require the country input
+		}
+		if (! isset($_POST[$value]) || $_POST[$value]=='')
+		{
 			$ok=0;
 			$msg.=$langs->trans("ErrorFieldRequired",$listfield[$f]).'<br>';
 		}
@@ -257,7 +263,7 @@ if ($_POST["actionadd"] || $_POST["actionmodify"])
 	// Autres verif
 	if (isset($_POST["code"]) && $_POST["code"]=='0') {
 		$ok=0;
-		$msg.="Le Code ne peut avoir la valeur 0<br>";
+		$msg.="Code can't contains value 0<br>";
 	}
 	if (isset($_POST["pays"]) && $_POST["pays"]=='0') {
 		$ok=0;
@@ -265,8 +271,10 @@ if ($_POST["actionadd"] || $_POST["actionmodify"])
 	}
 
 	// Si verif ok et action add, on ajoute la ligne
-	if ($ok && $_POST["actionadd"]) {
-		if ($tabrowid[$_POST["id"]]) {
+	if ($ok && $_POST["actionadd"])
+	{
+		if ($tabrowid[$_POST["id"]])
+		{
 			// Recupere id libre pour insertion
 			$newid=0;
 			$sql = "SELECT max(".$tabrowid[$_POST["id"]].") newid from ".$tabname[$_POST["id"]];
@@ -316,7 +324,8 @@ if ($_POST["actionadd"] || $_POST["actionmodify"])
 	}
 
 	// Si verif ok et action modify, on modifie la ligne
-	if ($ok && $_POST["actionmodify"]) {
+	if ($ok && $_POST["actionmodify"])
+	{
 		if ($tabrowid[$_POST["id"]]) { $rowidcol=$tabrowid[$_POST["id"]]; }
 		else { $rowidcol="rowid"; }
 
@@ -466,6 +475,8 @@ if ($_GET["id"])
 	$sql=$tabsql[$_GET["id"]];
 	if ($_GET["sortfield"])
 	{
+		// If sort order is "pays", we use pays_code instead
+		if ($_GET["sortfield"] == 'pays') $_GET["sortfield"]='pays_code';
 		$sql.= " ORDER BY ".$_GET["sortfield"];
 		if ($_GET["sortorder"])
 		{
@@ -488,7 +499,7 @@ if ($_GET["id"])
 	print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
 	print '<table class="noborder" width="100%">';
 
-	// Ligne d'ajout
+	// Form to add a new line
 	if ($tabname[$_GET["id"]])
 	{
 		$alabelisused=0;
@@ -497,7 +508,7 @@ if ($_GET["id"])
 		$fieldlist=split(',',$tabfield[$_GET["id"]]);
 		//        print '<table class="noborder" width="100%">';
 
-		// Ligne de titre d'ajout
+		// Line for title
 		print '<tr class="liste_titre">';
 		foreach ($fieldlist as $field => $value)
 		{
@@ -512,7 +523,9 @@ if ($_GET["id"])
 			if ($fieldlist[$field]=='code')            { $valuetoshow=$langs->trans("Code"); }
 			if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label")."*"; }
 			if ($fieldlist[$field]=='libelle_facture') { $valuetoshow=$langs->trans("LabelOnDocuments")."*"; }
-			if ($fieldlist[$field]=='pays')            { $valuetoshow=$langs->trans("Country"); }
+			if ($fieldlist[$field]=='pays')            {
+				if (in_array('region_id',$fieldlist)) { print '<td>&nbsp;</td>'; continue; }		// For region page, we do not show the country input
+				$valuetoshow=$langs->trans("Country"); }
 			if ($fieldlist[$field]=='recuperableonly') { $valuetoshow=MAIN_LABEL_MENTION_NPR; }
 			if ($fieldlist[$field]=='nbjour')          { $valuetoshow=$langs->trans("NbOfDays"); }
 			if ($fieldlist[$field]=='fdm')             { $valuetoshow=$langs->trans("AtEndOfMonth"); }
@@ -536,12 +549,12 @@ if ($_GET["id"])
 		print '&nbsp;</td>';
 		print '</tr>';
 
-		// Ligne d'ajout
+		// Line to type new values
 		print "<tr ".$bc[$var].">";
 
 		fieldList($fieldlist);
 
-		print '<td colspan="3"><input type="submit" class="button" name="actionadd" value="'.$langs->trans("Add").'"></td>';
+		print '<td colspan="3" align="right"><input type="submit" class="button" name="actionadd" value="'.$langs->trans("Add").'"></td>';
 		print "</tr>";
 
 		if ($alabelisused)  // Si un des champs est un libelle
@@ -551,7 +564,8 @@ if ($_GET["id"])
 		print '<tr><td colspan="'.(count($fieldlist)+2).'">&nbsp;</td></tr>';
 	}
 
-	// Affiche table des valeurs
+
+	// List of available values in database
 	dol_syslog("htdocs/admin/dict sql=".$sql, LOG_DEBUG);
 	$resql=$db->query($sql);
 	if ($resql)
@@ -625,7 +639,7 @@ if ($_GET["id"])
 						}
 						else if ($fieldlist[$field]=='pays') {
 							$key=$langs->trans("Country".strtoupper($obj->pays_code));
-							$valuetoshow=($key != "Country".strtoupper($obj->pays_code))?$key:$obj->pays;
+							$valuetoshow=($key != "Country".strtoupper($obj->pays_code))?$obj->pays_code." - ".$key:$obj->pays;
 						}
 						else if ($fieldlist[$field]=='recuperableonly' || $fieldlist[$field]=='fdm') {
 							$valuetoshow=yn($valuetoshow);
@@ -728,8 +742,11 @@ $db->close();
 
 llxFooter('$Date$ - $Revision$');
 
+
 /**
- \brief      Affiche les champs
+ *	\brief      Show field
+ * 	\param		fieldlist		Array of fields
+ * 	\param		obj				If we show a particular record, obj is filled with record fields
  */
 function fieldList($fieldlist,$obj='')
 {
@@ -742,8 +759,9 @@ function fieldList($fieldlist,$obj='')
 
 	foreach ($fieldlist as $field => $value)
 	{
+		//var_dump($obj);
 		if ($fieldlist[$field] == 'pays') {
-			//var_dump($obj);
+			if (in_array('region_id',$fieldlist)) { print '<td>&nbsp;</td>'; continue; }	// For region page, we do not show the country input
 			print '<td>';
 			$html->select_pays($obj->pays,'pays');
 			print '</td>';
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index 80224756ede..7110fc63552 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -530,7 +530,7 @@ Permission2515=Setup documents directories
 DictionnaryCompanyType=Company types
 DictionnaryCompanyJuridicalType=Juridical kinds of company
 DictionnaryProspectLevel=Prospect potential level
-DictionnaryCanton=Districts
+DictionnaryCanton=State/Cantons
 DictionnaryRegion=Regions
 DictionnaryCountry=Countries
 DictionnaryCurrency=Currencies
diff --git a/mysql/data/data.sql b/mysql/data/data.sql
index 46000927a99..8a778d0911a 100644
--- a/mysql/data/data.sql
+++ b/mysql/data/data.sql
@@ -860,26 +860,29 @@ insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (
 insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (2801,28,2801,     '',0,'Australia');
 
 -- Regions spain (id pays=4)
-INSERT INTO llx_c_regions (code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (401,  4, '', 1, 'Andalucia', 1);
-INSERT INTO llx_c_regions (code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (402,  4, '', 2, 'Aragón', 1);
-INSERT INTO llx_c_regions (code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (403,  4, '', 3, 'Castilla y León', 1);
-INSERT INTO llx_c_regions (code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (404,  4, '', 4, 'Castilla la Mancha', 1);
-INSERT INTO llx_c_regions (code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (405,  4, '', 5, 'Canarias', 1);
-INSERT INTO llx_c_regions (code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (406,  4, '', 6, 'Cataluña', 1);
-INSERT INTO llx_c_regions (code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (407,  4, '', 7, 'Comunidad de Ceuta', 1);
-INSERT INTO llx_c_regions (code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (408,  4, '', 8, 'Comunidad Foral de Navarra', 1);
-INSERT INTO llx_c_regions (code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (409,  4, '', 9, 'Comunidad de Melilla', 1);
-INSERT INTO llx_c_regions (code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (410,  4, '', 10, 'Cantabria', 1);
-INSERT INTO llx_c_regions (code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (411,  4, '', 11, 'Comunidad Valenciana', 1);
-INSERT INTO llx_c_regions (code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (412,  4, '', 12, 'Extemadura', 1);
-INSERT INTO llx_c_regions (code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (413,  4, '', 13, 'Galicia', 1);
-INSERT INTO llx_c_regions (code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (414,  4, '', 14, 'Islas Baleares', 1);
-INSERT INTO llx_c_regions (code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (415,  4, '', 15, 'La Rioja', 1);
-INSERT INTO llx_c_regions (code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (416,  4, '', 16, 'Comunidad de Madrid', 1);
-INSERT INTO llx_c_regions (code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (417,  4, '', 17, 'Región de Murcia', 1);
-INSERT INTO llx_c_regions (code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (418,  4, '', 18, 'Principado de Asturias', 1);
-INSERT INTO llx_c_regions (code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (419,  4, '', 19, 'Pais Vasco', 1);
-INSERT INTO llx_c_regions (code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (420,  4, '', 20, 'Otros', 1);
+INSERT INTO llx_c_regions (code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (401,  4, '', 0, 'Andalucia', 1);
+INSERT INTO llx_c_regions (code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (402,  4, '', 0, 'Aragón', 1);
+INSERT INTO llx_c_regions (code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (403,  4, '', 0, 'Castilla y León', 1);
+INSERT INTO llx_c_regions (code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (404,  4, '', 0, 'Castilla la Mancha', 1);
+INSERT INTO llx_c_regions (code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (405,  4, '', 0, 'Canarias', 1);
+INSERT INTO llx_c_regions (code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (406,  4, '', 0, 'Cataluña', 1);
+INSERT INTO llx_c_regions (code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (407,  4, '', 0, 'Comunidad de Ceuta', 1);
+INSERT INTO llx_c_regions (code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (408,  4, '', 0, 'Comunidad Foral de Navarra', 1);
+INSERT INTO llx_c_regions (code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (409,  4, '', 0, 'Comunidad de Melilla', 1);
+INSERT INTO llx_c_regions (code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (410,  4, '', 0, 'Cantabria', 1);
+INSERT INTO llx_c_regions (code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (411,  4, '', 0, 'Comunidad Valenciana', 1);
+INSERT INTO llx_c_regions (code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (412,  4, '', 0, 'Extemadura', 1);
+INSERT INTO llx_c_regions (code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (413,  4, '', 0, 'Galicia', 1);
+INSERT INTO llx_c_regions (code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (414,  4, '', 0, 'Islas Baleares', 1);
+INSERT INTO llx_c_regions (code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (415,  4, '', 0, 'La Rioja', 1);
+INSERT INTO llx_c_regions (code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (416,  4, '', 0, 'Comunidad de Madrid', 1);
+INSERT INTO llx_c_regions (code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (417,  4, '', 0, 'Región de Murcia', 1);
+INSERT INTO llx_c_regions (code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (418,  4, '', 0, 'Principado de Asturias', 1);
+INSERT INTO llx_c_regions (code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (419,  4, '', 0, 'Pais Vasco', 1);
+INSERT INTO llx_c_regions (code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (420,  4, '', 0, 'Otros', 1);
+
+-- Region US (id pays=11)
+INSERT INTO llx_c_regions (code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (110, 11, '', 0, 'United-States', 1);
 
 
 --
@@ -1068,6 +1071,57 @@ INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, nc
 INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('52', 409, '', 9, 'MELILLA', 'Melilla', 1);
 INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('53', 420, '', 20, 'OTROS', 'Otros', 1);
 
+-- Provinces US
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('AL', 110, '', 0, 'ALABAMA', 'Alabama', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('AK', 110, '', 0, 'ALASKA', 'Alaska', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('AZ', 110, '', 0, 'ARIZONA', 'Arizona', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('AR', 110, '', 0, 'ARKANSAS', 'Arkansas', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('CA', 110, '', 0, 'CALIFORNIA', 'California', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('CO', 110, '', 0, 'COLORADO', 'Colorado', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('CT', 110, '', 0, 'CONNECTICUT', 'Connecticut', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('DE', 110, '', 0, 'DELAWARE', 'Delaware', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('FL', 110, '', 0, 'FLORIDA', 'Florida', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('GA', 110, '', 0, 'GEORGIA', 'Georgia', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('HI', 110, '', 0, 'HAWAI', 'Hawaii', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('ID', 110, '', 0, 'IDAHO', 'Idaho', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('IL', 110, '', 0, 'ILLINOIS','Illinois', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('IN', 110, '', 0, 'INDIANA', 'Indiana', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('IA', 110, '', 0, 'IOWA', 'Iowa', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('KS', 110, '', 0, 'KANSAS', 'Kansas', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('KY', 110, '', 0, 'KENTUCKY', 'Kentucky', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('LA', 110, '', 0, 'LOUISIANA', 'Louisiana', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('ME', 110, '', 0, 'MAINE', 'Maine', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('MD', 110, '', 0, 'MARYLAND', 'Maryland', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('MA', 110, '', 0, 'MASSACHUSSETTS', 'Massachusetts', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('MI', 110, '', 0, 'MICHIGAN', 'Michigan', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('MN', 110, '', 0, 'MINNESOTA', 'Minnesota', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('MS', 110, '', 0, 'MISSISSIPI', 'Mississippi', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('MO', 110, '', 0, 'MISSOURI', 'Missouri', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('MT', 110, '', 0, 'MONTANA', 'Montana', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('NE', 110, '', 0, 'NEBRASKA', 'Nebraska', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('NV', 110, '', 0, 'NEVADA', 'Nevada', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('NH', 110, '', 0, 'NEW HAMPSHIRE', 'New Hampshire', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('NJ', 110, '', 0, 'NEW JERSEY', 'New Jersey', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('NM', 110, '', 0, 'NEW MEXICO', 'New Mexico', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('NY', 110, '', 0, 'NEW YORK', 'New York', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('NC', 110, '', 0, 'NORTH CAROLIAN', 'North Carolina', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('ND', 110, '', 0, 'NORTH DAKOTA', 'North Dakota', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('OH', 110, '', 0, 'OHIO', 'Ohio', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('OK', 110, '', 0, 'OKLAHOMA', 'Oklahoma', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('OR', 110, '', 0, 'OREGON', 'Oregon', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('PA', 110, '', 0, 'PENNSYLVANIA', 'Pennsylvania', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('RI', 110, '', 0, 'RHODE ISLAND', 'Rhode Island', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('SC', 110, '', 0, 'SOUTH CAROLINA', 'South Carolina', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('SD', 110, '', 0, 'SOUTH DAKOTA', 'South Dakota', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('TN', 110, '', 0, 'TENNESSEE', 'Tennessee', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('TX', 110, '', 0, 'TEXAS', 'Texas', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('UT', 110, '', 0, 'UTAH', 'Utah', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('VT', 110, '', 0, 'VERMONT', 'Vermont', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('VA', 110, '', 0, 'VIRGINIA', 'Virginia', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('WA', 110, '', 0, 'WASHINGTON', 'Washington', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('WV', 110, '', 0, 'WEST VIRGINIA', 'West Virginia', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('WI', 110, '', 0, 'WISCONSIN', 'Wisconsin', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('WY', 110, '', 0, 'WYOMONG', 'Wyoming', 1);
 
 
 --
diff --git a/mysql/migration/2.6.0-2.7.0.sql b/mysql/migration/2.6.0-2.7.0.sql
index 5dafa240c46..7cee7457ab1 100644
--- a/mysql/migration/2.6.0-2.7.0.sql
+++ b/mysql/migration/2.6.0-2.7.0.sql
@@ -174,3 +174,58 @@ alter table llx_commande_fournisseur add column   ref_supplier        varchar(30
 alter table llx_mailing add column bgcolor  varchar(8) after body;
 alter table llx_mailing add column bgimage  varchar(255) after bgcolor;
 
+-- Added US states
+INSERT INTO llx_c_regions (code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (110, 11, '', 0, 'United-States', 1);
+--
+-- Provinces US
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('AL', 110, '', 0, 'ALABAMA', 'Alabama', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('AK', 110, '', 0, 'ALASKA', 'Alaska', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('AZ', 110, '', 0, 'ARIZONA', 'Arizona', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('AR', 110, '', 0, 'ARKANSAS', 'Arkansas', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('CA', 110, '', 0, 'CALIFORNIA', 'California', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('CO', 110, '', 0, 'COLORADO', 'Colorado', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('CT', 110, '', 0, 'CONNECTICUT', 'Connecticut', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('DE', 110, '', 0, 'DELAWARE', 'Delaware', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('FL', 110, '', 0, 'FLORIDA', 'Florida', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('GA', 110, '', 0, 'GEORGIA', 'Georgia', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('HI', 110, '', 0, 'HAWAI', 'Hawaii', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('ID', 110, '', 0, 'IDAHO', 'Idaho', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('IL', 110, '', 0, 'ILLINOIS','Illinois', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('IN', 110, '', 0, 'INDIANA', 'Indiana', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('IA', 110, '', 0, 'IOWA', 'Iowa', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('KS', 110, '', 0, 'KANSAS', 'Kansas', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('KY', 110, '', 0, 'KENTUCKY', 'Kentucky', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('LA', 110, '', 0, 'LOUISIANA', 'Louisiana', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('ME', 110, '', 0, 'MAINE', 'Maine', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('MD', 110, '', 0, 'MARYLAND', 'Maryland', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('MA', 110, '', 0, 'MASSACHUSSETTS', 'Massachusetts', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('MI', 110, '', 0, 'MICHIGAN', 'Michigan', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('MN', 110, '', 0, 'MINNESOTA', 'Minnesota', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('MS', 110, '', 0, 'MISSISSIPI', 'Mississippi', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('MO', 110, '', 0, 'MISSOURI', 'Missouri', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('MT', 110, '', 0, 'MONTANA', 'Montana', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('NE', 110, '', 0, 'NEBRASKA', 'Nebraska', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('NV', 110, '', 0, 'NEVADA', 'Nevada', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('NH', 110, '', 0, 'NEW HAMPSHIRE', 'New Hampshire', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('NJ', 110, '', 0, 'NEW JERSEY', 'New Jersey', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('NM', 110, '', 0, 'NEW MEXICO', 'New Mexico', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('NY', 110, '', 0, 'NEW YORK', 'New York', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('NC', 110, '', 0, 'NORTH CAROLIAN', 'North Carolina', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('ND', 110, '', 0, 'NORTH DAKOTA', 'North Dakota', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('OH', 110, '', 0, 'OHIO', 'Ohio', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('OK', 110, '', 0, 'OKLAHOMA', 'Oklahoma', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('OR', 110, '', 0, 'OREGON', 'Oregon', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('PA', 110, '', 0, 'PENNSYLVANIA', 'Pennsylvania', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('RI', 110, '', 0, 'RHODE ISLAND', 'Rhode Island', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('SC', 110, '', 0, 'SOUTH CAROLINA', 'South Carolina', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('SD', 110, '', 0, 'SOUTH DAKOTA', 'South Dakota', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('TN', 110, '', 0, 'TENNESSEE', 'Tennessee', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('TX', 110, '', 0, 'TEXAS', 'Texas', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('UT', 110, '', 0, 'UTAH', 'Utah', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('VT', 110, '', 0, 'VERMONT', 'Vermont', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('VA', 110, '', 0, 'VIRGINIA', 'Virginia', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('WA', 110, '', 0, 'WASHINGTON', 'Washington', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('WV', 110, '', 0, 'WEST VIRGINIA', 'West Virginia', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('WI', 110, '', 0, 'WISCONSIN', 'Wisconsin', 1);
+insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('WY', 110, '', 0, 'WYOMONG', 'Wyoming', 1);
+
-- 
GitLab