mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 09:39:57 +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
@ -250,12 +250,15 @@ $("#location_id").on('change', function(e)
|
||||
}
|
||||
|
||||
if (stockEntry.location_id == locationId)
|
||||
{
|
||||
if ($("#specific_stock_entry option[value='" + stockEntry.stock_id + "']").length == 0)
|
||||
{
|
||||
$("#specific_stock_entry").append($("<option>", {
|
||||
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);
|
||||
|
||||
|
@ -312,16 +312,21 @@ $("#location_id_from").on('change', function(e)
|
||||
}
|
||||
|
||||
if (stockEntry.location_id == locationId)
|
||||
{
|
||||
if ($("#specific_stock_entry option[value='" + stockEntry.stock_id + "']").length == 0)
|
||||
{
|
||||
$("#specific_stock_entry").append($("<option>", {
|
||||
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)
|
||||
{
|
||||
$("#specific_stock_entry").val(stockId);
|
||||
}
|
||||
|
||||
sumValue = sumValue + parseFloat(stockEntry.amount);
|
||||
}
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user