diff --git a/ChangeLog b/ChangeLog
index 08d53ea7cdb..ca9b4daba2f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -72,6 +72,7 @@ For developers:
- New: [ Task #1495 ] Add trigger LINECONTRACT_CREATE.
- New: Added hook "formConfirm" and "doActions" for supplier invoice card
- New: [ task #1511, #1426 ] Added hook "doActions" for supplier card and supplier order card
+- New: renamed table llx_c_pays to llx_c_country & libelle field to label
WARNING: Following change may create regression for some external modules, but was necessary to make
Dolibarr better:
diff --git a/htdocs/adherents/canvas/actions_adherentcard_common.class.php b/htdocs/adherents/canvas/actions_adherentcard_common.class.php
index fc593e826f2..9bd164a9b32 100644
--- a/htdocs/adherents/canvas/actions_adherentcard_common.class.php
+++ b/htdocs/adherents/canvas/actions_adherentcard_common.class.php
@@ -412,7 +412,7 @@ abstract class ActionsAdherentCardCommon
// We set country_id, and country_code label of the chosen country
if ($this->object->country_id)
{
- $sql = "SELECT code, libelle FROM ".MAIN_DB_PREFIX."c_pays WHERE rowid = ".$this->object->country_id;
+ $sql = "SELECT code, label FROM ".MAIN_DB_PREFIX."c_country WHERE rowid = ".$this->object->country_id;
$resql=$this->db->query($sql);
if ($resql)
{
diff --git a/htdocs/adherents/cartes/carte.php b/htdocs/adherents/cartes/carte.php
index ade8f059810..98f5e908e16 100644
--- a/htdocs/adherents/cartes/carte.php
+++ b/htdocs/adherents/cartes/carte.php
@@ -64,9 +64,9 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg
$sql = "SELECT d.rowid, d.firstname, d.lastname, d.login, d.societe as company, d.datefin,";
$sql.= " d.address, d.zip, d.town, d.country, d.birth, d.email, d.photo,";
$sql.= " t.libelle as type,";
- $sql.= " p.code as country_code, p.libelle as country";
+ $sql.= " c.code as country_code, c.label as country";
$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_country as c ON d.country = c.rowid";
$sql.= " WHERE d.fk_adherent_type = t.rowid AND d.statut = 1";
if (is_numeric($foruserid)) $sql.=" AND d.rowid=".$foruserid;
if ($foruserlogin) $sql.=" AND d.login='".$db->escape($foruserlogin)."'";
diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php
index 4bee90b7a50..e33a8577685 100644
--- a/htdocs/adherents/class/adherent.class.php
+++ b/htdocs/adherents/class/adherent.class.php
@@ -1058,12 +1058,12 @@ class Adherent extends CommonObject
$sql.= " d.datevalid as datev,";
$sql.= " d.country,";
$sql.= " d.state_id,";
- $sql.= " p.rowid as country_id, p.code as country_code, p.libelle as country,";
+ $sql.= " c.rowid as country_id, c.code as country_code, c.label 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_country as c ON d.country = p.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";
diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php
index 49eabe52d43..00ef238c79a 100644
--- a/htdocs/adherents/fiche.php
+++ b/htdocs/adherents/fiche.php
@@ -945,7 +945,7 @@ else
$country=GETPOST('country','int');
if (!empty($country) || $object->country_id)
{
- $sql = "SELECT rowid, code, libelle as label from ".MAIN_DB_PREFIX."c_pays where rowid = ".(!empty($country)?$country:$object->country_id);
+ $sql = "SELECT rowid, code, label from ".MAIN_DB_PREFIX."c_country where rowid = ".(!empty($country)?$country:$object->country_id);
$resql=$db->query($sql);
if ($resql)
{
diff --git a/htdocs/adherents/stats/geo.php b/htdocs/adherents/stats/geo.php
index ecf27f78465..736f6ef0140 100644
--- a/htdocs/adherents/stats/geo.php
+++ b/htdocs/adherents/stats/geo.php
@@ -76,11 +76,11 @@ if ($mode)
$tab='statscountry';
$data = array();
- $sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, c.code, c.libelle as label";
- $sql.=" FROM ".MAIN_DB_PREFIX."adherent as d LEFT JOIN ".MAIN_DB_PREFIX."c_pays as c on d.country = c.rowid";
+ $sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, c.code, c.label";
+ $sql.=" FROM ".MAIN_DB_PREFIX."adherent as d LEFT JOIN ".MAIN_DB_PREFIX."c_country as c on d.country = c.rowid";
$sql.=" WHERE d.entity IN (".getEntity().")";
$sql.=" AND d.statut = 1";
- $sql.=" GROUP BY c.libelle, c.code";
+ $sql.=" GROUP BY c.label, c.code";
//print $sql;
}
@@ -91,29 +91,29 @@ if ($mode)
$tab='statsstate';
$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.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, co.code, co.label, c.nom as label2"; //
$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.=" LEFT JOIN ".MAIN_DB_PREFIX."c_country as co on d.country = co.rowid";
$sql.=" WHERE d.entity IN (".getEntity().")";
$sql.=" AND d.statut = 1";
- $sql.=" GROUP BY p.libelle, p.code, c.nom";
+ $sql.=" GROUP BY co.label, co.code, c.nom";
//print $sql;
}
if ($mode == 'memberbyregion') //
{
- $label=$langs->trans("Country"); //pays
+ $label=$langs->trans("Country");
$label2=$langs->trans("Region"); //département
$tab='statsregion'; //onglet
$data = array(); //tableau de donnée
- $sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, p.code, p.libelle as label, r.nom as label2";
+ $sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, co.code, co.label, r.nom as label2";
$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.=" LEFT JOIN ".MAIN_DB_PREFIX."c_country as co on d.country = co.rowid";
$sql.=" WHERE d.entity IN (".getEntity().")";
$sql.=" AND d.statut = 1";
- $sql.=" GROUP BY p.libelle, p.code, r.nom"; //+
+ $sql.=" GROUP BY co.label, co.code, r.nom"; //+
//print $sql;
}
if ($mode == 'memberbytown')
@@ -123,12 +123,12 @@ if ($mode)
$tab='statstown';
$data = array();
- $sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, p.code, p.libelle as label, d.town as label2";
+ $sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, c.code, c.label, d.town as label2";
$sql.=" FROM ".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_country as c on d.country = c.rowid";
$sql.=" WHERE d.entity IN (".getEntity().")";
$sql.=" AND d.statut = 1";
- $sql.=" GROUP BY p.libelle, p.code, d.town";
+ $sql.=" GROUP BY c.label, c.code, d.town";
//print $sql;
}
diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php
index c69f269f301..c774faf5caa 100644
--- a/htdocs/admin/company.php
+++ b/htdocs/admin/company.php
@@ -318,7 +318,7 @@ if ($action == 'edit' || $action == 'updateedit')
// Country
$var=!$var;
print '
';
- //if (empty($country_selected)) $country_selected=substr($langs->defaultlang,-2); // Par defaut, pays de la localisation
+ //if (empty($country_selected)) $country_selected=substr($langs->defaultlang,-2); // By default, country of localization
print $form->select_country($mysoc->country_id,'country_id');
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
print '
'."\n";
diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php
index 7075b601877..2b5fc6c0bd7 100644
--- a/htdocs/admin/dict.php
+++ b/htdocs/admin/dict.php
@@ -77,7 +77,7 @@ $tabname=array();
$tabname[1] = MAIN_DB_PREFIX."c_forme_juridique";
$tabname[2] = MAIN_DB_PREFIX."c_departements";
$tabname[3] = MAIN_DB_PREFIX."c_regions";
-$tabname[4] = MAIN_DB_PREFIX."c_pays";
+$tabname[4] = MAIN_DB_PREFIX."c_country";
$tabname[5] = MAIN_DB_PREFIX."c_civilite";
$tabname[6] = MAIN_DB_PREFIX."c_actioncomm";
$tabname[7] = MAIN_DB_PREFIX."c_chargesociales";
@@ -132,20 +132,20 @@ $tablib[26]= "DictionaryResourceType";
// Requests to extract data
$tabsql=array();
-$tabsql[1] = "SELECT f.rowid as rowid, f.code, f.libelle, p.code as country_code, p.libelle as country, 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.code as country_code, p.libelle as country, 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, r.code_region as code, r.nom as libelle, r.fk_pays as country_id, p.code as country_code, p.libelle as country, 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[1] = "SELECT f.rowid as rowid, f.code, f.libelle, c.code as country_code, c.label as country, f.active FROM ".MAIN_DB_PREFIX."c_forme_juridique as f, ".MAIN_DB_PREFIX."c_country as c WHERE f.fk_pays=c.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, c.code as country_code, c.label as country, d.active FROM ".MAIN_DB_PREFIX."c_departements as d, ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_country as c WHERE d.fk_region=r.code_region and r.fk_pays=c.rowid and r.active=1 and c.active=1";
+$tabsql[3] = "SELECT r.rowid as rowid, r.code_region as code, r.nom as libelle, r.fk_pays as country_id, c.code as country_code, c.label as country, r.active FROM ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_country as c WHERE r.fk_pays=c.rowid and c.active=1";
+$tabsql[4] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_country";
$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, a.module, a.position FROM ".MAIN_DB_PREFIX."c_actioncomm AS a";
-$tabsql[7] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.accountancy_code as accountancy_code, a.deductible, p.code as country_code, p.libelle as country, a.fk_pays as country_id, a.active FROM ".MAIN_DB_PREFIX."c_chargesociales AS a, ".MAIN_DB_PREFIX."c_pays as p WHERE a.fk_pays=p.rowid and p.active=1";
-$tabsql[8] = "SELECT t.id as rowid, t.code as code, t.libelle, t.fk_country as country_id, p.code as country_code, p.libelle as country, t.active FROM ".MAIN_DB_PREFIX."c_typent as t LEFT JOIN ".MAIN_DB_PREFIX."c_pays as p ON t.fk_country=p.rowid";
+$tabsql[7] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.accountancy_code as accountancy_code, a.deductible, c.code as country_code, c.label as country, a.fk_pays as country_id, a.active FROM ".MAIN_DB_PREFIX."c_chargesociales AS a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_pays=c.rowid and c.active=1";
+$tabsql[8] = "SELECT t.id as rowid, t.code as code, t.libelle, t.fk_country as country_id, c.code as country_code, c.label as country, t.active FROM ".MAIN_DB_PREFIX."c_typent as t LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON t.fk_country=c.rowid";
$tabsql[9] = "SELECT code_iso as code, label, unicode, active FROM ".MAIN_DB_PREFIX."c_currencies";
-$tabsql[10]= "SELECT t.rowid, t.taux, t.localtax1_type, t.localtax1, t.localtax2_type, t.localtax2, p.libelle as country, p.code as country_code, t.fk_pays as country_id, t.recuperableonly, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p WHERE t.fk_pays=p.rowid";
+$tabsql[10]= "SELECT t.rowid, t.taux, t.localtax1_type, t.localtax1, t.localtax2_type, t.localtax2, c.label as country, c.code as country_code, t.fk_pays as country_id, t.recuperableonly, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid";
$tabsql[11]= "SELECT t.rowid as rowid, element, source, code, libelle, active FROM ".MAIN_DB_PREFIX."c_type_contact AS t";
$tabsql[12]= "SELECT c.rowid as rowid, code, sortorder, c.libelle, c.libelle_facture, nbjour, fdm, decalage, active FROM ".MAIN_DB_PREFIX.'c_payment_term AS c';
$tabsql[13]= "SELECT id as rowid, code, c.libelle, type, active, accountancy_code FROM ".MAIN_DB_PREFIX."c_paiement AS c";
-$tabsql[14]= "SELECT e.rowid as rowid, e.code as code, e.libelle, e.price, e.organization, e.fk_pays as country_id, p.code as country_code, p.libelle as country, e.active FROM ".MAIN_DB_PREFIX."c_ecotaxe AS e, ".MAIN_DB_PREFIX."c_pays as p WHERE e.fk_pays=p.rowid and p.active=1";
+$tabsql[14]= "SELECT e.rowid as rowid, e.code as code, e.libelle, e.price, e.organization, e.fk_pays as country_id, c.code as country_code, c.label as country, e.active FROM ".MAIN_DB_PREFIX."c_ecotaxe AS e, ".MAIN_DB_PREFIX."c_country as c WHERE e.fk_pays=c.rowid and c.active=1";
$tabsql[15]= "SELECT rowid as rowid, code, label as libelle, width, height, unit, active FROM ".MAIN_DB_PREFIX."c_paper_format";
$tabsql[16]= "SELECT code, label as libelle, sortorder, active FROM ".MAIN_DB_PREFIX."c_prospectlevel";
$tabsql[17]= "SELECT id as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_type_fees";
@@ -155,8 +155,8 @@ $tabsql[20]= "SELECT rowid as rowid, code, libelle, active FROM ".MAIN_DB_PREF
$tabsql[21]= "SELECT c.rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_availability AS c";
$tabsql[22]= "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_input_reason";
$tabsql[23]= "SELECT rowid as rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number as accountancy_code, account_parent, label, active FROM ".MAIN_DB_PREFIX."accountingaccount";
-$tabsql[24]= "SELECT s.rowid as rowid, pcg_version, s.fk_pays as country_id, p.code as country_code, p.libelle as pays, s.label, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s, ".MAIN_DB_PREFIX."c_pays as p WHERE s.fk_pays=p.rowid and p.active=1";
-$tabsql[25]= "SELECT t.rowid, t.taux, p.libelle as country, p.code as country_code, t.fk_pays as country_id, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_revenuestamp as t, ".MAIN_DB_PREFIX."c_pays as p WHERE t.fk_pays=p.rowid";
+$tabsql[24]= "SELECT s.rowid as rowid, pcg_version, s.fk_pays as country_id, c.code as country_code, c.label as country, s.label, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s, ".MAIN_DB_PREFIX."c_country as c WHERE s.fk_pays=c.rowid and c.active=1";
+$tabsql[25]= "SELECT t.rowid, t.taux, c.label as country, c.code as country_code, t.fk_pays as country_id, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_revenuestamp as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid";
$tabsql[26]= "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_type_resource";
// Criteria to sort dictionaries
@@ -193,7 +193,7 @@ $tabfield=array();
$tabfield[1] = "code,libelle,country";
$tabfield[2] = "code,libelle,region_id,region,country"; // "code,libelle,region,country_code-country"
$tabfield[3] = "code,libelle,country_id,country";
-$tabfield[4] = "code,libelle";
+$tabfield[4] = "code,label";
$tabfield[5] = "code,libelle";
$tabfield[6] = "code,libelle,type,position";
$tabfield[7] = "code,libelle,country_id,country,accountancy_code,deductible";
@@ -222,7 +222,7 @@ $tabfieldvalue=array();
$tabfieldvalue[1] = "code,libelle,country";
$tabfieldvalue[2] = "code,libelle,region"; // "code,libelle,region"
$tabfieldvalue[3] = "code,libelle,country";
-$tabfieldvalue[4] = "code,libelle";
+$tabfieldvalue[4] = "code,label";
$tabfieldvalue[5] = "code,libelle";
$tabfieldvalue[6] = "code,libelle,type,position";
$tabfieldvalue[7] = "code,libelle,country,accountancy_code,deductible";
@@ -251,7 +251,7 @@ $tabfieldinsert=array();
$tabfieldinsert[1] = "code,libelle,fk_pays";
$tabfieldinsert[2] = "code_departement,nom,fk_region";
$tabfieldinsert[3] = "code_region,nom,fk_pays";
-$tabfieldinsert[4] = "code,libelle";
+$tabfieldinsert[4] = "code,label";
$tabfieldinsert[5] = "code,civilite";
$tabfieldinsert[6] = "code,libelle,type,position";
$tabfieldinsert[7] = "code,libelle,fk_pays,accountancy_code,deductible";
@@ -1019,7 +1019,7 @@ if ($id)
$valuetoshow=($obj->code && $key != "PaymentCondition".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
$valuetoshow=nl2br($valuetoshow);
}
- else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_pays') {
+ else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_country') {
$key=$langs->trans("Country".strtoupper($obj->code));
$valuetoshow=($obj->code && $key != "Country".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
}
diff --git a/htdocs/admin/limits.php b/htdocs/admin/limits.php
index 26f6c08aee9..781bc24aa09 100644
--- a/htdocs/admin/limits.php
+++ b/htdocs/admin/limits.php
@@ -205,8 +205,8 @@ else
$vat_rates=array();
$sql.="SELECT taux as vat_rate";
- $sql.=" FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p";
- $sql.=" WHERE t.active=1 AND t.fk_pays = p.rowid AND p.code='".$mysoc->country_code."' AND taux != 0";
+ $sql.=" FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c";
+ $sql.=" WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code='".$mysoc->country_code."' AND taux != 0";
$sql.=" ORDER BY t.taux ASC";
$resql=$db->query($sql);
if ($resql)
diff --git a/htdocs/cashdesk/facturation.php b/htdocs/cashdesk/facturation.php
index 95f3583fe94..a168fba5b7b 100644
--- a/htdocs/cashdesk/facturation.php
+++ b/htdocs/cashdesk/facturation.php
@@ -156,10 +156,10 @@ $i=0;
$sql = "SELECT t.rowid, t.taux";
$sql.= " FROM ".MAIN_DB_PREFIX."c_tva as t";
-$sql.= ", ".MAIN_DB_PREFIX."c_pays as p";
-$sql.= " WHERE t.fk_pays = p.rowid";
-$sql.= " AND t.active = 1";
-$sql.= " AND p.code = '".$mysoc->country_code."'";
+$sql.= ", ".MAIN_DB_PREFIX."c_country as c";
+$sql.= " WHERE t.fk_pays = c.rowid";
+$sql.= " AND c.active = 1";
+$sql.= " AND c.code = '".$mysoc->country_code."'";
//print $request;
$resql = $db->query($sql);
diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php
index e50c7bb34f6..4ca6175d785 100644
--- a/htdocs/compta/bank/class/account.class.php
+++ b/htdocs/compta/bank/class/account.class.php
@@ -607,10 +607,10 @@ class Account extends CommonObject
$sql.= " ba.domiciliation, ba.proprio, ba.owner_address, ba.state_id, ba.fk_pays as country_id,";
$sql.= " ba.account_number, ba.accountancy_journal, ba.currency_code,";
$sql.= " ba.min_allowed, ba.min_desired, ba.comment,";
- $sql.= ' p.code as country_code, p.libelle as country,';
+ $sql.= ' c.code as country_code, c.label 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_country as c ON ba.fk_pays = c.rowid';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON ba.state_id = d.rowid';
$sql.= " WHERE entity IN (".getEntity($this->element, 1).")";
if ($id) $sql.= " AND ba.rowid = ".$id;
diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php
index 60b056babf4..6c0c7c87558 100644
--- a/htdocs/compta/prelevement/class/bonprelevement.class.php
+++ b/htdocs/compta/prelevement/class/bonprelevement.class.php
@@ -1260,7 +1260,7 @@ class BonPrelevement extends CommonObject
/*
* section Debiteur (sepa Debiteurs bloc lines)
*/
- $sql = "SELECT soc.code_client as code, soc.address, soc.zip, soc.town, soc.datec, p.code as country_code,";
+ $sql = "SELECT soc.code_client as code, soc.address, soc.zip, soc.town, soc.datec, c.code as country_code,";
$sql.= " pl.client_nom as nom, pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, pl.amount as somme,";
$sql.= " f.facnumber as fac, pf.fk_facture as idfac, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum";
$sql.= " FROM";
@@ -1268,12 +1268,12 @@ class BonPrelevement extends CommonObject
$sql.= " ".MAIN_DB_PREFIX."facture as f,";
$sql.= " ".MAIN_DB_PREFIX."prelevement_facture as pf,";
$sql.= " ".MAIN_DB_PREFIX."societe as soc,";
- $sql.= " ".MAIN_DB_PREFIX."c_pays as p,";
+ $sql.= " ".MAIN_DB_PREFIX."c_country as c,";
$sql.= " ".MAIN_DB_PREFIX."societe_rib as rib";
$sql.= " WHERE pl.fk_prelevement_bons = ".$this->id;
$sql.= " AND pl.rowid = pf.fk_prelevement_lignes";
$sql.= " AND pf.fk_facture = f.rowid";
- $sql.= " AND soc.fk_pays = p.rowid";
+ $sql.= " AND soc.fk_pays = c.rowid";
$sql.= " AND soc.rowid = f.fk_soc";
$sql.= " AND rib.fk_soc = f.fk_soc";
$sql.= " AND rib.default_rib = 1";
@@ -1493,7 +1493,7 @@ class BonPrelevement extends CommonObject
* @param string $row_address soc.address AS adr,
* @param string $row_zip soc.zip
* @param string $row_town soc.town
- * @param string $row_country_code p.code AS pays,
+ * @param string $row_country_code c.code AS country,
* @param string $row_cb pl.code_banque AS cb,
* @param string $row_cg pl.code_guichet AS cg,
* @param string $row_cc pl.number AS cc,
@@ -1648,7 +1648,7 @@ class BonPrelevement extends CommonObject
$obj = $this->db->fetch_object($resql);
// DONNEES BRUTES : par la suite Rows['XXX'] de la requete au dessus
- $pays = explode(':', $configuration->global->MAIN_INFO_SOCIETE_COUNTRY);
+ $country = explode(':', $configuration->global->MAIN_INFO_SOCIETE_COUNTRY);
$IdBon = sprintf("%05d", $obj->rowid);
$RefBon = $obj->ref;
$type = ($nombre == 1) ? 'FRST' : 'RCUR' ;
@@ -1673,7 +1673,7 @@ class BonPrelevement extends CommonObject
$XML_SEPA_INFO .= ' '.$CrLf;
$XML_SEPA_INFO .= ' '.$configuration->global->PRELEVEMENT_RAISON_SOCIALE.''.$CrLf;
$XML_SEPA_INFO .= ' '.$CrLf;
- $XML_SEPA_INFO .= ' '.$pays[1].''.$CrLf;
+ $XML_SEPA_INFO .= ' '.$country[1].''.$CrLf;
$XML_SEPA_INFO .= ' '.$configuration->global->MAIN_INFO_SOCIETE_ADDRESS.''.$CrLf;
$XML_SEPA_INFO .= ' '.$configuration->global->MAIN_INFO_SOCIETE_ZIP.' '.$configuration->global->MAIN_INFO_SOCIETE_TOWN.''.$CrLf;
$XML_SEPA_INFO .= ' '.$CrLf;
@@ -1691,7 +1691,7 @@ class BonPrelevement extends CommonObject
/* $XML_SEPA_INFO .= ' '.$CrLf;
$XML_SEPA_INFO .= ' '.$configuration->global->PRELEVEMENT_RAISON_SOCIALE.''.$CrLf;
$XML_SEPA_INFO .= ' '.$CrLf;
- $XML_SEPA_INFO .= ' '.$pays[1].''.$CrLf;
+ $XML_SEPA_INFO .= ' '.$country[1].''.$CrLf;
$XML_SEPA_INFO .= ' '.$conf->global->MAIN_INFO_SOCIETE_ADDRESS.''.$CrLf;
$XML_SEPA_INFO .= ' '.$conf->global->MAIN_INFO_SOCIETE_ZIP.' '.$conf->global->MAIN_INFO_SOCIETE_TOWN.''.$CrLf;
$XML_SEPA_INFO .= ' '.$CrLf;
diff --git a/htdocs/contact/canvas/actions_contactcard_common.class.php b/htdocs/contact/canvas/actions_contactcard_common.class.php
index a2612e51e47..3cb150b8432 100644
--- a/htdocs/contact/canvas/actions_contactcard_common.class.php
+++ b/htdocs/contact/canvas/actions_contactcard_common.class.php
@@ -450,7 +450,7 @@ abstract class ActionsContactCardCommon
// We set country_id, and country_code label of the chosen country
if ($this->object->country_id)
{
- $sql = "SELECT code, libelle FROM ".MAIN_DB_PREFIX."c_pays WHERE rowid = ".$this->object->country_id;
+ $sql = "SELECT code, label FROM ".MAIN_DB_PREFIX."c_country WHERE rowid = ".$this->object->country_id;
$resql=$this->db->query($sql);
if ($resql)
{
@@ -460,9 +460,9 @@ abstract class ActionsContactCardCommon
{
dol_print_error($this->db);
}
- $this->object->country_id = $langs->trans("Country".$obj->code)?$langs->trans("Country".$obj->code):$obj->libelle;
+ $this->object->country_id = $langs->trans("Country".$obj->code)?$langs->trans("Country".$obj->code):$obj->label;
$this->object->country_code = $obj->code;
- $this->object->country = $langs->trans("Country".$obj->code)?$langs->trans("Country".$obj->code):$obj->libelle;
+ $this->object->country = $langs->trans("Country".$obj->code)?$langs->trans("Country".$obj->code):$obj->label;
}
}
diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php
index 7858f81dcf9..47f219feb4d 100644
--- a/htdocs/contact/class/contact.class.php
+++ b/htdocs/contact/class/contact.class.php
@@ -506,12 +506,12 @@ class Contact extends CommonObject
$sql.= " c.poste, c.phone, c.phone_perso, c.phone_mobile, c.fax, c.email, c.jabberid, c.skype,";
$sql.= " c.priv, c.note_private, c.note_public, c.default_lang, c.no_email, c.canvas,";
$sql.= " c.import_key,";
- $sql.= " p.libelle as country, p.code as country_code,";
+ $sql.= " co.label as country, co.code as country_code,";
$sql.= " d.nom as state, d.code_departement as state_code,";
$sql.= " u.rowid as user_id, u.login as user_login,";
$sql.= " s.nom as socname, s.address as socaddress, s.zip as soccp, s.town as soccity, s.default_lang as socdefault_lang";
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c";
- $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_pays as p ON c.fk_pays = p.rowid";
+ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON c.fk_pays = co.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as d ON c.fk_departement = d.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON c.rowid = u.fk_socpeople";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON c.fk_soc = s.rowid";
diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php
index 5c2b2f04938..1829e5f098c 100644
--- a/htdocs/contact/list.php
+++ b/htdocs/contact/list.php
@@ -124,9 +124,9 @@ $formother=new FormOther($db);
$sql = "SELECT s.rowid as socid, s.nom as name,";
$sql.= " p.rowid as cidp, p.lastname as lastname, p.statut, p.firstname, p.poste, p.email, p.skype,";
$sql.= " p.phone, p.phone_mobile, p.fax, p.fk_pays, p.priv, p.tms,";
-$sql.= " cp.code as country_code";
+$sql.= " co.code as country_code";
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as p";
-$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_pays as cp ON cp.rowid = p.fk_pays";
+$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = p.fk_pays";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = p.fk_soc";
if (! empty($search_categ)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_contact as cs ON p.rowid = cs.fk_socpeople"; // We need this table joined to the select in order to filter by categ
if (!$user->rights->societe->client->voir && !$socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
diff --git a/htdocs/core/ajax/ziptown.php b/htdocs/core/ajax/ziptown.php
index 80f6cd9bd63..def98b25ae8 100644
--- a/htdocs/core/ajax/ziptown.php
+++ b/htdocs/core/ajax/ziptown.php
@@ -63,13 +63,13 @@ if (! empty($_GET['zipcode']) || ! empty($_GET['town']))
if (! empty($conf->global->MAIN_USE_ZIPTOWN_DICTIONNARY)) // Use zip-town table
{
$sql = "SELECT z.rowid, z.zip, z.town, z.fk_county, z.fk_pays as fk_country";
- $sql.= ", p.rowid as fk_country, p.code as country_code, p.libelle as country";
+ $sql.= ", c.rowid as fk_country, c.code as country_code, c.label as country";
$sql.= ", d.rowid as fk_county, d.code_departement as county_code, d.nom as county";
- $sql.= " FROM (".MAIN_DB_PREFIX."c_ziptown as z,".MAIN_DB_PREFIX."c_pays as p)";
+ $sql.= " FROM (".MAIN_DB_PREFIX."c_ziptown as z,".MAIN_DB_PREFIX."c_country as c)";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX ."c_departements as d ON z.fk_county = d.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as r ON d.fk_region = r.code_region";
- $sql.= " WHERE z.fk_pays = p.rowid";
- $sql.= " AND z.active = 1 AND p.active = 1";
+ $sql.= " WHERE z.fk_pays = c.rowid";
+ $sql.= " AND z.active = 1 AND c.active = 1";
if ($zipcode) $sql.=" AND z.zip LIKE '" . $db->escape($zipcode) . "%'";
if ($town) $sql.=" AND z.town LIKE '%" . $db->escape($town) . "%'";
$sql.= " ORDER BY z.zip, z.town";
@@ -78,11 +78,11 @@ if (! empty($_GET['zipcode']) || ! empty($_GET['town']))
else // Use table of third parties
{
$sql = "SELECT DISTINCT s.zip, s.town, s.fk_departement as fk_county, s.fk_pays as fk_country";
- $sql.= ", p.code as country_code, p.libelle as country";
+ $sql.= ", c.code as country_code, c.label as country";
$sql.= ", d.code_departement as county_code , d.nom as county";
$sql.= " FROM ".MAIN_DB_PREFIX.'societe as s';
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX ."c_departements as d ON fk_departement = d.rowid";
- $sql.= " LEFT JOIN ".MAIN_DB_PREFIX.'c_pays as p ON fk_pays = p.rowid';
+ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX.'c_country as c ON fk_pays = c.rowid';
$sql.= " WHERE";
if ($zipcode) $sql.= " s.zip LIKE '".$db->escape($zipcode)."%'";
if ($town) $sql.= " s.town LIKE '%" . $db->escape($town) . "%'";
diff --git a/htdocs/core/class/cpays.class.php b/htdocs/core/class/ccountry.class.php
similarity index 90%
rename from htdocs/core/class/cpays.class.php
rename to htdocs/core/class/ccountry.class.php
index e75f8a75a1a..088dfaf327b 100644
--- a/htdocs/core/class/cpays.class.php
+++ b/htdocs/core/class/ccountry.class.php
@@ -16,9 +16,9 @@
*/
/**
- * \file htdocs/core/class/cpays.class.php
+ * \file htdocs/core/class/ccountry.class.php
* \ingroup core
- * \brief This file is a CRUD class file (Create/Read/Update/Delete) for c_pays dictionary
+ * \brief This file is a CRUD class file (Create/Read/Update/Delete) for c_country dictionary
*/
// Put here all includes required by your class file
@@ -30,18 +30,18 @@
/**
* Class to manage dictionary Countries (used by imports)
*/
-class Cpays // extends CommonObject
+class Ccountry // extends CommonObject
{
var $db; //!< To store db handler
var $error; //!< To return error code (or message)
var $errors=array(); //!< To return several error codes (or messages)
- //var $element='cpays'; //!< Id that identify managed objects
- //var $table_element='cpays'; //!< Name of table without prefix where object is stored
+ //var $element='ccountry'; //!< Id that identify managed objects
+ //var $table_element='ccountry'; //!< Name of table without prefix where object is stored
var $id;
var $code;
var $code_iso;
- var $libelle;
+ var $label;
var $active;
@@ -74,24 +74,24 @@ class Cpays // extends CommonObject
// Clean parameters
if (isset($this->code)) $this->code=trim($this->code);
if (isset($this->code_iso)) $this->code_iso=trim($this->code_iso);
- if (isset($this->libelle)) $this->libelle=trim($this->libelle);
+ if (isset($this->label)) $this->label=trim($this->label);
if (isset($this->active)) $this->active=trim($this->active);
// Check parameters
// Put here code to add control on parameters values
// Insert request
- $sql = "INSERT INTO ".MAIN_DB_PREFIX."c_pays(";
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."c_country(";
$sql.= "rowid,";
$sql.= "code,";
$sql.= "code_iso,";
- $sql.= "libelle,";
+ $sql.= "label,";
$sql.= "active";
$sql.= ") VALUES (";
$sql.= " ".(! isset($this->rowid)?'NULL':"'".$this->rowid."'").",";
$sql.= " ".(! isset($this->code)?'NULL':"'".$this->db->escape($this->code)."'").",";
$sql.= " ".(! isset($this->code_iso)?'NULL':"'".$this->db->escape($this->code_iso)."'").",";
- $sql.= " ".(! isset($this->libelle)?'NULL':"'".$this->db->escape($this->libelle)."'").",";
+ $sql.= " ".(! isset($this->label)?'NULL':"'".$this->db->escape($this->label)."'").",";
$sql.= " ".(! isset($this->active)?'NULL':"'".$this->active."'")."";
$sql.= ")";
@@ -103,7 +103,7 @@ class Cpays // extends CommonObject
if (! $error)
{
- $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."c_pays");
+ $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."c_country");
if (! $notrigger)
{
@@ -152,9 +152,9 @@ class Cpays // extends CommonObject
$sql.= " t.rowid,";
$sql.= " t.code,";
$sql.= " t.code_iso,";
- $sql.= " t.libelle,";
+ $sql.= " t.label,";
$sql.= " t.active";
- $sql.= " FROM ".MAIN_DB_PREFIX."c_pays as t";
+ $sql.= " FROM ".MAIN_DB_PREFIX."c_country as t";
if ($id) $sql.= " WHERE t.rowid = ".$id;
elseif ($code) $sql.= " WHERE t.code = '".$this->db->escape($code)."'";
@@ -169,7 +169,7 @@ class Cpays // extends CommonObject
$this->id = $obj->rowid;
$this->code = $obj->code;
$this->code_iso = $obj->code_iso;
- $this->libelle = $obj->libelle;
+ $this->label = $obj->label;
$this->active = $obj->active;
}
$this->db->free($resql);
@@ -199,7 +199,7 @@ class Cpays // extends CommonObject
// Clean parameters
if (isset($this->code)) $this->code=trim($this->code);
if (isset($this->code_iso)) $this->code_iso=trim($this->code_iso);
- if (isset($this->libelle)) $this->libelle=trim($this->libelle);
+ if (isset($this->label)) $this->label=trim($this->label);
if (isset($this->active)) $this->active=trim($this->active);
@@ -207,10 +207,10 @@ class Cpays // extends CommonObject
// Put here code to add control on parameters values
// Update request
- $sql = "UPDATE ".MAIN_DB_PREFIX."c_pays SET";
+ $sql = "UPDATE ".MAIN_DB_PREFIX."c_country SET";
$sql.= " code=".(isset($this->code)?"'".$this->db->escape($this->code)."'":"null").",";
$sql.= " code_iso=".(isset($this->code_iso)?"'".$this->db->escape($this->code_iso)."'":"null").",";
- $sql.= " libelle=".(isset($this->libelle)?"'".$this->db->escape($this->libelle)."'":"null").",";
+ $sql.= " label=".(isset($this->label)?"'".$this->db->escape($this->label)."'":"null").",";
$sql.= " active=".(isset($this->active)?$this->active:"null")."";
$sql.= " WHERE rowid=".$this->id;
@@ -267,7 +267,7 @@ class Cpays // extends CommonObject
global $conf, $langs;
$error=0;
- $sql = "DELETE FROM ".MAIN_DB_PREFIX."c_pays";
+ $sql = "DELETE FROM ".MAIN_DB_PREFIX."c_country";
$sql.= " WHERE rowid=".$this->id;
$this->db->begin();
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 355c13bc76f..5c1dca37328 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -449,19 +449,6 @@ class Form
return $this->textwithtooltip($text, $htmltext, 2, $direction, $img, $extracss, $notabs, '', $noencodehtmltext);
}
- /**
- * Return combo list of activated countries, into language of user
- *
- * @param string $selected Id or Code or Label of preselected country
- * @param string $htmlname Name of html select object
- * @param string $htmloption Options html on select object
- * @return void
- */
- function select_pays($selected='',$htmlname='country_id',$htmloption='')
- {
- print $this->select_country($selected,$htmlname,$htmloption);
- }
-
/**
* Return combo list of activated countries, into language of user
*
@@ -481,8 +468,8 @@ class Form
$countryArray=array();
$label=array();
- $sql = "SELECT rowid, code as code_iso, libelle as label";
- $sql.= " FROM ".MAIN_DB_PREFIX."c_pays";
+ $sql = "SELECT rowid, code as code_iso, label";
+ $sql.= " FROM ".MAIN_DB_PREFIX."c_country";
$sql.= " WHERE active = 1";
//$sql.= " ORDER BY code ASC";
@@ -490,7 +477,7 @@ class Form
$resql=$this->db->query($sql);
if ($resql)
{
- $out.= '