From 3a997ac8dcbafe5c6548975bf36ebccaa71edf06 Mon Sep 17 00:00:00 2001 From: joshvazquez Date: Sun, 10 Oct 2021 13:17:49 -0700 Subject: [PATCH] Fix printing label per unit If a product allows label printing per unit, the current code prevents you from setting "stock entry label" to "label per unit" on the purchase page because the option is disabled. Only a single label can be printed. Even if you set the product default to "label per unit" and don't change it on the purchase page, the selection is ignored because the option is disabled, so `jsonForm.print_stock_label` is undefined. In this case, no labels are printed at all because the value is undefined. This change enables/disables the option in the correct cases. --- public/viewjs/purchase.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/viewjs/purchase.js b/public/viewjs/purchase.js index 0bcc7002..e3424faf 100644 --- a/public/viewjs/purchase.js +++ b/public/viewjs/purchase.js @@ -313,11 +313,11 @@ if (Grocy.Components.ProductPicker !== undefined) { $("#default_print_stock_label").val("0"); } - $('#label-option-per-unit').prop("disabled", true); + $('#label-option-per-unit').prop("disabled", false); } else { - $('#label-option-per-unit').prop("disabled", false); + $('#label-option-per-unit').prop("disabled", true); } }