Qual: Uniformize fields departement_id into state_id

This commit is contained in:
Laurent Destailleur 2013-09-20 14:34:14 +02:00
parent 0315cfdac6
commit dd0612099c
11 changed files with 30 additions and 32 deletions

View File

@ -691,7 +691,7 @@ else
/* */
/* ************************************************************************** */
$object->canvas=$canvas;
$object->state_id = GETPOST('departement_id', 'int');
$object->state_id = GETPOST('state_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;

View File

@ -71,7 +71,7 @@ if ($_POST["action"] == 'add')
$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"];

View File

@ -285,10 +285,10 @@ abstract class ActionsContactCardCommon
}
// 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;
@ -432,9 +432,9 @@ abstract class ActionsContactCardCommon
$this->object->address = $_POST["address"];
$this->object->zip = $_POST["zipcode"];
$this->object->town = $_POST["town"];
$this->object->fk_departement = $_POST["departement_id"];
$this->object->fk_departement = $_POST["state_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_pro = $_POST["phone_pro"];
$this->object->phone_perso = $_POST["phone_perso"];
$this->object->phone_mobile = $_POST["phone_mobile"];

View File

@ -116,7 +116,6 @@ if (! empty($_GET['zipcode']) || ! empty($_GET['town']))
$row_array['value'] = $row['town'];
$row_array['zipcode'] = $row['zip'];
}
$row_array['departement_id'] = $row['fk_county']; // deprecated
$row_array['selectcountry_id'] = $row['fk_country'];
$row_array['state_id'] = $row['fk_county'];

View File

@ -191,7 +191,7 @@ class FormCompany
* @param string $htmlname Id of department
* @return void
*/
function select_departement($selected='',$country_codeid=0, $htmlname='departement_id')
function select_departement($selected='',$country_codeid=0, $htmlname='state_id')
{
print $this->select_state($selected,$country_codeid, $htmlname);
}
@ -208,7 +208,7 @@ class FormCompany
* @param string $htmlname Id of department
* @return string String with HTML select
*/
function select_state($selected='',$country_codeid=0, $htmlname='departement_id')
function select_state($selected='',$country_codeid=0, $htmlname='state_id')
{
global $conf,$langs,$user;

View File

@ -210,7 +210,7 @@ function ajax_multiautocompleter($htmlname,$fields,$url,$option='',$minLength=2,
jQuery("#'.$htmlname.'").val(item.value);
// TODO move this to specific request
if (item.states) {
jQuery("#departement_id").html(item.states);
jQuery("#state_id").html(item.states);
}
for (i=0;i<length;i++) {
if (item[fields[i]]) { // If defined
@ -233,12 +233,12 @@ function ajax_multiautocompleter($htmlname,$fields,$url,$option='',$minLength=2,
{
jQuery("#" + fields[i]).val(ui.item[fields[i]]);
// If we set new country and new state, we need to set a new list of state to allow change
if (ui.item.states && ui.item["departement_id"] != jQuery("#departement_id").value) {
jQuery("#departement_id").html(ui.item.states);
if (ui.item.states && ui.item["state_id"] != jQuery("#state_id").value) {
jQuery("#state_id").html(ui.item.states);
}
}
}
else if (fields[i]=="state_id" || fields[i]=="departement_id")
else if (fields[i]=="state_id" || fields[i]=="state_id")
{
if (ui.item[fields[i]] > 0) // Do not erase state if unknown
{

View File

@ -191,9 +191,9 @@ if ($action == 'create')
// Zip / Town
print '<tr><td>'.$langs->trans('Zip').'</td><td>';
print $formcompany->select_ziptown($object->zip,'zipcode',array('town','selectcountry_id','departement_id'),6);
print $formcompany->select_ziptown($object->zip,'zipcode',array('town','selectcountry_id','state_id'),6);
print '</td><td>'.$langs->trans('Town').'</td><td>';
print $formcompany->select_ziptown($object->town,'town',array('zipcode','selectcountry_id','departement_id'));
print $formcompany->select_ziptown($object->town,'town',array('zipcode','selectcountry_id','state_id'));
print '</td></tr>';
// Country
@ -510,9 +510,9 @@ else
// Zip / Town
print '<tr><td>'.$langs->trans('Zip').'</td><td>';
print $formcompany->select_ziptown($object->zip,'zipcode',array('town','selectcountry_id','departement_id'),6);
print $formcompany->select_ziptown($object->zip,'zipcode',array('town','selectcountry_id','state_id'),6);
print '</td><td>'.$langs->trans('Town').'</td><td>';
print $formcompany->select_ziptown($object->town,'town',array('zipcode','selectcountry_id','departement_id'));
print $formcompany->select_ziptown($object->town,'town',array('zipcode','selectcountry_id','state_id'));
print '</td></tr>';
// Country

View File

@ -133,7 +133,7 @@ abstract class ActionsCardCommon
$this->object->zip = $_POST["zipcode"];
$this->object->town = $_POST["town"];
$this->object->country_id = $_POST["country_id"];
$this->object->state_id = $_POST["departement_id"];
$this->object->state_id = $_POST["state_id"];
$this->object->tel = $_POST["tel"];
$this->object->fax = $_POST["fax"];
$this->object->email = trim($_POST["email"]);
@ -483,10 +483,10 @@ abstract class ActionsCardCommon
}
// 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'));
// Country
$this->object->country_id = ($this->object->country_id ? $this->object->country_id : $mysoc->country_id);
@ -670,7 +670,7 @@ abstract class ActionsCardCommon
$this->object->zip = $_POST["zipcode"];
$this->object->town = $_POST["town"];
$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->tel = $_POST["tel"];
$this->object->fax = $_POST["fax"];
$this->object->email = $_POST["email"];

View File

@ -54,10 +54,9 @@ class Societe extends CommonObject
var $town;
var $status; // 0=activity ceased, 1= in activity
var $state_id;
var $state_id; // Id of department
var $state_code;
var $state;
var $departement_id; // deprecated
var $departement_code; // deprecated
var $departement; // deprecated

View File

@ -129,7 +129,7 @@ if (empty($reshook))
$object->zip = GETPOST('zipcode');
$object->town = GETPOST('town');
$object->country_id = GETPOST('country_id');
$object->state_id = GETPOST('departement_id');
$object->state_id = GETPOST('state_id');
$object->phone = GETPOST('phone');
$object->fax = GETPOST('fax');
$object->email = GETPOST('email');
@ -588,7 +588,7 @@ else
$object->address = GETPOST('address');
$object->zip = GETPOST('zipcode');
$object->town = GETPOST('town');
$object->state_id = GETPOST('departement_id');
$object->state_id = GETPOST('state_id');
$object->phone = GETPOST('phone');
$object->fax = GETPOST('fax');
$object->email = GETPOST('email');
@ -812,9 +812,9 @@ else
// Zip / Town
print '<tr><td>'.$langs->trans('Zip').'</td><td>';
print $formcompany->select_ziptown($object->zip,'zipcode',array('town','selectcountry_id','departement_id'),6);
print $formcompany->select_ziptown($object->zip,'zipcode',array('town','selectcountry_id','state_id'),6);
print '</td><td>'.$langs->trans('Town').'</td><td>';
print $formcompany->select_ziptown($object->town,'town',array('zipcode','selectcountry_id','departement_id'));
print $formcompany->select_ziptown($object->town,'town',array('zipcode','selectcountry_id','state_id'));
print '</td></tr>';
// Country
@ -827,7 +827,7 @@ else
if (empty($conf->global->SOCIETE_DISABLE_STATE))
{
print '<tr><td>'.$langs->trans('State').'</td><td colspan="3">';
if ($object->country_id) print $formcompany->select_state($object->state_id,$object->country_code,'departement_id');
if ($object->country_id) print $formcompany->select_state($object->state_id,$object->country_code,'state_id');
else print $countrynotdefined;
print '</td></tr>';
}
@ -1069,7 +1069,7 @@ else
$object->zip = GETPOST('zipcode');
$object->town = GETPOST('town');
$object->country_id = GETPOST('country_id')?GETPOST('country_id'):$mysoc->country_id;
$object->state_id = GETPOST('departement_id');
$object->state_id = GETPOST('state_id');
$object->phone = GETPOST('phone');
$object->fax = GETPOST('fax');
$object->email = GETPOST('email');
@ -1230,9 +1230,9 @@ else
// Zip / Town
print '<tr><td>'.$langs->trans('Zip').'</td><td>';
print $formcompany->select_ziptown($object->zip,'zipcode',array('town','selectcountry_id','departement_id'),6);
print $formcompany->select_ziptown($object->zip,'zipcode',array('town','selectcountry_id','state_id'),6);
print '</td><td>'.$langs->trans('Town').'</td><td>';
print $formcompany->select_ziptown($object->town,'town',array('zipcode','selectcountry_id','departement_id'));
print $formcompany->select_ziptown($object->town,'town',array('zipcode','selectcountry_id','state_id'));
print '</td></tr>';
// Country

View File

@ -38,7 +38,7 @@
</tr>
<tr>
<td>select</td>
<td>departement_id</td>
<td>state_id</td>
<td>label=01 - Ain</td>
</tr>
<tr>