From 27169e1428ca307401a197fa679d6de6b8e7c607 Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Wed, 6 Jan 2021 09:31:36 +0100 Subject: [PATCH 01/31] Fixed constant typo (fixes #1260) --- changelog/62_UNRELEASED_xxxx-xx-xx.md | 1 + controllers/ChoresApiController.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 changelog/62_UNRELEASED_xxxx-xx-xx.md diff --git a/changelog/62_UNRELEASED_xxxx-xx-xx.md b/changelog/62_UNRELEASED_xxxx-xx-xx.md new file mode 100644 index 00000000..54b891cc --- /dev/null +++ b/changelog/62_UNRELEASED_xxxx-xx-xx.md @@ -0,0 +1 @@ +- Fixed that tracking chores with "Done by" a different user was not possible diff --git a/controllers/ChoresApiController.php b/controllers/ChoresApiController.php index fb8d51fe..d9396467 100644 --- a/controllers/ChoresApiController.php +++ b/controllers/ChoresApiController.php @@ -81,7 +81,7 @@ class ChoresApiController extends BaseApiController if ($doneBy != GROCY_USER_ID) { - User::checkPermission($request, User::PERMISSION_CHORE_TRACK_EXECUTION_EXECUTION); + User::checkPermission($request, User::PERMISSION_CHORE_TRACK_EXECUTION); } $choreExecutionId = $this->getChoresService()->TrackChore($args['choreId'], $trackedTime, $doneBy); From e42f4b405d3f8edc3bc1b7b25a5b7f441658cfaa Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Tue, 12 Jan 2021 10:40:14 +0100 Subject: [PATCH 02/31] Fixed PHP warning (fixes #1267) --- controllers/BaseController.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/controllers/BaseController.php b/controllers/BaseController.php index f51f6109..f50cff07 100644 --- a/controllers/BaseController.php +++ b/controllers/BaseController.php @@ -157,18 +157,18 @@ class BaseController if (GROCY_AUTHENTICATED) { $this->View->set('permissions', User::PermissionList()); - } - $decimalPlacesAmounts = intval($this->getUsersService()->GetUserSetting(GROCY_USER_ID, 'stock_decimal_places_amounts')); - if ($decimalPlacesAmounts <= 0) - { - $defaultMinAmount = 1; + $decimalPlacesAmounts = intval($this->getUsersService()->GetUserSetting(GROCY_USER_ID, 'stock_decimal_places_amounts')); + if ($decimalPlacesAmounts <= 0) + { + $defaultMinAmount = 1; + } + else + { + $defaultMinAmount = '0.' . str_repeat('0', $decimalPlacesAmounts - 1) . '1'; + } + $this->View->set('DEFAULT_MIN_AMOUNT', $defaultMinAmount); } - else - { - $defaultMinAmount = '0.' . str_repeat('0', $decimalPlacesAmounts - 1) . '1'; - } - $this->View->set('DEFAULT_MIN_AMOUNT', $defaultMinAmount); return $this->View->render($response, $page, $data); } From bfa3347a20c764b8e3c8dc75e917affcfa7108bd Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Tue, 12 Jan 2021 18:04:20 +0100 Subject: [PATCH 03/31] Fixed that editing stock entries was not possible (fixes #1268) --- changelog/62_UNRELEASED_xxxx-xx-xx.md | 1 + helpers/extensions.php | 5 +++++ services/StockService.php | 6 +++--- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/changelog/62_UNRELEASED_xxxx-xx-xx.md b/changelog/62_UNRELEASED_xxxx-xx-xx.md index 54b891cc..faae5f18 100644 --- a/changelog/62_UNRELEASED_xxxx-xx-xx.md +++ b/changelog/62_UNRELEASED_xxxx-xx-xx.md @@ -1 +1,2 @@ - Fixed that tracking chores with "Done by" a different user was not possible +- Fixed that editing stock entries was not possible diff --git a/helpers/extensions.php b/helpers/extensions.php index 73296a3a..c17f6ab7 100644 --- a/helpers/extensions.php +++ b/helpers/extensions.php @@ -156,6 +156,11 @@ function BoolToString(bool $bool) return $bool ? 'true' : 'false'; } +function BoolToInt(bool $bool) +{ + return $bool ? 1 : 0; +} + function ExternalSettingValue(string $value) { $tvalue = rtrim($value, "\r\n"); diff --git a/services/StockService.php b/services/StockService.php index 8aa04bf0..6cad4592 100644 --- a/services/StockService.php +++ b/services/StockService.php @@ -402,11 +402,11 @@ class StockService extends BaseService $openedDate = $stockRow->opened_date; - if ($open && $openedDate == null) + if (boolval($open) && $openedDate == null) { $openedDate = date('Y-m-d'); } - elseif (!$open) + elseif (!boolval($open)) { $openedDate = null; } @@ -418,7 +418,7 @@ class StockService extends BaseService 'location_id' => $locationId, 'shopping_location_id' => $shoppingLocationId, 'opened_date' => $openedDate, - 'open' => $open, + 'open' => BoolToInt($open), 'purchased_date' => $purchasedDate ]); From 5ecd3a585ecc34828a793bf49e2cf873bc58ddf6 Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Tue, 12 Jan 2021 18:14:32 +0100 Subject: [PATCH 04/31] Added changelog for #1269 --- changelog/62_UNRELEASED_xxxx-xx-xx.md | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog/62_UNRELEASED_xxxx-xx-xx.md b/changelog/62_UNRELEASED_xxxx-xx-xx.md index faae5f18..73266155 100644 --- a/changelog/62_UNRELEASED_xxxx-xx-xx.md +++ b/changelog/62_UNRELEASED_xxxx-xx-xx.md @@ -1,2 +1,3 @@ - Fixed that tracking chores with "Done by" a different user was not possible - Fixed that editing stock entries was not possible +- Some night mode style improvements (thanks @BlizzWave) From 20380faeb30b68838e974bd483011e83e2cea3e1 Mon Sep 17 00:00:00 2001 From: Marc Ole Bulling Date: Sat, 30 Jan 2021 12:39:10 +0100 Subject: [PATCH 05/31] Fix for #1271 (#1286) --- public/viewjs/shoppinglist.js | 1 + 1 file changed, 1 insertion(+) diff --git a/public/viewjs/shoppinglist.js b/public/viewjs/shoppinglist.js index e0a2c17b..42039971 100644 --- a/public/viewjs/shoppinglist.js +++ b/public/viewjs/shoppinglist.js @@ -449,6 +449,7 @@ $(document).on("click", "#print-shopping-list-button", function(e) callback: function() { bootbox.hideAll(); + $('.modal-backdrop').remove(); $(".print-timestamp").text(moment().format("l LT")); From bfb5525ec1a2287ddb0e409d345ec7871b28ff7f Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Sat, 30 Jan 2021 12:41:09 +0100 Subject: [PATCH 06/31] Added changelog for #1286 --- changelog/62_UNRELEASED_xxxx-xx-xx.md | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog/62_UNRELEASED_xxxx-xx-xx.md b/changelog/62_UNRELEASED_xxxx-xx-xx.md index 73266155..5faed9b0 100644 --- a/changelog/62_UNRELEASED_xxxx-xx-xx.md +++ b/changelog/62_UNRELEASED_xxxx-xx-xx.md @@ -1,3 +1,4 @@ - Fixed that tracking chores with "Done by" a different user was not possible - Fixed that editing stock entries was not possible +- Fixed that shopping list prints had a grey background (thanks @Forceu) - Some night mode style improvements (thanks @BlizzWave) From c889416c0a1ae8f898bdfcd839b5ea8557f88417 Mon Sep 17 00:00:00 2001 From: Marc Ole Bulling Date: Sat, 30 Jan 2021 12:47:12 +0100 Subject: [PATCH 07/31] Fix for #1289 and #1261 (#1297) --- public/viewjs/shoppinglistitemform.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/public/viewjs/shoppinglistitemform.js b/public/viewjs/shoppinglistitemform.js index fc8dacac..b373cbc4 100644 --- a/public/viewjs/shoppinglistitemform.js +++ b/public/viewjs/shoppinglistitemform.js @@ -244,17 +244,14 @@ if (GetUriParam("embedded") !== undefined) } var eitherRequiredFields = $("#product_id,#product_id_text_input,#note"); -eitherRequiredFields.on("input", function() +eitherRequiredFields.prop('required',""); +eitherRequiredFields.on('input', function () { - eitherRequiredFields.attr("required", ""); - if (!$(this).val().isEmpty()) - { - eitherRequiredFields.not(this).removeAttr("required"); - } - + eitherRequiredFields.not(this).prop('required', !$(this).val().length); Grocy.FrontendHelpers.ValidateForm('shoppinglist-form'); }); + if (GetUriParam("product-name") != null) { Grocy.Components.ProductPicker.GetPicker().trigger('change'); From 42689ecefe94889b0dad6ff15e3b710622040cfe Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Sat, 30 Jan 2021 12:49:17 +0100 Subject: [PATCH 08/31] Added changelog for #1297 --- changelog/62_UNRELEASED_xxxx-xx-xx.md | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog/62_UNRELEASED_xxxx-xx-xx.md b/changelog/62_UNRELEASED_xxxx-xx-xx.md index 5faed9b0..bb6f1a60 100644 --- a/changelog/62_UNRELEASED_xxxx-xx-xx.md +++ b/changelog/62_UNRELEASED_xxxx-xx-xx.md @@ -1,4 +1,5 @@ - Fixed that tracking chores with "Done by" a different user was not possible - Fixed that editing stock entries was not possible - Fixed that shopping list prints had a grey background (thanks @Forceu) +- Improved/fixed the form validation on the shopping list item page (thanks @Forceu) - Some night mode style improvements (thanks @BlizzWave) From 760914bf82d905cb588cecad8ed259cc3ff1f7b4 Mon Sep 17 00:00:00 2001 From: Marius Boro Date: Sat, 30 Jan 2021 12:49:51 +0100 Subject: [PATCH 09/31] Update grocy_night_mode.css (#1269) Night mode updates for Grocy 3 --- public/css/grocy_night_mode.css | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/public/css/grocy_night_mode.css b/public/css/grocy_night_mode.css index 18f76e4f..fcc31f52 100644 --- a/public/css/grocy_night_mode.css +++ b/public/css/grocy_night_mode.css @@ -241,3 +241,16 @@ .night-mode .dropdown-menu { background-color: #333131; } + +.night-mode .table-secondary td, +.night-mode .table-secondary th { + background-color: #4c4e50; +} + +.night-mode .secondary-message { + border-top-color: #4c4e50; +} + +.night-mode .normal-message { + border-top-color: #07373f; +} From a1adc80c29963515af1c53eea9d545be40404f15 Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Sat, 30 Jan 2021 13:06:44 +0100 Subject: [PATCH 10/31] Fixed consuming Scan Mode timing (fixes #1292) --- changelog/62_UNRELEASED_xxxx-xx-xx.md | 1 + public/viewjs/consume.js | 21 ++++++++++++--------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/changelog/62_UNRELEASED_xxxx-xx-xx.md b/changelog/62_UNRELEASED_xxxx-xx-xx.md index bb6f1a60..9e8b1c0e 100644 --- a/changelog/62_UNRELEASED_xxxx-xx-xx.md +++ b/changelog/62_UNRELEASED_xxxx-xx-xx.md @@ -2,4 +2,5 @@ - Fixed that editing stock entries was not possible - Fixed that shopping list prints had a grey background (thanks @Forceu) - Improved/fixed the form validation on the shopping list item page (thanks @Forceu) +- Fixed that consuming with Scan Mode was not possible - Some night mode style improvements (thanks @BlizzWave) diff --git a/public/viewjs/consume.js b/public/viewjs/consume.js index 5a3ea2f4..25196b51 100644 --- a/public/viewjs/consume.js +++ b/public/viewjs/consume.js @@ -265,6 +265,11 @@ $("#location_id").on('change', function(e) console.error(xhr); } ); + + if (document.getElementById("product_id").getAttribute("barcode") == "null") + { + ScanModeSubmit(); + } }, function(xhr) { @@ -369,10 +374,9 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e) $(".input-group-productamountpicker").trigger("change"); Grocy.FrontendHelpers.ValidateForm('consume-form'); RefreshLocaleNumberInput(); + ScanModeSubmit(false); } } - - ScanModeSubmit(false); }, function(xhr) { @@ -380,10 +384,6 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e) } ); } - else - { - ScanModeSubmit(); - } }, function(xhr) { @@ -612,6 +612,11 @@ var current_productDetails; function RefreshForm() { var productDetails = current_productDetails; + if (!productDetails) + { + return; + } + if (productDetails.product.enable_tare_weight_handling == 1) { $("#consume-exact-amount-group").removeClass("d-none"); @@ -650,12 +655,10 @@ function ScanModeSubmit(singleUnit = true) if (singleUnit) { $("#display_amount").val(1); + $(".input-group-productamountpicker").trigger("change"); } - RefreshLocaleNumberInput(); - $(".input-group-productamountpicker").trigger("change"); Grocy.FrontendHelpers.ValidateForm("consume-form"); - if (document.getElementById("consume-form").checkValidity() === true) { $('#save-consume-button').click(); From a455a012045e4f505859f2a05651d72741bcde02 Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Sat, 30 Jan 2021 13:11:40 +0100 Subject: [PATCH 11/31] Fixed print layout display handling (fixes #1272) --- public/viewjs/shoppinglist.js | 1 + views/shoppinglist.blade.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/public/viewjs/shoppinglist.js b/public/viewjs/shoppinglist.js index 42039971..cbc2d9c2 100644 --- a/public/viewjs/shoppinglist.js +++ b/public/viewjs/shoppinglist.js @@ -471,6 +471,7 @@ $(document).on("click", "#print-shopping-list-button", function(e) shoppingListPrintShadowTable.draw(); } + $(".print-layout-container").addClass("d-none"); $("." + $("input[name='print-layout-type']:checked").val()).removeClass("d-none"); window.print(); diff --git a/views/shoppinglist.blade.php b/views/shoppinglist.blade.php index d6fe522c..22d1123c 100644 --- a/views/shoppinglist.blade.php +++ b/views/shoppinglist.blade.php @@ -339,7 +339,7 @@ -