diff --git a/htdocs/mrp/ajax/interface.php b/htdocs/mrp/ajax/interface.php index 45709b81ac0..639e0d21642 100644 --- a/htdocs/mrp/ajax/interface.php +++ b/htdocs/mrp/ajax/interface.php @@ -31,8 +31,9 @@ $warehouse_id = GETPOST('warehouse_id', 'int'); $batch_id = GETPOST('batch_id', 'int'); $fk_product = GETPOST('product_id', 'int'); $action = GETPOST('action', 'alphanohtml'); +$permissiontoproduce = GETPOST('permissiontoproduce', 'int'); -if($action == 'updateselectbatchbywarehouse') { +if($action == 'updateselectbatchbywarehouse' && $permissiontoproduce) { $TRes = array(); @@ -53,7 +54,7 @@ if($action == 'updateselectbatchbywarehouse') { } print json_encode($TRes); -} elseif($action == 'updateselectwarehousebybatch'){ +} elseif($action == 'updateselectwarehousebybatch' && $permissiontoproduce){ $res = 0; diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index c13d1ffed9b..444823c849b 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -1364,6 +1364,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea url: "", data: { action: "updateselectbatchbywarehouse", + permissiontoproduce: , warehouse_id: $(this).val(), product_id: $("input[name='" + product_element_name + "']").val() } @@ -1418,6 +1419,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea url: "", data: { action: "updateselectwarehousebybatch", + permissiontoproduce: , batch_id: $(this).val(), product_id: $("input[name='" + product_element_name + "']").val() } diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index bac6c958d24..99d19a8e5f2 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -655,13 +655,11 @@ class FormProduct } foreach ($productIdArray as $productId) { - if (array_key_exists($productId, $this->cache_lot)) { - foreach ($this->cache_lot[$productId] as $id => $arraytypes) { - if (empty($fk_entrepot) || $fk_entrepot == $arraytypes['entrepot_id']) { - $label = $arraytypes['entrepot_label'] . ' - '; - $label .= $arraytypes['batch']; - $out .= ''; - } + foreach ($this->cache_lot[$productId] as $id => $arraytypes) { + if (empty($fk_entrepot) || $fk_entrepot == $arraytypes['entrepot_id']) { + $label = $arraytypes['entrepot_label'] . ' - '; + $label .= $arraytypes['batch']; + $out .= ''; } } }