diff --git a/dev/skeletons/skeleton_page.php b/dev/skeletons/skeleton_page.php
index ac329318ae53c58b500d01b345f4821cecb4f54f..482208e8ab1dce80100a4b47f025316e212766d7 100644
--- a/dev/skeletons/skeleton_page.php
+++ b/dev/skeletons/skeleton_page.php
@@ -353,7 +353,7 @@ if ($id && (empty($action) || $action == 'view'))
 
 	// Example 2 : Adding links to objects
 	// The class must extends CommonObject class to have this method available
-	//$somethingshown=$object->showLinkedObjectBlock();
+	//$somethingshown=$form->showLinkedObjectBlock($object);
 
 }
 
diff --git a/htdocs/cashdesk/admin/cashdesk.php b/htdocs/cashdesk/admin/cashdesk.php
index a8ef98b0b0b4b02e832bdcc3f81a74354cc7ada7..48804958b209e9d1cd74d5593ff53d792db7c71f 100644
--- a/htdocs/cashdesk/admin/cashdesk.php
+++ b/htdocs/cashdesk/admin/cashdesk.php
@@ -102,7 +102,7 @@ print "</tr>\n";
 $var=!$var;
 print '<tr '.$bc[$var].'><td width=\"50%\">'.$langs->trans("CashDeskThirdPartyForSell").'</td>';
 print '<td colspan="2">';
-print $form->select_thirdparty($conf->global->CASHDESK_ID_THIRDPARTY,'socid','s.client in (1,3)',0,array(),1);
+print $form->select_company($conf->global->CASHDESK_ID_THIRDPARTY,'socid','s.client in (1,3)',1,0,1,array(),0);
 print '</td></tr>';
 if (! empty($conf->banque->enabled))
 {
@@ -133,17 +133,17 @@ if (! empty($conf->stock->enabled))
 	if (empty($conf->productbatch->enabled)) {
 	   print $form->selectyesno('CASHDESK_NO_DECREASE_STOCK',$conf->global->CASHDESK_NO_DECREASE_STOCK,1);
 	}
-	else 
+	else
 	{
 	    if (!$conf->global->CASHDESK_NO_DECREASE_STOCK) {
 	       $res = dolibarr_set_const($db,"CASHDESK_NO_DECREASE_STOCK",1,'chaine',0,'',$conf->entity);
 	    }
-	    print $langs->trans('StockDecreaseForPointOfSaleDisabledbyBatch'); 
+	    print $langs->trans('StockDecreaseForPointOfSaleDisabledbyBatch');
 	}
 	print '</td></tr>';
 
 	$disabled=$conf->global->CASHDESK_NO_DECREASE_STOCK;
-	
+
 	$var=!$var;
 	print '<tr '.$bc[$var].'><td>'.$langs->trans("CashDeskIdWareHouse").'</td>';	// Force warehouse (this is not a default value)
 	print '<td colspan="2">';
diff --git a/htdocs/comm/askpricesupplier/card.php b/htdocs/comm/askpricesupplier/card.php
index 6759ae22196341aacc529c48785eb6d16c704af4..939d874a0f250035ddcdb021aa6a79d87a000993 100644
--- a/htdocs/comm/askpricesupplier/card.php
+++ b/htdocs/comm/askpricesupplier/card.php
@@ -1712,7 +1712,7 @@ if ($action == 'create')
 		/*
 		 * Linked object block
 		*/
-		$somethingshown = $object->showLinkedObjectBlock();
+		$somethingshown = $form->showLinkedObjectBlock($object);
 
 		print '</div><div class="fichehalfright"><div class="ficheaddleft">';
 
diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php
index ce22d192f81c57420ec63f140eceebf507a69528..ccdcd8504933c4161463076a66316b5370156e25 100644
--- a/htdocs/comm/propal.php
+++ b/htdocs/comm/propal.php
@@ -2310,7 +2310,7 @@ if ($action == 'create')
 		/*
 		 * Linked object block
 		*/
-		$somethingshown = $object->showLinkedObjectBlock();
+		$somethingshown = $form->showLinkedObjectBlock($object);
 
 		print '</div><div class="fichehalfright"><div class="ficheaddleft">';
 		// print '</td><td valign="top" width="50%">';
diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php
index fcd96f8c898dc3de2536ef4d884413246b5b45c3..04ea05d3f5d08076b423d379096b074075388c93 100644
--- a/htdocs/commande/card.php
+++ b/htdocs/commande/card.php
@@ -2308,7 +2308,7 @@ if ($action == 'create' && $user->rights->commande->creer)
 			/*
 			 * Linked object block
 			 */
-			$somethingshown = $object->showLinkedObjectBlock();
+			$somethingshown = $form->showLinkedObjectBlock($object);
 
 			print '</div><div class="fichehalfright"><div class="ficheaddleft">';
 			// print '</td><td valign="top" width="50%">';
diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index 379d2d2ee5ddaa9a9b2bc2a410373edd45333dae..3abe4fc6c99bf880dceefdd0fd1f54c5dfd58532 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -3776,7 +3776,7 @@ if ($action == 'create')
 		$somethingshown = $formfile->numoffiles;
 
 		// Linked object block
-		$somethingshown = $object->showLinkedObjectBlock();
+		$somethingshown = $form->showLinkedObjectBlock($object);
 
 		$linktoelem='';
 
diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php
index 192a2d16b1785823fa41a8a1c0fc1fe0ea028c5f..3df24e4e667189ca777d7dd8e11a811011f2b6b6 100644
--- a/htdocs/contrat/card.php
+++ b/htdocs/contrat/card.php
@@ -1874,7 +1874,7 @@ else
         /*
          * Linked object block
          */
-        $somethingshown=$object->showLinkedObjectBlock();
+        $somethingshown=$form->showLinkedObjectBlock($object);
 
         print '</div><div class="fichehalfright"><div class="ficheaddleft">';
 
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 4c511726979559e460c5acc94f8870bcf1200aa6..3ea0e010eb5e7ebe601dbc12735b6dcb12e07c67 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -135,8 +135,8 @@ abstract class CommonObject
 
 		$sql = "SELECT rowid, ref, ref_ext";
 		$sql.= " FROM ".MAIN_DB_PREFIX.$element;
-		$sql.= " WHERE entity IN (".getEntity($element).")" ; 
-		
+		$sql.= " WHERE entity IN (".getEntity($element).")" ;
+
 		if ($id > 0) $sql.= " AND rowid = ".$db->escape($id);
 		else if ($ref) $sql.= " AND ref = '".$db->escape($ref)."'";
 		else if ($ref_ext) $sql.= " AND ref_ext = '".$db->escape($ref_ext)."'";
@@ -2580,88 +2580,19 @@ abstract class CommonObject
     // TODO: All functions here must be redesigned and moved as they are not business functions but output functions
     // --------------------
 
-    /* This is to show linked object block */
-
     /**
-     *  Show linked object block
-     *  TODO Move this into html.class.php
-     *  But for the moment we don't know if it's possible as we keep a method available on overloaded objects.
+     *  Show linked object block.
      *
-     *  @return	int
+     *  @return		int		<0 if KO, >0 if OK
+     *  @deprecated Use instead $form->shoLinkedObjectBlock($object)
      */
     function showLinkedObjectBlock()
     {
-        global $conf,$langs,$hookmanager;
-        global $bc;
-
-        $this->fetchObjectLinked();
-
-        // Bypass the default method
-        $hookmanager->initHooks(array('commonobject'));
-        $parameters=array();
-        $reshook=$hookmanager->executeHooks('showLinkedObjectBlock',$parameters,$this,$action);    // Note that $action and $object may have been modified by hook
-
-        if (empty($reshook))
-        {
-        	$num = count($this->linkedObjects);
-
-        	foreach($this->linkedObjects as $objecttype => $objects)
-        	{
-        		$tplpath = $element = $subelement = $objecttype;
-
-        		if (preg_match('/^([^_]+)_([^_]+)/i',$objecttype,$regs))
-        		{
-        			$element = $regs[1];
-        			$subelement = $regs[2];
-        			$tplpath = $element.'/'.$subelement;
-        		}
-
-        		// To work with non standard path
-        		if ($objecttype == 'facture')          {
-        			$tplpath = 'compta/'.$element;
-        			if (empty($conf->facture->enabled)) continue;	// Do not show if module disabled
-        		}
-        		else if ($objecttype == 'propal')           {
-        			$tplpath = 'comm/'.$element;
-        			if (empty($conf->propal->enabled)) continue;	// Do not show if module disabled
-        		}
-        		else if ($objecttype == 'askpricesupplier')           {
-        			$tplpath = 'comm/'.$element;
-        			if (empty($conf->askpricesupplier->enabled)) continue;	// Do not show if module disabled
-        		}
-        		else if ($objecttype == 'shipping' || $objecttype == 'shipment') {
-        			$tplpath = 'expedition';
-        			if (empty($conf->expedition->enabled)) continue;	// Do not show if module disabled
-        		}
-        		else if ($objecttype == 'delivery')         {
-        			$tplpath = 'livraison';
-        			if (empty($conf->expedition->enabled)) continue;	// Do not show if module disabled
-        		}
-        		else if ($objecttype == 'invoice_supplier') {
-        			$tplpath = 'fourn/facture';
-        		}
-        		else if ($objecttype == 'order_supplier')   {
-        			$tplpath = 'fourn/commande';
-        		}
-
-        		global $linkedObjectBlock;
-        		$linkedObjectBlock = $objects;
-
-        		// Output template part (modules that overwrite templates must declare this into descriptor)
-        		$dirtpls=array_merge($conf->modules_parts['tpl'],array('/'.$tplpath.'/tpl'));
-        		foreach($dirtpls as $reldir)
-        		{
-        			$res=@include dol_buildpath($reldir.'/linkedobjectblock.tpl.php');
-        			if ($res) break;
-        		}
-        	}
-
-        	return $num;
-        }
+    	global $form;
+    	return $form->showLinkedObjectBlock($this);
     }
 
 
-
     /* This is to show add lines */
 
     /**
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index bdb4f57a4ccb459c09bde5588899dd730c137e6e..dfb310c20f8647081e162e98f4e77ce1004ad45c 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -803,11 +803,28 @@ class Form
      *  @param		array		$ajaxoptions			Options for ajax_autocompleter
      * 	@param		int			$forcecombo				Force to use combo box
      *  @return		string								Return select box for thirdparty.
+	 *  @deprecated	Use select_company instead. For exemple $form->select_thirdparty(GETPOST('socid'),'socid','',0) => $form->select_company(GETPOST('socid'),'socid','',1,0,0,array(),0)
      */
     function select_thirdparty($selected='', $htmlname='socid', $filter='', $limit=20, $ajaxoptions=array(), $forcecombo=0)
     {
-    	global $langs,$conf;
+   		return $this->select_thirdparty_list($selected,$htmlname,$filter,1,0,$forcecombo,array(),'',0,$limit);
+    }
 
+    /**
+     *  Output html form to select a third party
+     *
+     *	@param	string	$selected       Preselected type
+     *	@param  string	$htmlname       Name of field in form
+     *  @param  string	$filter         optional filters criteras (example: 's.rowid <> x')
+     *	@param	int		$showempty		Add an empty field
+     * 	@param	int		$showtype		Show third party type in combolist (customer, prospect or supplier)
+     * 	@param	int		$forcecombo		Force to use combo box
+     *  @param	array	$events			Ajax event options to run on change. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
+     *	@param	int		$limit			Maximum number of elements
+     * 	@return	string					HTML string with select box for thirdparty.
+     */
+    function select_company($selected='', $htmlname='socid', $filter='', $showempty=0, $showtype=0, $forcecombo=0, $events=array(), $limit=0)
+    {
     	$out='';
 
     	/* TODO Use ajax_autocompleter like for products (not finished)
@@ -840,32 +857,12 @@ class Form
     	}
     	else
     	{*/
-    		$out.=$this->select_thirdparty_list($selected,$htmlname,$filter,1,0,$forcecombo,array(),'',0,$limit);
+    		$out.=$this->select_thirdparty_list($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events, '', 0, $limit);
     	//}
 
     	return $out;
     }
 
-    /**
-     *  Output html form to select a third party
-     *
-     *	@param	string	$selected       Preselected type
-     *	@param  string	$htmlname       Name of field in form
-     *  @param  string	$filter         optional filters criteras (example: 's.rowid <> x')
-     *	@param	int		$showempty		Add an empty field
-     * 	@param	int		$showtype		Show third party type in combolist (customer, prospect or supplier)
-     * 	@param	int		$forcecombo		Force to use combo box
-     *  @param	array	$events			Event options to run on change. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
-     *	@param	int		$limit			Maximum number of elements
-     * 	@return	string					HTML string with
-	 *  @deprecated						Use select_thirdparty instead
-     *  @see select_thirdparty()
-     */
-    function select_company($selected='', $htmlname='socid', $filter='', $showempty=0, $showtype=0, $forcecombo=0, $events=array(), $limit=0)
-    {
-		return $this->select_thirdparty_list($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events, '', 0, $limit);
-    }
-
     /**
      *  Output html form to select a third party
      *
@@ -4620,6 +4617,84 @@ class Form
 	}
 
 
+    /**
+     *  Show linked object block.
+     *
+     *  @param	CommonObject	$object		Object we want to show links to
+     *  @return	int							<0 if KO, >0 if OK
+     */
+    function showLinkedObjectBlock($object)
+    {
+        global $conf,$langs,$hookmanager;
+        global $bc;
+
+        $object->fetchObjectLinked();
+
+        // Bypass the default method
+        $hookmanager->initHooks(array('commonobject'));
+        $parameters=array();
+        $reshook=$hookmanager->executeHooks('showLinkedObjectBlock',$parameters,$object,$action);    // Note that $action and $object may have been modified by hook
+
+        if (empty($reshook))
+        {
+        	$num = count($object->linkedObjects);
+
+        	foreach($object->linkedObjects as $objecttype => $objects)
+        	{
+        		$tplpath = $element = $subelement = $objecttype;
+
+        		if (preg_match('/^([^_]+)_([^_]+)/i',$objecttype,$regs))
+        		{
+        			$element = $regs[1];
+        			$subelement = $regs[2];
+        			$tplpath = $element.'/'.$subelement;
+        		}
+
+        		// To work with non standard path
+        		if ($objecttype == 'facture')          {
+        			$tplpath = 'compta/'.$element;
+        			if (empty($conf->facture->enabled)) continue;	// Do not show if module disabled
+        		}
+        		else if ($objecttype == 'propal')           {
+        			$tplpath = 'comm/'.$element;
+        			if (empty($conf->propal->enabled)) continue;	// Do not show if module disabled
+        		}
+        		else if ($objecttype == 'askpricesupplier')           {
+        			$tplpath = 'comm/'.$element;
+        			if (empty($conf->askpricesupplier->enabled)) continue;	// Do not show if module disabled
+        		}
+        		else if ($objecttype == 'shipping' || $objecttype == 'shipment') {
+        			$tplpath = 'expedition';
+        			if (empty($conf->expedition->enabled)) continue;	// Do not show if module disabled
+        		}
+        		else if ($objecttype == 'delivery')         {
+        			$tplpath = 'livraison';
+        			if (empty($conf->expedition->enabled)) continue;	// Do not show if module disabled
+        		}
+        		else if ($objecttype == 'invoice_supplier') {
+        			$tplpath = 'fourn/facture';
+        		}
+        		else if ($objecttype == 'order_supplier')   {
+        			$tplpath = 'fourn/commande';
+        		}
+
+        		global $linkedObjectBlock;
+        		$linkedObjectBlock = $objects;
+
+        		// Output template part (modules that overwrite templates must declare this into descriptor)
+        		$dirtpls=array_merge($conf->modules_parts['tpl'],array('/'.$tplpath.'/tpl'));
+        		foreach($dirtpls as $reldir)
+        		{
+        			$res=@include dol_buildpath($reldir.'/linkedobjectblock.tpl.php');
+        			if ($res) break;
+        		}
+        	}
+
+        	return $num;
+        }
+    }
+
+
     /**
      *	Return an html string with a select combo box to choose yes or no
      *
diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php
index 8ebdc547cc8a8b920fa9cafee935520d02365407..fd2a3cd40993557b8bf23aa46f1372732527c8bf 100644
--- a/htdocs/core/lib/agenda.lib.php
+++ b/htdocs/core/lib/agenda.lib.php
@@ -103,7 +103,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
 		print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
 		print $langs->trans("ThirdParty").' &nbsp; ';
 		print '</td><td class="nowrap maxwidthonsmartphone" style="padding-bottom: 2px;">';
-		print $form->select_thirdparty($socid, 'socid');
+		print $form->select_company($socid, 'socid');
 		print '</td></tr>';
 	}
 
diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php
index 2475f420dd005571ebcf6b9ba6d58e6f4a90dc27..85380907bbfbd60dfbbe2aa56de90b5318bae37e 100644
--- a/htdocs/expedition/card.php
+++ b/htdocs/expedition/card.php
@@ -1505,7 +1505,7 @@ else if ($id || $ref)
 		/*
 		 * Linked object block
 		*/
-		$somethingshown=$object->showLinkedObjectBlock();
+		$somethingshown=$form->showLinkedObjectBlock($object);
 
 		if ($genallowed && ! $somethingshown) $somethingshown=1;
 
diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php
index dac78d9ae3bf610bb2ab1f91238c1cba4976c785..ad224ab9fe29349cbfe58e34d603aeb49d210c87 100644
--- a/htdocs/fichinter/card.php
+++ b/htdocs/fichinter/card.php
@@ -1019,7 +1019,7 @@ if ($action == 'create')
 		print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
 
 		dol_fiche_head('');
-		
+
 		print '<table class="border" width="100%">';
 
 		print '<input type="hidden" name="socid" value='.$soc->id.'>';
@@ -1125,7 +1125,7 @@ if ($action == 'create')
 		}
 
 		dol_fiche_end();
-		
+
 		print '<div class="center">';
 		print '<input type="submit" class="button" value="'.$langs->trans("CreateDraftIntervention").'">';
 		print '</div>';
@@ -1135,7 +1135,7 @@ if ($action == 'create')
 	else
 	{
 		dol_fiche_head('');
-		
+
 		print '<form name="fichinter" action="'.$_SERVER['PHP_SELF'].'" method="POST">';
 		print '<table class="border" width="100%">';
 		print '<tr><td class="fieldrequired">'.$langs->trans("ThirdParty").'</td><td>';
@@ -1144,7 +1144,7 @@ if ($action == 'create')
 		print '</table>';
 
 		dol_fiche_end();
-		
+
 		print '<div class="center">';
 		print '<input type="hidden" name="action" value="create">';
 		print '<input type="submit" class="button" value="'.$langs->trans("CreateDraftIntervention").'">';
@@ -1722,7 +1722,7 @@ else if ($id > 0 || ! empty($ref))
 		/*
 		 * Linked object block
 		*/
-		$somethingshown=$object->showLinkedObjectBlock();
+		$somethingshown=$form->showLinkedObjectBlock($object);
 
 		//print '</td><td valign="top" width="50%">';
 		print '</div><div class="fichehalfright"><div class="ficheaddleft">';
diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php
index 35165b3329888fda8c3f9456e416050ff4cdb9c0..95442273495a7ac98d5c654567a67e4dc304f708 100644
--- a/htdocs/fourn/commande/card.php
+++ b/htdocs/fourn/commande/card.php
@@ -2766,7 +2766,7 @@ elseif (! empty($object->id))
 		/*
 		 * Linked object block
 		 */
-		$somethingshown=$object->showLinkedObjectBlock();
+		$somethingshown=$form->showLinkedObjectBlock($object);
 
 		print '</div><div class="fichehalfright"><div class="ficheaddleft">';
 
diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php
index b4b853b58bc1223b28ca4bec0ff225e6da2c6e21..e365f8a70706a43c2a8e0afaa75426285bfbb9c1 100644
--- a/htdocs/fourn/facture/card.php
+++ b/htdocs/fourn/facture/card.php
@@ -2415,7 +2415,7 @@ else
                 /*
                  * Linked object block
                  */
-                $somethingshown=$object->showLinkedObjectBlock();
+                $somethingshown=$form->showLinkedObjectBlock($object);
 
                 $linktoelem='';
 
diff --git a/htdocs/livraison/card.php b/htdocs/livraison/card.php
index fb087e7180066558dc0a6c728e50167e4a3e5da0..5e477d1926db9b1d96c79357ff083111e7d4e62e 100644
--- a/htdocs/livraison/card.php
+++ b/htdocs/livraison/card.php
@@ -788,7 +788,7 @@ else
 				$shipment = new Expedition($db);
 				$shipment->fetch($object->origin_id);
 
-				$somethingshown=$shipment->showLinkedObjectBlock();
+				$somethingshown=$form->showLinkedObjectBlock($shipment);
 			}
 
 			if ($genallowed && ! $somethingshown) $somethingshown=1;
diff --git a/htdocs/public/test/test_forms.php b/htdocs/public/test/test_forms.php
index 0a99b11e3aa1ba3582741529615aee0bf5465a46..a6a361620e99b6c7ed6da0e2b531858c16eeed82 100644
--- a/htdocs/public/test/test_forms.php
+++ b/htdocs/public/test/test_forms.php
@@ -75,7 +75,7 @@ print '<br><br>'."\n";
 
 // Test4d: form->select_thirdparty
 print "Test 4d: Select thirdparty<br>\n";
-print $form->select_thirdparty(0,'thirdpartytest');
+print $form->select_company(0,'thirdpartytest');
 
 print '<br><br>'."\n";
 
diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php
index ec9a63f64d47553111129f92ee76de9a5c954ed7..70ec2a08a49f1c62cf0225c91373afdc7c72b809 100644
--- a/htdocs/societe/soc.php
+++ b/htdocs/societe/soc.php
@@ -1849,7 +1849,7 @@ else
 				    'name' => 'soc_origin',
 			    	'label' => $langs->trans('MergeOriginThirdparty'),
 				    'type' => 'other',
-				    'value' => $form->select_thirdparty('', 'soc_origin', 's.rowid != '.$object->id)
+				    'value' => $form->select_company('', 'soc_origin', 's.rowid != '.$object->id)
 			    )
 		    );