Skip to content

Commit

Permalink
Qual: Renamed table llx_c_civilite into llx_c_civility
Browse files Browse the repository at this point in the history
field civilite into label in the same table and field civilite into civility in other table
  • Loading branch information
aspangaro committed Aug 12, 2014
1 parent 5260668 commit 1a87d98
Show file tree
Hide file tree
Showing 27 changed files with 64 additions and 53 deletions.
3 changes: 3 additions & 0 deletions ChangeLog
Expand Up @@ -73,6 +73,9 @@ 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.
- Qual: Renamed table llx_c_civilite into llx_c_civility
field civilite into label in the same table
and field civilite into civility in other table

WARNING: Following change may create regression for some external modules, but was necessary to make
Dolibarr better:
Expand Down
6 changes: 3 additions & 3 deletions htdocs/adherents/class/adherent.class.php
Expand Up @@ -425,7 +425,7 @@ function update($user,$notrigger=0,$nosyncuser=0,$nosyncuserpass=0,$nosyncthirdp
$this->db->begin();

$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET";
$sql.= " civilite = ".(!is_null($this->civility_id)?"'".$this->civility_id."'":"null");
$sql.= " civility = ".(!is_null($this->civility_id)?"'".$this->civility_id."'":"null");
$sql.= ", firstname = ".($this->firstname?"'".$this->db->escape($this->firstname)."'":"null");
$sql.= ", lastname=" .($this->lastname?"'".$this->db->escape($this->lastname)."'":"null");
$sql.= ", login=" .($this->login?"'".$this->db->escape($this->login)."'":"null");
Expand Down Expand Up @@ -1048,7 +1048,7 @@ function fetch($rowid,$ref='',$fk_soc='',$ref_ext='')
{
global $langs;

$sql = "SELECT d.rowid, d.ref_ext, d.civilite as civility_id, d.firstname, d.lastname, d.societe as company, d.fk_soc, d.statut, d.public, d.address, d.zip, d.town, d.note,";
$sql = "SELECT d.rowid, d.ref_ext, d.civility as civility_id, d.firstname, d.lastname, d.societe as company, d.fk_soc, d.statut, d.public, d.address, d.zip, d.town, d.note,";
$sql.= " d.email, d.skype, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass,";
$sql.= " d.photo, d.fk_adherent_type, d.morphy, d.entity,";
$sql.= " d.datec as datec,";
Expand Down Expand Up @@ -1539,7 +1539,7 @@ function getCivilityLabel()

$code=(empty($this->civility_id)?'':$this->civility_id);
if (empty($code)) return '';
return $langs->getLabelFromKey($this->db, "Civility".$code, "c_civilite", "code", "civilite", $code);
return $langs->getLabelFromKey($this->db, "Civility".$code, "c_civility", "code", "label", $code);
}

/**
Expand Down
14 changes: 7 additions & 7 deletions htdocs/admin/dict.php
Expand Up @@ -78,7 +78,7 @@
$tabname[2] = MAIN_DB_PREFIX."c_departements";
$tabname[3] = MAIN_DB_PREFIX."c_regions";
$tabname[4] = MAIN_DB_PREFIX."c_pays";
$tabname[5] = MAIN_DB_PREFIX."c_civilite";
$tabname[5] = MAIN_DB_PREFIX."c_civility";
$tabname[6] = MAIN_DB_PREFIX."c_actioncomm";
$tabname[7] = MAIN_DB_PREFIX."c_chargesociales";
$tabname[8] = MAIN_DB_PREFIX."c_typent";
Expand Down Expand Up @@ -136,7 +136,7 @@
$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[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[5] = "SELECT c.rowid as rowid, c.code as code, c.label, c.active FROM ".MAIN_DB_PREFIX."c_civility 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";
Expand Down Expand Up @@ -165,7 +165,7 @@
$tabsqlsort[2] ="country ASC, code ASC";
$tabsqlsort[3] ="country ASC, code ASC";
$tabsqlsort[4] ="code ASC";
$tabsqlsort[5] ="libelle ASC";
$tabsqlsort[5] ="label ASC";
$tabsqlsort[6] ="a.type ASC, a.module ASC, a.position ASC, a.code ASC";
$tabsqlsort[7] ="country ASC, code ASC, a.libelle ASC";
$tabsqlsort[8] ="country DESC, libelle ASC";
Expand Down Expand Up @@ -194,7 +194,7 @@
$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[5] = "code,libelle";
$tabfield[5] = "code,label";
$tabfield[6] = "code,libelle,type,position";
$tabfield[7] = "code,libelle,country_id,country,accountancy_code,deductible";
$tabfield[8] = "code,libelle,country_id,country";
Expand Down Expand Up @@ -223,7 +223,7 @@
$tabfieldvalue[2] = "code,libelle,region"; // "code,libelle,region"
$tabfieldvalue[3] = "code,libelle,country";
$tabfieldvalue[4] = "code,libelle";
$tabfieldvalue[5] = "code,libelle";
$tabfieldvalue[5] = "code,label";
$tabfieldvalue[6] = "code,libelle,type,position";
$tabfieldvalue[7] = "code,libelle,country,accountancy_code,deductible";
$tabfieldvalue[8] = "code,libelle,country";
Expand Down Expand Up @@ -252,7 +252,7 @@
$tabfieldinsert[2] = "code_departement,nom,fk_region";
$tabfieldinsert[3] = "code_region,nom,fk_pays";
$tabfieldinsert[4] = "code,libelle";
$tabfieldinsert[5] = "code,civilite";
$tabfieldinsert[5] = "code,label";
$tabfieldinsert[6] = "code,libelle,type,position";
$tabfieldinsert[7] = "code,libelle,fk_pays,accountancy_code,deductible";
$tabfieldinsert[8] = "code,libelle,fk_country";
Expand Down Expand Up @@ -1044,7 +1044,7 @@
$key=$langs->trans(strtoupper($obj->code));
$valuetoshow=($key != strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
}
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_civilite') {
else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_civility') {
$key=$langs->trans("Civility".strtoupper($obj->code));
$valuetoshow=($obj->code && $key != "Civility".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
}
Expand Down
6 changes: 3 additions & 3 deletions htdocs/contact/class/contact.class.php
Expand Up @@ -249,7 +249,7 @@ function update($id, $user=0, $notrigger=0, $action='update')
$sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET ";
if ($this->socid > 0) $sql .= " fk_soc='".$this->db->escape($this->socid)."',";
else if ($this->socid == -1) $sql .= " fk_soc=null,";
$sql .= " civilite='".$this->db->escape($this->civility_id)."'";
$sql .= " civility='".$this->db->escape($this->civility_id)."'";
$sql .= ", lastname='".$this->db->escape($this->lastname)."'";
$sql .= ", firstname='".$this->db->escape($this->firstname)."'";
$sql .= ", address='".$this->db->escape($this->address)."'";
Expand Down Expand Up @@ -498,7 +498,7 @@ function fetch($id, $user=0)

$langs->load("companies");

$sql = "SELECT c.rowid, c.fk_soc, c.ref_ext, c.civilite as civility_id, c.lastname, c.firstname,";
$sql = "SELECT c.rowid, c.fk_soc, c.ref_ext, c.civility as civility_id, c.lastname, c.firstname,";
$sql.= " c.address, c.statut, c.zip, c.town,";
$sql.= " c.fk_pays as country_id,";
$sql.= " c.fk_departement,";
Expand Down Expand Up @@ -911,7 +911,7 @@ function getCivilityLabel()

$code=(! empty($this->civility_id)?$this->civility_id:(! empty($this->civility_id)?$this->civility_id:''));
if (empty($code)) return '';
return $langs->getLabelFromKey($this->db, "Civility".$code, "c_civilite", "code", "civilite", $code);
return $langs->getLabelFromKey($this->db, "Civility".$code, "c_civility", "code", "label", $code);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/boxes/box_contacts.php
Expand Up @@ -61,7 +61,7 @@ function loadBox($max=5)

if ($user->rights->societe->lire)
{
$sql = "SELECT sp.rowid, sp.lastname, sp.firstname, sp.civilite as civility_id, sp.datec, sp.tms, sp.fk_soc,";
$sql = "SELECT sp.rowid, sp.lastname, sp.firstname, sp.civility as civility_id, sp.datec, sp.tms, sp.fk_soc,";
$sql.= " s.nom as socname";
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON sp.fk_soc = s.rowid";
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/class/commonobject.class.php
Expand Up @@ -381,7 +381,7 @@ function liste_contact($statut=-1,$source='external',$list=0)
$sql = "SELECT ec.rowid, ec.statut, ec.fk_socpeople as id, ec.fk_c_type_contact"; // This field contains id of llx_socpeople or id of llx_user
if ($source == 'internal') $sql.=", '-1' as socid";
if ($source == 'external' || $source == 'thirdparty') $sql.=", t.fk_soc as socid";
$sql.= ", t.civilite as civility, t.lastname as lastname, t.firstname, t.email";
$sql.= ", t.civility as civility, t.lastname as lastname, t.firstname, t.email";
$sql.= ", tc.source, tc.element, tc.code, tc.libelle";
$sql.= " FROM ".MAIN_DB_PREFIX."c_type_contact tc";
$sql.= ", ".MAIN_DB_PREFIX."element_contact ec";
Expand Down
4 changes: 2 additions & 2 deletions htdocs/core/class/html.formcompany.class.php
Expand Up @@ -367,7 +367,7 @@ function select_civility($selected='',$htmlname='civility_id')

$out='';

$sql = "SELECT rowid, code, civilite as civility_label, active FROM ".MAIN_DB_PREFIX."c_civilite";
$sql = "SELECT rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_civility";
$sql.= " WHERE active = 1";

dol_syslog("Form::select_civility", LOG_DEBUG);
Expand All @@ -392,7 +392,7 @@ function select_civility($selected='',$htmlname='civility_id')
$out.= '<option value="'.$obj->code.'">';
}
// Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
$out.= ($langs->trans("Civility".$obj->code)!="Civility".$obj->code ? $langs->trans("Civility".$obj->code) : ($obj->civility_label!='-'?$obj->civility_label:''));
$out.= ($langs->trans("Civility".$obj->code)!="Civility".$obj->code ? $langs->trans("Civility".$obj->code) : ($obj->label!='-'?$obj->label:''));
$out.= '</option>';
$i++;
}
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/class/translate.class.php
Expand Up @@ -363,7 +363,7 @@ private function getTradFromKey($key)
}
else if (preg_match('/^Civility([0-9A-Z]+)$/i',$key,$reg))
{
$newstr=$this->getLabelFromKey($db,$reg[1],'c_civilite','code','civilite');
$newstr=$this->getLabelFromKey($db,$reg[1],'c_civility','code','label');
}
else if (preg_match('/^OrderSource([0-9A-Z]+)$/i',$key,$reg))
{
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/lib/company.lib.php
Expand Up @@ -648,7 +648,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')


$sql = "SELECT p.rowid, p.lastname, p.firstname, p.fk_pays as country_id, p.poste, p.phone, p.phone_mobile, p.fax, p.email, p.skype, p.statut ";
$sql .= ", p.civilite as civility_id, p.address, p.zip, p.town";
$sql .= ", p.civility as civility_id, p.address, p.zip, p.town";
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p";
$sql .= " WHERE p.fk_soc = ".$object->id;
if ($search_status!='') $sql .= " AND p.statut = ".$db->escape($search_status);
Expand Down
4 changes: 2 additions & 2 deletions htdocs/core/modules/mailings/contacts1.modules.php
Expand Up @@ -197,7 +197,7 @@ function add_to_target($mailing_id,$filtersarray=array())

// La requete doit retourner: id, email, fk_contact, name, firstname, other
$sql = "SELECT c.rowid as id, c.email as email, c.rowid as fk_contact,";
$sql.= " c.lastname, c.firstname, c.civilite as civility_id,";
$sql.= " c.lastname, c.firstname, c.civility as civility_id,";
$sql.= " s.nom as companyname";
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = c.fk_soc";
Expand Down Expand Up @@ -239,7 +239,7 @@ function add_to_target($mailing_id,$filtersarray=array())
'firstname' => $obj->firstname,
'other' =>
($langs->transnoentities("ThirdParty").'='.$obj->companyname).';'.
($langs->transnoentities("UserTitle").'='.($obj->civilite_id?$langs->transnoentities("Civility".$obj->civilite_id):'')),
($langs->transnoentities("UserTitle").'='.($obj->civility_id?$langs->transnoentities("Civility".$obj->civility_id):'')),
'source_url' => $this->url($obj->id),
'source_id' => $obj->id,
'source_type' => 'contact'
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/modules/mailings/contacts2.modules.php
Expand Up @@ -79,7 +79,7 @@ function add_to_target($mailing_id,$filtersarray=array())

// La requete doit retourner: id, email, fk_contact, name, firstname, other
$sql = "SELECT sp.rowid as id, sp.email as email, sp.rowid as fk_contact,";
$sql.= " sp.lastname, sp.firstname as firstname, sp.civilite as civility_id,";
$sql.= " sp.lastname, sp.firstname as firstname, sp.civility as civility_id,";
$sql.= " s.nom as companyname";
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = sp.fk_soc";
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/modules/mailings/contacts3.modules.php
Expand Up @@ -77,7 +77,7 @@ function add_to_target($mailing_id,$filtersarray=array())

// La requete doit retourner: id, email, fk_contact, name, firstname, other
$sql = "SELECT sp.rowid as id, sp.email as email, sp.rowid as fk_contact,";
$sql.= " sp.lastname, sp.firstname, sp.civilite as civility_id,";
$sql.= " sp.lastname, sp.firstname, sp.civility as civility_id,";
$sql.= " s.nom as companyname";
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = sp.fk_soc";
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/modules/mailings/contacts4.modules.php
Expand Up @@ -77,7 +77,7 @@ function add_to_target($mailing_id,$filtersarray=array())

// La requete doit retourner: id, email, fk_contact, name, firstname, other
$sql = "SELECT sp.rowid as id, sp.email as email, sp.rowid as fk_contact,";
$sql.= " sp.lastname, sp.firstname, sp.civilite as civility_id,";
$sql.= " sp.lastname, sp.firstname, sp.civility as civility_id,";
$sql.= " s.nom as companyname";
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
if ($filtersarray[0] <> 'all')$sql.= " INNER JOIN ".MAIN_DB_PREFIX."categorie_contact as cs ON cs.fk_socpeople=sp.rowid";
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/modules/mailings/fraise.modules.php
Expand Up @@ -166,7 +166,7 @@ function add_to_target($mailing_id,$filtersarray=array())
// La requete doit retourner: id, email, fk_contact, name, firstname
$sql = "SELECT a.rowid as id, a.email as email, null as fk_contact, ";
$sql.= " a.lastname, a.firstname,";
$sql.= " a.datefin, a.civilite as civility_id, a.login, a.societe"; // Other fields
$sql.= " a.datefin, a.civility as civility_id, a.login, a.societe"; // Other fields
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a";
$sql.= " WHERE a.email <> ''"; // Note that null != '' is false
$sql.= " AND a.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$mailing_id.")";
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/modules/mailings/framboise.modules.php
Expand Up @@ -64,7 +64,7 @@ function add_to_target($mailing_id,$filtersarray=array())

// Select the members from category
$sql = "SELECT a.rowid as id, a.email as email, a.lastname, null as fk_contact, a.firstname,";
$sql.= " a.datefin, a.civilite as civility_id, a.login, a.societe,"; // Other fields
$sql.= " a.datefin, a.civility as civility_id, a.login, a.societe,"; // Other fields
if ($_POST['filter']) $sql.= " c.label";
else $sql.=" null as label";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a";
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/modules/mailings/pomme.modules.php
Expand Up @@ -149,7 +149,7 @@ function add_to_target($mailing_id,$filtersarray=array())

// La requete doit retourner: id, email, fk_contact, lastname, firstname
$sql = "SELECT u.rowid as id, u.email as email, null as fk_contact,";
$sql.= " u.lastname, u.firstname as firstname, u.civilite as civility_id, u.login, u.office_phone";
$sql.= " u.lastname, u.firstname as firstname, u.civility as civility_id, u.login, u.office_phone";
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
$sql.= " WHERE u.email <> ''"; // u.email IS NOT NULL est implicite dans ce test
$sql.= " AND u.entity IN (0,".$conf->entity.")";
Expand Down

0 comments on commit 1a87d98

Please sign in to comment.