diff --git a/htdocs/adherents/canvas/actions_adherentcard_common.class.php b/htdocs/adherents/canvas/actions_adherentcard_common.class.php
index 658b266fcf3..d57b7ea093e 100644
--- a/htdocs/adherents/canvas/actions_adherentcard_common.class.php
+++ b/htdocs/adherents/canvas/actions_adherentcard_common.class.php
@@ -286,10 +286,10 @@ abstract class ActionsAdherentCardCommon
}
// Zip
- $this->tpl['select_zip'] = $formcompany->select_ziptown($this->object->zip,'zipcode',array('town','selectcountry_id','departement_id'),6);
+ $this->tpl['select_zip'] = $formcompany->select_ziptown($this->object->zip,'zipcode',array('town','selectcountry_id','state_id'),6);
// Town
- $this->tpl['select_town'] = $formcompany->select_ziptown($this->object->town,'town',array('zipcode','selectcountry_id','departement_id'));
+ $this->tpl['select_town'] = $formcompany->select_ziptown($this->object->town,'town',array('zipcode','selectcountry_id','state_id'));
if (dol_strlen(trim($this->object->country_id)) == 0) $this->object->country_id = $objsoc->country_id;
@@ -300,7 +300,7 @@ abstract class ActionsAdherentCardCommon
if ($user->admin) $this->tpl['info_admin'] = info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
// State
- if ($this->object->country_id) $this->tpl['select_state'] = $formcompany->select_state($this->object->fk_departement,$this->object->country_code);
+ if ($this->object->country_id) $this->tpl['select_state'] = $formcompany->select_state($this->object->state_id,$this->object->country_code);
else $this->tpl['select_state'] = $countrynotdefined;
// Physical or Moral
@@ -400,9 +400,8 @@ abstract class ActionsAdherentCardCommon
$this->object->address = $_POST["address"];
$this->object->zip = $_POST["zipcode"];
$this->object->town = $_POST["town"];
- $this->object->fk_departement = $_POST["departement_id"];
$this->object->country_id = $_POST["country_id"]?$_POST["country_id"]:$mysoc->country_id;
- $this->object->state_id = $_POST["departement_id"];
+ $this->object->state_id = $_POST["state_id"];
$this->object->phone_perso = $_POST["phone_perso"];
$this->object->phone_mobile = $_POST["phone_mobile"];
$this->object->email = $_POST["email"];
diff --git a/htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php b/htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php
index 84cb06e2093..58ac61c13f2 100644
--- a/htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php
+++ b/htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php
@@ -76,7 +76,7 @@ dol_htmloutput_errors($this->control->tpl['error'],$this->control->tpl['errors']
| trans('State'); ?> |
- control->tpl['departement']; ?> |
+ control->tpl['state']; ?> |
diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php
index 54f160adfa3..8cced5bd052 100644
--- a/htdocs/adherents/class/adherent.class.php
+++ b/htdocs/adherents/class/adherent.class.php
@@ -56,9 +56,6 @@ class Adherent extends CommonObject
var $state_id; // Id of department
var $state_code; // Code of department
var $state; // Label of department
- var $fk_departement; // deprecated
- var $departement_code; // deprecated
- var $departement; // deprecated
var $country_id;
var $country_code;
@@ -396,7 +393,7 @@ class Adherent extends CommonObject
$this->zip=($this->zip?$this->zip:$this->zip);
$this->town=($this->town?$this->town:$this->town);
$this->country_id=($this->country_id > 0?$this->country_id:$this->country_id);
- $this->state_id=($this->state_id > 0?$this->state_id:$this->fk_departement);
+ $this->state_id=($this->state_id > 0?$this->state_id:$this->state_id);
if (! empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->lastname=ucwords(trim($this->lastname));
if (! empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->firstname=ucwords(trim($this->firstname));
@@ -420,8 +417,8 @@ class Adherent extends CommonObject
$sql.= ", address=" .($this->address?"'".$this->db->escape($this->address)."'":"null");
$sql.= ", zip=" .($this->zip?"'".$this->db->escape($this->zip)."'":"null");
$sql.= ", town=" .($this->town?"'".$this->db->escape($this->town)."'":"null");
- $sql.= ", country=" .($this->country_id>0?"'".$this->country_id."'":"null");
- $sql.= ", fk_departement=".($this->state_id>0?"'".$this->state_id."'":"null");
+ $sql.= ", country=".($this->country_id>0?"'".$this->country_id."'":"null");
+ $sql.= ", state_id=".($this->state_id>0?"'".$this->state_id."'":"null");
$sql.= ", email='".$this->email."'";
$sql.= ", phone=" .($this->phone?"'".$this->db->escape($this->phone)."'":"null");
$sql.= ", phone_perso=" .($this->phone_perso?"'".$this->db->escape($this->phone_perso)."'":"null");
@@ -1014,14 +1011,14 @@ class Adherent extends CommonObject
$sql.= " d.naiss as datenaiss,";
$sql.= " d.datevalid as datev,";
$sql.= " d.country,";
- $sql.= " d.fk_departement,";
+ $sql.= " d.state_id,";
$sql.= " p.rowid as country_id, p.code as country_code, p.libelle as country,";
$sql.= " dep.nom as state, dep.code_departement as state_code,";
$sql.= " t.libelle as type, t.cotisation as cotisation,";
$sql.= " u.rowid as user_id, u.login as user_login";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as t, ".MAIN_DB_PREFIX."adherent as d";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_pays as p ON d.country = p.rowid";
- $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as dep ON d.fk_departement = dep.rowid";
+ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as dep ON d.state_id = dep.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON d.rowid = u.fk_member";
$sql.= " WHERE d.fk_adherent_type = t.rowid";
if ($rowid) $sql.= " AND d.rowid=".$rowid;
@@ -1053,12 +1050,9 @@ class Adherent extends CommonObject
$this->zip = $obj->zip;
$this->town = $obj->town;
- $this->state_id = $obj->fk_departement;
- $this->state_code = $obj->fk_departement?$obj->state_code:'';
- $this->state = $obj->fk_departement?$obj->state:'';
- $this->fk_departement = $obj->fk_departement; // deprecated
- $this->departement_code = $obj->fk_departement?$obj->state_code:''; // deprecated
- $this->departement = $obj->fk_departement?$obj->state:''; // deprecated
+ $this->state_id = $obj->state_id;
+ $this->state_code = $obj->state_id?$obj->state_code:'';
+ $this->state = $obj->state_id?$obj->state:'';
$this->country_id = $obj->country_id;
$this->country_code = $obj->country_code;
diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php
index 81e5158d90d..0159f5d93d5 100644
--- a/htdocs/adherents/fiche.php
+++ b/htdocs/adherents/fiche.php
@@ -260,9 +260,8 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->adherent->creer)
$object->address = trim($_POST["address"]);
$object->zip = trim($_POST["zipcode"]);
$object->town = trim($_POST["town"]);
- $object->state_id = $_POST["departement_id"];
+ $object->state_id = $_POST["state_id"];
$object->country_id = $_POST["country_id"];
- $object->fk_departement = $_POST["departement_id"]; // deprecated
$object->phone = trim($_POST["phone"]);
$object->phone_perso = trim($_POST["phone_perso"]);
@@ -410,7 +409,7 @@ if ($action == 'add' && $user->rights->adherent->creer)
$address=$_POST["address"];
$zip=$_POST["zipcode"];
$town=$_POST["town"];
- $state_id=$_POST["departement_id"];
+ $state_id=$_POST["state_id"];
$country_id=$_POST["country_id"];
$phone=$_POST["phone"];
@@ -435,7 +434,6 @@ if ($action == 'add' && $user->rights->adherent->creer)
$object->address = $address;
$object->zip = $zip;
$object->town = $town;
- $object->fk_departement = $state_id;
$object->state_id = $state_id;
$object->country_id = $country_id;
$object->phone = $phone;
@@ -721,7 +719,7 @@ else
/* */
/* ************************************************************************** */
$object->canvas=$canvas;
- $object->fk_departement = GETPOST('departement_id', 'int');
+ $object->state_id = GETPOST('departement_id', 'int');
// We set country_id, country_code and country for the selected country
$object->country_id=GETPOST('country_id','int')?GETPOST('country_id','int'):$mysoc->country_id;
@@ -833,9 +831,9 @@ else
// Zip / Town
print '
| '.$langs->trans("Zip").' / '.$langs->trans("Town").' | ';
- print $formcompany->select_ziptown((GETPOST('zipcode','alpha')?GETPOST('zipcode','alpha'):$object->zip),'zipcode',array('town','selectcountry_id','departement_id'),6);
+ print $formcompany->select_ziptown((GETPOST('zipcode','alpha')?GETPOST('zipcode','alpha'):$object->zip),'zipcode',array('town','selectcountry_id','state_id'),6);
print ' ';
- print $formcompany->select_ziptown((GETPOST('town','alpha')?GETPOST('town','alpha'):$object->town),'town',array('zipcode','selectcountry_id','departement_id'));
+ print $formcompany->select_ziptown((GETPOST('town','alpha')?GETPOST('town','alpha'):$object->town),'town',array('zipcode','selectcountry_id','state_id'));
print ' |
';
// Country
@@ -851,7 +849,7 @@ else
print '| '.$langs->trans('State').' | ';
if ($object->country_id)
{
- print $formcompany->select_state(GETPOST('departement_id','int')?GETPOST('departement_id','int'):$object->fk_departement,$object->country_code);
+ print $formcompany->select_state(GETPOST('state_id','int')?GETPOST('state_id','int'):$object->state_id,$object->country_code);
}
else
{
@@ -1083,9 +1081,9 @@ else
// Zip / Town
print ' |
| '.$langs->trans("Zip").' / '.$langs->trans("Town").' | ';
- print $formcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$object->zip),'zipcode',array('town','selectcountry_id','departement_id'),6);
+ print $formcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$object->zip),'zipcode',array('town','selectcountry_id','state_id'),6);
print ' ';
- print $formcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$object->town),'town',array('zipcode','selectcountry_id','departement_id'));
+ print $formcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$object->town),'town',array('zipcode','selectcountry_id','state_id'));
print ' |
';
// Country
@@ -1099,7 +1097,7 @@ else
if (empty($conf->global->MEMBER_DISABLE_STATE))
{
print '| '.$langs->trans('State').' | ';
- print $formcompany->select_state($object->fk_departement,isset($_POST["country_id"])?$_POST["country_id"]:$object->country_id);
+ print $formcompany->select_state($object->state_id,isset($_POST["country_id"])?$_POST["country_id"]:$object->country_id);
print ' |
';
}
@@ -1432,7 +1430,7 @@ else
print '';
// State
- print '| '.$langs->trans('State').' | '.$object->departement.' | ';
+ print '
| '.$langs->trans('State').' | '.$object->state.' | ';
// Tel pro.
print '
| '.$langs->trans("PhonePro").' | '.dol_print_phone($object->phone,$object->country_code,0,$object->fk_soc,1).' |
';
diff --git a/htdocs/adherents/stats/geo.php b/htdocs/adherents/stats/geo.php
index f04173c00b9..2595136a33e 100755
--- a/htdocs/adherents/stats/geo.php
+++ b/htdocs/adherents/stats/geo.php
@@ -85,7 +85,7 @@ if ($mode)
$data = array();
$sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, p.code, p.libelle as label, c.nom as label2";
- $sql.=" FROM ".MAIN_DB_PREFIX."adherent as d LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c on d.fk_departement = c.rowid";
+ $sql.=" FROM ".MAIN_DB_PREFIX."adherent as d LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c on d.state_id = c.rowid";
$sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_regions as r on c.fk_region = r.code_region";
$sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_pays as p on d.country = p.rowid";
$sql.=" WHERE d.entity IN (".getEntity().")";
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 0b74e32c3c4..056bffa3d9f 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
@@ -60,6 +60,7 @@ alter table llx_adherent CHANGE COLUMN prenom firstname varchar(50);
alter table llx_adherent CHANGE COLUMN ville town text;
alter table llx_adherent CHANGE COLUMN cp zip varchar(10);
alter table llx_adherent CHANGE COLUMN pays country varchar(50);
+alter table llx_adherent CHANGE COLUMN fk_departement state_id varchar(50);
alter table llx_mailing_cibles CHANGE COLUMN nom lastname varchar(50);
alter table llx_mailing_cibles CHANGE COLUMN prenom firstname varchar(50);
alter table llx_user CHANGE COLUMN name lastname varchar(50);