InsideOrders fix
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -152,7 +150,7 @@ $edit->ss->assign("STOCK_PW", $stock_pw);
|
||||
$edit->ss->assign("STOCK_RW", $stock_rw);
|
||||
$edit->ss->assign("EMPLOYERS", $eas);
|
||||
if (isset($products)) {
|
||||
$edit->ss->assign("POSITION_LIST", str_replace('"', "'", json_encode($products)));
|
||||
$edit->ss->assign("POSITION_LIST", str_replace('"', "'", json_encode($products)));
|
||||
}
|
||||
echo $edit->display ();
|
||||
//loading view
|
||||
|
||||
@@ -1,124 +1,130 @@
|
||||
//START:
|
||||
$(document).ready(
|
||||
function() {
|
||||
// confirm exit
|
||||
window.onbeforeunload = confirmExit;
|
||||
// prevent submit by enter press
|
||||
lockEnter();
|
||||
//// categories
|
||||
getCategoriesList();
|
||||
$("#parent_name").change(
|
||||
function() {
|
||||
$(".loading_panel").css("display", "block");
|
||||
setTimeout(function() {
|
||||
getParentInfo($("#parent_id").val(), 'Accounts');
|
||||
}, 1000);
|
||||
});
|
||||
// searchProductInput change
|
||||
$('#searchProductsInput').keyup(function() {
|
||||
searchProducts();
|
||||
});
|
||||
$("#stock_pw").change(function() {
|
||||
$("#pw_stock_id").val(($("#stock_pw :selected").val()));
|
||||
});
|
||||
$("#stock_rw").change(function() {
|
||||
$("#rw_stock_id").val(($("#stock_rw :selected").val()));
|
||||
});
|
||||
DrawHeaders();
|
||||
|
||||
$("#register_date").prop("disabled", true);
|
||||
$("#assigned_user_name").prop("disabled", true);
|
||||
//$("#register_date_trigger").hide();
|
||||
$("#btn_assigned_user_name").hide();
|
||||
$("#btn_clr_assigned_user_name").hide();
|
||||
|
||||
if (($("#new_number").val() == true)
|
||||
&& ($("#duplicate").val() != true)) {
|
||||
generateNumber();
|
||||
} else if (($("#new_number").val() == true)
|
||||
&& ($("#duplicate").val() == true)) {
|
||||
generateNumber();
|
||||
getParentInfo($("#parent_id").val(),
|
||||
$("#parent_type :selected").val());
|
||||
getItems();
|
||||
} else {
|
||||
getParentInfo($("#parent_id").val(),
|
||||
'Accounts');
|
||||
getItems();
|
||||
$("#rw_stock_id").val(($("#stock_rw :selected").val()));
|
||||
$("#pw_stock_id").val(($("#stock_pw :selected").val()));
|
||||
}
|
||||
// handle setItems
|
||||
setITEMS = function() {
|
||||
SetTab('ITEMS');
|
||||
//var formname = 'EditView';
|
||||
//if (check_form_(formname) == true) {
|
||||
// SetTab('ITEMS');
|
||||
// //checkProducts();
|
||||
// //disable stock change
|
||||
// //$("#stock_pw").prop("disabled", true);
|
||||
// $("#stock_rw").prop("disabled", true);
|
||||
//}
|
||||
};
|
||||
// add mz@bim-it.pl 11.11.2023
|
||||
if ($("#position_list").val().length) {
|
||||
const data = JSON.parse($("#position_list").val().replaceAll("'", '"'));
|
||||
items = data;
|
||||
FillTable(data, false);
|
||||
}
|
||||
$("#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() {
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
if (items[i].product_component === 0) {
|
||||
refreshStock(i, 0);
|
||||
}
|
||||
}
|
||||
});
|
||||
// enc mz
|
||||
});
|
||||
function () {
|
||||
// confirm exit
|
||||
window.onbeforeunload = confirmExit;
|
||||
// prevent submit by enter press
|
||||
lockEnter();
|
||||
//// categories
|
||||
getCategoriesList();
|
||||
$("#parent_name").change(
|
||||
function () {
|
||||
$(".loading_panel").css("display", "block");
|
||||
setTimeout(function () {
|
||||
getParentInfo($("#parent_id").val(), 'Accounts');
|
||||
}, 1000);
|
||||
});
|
||||
// searchProductInput change
|
||||
$('#searchProductsInput').keyup(function () {
|
||||
searchProducts();
|
||||
});
|
||||
$("#stock_pw").change(function () {
|
||||
$("#pw_stock_id").val(($("#stock_pw :selected").val()));
|
||||
});
|
||||
$("#stock_rw").change(function () {
|
||||
$("#rw_stock_id").val(($("#stock_rw :selected").val()));
|
||||
});
|
||||
DrawHeaders();
|
||||
|
||||
$("#register_date").prop("disabled", true);
|
||||
$("#assigned_user_name").prop("disabled", true);
|
||||
//$("#register_date_trigger").hide();
|
||||
$("#btn_assigned_user_name").hide();
|
||||
$("#btn_clr_assigned_user_name").hide();
|
||||
|
||||
if (($("#new_number").val() == true)
|
||||
&& ($("#duplicate").val() != true)) {
|
||||
generateNumber();
|
||||
} else if (($("#new_number").val() == true)
|
||||
&& ($("#duplicate").val() == true)) {
|
||||
generateNumber();
|
||||
getParentInfo($("#parent_id").val(),
|
||||
$("#parent_type :selected").val());
|
||||
getItems();
|
||||
} else {
|
||||
getParentInfo($("#parent_id").val(),
|
||||
'Accounts');
|
||||
getItems();
|
||||
$("#rw_stock_id").val(($("#stock_rw :selected").val()));
|
||||
$("#pw_stock_id").val(($("#stock_pw :selected").val()));
|
||||
}
|
||||
// handle setItems
|
||||
setITEMS = function () {
|
||||
SetTab('ITEMS');
|
||||
//var formname = 'EditView';
|
||||
//if (check_form_(formname) == true) {
|
||||
// SetTab('ITEMS');
|
||||
// //checkProducts();
|
||||
// //disable stock change
|
||||
// //$("#stock_pw").prop("disabled", true);
|
||||
// $("#stock_rw").prop("disabled", true);
|
||||
//}
|
||||
};
|
||||
// add mz@bim-it.pl 11.11.2023
|
||||
if ($("#position_list").val().length) {
|
||||
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++) {
|
||||
if (items[i].product_component === 1) {
|
||||
refreshStock(i, 1);
|
||||
}
|
||||
}
|
||||
});
|
||||
$("#stock_pw").change(function () {
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
if (items[i].product_component === 0) {
|
||||
refreshStock(i, 0);
|
||||
}
|
||||
}
|
||||
});
|
||||
// enc mz
|
||||
});
|
||||
// handle save
|
||||
var check_form_ = check_form;
|
||||
check_form = function(formname) {
|
||||
window.onbeforeunload = null;
|
||||
if (items.length == 0) {
|
||||
alert("Brak produktów");
|
||||
return false;
|
||||
}
|
||||
$(".loading_panel").css("display", "block");
|
||||
$("#register_date").prop("disabled", false);
|
||||
$("#assigned_user_name").prop("disabled", false);
|
||||
|
||||
$("#position_list").val(JSON.stringifyNoSecurity(items));
|
||||
|
||||
var check = checkProducts();
|
||||
check_form = function (formname) {
|
||||
window.onbeforeunload = null;
|
||||
if (items.length == 0) {
|
||||
alert("Brak produktów");
|
||||
return false;
|
||||
}
|
||||
$(".loading_panel").css("display", "block");
|
||||
$("#register_date").prop("disabled", false);
|
||||
$("#assigned_user_name").prop("disabled", false);
|
||||
|
||||
$(".loading_panel").css("display", "none");
|
||||
if (check_form_(formname) == false || check == false) {
|
||||
$("#register_date").prop("disabled", true);
|
||||
$("#assigned_user_name").prop("disabled", true);
|
||||
window.onbeforeunload = confirmExit;
|
||||
$(".loading_panel").css("display", "none");
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
$("#position_list").val(JSON.stringifyNoSecurity(items));
|
||||
|
||||
var check = checkProducts();
|
||||
|
||||
$(".loading_panel").css("display", "none");
|
||||
if (check_form_(formname) == false || check == false) {
|
||||
$("#register_date").prop("disabled", true);
|
||||
$("#assigned_user_name").prop("disabled", true);
|
||||
window.onbeforeunload = confirmExit;
|
||||
$(".loading_panel").css("display", "none");
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
function confirmExit() {
|
||||
return "";
|
||||
return "";
|
||||
}
|
||||
|
||||
function lockEnter() {
|
||||
// prevent default
|
||||
$(window).keydown(function(event) {
|
||||
if (event.keyCode == 13 && $(":focus").prop('tagName')!='TEXTAREA') {
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
// prevent default
|
||||
$(window).keydown(function (event) {
|
||||
if (event.keyCode == 13 && $(":focus").prop('tagName') != 'TEXTAREA') {
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user