diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php
index 6e5dd2aabae..55ad5902e13 100644
--- a/htdocs/admin/company.php
+++ b/htdocs/admin/company.php
@@ -68,7 +68,7 @@ if ( ($action == 'update' && empty($_POST["cancel"]))
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ADDRESS",$_POST["address"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TOWN",$_POST["town"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ZIP",$_POST["zipcode"],'chaine',0,'',$conf->entity);
- dolibarr_set_const($db, "MAIN_INFO_SOCIETE_DEPARTEMENT",$_POST["departement_id"],'chaine',0,'',$conf->entity);
+ dolibarr_set_const($db, "MAIN_INFO_SOCIETE_STATE",$_POST["state_id"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_MONNAIE",$_POST["currency"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TEL",$_POST["tel"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FAX",$_POST["fax"],'chaine',0,'',$conf->entity);
@@ -296,7 +296,7 @@ if ($action == 'edit' || $action == 'updateedit')
$var=!$var;
print '
'.$langs->trans("State").' ';
- $formcompany->select_departement($conf->global->MAIN_INFO_SOCIETE_DEPARTEMENT,$mysoc->country_code,'departement_id');
+ $formcompany->select_departement($conf->global->MAIN_INFO_SOCIETE_STATE,$mysoc->country_code,'state_id');
print ' '."\n";
$var=!$var;
@@ -667,7 +667,7 @@ else
$var=!$var;
print ''.$langs->trans("State").' ';
- if (! empty($conf->global->MAIN_INFO_SOCIETE_DEPARTEMENT)) print getState($conf->global->MAIN_INFO_SOCIETE_DEPARTEMENT);
+ if (! empty($conf->global->MAIN_INFO_SOCIETE_STATE)) print getState($conf->global->MAIN_INFO_SOCIETE_STATE);
else print ' ';
print ' ';
diff --git a/htdocs/comm/prospect/list.php b/htdocs/comm/prospect/list.php
index 727932c0f40..6684b2d0f0d 100755
--- a/htdocs/comm/prospect/list.php
+++ b/htdocs/comm/prospect/list.php
@@ -41,8 +41,8 @@ $socname = GETPOST("socname",'alpha');
$stcomm = GETPOST("stcomm",'int');
$search_nom = GETPOST("search_nom");
$search_zipcode = GETPOST("search_zipcode");
-$search_town = GETPOST("search_town");
-$search_departement = GETPOST("search_departement");
+$search_town = GETPOST("search_town");
+$search_state = GETPOST("search_state");
$search_datec = GETPOST("search_datec");
$search_categ = GETPOST("search_categ",'int');
$catid = GETPOST("catid",'int');
@@ -195,7 +195,7 @@ if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL";
if ($search_nom) $sql .= " AND s.nom LIKE '%".$db->escape(strtolower($search_nom))."%'";
if ($search_zipcode) $sql .= " AND s.zip LIKE '".$db->escape(strtolower($search_zipcode))."%'";
if ($search_town) $sql .= " AND s.town LIKE '%".$db->escape(strtolower($search_town))."%'";
-if ($search_departement) $sql .= " AND d.nom LIKE '%".$db->escape(strtolower($search_departement))."%'";
+if ($search_state) $sql .= " AND d.nom LIKE '%".$db->escape(strtolower($search_state))."%'";
if ($search_datec) $sql .= " AND s.datec LIKE '%".$db->escape($search_datec)."%'";
// Insert levels filters
if ($search_levels)
@@ -318,7 +318,7 @@ if ($resql)
print ' ';
print '';
print '';
- print ' ';
+ print ' ';
print ' ';
print '';
print ' ';
diff --git a/htdocs/compta/bank/bankid_fr.php b/htdocs/compta/bank/bankid_fr.php
index 61d3cf0feb5..31d929dfed5 100644
--- a/htdocs/compta/bank/bankid_fr.php
+++ b/htdocs/compta/bank/bankid_fr.php
@@ -65,7 +65,7 @@ if ($action == 'update' && ! $_POST["cancel"])
$account->domiciliation = trim($_POST["domiciliation"]);
$account->proprio = trim($_POST["proprio"]);
$account->owner_address = trim($_POST["owner_address"]);
- $account->fk_departement = trim($_POST["fk_departement"]);
+ $account->state_id = trim($_POST["state_id"]);
//$account->country_id = trim($_POST["country_id"]); // We do not change this.
if ($account->id)
diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php
index 3e216787c1a..21a669d618a 100644
--- a/htdocs/compta/bank/class/account.class.php
+++ b/htdocs/compta/bank/class/account.class.php
@@ -62,10 +62,6 @@ class Account extends CommonObject
var $proprio;
var $owner_address;
-
- var $fk_departement; // deprecated
- var $departement_code; // deprecated
- var $departement; // deprecated
var $state_id;
var $state_code;
var $state;
@@ -351,7 +347,7 @@ class Account extends CommonObject
// Clean parameters
if (! $this->min_allowed) $this->min_allowed=0;
if (! $this->min_desired) $this->min_desired=0;
- $this->state_id = ($this->state_id?$this->state_id:$this->fk_departement);
+ $this->state_id = ($this->state_id?$this->state_id:$this->state_id);
$this->country_id = ($this->country_id?$this->country_id:$this->country_id);
// Check parameters
@@ -390,7 +386,7 @@ class Account extends CommonObject
$sql.= ", min_allowed";
$sql.= ", min_desired";
$sql.= ", comment";
- $sql.= ", fk_departement";
+ $sql.= ", state_id";
$sql.= ", fk_pays";
$sql.= ") VALUES (";
$sql.= "'".$this->db->idate($now)."'";
@@ -475,7 +471,7 @@ class Account extends CommonObject
// Clean parameters
if (! $this->min_allowed) $this->min_allowed=0;
if (! $this->min_desired) $this->min_desired=0;
- $this->state_id = ($this->state_id?$this->state_id:$this->fk_departement);
+ $this->state_id = ($this->state_id?$this->state_id:$this->state_id);
$this->country_id = ($this->country_id?$this->country_id:$this->country_id);
// Check parameters
@@ -510,7 +506,7 @@ class Account extends CommonObject
$sql.= ",min_desired = '".price2num($this->min_desired)."'";
$sql.= ",comment = '".$this->db->escape($this->comment)."'";
- $sql.= ",fk_departement = ".($this->state_id>0?"'".$this->state_id."'":"null");
+ $sql.= ",state_id = ".($this->state_id>0?"'".$this->state_id."'":"null");
$sql.= ",fk_pays = ".$this->country_id;
$sql.= " WHERE rowid = ".$this->id;
@@ -542,7 +538,7 @@ class Account extends CommonObject
global $conf,$langs;
// Clean parameters
- $this->state_id = ($this->state_id?$this->state_id:$this->fk_departement);
+ $this->state_id = ($this->state_id?$this->state_id:$this->state_id);
$this->country_id = ($this->country_id?$this->country_id:$this->country_id);
// Chargement librairie pour acces fonction controle RIB
@@ -568,7 +564,7 @@ class Account extends CommonObject
$sql.= ",domiciliation='".$this->db->escape($this->domiciliation)."'";
$sql.= ",proprio = '".$this->db->escape($this->proprio)."'";
$sql.= ",owner_address = '".$this->db->escape($this->owner_address)."'";
- $sql.= ",fk_departement = ".($this->state_id>0?"'".$this->state_id."'":"null");
+ $sql.= ",state_id = ".($this->state_id>0?"'".$this->state_id."'":"null");
$sql.= ",fk_pays = ".$this->country_id;
$sql.= " WHERE rowid = ".$this->id;
$sql.= " AND entity = ".$conf->entity;
@@ -608,14 +604,14 @@ class Account extends CommonObject
$sql = "SELECT ba.rowid, ba.ref, ba.label, ba.bank, ba.number, ba.courant, ba.clos, ba.rappro, ba.url,";
$sql.= " ba.code_banque, ba.code_guichet, ba.cle_rib, ba.bic, ba.iban_prefix as iban,";
- $sql.= " ba.domiciliation, ba.proprio, ba.owner_address, ba.fk_departement, ba.fk_pays as country_id,";
+ $sql.= " ba.domiciliation, ba.proprio, ba.owner_address, ba.state_id, ba.fk_pays as country_id,";
$sql.= " ba.account_number, ba.currency_code,";
$sql.= " ba.min_allowed, ba.min_desired, ba.comment,";
$sql.= ' p.code as country_code, p.libelle as country,';
$sql.= ' d.code_departement as state_code, d.nom as state';
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account as ba";
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_pays as p ON ba.fk_pays = p.rowid';
- $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON ba.fk_departement = d.rowid';
+ $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON ba.state_id = d.rowid';
$sql.= " WHERE entity = ".$conf->entity;
if ($id) $sql.= " AND ba.rowid = ".$id;
if ($ref) $sql.= " AND ba.ref = '".$this->db->escape($ref)."'";
@@ -650,10 +646,7 @@ class Account extends CommonObject
$this->proprio = $obj->proprio;
$this->owner_address = $obj->owner_address;
- $this->fk_departement = $obj->fk_departement; // deprecated
- $this->departement_code= $obj->state_code; // deprecated
- $this->departement = $obj->state; // deprecated
- $this->state_id = $obj->fk_departement;
+ $this->state_id = $obj->state_id;
$this->state_code = $obj->state_code;
$this->state = $obj->state;
diff --git a/htdocs/compta/bank/fiche.php b/htdocs/compta/bank/fiche.php
index e7d93fb94d7..b811e35f7d7 100644
--- a/htdocs/compta/bank/fiche.php
+++ b/htdocs/compta/bank/fiche.php
@@ -69,7 +69,7 @@ if ($_POST["action"] == 'add')
$account->currency_code = trim($_POST["account_currency_code"]);
- $account->fk_departement = $_POST["account_departement_id"];
+ $account->state_id = $_POST["account_departement_id"];
$account->country_id = $_POST["account_country_id"];
$account->min_allowed = $_POST["account_min_allowed"];
@@ -140,7 +140,7 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"])
$account->currency_code = trim($_POST["account_currency_code"]);
- $account->state_id = $_POST["account_departement_id"];
+ $account->state_id = $_POST["account_state_id"];
$account->country_id = $_POST["account_country_id"];
$account->min_allowed = $_POST["account_min_allowed"];
@@ -282,7 +282,7 @@ if ($action == 'create')
print ' '.$langs->trans('State').' ';
if ($selectedcode)
{
- $formcompany->select_departement(isset($_POST["account_departement_id"])?$_POST["account_departement_id"]:'',$selectedcode,'account_departement_id');
+ $formcompany->select_departement(isset($_POST["account_state_id"])?$_POST["account_state_id"]:'',$selectedcode,'account_state_id');
}
else
{
@@ -555,7 +555,7 @@ else
print ' '.$langs->trans('State').' ';
if ($selectedcode)
{
- print $formcompany->select_state(isset($_POST["account_departement_id"])?$_POST["account_departement_id"]:$account->fk_departement,$selectedcode,'account_departement_id');
+ print $formcompany->select_state(isset($_POST["account_state_id"])?$_POST["account_state_id"]:$account->state_id,$selectedcode,'account_state_id');
}
else
{
diff --git a/htdocs/compta/dons/fiche.php b/htdocs/compta/dons/fiche.php
index b87634d0997..7057b97f21e 100644
--- a/htdocs/compta/dons/fiche.php
+++ b/htdocs/compta/dons/fiche.php
@@ -301,9 +301,9 @@ if ($action == 'create')
// Zip / Town
print ' '.$langs->trans("Zip").' / '.$langs->trans("Town").' ';
- print $formcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$don->zip),'zipcode',array('town','selectcountry_id','departement_id'),6);
+ print $formcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$don->zip),'zipcode',array('town','selectcountry_id','state_id'),6);
print ' ';
- print $formcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$don->town),'town',array('zipcode','selectcountry_id','departement_id'));
+ print $formcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$don->town),'town',array('zipcode','selectcountry_id','state_id'));
print ' ';
print "".''.$langs->trans("Country").' ';
@@ -391,9 +391,9 @@ if (! empty($id) && $action == 'edit')
// Zip / Town
print ''.$langs->trans("Zip").' / '.$langs->trans("Town").' ';
- print $formcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$don->zip),'zipcode',array('town','selectcountry_id','departement_id'),6);
+ print $formcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$don->zip),'zipcode',array('town','selectcountry_id','state_id'),6);
print ' ';
- print $formcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$don->town),'town',array('zipcode','selectcountry_id','departement_id'));
+ print $formcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$don->town),'town',array('zipcode','selectcountry_id','state_id'));
print ' ';
print "".''.$langs->trans("Country").' ';
diff --git a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql
index 056bffa3d9f..18e984858ed 100755
--- a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql
+++ b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql
@@ -35,6 +35,7 @@ UPDATE llx_const set name='MAIN_INFO_SOCIETE_ADDRESS' where name='MAIN_INFO_SOCI
UPDATE llx_const set name='MAIN_INFO_SOCIETE_TOWN' where name='MAIN_INFO_SOCIETE_VILLE';
UPDATE llx_const set name='MAIN_INFO_SOCIETE_ZIP' where name='MAIN_INFO_SOCIETE_CP';
UPDATE llx_const set name='MAIN_INFO_SOCIETE_COUNTRY' where name='MAIN_INFO_SOCIETE_PAYS';
+UPDATE llx_const set name='MAIN_INFO_SOCIETE_STATE' where name='MAIN_INFO_SOCIETE_DEPARTEMENT';
ALTER TABLE llx_user add COLUMN fk_user integer;
@@ -72,6 +73,7 @@ alter table llx_socpeople CHANGE COLUMN name lastname varchar(50);
alter table llx_socpeople CHANGE COLUMN ville town text;
alter table llx_socpeople CHANGE COLUMN cp zip varchar(10);
alter table llx_bank_account CHANGE COLUMN adresse_proprio owner_address text;
+alter table llx_bank_account CHANGE COLUMN fk_departement state_id varchar(50);
alter table llx_societe_rib CHANGE COLUMN adresse_proprio owner_address text;
alter table llx_societe_address CHANGE COLUMN ville town text;
alter table llx_societe_address CHANGE COLUMN cp zip varchar(10);