diff --git a/htdocs/adherents/canvas/actions_adherentcard_common.class.php b/htdocs/adherents/canvas/actions_adherentcard_common.class.php
index d57b7ea093ea3db46cabb2f08f5e46a0ad2a3345..2d577270677b63a24d775e7ec6c9984f6d0a0bb1 100644
--- a/htdocs/adherents/canvas/actions_adherentcard_common.class.php
+++ b/htdocs/adherents/canvas/actions_adherentcard_common.class.php
@@ -394,7 +394,7 @@ abstract class ActionsAdherentCardCommon
         $this->object->old_firstname 		= 	$_POST["old_firstname"];
 
         $this->object->fk_soc				=	$_POST["fk_soc"];
-        $this->object->name					=	$_POST["name"];
+        $this->object->lastname				=	$_POST["lastname"];
         $this->object->firstname			= 	$_POST["firstname"];
         $this->object->civilite_id			= 	$_POST["civilite_id"];
         $this->object->address				=	$_POST["address"];
diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php
index 6b989004b3cd8c3eb8421a0b09b59894663a3059..25767e8f5b2ebf04ddd859705c4bb301ae49880c 100644
--- a/htdocs/adherents/card_subscriptions.php
+++ b/htdocs/adherents/card_subscriptions.php
@@ -829,7 +829,7 @@ if ($rowid)
         print '<input type="hidden" name="action" value="cotisation">';
         print '<input type="hidden" name="rowid" value="'.$rowid.'">';
         print '<input type="hidden" name="memberlabel" id="memberlabel" value="'.dol_escape_htmltag($object->getFullName($langs)).'">';
-        print '<input type="hidden" name="thirdpartylabel" id="thirdpartylabel" value="'.dol_escape_htmltag($object->name).'">';
+        print '<input type="hidden" name="thirdpartylabel" id="thirdpartylabel" value="'.dol_escape_htmltag($object->societe).'">';
         print "<table class=\"border\" width=\"100%\">\n";
 
         $today=dol_now();
diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php
index 8a3bd19e93cbdde93af36a23058fa137c5f21b76..7dd0f5fbbd1b87f113184bb08ef62cec7c8acd32 100644
--- a/htdocs/adherents/class/adherent.class.php
+++ b/htdocs/adherents/class/adherent.class.php
@@ -49,6 +49,7 @@ class Adherent extends CommonObject
     var $login;
     var $pass;
     var $societe;
+    var $company;
     var $address;
     var $zip;
     var $town;
@@ -1005,7 +1006,7 @@ class Adherent extends CommonObject
     {
         global $langs;
 
-        $sql = "SELECT d.rowid, d.civilite, d.firstname, d.lastname, d.societe, d.fk_soc, d.statut, d.public, d.address, d.zip, d.town, d.note,";
+        $sql = "SELECT d.rowid, d.civilite, 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.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,";
@@ -1047,7 +1048,8 @@ class Adherent extends CommonObject
                 $this->lastname			= $obj->lastname;
                 $this->login			= $obj->login;
                 $this->pass				= $obj->pass;
-                $this->societe			= $obj->societe;
+                $this->societe			= $obj->company;
+                $this->company			= $obj->company;
                 $this->fk_soc			= $obj->fk_soc;
                 $this->address			= $obj->address;
                 $this->zip				= $obj->zip;
diff --git a/htdocs/admin/accounting.php b/htdocs/admin/accounting.php
index 0023cda87d477003a444f23b84a266e6f212f8a1..fc6c83b356144836023e1360ad9dfd8ed5ef4d3e 100644
--- a/htdocs/admin/accounting.php
+++ b/htdocs/admin/accounting.php
@@ -212,26 +212,6 @@ $list=array('COMPTA_PRODUCT_BUY_ACCOUNT','COMPTA_PRODUCT_SOLD_ACCOUNT','COMPTA_S
 'COMPTA_VAT_ACCOUNT','COMPTA_ACCOUNT_CUSTOMER','COMPTA_ACCOUNT_SUPPLIER'
 );
 
-/*$sql = "SELECT rowid, name, value, type, note";
-$sql.= " FROM ".MAIN_DB_PREFIX."const";
-$sql.= " WHERE name LIKE 'COMPTA_%'";
-$sql.= " AND name NOT IN ('COMPTA_MODE')";
-$sql.= " AND entity = ".$conf->entity;
-$result = $db->query($sql);
-if ($result)
-{
-	$num = $db->num_rows($result);
-	$i = 0;
-
-	while ($i < $num)
-	{
-		$obj = $db->fetch_object($result);
-		$var=!$var;
-		$list[$obj->name]=$obj->value;
-		$i++;
-	}
-}*/
-
 $num=count($list);
 if ($num)
 {
diff --git a/htdocs/admin/prelevement.php b/htdocs/admin/prelevement.php
index c079e5a8d72ded92c5fbd80f28acbfea9ba5580c..bbbc307e42028aeba3025c7bf920807ce915cf83 100644
--- a/htdocs/admin/prelevement.php
+++ b/htdocs/admin/prelevement.php
@@ -165,8 +165,8 @@ if (! empty($conf->global->MAIN_MODULE_NOTIFICATION))
     $langs->load("mails");
     print_titre($langs->trans("Notifications"));
 
-    $sql = "SELECT rowid, name, firstname, fk_societe, email";
-    $sql.= " FROM ".MAIN_DB_PREFIX."user";
+    $sql = "SELECT u.rowid, u.lastname, u.firstname, u.fk_societe, u.email";
+    $sql.= " FROM ".MAIN_DB_PREFIX."user as u";
     $sql.= " WHERE entity IN (0,".$conf->entity.")";
 
     $resql=$db->query($sql);
@@ -181,7 +181,7 @@ if (! empty($conf->global->MAIN_MODULE_NOTIFICATION))
             $var=!$var;
             if (!$obj->fk_societe)
             {
-                $username= $obj->firstname.' '.$obj->name;
+                $username= $obj->firstname.' '.$obj->lastname;
                 $internalusers[$obj->rowid] = $username;
             }
 
@@ -233,11 +233,11 @@ if (! empty($conf->global->MAIN_MODULE_NOTIFICATION))
     print '<td align="right"><input type="submit" class="button" value="'.$langs->trans("Add").'"></td></tr>';
 }
 // List of current notifications for objet_type='withdraw'
-$sql = "SELECT u.lastname, u.firstname";
-$sql.= ", nd.rowid, ad.code, ad.label";
-$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
-$sql.= ", ".MAIN_DB_PREFIX."notify_def as nd";
-$sql.= ", ".MAIN_DB_PREFIX."c_action_trigger as ad";
+$sql = "SELECT u.lastname, u.firstname,";
+$sql.= " nd.rowid, ad.code, ad.label";
+$sql.= " FROM ".MAIN_DB_PREFIX."user as u,";
+$sql.= " ".MAIN_DB_PREFIX."notify_def as nd,";
+$sql.= " ".MAIN_DB_PREFIX."c_action_trigger as ad";
 $sql.= " WHERE u.rowid = nd.fk_user";
 $sql.= " AND nd.fk_action = ad.rowid";
 $sql.= " AND u.entity IN (0,".$conf->entity.")";
@@ -253,8 +253,8 @@ if ($resql)
         $obj = $db->fetch_object($resql);
         $var=!$var;
 
-        print "<tr $bc[$var]>";
-        print '<td>'.$obj->firstname." ".$obj->name.'</td>';
+        print "<tr ".$bc[$var].">";
+        print '<td>'.$obj->firstname." ".$obj->lastname.'</td>';
         $label=($langs->trans("Notify_".$obj->code)!="Notify_".$obj->code?$langs->trans("Notify_".$obj->code):$obj->label);
         print '<td>'.$label.'</td>';
         print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=deletenotif&amp;notif='.$obj->rowid.'">'.img_delete().'</a></td>';
diff --git a/htdocs/asterisk/cidlookup.php b/htdocs/asterisk/cidlookup.php
index 77cd271fe70770f19204bc5486543044d6d407e5..b90d393f01dc6d18f18f634934b15ffbb50946b6 100644
--- a/htdocs/asterisk/cidlookup.php
+++ b/htdocs/asterisk/cidlookup.php
@@ -40,7 +40,7 @@ if (empty($phone))
 	exit;
 }
 
-$sql = "SELECT nom as name FROM ".MAIN_DB_PREFIX."societe as s";
+$sql = "SELECT s.nom as name FROM ".MAIN_DB_PREFIX."societe as s";
 $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON sp.fk_soc = s.rowid";
 $sql.= " WHERE s.entity IN (".getEntity('societe', 1).")";
 $sql.= " AND (s.phone='".$db->escape($phone)."'";
diff --git a/htdocs/boutique/commande/class/boutiquecommande.class.php b/htdocs/boutique/commande/class/boutiquecommande.class.php
index 102d43085c26d91b8ebc11ebf6ce8d6681f4e48e..bf1e2fd7fd139560bbf921ef3e2350aac37b14d0 100644
--- a/htdocs/boutique/commande/class/boutiquecommande.class.php
+++ b/htdocs/boutique/commande/class/boutiquecommande.class.php
@@ -75,24 +75,24 @@ class BoutiqueCommande
             $array = $this->db->fetch_array($result);
 
             $this->id          = $array["orders_id"];
-            $this->client_id   = stripslashes($array["customers_id"]);
-            $this->client_name = stripslashes($array["customers_name"]);
+            $this->client_id   = $array["customers_id"];
+            $this->client_name = $array["customers_name"];
 
-            $this->payment_method = stripslashes($array["payment_method"]);
+            $this->payment_method = $array["payment_method"];
 
             $this->date = $this->db->jdate($array["date_purchased"]);
 
-            $this->delivery_adr->name = stripslashes($array["delivery_name"]);
-            $this->delivery_adr->street = stripslashes($array["delivery_street_address"]);
-            $this->delivery_adr->zip = stripslashes($array["delivery_zipcode"]);
-            $this->delivery_adr->city = stripslashes($array["delivery_city"]);
-            $this->delivery_adr->country = stripslashes($array["delivery_country"]);
+            $this->delivery_adr->name = $array["delivery_name"];
+            $this->delivery_adr->street = $array["delivery_street_address"];
+            $this->delivery_adr->zip = $array["delivery_zipcode"];
+            $this->delivery_adr->city = $array["delivery_city"];
+            $this->delivery_adr->country = $array["delivery_country"];
 
-            $this->billing_adr->name = stripslashes($array["billing_name"]);
-            $this->billing_adr->street = stripslashes($array["billing_street_address"]);
-            $this->billing_adr->zip = stripslashes($array["billing_zipcode"]);
-            $this->billing_adr->city = stripslashes($array["billing_city"]);
-            $this->billing_adr->country = stripslashes($array["billing_country"]);
+            $this->billing_adr->name = $array["billing_name"];
+            $this->billing_adr->street = $array["billing_street_address"];
+            $this->billing_adr->zip = $array["billing_zipcode"];
+            $this->billing_adr->city = $array["billing_city"];
+            $this->billing_adr->country = $array["billing_country"];
 
             $this->db->free();
 
@@ -106,7 +106,7 @@ class BoutiqueCommande
             if ( $result )
             {
                 $num = $this->db->num_rows($result);
-				
+
 				$i=0;
                 while ($i < $num)
                 {
diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php
index 38ee9cd8d8b0c0761ffcd2d5a32b49d843a11f60..48307e19905b27739c5684571025e6a29916c070 100644
--- a/htdocs/comm/action/class/actioncomm.class.php
+++ b/htdocs/comm/action/class/actioncomm.class.php
@@ -38,7 +38,7 @@ class ActionComm extends CommonObject
     protected $ismultientitymanaged = 2;	// 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
 
     var $id;
-    
+
     var $type_id;		// id into parent table llx_c_actioncomm (will be deprecated into future, link should not be required)
     var $type_code;		// code into parent table llx_c_actioncomm (will be deprecated into future, link should not be required)
     var $type;			// label into parent table llx_c_actioncomm (will be deprecated into future, link should not be required)
@@ -109,7 +109,7 @@ class ActionComm extends CommonObject
     function add($user,$notrigger=0)
     {
         global $langs,$conf,$hookmanager;
-        
+
         $error=0;
         $now=dol_now();
 
@@ -309,7 +309,7 @@ class ActionComm extends CommonObject
                 $transcode=$langs->trans("Action".$obj->type_code);
                 $type_libelle=($transcode!="Action".$obj->type_code?$transcode:$obj->libelle);
                 $this->type      = $type_libelle;
-                
+
 				$this->code					= $obj->code;
                 $this->label				= $obj->label;
                 $this->datep				= $this->db->jdate($obj->datep);
@@ -948,7 +948,7 @@ class ActionComm extends CommonObject
                     $event['startdate']=$datestart;
                     $event['duration']=$duration;	// Not required with type 'journal'
                     $event['enddate']=$dateend;		// Not required with type 'journal'
-                    $event['author']=$obj->firstname.($obj->name?" ".$obj->name:"");
+                    $event['author']=$obj->firstname.($obj->lastname?" ".$obj->lastname:"");
                     $event['priority']=$obj->priority;
                     $event['fulldayevent']=$obj->fulldayevent;
                     $event['location']=$obj->location;
diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php
index 2a46dbbbae3b9e87bb5b14611019c8b50d8a3bc1..f16579051e1a31f102f522bc0b1d2971d4f55c58 100644
--- a/htdocs/comm/action/index.php
+++ b/htdocs/comm/action/index.php
@@ -486,7 +486,7 @@ if ($showbirthday)
             $event->datep=dol_mktime(0,0,0,$datearray['mon'],$datearray['mday'],$year,true);    // For full day events, date are also GMT but they wont but converted during output
             $event->datef=$event->datep;
             $event->type_code='BIRTHDAY';
-            $event->libelle=$langs->trans("Birthday").' '.$obj->firstname.' '.$obj->name;
+            $event->libelle=$langs->trans("Birthday").' '.$obj->firstname.' '.$obj->lastname;
             $event->percentage=100;
             $event->fulldayevent=true;
 
diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php
index 7648c3db98957cd7772f26a3d93b101417bbd0c5..b603792b95728468cb176401a3884f54ae7dabac 100644
--- a/htdocs/comm/action/listactions.php
+++ b/htdocs/comm/action/listactions.php
@@ -306,7 +306,7 @@ if ($resql)
 		print '<td>';
 		if ($obj->fk_contact > 0)
 		{
-			$contactstatic->name=$obj->name;
+			$contactstatic->lastname=$obj->lastname;
 			$contactstatic->firstname=$obj->firstname;
 			$contactstatic->id=$obj->fk_contact;
 			print $contactstatic->getNomUrl(1,'',10);
diff --git a/htdocs/comm/bookmark.php b/htdocs/comm/bookmark.php
index 8baa467851033c4796947332e923d38ab41ae4fa..dff26cb26182e7352c233beaac2d5b054f29ee89 100644
--- a/htdocs/comm/bookmark.php
+++ b/htdocs/comm/bookmark.php
@@ -87,7 +87,7 @@ if ($_GET["action"] == 'delete')
 
 print_fiche_titre($langs->trans("Bookmarks"));
 
-$sql = "SELECT s.rowid, s.nom, b.dateb as dateb, b.rowid as bid, b.fk_user, b.url, b.target, u.lastname, u.firstname";
+$sql = "SELECT s.rowid, s.nom as name, b.dateb as dateb, b.rowid as bid, b.fk_user, b.url, b.target, u.lastname, u.firstname";
 $sql.= " FROM ".MAIN_DB_PREFIX."bookmark as b, ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."user as u";
 $sql.= " WHERE b.fk_soc = s.rowid AND b.fk_user=u.rowid";
 if (! $user->admin) $sql.= " AND b.fk_user = ".$user->id;
@@ -125,9 +125,9 @@ if ($resql)
       print "<tr $bc[$var]>";
       //print "<td>" . ($i + 1 + ($limit * $page)) . "</td>";
       print "<td align=\"center\"><b>".$obj->bid."</b></td>";
-      print "<td><a href='".DOL_URL_ROOT."/user/fiche.php?id=".$obj->fk_user."'>".img_object($langs->trans("ShowUser"),"user").' '.$obj->name." ".$obj->firstname."</a></td>\n";
+      print "<td><a href='".DOL_URL_ROOT."/user/fiche.php?id=".$obj->fk_user."'>".img_object($langs->trans("ShowUser"),"user").' '.$obj->lastname." ".$obj->firstname."</a></td>\n";
       print '<td align="center">'.dol_print_date($db->jdate($obj->dateb))."</td>";
-      print "<td><a href=\"index.php?socid=".$obj->rowid."\">".img_object($langs->trans("ShowCompany"),"company").' '.$obj->nom."</a></td>\n";
+      print "<td><a href=\"index.php?socid=".$obj->rowid."\">".img_object($langs->trans("ShowCompany"),"company").' '.$obj->name."</a></td>\n";
       print '<td align="center">'.$obj->url."</td>";
       print '<td align="center">'.$obj->target."</td>";
       print "<td><a href=\"bookmark.php?action=delete&bid=".$obj->bid."\">".img_delete()."</a></td>\n";
diff --git a/htdocs/compta/deplacement/index.php b/htdocs/compta/deplacement/index.php
index a4c59834529f8d11939647a7146bda268ae90763..1c94159d083e3a9281baa8c217e1b9f632538fb5 100644
--- a/htdocs/compta/deplacement/index.php
+++ b/htdocs/compta/deplacement/index.php
@@ -168,7 +168,7 @@ if ($result)
             $deplacementstatic->ref=$obj->rowid;
             $deplacementstatic->id=$obj->rowid;
             $userstatic->id=$obj->uid;
-            $userstatic->lastname=$obj->name;
+            $userstatic->lastname=$obj->lastname;
             $userstatic->firstname=$obj->firstname;
             print '<tr '.$bc[$var].'>';
             print '<td>'.$deplacementstatic->getNomUrl(1).'</td>';
diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php
index 7250c028b87c8097622c39b86bcef5e23f61954b..7f541e1b8db1f1ea16bc70fb46b9c06761173eec 100644
--- a/htdocs/compta/index.php
+++ b/htdocs/compta/index.php
@@ -613,7 +613,7 @@ if (! empty($conf->deplacement->enabled) && $user->rights->deplacement->lire)
 				$deplacementstatic->ref=$objp->rowid;
 				$deplacementstatic->id=$objp->rowid;
 				$userstatic->id=$objp->uid;
-				$userstatic->lastname=$objp->name;
+				$userstatic->lastname=$objp->lastname;
 				$userstatic->firstname=$objp->firstname;
 				print '<tr '.$bc[$var].'>';
                 print '<td>'.$deplacementstatic->getNomUrl(1).'</td>';
diff --git a/htdocs/compta/stats/cabyuser.php b/htdocs/compta/stats/cabyuser.php
index a8bc8b56e646eeb00a82c513b420fd4056c2c9bb..86f16cf36841afee21787a65cfe96e619f4f2b5a 100644
--- a/htdocs/compta/stats/cabyuser.php
+++ b/htdocs/compta/stats/cabyuser.php
@@ -171,7 +171,7 @@ if ($result)
     {
          $obj = $db->fetch_object($result);
          $amount[$obj->rowid] = $obj->amount_ttc;
-         $name[$obj->rowid] = $obj->name.' '.$obj->firstname;
+         $name[$obj->rowid] = $obj->lastname.' '.$obj->firstname;
          $catotal+=$obj->amount_ttc;
          $i++;
     }
@@ -183,7 +183,7 @@ else {
 // On ajoute les paiements ancienne version, non lies par paiement_facture donc sans user
 if ($modecompta != 'CREANCES-DETTES')
 {
-    $sql = "SELECT -1 as rowidx, '' as name, '' as firstname, sum(p.amount) as amount_ttc";
+    $sql = "SELECT -1 as rowidx, '' as lastname, '' as firstname, sum(p.amount) as amount_ttc";
     $sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
     $sql.= ", ".MAIN_DB_PREFIX."bank_account as ba";
     $sql.= ", ".MAIN_DB_PREFIX."paiement as p";
@@ -205,7 +205,7 @@ if ($modecompta != 'CREANCES-DETTES')
         {
             $obj = $db->fetch_object($result);
             $amount[$obj->rowidx] = $obj->amount_ttc;
-            $name[$obj->rowidx] = $obj->name.' '.$obj->firstname;
+            $name[$obj->rowidx] = $obj->lastname.' '.$obj->firstname;
             $catotal+=$obj->amount_ttc;
             $i++;
         }
diff --git a/htdocs/contact/canvas/actions_contactcard_common.class.php b/htdocs/contact/canvas/actions_contactcard_common.class.php
index a0fb97d715876219602cf0b3ba348c693f316fcd..f86970afc0aeb7030719987b0318be7a1c79ed0a 100644
--- a/htdocs/contact/canvas/actions_contactcard_common.class.php
+++ b/htdocs/contact/canvas/actions_contactcard_common.class.php
@@ -425,7 +425,7 @@ abstract class ActionsContactCardCommon
         $this->object->old_firstname 		= 	$_POST["old_firstname"];
 
         $this->object->socid				=	$_POST["socid"];
-        $this->object->name					=	$_POST["name"];
+        $this->object->lastname				=	$_POST["name"];
         $this->object->firstname			= 	$_POST["firstname"];
         $this->object->civilite_id			= 	$_POST["civilite_id"];
         $this->object->poste				= 	$_POST["poste"];
diff --git a/htdocs/contact/exportimport.php b/htdocs/contact/exportimport.php
index d1cb013c85f46bf6fb1eb7766f26a43d6c3c69d9..c3f9f2605ee710fa6e7f8b28569e16a95907df4f 100644
--- a/htdocs/contact/exportimport.php
+++ b/htdocs/contact/exportimport.php
@@ -64,7 +64,7 @@ print $form->showrefnav($contact, 'id', $linkback);
 print '</td></tr>';
 
 // Name
-print '<tr><td width="20%">'.$langs->trans("Lastname").' / '.$langs->trans("Label").'</td><td>'.$contact->name.'</td>';
+print '<tr><td width="20%">'.$langs->trans("Lastname").' / '.$langs->trans("Label").'</td><td>'.$contact->lastname.'</td>';
 print '<td width="20%">'.$langs->trans("Firstname").'</td><td width="25%">'.$contact->firstname.'</td></tr>';
 
 // Company
diff --git a/htdocs/contact/fiche.php b/htdocs/contact/fiche.php
index 3cd480a1ef09acc68dca0da7828c80e7ea8896b0..2f1f0613740311aea24562626a91e554999ab0d8 100644
--- a/htdocs/contact/fiche.php
+++ b/htdocs/contact/fiche.php
@@ -198,7 +198,7 @@ if (empty($reshook))
     {
         $result=$object->fetch($_GET["id"]);
 
-        $object->old_name      = $_POST["old_name"];
+        $object->old_lastname      = $_POST["old_lastname"];
         $object->old_firstname = $_POST["old_firstname"];
 
         $result = $object->delete();
@@ -227,7 +227,7 @@ if (empty($reshook))
 
             $object->oldcopy=dol_clone($object);
 
-            $object->old_name		= $_POST["old_name"];
+            $object->old_lastname	= $_POST["old_lastname"];
             $object->old_firstname	= $_POST["old_firstname"];
 
             $object->socid			= $_POST["socid"];
@@ -265,7 +265,7 @@ if (empty($reshook))
 
             if ($result > 0)
             {
-                $object->old_name='';
+                $object->old_lastname='';
                 $object->old_firstname='';
                 $action = 'view';
             }
@@ -620,7 +620,7 @@ else
             print '<input type="hidden" name="id" value="'.$id.'">';
             print '<input type="hidden" name="action" value="update">';
             print '<input type="hidden" name="contactid" value="'.$object->id.'">';
-            print '<input type="hidden" name="old_name" value="'.$object->name.'">';
+            print '<input type="hidden" name="old_lastname" value="'.$object->lastname.'">';
             print '<input type="hidden" name="old_firstname" value="'.$object->firstname.'">';
             if (! empty($backtopage)) print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
 
diff --git a/htdocs/contact/ldap.php b/htdocs/contact/ldap.php
index 927d8c1c922808f79561ddb7189151496e184365..bb1114c18da9359ad01b944faaedfe43d45c6abf 100644
--- a/htdocs/contact/ldap.php
+++ b/htdocs/contact/ldap.php
@@ -96,7 +96,7 @@ print $form->showrefnav($contact,'id');
 print '</td></tr>';
 
 // Name
-print '<tr><td>'.$langs->trans("Lastname").' / '.$langs->trans("Label").'</td><td>'.$contact->name.'</td>';
+print '<tr><td>'.$langs->trans("Lastname").' / '.$langs->trans("Label").'</td><td>'.$contact->lastname.'</td>';
 print '<td>'.$langs->trans("Firstname").'</td><td width="25%">'.$contact->firstname.'</td></tr>';
 
 // Company
diff --git a/htdocs/contact/vcard.php b/htdocs/contact/vcard.php
index 683be86bb0873d188752e6baccf8bacb77cca6e5..f9f4c80fad1ac3feadc1d5180f22c4bb0612a8c2 100644
--- a/htdocs/contact/vcard.php
+++ b/htdocs/contact/vcard.php
@@ -46,7 +46,7 @@ $v = new vCard();
 $v->setProdId('Dolibarr '.DOL_VERSION);
 
 $v->setUid('DOLIBARR-CONTACTID-'.$contact->id);
-$v->setName($contact->name, $contact->firstname, "", "", "");
+$v->setName($contact->lastname, $contact->firstname, "", "", "");
 $v->setFormattedName($contact->getFullName($langs));
 
 // By default, all informations are for work (except phone_perso and phone_mobile)
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 234054f9da2535003c19097062fbc6544f1b7ca1..5865566675533dcead7a08ca1c2def7aceef6438 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -63,7 +63,7 @@ abstract class CommonObject
 
         $lastname=$this->lastname;
         $firstname=$this->firstname;
-        if (empty($lastname))  $lastname=($this->name?$this->name:$this->nom);
+        if (empty($lastname))  $lastname=($this->lastname?$this->lastname:($this->name?$this->name:$this->nom));
         if (empty($firstname)) $firstname=$this->firstname;
 
         $ret='';
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 268a5d712d368d739479562af1dca710456bf56f..784c8bc926f4bc0aa276dd76001b7e5915eecd00 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -898,8 +898,7 @@ class Form
                     $obj = $this->db->fetch_object($resql);
 
                     $contactstatic->id=$obj->rowid;
-                    $contactstatic->name=$obj->name;
-                    $contactstatic->lastname=$obj->name;
+                    $contactstatic->lastname=$obj->lastname;
                     $contactstatic->firstname=$obj->firstname;
 
                     if ($htmlname != 'none')
diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php
index a0ea370c5ee990e989156b3fc98a19cda95ad7d7..abf124b02f36d903c650370c150b52c97d75bbe1 100644
--- a/htdocs/core/class/notify.class.php
+++ b/htdocs/core/class/notify.class.php
@@ -135,7 +135,7 @@ class Notify
 
 		dol_syslog("Notify::send action=$action, socid=$socid, texte=$texte, objet_type=$objet_type, objet_id=$objet_id, file=$file");
 
-		$sql = "SELECT s.nom, c.email, c.rowid as cid, c.name, c.firstname,";
+		$sql = "SELECT s.nom, c.email, c.rowid as cid, c.lastname, c.firstname,";
 		$sql.= " a.rowid as adid, a.label, a.code, n.rowid";
         $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c,";
         $sql.= " ".MAIN_DB_PREFIX."c_action_trigger as a,";
@@ -157,7 +157,7 @@ class Notify
             {
                 $obj = $this->db->fetch_object($result);
 
-                $sendto = $obj->firstname . " " . $obj->name . " <".$obj->email.">";
+                $sendto = $obj->firstname . " " . $obj->lastname . " <".$obj->email.">";
 				$actiondefid = $obj->adid;
 
                 if (dol_strlen($sendto))
diff --git a/htdocs/core/modules/mailings/contacts1.modules.php b/htdocs/core/modules/mailings/contacts1.modules.php
index 0067f67af161b30eb51e7a66ea36923f2453f720..8ce9207ea7580f933cd3d6b1ff44cc7ef10e7fd6 100755
--- a/htdocs/core/modules/mailings/contacts1.modules.php
+++ b/htdocs/core/modules/mailings/contacts1.modules.php
@@ -200,7 +200,7 @@ class mailing_contacts1 extends MailingTargets
 
 		// 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.name as name, c.firstname as firstname, c.civilite,";
+		$sql.= " c.lastname, c.firstname, c.civilite,";
 		$sql.= " s.nom as companyname";
 		$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c,";
 		$sql.= " ".MAIN_DB_PREFIX."societe as s";
@@ -238,7 +238,7 @@ class mailing_contacts1 extends MailingTargets
 					$cibles[$j] = array(
                     		'email' => $obj->email,
                     		'fk_contact' => $obj->fk_contact,
-                    		'name' => $obj->name,
+                    		'lastname' => $obj->lastname,
                     		'firstname' => $obj->firstname,
                     		'other' =>
                                 ($langs->transnoentities("ThirdParty").'='.$obj->companyname).';'.
diff --git a/htdocs/core/modules/mailings/contacts3.modules.php b/htdocs/core/modules/mailings/contacts3.modules.php
index 10afb1dd10f8fc5210247a01132cbd8e72be2afb..229f26f7ca7cd57fb7a798ce45e0e90a946aab17 100755
--- a/htdocs/core/modules/mailings/contacts3.modules.php
+++ b/htdocs/core/modules/mailings/contacts3.modules.php
@@ -104,7 +104,7 @@ class mailing_contacts3 extends MailingTargets
     			$target[] = array(
                             'email' => $obj->email,
                             'fk_contact' => $obj->fk_contact,
-                            'name' => $obj->name,
+                            'lastname' => $obj->lastname,
                             'firstname' => $obj->firstname,
                             'other' =>
                                 ($langs->transnoentities("ThirdParty").'='.$obj->companyname).';'.
diff --git a/htdocs/core/modules/mailings/fraise.modules.php b/htdocs/core/modules/mailings/fraise.modules.php
index fda4827115959fa576668efd53efc418b3e2446d..932679378007cd5feb59978ffdd33588cdef8538 100644
--- a/htdocs/core/modules/mailings/fraise.modules.php
+++ b/htdocs/core/modules/mailings/fraise.modules.php
@@ -197,7 +197,7 @@ class mailing_fraise extends MailingTargets
                     $cibles[$j] = array(
                     			'email' => $obj->email,
                     			'fk_contact' => $obj->fk_contact,
-                    			'name' => $obj->name,
+                    			'lastname' => $obj->lastname,
                     			'firstname' => $obj->firstname,
                     			'other' =>
                                 ($langs->transnoentities("Login").'='.$obj->login).';'.
diff --git a/htdocs/core/modules/mailings/framboise.modules.php b/htdocs/core/modules/mailings/framboise.modules.php
index e787f750c475ab4cc78c5c9513715dd85bb7ca1d..433b48427d92613046f09cc0576c976d1d5a641e 100644
--- a/htdocs/core/modules/mailings/framboise.modules.php
+++ b/htdocs/core/modules/mailings/framboise.modules.php
@@ -95,7 +95,7 @@ class mailing_framboise extends MailingTargets
 					$cibles[$j] = array(
                     			'email' => $obj->email,
                     			'fk_contact' => $obj->fk_contact,
-                    			'name' => $obj->name,
+                    			'lastname' => $obj->lastname,
                     			'firstname' => $obj->firstname,
                     			'other' => ($obj->label?$langs->transnoentities("Category").'='.$obj->label:''),
                                 'source_url' => $this->url($obj->id),
diff --git a/htdocs/core/modules/mailings/pomme.modules.php b/htdocs/core/modules/mailings/pomme.modules.php
index 4541b2c92dc62dbe0c804cbf86c092885eb1372c..c4c5d0cc3c4da1182a0ac09f9958116a3fa156ab 100644
--- a/htdocs/core/modules/mailings/pomme.modules.php
+++ b/htdocs/core/modules/mailings/pomme.modules.php
@@ -176,7 +176,7 @@ class mailing_pomme extends MailingTargets
 					$cibles[$j] = array(
                     			'email' => $obj->email,
                     			'fk_contact' => $obj->fk_contact,
-                    			'name' => $obj->name,
+                    			'lastname' => $obj->lastname,
                     			'firstname' => $obj->firstname,
                     			'other' =>
 					            ($langs->transnoentities("Login").'='.$obj->login).';'.
diff --git a/htdocs/core/modules/mailings/thirdparties.modules.php b/htdocs/core/modules/mailings/thirdparties.modules.php
index dc4e41cd03f21a23604739bcfe92c32f6f9cb415..ae6942e1179c6b8b2a015826855caaa45f605b43 100755
--- a/htdocs/core/modules/mailings/thirdparties.modules.php
+++ b/htdocs/core/modules/mailings/thirdparties.modules.php
@@ -105,7 +105,7 @@ class mailing_thirdparties extends MailingTargets
 					$cibles[$j] = array(
                     			'email' => $obj->email,
                     			'fk_contact' => $obj->fk_contact,
-                    			'name' => $obj->name,
+                    			'lastname' => $obj->lastname,
                     			'firstname' => $obj->firstname,
                     			'other' => ($obj->label?$langs->transnoentities("Category").'='.$obj->label:''),
                                 'source_url' => $this->url($obj->id),
diff --git a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php
index 15b3ad6f0d49cf52148e95ba70c55e281b090dfe..a5c36464253faeee1ec9978b8f2a7d5593d85d12 100755
--- a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php
+++ b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php
@@ -122,7 +122,7 @@ class mailing_thirdparties_services_expired extends MailingTargets
                 {
                     $cibles[$j] = array(
 					'email' => $obj->email,
-					'name' => $obj->name,
+					'lastname' => $obj->lastname,
 					'other' =>
                     ('StartDate='.dol_print_date($this->db->jdate($obj->date_ouverture),'day')).';'.
                     ('EndDate='.dol_print_date($this->db->jdate($obj->date_fin_validite),'day')).';'.
diff --git a/htdocs/fourn/commande/index.php b/htdocs/fourn/commande/index.php
index bfb22597be7b424f209d34b04c64e5dbbc8397f6..c55765fd238302569963699ada963fa098580c65 100755
--- a/htdocs/fourn/commande/index.php
+++ b/htdocs/fourn/commande/index.php
@@ -276,7 +276,7 @@ if ($resql)
         print "<tr $bc[$var]>";
         print '<td>';
         $userstatic->id=$obj->rowid;
-        $userstatic->lastname=$obj->name;
+        $userstatic->lastname=$obj->lastname;
         $userstatic->firstname=$obj->firstname;
         print $userstatic->getNomUrl(1);
         print '</td>';
diff --git a/htdocs/fourn/contact.php b/htdocs/fourn/contact.php
index 259faf758823454d31d4475d444710f9f5e264c6..f1052c6130e48b45054b4b7cadbf9778f14bdeed 100644
--- a/htdocs/fourn/contact.php
+++ b/htdocs/fourn/contact.php
@@ -57,7 +57,7 @@ $limit = $conf->liste_limit;
  * Mode liste
  */
 
-$sql = "SELECT s.rowid as socid, s.nom, st.libelle as stcomm, p.rowid as cidp, p.name, p.firstname, p.email, p.phone";
+$sql = "SELECT s.rowid as socid, s.nom as name, st.libelle as stcomm, p.rowid as cidp, p.lastname, p.firstname, p.email, p.phone";
 if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user ";
 $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."socpeople as p, ".MAIN_DB_PREFIX."c_stcomm as st";
 if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@@ -85,13 +85,14 @@ if ($socid) {
     $sql .= " AND s.rowid = ".$socid;
 }
 
-$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($limit, $offset);
+$sql .= " ORDER BY $sortfield $sortorder ";
+$sql .= $db->plimit($limit, $offset);
 
 $result = $db->query($sql);
 if ($result)
 {
     $num = $db->num_rows($result);
-    
+
     $title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("ListOfContacts") : $langs->trans("ListOfContactsAddresses"));
     print_barre_liste($title." (".$langs->trans("Suppliers").")",$page, "contact.php", "",$sortfield,$sortorder,"",$num);
 
@@ -111,11 +112,11 @@ if ($result)
 
         $var=!$var;
 
-        print "<tr $bc[$var]>";
+        print "<tr ".$bc[$var].">";
 
-        print '<td><a href="'.DOL_URL_ROOT.'/contact/fiche.php?id='.$obj->cidp.'">'.img_object($langs->trans("ShowContact"),"contact").' '.$obj->name.'</a></td>';
+        print '<td><a href="'.DOL_URL_ROOT.'/contact/fiche.php?id='.$obj->cidp.'">'.img_object($langs->trans("ShowContact"),"contact").' '.$obj->lastname.'</a></td>';
         print '<td>'.$obj->firstname.'</td>';
-        print '<td><a href="'.DOL_URL_ROOT.'/fourn/fiche.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.$obj->nom.'</a></td>';
+        print '<td><a href="'.DOL_URL_ROOT.'/fourn/fiche.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.$obj->name.'</a></td>';
         print '<td>'.$obj->email.'</td>';
         print '<td>'.$obj->phone.'</td>';
 
@@ -131,7 +132,8 @@ else
     dol_print_error($db);
 }
 
-$db->close();
 
 llxFooter();
+
+$db->close();
 ?>
diff --git a/htdocs/societe/commerciaux.php b/htdocs/societe/commerciaux.php
index 5f0f7af2410f0c247f1ca1ed947bad29ac10f8b9..0fa9f78353b3886f86c804da7ddd0257065c1e7d 100644
--- a/htdocs/societe/commerciaux.php
+++ b/htdocs/societe/commerciaux.php
@@ -46,7 +46,7 @@ $hookmanager->initHooks(array('salesrepresentativescard'));
 if($_GET["socid"] && $_GET["commid"])
 {
 	$action = 'add';
-	
+
 	if ($user->rights->societe->creer)
 	{
 
@@ -54,10 +54,10 @@ if($_GET["socid"] && $_GET["commid"])
 		$soc->id = $_GET["socid"];
 		$soc->fetch($_GET["socid"]);
 
-	
+
 		$parameters=array('id'=>$_GET["commid"]);
 		$reshook=$hookmanager->executeHooks('doActions',$parameters,$soc,$action);    // Note that $action and $object may have been modified by some hooks
-		$error=$hookmanager->error; $errors=array_merge($errors, (array) $hookmanager->errors);		
+		$error=$hookmanager->error; $errors=array_merge($errors, (array) $hookmanager->errors);
 
 
 		if (empty($reshook)) $soc->add_commercial($user, $_GET["commid"]);
@@ -74,19 +74,19 @@ if($_GET["socid"] && $_GET["commid"])
 
 if($_GET["socid"] && $_GET["delcommid"])
 {
-	$action = 'delete';	
-	
+	$action = 'delete';
+
 	if ($user->rights->societe->creer)
 	{
 		$soc = new Societe($db);
 		$soc->id = $_GET["socid"];
 		$soc->fetch($_GET["socid"]);
-		
+
 		$parameters=array('id'=>$_GET["delcommid"]);
 		$reshook=$hookmanager->executeHooks('doActions',$parameters,$soc,$action);    // Note that $action and $object may have been modified by some hooks
-		$error=$hookmanager->error; $errors=array_merge($errors, (array) $hookmanager->errors);		
-		
-		
+		$error=$hookmanager->error; $errors=array_merge($errors, (array) $hookmanager->errors);
+
+
 		if (empty($reshook)) $soc->del_commercial($user, $_GET["delcommid"]);
 
 		header("Location: commerciaux.php?socid=".$soc->id);
@@ -116,7 +116,7 @@ if ($_GET["socid"])
 	$result=$soc->fetch($_GET["socid"]);
 
 	$action='view';
-	
+
 	$head=societe_prepare_head2($soc);
 
 	dol_fiche_head($head, 'salesrepresentative', $langs->trans("ThirdParty"),0,'company');
@@ -182,13 +182,13 @@ if ($_GET["socid"])
  			$parameters=array('socid'=>$soc->id);
         	$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$obj,$action);    // Note that $action and $object may have been modified by hook
       		if (empty($reshook)) {
-      			
+
 				null; // actions in normal case
       		}
 
 			print '<a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$obj->rowid.'">';
 			print img_object($langs->trans("ShowUser"),"user").' ';
-			print $obj->firstname." " .$obj->name."\n";
+			print $obj->firstname." " .$obj->lastname."\n";
 			print '</a>&nbsp;';
 			if ($user->rights->societe->creer)
 			{
@@ -254,7 +254,7 @@ if ($_GET["socid"])
 				print "<tr $bc[$var]><td>";
 				print '<a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$obj->rowid.'">';
 				print img_object($langs->trans("ShowUser"),"user").' ';
-				print stripslashes($obj->firstname)." " .stripslashes($obj->name)."\n";
+				print $obj->firstname." " .$obj->lastname."\n";
 				print '</a>';
 				print '</td><td>'.$obj->login.'</td>';
 				print '<td><a href="commerciaux.php?socid='.$_GET["socid"].'&amp;commid='.$obj->rowid.'">'.$langs->trans("Add").'</a></td>';
diff --git a/htdocs/societe/notify/fiche.php b/htdocs/societe/notify/fiche.php
index 785326f076da82a15b9cad991ab199109bdd1d93..2499ae30a5b9f65ec6d21ff99b8497958c9de168 100644
--- a/htdocs/societe/notify/fiche.php
+++ b/htdocs/societe/notify/fiche.php
@@ -301,7 +301,7 @@ if ($result > 0)
             $obj = $db->fetch_object($resql);
 
             $contactstatic->id=$obj->contactid;
-            $contactstatic->name=$obj->name;
+            $contactstatic->lastname=$obj->lastname;
             $contactstatic->firstname=$obj->firstname;
             print '<tr '.$bc[$var].'><td>'.$contactstatic->getNomUrl(1);
             if ($obj->type == 'email')
@@ -378,7 +378,7 @@ if ($result > 0)
             $obj = $db->fetch_object($resql);
 
             $contactstatic->id=$obj->id;
-            $contactstatic->name=$obj->name;
+            $contactstatic->lastname=$obj->lastname;
             $contactstatic->firstname=$obj->firstname;
             print '<tr '.$bc[$var].'><td>'.$contactstatic->getNomUrl(1);
             print $obj->email?' &lt;'.$obj->email.'&gt;':$langs->trans("NoMail");
diff --git a/htdocs/societe/notify/index.php b/htdocs/societe/notify/index.php
index 9b20118298a0d45809414cbf9d020610b5ad8e73..9a1fc344a53d85ba0d3372d63756836a02e7a129 100644
--- a/htdocs/societe/notify/index.php
+++ b/htdocs/societe/notify/index.php
@@ -57,7 +57,7 @@ $pagenext = $page + 1;
 
 llxHeader();
 
-$sql = "SELECT s.nom, s.rowid as socid, c.name, c.firstname, a.label, n.rowid";
+$sql = "SELECT s.nom, s.rowid as socid, c.lastname, c.firstname, a.label, n.rowid";
 $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c,";
 $sql.= " ".MAIN_DB_PREFIX."c_action_trigger as a,";
 $sql.= " ".MAIN_DB_PREFIX."notify_def as n,";
@@ -83,7 +83,7 @@ if ($result)
 	print '<table class="noborder" width="100%">';
 	print '<tr class="liste_titre">';
 	print_liste_field_titre($langs->trans("Company"),"index.php","s.nom","","",'valign="center"',$sortfield,$sortorder);
-	print_liste_field_titre($langs->trans("Contact"),"index.php","c.name","","",'valign="center"',$sortfield,$sortorder);
+	print_liste_field_titre($langs->trans("Contact"),"index.php","c.lastname","","",'valign="center"',$sortfield,$sortorder);
 	print_liste_field_titre($langs->trans("Action"),"index.php","a.titre","","",'valign="center"',$sortfield,$sortorder);
 	print "</tr>\n";
 	$var=True;
@@ -95,7 +95,7 @@ if ($result)
 
 		print "<tr $bc[$var]>";
 		print "<td><a href=\"fiche.php?socid=".$obj->socid."\">$obj->nom</A></td>\n";
-		print "<td>".$obj->firstname." ".$obj->name."</td>\n";
+		print "<td>".$obj->firstname." ".$obj->lastname."</td>\n";
 		print "<td>".$obj->titre."</td>\n";
 		print "</tr>\n";
 		$i++;
diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php
index 5008f51159cb7d2c0fc8fd50ed51622e284532f0..feb1b6164e053a98cc4e846b0dea29b3f1ef8617 100644
--- a/htdocs/user/class/user.class.php
+++ b/htdocs/user/class/user.class.php
@@ -188,7 +188,7 @@ class User extends CommonObject
 				$this->ref_ext 		= $obj->ref_ext;
 
 				$this->ldap_sid 	= $obj->ldap_sid;
-				$this->lastname		= $obj->name;
+				$this->lastname		= $obj->lastname;
 				$this->firstname 	= $obj->firstname;
 
 				$this->login		= $obj->login;
@@ -2194,7 +2194,7 @@ class User extends CommonObject
 				$this->users[$obj->rowid]['id'] = $obj->rowid;
 				$this->users[$obj->rowid]['fk_user'] = $obj->fk_user;
 				$this->users[$obj->rowid]['firstname'] = $obj->firstname;
-				$this->users[$obj->rowid]['name'] = $obj->name;
+				$this->users[$obj->rowid]['lastname'] = $obj->lastname;
 				$this->users[$obj->rowid]['login'] = $obj->login;
 				$this->users[$obj->rowid]['statut'] = $obj->statut;
 				$i++;
diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php
index 5876e05a2135b2108fbcada0be5af5ea36c30164..ef554f85d2cf041f415883fdf107f012d7d902aa 100644
--- a/htdocs/user/class/usergroup.class.php
+++ b/htdocs/user/class/usergroup.class.php
@@ -96,7 +96,6 @@ class UserGroup extends CommonObject
 				$this->id = $obj->rowid;
 				$this->ref = $obj->rowid;
 				$this->entity = $obj->entity;
-				$this->nom  = $obj->name;        // depecated
 				$this->name = $obj->name;
 				$this->note = $obj->note;
 				$this->datec = $obj->datec;
diff --git a/scripts/company/export-contacts-xls-example.php b/scripts/company/export-contacts-xls-example.php
index 3b21137eed2a04169c141e89e97439f568479133..a07813b3606e306e89478fdb29ed728901487078 100644
--- a/scripts/company/export-contacts-xls-example.php
+++ b/scripts/company/export-contacts-xls-example.php
@@ -2,7 +2,7 @@
 <?php
 /*
  * Copyright (C) 2004      Rodolphe Quiedeville <rodolphe@quiedeville.org>
- * Copyright (C) 2009-2011 Laurent Destailleur  <eldy@users.sourceforge.net>
+ * Copyright (C) 2009-2013 Laurent Destailleur  <eldy@users.sourceforge.net>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -57,8 +57,8 @@ $fname = DOL_DATA_ROOT.'/export-contacts.xls';
 
 //$objPHPExcel = new writeexcel_workbook($fname);
 $objPHPExcel = new PHPExcel();
-$objPHPExcel->getProperties()->setCreator("Maarten Balliauw");
-$objPHPExcel->getProperties()->setLastModifiedBy("Maarten Balliauw");
+$objPHPExcel->getProperties()->setCreator("Dolibarr script");
+$objPHPExcel->getProperties()->setLastModifiedBy("Dolibarr script");
 $objPHPExcel->getProperties()->setTitle("Test Document");
 $objPHPExcel->getProperties()->setSubject("Test Document");
 $objPHPExcel->getProperties()->setDescription("Test document, generated using PHP classes.");
@@ -70,7 +70,7 @@ $objPHPExcel->getActiveSheet()->setTitle('Contacts');
 
 //$page->set_column(0,4,18); // A
 
-$sql = "SELECT distinct c.name as lastname, c.firstname, c.email, s.nom as name";
+$sql = "SELECT distinct c.lastname, c.firstname, c.email, s.nom as name";
 $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c";
 $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on s.rowid = c.fk_soc";
 
diff --git a/scripts/invoices/email_unpaid_invoices_to_representatives.php b/scripts/invoices/email_unpaid_invoices_to_representatives.php
index 19741c5f7a0a27c9de54afe4e31dc513bb1e510f..2d3bd6f6c758f89c65332f3f167719be654da65d 100755
--- a/scripts/invoices/email_unpaid_invoices_to_representatives.php
+++ b/scripts/invoices/email_unpaid_invoices_to_representatives.php
@@ -85,7 +85,7 @@ if ($resql)
                 $total = 0;
             }
 
-            $message .= "Facture ".$obj->facnumber." : ".price($obj->total_ttc)." : ".$obj->name."\n";
+            $message .= $langs->trans("Invoice")." ".$obj->facnumber." : ".price($obj->total_ttc)." : ".$obj->name."\n";
             $total += $obj->total_ttc;
 
             dol_syslog("email_unpaid_invoices_to_representatives.php: ".$obj->email);