From aa625598128b1b8f5a7a45abccd578a479963b0c Mon Sep 17 00:00:00 2001
From: Regis Houssin <regis@dolibarr.fr>
Date: Fri, 6 Aug 2010 13:56:25 +0000
Subject: [PATCH] Fix: fetch_client is deprecated

---
 htdocs/comm/propal/class/propal.class.php     |  2 +-
 htdocs/comm/propal/contact.php                |  2 +-
 htdocs/comm/propal/document.php               |  2 +-
 htdocs/comm/propal/note.php                   |  2 +-
 htdocs/commande/contact.php                   |  2 +-
 htdocs/commande/fiche.php                     | 18 +++++++-------
 htdocs/compta/facture.php                     | 24 +++++++++----------
 htdocs/compta/facture/class/facture.class.php |  2 +-
 htdocs/compta/facture/contact.php             |  2 +-
 htdocs/compta/facture/fiche-rec.php           |  2 +-
 htdocs/compta/paiement.php                    |  4 ++--
 htdocs/contrat/fiche.php                      |  2 +-
 htdocs/core/class/commonobject.class.php      |  9 -------
 htdocs/expedition/fiche.php                   |  4 ++--
 htdocs/fichinter/contact.php                  |  2 +-
 htdocs/fichinter/document.php                 |  2 +-
 htdocs/fichinter/fiche.php                    | 16 ++++++-------
 htdocs/fourn/facture/contact.php              |  2 +-
 .../modules/commande/pdf_einstein.modules.php |  2 +-
 .../pdf/pdf_expedition_merou.modules.php      |  4 ++--
 .../pdf/pdf_expedition_rouget.modules.php     |  2 +-
 .../modules/facture/modules_facture.php       |  2 +-
 .../modules/facture/pdf_crabe.modules.php     |  2 +-
 .../modules/facture/pdf_oursin.modules.php    |  2 +-
 .../modules/fichinter/pdf_soleil.modules.php  |  2 +-
 .../livraison/pdf/pdf_sirocco.modules.php     |  2 +-
 .../livraison/pdf/pdf_typhon.modules.php      |  2 +-
 .../project/pdf/pdf_baleine.modules.php       |  2 +-
 .../propale/pdf_propale_azur.modules.php      |  2 +-
 .../propale/pdf_propale_jaune.modules.php     |  2 +-
 htdocs/livraison/fiche.php                    |  4 ++--
 htdocs/projet/element.php                     |  2 +-
 htdocs/public/paybox/newpayment.php           |  6 ++---
 htdocs/societe/soc.php                        |  2 +-
 test/CommonObjectTest.php                     |  2 +-
 35 files changed, 66 insertions(+), 75 deletions(-)

diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php
index 3328f7d9153..1502418f9a0 100644
--- a/htdocs/comm/propal/class/propal.class.php
+++ b/htdocs/comm/propal/class/propal.class.php
@@ -575,7 +575,7 @@ class Propal extends CommonObject
 
 		$this->db->begin();
 
-		$this->fetch_client();
+		$this->fetch_thirdparty();
 
 		// Insertion dans la base
 		$sql = "INSERT INTO ".MAIN_DB_PREFIX."propal (";
diff --git a/htdocs/comm/propal/contact.php b/htdocs/comm/propal/contact.php
index e7e19ad818b..77180a4d22f 100644
--- a/htdocs/comm/propal/contact.php
+++ b/htdocs/comm/propal/contact.php
@@ -202,7 +202,7 @@ if ($id > 0 || ! empty($ref))
 
 		// Customer
 		if ( is_null($propal->client) )
-			$propal->fetch_client();
+			$propal->fetch_thirdparty();
 		print "<tr><td>".$langs->trans("Company")."</td>";
 		print '<td colspan="3">'.$propal->client->getNomUrl(1).'</td></tr>';
 
diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php
index f00b6d29153..337acb8bdf1 100644
--- a/htdocs/comm/propal/document.php
+++ b/htdocs/comm/propal/document.php
@@ -174,7 +174,7 @@ if ($id > 0 || ! empty($ref))
 
 		// Customer
 		if ( is_null($propal->client) )
-			$propal->fetch_client();
+			$propal->fetch_thirdparty();
 		print "<tr><td>".$langs->trans("Company")."</td>";
 		print '<td colspan="3">'.$propal->client->getNomUrl(1).'</td></tr>';
 
diff --git a/htdocs/comm/propal/note.php b/htdocs/comm/propal/note.php
index 05399564068..d75df348f83 100644
--- a/htdocs/comm/propal/note.php
+++ b/htdocs/comm/propal/note.php
@@ -133,7 +133,7 @@ if ($id > 0 || ! empty($ref))
 
 			// Customer
 			if ( is_null($propal->client) )
-				$propal->fetch_client();
+				$propal->fetch_thirdparty();
 			print "<tr><td>".$langs->trans("Company")."</td>";
 			print '<td colspan="3">'.$propal->client->getNomUrl(1).'</td></tr>';
 
diff --git a/htdocs/commande/contact.php b/htdocs/commande/contact.php
index a959db0b159..2dfbf8c829e 100644
--- a/htdocs/commande/contact.php
+++ b/htdocs/commande/contact.php
@@ -202,7 +202,7 @@ if ($id > 0 || ! empty($ref))
 
 		// Customer
 		if ( is_null($commande->client) )
-			$commande->fetch_client();
+			$commande->fetch_thirdparty();
 
 		print "<tr><td>".$langs->trans("Company")."</td>";
 		print '<td colspan="3">'.$commande->client->getNomUrl(1).'</td></tr>';
diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php
index 9f6d13a1c42..0b90191304d 100644
--- a/htdocs/commande/fiche.php
+++ b/htdocs/commande/fiche.php
@@ -139,7 +139,7 @@ if ($_REQUEST['action'] == 'confirm_deleteline' && $_REQUEST['confirm'] == 'yes'
 	{
 		$commande = new Commande($db);
 		$commande->fetch($_GET['id']);
-		$commande->fetch_client();
+		$commande->fetch_thirdparty();
 
 		$result = $commande->delete_line($_GET['lineid']);
 		if ($result > 0)
@@ -182,7 +182,7 @@ if ($_POST['action'] == 'add' && $user->rights->commande->creer)
 
 	$commande = new Commande($db);
 	$commande->socid=$_POST['socid'];
-	$commande->fetch_client();
+	$commande->fetch_thirdparty();
 
 	$db->begin();
 
@@ -377,7 +377,7 @@ if ($_POST['action'] == 'addline' && $user->rights->commande->creer)
 			dol_print_error($db,$commande->error);
 			exit;
 		}
-		$ret=$commande->fetch_client();
+		$ret=$commande->fetch_thirdparty();
 
 		// Clean parameters
 		$suffixe = $_POST['idprod'] ? '_prod' : '';
@@ -514,7 +514,7 @@ if ($_POST['action'] == 'updateligne' && $user->rights->commande->creer && $_POS
 {
 	$commande = new Commande($db,'',$_POST['id']);
 	if (! $commande->fetch($_POST['id']) > 0) dol_print_error($db);
-	$commande->fetch_client();
+	$commande->fetch_thirdparty();
 
 	// Clean parameters
 	$date_start='';
@@ -613,7 +613,7 @@ if ($_REQUEST['action'] == 'confirm_validate' && $_REQUEST['confirm'] == 'yes' &
 {
 	$commande = new Commande($db);
 	$commande->fetch($_GET['id']);	// Load order and lines
-	$commande->fetch_client();
+	$commande->fetch_thirdparty();
 
 	$result=$commande->valid($user);
 	if ($result	>= 0)
@@ -655,7 +655,7 @@ if ($_GET['action'] == 'modif' && $user->rights->commande->creer)
 	 */
 	$commande = new Commande($db);
 	$commande->fetch($_GET['id']);		// Load order and lines
-	$commande->fetch_client();
+	$commande->fetch_thirdparty();
 
 	$result = $commande->set_draft($user);
 	if ($result	>= 0)
@@ -682,7 +682,7 @@ if ($_GET['action'] == 'up' && $user->rights->commande->creer)
 {
 	$commande = new Commande($db,'',$_GET['id']);
 	$commande->fetch($_GET['id']);
-	$commande->fetch_client();
+	$commande->fetch_thirdparty();
 	$commande->line_up($_GET['rowid']);
 
 	// Define output language
@@ -706,7 +706,7 @@ if ($_GET['action'] == 'down' && $user->rights->commande->creer)
 {
 	$commande = new Commande($db,'',$_GET['id']);
 	$commande->fetch($_GET['id']);
-	$commande->fetch_client();
+	$commande->fetch_thirdparty();
 	$commande->line_down($_GET['rowid']);
 
 	// Define output language
@@ -735,7 +735,7 @@ if ($_REQUEST['action'] == 'builddoc')	// In get or post
 	// Sauvegarde le dernier modele choisi pour generer un document
 	$commande = new Commande($db, 0, $_REQUEST['id']);
 	$result=$commande->fetch($_REQUEST['id']);
-	$commande->fetch_client();
+	$commande->fetch_thirdparty();
 
 	if ($_REQUEST['model'])
 	{
diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index a56536a308e..a56b37dcf54 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -142,7 +142,7 @@ if ($_REQUEST['action'] == 'confirm_deleteproductline' && $_REQUEST['confirm'] =
 	{
 		$fac = new Facture($db);
 		$fac->fetch($_GET['facid']);
-		$fac->fetch_client();
+		$fac->fetch_thirdparty();
 
 		$result = $fac->deleteline($_GET['rowid'], $user);
 		if ($result > 0)
@@ -306,7 +306,7 @@ if ($_REQUEST['action'] == 'confirm_valid' && $_REQUEST['confirm'] == 'yes' && $
 {
 	$fac = new Facture($db);
 	$fac->fetch($_GET['facid']);
-	$fac->fetch_client();
+	$fac->fetch_thirdparty();
 
 	$result = $fac->validate($user);
 	if ($result >= 0)
@@ -334,7 +334,7 @@ if ($_GET['action'] == 'modif' && $user->rights->facture->unvalidate)
 {
 	$fac = new Facture($db);
 	$fac->fetch($_GET['facid']);
-	$fac->fetch_client();
+	$fac->fetch_thirdparty();
 
 	// On verifie si la facture a des paiements
 	$sql = 'SELECT pf.amount';
@@ -430,7 +430,7 @@ if ($_REQUEST['action'] == 'confirm_converttoreduc' && $_REQUEST['confirm'] == '
 
 	$fac = new Facture($db);
 	$fac->fetch($_GET['facid']);
-	$fac->fetch_client();
+	$fac->fetch_thirdparty();
 	$fac->fetch_lines();
 
 	if (! $fac->paye)	// protection against multiple submit
@@ -529,7 +529,7 @@ if ($_POST['action'] == 'add' && $user->rights->facture->creer)
 		{
 			// This is a replacement invoice
 			$result=$facture->fetch($_POST['fac_replacement']);
-			$facture->fetch_client();
+			$facture->fetch_thirdparty();
 
 			$facture->date           = $datefacture;
 			$facture->note_public    = trim($_POST['note_public']);
@@ -820,7 +820,7 @@ if (($_POST['action'] == 'addline' || $_POST['action'] == 'addline_predef') && $
 			dol_print_error($db,$fac->error);
 			exit;
 		}
-		$ret=$fac->fetch_client();
+		$ret=$fac->fetch_thirdparty();
 
 		$suffixe = $_POST['idprod'] ? '_predef' : '';
 		$date_start=dol_mktime($_POST['date_start'.$suffixe.'hour'],$_POST['date_start'.$suffixe.'min'],$_POST['date_start'.$suffixe.'sec'],$_POST['date_start'.$suffixe.'month'],$_POST['date_start'.$suffixe.'day'],$_POST['date_start'.$suffixe.'year']);
@@ -956,7 +956,7 @@ if ($_POST['action'] == 'updateligne' && $user->rights->facture->creer && $_POST
 {
 	$fac = new Facture($db,'',$_POST['facid']);
 	if (! $fac->fetch($_POST['facid']) > 0) dol_print_error($db);
-	$fac->fetch_client();
+	$fac->fetch_thirdparty();
 
 	// Clean parameters
 	$date_start='';
@@ -1054,7 +1054,7 @@ if ($_GET['action'] == 'up' && $user->rights->facture->creer)
 {
 	$fac = new Facture($db,'',$_GET['facid']);
 	$fac->fetch($_GET['facid']);
-	$fac->fetch_client();
+	$fac->fetch_thirdparty();
 	$fac->line_up($_GET['rowid']);
 
 	// Define output language
@@ -1077,7 +1077,7 @@ if ($_GET['action'] == 'down' && $user->rights->facture->creer)
 {
 	$fac = new Facture($db,'',$_GET['facid']);
 	$fac->fetch($_GET['facid']);
-	$fac->fetch_client();
+	$fac->fetch_thirdparty();
 	$fac->line_down($_GET['rowid']);
 
 	// Define output language
@@ -1306,7 +1306,7 @@ if ($_REQUEST['action'] == 'builddoc')	// En get ou en post
 {
 	$fac = new Facture($db, 0, $_GET['facid']);
 	$fac->fetch($_GET['facid']);
-	$fac->fetch_client();
+	$fac->fetch_thirdparty();
 
 	if ($_REQUEST['model'])
 	{
@@ -1383,7 +1383,7 @@ if ($_GET['action'] == 'create')
 		$classname = ucfirst($subelement);
 		$object = new $classname($db);
 		$object->fetch($_GET['originid']);
-		$object->fetch_client();
+		$object->fetch_thirdparty();
 
 		$projectid			= (!empty($object->fk_project)?$object->fk_project:'');
 		$ref_client			= (!empty($object->ref_client)?$object->ref_client:'');
@@ -1930,7 +1930,7 @@ else
 		{
 			if ($user->societe_id>0 && $user->societe_id!=$fac->socid)  accessforbidden('',0);
 
-			$result=$fac->fetch_client();
+			$result=$fac->fetch_thirdparty();
 
 			$soc = new Societe($db, $fac->socid);
 			$soc->fetch($fac->socid);
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index db2e5b249bd..0ff4eb26d26 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -1321,7 +1321,7 @@ class Facture extends CommonObject
 
 		$this->db->begin();
 
-		$this->fetch_client();
+		$this->fetch_thirdparty();
 		$this->fetch_lines();
 
 		// Check parameters
diff --git a/htdocs/compta/facture/contact.php b/htdocs/compta/facture/contact.php
index 3fc107c5642..c4920758aab 100644
--- a/htdocs/compta/facture/contact.php
+++ b/htdocs/compta/facture/contact.php
@@ -168,7 +168,7 @@ if ($id > 0 || ! empty($ref))
 	$facture = new Facture($db);
 	if ($facture->fetch($id, $ref) > 0)
 	{
-		$facture->fetch_client();
+		$facture->fetch_thirdparty();
 
 		$head = facture_prepare_head($facture);
 
diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php
index 4a4ce263270..d0829a1a13c 100644
--- a/htdocs/compta/facture/fiche-rec.php
+++ b/htdocs/compta/facture/fiche-rec.php
@@ -118,7 +118,7 @@ if ($_GET["action"] == 'create')
 
 		print '<table class="border" width="100%">';
 
-		$facture->fetch_client();
+		$facture->fetch_thirdparty();
 
 		print '<tr><td>'.$langs->trans("Customer").'</td><td>'.$facture->client->getNomUrl(1).'</td>';
 		print '<td>';
diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php
index f84f698eac2..fef83324fa6 100644
--- a/htdocs/compta/paiement.php
+++ b/htdocs/compta/paiement.php
@@ -178,7 +178,7 @@ if ($_POST['action'] == 'confirm_paiement' && $_POST['confirm'] == 'yes')
 						$facid = $key;
 						$fac = new Facture($db);
 						$fac->fetch($facid);
-						$fac->fetch_client();
+						$fac->fetch_thirdparty();
 						$acc->add_url_line($bank_line_id,
 						$paiement_id,
 						DOL_URL_ROOT.'/compta/paiement/fiche.php?id=',
@@ -241,7 +241,7 @@ if ($_GET['action'] == 'create' || $_POST['action'] == 'confirm_paiement' || $_P
 
 	if ($result >= 0)
 	{
-		$facture->fetch_client();
+		$facture->fetch_thirdparty();
 
 		$title='';
 		if ($facture->type != 2) $title.=$langs->trans("EnterPaymentReceivedFromCustomer");
diff --git a/htdocs/contrat/fiche.php b/htdocs/contrat/fiche.php
index 27e37f86947..50948548323 100644
--- a/htdocs/contrat/fiche.php
+++ b/htdocs/contrat/fiche.php
@@ -189,7 +189,7 @@ if ($_POST["action"] == 'addligne' && $user->rights->contrat->creer)
 			dol_print_error($db,$commande->error);
 			exit;
 		}
-		$ret=$contrat->fetch_client();
+		$ret=$contrat->fetch_thirdparty();
 
 		$date_start='';
 		$date_end='';
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 5540a6c4909..db873d2b015 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -453,15 +453,6 @@ class CommonObject
 		return $result;
 	}
 
-	/**
-	 * @deprecated Replaced by fetch_thirdparty
-	 * Kept for backward compatibility
-	 */
-	function fetch_client()
-	{
-		return $this->fetch_thirdparty();
-	}
-
 	/**
 	 *		\brief      Charge le projet d'id $this->fk_project dans this->projet
 	 *		\return		int			<0 if KO, >=0 if OK
diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php
index d6628bdc5be..1a2aed2789b 100644
--- a/htdocs/expedition/fiche.php
+++ b/htdocs/expedition/fiche.php
@@ -149,7 +149,7 @@ if ($_REQUEST["action"] == 'confirm_valid' && $_REQUEST["confirm"] == 'yes' && $
 {
 	$expedition = new Expedition($db);
 	$expedition->fetch($_GET["id"]);
-	$expedition->fetch_client();
+	$expedition->fetch_thirdparty();
 
 	$result = $expedition->valid($user);
 
@@ -266,7 +266,7 @@ if ($_REQUEST['action'] == 'builddoc')	// En get ou en post
 	// Sauvegarde le dernier modele choisi pour generer un document
 	$shipment = new Expedition($db, 0, $_REQUEST['id']);
 	$shipment->fetch($_REQUEST['id']);
-	$shipment->fetch_client();
+	$shipment->fetch_thirdparty();
 
 	if ($_REQUEST['model'])
 	{
diff --git a/htdocs/fichinter/contact.php b/htdocs/fichinter/contact.php
index d1ac731ab95..cae85a04470 100644
--- a/htdocs/fichinter/contact.php
+++ b/htdocs/fichinter/contact.php
@@ -187,7 +187,7 @@ if ($id > 0)
 
 		// Customer
 		if ( is_null($fichinter->client) )
-			$fichinter->fetch_client();
+			$fichinter->fetch_thirdparty();
 
 		print "<tr><td>".$langs->trans("Company")."</td>";
 		print '<td colspan="3">'.$fichinter->client->getNomUrl(1).'</td></tr>';
diff --git a/htdocs/fichinter/document.php b/htdocs/fichinter/document.php
index 480554d31c3..9e880f0ea04 100644
--- a/htdocs/fichinter/document.php
+++ b/htdocs/fichinter/document.php
@@ -109,7 +109,7 @@ llxHeader("","",$langs->trans("InterventionCard"));
 
 if ($object->id)
 {
-	$object->fetch_client();
+	$object->fetch_thirdparty();
 
     $soc = new Societe($db, $object->societe->id);
     $soc->fetch($object->societe->id);
diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php
index 90faa61de4f..f8fe080ade6 100644
--- a/htdocs/fichinter/fiche.php
+++ b/htdocs/fichinter/fiche.php
@@ -86,7 +86,7 @@ if ($_REQUEST['action'] == 'confirm_validate' && $_REQUEST['confirm'] == 'yes')
 {
 	$fichinter = new Fichinter($db);
 	$fichinter->fetch($_GET["id"]);
-	$fichinter->fetch_client();
+	$fichinter->fetch_thirdparty();
 
 	$result = $fichinter->setValid($user, $conf->fichinter->outputdir);
 	if ($result >= 0)
@@ -115,7 +115,7 @@ if ($_REQUEST['action'] == 'confirm_modify' && $_REQUEST['confirm'] == 'yes')
 {
 	$fichinter = new Fichinter($db);
 	$fichinter->fetch($_GET["id"]);
-	$fichinter->fetch_client();
+	$fichinter->fetch_thirdparty();
 
 	$result = $fichinter->setDraft($user);
 	if ($result >= 0)
@@ -196,7 +196,7 @@ if ($_REQUEST['action'] == 'builddoc')	// En get ou en post
 {
 	$fichinter = new Fichinter($db);
 	$fichinter->fetch($_GET['id']);
-	$fichinter->fetch_client();
+	$fichinter->fetch_thirdparty();
 	$fichinter->fetch_lines();
 
 	if ($_REQUEST['model'])
@@ -258,7 +258,7 @@ if ($_POST['action'] == "addligne" && $user->rights->ficheinter->creer)
 	{
 		$fichinter = new Fichinter($db);
 		$ret=$fichinter->fetch($_POST['fichinterid']);
-		$fichinter->fetch_client();
+		$fichinter->fetch_thirdparty();
 
 		$desc=$_POST['np_desc'];
 		$date_intervention = dol_mktime($_POST["dihour"], $_POST["dimin"], 0, $_POST["dimonth"], $_POST["diday"], $_POST["diyear"]);
@@ -305,7 +305,7 @@ if ($_POST['action'] == 'updateligne' && $user->rights->ficheinter->creer && $_P
 		dol_print_error($db);
 		exit;
 	}
-	$fichinter->fetch_client();
+	$fichinter->fetch_thirdparty();
 
 	$desc=$_POST['np_desc'];
 	$date_intervention = dol_mktime($_POST["dihour"], $_POST["dimin"], 0, $_POST["dimonth"], $_POST["diday"], $_POST["diyear"]);
@@ -390,7 +390,7 @@ if ($_GET['action'] == 'up' && $user->rights->ficheinter->creer)
 {
 	$fichinter = new Fichinter($db);
 	$fichinter->fetch($_GET['id']);
-	$fichinter->fetch_client();
+	$fichinter->fetch_thirdparty();
 	$fichinter->line_up($_GET['rowid']);
 
 	// Define output language
@@ -412,7 +412,7 @@ if ($_GET['action'] == 'down' && $user->rights->ficheinter->creer)
 {
 	$fichinter = new Fichinter($db);
 	$fichinter->fetch($_GET['id']);
-	$fichinter->fetch_client();
+	$fichinter->fetch_thirdparty();
 	$fichinter->line_down($_GET['rowid']);
 
 	// Define output language
@@ -549,7 +549,7 @@ elseif ($fichinterid)
 	/*
 	 * Affichage en mode visu
 	 */
-	$fichinter->fetch_client();
+	$fichinter->fetch_thirdparty();
 
 	$societe=new Societe($db);
 	$societe->fetch($fichinter->socid);
diff --git a/htdocs/fourn/facture/contact.php b/htdocs/fourn/facture/contact.php
index a85cac763df..a8a75d07afb 100644
--- a/htdocs/fourn/facture/contact.php
+++ b/htdocs/fourn/facture/contact.php
@@ -168,7 +168,7 @@ if ($id > 0)
 	$facture = new FactureFournisseur($db);
 	if ($facture->fetch($_GET['facid'], $user->societe_id) > 0)
 	{
-		$facture->fetch_client();
+		$facture->fetch_thirdparty();
 
 		$head = facturefourn_prepare_head($facture);
 
diff --git a/htdocs/includes/modules/commande/pdf_einstein.modules.php b/htdocs/includes/modules/commande/pdf_einstein.modules.php
index 0e0941bc3c0..51cb5a44ad2 100644
--- a/htdocs/includes/modules/commande/pdf_einstein.modules.php
+++ b/htdocs/includes/modules/commande/pdf_einstein.modules.php
@@ -905,7 +905,7 @@ class pdf_einstein extends ModelePDFCommandes
 			$pdf->SetFont('Arial','',8);
 			$pdf->SetXY(102,$posy-5);
 			$pdf->MultiCell(80, 4, $outputlangs->transnoentities("BillTo").":");
-			$object->fetch_client();
+			$object->fetch_thirdparty();
 
 			// Cadre client destinataire
 			$pdf->rect(100, $posy, 100, $hautcadre);
diff --git a/htdocs/includes/modules/expedition/pdf/pdf_expedition_merou.modules.php b/htdocs/includes/modules/expedition/pdf/pdf_expedition_merou.modules.php
index 57de2c1d7ab..708e9ebad71 100644
--- a/htdocs/includes/modules/expedition/pdf/pdf_expedition_merou.modules.php
+++ b/htdocs/includes/modules/expedition/pdf/pdf_expedition_merou.modules.php
@@ -95,7 +95,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition
 		//Verification de la configuration
 		if ($conf->expedition->dir_output."/sending")
 		{
-			$object->fetch_client();
+			$object->fetch_thirdparty();
 
 			//Creation de l expediteur
 			$this->expediteur = $mysoc;
@@ -478,7 +478,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition
 		$blSocY = 1;
 		$pdf->Rect($blExpX, $Yoff, $blW, 20);
 
-		$object->fetch_client();
+		$object->fetch_thirdparty();
 
 		// If SHIPPING contact defined on order, we use it
 		$usecontact=false;
diff --git a/htdocs/includes/modules/expedition/pdf/pdf_expedition_rouget.modules.php b/htdocs/includes/modules/expedition/pdf/pdf_expedition_rouget.modules.php
index c3306acb41f..5a46306675b 100644
--- a/htdocs/includes/modules/expedition/pdf/pdf_expedition_rouget.modules.php
+++ b/htdocs/includes/modules/expedition/pdf/pdf_expedition_rouget.modules.php
@@ -230,7 +230,7 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
 	{
 		global $user,$conf,$langs;
 
-		$object->fetch_client();
+		$object->fetch_thirdparty();
 
 		if (! is_object($outputlangs)) $outputlangs=$langs;
 		// Force output charset to ISO, because, FPDF expect text encoded in ISO
diff --git a/htdocs/includes/modules/facture/modules_facture.php b/htdocs/includes/modules/facture/modules_facture.php
index e6849f179b8..b32548282f4 100644
--- a/htdocs/includes/modules/facture/modules_facture.php
+++ b/htdocs/includes/modules/facture/modules_facture.php
@@ -225,7 +225,7 @@ function facture_meta_create($db, $facid, $message="")
 
 	$fac = new Facture($db,"",$facid);
 	$fac->fetch($facid);
-	$fac->fetch_client();
+	$fac->fetch_thirdparty();
 
 	if ($conf->facture->dir_output)
 	{
diff --git a/htdocs/includes/modules/facture/pdf_crabe.modules.php b/htdocs/includes/modules/facture/pdf_crabe.modules.php
index b3468dffc6d..c0e4af49e07 100644
--- a/htdocs/includes/modules/facture/pdf_crabe.modules.php
+++ b/htdocs/includes/modules/facture/pdf_crabe.modules.php
@@ -132,7 +132,7 @@ class pdf_crabe extends ModelePDFFactures
 				$ret=$fac->fetch($id);
 			}
 
-			$fac->fetch_client();
+			$fac->fetch_thirdparty();
 
 			$deja_regle = $fac->getSommePaiement();
 			$amount_credit_notes_included = $fac->getSumCreditNotesUsed();
diff --git a/htdocs/includes/modules/facture/pdf_oursin.modules.php b/htdocs/includes/modules/facture/pdf_oursin.modules.php
index c37d59d41e1..cd0dcf5ea3b 100644
--- a/htdocs/includes/modules/facture/pdf_oursin.modules.php
+++ b/htdocs/includes/modules/facture/pdf_oursin.modules.php
@@ -128,7 +128,7 @@ class pdf_oursin extends ModelePDFFactures
 				$fac = new Facture($this->db);
 				$ret=$fac->fetch($id);
 			}
-			$fac->fetch_client();
+			$fac->fetch_thirdparty();
 
 			$deja_regle = $fac->getSommePaiement();
 			$amount_credit_notes_included = $fac->getSumCreditNotesUsed();
diff --git a/htdocs/includes/modules/fichinter/pdf_soleil.modules.php b/htdocs/includes/modules/fichinter/pdf_soleil.modules.php
index 9702f444787..2539d292715 100644
--- a/htdocs/includes/modules/fichinter/pdf_soleil.modules.php
+++ b/htdocs/includes/modules/fichinter/pdf_soleil.modules.php
@@ -238,7 +238,7 @@ class pdf_soleil extends ModelePDFFicheinter
 				// Client destinataire
 				$pdf->SetTextColor(0,0,0);
 				$pdf->SetFont('Arial','B',12);
-				$fichinter->fetch_client();
+				$fichinter->fetch_thirdparty();
 				$pdf->SetXY(102,42);
 				$pdf->MultiCell(86,5, $outputlangs->convToOutputCharset($carac_client_name));
 				$pdf->SetFont('Arial','B',11);
diff --git a/htdocs/includes/modules/livraison/pdf/pdf_sirocco.modules.php b/htdocs/includes/modules/livraison/pdf/pdf_sirocco.modules.php
index 5e61c218cb8..ba70b72b14d 100644
--- a/htdocs/includes/modules/livraison/pdf/pdf_sirocco.modules.php
+++ b/htdocs/includes/modules/livraison/pdf/pdf_sirocco.modules.php
@@ -110,7 +110,7 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
 				}
 			}
 
-			$object->fetch_client();
+			$object->fetch_thirdparty();
 
 			$nblignes = sizeof($object->lignes);
 
diff --git a/htdocs/includes/modules/livraison/pdf/pdf_typhon.modules.php b/htdocs/includes/modules/livraison/pdf/pdf_typhon.modules.php
index 5aaf3ae7494..3d75ef8ecfd 100644
--- a/htdocs/includes/modules/livraison/pdf/pdf_typhon.modules.php
+++ b/htdocs/includes/modules/livraison/pdf/pdf_typhon.modules.php
@@ -132,7 +132,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
 				}
 			}
 
-			$object->fetch_client();
+			$object->fetch_thirdparty();
 
 			$nblignes = sizeof($object->lignes);
 
diff --git a/htdocs/includes/modules/project/pdf/pdf_baleine.modules.php b/htdocs/includes/modules/project/pdf/pdf_baleine.modules.php
index ed7e0bbd717..5df9c5b142d 100644
--- a/htdocs/includes/modules/project/pdf/pdf_baleine.modules.php
+++ b/htdocs/includes/modules/project/pdf/pdf_baleine.modules.php
@@ -452,7 +452,7 @@ class pdf_baleine extends ModelePDFProjects
 			// Cadre client destinataire
 			$pdf->rect(100, $posy, 100, $hautcadre);
 
-			$object->fetch_client();
+			$object->fetch_thirdparty();
 
 			// Recipient name
 			if (! empty($usecontact))
diff --git a/htdocs/includes/modules/propale/pdf_propale_azur.modules.php b/htdocs/includes/modules/propale/pdf_propale_azur.modules.php
index 0f492d5ae24..d15275842fe 100644
--- a/htdocs/includes/modules/propale/pdf_propale_azur.modules.php
+++ b/htdocs/includes/modules/propale/pdf_propale_azur.modules.php
@@ -130,7 +130,7 @@ class pdf_propale_azur extends ModelePDFPropales
 				$propale = new Propal($this->db,"",$id);
 				$ret=$propale->fetch($id);
 			}
-			$propale->fetch_client();
+			$propale->fetch_thirdparty();
 			$deja_regle = "";
 
 			// Definition de $dir et $file
diff --git a/htdocs/includes/modules/propale/pdf_propale_jaune.modules.php b/htdocs/includes/modules/propale/pdf_propale_jaune.modules.php
index 804e8c5a1d9..fb3773ce59b 100644
--- a/htdocs/includes/modules/propale/pdf_propale_jaune.modules.php
+++ b/htdocs/includes/modules/propale/pdf_propale_jaune.modules.php
@@ -105,7 +105,7 @@ class pdf_propale_jaune extends ModelePDFPropales
 				$propale = new Propal($this->db,"",$id);
 				$ret=$propale->fetch($id);
 			}
-			$propale->fetch_client();
+			$propale->fetch_thirdparty();
 			$deja_regle = "";
 
 			// Definition de $dir et $file
diff --git a/htdocs/livraison/fiche.php b/htdocs/livraison/fiche.php
index 398ca056cef..18d899dcb5d 100644
--- a/htdocs/livraison/fiche.php
+++ b/htdocs/livraison/fiche.php
@@ -104,7 +104,7 @@ if ($_REQUEST["action"] == 'confirm_valid' && $_REQUEST["confirm"] == 'yes' && $
 {
 	$delivery = new Livraison($db);
 	$delivery->fetch($_GET["id"]);
-	$delivery->fetch_client();
+	$delivery->fetch_thirdparty();
 
 	$result = $delivery->valid($user);
 
@@ -392,7 +392,7 @@ else
 	{
 		$delivery = new Livraison($db);
 		$result = $delivery->fetch($_GET["id"]);
-		$delivery->fetch_client();
+		$delivery->fetch_thirdparty();
 
 		$expedition=new Expedition($db);
 		$result = $expedition->fetch($delivery->expedition_id);
diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php
index dbc54a9d50f..42c34f11895 100644
--- a/htdocs/projet/element.php
+++ b/htdocs/projet/element.php
@@ -195,7 +195,7 @@ foreach ($listofreferent as $key => $value)
 			{
 				$element = new $classname($db);
 				$element->fetch($elementarray[$i]);
-				$element->fetch_client();
+				$element->fetch_thirdparty();
 				//print $classname;
 
 				$var=!$var;
diff --git a/htdocs/public/paybox/newpayment.php b/htdocs/public/paybox/newpayment.php
index f41279ba78a..77ae8b18756 100644
--- a/htdocs/public/paybox/newpayment.php
+++ b/htdocs/public/paybox/newpayment.php
@@ -248,7 +248,7 @@ if ($_REQUEST["amount"] == 'order')
 	}
 	else
 	{
-		$result=$order->fetch_client($order->socid);
+		$result=$order->fetch_thirdparty($order->socid);
 	}
 
 	$amount=$order->total_ttc;
@@ -322,7 +322,7 @@ if ($_REQUEST["amount"] == 'invoice')
 	}
 	else
 	{
-		$result=$invoice->fetch_client($invoice->socid);
+		$result=$invoice->fetch_thirdparty($invoice->socid);
 	}
 
 	$amount=$invoice->total_ttc - $invoice->getSommePaiement();
@@ -401,7 +401,7 @@ if ($_REQUEST["amount"] == 'contractline')
 			$result=$contract->fetch($contractline->fk_contrat);
 			if ($result > 0)
 			{
-				$result=$contract->fetch_client($contract->socid);
+				$result=$contract->fetch_thirdparty($contract->socid);
 			}
 			else
 			{
diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php
index 38faa37f96b..243685c2ded 100644
--- a/htdocs/societe/soc.php
+++ b/htdocs/societe/soc.php
@@ -307,7 +307,7 @@ if ($_REQUEST['action'] == 'builddoc')	// En get ou en post
 
 		$soc = new Societe($db);
 		$soc->fetch($socid);
-		$soc->fetch_client();
+		$soc->fetch_thirdparty();
 
 		/*if ($_REQUEST['model'])
 		{
diff --git a/test/CommonObjectTest.php b/test/CommonObjectTest.php
index e3e9840603d..0c148c7da6f 100644
--- a/test/CommonObjectTest.php
+++ b/test/CommonObjectTest.php
@@ -189,7 +189,7 @@ class CommonObjectTest extends PHPUnit_Framework_TestCase
 		$localobject=new Commande($this->savdb);
 		$localobject->fetch(1);
 
-    	$result=$localobject->fetch_client();
+    	$result=$localobject->fetch_thirdparty();
 
 		print __METHOD__." result=".$result."\n";
     	$this->assertLessThanOrEqual($result,0);
-- 
GitLab