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

View File

@@ -62,9 +62,13 @@ $(document).ready(
}; };
// add mz@bim-it.pl 11.11.2023 // add mz@bim-it.pl 11.11.2023
if ($("#position_list").val().length) { 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; items = data;
FillTable(data, false); FillTable(data, false);
checkProducts();
} }
$("#stock_rw").change(function () { $("#stock_rw").change(function () {
for (var i = 0; i < items.length; i++) { for (var i = 0; i < items.length; i++) {
@@ -110,9 +114,11 @@ check_form = function(formname) {
} }
}; };
function confirmExit() { function confirmExit() {
return ""; return "";
} }
function lockEnter() { function lockEnter() {
// prevent default // prevent default
$(window).keydown(function (event) { $(window).keydown(function (event) {

View File

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

View File

@@ -76,7 +76,7 @@
</table> </table>
</form> </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"> target="_blank" id="createInsideOrderForm">
<input id="insideOrderProducts" name="insideOrderProducts" type="hidden" value=""/> <input id="insideOrderProducts" name="insideOrderProducts" type="hidden" value=""/>
</form> </form>