mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 17:45:39 +00:00
Prvent potentially duplicate stock items in drodpown on /consume and /transfer page (fixes #1368)
This commit is contained in:
parent
b856911f0f
commit
9f833b9bd5
@ -251,11 +251,14 @@ $("#location_id").on('change', function(e)
|
|||||||
|
|
||||||
if (stockEntry.location_id == locationId)
|
if (stockEntry.location_id == locationId)
|
||||||
{
|
{
|
||||||
$("#specific_stock_entry").append($("<option>", {
|
if ($("#specific_stock_entry option[value='" + stockEntry.stock_id + "']").length == 0)
|
||||||
value: stockEntry.stock_id,
|
{
|
||||||
amount: stockEntry.amount,
|
$("#specific_stock_entry").append($("<option>", {
|
||||||
text: __t("Amount: %1$s; Due on %2$s; Bought on %3$s", stockEntry.amount, moment(stockEntry.best_before_date).format("YYYY-MM-DD"), moment(stockEntry.purchased_date).format("YYYY-MM-DD")) + "; " + openTxt
|
value: stockEntry.stock_id,
|
||||||
}));
|
amount: stockEntry.amount,
|
||||||
|
text: __t("Amount: %1$s; Due on %2$s; Bought on %3$s", stockEntry.amount, moment(stockEntry.best_before_date).format("YYYY-MM-DD"), moment(stockEntry.purchased_date).format("YYYY-MM-DD")) + "; " + openTxt
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
sumValue = sumValue + parseFloat(stockEntry.amount || 0);
|
sumValue = sumValue + parseFloat(stockEntry.amount || 0);
|
||||||
|
|
||||||
|
@ -313,15 +313,20 @@ $("#location_id_from").on('change', function(e)
|
|||||||
|
|
||||||
if (stockEntry.location_id == locationId)
|
if (stockEntry.location_id == locationId)
|
||||||
{
|
{
|
||||||
$("#specific_stock_entry").append($("<option>", {
|
if ($("#specific_stock_entry option[value='" + stockEntry.stock_id + "']").length == 0)
|
||||||
value: stockEntry.stock_id,
|
{
|
||||||
amount: stockEntry.amount,
|
$("#specific_stock_entry").append($("<option>", {
|
||||||
text: __t("Amount: %1$s; Due on %2$s; Bought on %3$s", stockEntry.amount, moment(stockEntry.best_before_date).format("YYYY-MM-DD"), moment(stockEntry.purchased_date).format("YYYY-MM-DD")) + "; " + openTxt
|
value: stockEntry.stock_id,
|
||||||
}));
|
amount: stockEntry.amount,
|
||||||
|
text: __t("Amount: %1$s; Due on %2$s; Bought on %3$s", stockEntry.amount, moment(stockEntry.best_before_date).format("YYYY-MM-DD"), moment(stockEntry.purchased_date).format("YYYY-MM-DD")) + "; " + openTxt
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
if (stockEntry.stock_id == stockId)
|
if (stockEntry.stock_id == stockId)
|
||||||
{
|
{
|
||||||
$("#specific_stock_entry").val(stockId);
|
$("#specific_stock_entry").val(stockId);
|
||||||
}
|
}
|
||||||
|
|
||||||
sumValue = sumValue + parseFloat(stockEntry.amount);
|
sumValue = sumValue + parseFloat(stockEntry.amount);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user