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

@@ -1,6 +1,6 @@
//START:
$(document).ready(
function() {
function () {
// confirm exit
window.onbeforeunload = confirmExit;
// prevent submit by enter press
@@ -8,20 +8,20 @@ $(document).ready(
//// categories
getCategoriesList();
$("#parent_name").change(
function() {
function () {
$(".loading_panel").css("display", "block");
setTimeout(function() {
setTimeout(function () {
getParentInfo($("#parent_id").val(), 'Accounts');
}, 1000);
});
// searchProductInput change
$('#searchProductsInput').keyup(function() {
$('#searchProductsInput').keyup(function () {
searchProducts();
});
$("#stock_pw").change(function() {
$("#stock_pw").change(function () {
$("#pw_stock_id").val(($("#stock_pw :selected").val()));
});
$("#stock_rw").change(function() {
$("#stock_rw").change(function () {
$("#rw_stock_id").val(($("#stock_rw :selected").val()));
});
DrawHeaders();
@@ -49,7 +49,7 @@ $(document).ready(
$("#pw_stock_id").val(($("#stock_pw :selected").val()));
}
// handle setItems
setITEMS = function() {
setITEMS = function () {
SetTab('ITEMS');
//var formname = 'EditView';
//if (check_form_(formname) == true) {
@@ -62,18 +62,22 @@ $(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() {
$("#stock_rw").change(function () {
for (var i = 0; i < items.length; i++) {
if (items[i].product_component === 1) {
refreshStock(i, 1);
}
}
});
$("#stock_pw").change(function() {
$("#stock_pw").change(function () {
for (var i = 0; i < items.length; i++) {
if (items[i].product_component === 0) {
refreshStock(i, 0);
@@ -84,7 +88,7 @@ $(document).ready(
});
// handle save
var check_form_ = check_form;
check_form = function(formname) {
check_form = function (formname) {
window.onbeforeunload = null;
if (items.length == 0) {
alert("Brak produktów");
@@ -110,13 +114,15 @@ check_form = function(formname) {
}
};
function confirmExit() {
return "";
}
function lockEnter() {
// prevent default
$(window).keydown(function(event) {
if (event.keyCode == 13 && $(":focus").prop('tagName')!='TEXTAREA') {
$(window).keydown(function (event) {
if (event.keyCode == 13 && $(":focus").prop('tagName') != 'TEXTAREA') {
event.preventDefault();
return false;
}

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>