Permission and correct merge conflict error

This commit is contained in:
atm-lena 2022-02-07 10:55:33 +01:00
parent dbe31d41ad
commit 19dd137462
3 changed files with 10 additions and 9 deletions

View File

@ -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;

View File

@ -1364,6 +1364,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
url: "<?php echo DOL_URL_ROOT . '/mrp/ajax/interface.php'; ?>",
data: {
action: "updateselectbatchbywarehouse",
permissiontoproduce: <?php echo $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: "<?php echo DOL_URL_ROOT . '/mrp/ajax/interface.php'; ?>",
data: {
action: "updateselectwarehousebybatch",
permissiontoproduce: <?php echo $permissiontoproduce ?>,
batch_id: $(this).val(),
product_id: $("input[name='" + product_element_name + "']").val()
}

View File

@ -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 .= '<option>' . $arraytypes['batch'] . '</option>';
}
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 .= '<option value="' . $arraytypes['batch'] . '">(' . $langs->trans('Stock Total') . ': ' . $arraytypes['qty'] . ')</option>';
}
}
}