From 28fe479f53664b8f0261b84a16b432dd5731e06a Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Bellet Date: Thu, 20 Jul 2023 14:58:19 +0200 Subject: [PATCH 1/2] Unhide `on_demand` & `on_hand` columns by default + update specs as well --- .../reports/products_and_inventory/all_products.rb | 4 ---- spec/system/admin/reports_spec.rb | 9 +++++---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/lib/reporting/reports/products_and_inventory/all_products.rb b/lib/reporting/reports/products_and_inventory/all_products.rb index 8ec06fded7..2471e4c673 100644 --- a/lib/reporting/reports/products_and_inventory/all_products.rb +++ b/lib/reporting/reports/products_and_inventory/all_products.rb @@ -4,10 +4,6 @@ module Reporting module Reports module ProductsAndInventory class AllProducts < Base - def default_params - { fields_to_hide: [:on_demand, :on_hand] } - end - def message I18n.t("spree.admin.reports.products_and_inventory.all_products.message") end diff --git a/spec/system/admin/reports_spec.rb b/spec/system/admin/reports_spec.rb index c11eb5ee69..6264aaee39 100644 --- a/spec/system/admin/reports_spec.rb +++ b/spec/system/admin/reports_spec.rb @@ -423,22 +423,23 @@ describe ' expect(page).to have_content "Supplier" expect(page).to have_table_row ["Supplier", "Producer Suburb", "Product", "Product Properties", "Taxons", "Variant Value", "Price", - "Group Buy Unit Quantity", "Amount", "SKU"].map(&:upcase) + "Group Buy Unit Quantity", "Amount", "SKU", + "On demand?", "On hand"].map(&:upcase) expect(page).to have_table_row [product1.supplier.name, product1.supplier.address.city, "Product Name", product1.properties.map(&:presentation).join(", "), product1.primary_taxon.name, "1g", "100.0", - "none", "", "sku1"] + "none", "", "sku1", "No", "10"] expect(page).to have_table_row [product1.supplier.name, product1.supplier.address.city, "Product Name", product1.properties.map(&:presentation).join(", "), product1.primary_taxon.name, "1g", "80.0", - "none", "", "sku2"] + "none", "", "sku2", "No", "20"] expect(page).to have_table_row [product2.supplier.name, product1.supplier.address.city, "Product 2", product1.properties.map(&:presentation).join(", "), product2.primary_taxon.name, "100g", "99.0", - "none", "", "product_sku"] + "none", "", "product_sku", "No", "9"] end it "shows the LettuceShare report" do From a094a89c09840cf121756fc2065e6ed33cf1297b Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Bellet Date: Thu, 20 Jul 2023 15:31:38 +0200 Subject: [PATCH 2/2] Mark "Inventory (on hand)" report as deprecated Co-Authored-By: Maikel , @dacook --- app/views/admin/reports/_report_subtype.html.haml | 5 ++++- config/locales/en.yml | 1 + lib/reporting/reports/list.rb | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/views/admin/reports/_report_subtype.html.haml b/app/views/admin/reports/_report_subtype.html.haml index c043c68e61..216300d5d3 100644 --- a/app/views/admin/reports/_report_subtype.html.haml +++ b/app/views/admin/reports/_report_subtype.html.haml @@ -2,4 +2,7 @@ - report_subtypes.each do |report_subtype| %li - url = main_app.admin_report_path(report_type: report_type, report_subtype: report_subtype[1]) - = link_to report_subtype[0], url + - if report_subtype.dig(2, :deprecated) + %strike= link_to report_subtype[0], url, title: t('admin.reports.deprecated') + - else + = link_to report_subtype[0], url diff --git a/config/locales/en.yml b/config/locales/en.yml index 624defa10d..872f6cbf26 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1453,6 +1453,7 @@ en: email_confirmation: "Email confirmation is pending. We've sent a confirmation email to %{email}." not_visible: "%{enterprise} is not visible and so cannot be found on the map or in searches" reports: + deprecated: "This report is deprecated and will be removed in a future release." hidden: HIDDEN unitsize: UNITSIZE total: TOTAL diff --git a/lib/reporting/reports/list.rb b/lib/reporting/reports/list.rb index 23489baf00..84e3a1ed41 100644 --- a/lib/reporting/reports/list.rb +++ b/lib/reporting/reports/list.rb @@ -40,7 +40,7 @@ module Reporting def products_and_inventory_report_types [ [i18n_translate("all_products"), :all_products], - [i18n_translate("inventory"), :inventory], + [i18n_translate("inventory"), :inventory, { deprecated: true }], [i18n_translate("lettuce_share"), :lettuce_share] ] end