From 94a2b4bdfc3385285fff58365c7a7324e03a841b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 Apr 2023 23:35:42 +0200 Subject: [PATCH] Update interface.php --- htdocs/mrp/ajax/interface.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/htdocs/mrp/ajax/interface.php b/htdocs/mrp/ajax/interface.php index 4822294a95c..195c9a570bd 100644 --- a/htdocs/mrp/ajax/interface.php +++ b/htdocs/mrp/ajax/interface.php @@ -23,15 +23,24 @@ if (!defined('NOREQUIREAJAX')) { define('NOREQUIREAJAX', '1'); } -global $db, $langs; - require '../../main.inc.php'; // Load $user and permissions $warehouse_id = GETPOST('warehouse_id', 'int'); $batch = GETPOST('batch', 'alphanohtml'); $fk_product = GETPOST('product_id', 'int'); $action = GETPOST('action', 'alphanohtml'); -$permissiontoproduce = GETPOST('permissiontoproduce', 'int'); + +$result = restrictedArea($user, 'mrp'); + +$permissiontoproduce = $user->rights->mrp->write; + + + +/* + * View + */ + +top_httphead("application/json"); if ($action == 'updateselectbatchbywarehouse' && $permissiontoproduce) { $TRes = array(); @@ -57,7 +66,6 @@ if ($action == 'updateselectbatchbywarehouse' && $permissiontoproduce) { } echo json_encode($TRes); - exit(); } elseif ($action == 'updateselectwarehousebybatch' && $permissiontoproduce) { $res = 0; @@ -79,5 +87,4 @@ if ($action == 'updateselectbatchbywarehouse' && $permissiontoproduce) { } echo json_encode($res); - exit(); }