spree_core 6.0.4 → 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.
Files changed (178) hide show
  1. checksums.yaml +4 -4
  2. data/app/jobs/spree/imports/create_rows_job.rb +4 -2
  3. data/app/jobs/spree/imports/process_rows_job.rb +4 -2
  4. data/app/jobs/spree/products/auto_match_taxons_job.rb +5 -2
  5. data/app/jobs/spree/search_provider/index_job.rb +8 -0
  6. data/app/jobs/spree/search_provider/remove_job.rb +3 -0
  7. data/app/jobs/spree/stock_locations/stock_items/create_job.rb +5 -2
  8. data/app/mailers/spree/base_mailer.rb +1 -1
  9. data/app/models/concerns/spree/acted_by.rb +2 -2
  10. data/app/models/concerns/spree/customer_methods.rb +6 -4
  11. data/app/models/concerns/spree/deprecated_customer_alias.rb +11 -3
  12. data/app/models/concerns/spree/derived_number.rb +1 -1
  13. data/app/models/concerns/spree/has_custom_fields.rb +12 -10
  14. data/app/models/concerns/spree/integrations_concern.rb +5 -3
  15. data/app/models/concerns/spree/label_translatable.rb +4 -4
  16. data/app/models/concerns/spree/metadata.rb +3 -3
  17. data/app/models/concerns/spree/presentation_translatable.rb +1 -1
  18. data/app/models/concerns/spree/purchase/addresses.rb +8 -5
  19. data/app/models/concerns/spree/purchase/deprecated_aliases.rb +2 -2
  20. data/app/models/concerns/spree/stores/markets.rb +4 -2
  21. data/app/models/concerns/spree/user_address.rb +5 -2
  22. data/app/models/concerns/spree/user_methods.rb +2 -2
  23. data/app/models/spree/address.rb +29 -14
  24. data/app/models/spree/asset.rb +3 -3
  25. data/app/models/spree/base.rb +1 -1
  26. data/app/models/spree/calculator/shipping/flat_rate.rb +6 -4
  27. data/app/models/spree/cart.rb +2 -2
  28. data/app/models/spree/category.rb +8 -6
  29. data/app/models/spree/classification.rb +2 -2
  30. data/app/models/spree/current.rb +19 -0
  31. data/app/models/spree/custom_field.rb +6 -6
  32. data/app/models/spree/custom_field_definition.rb +10 -7
  33. data/app/models/spree/delivery_method.rb +21 -15
  34. data/app/models/spree/delivery_rate.rb +1 -1
  35. data/app/models/spree/digital.rb +1 -1
  36. data/app/models/spree/digital_asset.rb +2 -2
  37. data/app/models/spree/digital_link.rb +4 -4
  38. data/app/models/spree/export.rb +29 -2
  39. data/app/models/spree/fulfillment/custom_events.rb +18 -10
  40. data/app/models/spree/fulfillment.rb +30 -23
  41. data/app/models/spree/fulfillment_item.rb +3 -3
  42. data/app/models/spree/fulfilment_changer.rb +1 -1
  43. data/app/models/spree/gift_card.rb +12 -12
  44. data/app/models/spree/import.rb +23 -15
  45. data/app/models/spree/import_row.rb +6 -6
  46. data/app/models/spree/inventory_unit.rb +1 -1
  47. data/app/models/spree/invitation.rb +8 -4
  48. data/app/models/spree/line_item.rb +10 -8
  49. data/app/models/spree/media.rb +2 -2
  50. data/app/models/spree/metafield.rb +1 -1
  51. data/app/models/spree/metafield_definition.rb +1 -1
  52. data/app/models/spree/metafields.rb +2 -2
  53. data/app/models/spree/option_type.rb +26 -0
  54. data/app/models/spree/option_value.rb +3 -3
  55. data/app/models/spree/order.rb +87 -45
  56. data/app/models/spree/order_inventory.rb +2 -2
  57. data/app/models/spree/order_merger.rb +2 -2
  58. data/app/models/spree/order_updater.rb +34 -20
  59. data/app/models/spree/payment.rb +8 -8
  60. data/app/models/spree/payment_method.rb +11 -9
  61. data/app/models/spree/price.rb +19 -8
  62. data/app/models/spree/price_list.rb +12 -6
  63. data/app/models/spree/price_rules/zone_rule.rb +1 -1
  64. data/app/models/spree/product.rb +26 -24
  65. data/app/models/spree/product_category.rb +3 -3
  66. data/app/models/spree/promotion/rules/category.rb +27 -10
  67. data/app/models/spree/promotion/rules/country.rb +1 -1
  68. data/app/models/spree/promotion/rules/taxon.rb +4 -2
  69. data/app/models/spree/promotion/rules/user.rb +1 -1
  70. data/app/models/spree/promotion_action.rb +1 -1
  71. data/app/models/spree/promotion_rule_category.rb +5 -5
  72. data/app/models/spree/promotion_rule_taxon.rb +2 -2
  73. data/app/models/spree/prototype.rb +4 -1
  74. data/app/models/spree/return_authorization_reason.rb +3 -3
  75. data/app/models/spree/return_reason.rb +1 -1
  76. data/app/models/spree/search_provider/base.rb +2 -2
  77. data/app/models/spree/search_provider.rb +7 -5
  78. data/app/models/spree/shipment.rb +4 -1
  79. data/app/models/spree/shipping_method.rb +4 -1
  80. data/app/models/spree/shipping_rate.rb +1 -1
  81. data/app/models/spree/stock/coordinator.rb +2 -2
  82. data/app/models/spree/stock/estimator.rb +7 -5
  83. data/app/models/spree/stock/package.rb +10 -8
  84. data/app/models/spree/stock_item.rb +1 -1
  85. data/app/models/spree/stock_level/custom_events.rb +1 -1
  86. data/app/models/spree/stock_level.rb +1 -1
  87. data/app/models/spree/stock_location.rb +12 -8
  88. data/app/models/spree/stock_movement.rb +6 -6
  89. data/app/models/spree/stock_reservation.rb +5 -5
  90. data/app/models/spree/store.rb +42 -16
  91. data/app/models/spree/store_credit.rb +2 -2
  92. data/app/models/spree/store_credit_category.rb +5 -5
  93. data/app/models/spree/store_credit_type.rb +2 -2
  94. data/app/models/spree/subscriber.rb +7 -7
  95. data/app/models/spree/tax_rate.rb +5 -5
  96. data/app/models/spree/taxon.rb +3 -3
  97. data/app/models/spree/taxon_rule.rb +2 -2
  98. data/app/models/spree/taxonomy.rb +1 -1
  99. data/app/models/spree/variant.rb +12 -10
  100. data/app/models/spree/variant_media.rb +1 -1
  101. data/app/models/spree/wished_item.rb +1 -1
  102. data/app/models/spree/wishlist.rb +2 -2
  103. data/app/models/spree/wishlist_item/custom_events.rb +2 -2
  104. data/app/models/spree/zone.rb +1 -1
  105. data/app/models/spree/zone_member.rb +1 -1
  106. data/app/services/spree/carts/associate.rb +6 -2
  107. data/app/services/spree/carts/create.rb +1 -1
  108. data/app/services/spree/carts/destroy.rb +1 -1
  109. data/app/services/spree/carts/remove_item.rb +1 -1
  110. data/app/services/spree/carts/remove_line_item.rb +2 -2
  111. data/app/services/spree/carts/remove_out_of_stock_items.rb +3 -1
  112. data/app/services/spree/carts/set_quantity.rb +2 -2
  113. data/app/services/spree/carts/update.rb +17 -0
  114. data/app/services/spree/checkout/add_store_credit.rb +3 -3
  115. data/app/services/spree/checkout/remove_store_credit.rb +2 -2
  116. data/app/services/spree/imports/row_processors/product_variant.rb +19 -0
  117. data/app/services/spree/orders/approve.rb +3 -3
  118. data/app/services/spree/orders/create_user_account.rb +2 -2
  119. data/app/services/spree/products/auto_match_taxons.rb +5 -2
  120. data/app/services/spree/shipments/update.rb +2 -2
  121. data/app/services/spree/stock_locations/stock_items/create.rb +5 -2
  122. data/app/services/spree/stock_reservations/extend.rb +3 -1
  123. data/app/services/spree/stock_reservations/reserve.rb +3 -1
  124. data/app/services/spree/taxons/add_products.rb +4 -2
  125. data/app/services/spree/taxons/regenerate_products.rb +5 -2
  126. data/app/services/spree/taxons/remove_products.rb +4 -2
  127. data/app/workflows/spree/carts/add_item.rb +1 -1
  128. data/app/workflows/spree/carts/recalculate.rb +1 -1
  129. data/app/workflows/spree/fulfillments/update.rb +1 -1
  130. data/app/workflows/spree/orders/cancel.rb +3 -1
  131. data/app/workflows/spree/payments/capture.rb +2 -2
  132. data/app/workflows/spree/seller_transfers/create.rb +1 -1
  133. data/config/locales/en.yml +4 -0
  134. data/db/migrate/20260710000001_rename_taxons_to_categories.rb +1 -1
  135. data/db/migrate/20260728000004_rename_shipping_to_fulfillment_and_delivery.rb +1 -1
  136. data/db/migrate/20260806000001_add_store_id_to_spree_tax_rates_and_categories.rb +1 -1
  137. data/db/migrate/20260807130001_add_country_state_codes_to_consumers.rb +1 -1
  138. data/db/migrate/20260809000001_rename_metafields_to_custom_fields.rb +1 -1
  139. data/db/migrate/20260809150001_promote_shipping_categories_to_delivery_profiles.rb +1 -1
  140. data/db/migrate/20260811000001_add_delivery_tracking_to_fulfillments.rb +1 -1
  141. data/db/migrate/20260824000001_add_store_to_spree_media.rb +1 -1
  142. data/db/migrate/20260828100001_unify_import_and_export_tenancy.rb +1 -1
  143. data/db/migrate/20261016000001_remove_default_from_spree_tax_rates_included_in_price.rb +1 -1
  144. data/lib/spree/agent_tools/default_catalog.rb +2 -2
  145. data/lib/spree/agent_tools/legacy_tools.rb +1 -1
  146. data/lib/spree/core/dependencies.rb +10 -10
  147. data/lib/spree/core/engine.rb +4 -0
  148. data/lib/spree/core/number_generator.rb +4 -3
  149. data/lib/spree/core/preferences/preferable.rb +1 -1
  150. data/lib/spree/core/preferences/preferable_class_methods.rb +5 -1
  151. data/lib/spree/core/pricing/resolver.rb +2 -2
  152. data/lib/spree/core/version.rb +1 -1
  153. data/lib/spree/core.rb +37 -10
  154. data/lib/spree/i18n.rb +6 -2
  155. data/lib/spree/localized_number.rb +1 -1
  156. data/lib/spree/removed_apis.rb +274 -0
  157. data/lib/spree/reporting/default_vocabulary.rb +1 -1
  158. data/lib/spree/testing_support/factories/digital_asset_factory.rb +1 -1
  159. data/lib/spree/testing_support/factories/stock_level_factory.rb +1 -1
  160. data/lib/spree/testing_support/factories/taxon_factory.rb +1 -1
  161. data/lib/spree/testing_support/factories/taxonomy_factory.rb +1 -1
  162. data/lib/spree/testing_support/factories/wishlist_item_factory.rb +1 -1
  163. data/lib/spree/testing_support/i18n.rb +7 -2
  164. data/lib/spree/testing_support/order_walkthrough.rb +5 -2
  165. data/lib/spree/upgrades/5_6_to_6_0/manifest.yml +14 -14
  166. data/lib/tasks/carts_migration.rake +1 -1
  167. data/lib/tasks/categories_and_collections.rake +1 -1
  168. data/lib/tasks/deliveries_migration.rake +1 -1
  169. data/lib/tasks/delivery_method_rules_migration.rake +1 -1
  170. data/lib/tasks/delivery_migration.rake +1 -1
  171. data/lib/tasks/delivery_profiles_migration.rake +2 -2
  172. data/lib/tasks/fold_store_credit_categories.rake +1 -1
  173. data/lib/tasks/migrate_country_state_codes.rake +1 -1
  174. data/lib/tasks/migrate_returns.rake +4 -4
  175. data/lib/tasks/migrate_rich_text_to_columns.rake +1 -1
  176. data/lib/tasks/store_settings.rake +1 -1
  177. data/lib/tasks/typed_stock_movements_migration.rake +1 -1
  178. metadata +7 -6
@@ -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.1
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.1.
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
@@ -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 for one release. Rule-based
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.1 with Spree::Taxonomy.
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.1.
47
+ # @deprecated Use #product_categories; removed in 6.3.
48
48
  def classifications
49
- Spree::Deprecation.warn('Spree::Category#classifications is deprecated and will be removed in Spree 6.1. Use Spree::Category#product_categories instead.')
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.1. Nothing creates an automatic category any more, so the model
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.1 with Spree::Taxonomy.
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.1.
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.1. Use Spree::ProductCategory instead.')
9
+ Spree::Deprecation.warn('Spree::Classification is deprecated and will be removed in Spree 6.3. Use Spree::ProductCategory instead.')
10
10
  end
@@ -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.1
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.1. Use #custom_field_definition instead.')
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.1. Use #custom_field_definition_id instead.')
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.1. Use #custom_field_definition_id= instead.')
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.1. Use #custom_field_definition= instead.')
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.1. Use #label instead.')
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.1
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.1. Use #label instead.')
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.1. Use #label= instead.')
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('#metafield_type is deprecated and will be removed in Spree 6.1. Use #field_type (which returns an API token) or #field_type_class_name instead.')
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.1. Use #field_type= instead.')
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.1. Use #storefront_visible instead.')
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.1. Use #storefront_visible= instead.')
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.1.
28
+ # @deprecated Use {STOREFRONT}/{BACKOFFICE}; removed in 6.3.
29
29
  DISPLAY_ON_FRONT_END = 1
30
- # @deprecated Use {STOREFRONT}/{BACKOFFICE}; removed in 6.1.
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.1.
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.1
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.1. Anything else raises — a typo must not silently quote
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("Spree::DeliveryMethod::DISPLAY_ON_* audience filters are deprecated and will be removed in Spree 6.1. Use #{STOREFRONT.inspect} / #{BACKOFFICE.inspect} instead.")
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.1.
434
+ # removed in 6.3.
432
435
  def available_to_display?(display_filter)
433
- Spree::Deprecation.warn('Spree::DeliveryMethod#available_to_display? is deprecated and will be removed in Spree 6.1. Use #available_to?(Spree::DeliveryMethod::STOREFRONT / BACKOFFICE) instead.')
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.1.
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.1. Use #storefront_visible instead.')
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.1.
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.1. Use #storefront_visible= instead.')
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
- provider: provider_class.provider_name, profile: delivery_profile.name)
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
- provider: rate_provider_class.provider_name)
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.1.
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
@@ -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 for one release; removed in 6.1.
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 for one release
145
- # (webhook contract bridge — removed in 6.1).
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.1.
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.1. Use #digital_asset instead.')
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.1.
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.1. Use #digital_asset= instead.')
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
 
@@ -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
- send(:"generate_#{format}")
122
- handle_attachment
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
 
@@ -12,7 +12,7 @@ module Spree
12
12
  # - fulfillment.canceled: Fulfillment was canceled
13
13
  #
14
14
  # The legacy shipment.* / order.shipped events are dual-emitted for one
15
- # release (webhook contract bridge — removed in 6.1).
15
+ # release (webhook contract bridge — removed in 6.5).
16
16
  #
17
17
  # NOTE: These methods are called from the Spree::Fulfillments workflows,
18
18
  # never from ActiveRecord callbacks — publishing is part of the transition
@@ -20,9 +20,11 @@ module Spree
20
20
  module CustomEvents
21
21
  extend ActiveSupport::Concern
22
22
 
23
- # @deprecated `ready` is not a status since 6.0; removed in 6.1.
23
+ # @deprecated `ready` is not a status since 6.0; removed in 6.3.
24
24
  def publish_fulfillment_ready_event
25
- Spree::Deprecation.warn('Spree::Fulfillment#publish_fulfillment_ready_event is deprecated and will be removed in Spree 6.1. The ready status no longer exists.')
25
+ Spree::Deprecation.warn(
26
+ 'Spree::Fulfillment#publish_fulfillment_ready_event is deprecated and will be removed in Spree 6.3. The ready status no longer exists.'
27
+ )
26
28
  nil
27
29
  end
28
30
 
@@ -45,7 +47,7 @@ module Spree
45
47
  metadata = { notify_customer: notify_customer? }
46
48
 
47
49
  publish_event('fulfillment.fulfilled', nil, metadata)
48
- # Legacy name — removed in 6.1
50
+ # Legacy name — removed in 6.5
49
51
  publish_event('shipment.shipped', nil, metadata)
50
52
 
51
53
  # Force reload of fulfillments association to see the new status
@@ -68,19 +70,25 @@ module Spree
68
70
  return unless Spree::Events.enabled?
69
71
 
70
72
  publish_event('fulfillment.canceled')
71
- # Legacy name — removed in 6.1
73
+ # Legacy name — removed in 6.5
72
74
  publish_event('shipment.canceled')
73
75
  end
74
76
 
75
- # @deprecated Use {#publish_fulfillment_fulfilled_event}; removed in 6.1.
77
+ # @deprecated Use {#publish_fulfillment_fulfilled_event}; removed in 6.3.
76
78
  def publish_shipment_shipped_event
77
- Spree::Deprecation.warn('Spree::Fulfillment#publish_shipment_shipped_event is deprecated and will be removed in Spree 6.1. Use #publish_fulfillment_fulfilled_event instead.')
79
+ Spree::Deprecation.warn(
80
+ 'Spree::Fulfillment#publish_shipment_shipped_event is deprecated and will be removed in Spree 6.3. ' \
81
+ 'Use #publish_fulfillment_fulfilled_event instead.'
82
+ )
78
83
  publish_fulfillment_fulfilled_event
79
84
  end
80
85
 
81
- # @deprecated Use {#publish_fulfillment_canceled_event}; removed in 6.1.
86
+ # @deprecated Use {#publish_fulfillment_canceled_event}; removed in 6.3.
82
87
  def publish_shipment_canceled_event
83
- Spree::Deprecation.warn('Spree::Fulfillment#publish_shipment_canceled_event is deprecated and will be removed in Spree 6.1. Use #publish_fulfillment_canceled_event instead.')
88
+ Spree::Deprecation.warn(
89
+ 'Spree::Fulfillment#publish_shipment_canceled_event is deprecated and will be removed in Spree 6.3. ' \
90
+ 'Use #publish_fulfillment_canceled_event instead.'
91
+ )
84
92
  publish_fulfillment_canceled_event
85
93
  end
86
94
 
@@ -88,7 +96,7 @@ module Spree
88
96
 
89
97
  def publish_order_fulfilled_event
90
98
  order.publish_event('order.fulfilled')
91
- # Legacy name — removed in 6.1
99
+ # Legacy name — removed in 6.5
92
100
  order.publish_event('order.shipped')
93
101
  end
94
102
  end
@@ -68,7 +68,7 @@ module Spree
68
68
  # unfulfilled/fulfilled/delivered/canceled scopes + predicates come from
69
69
  # has_status below. These are the ones it cannot generate.
70
70
  #
71
- # @deprecated legacy names — removed in 6.1
71
+ # @deprecated legacy names — removed in 6.3
72
72
  scope :shipped, -> { fulfilled }
73
73
  scope :pending, -> { unfulfilled }
74
74
  scope :ready, -> { unfulfilled }
@@ -151,22 +151,22 @@ module Spree
151
151
  include Spree::HasStatus
152
152
  has_status :unfulfilled, :fulfilled, :delivered, :canceled, default: :unfulfilled
153
153
 
154
- # @deprecated Use {Spree::Fulfillments::Fulfill}; removed in 6.1.
154
+ # @deprecated Use {Spree::Fulfillments::Fulfill}; removed in 6.3.
155
155
  def ship(*args)
156
- Spree::Deprecation.warn('Spree::Fulfillment#ship is deprecated and will be removed in Spree 6.1. Use Spree::Fulfillments::Fulfill instead.')
156
+ Spree::Deprecation.warn('Spree::Fulfillment#ship is deprecated and will be removed in Spree 6.3. Use Spree::Fulfillments::Fulfill instead.')
157
157
  Spree.fulfillment_fulfill_workflow.call(fulfillment: self, **args.first.to_h)
158
158
  end
159
159
  alias ship! ship
160
160
 
161
- # @deprecated Use {#can_fulfill?}; removed in 6.1.
161
+ # @deprecated Use {#can_fulfill?}; removed in 6.3.
162
162
  def can_ship?
163
- Spree::Deprecation.warn('Spree::Fulfillment#can_ship? is deprecated and will be removed in Spree 6.1. Use #can_fulfill? instead.')
163
+ Spree::Deprecation.warn('Spree::Fulfillment#can_ship? is deprecated and will be removed in Spree 6.3. Use #can_fulfill? instead.')
164
164
  can_fulfill?
165
165
  end
166
166
 
167
- # @deprecated Use {#fulfilled?}; removed in 6.1.
167
+ # @deprecated Use {#fulfilled?}; removed in 6.3.
168
168
  def shipped?
169
- Spree::Deprecation.warn('Spree::Fulfillment#shipped? is deprecated and will be removed in Spree 6.1. Use #fulfilled? instead.')
169
+ Spree::Deprecation.warn('Spree::Fulfillment#shipped? is deprecated and will be removed in Spree 6.3. Use #fulfilled? instead.')
170
170
  fulfilled?
171
171
  end
172
172
 
@@ -209,7 +209,7 @@ module Spree
209
209
  # @deprecated the column is +status+ since 6.0
210
210
  alias_attribute :state, :status
211
211
  alias_attribute :shipped_at, :fulfilled_at
212
- # Legacy association names — removed in 6.1.
212
+ # Legacy association names — removed in 6.3.
213
213
  has_many :inventory_units, class_name: 'Spree::FulfillmentItem', foreign_key: :fulfillment_id, inverse_of: :fulfillment, deprecated: true
214
214
  has_many :shipping_rates, -> { order(:cost) }, class_name: 'Spree::DeliveryRate', foreign_key: :fulfillment_id, deprecated: true
215
215
  has_one :selected_shipping_rate, -> { where(selected: true).order(:cost) }, class_name: 'Spree::DeliveryRate', foreign_key: :fulfillment_id, deprecated: true
@@ -271,9 +271,9 @@ module Spree
271
271
  delivery_method&.digital? || false
272
272
  end
273
273
 
274
- # @deprecated Use {#delivery_method}; removed in 6.1.
274
+ # @deprecated Use {#delivery_method}; removed in 6.3.
275
275
  def shipping_method
276
- Spree::Deprecation.warn('Spree::Fulfillment#shipping_method is deprecated and will be removed in Spree 6.1. Use #delivery_method instead.')
276
+ Spree::Deprecation.warn('Spree::Fulfillment#shipping_method is deprecated and will be removed in Spree 6.3. Use #delivery_method instead.')
277
277
  delivery_method
278
278
  end
279
279
 
@@ -281,18 +281,22 @@ module Spree
281
281
  delivery_rates.create(delivery_method: delivery_method, selected: selected, cost: cost)
282
282
  end
283
283
 
284
- # @deprecated Use {#add_delivery_method}; removed in 6.1.
284
+ # @deprecated Use {#add_delivery_method}; removed in 6.3.
285
285
  def add_shipping_method(delivery_method, selected = false)
286
- Spree::Deprecation.warn('Spree::Fulfillment#add_shipping_method is deprecated and will be removed in Spree 6.1. Use #add_delivery_method instead.')
286
+ Spree::Deprecation.warn(
287
+ 'Spree::Fulfillment#add_shipping_method is deprecated and will be removed in Spree 6.3. Use #add_delivery_method instead.'
288
+ )
287
289
  add_delivery_method(delivery_method, selected)
288
290
  end
289
291
 
290
- # @deprecated Cancel through {Spree::Fulfillments::Cancel}; removed in 6.1.
292
+ # @deprecated Cancel through {Spree::Fulfillments::Cancel}; removed in 6.3.
291
293
  # Restocking and the provider call are workflow steps now, so this no
292
294
  # longer runs as a transition callback. Kept only so a host app that
293
- # called it directly keeps working for one release.
295
+ # called it directly keeps working until 6.3.
294
296
  def after_cancel
295
- Spree::Deprecation.warn('Spree::Fulfillment#after_cancel is deprecated and will be removed in Spree 6.1. Cancel through Spree::Fulfillments::Cancel instead.')
297
+ Spree::Deprecation.warn(
298
+ 'Spree::Fulfillment#after_cancel is deprecated and will be removed in Spree 6.3. Cancel through Spree::Fulfillments::Cancel instead.'
299
+ )
296
300
  manifest.each { |item| manifest_restock(item) }
297
301
  provider.cancel_fulfillment(self)
298
302
  end
@@ -538,23 +542,23 @@ module Spree
538
542
  end
539
543
  end
540
544
 
541
- # @deprecated Use {#unfulfilled?}; removed in 6.1.
545
+ # @deprecated Use {#unfulfilled?}; removed in 6.3.
542
546
  def ready_or_pending?
543
547
  unfulfilled?
544
548
  end
545
549
 
546
- # @deprecated Use {#unfulfilled?}; removed in 6.1.
550
+ # @deprecated Use {#unfulfilled?}; removed in 6.3.
547
551
  def pending?
548
552
  unfulfilled?
549
553
  end
550
554
 
551
- # @deprecated Use {#unfulfilled?}; removed in 6.1.
555
+ # @deprecated Use {#unfulfilled?}; removed in 6.3.
552
556
  def ready?
553
557
  unfulfilled?
554
558
  end
555
559
 
556
560
  # @deprecated `ready_for_pickup` is not a status since 6.0 — for pickup
557
- # fulfillments `fulfilled` means "waiting at the counter". Removed in 6.1.
561
+ # fulfillments `fulfilled` means "waiting at the counter". Removed in 6.3.
558
562
  def ready_for_pickup?
559
563
  fulfilled? && provider.class.pickup?
560
564
  end
@@ -733,11 +737,11 @@ module Spree
733
737
  end
734
738
 
735
739
  # @deprecated Assigning tracking writes a delivery on save; removed in
736
- # 6.1. Use Spree::Deliveries::Create or the +tracking:+ keyword on
740
+ # 6.3. Use Spree::Deliveries::Create or the +tracking:+ keyword on
737
741
  # Spree::Fulfillments::Fulfill / Update instead.
738
742
  def tracking=(value)
739
743
  Spree::Deprecation.warn(
740
- 'Spree::Fulfillment#tracking= is deprecated and will be removed in Spree 6.1. ' \
744
+ 'Spree::Fulfillment#tracking= is deprecated and will be removed in Spree 6.3. ' \
741
745
  'Tracking is a Spree::Delivery — use Spree::Deliveries::Create or the tracking: keyword ' \
742
746
  'on Spree::Fulfillments::Fulfill / Update.'
743
747
  )
@@ -785,7 +789,7 @@ module Spree
785
789
  self.cost = choice&.cost || 0
786
790
  end
787
791
 
788
- # @deprecated No-op since 6.0; removed in 6.1.
792
+ # @deprecated No-op since 6.0; removed in 6.3.
789
793
  #
790
794
  # This re-derived the status from the order's payment state on every order
791
795
  # recalculation, which is what made a fulfillment move backwards when a
@@ -797,7 +801,10 @@ module Spree
797
801
  # rely on to write the status.
798
802
  return super unless args.one? && (args.first.is_a?(Spree::Order) || args.first.is_a?(Spree::Cart))
799
803
 
800
- Spree::Deprecation.warn('Spree::Fulfillment#update!(order) is a no-op since Spree 6.0 and will be removed in 6.1. Fulfillment statuses change through Spree::Fulfillments workflows.')
804
+ Spree::Deprecation.warn(
805
+ 'Spree::Fulfillment#update!(order) is a no-op since Spree 6.0 and will be removed in 6.3. ' \
806
+ 'Fulfillment statuses change through Spree::Fulfillments workflows.'
807
+ )
801
808
  true
802
809
  end
803
810
 
@@ -24,7 +24,7 @@ module Spree
24
24
  backordered.order('spree_orders.completed_at ASC')
25
25
  end
26
26
 
27
- # Legacy names — removed in 6.1.
27
+ # Legacy names — removed in 6.3.
28
28
  belongs_to :shipment, class_name: 'Spree::Fulfillment', foreign_key: :fulfillment_id, optional: true, touch: true, deprecated: true
29
29
  alias_attribute :shipment_id, :fulfillment_id
30
30
  # @deprecated the column is +status+ since 6.0
@@ -69,11 +69,11 @@ module Spree
69
69
  end
70
70
  alias fill_backorder fill_backorder!
71
71
 
72
- # @deprecated Write the status — removed in 6.1. `return` was a state
72
+ # @deprecated Write the status — removed in 6.3. `return` was a state
73
73
  # machine event name and could never be called as written (it parses as
74
74
  # the keyword), so this exists only for `send(:return!)`-style callers.
75
75
  def return!
76
- Spree::Deprecation.warn('Spree::FulfillmentItem#return! is deprecated and will be removed in Spree 6.1. Write the status instead.')
76
+ Spree::Deprecation.warn('Spree::FulfillmentItem#return! is deprecated and will be removed in Spree 6.3. Write the status instead.')
77
77
  return false unless shipped?
78
78
 
79
79
  update!(status: 'returned')