diff --git a/htdocs/product/inventory/card.php b/htdocs/product/inventory/card.php
index 69658f2b42a..30bb3312576 100644
--- a/htdocs/product/inventory/card.php
+++ b/htdocs/product/inventory/card.php
@@ -75,6 +75,16 @@ $extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
+if (empty($conf->global->MAIN_USE_ADVANCED_PERMS))
+{
+ $permissiontoadd = $user->rights->stock->write;
+ $permissiontodelete = $user->rights->stock->write;
+}
+else
+{
+ $permissiontoadd = $user->rights->stock->advance_inventory->create;
+ $permissiontodelete = $user->rights->stock->advance_inventory->write;
+}
/*
@@ -89,16 +99,6 @@ if (empty($reshook))
{
$error=0;
- if (empty($conf->global->MAIN_USE_ADVANCED_PERMS))
- {
- $permissiontoadd = $user->rights->stock->write;
- $permissiontodelete = $user->rights->stock->write;
- }
- else
- {
- $permissiontoadd = $user->rights->stock->advance_inventory->create;
- $permissiontodelete = $user->rights->stock->advance_inventory->write;
- }
$backurlforlist = DOL_URL_ROOT.'/product/inventory/list.php';
// Actions cancel, add, update or delete
@@ -344,7 +344,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Send
print 'id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail') . ''."\n";
- if ($user->rights->stock->advance_inventory->write)
+ if ($permissiontoadd)
{
print 'id.'&action=edit">'.$langs->trans("Modify").''."\n";
}
@@ -353,7 +353,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print ''.$langs->trans('Modify').''."\n";
}
- if ($user->rights->stock->advance_inventory->write)
+ if ($permissiontodelete)
{
print 'id.'&action=delete">'.$langs->trans('Delete').''."\n";
}