From 64f2f324de8d40e4438e5ec1f354e39f25f92492 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 10 Mar 2018 12:52:09 +0100 Subject: [PATCH] Update card.php --- htdocs/product/inventory/card.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) 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 '' . $langs->trans('SendMail') . ''."\n"; - if ($user->rights->stock->advance_inventory->write) + if ($permissiontoadd) { print ''.$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 ''.$langs->trans('Delete').''."\n"; }