InsideOrders fix

This commit is contained in:
Michał Zieliński
2025-07-15 17:18:21 +02:00
parent 0068e3beec
commit 5173239e69
4 changed files with 126 additions and 123 deletions

View File

@@ -35,17 +35,14 @@ else if ($_REQUEST['isDuplicate']=="true") {
$duplicate=true;
//get data
$focus->retrieve($_REQUEST['return_id']);
}
else {
} else {
$new_number=true;
//dates
$focus->register_date = date("d.m.Y");
$OPT ['check_parent_id'] = false;
// add mz@bim-it.pl 11.11.2023
$products = [];
if ($_REQUEST['fromProductsBySalesReport']) {
$requestProducts = explode('*', $_POST['insideOrderProducts']);
if ($_REQUEST['fromProductionScheduler']) {
$requestProducts = explode('*', $_REQUEST['insideOrderProducts']);
if (is_array($requestProducts)) {
$position = 0;
foreach ($requestProducts as $p) {
@@ -95,6 +92,7 @@ else {
$products[] = $row;
}
}
$focus->position_list = json_encode($products);
}
}
}

View File

@@ -62,9 +62,13 @@ $(document).ready(
};
// add mz@bim-it.pl 11.11.2023
if ($("#position_list").val().length) {
const data = JSON.parse($("#position_list").val().replaceAll("'", '"'));
let rawData = $("#position_list").val();
rawData = rawData.replace(/"(\d+)"/g, '\\"$1\\"');
rawData = rawData.replace(/'/g, '"');
const data = JSON.parse(rawData);
items = data;
FillTable(data, false);
checkProducts();
}
$("#stock_rw").change(function () {
for (var i = 0; i < items.length; i++) {
@@ -110,9 +114,11 @@ check_form = function(formname) {
}
};
function confirmExit() {
return "";
}
function lockEnter() {
// prevent default
$(window).keydown(function (event) {

View File

@@ -702,8 +702,7 @@ function checkProducts() {
items[index].quantity = pqty;
}
if (items[index].product_component == 1
&& id == items[index].product_product_id) {
if (items[index].product_component == 1) {
items[index].quantity = pqty * $("#quantity_comp_" + index).val();
$("#quantity_" + index).val(FormatNumber(items[index].quantity, 4));
}

View File

@@ -76,7 +76,7 @@
</table>
</form>
<form action="index.php?module=EcmInsideOrders&action=EditView&fromProductsBySalesReport=true" method="post"
<form action="index.php?module=EcmInsideOrders&action=EditView&fromProductionScheduler=true" method="post"
target="_blank" id="createInsideOrderForm">
<input id="insideOrderProducts" name="insideOrderProducts" type="hidden" value=""/>
</form>