From 787c885ccf876c1f11b6108af6412efb223da5ff Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Mon, 8 Nov 2021 22:09:48 +0100 Subject: [PATCH] Fixed addnewproduct productpicker flow shopping list selection on return (fixes #1646) --- changelog/65_UNRELEASED_xxxx-xx-xx.md | 1 + public/viewjs/components/productpicker.js | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/changelog/65_UNRELEASED_xxxx-xx-xx.md b/changelog/65_UNRELEASED_xxxx-xx-xx.md index d0e7a549..f1837a38 100644 --- a/changelog/65_UNRELEASED_xxxx-xx-xx.md +++ b/changelog/65_UNRELEASED_xxxx-xx-xx.md @@ -3,3 +3,4 @@ - Fixed that the "Stay logged in permanently" checkbox on the login page had no effect (thanks @0) - Fixed that the labels of context-/more-menu items were not readable in Night Mode (thanks @corbolais) - Fixed that auto night mode over midnight did not always work +- Fixed that the "Add as new product" productpicker workflow, started from the shopping list item form, always selected the default shopping list after finishing the flow diff --git a/public/viewjs/components/productpicker.js b/public/viewjs/components/productpicker.js index b479931c..65260d75 100644 --- a/public/viewjs/components/productpicker.js +++ b/public/viewjs/components/productpicker.js @@ -208,6 +208,12 @@ $('#product_id_text_input').on('blur', function(e) className: 'btn-success add-new-product-dialog-button responsive-button ' + addProductWorkflowsAdditionalCssClasses, callback: function() { + // Not the best place here - this is only relevant when this flow is started from the shopping list item form + // (to select the correct shopping list on return) + if (GetUriParam("list") !== undefined) + { + embedded += "&list=" + GetUriParam("list"); + } Grocy.Components.ProductPicker.PopupOpen = false; window.location.href = U('/product/new?flow=InplaceNewProductWithName&name=' + encodeURIComponent(input) + '&returnto=' + encodeURIComponent(Grocy.CurrentUrlRelative + "?flow=InplaceNewProductWithName&" + embedded) + "&" + embedded);