spree_core 6.0.3 → 6.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/jobs/spree/imports/create_rows_job.rb +4 -2
- data/app/jobs/spree/imports/process_rows_job.rb +4 -2
- data/app/jobs/spree/payments/handle_webhook_job.rb +12 -1
- data/app/jobs/spree/products/auto_match_taxons_job.rb +5 -2
- data/app/jobs/spree/search_provider/index_job.rb +8 -0
- data/app/jobs/spree/search_provider/remove_job.rb +3 -0
- data/app/jobs/spree/stock_locations/stock_items/create_job.rb +5 -2
- data/app/mailers/spree/base_mailer.rb +1 -1
- data/app/models/concerns/spree/acted_by.rb +2 -2
- data/app/models/concerns/spree/customer_methods.rb +6 -4
- data/app/models/concerns/spree/deprecated_customer_alias.rb +11 -3
- data/app/models/concerns/spree/derived_number.rb +1 -1
- data/app/models/concerns/spree/has_custom_fields.rb +16 -11
- data/app/models/concerns/spree/integrations_concern.rb +5 -3
- data/app/models/concerns/spree/label_translatable.rb +4 -4
- data/app/models/concerns/spree/metadata.rb +3 -3
- data/app/models/concerns/spree/personal_data_matching.rb +5 -1
- data/app/models/concerns/spree/presentation_translatable.rb +1 -1
- data/app/models/concerns/spree/product_scopes.rb +2 -2
- data/app/models/concerns/spree/publishable.rb +26 -3
- data/app/models/concerns/spree/purchase/addresses.rb +8 -5
- data/app/models/concerns/spree/purchase/deprecated_aliases.rb +2 -2
- data/app/models/concerns/spree/stores/markets.rb +4 -2
- data/app/models/concerns/spree/user_address.rb +5 -2
- data/app/models/concerns/spree/user_methods.rb +2 -2
- data/app/models/spree/address.rb +29 -14
- data/app/models/spree/asset.rb +3 -3
- data/app/models/spree/authentication/strategies/base_strategy.rb +10 -1
- data/app/models/spree/base.rb +1 -1
- data/app/models/spree/calculator/shipping/flat_rate.rb +6 -4
- data/app/models/spree/cart.rb +9 -4
- data/app/models/spree/category.rb +8 -6
- data/app/models/spree/classification.rb +2 -2
- data/app/models/spree/current.rb +19 -0
- data/app/models/spree/custom_field.rb +6 -6
- data/app/models/spree/custom_field_definition.rb +10 -7
- data/app/models/spree/delivery_method.rb +21 -15
- data/app/models/spree/delivery_rate.rb +1 -1
- data/app/models/spree/digital.rb +1 -1
- data/app/models/spree/digital_asset.rb +2 -2
- data/app/models/spree/digital_link.rb +4 -4
- data/app/models/spree/export.rb +29 -2
- data/app/models/spree/fulfillment/custom_events.rb +18 -10
- data/app/models/spree/fulfillment.rb +30 -23
- data/app/models/spree/fulfillment_item.rb +3 -3
- data/app/models/spree/fulfilment_changer.rb +1 -1
- data/app/models/spree/gift_card.rb +12 -12
- data/app/models/spree/import.rb +23 -15
- data/app/models/spree/import_row.rb +6 -6
- data/app/models/spree/inventory_unit.rb +1 -1
- data/app/models/spree/invitation.rb +14 -6
- data/app/models/spree/line_item.rb +10 -8
- data/app/models/spree/media.rb +27 -3
- data/app/models/spree/metafield.rb +1 -1
- data/app/models/spree/metafield_definition.rb +1 -1
- data/app/models/spree/metafields.rb +2 -2
- data/app/models/spree/option_type.rb +26 -0
- data/app/models/spree/option_value.rb +3 -3
- data/app/models/spree/order.rb +92 -46
- data/app/models/spree/order_inventory.rb +2 -2
- data/app/models/spree/order_merger.rb +2 -2
- data/app/models/spree/order_updater.rb +34 -20
- data/app/models/spree/payment.rb +8 -8
- data/app/models/spree/payment_method.rb +11 -9
- data/app/models/spree/price.rb +22 -8
- data/app/models/spree/price_list.rb +12 -6
- data/app/models/spree/price_rules/zone_rule.rb +1 -1
- data/app/models/spree/product.rb +32 -33
- data/app/models/spree/product_category.rb +10 -4
- data/app/models/spree/product_collection.rb +8 -1
- data/app/models/spree/promotion/rules/category.rb +27 -10
- data/app/models/spree/promotion/rules/country.rb +1 -1
- data/app/models/spree/promotion/rules/taxon.rb +4 -2
- data/app/models/spree/promotion/rules/user.rb +1 -1
- data/app/models/spree/promotion_action.rb +1 -1
- data/app/models/spree/promotion_rule_category.rb +5 -5
- data/app/models/spree/promotion_rule_taxon.rb +2 -2
- data/app/models/spree/prototype.rb +4 -1
- data/app/models/spree/return_authorization_reason.rb +3 -3
- data/app/models/spree/return_reason.rb +1 -1
- data/app/models/spree/search_provider/base.rb +2 -2
- data/app/models/spree/search_provider.rb +7 -5
- data/app/models/spree/seller.rb +93 -10
- data/app/models/spree/seller_requirements/complete_profile.rb +26 -7
- data/app/models/spree/shipment.rb +4 -1
- data/app/models/spree/shipping_method.rb +4 -1
- data/app/models/spree/shipping_rate.rb +1 -1
- data/app/models/spree/stock/coordinator.rb +2 -2
- data/app/models/spree/stock/estimator.rb +7 -5
- data/app/models/spree/stock/package.rb +10 -8
- data/app/models/spree/stock_item.rb +1 -1
- data/app/models/spree/stock_level/custom_events.rb +1 -1
- data/app/models/spree/stock_level.rb +31 -2
- data/app/models/spree/stock_location.rb +12 -8
- data/app/models/spree/stock_movement.rb +7 -6
- data/app/models/spree/stock_reservation.rb +5 -5
- data/app/models/spree/store.rb +42 -16
- data/app/models/spree/store_credit.rb +2 -2
- data/app/models/spree/store_credit_category.rb +5 -5
- data/app/models/spree/store_credit_type.rb +2 -2
- data/app/models/spree/subscriber.rb +7 -7
- data/app/models/spree/tax_rate.rb +5 -5
- data/app/models/spree/taxon.rb +3 -3
- data/app/models/spree/taxon_rule.rb +2 -2
- data/app/models/spree/taxonomy.rb +1 -1
- data/app/models/spree/variant.rb +12 -10
- data/app/models/spree/variant_media.rb +1 -1
- data/app/models/spree/wished_item.rb +1 -1
- data/app/models/spree/wishlist.rb +2 -2
- data/app/models/spree/wishlist_item/custom_events.rb +2 -2
- data/app/models/spree/zone.rb +1 -1
- data/app/models/spree/zone_member.rb +1 -1
- data/app/services/spree/carts/associate.rb +6 -2
- data/app/services/spree/carts/create.rb +1 -1
- data/app/services/spree/carts/destroy.rb +23 -7
- data/app/services/spree/carts/remove_item.rb +1 -1
- data/app/services/spree/carts/remove_line_item.rb +2 -2
- data/app/services/spree/carts/remove_out_of_stock_items.rb +3 -1
- data/app/services/spree/carts/set_quantity.rb +2 -2
- data/app/services/spree/carts/update.rb +17 -0
- data/app/services/spree/checkout/add_store_credit.rb +3 -3
- data/app/services/spree/checkout/remove_store_credit.rb +2 -2
- data/app/services/spree/collections/regenerate_products.rb +37 -15
- data/app/services/spree/companies/add_member.rb +9 -4
- data/app/services/spree/diagnostics/error_log.rb +139 -0
- data/app/services/spree/diagnostics/section.rb +72 -0
- data/app/services/spree/diagnostics/sections.rb +121 -0
- data/app/services/spree/diagnostics/stack.rb +73 -0
- data/app/services/spree/diagnostics.rb +132 -0
- data/app/services/spree/imports/row_processors/product_variant.rb +19 -0
- data/app/services/spree/newsletter/subscribe.rb +7 -3
- data/app/services/spree/orders/approve.rb +3 -3
- data/app/services/spree/orders/create_user_account.rb +2 -2
- data/app/services/spree/orders/remove_line_item.rb +16 -5
- data/app/services/spree/product_memberships.rb +21 -1
- data/app/services/spree/product_types/apply_to_products.rb +12 -2
- data/app/services/spree/products/auto_match_collections.rb +20 -4
- data/app/services/spree/products/auto_match_taxons.rb +5 -2
- data/app/services/spree/shipments/update.rb +2 -2
- data/app/services/spree/stock_locations/stock_items/create.rb +5 -2
- data/app/services/spree/stock_reservations/extend.rb +3 -1
- data/app/services/spree/stock_reservations/reserve.rb +12 -7
- data/app/services/spree/store_credits/apply.rb +9 -1
- data/app/services/spree/taxons/add_products.rb +4 -2
- data/app/services/spree/taxons/regenerate_products.rb +5 -2
- data/app/services/spree/taxons/remove_products.rb +4 -2
- data/app/services/spree/update_check.rb +7 -31
- data/app/tools/spree/agent_tools/describe_resource.rb +3 -0
- data/app/tools/spree/agent_tools/get_resource.rb +1 -1
- data/app/tools/spree/agent_tools/resource_write.rb +1 -1
- data/app/tools/spree/agent_tools/search_resources.rb +42 -10
- data/app/workflows/spree/carts/add_item.rb +52 -1
- data/app/workflows/spree/carts/complete.rb +14 -2
- data/app/workflows/spree/carts/recalculate.rb +1 -1
- data/app/workflows/spree/fulfillments/update.rb +1 -1
- data/app/workflows/spree/orders/cancel.rb +3 -1
- data/app/workflows/spree/payments/capture.rb +2 -2
- data/app/workflows/spree/payments/handle_webhook.rb +7 -3
- data/app/workflows/spree/seller_transfers/create.rb +1 -1
- data/app/workflows/spree/sellers/approve.rb +6 -0
- data/app/workflows/spree/sellers/create.rb +5 -2
- data/app/workflows/spree/stock_levels/bulk_upsert.rb +19 -7
- data/config/locales/be.yml +1 -1
- data/config/locales/en.yml +12 -0
- data/config/locales/fr.yml +1 -1
- data/config/locales/lt.yml +1 -1
- data/config/locales/ru.yml +1 -1
- data/config/locales/uk.yml +1 -1
- data/db/migrate/20240303174340_fix_spree_stock_item_unique_index.rb +14 -10
- data/db/migrate/20260710000001_rename_taxons_to_categories.rb +1 -1
- data/db/migrate/20260728000004_rename_shipping_to_fulfillment_and_delivery.rb +1 -1
- data/db/migrate/20260806000001_add_store_id_to_spree_tax_rates_and_categories.rb +1 -1
- data/db/migrate/20260807130001_add_country_state_codes_to_consumers.rb +1 -1
- data/db/migrate/20260809000001_rename_metafields_to_custom_fields.rb +1 -1
- data/db/migrate/20260809150001_promote_shipping_categories_to_delivery_profiles.rb +1 -1
- data/db/migrate/20260811000001_add_delivery_tracking_to_fulfillments.rb +1 -1
- data/db/migrate/20260814000001_rename_stock_items_to_stock_levels.rb +13 -7
- data/db/migrate/20260824000001_add_store_to_spree_media.rb +1 -1
- data/db/migrate/20260828100001_unify_import_and_export_tenancy.rb +1 -1
- data/db/migrate/20261016000001_remove_default_from_spree_tax_rates_included_in_price.rb +1 -1
- data/lib/spree/agent_tool.rb +3 -3
- data/lib/spree/agent_tools/default_catalog.rb +2 -2
- data/lib/spree/agent_tools/legacy_tools.rb +1 -1
- data/lib/spree/agent_tools/operation_tool.rb +1 -1
- data/lib/spree/agent_tools/record_summary.rb +8 -2
- data/lib/spree/agent_tools/resource_map.rb +82 -7
- data/lib/spree/core/dependencies.rb +10 -10
- data/lib/spree/core/engine.rb +14 -0
- data/lib/spree/core/number_generator.rb +4 -3
- data/lib/spree/core/preferences/preferable.rb +1 -1
- data/lib/spree/core/preferences/preferable_class_methods.rb +5 -1
- data/lib/spree/core/pricing/resolver.rb +2 -2
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/core.rb +48 -10
- data/lib/spree/i18n.rb +6 -2
- data/lib/spree/localized_number.rb +1 -1
- data/lib/spree/removed_apis.rb +274 -0
- data/lib/spree/reporting/default_vocabulary.rb +26 -6
- data/lib/spree/testing_support/factories/digital_asset_factory.rb +1 -1
- data/lib/spree/testing_support/factories/stock_level_factory.rb +1 -1
- data/lib/spree/testing_support/factories/taxon_factory.rb +1 -1
- data/lib/spree/testing_support/factories/taxonomy_factory.rb +1 -1
- data/lib/spree/testing_support/factories/wishlist_item_factory.rb +1 -1
- data/lib/spree/testing_support/i18n.rb +7 -2
- data/lib/spree/testing_support/order_walkthrough.rb +5 -2
- data/lib/spree/upgrades/5_6_to_6_0/manifest.yml +14 -14
- data/lib/tasks/carts_migration.rake +1 -1
- data/lib/tasks/categories_and_collections.rake +1 -1
- data/lib/tasks/deliveries_migration.rake +1 -1
- data/lib/tasks/delivery_method_rules_migration.rake +1 -1
- data/lib/tasks/delivery_migration.rake +1 -1
- data/lib/tasks/delivery_profiles_migration.rake +2 -2
- data/lib/tasks/diagnostics.rake +11 -0
- data/lib/tasks/fold_store_credit_categories.rake +1 -1
- data/lib/tasks/migrate_country_state_codes.rake +1 -1
- data/lib/tasks/migrate_returns.rake +4 -4
- data/lib/tasks/migrate_rich_text_to_columns.rake +1 -1
- data/lib/tasks/store_settings.rake +1 -1
- data/lib/tasks/typed_stock_movements_migration.rake +1 -1
- metadata +13 -6
data/app/models/spree/address.rb
CHANGED
|
@@ -65,7 +65,7 @@ module Spree
|
|
|
65
65
|
|
|
66
66
|
# @deprecated The canonical names are +country_code+ and +state_code+,
|
|
67
67
|
# matching the tax tables. Kept because the Store API shipped
|
|
68
|
-
# +country_iso+ and +state_abbr+; both are removed in 6.
|
|
68
|
+
# +country_iso+ and +state_abbr+; both are removed in 6.3.
|
|
69
69
|
alias_attribute :state_abbr, :state_code
|
|
70
70
|
alias_attribute :country_iso, :country_code
|
|
71
71
|
|
|
@@ -133,9 +133,9 @@ module Spree
|
|
|
133
133
|
value.to_s.gsub(/[\s-]/, '').upcase
|
|
134
134
|
end
|
|
135
135
|
|
|
136
|
-
# @deprecated Use {.normalize_postal_code}; removed in 6.
|
|
136
|
+
# @deprecated Use {.normalize_postal_code}; removed in 6.3.
|
|
137
137
|
def self.normalize_zipcode(value)
|
|
138
|
-
Spree::Deprecation.warn('Spree::Address.normalize_zipcode is deprecated and will be removed in Spree 6.
|
|
138
|
+
Spree::Deprecation.warn('Spree::Address.normalize_zipcode is deprecated and will be removed in Spree 6.3. Use .normalize_postal_code instead.')
|
|
139
139
|
normalize_postal_code(value)
|
|
140
140
|
end
|
|
141
141
|
|
|
@@ -144,9 +144,11 @@ module Spree
|
|
|
144
144
|
self.class.normalize_postal_code(postal_code)
|
|
145
145
|
end
|
|
146
146
|
|
|
147
|
-
# @deprecated Use {#normalized_postal_code}; removed in 6.
|
|
147
|
+
# @deprecated Use {#normalized_postal_code}; removed in 6.3.
|
|
148
148
|
def normalized_zipcode
|
|
149
|
-
Spree::Deprecation.warn(
|
|
149
|
+
Spree::Deprecation.warn(
|
|
150
|
+
'Spree::Address#normalized_zipcode is deprecated and will be removed in Spree 6.3. Use #normalized_postal_code instead.'
|
|
151
|
+
)
|
|
150
152
|
normalized_postal_code
|
|
151
153
|
end
|
|
152
154
|
|
|
@@ -166,7 +168,7 @@ module Spree
|
|
|
166
168
|
params.delete(:country_id)
|
|
167
169
|
params.delete(:state_id)
|
|
168
170
|
|
|
169
|
-
# Legacy write names accepted until 6.
|
|
171
|
+
# Legacy write names accepted until 6.5; the columns are country_code
|
|
170
172
|
# and state_code. The renamed name and postal-code columns need no entry
|
|
171
173
|
# here — alias_attribute resolves those inside `where` too, while these
|
|
172
174
|
# two are not attribute aliases.
|
|
@@ -239,19 +241,31 @@ module Spree
|
|
|
239
241
|
|
|
240
242
|
# @deprecated The address's owner may be a customer, a company node or a
|
|
241
243
|
# seller, so {#owner} replaces the customer-only association. Removed in
|
|
242
|
-
# Spree 6.
|
|
244
|
+
# Spree 6.3.
|
|
243
245
|
def user
|
|
244
|
-
|
|
246
|
+
if defined?(Spree::Deprecation)
|
|
247
|
+
Spree::Deprecation.warn(
|
|
248
|
+
'Spree::Address#user is deprecated and will be removed in Spree 6.3. Use #owner instead.'
|
|
249
|
+
)
|
|
250
|
+
end
|
|
245
251
|
customer_owner
|
|
246
252
|
end
|
|
247
253
|
|
|
248
254
|
def user=(value)
|
|
249
|
-
|
|
255
|
+
if defined?(Spree::Deprecation)
|
|
256
|
+
Spree::Deprecation.warn(
|
|
257
|
+
'Spree::Address#user= is deprecated and will be removed in Spree 6.3. Use #owner= instead.'
|
|
258
|
+
)
|
|
259
|
+
end
|
|
250
260
|
self.owner = value
|
|
251
261
|
end
|
|
252
262
|
|
|
253
263
|
def user_id
|
|
254
|
-
|
|
264
|
+
if defined?(Spree::Deprecation)
|
|
265
|
+
Spree::Deprecation.warn(
|
|
266
|
+
'Spree::Address#user_id is deprecated and will be removed in Spree 6.3. Use #owner_id instead.'
|
|
267
|
+
)
|
|
268
|
+
end
|
|
255
269
|
owner_id if customer_owned?
|
|
256
270
|
end
|
|
257
271
|
|
|
@@ -322,11 +336,12 @@ module Spree
|
|
|
322
336
|
# @deprecated Overriding Ruby's +Object#clone+ was a mistake: this returns
|
|
323
337
|
# a value copy with the owner, label and metadata stripped, which is not
|
|
324
338
|
# what +clone+ means anywhere else in Ruby. The override is removed in
|
|
325
|
-
# Spree 6.
|
|
339
|
+
# Spree 6.3 and +clone+ becomes the standard shallow copy. Use
|
|
326
340
|
# {#snapshot} for the ownerless copy a purchase keeps.
|
|
327
341
|
def clone
|
|
328
342
|
Spree::Deprecation.warn(
|
|
329
|
-
'Spree::Address#clone is deprecated. From Spree 6.
|
|
343
|
+
'Spree::Address#clone is deprecated. From Spree 6.3 it behaves as the standard Ruby Object#clone — ' \
|
|
344
|
+
'a shallow copy keeping the owner and every other attribute. Use #snapshot for the ownerless copy a purchase keeps.'
|
|
330
345
|
)
|
|
331
346
|
|
|
332
347
|
self.class.new(value_attributes)
|
|
@@ -431,7 +446,7 @@ module Spree
|
|
|
431
446
|
require_zipcode?
|
|
432
447
|
end
|
|
433
448
|
|
|
434
|
-
# @deprecated Override {#require_postal_code?}; removed in 6.
|
|
449
|
+
# @deprecated Override {#require_postal_code?}; removed in 6.3.
|
|
435
450
|
def require_zipcode?
|
|
436
451
|
!quick_checkout && (country ? country.zipcode_required? : true)
|
|
437
452
|
end
|
|
@@ -519,7 +534,7 @@ module Spree
|
|
|
519
534
|
end
|
|
520
535
|
|
|
521
536
|
# The ISO code is what the address stores; the association is kept in step
|
|
522
|
-
# with it
|
|
537
|
+
# with it until 6.3 removes it. Assigning +country+ directly
|
|
523
538
|
# is equally supported — whichever half was set fills in the other.
|
|
524
539
|
def normalize_country
|
|
525
540
|
submitted_iso = self[:country_code].presence
|
data/app/models/spree/asset.rb
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
module Spree
|
|
4
4
|
# Deprecation alias for Spree::Media, renamed from Spree::Asset in 6.0.
|
|
5
|
-
# Retained
|
|
5
|
+
# Retained until 6.3 so existing code and extensions that reference
|
|
6
6
|
# Spree::Asset keep working; the canonical class is Spree::Media. Removed in
|
|
7
|
-
# 6.
|
|
7
|
+
# 6.3, together with Spree::Image (which this replaces).
|
|
8
8
|
#
|
|
9
9
|
# This is a true constant alias — the underlying class, table (spree_media)
|
|
10
10
|
# and prefix (media) are all Spree::Media. Only the constant differs, so
|
|
@@ -12,5 +12,5 @@ module Spree
|
|
|
12
12
|
# resolving to Spree::Media.
|
|
13
13
|
Asset = Media
|
|
14
14
|
|
|
15
|
-
Spree::Deprecation.warn('Spree::Asset is deprecated and will be removed in Spree 6.
|
|
15
|
+
Spree::Deprecation.warn('Spree::Asset is deprecated and will be removed in Spree 6.3. Use Spree::Media instead.')
|
|
16
16
|
end
|
|
@@ -82,12 +82,21 @@ module Spree
|
|
|
82
82
|
# account as "ada@example.com" — an exact match would refuse login to
|
|
83
83
|
# someone who capitalizes their own address differently.
|
|
84
84
|
#
|
|
85
|
+
# When that finds nothing, an exact match through the model goes
|
|
86
|
+
# through whatever the app layers on the column: an app that encrypts
|
|
87
|
+
# email (`encrypts :email, deterministic: true, downcase: true`)
|
|
88
|
+
# stores ciphertext, which `LOWER(email)` in SQL can never match. The
|
|
89
|
+
# case-insensitive match comes first so that, where older data holds
|
|
90
|
+
# two accounts differing only in case, the casing typed never picks
|
|
91
|
+
# between them.
|
|
92
|
+
#
|
|
85
93
|
# @param email [String]
|
|
86
94
|
# @return [Object, nil]
|
|
87
95
|
def find_user_by_email(email)
|
|
88
96
|
return nil if email.blank?
|
|
89
97
|
|
|
90
|
-
user_class.find_by(user_class.arel_table[:email].lower.eq(email.to_s.downcase))
|
|
98
|
+
user_class.find_by(user_class.arel_table[:email].lower.eq(email.to_s.downcase)) ||
|
|
99
|
+
user_class.find_by(email: email.to_s)
|
|
91
100
|
end
|
|
92
101
|
|
|
93
102
|
# Find or create user identity
|
data/app/models/spree/base.rb
CHANGED
|
@@ -306,7 +306,7 @@ class Spree::Base < ApplicationRecord
|
|
|
306
306
|
|
|
307
307
|
# @deprecated Legacy Tom Select helper for the removed Rails admin. No replacement.
|
|
308
308
|
def self.to_tom_select_json
|
|
309
|
-
Spree::Deprecation.warn('Spree::Base.to_tom_select_json is deprecated and will be removed in Spree 6.
|
|
309
|
+
Spree::Deprecation.warn('Spree::Base.to_tom_select_json is deprecated and will be removed in Spree 6.3.')
|
|
310
310
|
|
|
311
311
|
pluck(:name, :id).map do |name, id|
|
|
312
312
|
{
|
|
@@ -11,11 +11,13 @@ module Spree
|
|
|
11
11
|
# currency so upgraded stores quote unchanged.
|
|
12
12
|
preference :currency, :string, format: :currency, default: -> { Spree::Store.default.default_currency }
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
preference :maximum_item_total, :money, default: nil, nullable: true, deprecated: 'Use a Spree::DeliveryMethodRules rule on the delivery method instead; removed in Spree 6.1.'
|
|
14
|
+
RULE_DEPRECATION = 'Use a Spree::DeliveryMethodRules rule on the delivery method instead; removed in Spree 6.3.'.freeze
|
|
16
15
|
|
|
17
|
-
preference :
|
|
18
|
-
preference :
|
|
16
|
+
preference :minimum_item_total, :money, default: nil, nullable: true, deprecated: RULE_DEPRECATION
|
|
17
|
+
preference :maximum_item_total, :money, default: nil, nullable: true, deprecated: RULE_DEPRECATION
|
|
18
|
+
|
|
19
|
+
preference :minimum_weight, :decimal, default: nil, nullable: true, deprecated: RULE_DEPRECATION
|
|
20
|
+
preference :maximum_weight, :decimal, default: nil, nullable: true, deprecated: RULE_DEPRECATION
|
|
19
21
|
|
|
20
22
|
def self.description
|
|
21
23
|
I18n.t('spree.shipping_flat_rate_per_order')
|
data/app/models/spree/cart.rb
CHANGED
|
@@ -79,7 +79,7 @@ module Spree
|
|
|
79
79
|
end
|
|
80
80
|
end
|
|
81
81
|
has_many :fulfillment_items, through: :fulfillments, class_name: 'Spree::FulfillmentItem'
|
|
82
|
-
# Legacy name (5.x carts were orders) — removed in 6.
|
|
82
|
+
# Legacy name (5.x carts were orders) — removed in 6.3
|
|
83
83
|
has_many :shipments, -> { order(:created_at, :id) }, class_name: 'Spree::Fulfillment', inverse_of: :cart, deprecated: true
|
|
84
84
|
has_many :order_promotions, class_name: 'Spree::OrderPromotion', inverse_of: :cart, dependent: :destroy
|
|
85
85
|
has_many :promotions, through: :order_promotions, class_name: 'Spree::Promotion'
|
|
@@ -107,7 +107,7 @@ module Spree
|
|
|
107
107
|
delegate :name, to: :customer, prefix: true, allow_nil: true
|
|
108
108
|
|
|
109
109
|
# @deprecated Store API bridge — carts have no order-style number; the
|
|
110
|
-
# prefixed ID is the identifier. Removed from the API in 6.
|
|
110
|
+
# prefixed ID is the identifier. Removed from the API in 6.5.
|
|
111
111
|
# @return [String]
|
|
112
112
|
def number
|
|
113
113
|
prefixed_id
|
|
@@ -141,11 +141,16 @@ module Spree
|
|
|
141
141
|
|
|
142
142
|
# Whether a live completion attempt holds this cart — its totals are fixed
|
|
143
143
|
# and money may be moving, so mutations must wait until it finishes or the
|
|
144
|
-
# claim goes stale.
|
|
144
|
+
# claim goes stale. A payment-covered draft or a divided checkout resumes
|
|
145
|
+
# its existing result instead of editing the cart that supplied it.
|
|
145
146
|
#
|
|
146
147
|
# @return [Boolean]
|
|
147
148
|
def completion_claimed?
|
|
148
|
-
|
|
149
|
+
return false if completing_at.blank?
|
|
150
|
+
return true if completing_at > COMPLETING_CLAIM_TTL.ago || order_group.present?
|
|
151
|
+
return false if order.nil?
|
|
152
|
+
|
|
153
|
+
order.payments.valid.where(status: %w[pending processing completed]).sum(:amount) >= order.amount_due_at_checkout
|
|
149
154
|
end
|
|
150
155
|
|
|
151
156
|
# Recomputes and persists money totals (item, tax, promotion, delivery)
|
|
@@ -5,7 +5,7 @@ require 'stringex'
|
|
|
5
5
|
module Spree
|
|
6
6
|
# The hierarchical product category (formerly Spree::Taxon), on spree_categories,
|
|
7
7
|
# owned directly via store_id — a parentless category is a genuine top-level node.
|
|
8
|
-
# Spree::Taxon is retained as a deprecation alias
|
|
8
|
+
# Spree::Taxon is retained as a deprecation alias until 6.3. Rule-based
|
|
9
9
|
# (automatic) membership now lives on Spree::Collection.
|
|
10
10
|
class Category < Spree.base_class
|
|
11
11
|
include Spree::SingleStoreResource
|
|
@@ -39,14 +39,16 @@ module Spree
|
|
|
39
39
|
# Associations
|
|
40
40
|
#
|
|
41
41
|
# @deprecated Read only by the 5.6 -> 6.0 upgrade task, which needs the
|
|
42
|
-
# column to find the rows it migrates. Removed in 6.
|
|
42
|
+
# column to find the rows it migrates. Removed in 6.3 with Spree::Taxonomy.
|
|
43
43
|
belongs_to :taxonomy, class_name: 'Spree::Taxonomy', inverse_of: :taxons, optional: true, deprecated: true
|
|
44
44
|
has_many :product_categories, -> { order(:position) }, class_name: 'Spree::ProductCategory', dependent: :destroy_async, inverse_of: :category
|
|
45
45
|
has_many :products, through: :product_categories
|
|
46
46
|
|
|
47
|
-
# @deprecated Use #product_categories; removed in 6.
|
|
47
|
+
# @deprecated Use #product_categories; removed in 6.3.
|
|
48
48
|
def classifications
|
|
49
|
-
Spree::Deprecation.warn(
|
|
49
|
+
Spree::Deprecation.warn(
|
|
50
|
+
'Spree::Category#classifications is deprecated and will be removed in Spree 6.3. Use Spree::Category#product_categories instead.'
|
|
51
|
+
)
|
|
50
52
|
product_categories
|
|
51
53
|
end
|
|
52
54
|
|
|
@@ -159,7 +161,7 @@ module Spree
|
|
|
159
161
|
# Categories are manual only in 6.0 — rule-based (automatic) membership lives on
|
|
160
162
|
# Spree::Collection. The automatic/rules_match_policy/sort_order columns and the
|
|
161
163
|
# spree_taxon_rules table are retained for the Phase 4 data migration and dropped
|
|
162
|
-
# in 6.
|
|
164
|
+
# in 6.3. Nothing creates an automatic category any more, so the model
|
|
163
165
|
# associations carry no scope; the API controllers still apply it as a
|
|
164
166
|
# boundary guard against rows an install has yet to migrate.
|
|
165
167
|
scope :manual, -> { where.not(automatic: true) }
|
|
@@ -480,7 +482,7 @@ module Spree
|
|
|
480
482
|
# A category added under a legacy taxonomy-backed parent inherits its
|
|
481
483
|
# taxonomy, so #ensure_store and the .for_store fallback can still resolve a
|
|
482
484
|
# store for installs that have not yet run the 6.0 upgrade task. Removed in
|
|
483
|
-
# 6.
|
|
485
|
+
# 6.3 with Spree::Taxonomy.
|
|
484
486
|
# A tree belongs to one store.
|
|
485
487
|
def parent_belongs_to_same_store
|
|
486
488
|
return if parent.blank?
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
module Spree
|
|
4
4
|
# Deprecation alias for Spree::ProductCategory, renamed from Spree::Classification
|
|
5
5
|
# in 6.0. A true constant alias (AR-safe); the warning fires when this file loads.
|
|
6
|
-
# Removed in 6.
|
|
6
|
+
# Removed in 6.3.
|
|
7
7
|
Classification = ProductCategory
|
|
8
8
|
|
|
9
|
-
Spree::Deprecation.warn('Spree::Classification is deprecated and will be removed in Spree 6.
|
|
9
|
+
Spree::Deprecation.warn('Spree::Classification is deprecated and will be removed in Spree 6.3. Use Spree::ProductCategory instead.')
|
|
10
10
|
end
|
data/app/models/spree/current.rb
CHANGED
|
@@ -96,6 +96,25 @@ module Spree
|
|
|
96
96
|
super.presence || I18n.default_locale.name
|
|
97
97
|
end
|
|
98
98
|
|
|
99
|
+
# Runs the block with +content_locale+ assigned, for work outside a request
|
|
100
|
+
# that reads a store's content in that store's own locales — an export, a
|
|
101
|
+
# mailer, a search document builder. Nothing assigns the content locale
|
|
102
|
+
# there, so base columns would be read as the application's default locale
|
|
103
|
+
# instead of the store's. Restores what was assigned before, which outside
|
|
104
|
+
# a request is nothing.
|
|
105
|
+
#
|
|
106
|
+
# @param locale [String, Symbol, nil] locale code
|
|
107
|
+
# @return [Object] the block's result
|
|
108
|
+
def with_content_locale(locale)
|
|
109
|
+
previous = attributes[:content_locale]
|
|
110
|
+
# A code, not a locale object: the Mobility column fallback compares it
|
|
111
|
+
# to the string form of the locale being read.
|
|
112
|
+
self.content_locale = locale&.to_s
|
|
113
|
+
yield
|
|
114
|
+
ensure
|
|
115
|
+
self.content_locale = previous
|
|
116
|
+
end
|
|
117
|
+
|
|
99
118
|
# The country whose tax applies while browsing, before any address exists.
|
|
100
119
|
# Fallback: the market being browsed -> the store's own country. An order
|
|
101
120
|
# in hand answers this better (Spree::Purchase::Taxation#tax_country reads
|
|
@@ -88,30 +88,30 @@ module Spree
|
|
|
88
88
|
end
|
|
89
89
|
|
|
90
90
|
#
|
|
91
|
-
# Deprecated 6.0 names, removed in 6.
|
|
91
|
+
# Deprecated 6.0 names, removed in 6.3
|
|
92
92
|
#
|
|
93
93
|
def metafield_definition
|
|
94
|
-
Spree::Deprecation.warn('#metafield_definition is deprecated and will be removed in Spree 6.
|
|
94
|
+
Spree::Deprecation.warn('#metafield_definition is deprecated and will be removed in Spree 6.3. Use #custom_field_definition instead.')
|
|
95
95
|
custom_field_definition
|
|
96
96
|
end
|
|
97
97
|
|
|
98
98
|
def metafield_definition_id
|
|
99
|
-
Spree::Deprecation.warn('#metafield_definition_id is deprecated and will be removed in Spree 6.
|
|
99
|
+
Spree::Deprecation.warn('#metafield_definition_id is deprecated and will be removed in Spree 6.3. Use #custom_field_definition_id instead.')
|
|
100
100
|
custom_field_definition_id
|
|
101
101
|
end
|
|
102
102
|
|
|
103
103
|
def metafield_definition_id=(value)
|
|
104
|
-
Spree::Deprecation.warn('#metafield_definition_id= is deprecated and will be removed in Spree 6.
|
|
104
|
+
Spree::Deprecation.warn('#metafield_definition_id= is deprecated and will be removed in Spree 6.3. Use #custom_field_definition_id= instead.')
|
|
105
105
|
self.custom_field_definition_id = value
|
|
106
106
|
end
|
|
107
107
|
|
|
108
108
|
def metafield_definition=(value)
|
|
109
|
-
Spree::Deprecation.warn('#metafield_definition= is deprecated and will be removed in Spree 6.
|
|
109
|
+
Spree::Deprecation.warn('#metafield_definition= is deprecated and will be removed in Spree 6.3. Use #custom_field_definition= instead.')
|
|
110
110
|
self.custom_field_definition = value
|
|
111
111
|
end
|
|
112
112
|
|
|
113
113
|
def name
|
|
114
|
-
Spree::Deprecation.warn('#name is deprecated and will be removed in Spree 6.
|
|
114
|
+
Spree::Deprecation.warn('#name is deprecated and will be removed in Spree 6.3. Use #label instead.')
|
|
115
115
|
label
|
|
116
116
|
end
|
|
117
117
|
|
|
@@ -82,37 +82,40 @@ module Spree
|
|
|
82
82
|
end
|
|
83
83
|
|
|
84
84
|
#
|
|
85
|
-
# Deprecated 6.0 column names, removed in 6.
|
|
85
|
+
# Deprecated 6.0 column names, removed in 6.3
|
|
86
86
|
#
|
|
87
87
|
def name
|
|
88
|
-
Spree::Deprecation.warn('#name is deprecated and will be removed in Spree 6.
|
|
88
|
+
Spree::Deprecation.warn('#name is deprecated and will be removed in Spree 6.3. Use #label instead.')
|
|
89
89
|
label
|
|
90
90
|
end
|
|
91
91
|
|
|
92
92
|
def name=(value)
|
|
93
|
-
Spree::Deprecation.warn('#name= is deprecated and will be removed in Spree 6.
|
|
93
|
+
Spree::Deprecation.warn('#name= is deprecated and will be removed in Spree 6.3. Use #label= instead.')
|
|
94
94
|
self.label = value
|
|
95
95
|
end
|
|
96
96
|
|
|
97
97
|
def metafield_type
|
|
98
|
-
Spree::Deprecation.warn(
|
|
98
|
+
Spree::Deprecation.warn(
|
|
99
|
+
'#metafield_type is deprecated and will be removed in Spree 6.3. ' \
|
|
100
|
+
'Use #field_type (which returns an API token) or #field_type_class_name instead.'
|
|
101
|
+
)
|
|
99
102
|
field_type_class_name
|
|
100
103
|
end
|
|
101
104
|
|
|
102
105
|
def metafield_type=(value)
|
|
103
|
-
Spree::Deprecation.warn('#metafield_type= is deprecated and will be removed in Spree 6.
|
|
106
|
+
Spree::Deprecation.warn('#metafield_type= is deprecated and will be removed in Spree 6.3. Use #field_type= instead.')
|
|
104
107
|
self.field_type = value
|
|
105
108
|
end
|
|
106
109
|
|
|
107
110
|
# The tri-state display_on collapsed into the storefront_visible boolean;
|
|
108
111
|
# 'front_end' folds into visible since it never meant hidden-from-storefront.
|
|
109
112
|
def display_on
|
|
110
|
-
Spree::Deprecation.warn('#display_on is deprecated and will be removed in Spree 6.
|
|
113
|
+
Spree::Deprecation.warn('#display_on is deprecated and will be removed in Spree 6.3. Use #storefront_visible instead.')
|
|
111
114
|
storefront_visible? ? 'both' : 'back_end'
|
|
112
115
|
end
|
|
113
116
|
|
|
114
117
|
def display_on=(value)
|
|
115
|
-
Spree::Deprecation.warn('#display_on= is deprecated and will be removed in Spree 6.
|
|
118
|
+
Spree::Deprecation.warn('#display_on= is deprecated and will be removed in Spree 6.3. Use #storefront_visible= instead.')
|
|
116
119
|
self.storefront_visible = value.to_s != 'back_end'
|
|
117
120
|
end
|
|
118
121
|
|
|
@@ -25,9 +25,9 @@ module Spree
|
|
|
25
25
|
# Dispatch strategy used when +fulfillment_provider+ is blank.
|
|
26
26
|
DEFAULT_FULFILLMENT_PROVIDER = 'Spree::FulfillmentProvider::Manual'.freeze
|
|
27
27
|
|
|
28
|
-
# @deprecated Use {STOREFRONT}/{BACKOFFICE}; removed in 6.
|
|
28
|
+
# @deprecated Use {STOREFRONT}/{BACKOFFICE}; removed in 6.3.
|
|
29
29
|
DISPLAY_ON_FRONT_END = 1
|
|
30
|
-
# @deprecated Use {STOREFRONT}/{BACKOFFICE}; removed in 6.
|
|
30
|
+
# @deprecated Use {STOREFRONT}/{BACKOFFICE}; removed in 6.3.
|
|
31
31
|
DISPLAY_ON_BACK_END = 2
|
|
32
32
|
|
|
33
33
|
default_scope { where(deleted_at: nil) }
|
|
@@ -114,7 +114,7 @@ module Spree
|
|
|
114
114
|
seller.nil? ? first_party : where(seller_id: seller.id).or(shared_with_sellers)
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
# Legacy association names — removed in 6.
|
|
117
|
+
# Legacy association names — removed in 6.3.
|
|
118
118
|
has_many :shipping_rates, class_name: 'Spree::DeliveryRate', foreign_key: :delivery_method_id, deprecated: true
|
|
119
119
|
has_many :shipments, through: :delivery_rates, source: :fulfillment, deprecated: true
|
|
120
120
|
|
|
@@ -400,7 +400,7 @@ module Spree
|
|
|
400
400
|
# rates — a typo must not narrow the offer set unnoticed.
|
|
401
401
|
#
|
|
402
402
|
# @param audience [Symbol, Integer] {STOREFRONT} or {BACKOFFICE}; the
|
|
403
|
-
# legacy DISPLAY_ON_* integers are accepted until 6.
|
|
403
|
+
# legacy DISPLAY_ON_* integers are accepted until 6.3
|
|
404
404
|
# @return [Boolean]
|
|
405
405
|
def available_to?(audience)
|
|
406
406
|
case self.class.normalize_audience(audience)
|
|
@@ -411,7 +411,7 @@ module Spree
|
|
|
411
411
|
|
|
412
412
|
# Maps an audience onto {STOREFRONT}/{BACKOFFICE}, accepting the legacy
|
|
413
413
|
# DISPLAY_ON_* integers so callers holding the old constants keep working
|
|
414
|
-
# until 6.
|
|
414
|
+
# until 6.3. Anything else raises — a typo must not silently quote
|
|
415
415
|
# storefront-only rates.
|
|
416
416
|
#
|
|
417
417
|
# @param audience [Symbol, Integer]
|
|
@@ -420,7 +420,10 @@ module Spree
|
|
|
420
420
|
case audience
|
|
421
421
|
when STOREFRONT, BACKOFFICE then audience
|
|
422
422
|
when DISPLAY_ON_FRONT_END, DISPLAY_ON_BACK_END
|
|
423
|
-
Spree::Deprecation.warn(
|
|
423
|
+
Spree::Deprecation.warn(
|
|
424
|
+
'Spree::DeliveryMethod::DISPLAY_ON_* audience filters are deprecated and will be removed in Spree 6.3. ' \
|
|
425
|
+
"Use #{STOREFRONT.inspect} / #{BACKOFFICE.inspect} instead."
|
|
426
|
+
)
|
|
424
427
|
audience == DISPLAY_ON_BACK_END ? BACKOFFICE : STOREFRONT
|
|
425
428
|
else
|
|
426
429
|
raise ArgumentError, "unknown delivery audience #{audience.inspect} (expected #{STOREFRONT.inspect} or #{BACKOFFICE.inspect})"
|
|
@@ -428,9 +431,12 @@ module Spree
|
|
|
428
431
|
end
|
|
429
432
|
|
|
430
433
|
# @deprecated Use {#available_to?} with {STOREFRONT}/{BACKOFFICE};
|
|
431
|
-
# removed in 6.
|
|
434
|
+
# removed in 6.3.
|
|
432
435
|
def available_to_display?(display_filter)
|
|
433
|
-
Spree::Deprecation.warn(
|
|
436
|
+
Spree::Deprecation.warn(
|
|
437
|
+
'Spree::DeliveryMethod#available_to_display? is deprecated and will be removed in Spree 6.3. ' \
|
|
438
|
+
'Use #available_to?(Spree::DeliveryMethod::STOREFRONT / BACKOFFICE) instead.'
|
|
439
|
+
)
|
|
434
440
|
available_to?(display_filter)
|
|
435
441
|
end
|
|
436
442
|
|
|
@@ -440,7 +446,7 @@ module Spree
|
|
|
440
446
|
if estimated_transit_business_days_min == estimated_transit_business_days_max
|
|
441
447
|
estimated_transit_business_days_min.to_s
|
|
442
448
|
else
|
|
443
|
-
[estimated_transit_business_days_min, estimated_transit_business_days_max].compact.join(
|
|
449
|
+
[estimated_transit_business_days_min, estimated_transit_business_days_max].compact.join('-')
|
|
444
450
|
end
|
|
445
451
|
end
|
|
446
452
|
|
|
@@ -476,15 +482,15 @@ module Spree
|
|
|
476
482
|
provider_class.digital?
|
|
477
483
|
end
|
|
478
484
|
|
|
479
|
-
# @deprecated Use {#storefront_visible}; removed in 6.
|
|
485
|
+
# @deprecated Use {#storefront_visible}; removed in 6.3.
|
|
480
486
|
def display_on
|
|
481
|
-
Spree::Deprecation.warn('Spree::DeliveryMethod#display_on is deprecated and will be removed in Spree 6.
|
|
487
|
+
Spree::Deprecation.warn('Spree::DeliveryMethod#display_on is deprecated and will be removed in Spree 6.3. Use #storefront_visible instead.')
|
|
482
488
|
storefront_visible? ? 'both' : 'back_end'
|
|
483
489
|
end
|
|
484
490
|
|
|
485
|
-
# @deprecated Use {#storefront_visible=}; removed in 6.
|
|
491
|
+
# @deprecated Use {#storefront_visible=}; removed in 6.3.
|
|
486
492
|
def display_on=(value)
|
|
487
|
-
Spree::Deprecation.warn('Spree::DeliveryMethod#display_on= is deprecated and will be removed in Spree 6.
|
|
493
|
+
Spree::Deprecation.warn('Spree::DeliveryMethod#display_on= is deprecated and will be removed in Spree 6.3. Use #storefront_visible= instead.')
|
|
488
494
|
self.storefront_visible = value.to_s != 'back_end'
|
|
489
495
|
end
|
|
490
496
|
|
|
@@ -546,7 +552,7 @@ module Spree
|
|
|
546
552
|
:fulfillment_provider, :profile_does_not_accept_provider,
|
|
547
553
|
provider: provider_class.provider_name, profile: delivery_profile.name,
|
|
548
554
|
message: I18n.t('spree.errors.messages.profile_does_not_accept_provider',
|
|
549
|
-
|
|
555
|
+
provider: provider_class.provider_name, profile: delivery_profile.name)
|
|
550
556
|
)
|
|
551
557
|
end
|
|
552
558
|
|
|
@@ -560,7 +566,7 @@ module Spree
|
|
|
560
566
|
:rate_provider, :rate_provider_requires_shipping,
|
|
561
567
|
provider: rate_provider_class.provider_name,
|
|
562
568
|
message: I18n.t('spree.errors.messages.rate_provider_requires_shipping',
|
|
563
|
-
|
|
569
|
+
provider: rate_provider_class.provider_name)
|
|
564
570
|
)
|
|
565
571
|
end
|
|
566
572
|
|
|
@@ -10,7 +10,7 @@ module Spree
|
|
|
10
10
|
belongs_to :fulfillment, class_name: 'Spree::Fulfillment'
|
|
11
11
|
belongs_to :tax_rate, -> { with_deleted }, class_name: 'Spree::TaxRate', optional: true
|
|
12
12
|
belongs_to :delivery_method, -> { with_deleted }, class_name: 'Spree::DeliveryMethod', inverse_of: :delivery_rates
|
|
13
|
-
# Legacy names — removed in 6.
|
|
13
|
+
# Legacy names — removed in 6.3.
|
|
14
14
|
belongs_to :shipment, class_name: 'Spree::Fulfillment', foreign_key: :fulfillment_id, optional: true, deprecated: true
|
|
15
15
|
belongs_to :shipping_method, -> { with_deleted }, class_name: 'Spree::DeliveryMethod', foreign_key: :delivery_method_id, optional: true, deprecated: true
|
|
16
16
|
alias_attribute :shipment_id, :fulfillment_id
|
data/app/models/spree/digital.rb
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
module Spree
|
|
4
4
|
# Deprecation alias for Spree::DigitalAsset, renamed from Spree::Digital in
|
|
5
|
-
# 6.0. Retained
|
|
5
|
+
# 6.0. Retained until 6.3.
|
|
6
6
|
#
|
|
7
7
|
# A plain constant alias rather than a DeprecatedConstantProxy: the proxy
|
|
8
8
|
# would name the calling site, but it fails `is_a?`/`===` checks, so legacy
|
|
@@ -141,8 +141,8 @@ module Spree
|
|
|
141
141
|
provider_type.blank? || Spree.digital_asset_providers.map(&:to_s).include?(provider_type)
|
|
142
142
|
end
|
|
143
143
|
|
|
144
|
-
# The legacy digital.* events are dual-emitted
|
|
145
|
-
# (webhook contract bridge — removed in 6.
|
|
144
|
+
# The legacy digital.* events are dual-emitted until 6.5
|
|
145
|
+
# (webhook contract bridge — removed in 6.5).
|
|
146
146
|
def publish_create_event
|
|
147
147
|
publish_event('digital.created')
|
|
148
148
|
super
|
|
@@ -25,15 +25,15 @@ module Spree
|
|
|
25
25
|
delegate :store, to: :line_item
|
|
26
26
|
delegate :order, to: :line_item
|
|
27
27
|
|
|
28
|
-
# @deprecated Use {#digital_asset}; removed in 6.
|
|
28
|
+
# @deprecated Use {#digital_asset}; removed in 6.3.
|
|
29
29
|
def digital
|
|
30
|
-
Spree::Deprecation.warn('Spree::DigitalLink#digital is deprecated and will be removed in Spree 6.
|
|
30
|
+
Spree::Deprecation.warn('Spree::DigitalLink#digital is deprecated and will be removed in Spree 6.3. Use #digital_asset instead.')
|
|
31
31
|
digital_asset
|
|
32
32
|
end
|
|
33
33
|
|
|
34
|
-
# @deprecated Use {#digital_asset=}; removed in 6.
|
|
34
|
+
# @deprecated Use {#digital_asset=}; removed in 6.3.
|
|
35
35
|
def digital=(value)
|
|
36
|
-
Spree::Deprecation.warn('Spree::DigitalLink#digital= is deprecated and will be removed in Spree 6.
|
|
36
|
+
Spree::Deprecation.warn('Spree::DigitalLink#digital= is deprecated and will be removed in Spree 6.3. Use #digital_asset= instead.')
|
|
37
37
|
self.digital_asset = value
|
|
38
38
|
end
|
|
39
39
|
|
data/app/models/spree/export.rb
CHANGED
|
@@ -117,9 +117,12 @@ module Spree
|
|
|
117
117
|
# read the current one — the product search's custom-field arm, address
|
|
118
118
|
# validation — would otherwise answer for the default store rather than
|
|
119
119
|
# the one whose records are being exported.
|
|
120
|
+
@filter_locale = I18n.locale
|
|
120
121
|
Spree::Current.set(store: store) do
|
|
121
|
-
|
|
122
|
-
|
|
122
|
+
in_store_locale do
|
|
123
|
+
send(:"generate_#{format}")
|
|
124
|
+
handle_attachment
|
|
125
|
+
end
|
|
123
126
|
end
|
|
124
127
|
|
|
125
128
|
send_export_done_email
|
|
@@ -205,6 +208,10 @@ module Spree
|
|
|
205
208
|
end
|
|
206
209
|
|
|
207
210
|
def records_to_export
|
|
211
|
+
in_filter_locale { filtered_records }
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
def filtered_records
|
|
208
215
|
return scope.ransack.result if search_params.blank?
|
|
209
216
|
|
|
210
217
|
params = decoded_search_params
|
|
@@ -369,6 +376,26 @@ module Spree
|
|
|
369
376
|
|
|
370
377
|
private
|
|
371
378
|
|
|
379
|
+
# Runs the block reading translated columns the way a request for this
|
|
380
|
+
# store's own language does. The job otherwise runs in the locale of
|
|
381
|
+
# whatever enqueued it, with the application's default locale standing in
|
|
382
|
+
# for the one the base columns are written in, and a store written in
|
|
383
|
+
# another language exports blank names and descriptions.
|
|
384
|
+
def in_store_locale(&block)
|
|
385
|
+
locale = store.default_market&.default_locale
|
|
386
|
+
return yield if locale.blank?
|
|
387
|
+
|
|
388
|
+
Spree::Current.with_content_locale(locale) { I18n.with_locale(locale, &block) }
|
|
389
|
+
end
|
|
390
|
+
|
|
391
|
+
# Builds the query in the locale the export was asked for in, which the job
|
|
392
|
+
# inherits from the request. A filter on a translated column was written
|
|
393
|
+
# against the list the admin was looking at, so it selects the same rows
|
|
394
|
+
# here; only their content is then read in the store's own language.
|
|
395
|
+
def in_filter_locale(&)
|
|
396
|
+
I18n.with_locale(@filter_locale || I18n.locale, &)
|
|
397
|
+
end
|
|
398
|
+
|
|
372
399
|
def seller_scope_must_be_available
|
|
373
400
|
return if model_class.respond_to?(:for_seller)
|
|
374
401
|
|