mirror of
https://github.com/grocy/grocy.git
synced 2026-04-04 03:46:16 +02:00
Code formatting / naming
This commit is contained in:
parent
4374712346
commit
260cccd299
|
|
@ -2330,6 +2330,5 @@ msgstr ""
|
|||
msgid "Move on open"
|
||||
msgstr ""
|
||||
|
||||
|
||||
msgid "When checked, opening the product will move one unit to the default consume location"
|
||||
msgstr ""
|
||||
|
|
|
|||
|
|
@ -239,20 +239,26 @@ $('#product-form input').keyup(function(event)
|
|||
$('#location_id').change(function(event)
|
||||
{
|
||||
Grocy.FrontendHelpers.ValidateForm('product-form');
|
||||
updateMoveOnOpen();
|
||||
});
|
||||
$('#default_consume_location_id').change(function(event) {
|
||||
updateMoveOnOpen();
|
||||
UpdateMoveOnOpen();
|
||||
});
|
||||
|
||||
function updateMoveOnOpen() {
|
||||
$('#default_consume_location_id').change(function(event)
|
||||
{
|
||||
UpdateMoveOnOpen();
|
||||
});
|
||||
|
||||
function UpdateMoveOnOpen()
|
||||
{
|
||||
var defaultLocation = $("#location_id :selected").val();
|
||||
var consumeLocationLocation = $("#default_consume_location_id :selected").val();
|
||||
|
||||
if (!consumeLocationLocation || defaultLocation === consumeLocationLocation) {
|
||||
if (!consumeLocationLocation || defaultLocation === consumeLocationLocation)
|
||||
{
|
||||
document.getElementById("move_on_open").checked = false;
|
||||
$("#move_on_open").attr("disabled", true);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#move_on_open").attr("disabled", false);
|
||||
}
|
||||
}
|
||||
|
|
@ -572,7 +578,7 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
|||
}
|
||||
});
|
||||
|
||||
updateMoveOnOpen();
|
||||
UpdateMoveOnOpen();
|
||||
Grocy.FrontendHelpers.ValidateForm("product-form");
|
||||
Grocy.Components.ProductPicker.GetPicker().trigger("change");
|
||||
|
||||
|
|
|
|||
|
|
@ -1057,9 +1057,12 @@ class StockService extends BaseService
|
|||
|
||||
$amount = 0;
|
||||
}
|
||||
if ($product->move_on_open) {
|
||||
|
||||
if ($product->move_on_open)
|
||||
{
|
||||
$locationIdTo = $product->default_consume_location_id;
|
||||
if ($locationIdTo && $locationIdTo !== $stockEntry->location_id) {
|
||||
if ($locationIdTo && $locationIdTo !== $stockEntry->location_id)
|
||||
{
|
||||
$this->TransferProduct($stockEntry->product_id, $amount, $stockEntry->location_id, $locationIdTo, $stockEntry->stock_id, $transactionId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user