diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php
index b554957b7a8..bcfd02bf1e6 100644
--- a/htdocs/admin/facture.php
+++ b/htdocs/admin/facture.php
@@ -585,7 +585,7 @@ print "
".$langs->trans("SuggestPaymentByChequeToAddress")." | ";
print "";
print ' | ';
print '';
- print $mysoc->nom;
+ print $mysoc->name;
print ' | ';
print '';
@@ -333,7 +333,7 @@ if ($id > 0 || ! empty($ref))
}
if ($tab[$i]['socid'] < 0)
{
- print $mysoc->nom;
+ print $mysoc->name;
}
if (! $tab[$i]['socid'])
{
diff --git a/htdocs/fourn/facture/contact.php b/htdocs/fourn/facture/contact.php
index bc8bb29bd85..d9fc7320f29 100644
--- a/htdocs/fourn/facture/contact.php
+++ b/htdocs/fourn/facture/contact.php
@@ -231,7 +231,7 @@ if ($id > 0)
print ' | ';
print '';
- print $mysoc->nom;
+ print $mysoc->name;
print ' | ';
print '';
@@ -323,7 +323,7 @@ if ($id > 0)
}
if ($tab[$i]['socid'] < 0)
{
- print $mysoc->nom;
+ print $mysoc->name;
}
if (! $tab[$i]['socid'])
{
diff --git a/htdocs/includes/modules/dons/html_cerfafr.modules.php b/htdocs/includes/modules/dons/html_cerfafr.modules.php
index f6ba8039a87..95ebe53aa84 100644
--- a/htdocs/includes/modules/dons/html_cerfafr.modules.php
+++ b/htdocs/includes/modules/dons/html_cerfafr.modules.php
@@ -123,10 +123,10 @@ class html_cerfafr extends ModeleDon
$html = str_replace('__AMOUNT__',$don->amount,$html);
$html = str_replace('__CURRENCY__',$outputlangs->transnoentitiesnoconv("Currency".$conf->monnaie),$html);
$html = str_replace('__CURRENCYCODE__',$conf->monnaie,$html);
- $html = str_replace('__MAIN_INFO_SOCIETE_NOM__',$mysoc->nom,$html);
+ $html = str_replace('__MAIN_INFO_SOCIETE_NOM__',$mysoc->name,$html);
$html = str_replace('__MAIN_INFO_SOCIETE_ADRESSE__',$mysoc->address,$html);
- $html = str_replace('__MAIN_INFO_SOCIETE_CP__',$mysoc->cp,$html);
- $html = str_replace('__MAIN_INFO_SOCIETE_VILLE__',$mysoc->ville,$html);
+ $html = str_replace('__MAIN_INFO_SOCIETE_CP__',$mysoc->zip,$html);
+ $html = str_replace('__MAIN_INFO_SOCIETE_VILLE__',$mysoc->town,$html);
$html = str_replace('__DONATOR_NAME__',$don->nom,$html);
$html = str_replace('__DONATOR_ADDRESS__',$don->adresse,$html);
$html = str_replace('__DONATOR_ZIP__',$don->cp,$html);
diff --git a/htdocs/includes/modules/livraison/pdf/pdf_typhon.modules.php b/htdocs/includes/modules/livraison/pdf/pdf_typhon.modules.php
index 9e30bfcbd6a..81ff98ab3f2 100644
--- a/htdocs/includes/modules/livraison/pdf/pdf_typhon.modules.php
+++ b/htdocs/includes/modules/livraison/pdf/pdf_typhon.modules.php
@@ -470,7 +470,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
$larg_sign = ($this->page_largeur-$this->marge_gauche-$this->marge_droite)/3;
$pdf->Rect($this->marge_gauche, ($tab_top + $tab_height + 3), $larg_sign, 25 );
$pdf->SetXY ($this->marge_gauche + 2, $tab_top + $tab_height + 5);
- $pdf->MultiCell($larg_sign,2, $outputlangs->trans("For").' '.$outputlangs->convToOutputCharset($mysoc->nom).":",'','L');
+ $pdf->MultiCell($larg_sign,2, $outputlangs->trans("For").' '.$outputlangs->convToOutputCharset($mysoc->name).":",'','L');
$pdf->Rect(2*$larg_sign+$this->marge_gauche, ($tab_top + $tab_height + 3), $larg_sign, 25 );
$pdf->SetXY (2*$larg_sign+$this->marge_gauche + 2, $tab_top + $tab_height + 5);
diff --git a/htdocs/includes/modules/member/cards/pdf_standard.class.php b/htdocs/includes/modules/member/cards/pdf_standard.class.php
index dc5cfa99686..c1d14432ac3 100644
--- a/htdocs/includes/modules/member/cards/pdf_standard.class.php
+++ b/htdocs/includes/modules/member/cards/pdf_standard.class.php
@@ -425,7 +425,7 @@ class pdf_standard {
$pdf->SetSubject($outputlangs->transnoentities("MembersCards"));
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
- $pdf->SetKeyWords($outputlangs->transnoentities('MembersCards')." ".$outputlangs->transnoentities("Foundation")." ".$outputlangs->convToOutputCharset($mysoc->nom));
+ $pdf->SetKeyWords($outputlangs->transnoentities('MembersCards')." ".$outputlangs->transnoentities("Foundation")." ".$outputlangs->convToOutputCharset($mysoc->name));
if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false);
$pdf->SetMargins(0,0);
diff --git a/htdocs/includes/modules/member/labels/pdf_standardlabel.class.php b/htdocs/includes/modules/member/labels/pdf_standardlabel.class.php
index 1caf80a361b..b51d8e13e07 100644
--- a/htdocs/includes/modules/member/labels/pdf_standardlabel.class.php
+++ b/htdocs/includes/modules/member/labels/pdf_standardlabel.class.php
@@ -404,7 +404,7 @@ class pdf_standardlabel {
$pdf->SetSubject($outputlangs->transnoentities("MembersLabels"));
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
- $pdf->SetKeyWords($outputlangs->transnoentities('MembersLabels')." ".$outputlangs->transnoentities("Foundation")." ".$outputlangs->convToOutputCharset($mysoc->nom));
+ $pdf->SetKeyWords($outputlangs->transnoentities('MembersLabels')." ".$outputlangs->transnoentities("Foundation")." ".$outputlangs->convToOutputCharset($mysoc->name));
if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false);
$pdf->SetMargins(0,0);
diff --git a/htdocs/includes/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/includes/modules/supplier_invoice/pdf/pdf_canelle.modules.php
index 0ff6099bbcd..19489d5f410 100755
--- a/htdocs/includes/modules/supplier_invoice/pdf/pdf_canelle.modules.php
+++ b/htdocs/includes/modules/supplier_invoice/pdf/pdf_canelle.modules.php
@@ -797,7 +797,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
// Nom emetteur
- $carac_emetteur_name=$outputlangs->convToOutputCharset($mysoc->nom);
+ $carac_emetteur_name=$outputlangs->convToOutputCharset($mysoc->name);
$pdf->SetTextColor(0,0,60);
$pdf->SetFont('','B', $default_font_size);
$pdf->SetXY($this->marge_gauche+2,$posy+3);
diff --git a/htdocs/includes/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/includes/modules/supplier_order/pdf/pdf_muscadet.modules.php
index 0aa26803edc..2691d0ddc0c 100644
--- a/htdocs/includes/modules/supplier_order/pdf/pdf_muscadet.modules.php
+++ b/htdocs/includes/modules/supplier_order/pdf/pdf_muscadet.modules.php
@@ -720,7 +720,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
// Nom emetteur
- $carac_emetteur_name=$outputlangs->convToOutputCharset($mysoc->nom);
+ $carac_emetteur_name=$outputlangs->convToOutputCharset($mysoc->name);
$pdf->SetTextColor(0,0,60);
$pdf->SetFont('','B', $default_font_size);
$pdf->SetXY($this->marge_gauche+2,$posy+3);
diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php
index 52cf31c1ba6..e320f56c6a0 100644
--- a/htdocs/master.inc.php
+++ b/htdocs/master.inc.php
@@ -243,14 +243,10 @@ if (! defined('NOREQUIREDB') && ! defined('NOREQUIRESOC'))
$mysoc->id=0;
$mysoc->nom=$conf->global->MAIN_INFO_SOCIETE_NOM; // TODO deprecated
$mysoc->name=$conf->global->MAIN_INFO_SOCIETE_NOM;
- $mysoc->adresse=$conf->global->MAIN_INFO_SOCIETE_ADRESSE; // TODO deprecated
$mysoc->address=$conf->global->MAIN_INFO_SOCIETE_ADRESSE;
- $mysoc->cp=$conf->global->MAIN_INFO_SOCIETE_CP; // TODO deprecated
$mysoc->zip=$conf->global->MAIN_INFO_SOCIETE_CP;
- $mysoc->ville=$conf->global->MAIN_INFO_SOCIETE_VILLE; // TODO deprecated
$mysoc->town=$conf->global->MAIN_INFO_SOCIETE_VILLE;
$mysoc->state_id=$conf->global->MAIN_INFO_SOCIETE_DEPARTEMENT;
- $mysoc->departement_id=$conf->global->MAIN_INFO_SOCIETE_DEPARTEMENT; // TODO deprecated
$mysoc->note=empty($conf->global->MAIN_INFO_SOCIETE_NOTE)?'':$conf->global->MAIN_INFO_SOCIETE_NOTE;
// We define pays_id, pays_code and pays_label
diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php
index 4f11c601657..4cf83793815 100644
--- a/htdocs/societe/class/societe.class.php
+++ b/htdocs/societe/class/societe.class.php
@@ -161,18 +161,19 @@ class Societe extends CommonObject
/**
- * \brief Create third party in database
- * \param user Object of user that ask creation
- * \return int >= 0 if OK, < 0 if KO
+ * Create third party in database
+ * @param user Object of user that ask creation
+ * @return int >= 0 if OK, < 0 if KO
*/
function create($user='')
{
global $langs,$conf;
// Clean parameters
+ $this->name=trim($this->name);
$this->nom=trim($this->nom);
- dol_syslog("Societe::create ".$this->nom);
+ dol_syslog("Societe::create ".$this->name);
// Check parameters
if (! empty($conf->global->SOCIETE_MAIL_REQUIRED) && ! isValidEMail($this->email))
@@ -273,14 +274,15 @@ class Societe extends CommonObject
}
/**
- * \brief Check properties of third party are ok (like name, third party codes, ...)
- * \return int 0 if OK, <0 if KO
+ * Check properties of third party are ok (like name, third party codes, ...)
+ * @return int 0 if OK, <0 if KO
*/
function verify()
{
$this->errors=array();
$result = 0;
+ $this->name=trim($this->name);
$this->nom=trim($this->nom);
if (! $this->nom)
@@ -347,13 +349,13 @@ class Societe extends CommonObject
}
/**
- * \brief Update parameters of third party
- * \param id id societe
- * \param user Utilisateur qui demande la mise a jour
- * \param call_trigger 0=non, 1=oui
- * \param allowmodcodeclient Inclut modif code client et code compta
- * \param allowmodcodefournisseur Inclut modif code fournisseur et code compta fournisseur
- * \return int <0 si ko, >=0 si ok
+ * Update parameters of third party
+ * @param id id societe
+ * @param user Utilisateur qui demande la mise a jour
+ * @param call_trigger 0=non, 1=oui
+ * @param allowmodcodeclient Inclut modif code client et code compta
+ * @param allowmodcodefournisseur Inclut modif code fournisseur et code compta fournisseur
+ * @return int <0 si ko, >=0 si ok
*/
function update($id, $user='', $call_trigger=1, $allowmodcodeclient=0, $allowmodcodefournisseur=0)
{
@@ -365,7 +367,8 @@ class Societe extends CommonObject
// Clean parameters
$this->id=$id;
- $this->nom=trim($this->nom);
+ $this->nom=trim($this->nom); // TODO obsolete
+ $this->name=trim($this->name);
$this->adresse=trim($this->adresse); // TODO obsolete
$this->address=trim($this->address);
$this->cp=trim($this->cp);
@@ -555,7 +558,7 @@ class Societe extends CommonObject
if (empty($rowid) && empty($ref) && empty($ref_ext)) return -1;
- $sql = 'SELECT s.rowid, s.nom, s.entity, s.ref_ext, s.address, s.datec as dc, s.prefix_comm';
+ $sql = 'SELECT s.rowid, s.nom as name, s.entity, s.ref_ext, s.address, s.datec as dc, s.prefix_comm';
$sql .= ', s.price_level';
$sql .= ', s.tms as date_update';
$sql .= ', s.tel, s.fax, s.email, s.url, s.cp as zip, s.ville as town, s.note, s.client, s.fournisseur';
@@ -608,8 +611,8 @@ class Societe extends CommonObject
$this->entity = $obj->entity;
$this->ref = $obj->rowid;
- $this->nom = $obj->nom; // TODO obsolete
- $this->name = $obj->nom;
+ $this->nom = $obj->name; // TODO obsolete
+ $this->name = $obj->name;
$this->ref_ext = $obj->ref_ext;
$this->datec = $this->db->jdate($obj->datec);
@@ -629,7 +632,8 @@ class Societe extends CommonObject
$this->pays = $obj->fk_pays?($langs->trans('Country'.$obj->pays_code)!='Country'.$obj->pays_code?$langs->trans('Country'.$obj->pays_code):$obj->pays):''; // TODO obsolete
$this->country = $obj->fk_pays?($langs->trans('Country'.$obj->pays_code)!='Country'.$obj->pays_code?$langs->trans('Country'.$obj->pays_code):$obj->pays):'';
- $this->departement_id = $obj->fk_departement;
+ $this->departement_id = $obj->fk_departement; // TODO obsolete
+ $this->state_id = $obj->fk_departement;
$this->departement = $obj->fk_departement?$obj->departement:'';
$transcode=$langs->trans('StatusProspect'.$obj->fk_stcomm);
@@ -1380,9 +1384,11 @@ class Societe extends CommonObject
$lien.=(!empty($this->canvas)?'&canvas='.$this->canvas:'').'">';
$lienfin='';
- if ($withpicto) $result.=($lien.img_object($langs->trans("ShowCompany").': '.$this->nom,'company').$lienfin);
+ if (empty($this->name)) $this->name=$this->nom;
+
+ if ($withpicto) $result.=($lien.img_object($langs->trans("ShowCompany").': '.$this->name,'company').$lienfin);
if ($withpicto && $withpicto != 2) $result.=' ';
- $result.=$lien.($maxlen?dol_trunc($this->nom,$maxlen):$this->nom).$lienfin;
+ $result.=$lien.($maxlen?dol_trunc($this->name,$maxlen):$this->name).$lienfin;
return $result;
}
@@ -1412,8 +1418,9 @@ class Societe extends CommonObject
$contact_email = $this->contact_email_array();
if ($this->email)
{
- // TODO: Tester si email non deja present dans tableau contact
- $contact_email[-1]=$langs->trans("ThirdParty").': '.dol_trunc($this->nom,16)." <".$this->email.">";
+ if (empty($this->name)) $this->name=$this->nom;
+ // TODO: Tester si email non deja present dans tableau contact
+ $contact_email[-1]=$langs->trans("ThirdParty").': '.dol_trunc($this->nom,16)." <".$this->email.">";
}
return $contact_email;
}
@@ -2169,19 +2176,25 @@ class Societe extends CommonObject
if (empty($name)) $name=trim($member->nom.' '.$member->prenom);
// Positionne parametres
- $this->email = $member->email;
- $this->nom = $name;
- $this->client = 1; // A member is a customer by default
- $this->code_client = -1;
- $this->code_fournisseur = -1;
+ $this->nom=$name; // TODO obsolete
+ $this->name=$name;
$this->adresse=$member->adresse; // TODO obsolete
$this->address=$member->adresse;
- $this->cp=$member->cp;
- $this->ville=$member->ville;
- $this->pays_code=$member->pays_code;
- $this->pays_id=$member->pays_id;
+ $this->cp=$member->cp; // TODO obsolete
+ $this->zip=$member->cp;
+ $this->ville=$member->ville; // TODO obsolete
+ $this->town=$member->ville;
+ $this->pays_code=$member->pays_code; // TODO obsolete
+ $this->country_code=$member->pays_code;
+ $this->pays_id=$member->pays_id; // TODO obsolete
+ $this->country_id=$member->pays_id;
$this->tel=$member->phone; // Prof phone
-
+ $this->email=$member->email;
+
+ $this->client = 1; // A member is a customer by default
+ $this->code_client = -1;
+ $this->code_fournisseur = -1;
+
$this->db->begin();
// Cree et positionne $this->id
|