diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 0c1d18e28edfbc772d6a02f4e3baa7be04774d74..4ab213431146ea78fdb00b994fe1389d708fa03f 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -205,7 +205,7 @@ abstract class CommonObject
         $datecreate = dol_now();
 
         $this->db->begin();
-        
+
         // Insertion dans la base
         $sql = "INSERT INTO ".MAIN_DB_PREFIX."element_contact";
         $sql.= " (element_id, fk_socpeople, datecreate, statut, fk_c_type_contact) ";
@@ -223,7 +223,7 @@ abstract class CommonObject
             	$result=$this->call_trigger(strtoupper($this->element).'_ADD_CONTACT', $user);
 	            if ($result < 0) { $this->db->rollback(); return -1; }
             }
-            
+
             $this->db->commit();
             return 1;
         }
@@ -310,7 +310,7 @@ abstract class CommonObject
 
 
         $this->db->begin();
-        
+
         $sql = "DELETE FROM ".MAIN_DB_PREFIX."element_contact";
         $sql.= " WHERE rowid =".$rowid;
 
@@ -3226,12 +3226,17 @@ abstract class CommonObject
 
     	if (! $user->rights->margins->liretous) return;
 
-        $rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT);
+        $rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT, $conf->global->MAIN_MAX_DECIMALS_TOT);
 
 		$marginInfo = $this->getMarginInfos($force_price);
 
-		print '<table class="nobordernopadding" width="100%">';
+		if (! empty($conf->global->MARGININFO_HIDE_SHOW))
+		{
+			print "<img onclick=\"$('.margininfos').toggle();\" src='".img_picto($langs->trans("Hide")."/".$langs->trans("Show"),'object_margin.png','','',1)."'>";
+			if ($conf->global->MARGININFO_HIDE_SHOW == 2) print '<script>$(document).ready(function() {$(".margininfos").hide();});</script>';	// hide by default
+		}
 
+		print '<table class="nobordernopadding margintable" width="100%">';
 		print '<tr class="liste_titre">';
 		print '<td width="30%">'.$langs->trans('Margins').'</td>';
 		print '<td width="20%" align="right">'.$langs->trans('SellingPrice').'</td>';
@@ -3350,7 +3355,7 @@ abstract class CommonObject
 
 
 	    $this->db->begin();
-	    
+
 	    $sql = "DELETE FROM ".MAIN_DB_PREFIX."element_resources";
 	    $sql.= " WHERE rowid =".$rowid;
 
@@ -3392,13 +3397,13 @@ abstract class CommonObject
         	}
         }
     }
-    
+
     /**
      * Call trigger based on this instance
-     * 
+     *
      *  NB: Error from trigger are stacked in errors
      *  NB2: if trigger fail, action should be canceled.
-     * 
+     *
      * @param   string    $trigger_name   trigger's name to execute
      * @param   User      $user           Object user
      * @return  int                       Result of run_triggers
@@ -3406,7 +3411,7 @@ abstract class CommonObject
     function call_trigger($trigger_name, $user)
     {
         global $langs,$conf;
-        
+
         include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
         $interface=new Interfaces($this->db);
         $result=$interface->run_triggers($trigger_name,$this,$user,$langs,$conf);
@@ -3415,13 +3420,13 @@ abstract class CommonObject
             {
                 $this->errors=array_merge($this->errors,$interface->errors);
             }
-            else 
+            else
             {
                 $this->errors=$interface->errors;
             }
         }
         return $result;
-        
+
     }
 
 }
diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php
index 948a61bae2c3f9fe568358b15a11be9e970be672..ce87aa5e815967b7030b238ff7d7f542b3a56e2b 100644
--- a/htdocs/core/tpl/objectline_view.tpl.php
+++ b/htdocs/core/tpl/objectline_view.tpl.php
@@ -123,7 +123,7 @@
   if (! empty($conf->margin->enabled) && empty($user->societe_id)) {
 	$rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT);
   ?>
-  	<td align="right" class="nowrap"><?php $coldisplay++; ?><?php echo price($line->pa_ht); ?></td>
+  	<td align="right" class="nowrap"><?php $coldisplay++; ?><div class="margininfos"><?php echo price($line->pa_ht); ?></div></td>
   	<?php if (! empty($conf->global->DISPLAY_MARGIN_RATES) && $user->rights->margins->liretous) {?>
   	  <td align="right" class="nowrap"><?php $coldisplay++; ?><?php echo (($line->pa_ht == 0)?'n/a':price($line->marge_tx, null, null, null, null, $rounding).'%'); ?></td>
   	<?php