Qual: Normalize field names

This commit is contained in:
Laurent Destailleur 2012-01-19 22:20:28 +01:00
parent c608dd2087
commit d9aa0c4b28
6 changed files with 109 additions and 100 deletions

View File

@ -976,7 +976,7 @@ class Adherent extends CommonObject
$sql.= " d.pays,";
$sql.= " d.fk_departement,";
$sql.= " p.rowid as country_id, p.code as country_code, p.libelle as country,";
$sql.= " dep.nom as departement, dep.code_departement as departement_code,";
$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";
@ -1016,19 +1016,19 @@ class Adherent extends CommonObject
$this->town = $obj->town;
$this->state_id = $obj->fk_departement;
$this->state_code = $obj->fk_departement?$obj->departement_code:'';
$this->state = $obj->fk_departement?$obj->departement:'';
$this->fk_departement = $obj->fk_departement; // TODO deprecated
$this->departement_code = $obj->fk_departement?$obj->departement_code:''; // TODO deprecated
$this->departement = $obj->fk_departement?$obj->departement:''; // TODO deprecated
$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->country_id = $obj->country_id;
$this->country_code = $obj->country_code;
$this->pays_id = $obj->country_id; // TODO deprecated
$this->pays_code = $obj->country_code; // TODO deprecated
if ($langs->trans("Country".$obj->country_code) != "Country".$obj->country_code) $this->country = $langs->transnoentitiesnoconv("Country".$obj->country_code);
else $this->country=$obj->country;
$this->pays = $this->country; // TODO deprecated
$this->pays_id = $obj->country_id; // deprecated
$this->pays_code = $obj->country_code; // deprecated
$this->pays = $this->country; // deprecated
$this->phone = $obj->phone;
$this->phone_perso = $obj->phone_perso;

View File

@ -64,13 +64,19 @@ class Account extends CommonObject
var $adresse_proprio;
var $fk_departement;
var $departement_code;
var $departement;
var $fk_departement; // deprecated
var $departement_code; // deprecated
var $departement; // deprecated
var $state_id;
var $state_code;
var $state;
var $fk_pays;
var $pays_code;
var $pays;
var $fk_pays; // deprecated
var $pays_code; // deprecated
var $pays; // deprecated
var $country_id;
var $country_code;
var $country;
var $type_lib=array();
@ -575,7 +581,7 @@ class Account extends CommonObject
$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 departement_code, d.nom as departement';
$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';
@ -613,13 +619,16 @@ class Account extends CommonObject
$this->proprio = $obj->proprio;
$this->adresse_proprio = $obj->adresse_proprio;
$this->fk_departement = $obj->fk_departement;
$this->departement_code= $obj->departement_code;
$this->departement = $obj->departement;
$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_code = $obj->state_code;
$this->state = $obj->state;
$this->fk_pays = $obj->country_id;
$this->pays_code = $obj->country_code;
$this->pays = $obj->country;
$this->fk_pays = $obj->country_id; // deprecated
$this->pays_code = $obj->country_code; // deprecated
$this->pays = $obj->country; // deprecated
$this->country_id = $obj->country_id;
$this->country_code = $obj->country_code;
$this->country = $obj->country;

View File

@ -50,19 +50,19 @@ class Contact extends CommonObject
var $ville; // TODO deprecated
var $town;
var $fk_departement; // Id of department
var $departement_code; // Code of department
var $departement; // Label of department
var $fk_departement; // deprecated
var $departement_code; // deprecated
var $departement; // deprecated
var $state_id; // Id of department
var $state_code; // Code of department
var $state; // Label of department
var $fk_pays; // Id of country
var $pays_code; // Code of country
var $pays; // Label of country
var $country_id; // Id of country
var $country_code; // Code of country
var $country; // Label of country
var $fk_pays; // deprecated
var $pays_code; // deprecated
var $pays; // deprecated
var $country_id; // Id of country
var $country_code; // Code of country
var $country; // Label of country
var $socid; // fk_soc
var $status; // 0=brouillon, 1=4=actif, 5=inactif
@ -471,7 +471,7 @@ class Contact extends CommonObject
$sql.= " c.priv, c.note, c.default_lang, c.canvas,";
$sql.= " c.import_key,";
$sql.= " p.libelle as country, p.code as country_code,";
$sql.= " d.nom as departement, d.code_departement as departement_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.cp as soccp, s.ville as soccity, s.default_lang as socdefault_lang";
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c";
@ -505,12 +505,12 @@ class Contact extends CommonObject
$this->ville = $obj->town; // TODO deprecated
$this->town = $obj->town;
$this->fk_departement = $obj->fk_departement;
$this->fk_departement = $obj->fk_departement; // deprecated
$this->state_id = $obj->fk_departement;
$this->departement_code = $obj->departement_code; // TODO deprecated
$this->state_code = $obj->departement_code;
$this->departement = $obj->departement; // TODO deprecated
$this->state = $obj->departement;
$this->departement_code = $obj->state_code; // deprecated
$this->state_code = $obj->state_code;
$this->departement = $obj->state; // deprecated
$this->state = $obj->state;
$this->fk_pays = $obj->country_id;
$this->country_id = $obj->country_id;

View File

@ -282,7 +282,7 @@ if (GETPOST("source") == 'order')
if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int');
$amount=price2num($amount);
$fulltag='IR='.$order->ref.'.TPID='.$order->client->id.'.TP='.strtr($order->client->nom,"-"," ");
$fulltag='IR='.$order->ref.'.TPID='.$order->thirdparty->id.'.TP='.strtr($order->thirdparty->name,"-"," ");
if (! empty($_REQUEST["tag"])) { $tag=$_REQUEST["tag"]; $fulltag.='.TAG='.$_REQUEST["tag"]; }
$fulltag=dol_string_unaccent($fulltag);
@ -296,7 +296,7 @@ if (GETPOST("source") == 'order')
// Debitor
$var=!$var;
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("ThirdParty");
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$order->client->nom.'</b>';
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$order->thirdparty->name.'</b>';
// Object
$var=!$var;
@ -335,7 +335,7 @@ if (GETPOST("source") == 'order')
$var=!$var;
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("YourEMail");
print ' ('.$langs->trans("ToComplete").')';
$email=$order->client->email;
$email=$order->thirdparty->email;
$email=(GETPOST("email")?GETPOST("email"):(isValidEmail($email)?$email:''));
print '</td><td class="CTableRow'.($var?'1':'2').'"><input class="flat" type="text" name="email" size="48" value="'.$email.'"></td></tr>'."\n";
}
@ -365,7 +365,7 @@ if (GETPOST("source") == 'invoice')
if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int');
$amount=price2num($amount);
$fulltag='IR='.$invoice->ref.'.TPID='.$invoice->client->id.'.TP='.strtr($invoice->client->nom,"-"," ");
$fulltag='IR='.$invoice->ref.'.TPID='.$invoice->thirdparty->id.'.TP='.strtr($invoice->thirdparty->name,"-"," ");
if (! empty($_REQUEST["tag"])) { $tag=$_REQUEST["tag"]; $fulltag.='.TAG='.$_REQUEST["tag"]; }
$fulltag=dol_string_unaccent($fulltag);
@ -379,7 +379,7 @@ if (GETPOST("source") == 'invoice')
// Debitor
$var=!$var;
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("ThirdParty");
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$invoice->client->nom.'</b>';
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$invoice->thirdparty->name.'</b>';
// Object
$var=!$var;
@ -418,7 +418,7 @@ if (GETPOST("source") == 'invoice')
$var=!$var;
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("YourEMail");
print ' ('.$langs->trans("ToComplete").')';
$email=$invoice->client->email;
$email=$invoice->thirdparty->email;
$email=(GETPOST("email")?GETPOST("email"):(isValidEmail($email)?$email:''));
print '</td><td class="CTableRow'.($var?'1':'2').'"><input class="flat" type="text" name="email" size="48" value="'.$email.'"></td></tr>'."\n";
}
@ -470,9 +470,9 @@ if (GETPOST("source") == 'contractline')
// We define price for product (TODO Put this in a method in product class)
if ($conf->global->PRODUIT_MULTIPRICES)
{
$pu_ht = $product->multiprices[$contract->client->price_level];
$pu_ttc = $product->multiprices_ttc[$contract->client->price_level];
$price_base_type = $product->multiprices_base_type[$contract->client->price_level];
$pu_ht = $product->multiprices[$contract->thirdparty->price_level];
$pu_ttc = $product->multiprices_ttc[$contract->thirdparty->price_level];
$price_base_type = $product->multiprices_base_type[$contract->thirdparty->price_level];
}
else
{
@ -491,7 +491,7 @@ if (GETPOST("source") == 'contractline')
if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int');
$amount=price2num($amount);
$fulltag='CLR='.$contractline->ref.'.CR='.$contract->ref.'.TPID='.$contract->client->id.'.TP='.strtr($contract->client->nom,"-"," ");
$fulltag='CLR='.$contractline->ref.'.CR='.$contract->ref.'.TPID='.$contract->thirdparty->id.'.TP='.strtr($contract->thirdparty->name,"-"," ");
if (! empty($_REQUEST["tag"])) { $tag=$_REQUEST["tag"]; $fulltag.='.TAG='.$_REQUEST["tag"]; }
$fulltag=dol_string_unaccent($fulltag);
@ -508,7 +508,7 @@ if (GETPOST("source") == 'contractline')
// Debitor
$var=!$var;
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("ThirdParty");
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$contract->client->nom.'</b>';
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$contract->thirdparty->name.'</b>';
// Object
$var=!$var;
@ -589,7 +589,7 @@ if (GETPOST("source") == 'contractline')
$var=!$var;
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("YourEMail");
print ' ('.$langs->trans("ToComplete").')';
$email=$contract->client->email;
$email=$contract->thirdparty->email;
$email=(GETPOST("email")?GETPOST("email"):(isValidEmail($email)?$email:''));
print '</td><td class="CTableRow'.($var?'1':'2').'"><input class="flat" type="text" name="email" size="48" value="'.$email.'"></td></tr>'."\n";
@ -689,7 +689,7 @@ if (GETPOST("source") == 'membersubscription')
// EMail
$var=!$var;
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("YourEMail");
$email=$member->client->email;
$email=$member->email;
$email=(GETPOST("email")?GETPOST("email"):(isValidEmail($email)?$email:''));
if (empty($email)) print ' ('.$langs->trans("ToComplete").')';
print '</td><td class="CTableRow'.($var?'1':'2').'"><input class="flat" type="text" name="email" size="48" value="'.$email.'"></td></tr>'."\n";

View File

@ -384,8 +384,8 @@ if (GETPOST("source") == 'order' && $valid)
if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int');
$amount=price2num($amount);
$fulltag='ORD='.$order->ref.'.CUS='.$order->client->id;
//$fulltag.='.NAM='.strtr($order->client->nom,"-"," ");
$fulltag='ORD='.$order->ref.'.CUS='.$order->thirdparty->id;
//$fulltag.='.NAM='.strtr($order->thirdparty->name,"-"," ");
if (! empty($TAG)) { $tag=$TAG; $fulltag.='.TAG='.$TAG; }
$fulltag=dol_string_unaccent($fulltag);
@ -399,7 +399,7 @@ if (GETPOST("source") == 'order' && $valid)
// Debitor
$var=!$var;
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("ThirdParty");
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$order->client->nom.'</b>';
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$order->thirdparty->name.'</b>';
// Object
$var=!$var;
@ -435,14 +435,14 @@ if (GETPOST("source") == 'order' && $valid)
print '</td></tr>'."\n";
// Shipping address
$shipToName=$order->client->nom;
$shipToStreet=$order->client->address;
$shipToCity=$order->client->ville;
$shipToState=$order->client->departement_code;
$shipToCountryCode=$order->client->country_code;
$shipToZip=$order->client->cp;
$shipToName=$order->thirdparty->name;
$shipToStreet=$order->thirdparty->address;
$shipToCity=$order->thirdparty->town;
$shipToState=$order->thirdparty->state_code;
$shipToCountryCode=$order->thirdparty->country_code;
$shipToZip=$order->thirdparty->zip;
$shipToStreet2='';
$phoneNum=$order->client->tel;
$phoneNum=$order->thirdparty->tel;
if ($shipToName && $shipToStreet && $shipToCity && $shipToCountryCode && $shipToZip)
{
print '<input type="hidden" name="shipToName" value="'.$shipToName.'">'."\n";
@ -458,7 +458,7 @@ if (GETPOST("source") == 'order' && $valid)
{
print '<!-- Shipping address not complete, so we don t use it -->'."\n";
}
print '<input type="hidden" name="email" value="'.$order->client->email.'">'."\n";
print '<input type="hidden" name="email" value="'.$order->thirdparty->email.'">'."\n";
print '<input type="hidden" name="desc" value="'.$langs->trans("Order").' '.$order->ref.'">'."\n";
}
@ -487,8 +487,8 @@ if (GETPOST("source") == 'invoice' && $valid)
if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int');
$amount=price2num($amount);
$fulltag='INV='.$invoice->ref.'.CUS='.$invoice->client->id;
//$fulltag.='.NAM='.strtr($invoice->client->nom,"-"," ");
$fulltag='INV='.$invoice->ref.'.CUS='.$invoice->thirdparty->id;
//$fulltag.='.NAM='.strtr($invoice->thirdparty->name,"-"," ");
if (! empty($TAG)) { $tag=$TAG; $fulltag.='.TAG='.$TAG; }
$fulltag=dol_string_unaccent($fulltag);
@ -502,7 +502,7 @@ if (GETPOST("source") == 'invoice' && $valid)
// Debitor
$var=!$var;
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("ThirdParty");
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$invoice->client->nom.'</b>';
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$invoice->thirdparty->name.'</b>';
// Object
$var=!$var;
@ -538,14 +538,14 @@ if (GETPOST("source") == 'invoice' && $valid)
print '</td></tr>'."\n";
// Shipping address
$shipToName=$invoice->client->nom;
$shipToStreet=$invoice->client->address;
$shipToCity=$invoice->client->ville;
$shipToState=$invoice->client->departement_code;
$shipToCountryCode=$invoice->client->country_code;
$shipToZip=$invoice->client->cp;
$shipToName=$invoice->thirdparty->name;
$shipToStreet=$invoice->thirdparty->address;
$shipToCity=$invoice->thirdparty->town;
$shipToState=$invoice->thirdparty->state_code;
$shipToCountryCode=$invoice->thirdparty->country_code;
$shipToZip=$invoice->thirdparty->zip;
$shipToStreet2='';
$phoneNum=$invoice->client->tel;
$phoneNum=$invoice->thirdparty->tel;
if ($shipToName && $shipToStreet && $shipToCity && $shipToCountryCode && $shipToZip)
{
print '<input type="hidden" name="shipToName" value="'.$shipToName.'">'."\n";
@ -561,7 +561,7 @@ if (GETPOST("source") == 'invoice' && $valid)
{
print '<!-- Shipping address not complete, so we don t use it -->'."\n";
}
print '<input type="hidden" name="email" value="'.$invoice->client->email.'">'."\n";
print '<input type="hidden" name="email" value="'.$invoice->thirdparty->email.'">'."\n";
print '<input type="hidden" name="desc" value="'.$langs->trans("Invoice").' '.$invoice->ref.'">'."\n";
}
@ -612,9 +612,9 @@ if (GETPOST("source") == 'contractline' && $valid)
// We define price for product (TODO Put this in a method in product class)
if ($conf->global->PRODUIT_MULTIPRICES)
{
$pu_ht = $product->multiprices[$contract->client->price_level];
$pu_ttc = $product->multiprices_ttc[$contract->client->price_level];
$price_base_type = $product->multiprices_base_type[$contract->client->price_level];
$pu_ht = $product->multiprices[$contract->thirdparty->price_level];
$pu_ttc = $product->multiprices_ttc[$contract->thirdparty->price_level];
$price_base_type = $product->multiprices_base_type[$contract->thirdparty->price_level];
}
else
{
@ -633,8 +633,8 @@ if (GETPOST("source") == 'contractline' && $valid)
if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int');
$amount=price2num($amount);
$fulltag='COL='.$contractline->ref.'.CON='.$contract->ref.'.CUS='.$contract->client->id.'.DAT='.dol_print_date(dol_now(),'%Y%m%d%H%M');
//$fulltag.='.NAM='.strtr($contract->client->nom,"-"," ");
$fulltag='COL='.$contractline->ref.'.CON='.$contract->ref.'.CUS='.$contract->thirdparty->id.'.DAT='.dol_print_date(dol_now(),'%Y%m%d%H%M');
//$fulltag.='.NAM='.strtr($contract->thirdparty->name,"-"," ");
if (! empty($TAG)) { $tag=$TAG; $fulltag.='.TAG='.$TAG; }
$fulltag=dol_string_unaccent($fulltag);
@ -651,7 +651,7 @@ if (GETPOST("source") == 'contractline' && $valid)
// Debitor
$var=!$var;
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("ThirdParty");
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$contract->client->nom.'</b>';
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$contract->thirdparty->name.'</b>';
// Object
$var=!$var;
@ -729,14 +729,14 @@ if (GETPOST("source") == 'contractline' && $valid)
print '</td></tr>'."\n";
// Shipping address
$shipToName=$contract->client->nom;
$shipToStreet=$contract->client->address;
$shipToCity=$contract->client->ville;
$shipToState=$contract->client->departement_code;
$shipToCountryCode=$contract->client->pays_code;
$shipToZip=$contract->client->cp;
$shipToName=$contract->thirdparty->name;
$shipToStreet=$contract->thirdparty->address;
$shipToCity=$contract->thirdparty->town;
$shipToState=$contract->thirdparty->state_code;
$shipToCountryCode=$contract->thirdparty->pays_code;
$shipToZip=$contract->thirdparty->zip;
$shipToStreet2='';
$phoneNum=$contract->client->tel;
$phoneNum=$contract->thirdparty->tel;
if ($shipToName && $shipToStreet && $shipToCity && $shipToCountryCode && $shipToZip)
{
print '<input type="hidden" name="shipToName" value="'.$shipToName.'">'."\n";
@ -752,7 +752,7 @@ if (GETPOST("source") == 'contractline' && $valid)
{
print '<!-- Shipping address not complete, so we don t use it -->'."\n";
}
print '<input type="hidden" name="email" value="'.$contract->client->email.'">'."\n";
print '<input type="hidden" name="email" value="'.$contract->thirdparty->email.'">'."\n";
print '<input type="hidden" name="desc" value="'.$langs->trans("Contract").' '.$contract->ref.'">'."\n";
}
@ -850,10 +850,10 @@ if (GETPOST("source") == 'membersubscription' && $valid)
// Shipping address
$shipToName=$member->getFullName($langs);
$shipToStreet=$member->address;
$shipToCity=$member->ville;
$shipToState=$member->departement_code;
$shipToCity=$member->town;
$shipToState=$member->state_code;
$shipToCountryCode=$member->country_code;
$shipToZip=$member->cp;
$shipToZip=$member->zip;
$shipToStreet2='';
$phoneNum=$member->tel;
if ($shipToName && $shipToStreet && $shipToCity && $shipToCountryCode && $shipToZip)
@ -913,7 +913,7 @@ print '<br>';
html_print_paypal_footer($mysoc,$langs);
$db->close();
llxFooterPaypal();
$db->close();
?>

View File

@ -57,13 +57,13 @@ class Societe extends CommonObject
var $state_id;
var $state_code;
var $state;
var $departement_id;
var $departement_code;
var $departement;
var $departement_id; // deprecated
var $departement_code; // deprecated
var $departement; // deprecated
var $pays_id; // TODO obsolete
var $pays_code; // TODO obsolete
var $pays; // TODO obsolete
var $pays_id; // deprecated
var $pays_code; // deprecated
var $pays; // deprecated
var $country_id;
var $country_code;
var $country;
@ -639,7 +639,7 @@ class Societe extends CommonObject
$sql .= ', fj.libelle as forme_juridique';
$sql .= ', e.libelle as effectif';
$sql .= ', p.code as country_code, p.libelle as country';
$sql .= ', d.code_departement as departement_code, d.nom as departement';
$sql .= ', d.code_departement as state_code, d.nom as state';
$sql .= ', st.libelle as stcomm';
$sql .= ', te.code as typent_code';
$sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s';
@ -700,8 +700,8 @@ class Societe extends CommonObject
$this->country = $obj->country_id?($langs->trans('Country'.$obj->country_code)!='Country'.$obj->country_code?$langs->trans('Country'.$obj->country_code):$obj->country):'';
$this->state_id = $obj->fk_departement;
$this->state_code = $obj->departement_code;
$this->state = $obj->departement;
$this->state_code = $obj->state_code;
$this->state = $obj->state;
$transcode=$langs->trans('StatusProspect'.$obj->fk_stcomm);
$libelle=($transcode!='StatusProspect'.$obj->fk_stcomm?$transcode:$obj->stcomm);