FIX updateselectwarehousebybatch : request sql must take batch, no id + fix delete condition

This commit is contained in:
atm-lena 2022-03-08 11:21:04 +01:00
parent 5072f69ee9
commit 5c576d0ae5
2 changed files with 3 additions and 3 deletions

View File

@ -28,7 +28,7 @@ global $db, $langs;
require '../../main.inc.php'; // Load $user and permissions
$warehouse_id = GETPOST('warehouse_id', 'int');
$batch_id = GETPOST('batch_id', 'int');
$batch = GETPOST('batch', 'alphanohtml');
$fk_product = GETPOST('product_id', 'int');
$action = GETPOST('action', 'alphanohtml');
$permissiontoproduce = GETPOST('permissiontoproduce', 'int');
@ -61,7 +61,7 @@ if ($action == 'updateselectbatchbywarehouse' && $permissiontoproduce) {
$sql .= " JOIN " . MAIN_DB_PREFIX . "product_stock as ps on ps.rowid = pb.fk_product_stock";
$sql .= " JOIN " . MAIN_DB_PREFIX . "entrepot as e on e.rowid = ps.fk_entrepot AND e.entity IN (" . getEntity('stock') . ")";
$sql .= " WHERE ps.fk_product = " .((int) $fk_product);
if ($batch_id > 0) $sql.= " AND pb.batch = '" . ((int) $batch_id) . "'";
if ($batch) $sql.= " AND pb.batch = '" . $batch . "'";
$sql .= " ORDER BY e.ref, pb.batch";
$resql = $db->query($sql);

View File

@ -1419,7 +1419,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
data: {
action: "updateselectwarehousebybatch",
permissiontoproduce: <?php echo $permissiontoproduce ?>,
batch_id: $(this).val(),
batch: $(this).val(),
product_id: $("input[name='" + product_element_name + "']").val()
}
}).done(function (data) {