diff --git a/htdocs/margin/agentMargins.php b/htdocs/margin/agentMargins.php
index 32525114ee3c73e1df423b5569b63c1097b1d0c1..efea924b2805c34a159770d493b0e67c22f37f68 100644
--- a/htdocs/margin/agentMargins.php
+++ b/htdocs/margin/agentMargins.php
@@ -36,7 +36,7 @@ $langs->load("margins");
 
 // Security check
 
-if ($user->rights->margin->read->all) {
+if ($user->rights->margins->read->all) {
 	$agentid = GETPOST('agentid', 'int');
 } else {
 	$agentid = $user->id;
@@ -91,7 +91,7 @@ dol_fiche_head($head, 'agentMargins', $titre, 0, $picto);
 print '<form method="post" name="sel" action="'.$_SERVER['PHP_SELF'].'">';
 print '<table class="border" width="100%">';
 
-if ($user->rights->margin->read->all) {
+if ($user->rights->margins->read->all) {
 	print '<tr><td width="20%">'.$langs->trans('SalesRepresentative').'</td>';
 	print '<td colspan="4">';
 	print $form->select_dolusers($agentid, 'agentid', 1);
diff --git a/htdocs/margin/lib/margins.lib.php b/htdocs/margin/lib/margins.lib.php
index 1478dd9dcb035088121db8b1b378dee98a03d594..ce100d49390afd220a36706073a21432c5f7f4cd 100644
--- a/htdocs/margin/lib/margins.lib.php
+++ b/htdocs/margin/lib/margins.lib.php
@@ -77,7 +77,7 @@ function marges_prepare_head()
 		$h++;
 	}
 
-	if ($user->rights->margin->read->all) {
+	if ($user->rights->margins->read->all) {
 		$title = 'UserMargins';
 	} else {
 		$title = 'SalesRepresentativeMargins';