Fixed per unit stock grocycodes weren't unique per unit (fixes #1676)

This commit is contained in:
Bernd Bestel
2021-11-14 15:26:38 +01:00
parent fc413a05d1
commit 6070507b04
10 changed files with 208 additions and 96 deletions

View File

@@ -140,13 +140,14 @@ class StockApiController extends BaseApiController
{
$transactionType = $requestBody['transactiontype'];
}
$runPrinterWebhook = false;
if (array_key_exists('print_stock_label', $requestBody) && intval($requestBody['print_stock_label']))
$stockLabelType = 0;
if (array_key_exists('stock_label_type', $requestBody) && is_numeric($requestBody['stock_label_type']))
{
$runPrinterWebhook = intval($requestBody['print_stock_label']);
$stockLabelType = intval($requestBody['stock_label_type']);
}
$transactionId = $this->getStockService()->AddProduct($args['productId'], $requestBody['amount'], $bestBeforeDate, $transactionType, $purchasedDate, $price, $locationId, $shoppingLocationId, $unusedTransactionId, $runPrinterWebhook);
$transactionId = $this->getStockService()->AddProduct($args['productId'], $requestBody['amount'], $bestBeforeDate, $transactionType, $purchasedDate, $price, $locationId, $shoppingLocationId, $unusedTransactionId, $stockLabelType);
$args['transactionId'] = $transactionId;
return $this->StockTransactions($request, $response, $args);