mirror of
https://github.com/grocy/grocy.git
synced 2026-03-28 07:39:25 +01:00
#2156 added note field to consume page
This commit is contained in:
parent
11ea8f3716
commit
4ed6630907
|
|
@ -315,8 +315,13 @@ class StockApiController extends BaseApiController
|
|||
$allowSubproductSubstitution = $requestBody['allow_subproduct_substitution'];
|
||||
}
|
||||
|
||||
$note = null;
|
||||
if (array_key_exists('note', $requestBody)) {
|
||||
$note = $requestBody['note'];
|
||||
}
|
||||
|
||||
$transactionId = null;
|
||||
$transactionId = $this->getStockService()->ConsumeProduct($args['productId'], $requestBody['amount'], $spoiled, $transactionType, $specificStockEntryId, $recipeId, $locationId, $transactionId, $allowSubproductSubstitution, $consumeExact);
|
||||
$transactionId = $this->getStockService()->ConsumeProduct($args['productId'], $requestBody['amount'], $spoiled, $transactionType, $specificStockEntryId, $recipeId, $locationId, $transactionId, $allowSubproductSubstitution, $consumeExact, $note);
|
||||
$args['transactionId'] = $transactionId;
|
||||
return $this->StockTransactions($request, $response, $args);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
jsonData.exact_amount = $('#consume-exact-amount').is(':checked');
|
||||
jsonData.spoiled = $('#spoiled').is(':checked');
|
||||
jsonData.allow_subproduct_substitution = true;
|
||||
jsonData.note = jsonForm.note;
|
||||
|
||||
if ($("#use_specific_stock_entry").is(":checked"))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -355,7 +355,7 @@ class StockService extends BaseService
|
|||
}
|
||||
}
|
||||
|
||||
public function ConsumeProduct(int $productId, float $amount, bool $spoiled, $transactionType, $specificStockEntryId = 'default', $recipeId = null, $locationId = null, &$transactionId = null, $allowSubproductSubstitution = false, $consumeExactAmount = false)
|
||||
public function ConsumeProduct(int $productId, float $amount, bool $spoiled, $transactionType, $specificStockEntryId = 'default', $recipeId = null, $locationId = null, &$transactionId = null, $allowSubproductSubstitution = false, $consumeExactAmount = false, $note = null)
|
||||
{
|
||||
if (!$this->ProductExists($productId))
|
||||
{
|
||||
|
|
@ -456,7 +456,7 @@ class StockService extends BaseService
|
|||
'transaction_id' => $transactionId,
|
||||
'user_id' => GROCY_USER_ID,
|
||||
'location_id' => $stockEntry->location_id,
|
||||
'note' => $stockEntry->note
|
||||
'note' => $note
|
||||
]);
|
||||
$logRow->save();
|
||||
|
||||
|
|
@ -491,7 +491,7 @@ class StockService extends BaseService
|
|||
'transaction_id' => $transactionId,
|
||||
'user_id' => GROCY_USER_ID,
|
||||
'location_id' => $stockEntry->location_id,
|
||||
'note' => $stockEntry->note
|
||||
'note' => $note
|
||||
]);
|
||||
$logRow->save();
|
||||
|
||||
|
|
|
|||
|
|
@ -135,6 +135,16 @@
|
|||
))
|
||||
@endif
|
||||
|
||||
<div class="form-group">
|
||||
<label for="note">{{ $__t('Note') }}</label>
|
||||
<div class="input-group">
|
||||
<input type="text"
|
||||
class="form-control"
|
||||
id="note"
|
||||
name="note">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button id="save-consume-button"
|
||||
class="btn btn-success">{{ $__t('OK') }}</button>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user