diff --git a/htdocs/product/stock/movement_card.php b/htdocs/product/stock/movement_card.php index a1c8906f6aa..cf5b3dcc014 100644 --- a/htdocs/product/stock/movement_card.php +++ b/htdocs/product/stock/movement_card.php @@ -170,7 +170,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' } // Correct stock -if ($action == "correct_stock") { +if ($action == "correct_stock" && !$cancel && $usercancreate) { $product = new Product($db); if (!empty($product_id)) { $result = $product->fetch($product_id); @@ -250,7 +250,7 @@ if ($action == "correct_stock") { } // Transfer stock from a warehouse to another warehouse -if ($action == "transfert_stock" && !$cancel) { +if ($action == "transfert_stock" && !$cancel && $usercancreate) { $error = 0; $product = new Product($db); if (!empty($product_id)) { diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 7cd0fbbad2a..22d4d7ce7a4 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -119,6 +119,7 @@ $error = 0; $usercanread = (($object->type == Product::TYPE_PRODUCT && $user->hasRight('produit', 'lire')) || ($object->type == Product::TYPE_SERVICE && $user->hasRight('service', 'lire'))); $usercancreate = (($object->type == Product::TYPE_PRODUCT && $user->hasRight('produit', 'creer')) || ($object->type == Product::TYPE_SERVICE && $user->hasRight('service', 'creer'))); $usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS') ? $user->hasRight('product', 'product_advance', 'read_prices') : $user->hasRight('product', 'lire'); +$usercanupdatestock = $user->hasRight('stock', 'mouvement', 'creer'); if ($object->isService()) { $label = $langs->trans('Service'); @@ -247,7 +248,7 @@ if ($action == 'setdesiredstock' && $usercancreate) { // Correct stock -if ($action == "correct_stock" && !$cancel && $usercancreate) { +if ($action == "correct_stock" && !$cancel && $usercanupdatestock) { if (!(GETPOSTINT("id_entrepot") > 0)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Warehouse")), null, 'errors'); $error++; @@ -340,7 +341,7 @@ if ($action == "correct_stock" && !$cancel && $usercancreate) { } // Transfer stock from a warehouse to another warehouse -if ($action == "transfert_stock" && !$cancel && $usercancreate) { +if ($action == "transfert_stock" && !$cancel && $usercanupdatestock) { if (!(GETPOSTINT("id_entrepot") > 0) || !(GETPOSTINT("id_entrepot_destination") > 0)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Warehouse")), null, 'errors'); $error++; diff --git a/htdocs/viewimage.php b/htdocs/viewimage.php index b49a32cf8fa..5cee83820af 100644 --- a/htdocs/viewimage.php +++ b/htdocs/viewimage.php @@ -343,7 +343,7 @@ if ($modulepart == 'barcode') { $vcffile = ''; if ($reg[1] == 'user') { $vcffile = $conf->user->dir_temp.'/'.$code; - } elseif ($reg[1] == 'user') { + } elseif ($reg[1] == 'contact') { $vcffile = $conf->contact->dir_temp.'/'.$code; }