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.
Files changed (221) 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/payments/handle_webhook_job.rb +12 -1
  5. data/app/jobs/spree/products/auto_match_taxons_job.rb +5 -2
  6. data/app/jobs/spree/search_provider/index_job.rb +8 -0
  7. data/app/jobs/spree/search_provider/remove_job.rb +3 -0
  8. data/app/jobs/spree/stock_locations/stock_items/create_job.rb +5 -2
  9. data/app/mailers/spree/base_mailer.rb +1 -1
  10. data/app/models/concerns/spree/acted_by.rb +2 -2
  11. data/app/models/concerns/spree/customer_methods.rb +6 -4
  12. data/app/models/concerns/spree/deprecated_customer_alias.rb +11 -3
  13. data/app/models/concerns/spree/derived_number.rb +1 -1
  14. data/app/models/concerns/spree/has_custom_fields.rb +16 -11
  15. data/app/models/concerns/spree/integrations_concern.rb +5 -3
  16. data/app/models/concerns/spree/label_translatable.rb +4 -4
  17. data/app/models/concerns/spree/metadata.rb +3 -3
  18. data/app/models/concerns/spree/personal_data_matching.rb +5 -1
  19. data/app/models/concerns/spree/presentation_translatable.rb +1 -1
  20. data/app/models/concerns/spree/product_scopes.rb +2 -2
  21. data/app/models/concerns/spree/publishable.rb +26 -3
  22. data/app/models/concerns/spree/purchase/addresses.rb +8 -5
  23. data/app/models/concerns/spree/purchase/deprecated_aliases.rb +2 -2
  24. data/app/models/concerns/spree/stores/markets.rb +4 -2
  25. data/app/models/concerns/spree/user_address.rb +5 -2
  26. data/app/models/concerns/spree/user_methods.rb +2 -2
  27. data/app/models/spree/address.rb +29 -14
  28. data/app/models/spree/asset.rb +3 -3
  29. data/app/models/spree/authentication/strategies/base_strategy.rb +10 -1
  30. data/app/models/spree/base.rb +1 -1
  31. data/app/models/spree/calculator/shipping/flat_rate.rb +6 -4
  32. data/app/models/spree/cart.rb +9 -4
  33. data/app/models/spree/category.rb +8 -6
  34. data/app/models/spree/classification.rb +2 -2
  35. data/app/models/spree/current.rb +19 -0
  36. data/app/models/spree/custom_field.rb +6 -6
  37. data/app/models/spree/custom_field_definition.rb +10 -7
  38. data/app/models/spree/delivery_method.rb +21 -15
  39. data/app/models/spree/delivery_rate.rb +1 -1
  40. data/app/models/spree/digital.rb +1 -1
  41. data/app/models/spree/digital_asset.rb +2 -2
  42. data/app/models/spree/digital_link.rb +4 -4
  43. data/app/models/spree/export.rb +29 -2
  44. data/app/models/spree/fulfillment/custom_events.rb +18 -10
  45. data/app/models/spree/fulfillment.rb +30 -23
  46. data/app/models/spree/fulfillment_item.rb +3 -3
  47. data/app/models/spree/fulfilment_changer.rb +1 -1
  48. data/app/models/spree/gift_card.rb +12 -12
  49. data/app/models/spree/import.rb +23 -15
  50. data/app/models/spree/import_row.rb +6 -6
  51. data/app/models/spree/inventory_unit.rb +1 -1
  52. data/app/models/spree/invitation.rb +14 -6
  53. data/app/models/spree/line_item.rb +10 -8
  54. data/app/models/spree/media.rb +27 -3
  55. data/app/models/spree/metafield.rb +1 -1
  56. data/app/models/spree/metafield_definition.rb +1 -1
  57. data/app/models/spree/metafields.rb +2 -2
  58. data/app/models/spree/option_type.rb +26 -0
  59. data/app/models/spree/option_value.rb +3 -3
  60. data/app/models/spree/order.rb +92 -46
  61. data/app/models/spree/order_inventory.rb +2 -2
  62. data/app/models/spree/order_merger.rb +2 -2
  63. data/app/models/spree/order_updater.rb +34 -20
  64. data/app/models/spree/payment.rb +8 -8
  65. data/app/models/spree/payment_method.rb +11 -9
  66. data/app/models/spree/price.rb +22 -8
  67. data/app/models/spree/price_list.rb +12 -6
  68. data/app/models/spree/price_rules/zone_rule.rb +1 -1
  69. data/app/models/spree/product.rb +32 -33
  70. data/app/models/spree/product_category.rb +10 -4
  71. data/app/models/spree/product_collection.rb +8 -1
  72. data/app/models/spree/promotion/rules/category.rb +27 -10
  73. data/app/models/spree/promotion/rules/country.rb +1 -1
  74. data/app/models/spree/promotion/rules/taxon.rb +4 -2
  75. data/app/models/spree/promotion/rules/user.rb +1 -1
  76. data/app/models/spree/promotion_action.rb +1 -1
  77. data/app/models/spree/promotion_rule_category.rb +5 -5
  78. data/app/models/spree/promotion_rule_taxon.rb +2 -2
  79. data/app/models/spree/prototype.rb +4 -1
  80. data/app/models/spree/return_authorization_reason.rb +3 -3
  81. data/app/models/spree/return_reason.rb +1 -1
  82. data/app/models/spree/search_provider/base.rb +2 -2
  83. data/app/models/spree/search_provider.rb +7 -5
  84. data/app/models/spree/seller.rb +93 -10
  85. data/app/models/spree/seller_requirements/complete_profile.rb +26 -7
  86. data/app/models/spree/shipment.rb +4 -1
  87. data/app/models/spree/shipping_method.rb +4 -1
  88. data/app/models/spree/shipping_rate.rb +1 -1
  89. data/app/models/spree/stock/coordinator.rb +2 -2
  90. data/app/models/spree/stock/estimator.rb +7 -5
  91. data/app/models/spree/stock/package.rb +10 -8
  92. data/app/models/spree/stock_item.rb +1 -1
  93. data/app/models/spree/stock_level/custom_events.rb +1 -1
  94. data/app/models/spree/stock_level.rb +31 -2
  95. data/app/models/spree/stock_location.rb +12 -8
  96. data/app/models/spree/stock_movement.rb +7 -6
  97. data/app/models/spree/stock_reservation.rb +5 -5
  98. data/app/models/spree/store.rb +42 -16
  99. data/app/models/spree/store_credit.rb +2 -2
  100. data/app/models/spree/store_credit_category.rb +5 -5
  101. data/app/models/spree/store_credit_type.rb +2 -2
  102. data/app/models/spree/subscriber.rb +7 -7
  103. data/app/models/spree/tax_rate.rb +5 -5
  104. data/app/models/spree/taxon.rb +3 -3
  105. data/app/models/spree/taxon_rule.rb +2 -2
  106. data/app/models/spree/taxonomy.rb +1 -1
  107. data/app/models/spree/variant.rb +12 -10
  108. data/app/models/spree/variant_media.rb +1 -1
  109. data/app/models/spree/wished_item.rb +1 -1
  110. data/app/models/spree/wishlist.rb +2 -2
  111. data/app/models/spree/wishlist_item/custom_events.rb +2 -2
  112. data/app/models/spree/zone.rb +1 -1
  113. data/app/models/spree/zone_member.rb +1 -1
  114. data/app/services/spree/carts/associate.rb +6 -2
  115. data/app/services/spree/carts/create.rb +1 -1
  116. data/app/services/spree/carts/destroy.rb +23 -7
  117. data/app/services/spree/carts/remove_item.rb +1 -1
  118. data/app/services/spree/carts/remove_line_item.rb +2 -2
  119. data/app/services/spree/carts/remove_out_of_stock_items.rb +3 -1
  120. data/app/services/spree/carts/set_quantity.rb +2 -2
  121. data/app/services/spree/carts/update.rb +17 -0
  122. data/app/services/spree/checkout/add_store_credit.rb +3 -3
  123. data/app/services/spree/checkout/remove_store_credit.rb +2 -2
  124. data/app/services/spree/collections/regenerate_products.rb +37 -15
  125. data/app/services/spree/companies/add_member.rb +9 -4
  126. data/app/services/spree/diagnostics/error_log.rb +139 -0
  127. data/app/services/spree/diagnostics/section.rb +72 -0
  128. data/app/services/spree/diagnostics/sections.rb +121 -0
  129. data/app/services/spree/diagnostics/stack.rb +73 -0
  130. data/app/services/spree/diagnostics.rb +132 -0
  131. data/app/services/spree/imports/row_processors/product_variant.rb +19 -0
  132. data/app/services/spree/newsletter/subscribe.rb +7 -3
  133. data/app/services/spree/orders/approve.rb +3 -3
  134. data/app/services/spree/orders/create_user_account.rb +2 -2
  135. data/app/services/spree/orders/remove_line_item.rb +16 -5
  136. data/app/services/spree/product_memberships.rb +21 -1
  137. data/app/services/spree/product_types/apply_to_products.rb +12 -2
  138. data/app/services/spree/products/auto_match_collections.rb +20 -4
  139. data/app/services/spree/products/auto_match_taxons.rb +5 -2
  140. data/app/services/spree/shipments/update.rb +2 -2
  141. data/app/services/spree/stock_locations/stock_items/create.rb +5 -2
  142. data/app/services/spree/stock_reservations/extend.rb +3 -1
  143. data/app/services/spree/stock_reservations/reserve.rb +12 -7
  144. data/app/services/spree/store_credits/apply.rb +9 -1
  145. data/app/services/spree/taxons/add_products.rb +4 -2
  146. data/app/services/spree/taxons/regenerate_products.rb +5 -2
  147. data/app/services/spree/taxons/remove_products.rb +4 -2
  148. data/app/services/spree/update_check.rb +7 -31
  149. data/app/tools/spree/agent_tools/describe_resource.rb +3 -0
  150. data/app/tools/spree/agent_tools/get_resource.rb +1 -1
  151. data/app/tools/spree/agent_tools/resource_write.rb +1 -1
  152. data/app/tools/spree/agent_tools/search_resources.rb +42 -10
  153. data/app/workflows/spree/carts/add_item.rb +52 -1
  154. data/app/workflows/spree/carts/complete.rb +14 -2
  155. data/app/workflows/spree/carts/recalculate.rb +1 -1
  156. data/app/workflows/spree/fulfillments/update.rb +1 -1
  157. data/app/workflows/spree/orders/cancel.rb +3 -1
  158. data/app/workflows/spree/payments/capture.rb +2 -2
  159. data/app/workflows/spree/payments/handle_webhook.rb +7 -3
  160. data/app/workflows/spree/seller_transfers/create.rb +1 -1
  161. data/app/workflows/spree/sellers/approve.rb +6 -0
  162. data/app/workflows/spree/sellers/create.rb +5 -2
  163. data/app/workflows/spree/stock_levels/bulk_upsert.rb +19 -7
  164. data/config/locales/be.yml +1 -1
  165. data/config/locales/en.yml +12 -0
  166. data/config/locales/fr.yml +1 -1
  167. data/config/locales/lt.yml +1 -1
  168. data/config/locales/ru.yml +1 -1
  169. data/config/locales/uk.yml +1 -1
  170. data/db/migrate/20240303174340_fix_spree_stock_item_unique_index.rb +14 -10
  171. data/db/migrate/20260710000001_rename_taxons_to_categories.rb +1 -1
  172. data/db/migrate/20260728000004_rename_shipping_to_fulfillment_and_delivery.rb +1 -1
  173. data/db/migrate/20260806000001_add_store_id_to_spree_tax_rates_and_categories.rb +1 -1
  174. data/db/migrate/20260807130001_add_country_state_codes_to_consumers.rb +1 -1
  175. data/db/migrate/20260809000001_rename_metafields_to_custom_fields.rb +1 -1
  176. data/db/migrate/20260809150001_promote_shipping_categories_to_delivery_profiles.rb +1 -1
  177. data/db/migrate/20260811000001_add_delivery_tracking_to_fulfillments.rb +1 -1
  178. data/db/migrate/20260814000001_rename_stock_items_to_stock_levels.rb +13 -7
  179. data/db/migrate/20260824000001_add_store_to_spree_media.rb +1 -1
  180. data/db/migrate/20260828100001_unify_import_and_export_tenancy.rb +1 -1
  181. data/db/migrate/20261016000001_remove_default_from_spree_tax_rates_included_in_price.rb +1 -1
  182. data/lib/spree/agent_tool.rb +3 -3
  183. data/lib/spree/agent_tools/default_catalog.rb +2 -2
  184. data/lib/spree/agent_tools/legacy_tools.rb +1 -1
  185. data/lib/spree/agent_tools/operation_tool.rb +1 -1
  186. data/lib/spree/agent_tools/record_summary.rb +8 -2
  187. data/lib/spree/agent_tools/resource_map.rb +82 -7
  188. data/lib/spree/core/dependencies.rb +10 -10
  189. data/lib/spree/core/engine.rb +14 -0
  190. data/lib/spree/core/number_generator.rb +4 -3
  191. data/lib/spree/core/preferences/preferable.rb +1 -1
  192. data/lib/spree/core/preferences/preferable_class_methods.rb +5 -1
  193. data/lib/spree/core/pricing/resolver.rb +2 -2
  194. data/lib/spree/core/version.rb +1 -1
  195. data/lib/spree/core.rb +48 -10
  196. data/lib/spree/i18n.rb +6 -2
  197. data/lib/spree/localized_number.rb +1 -1
  198. data/lib/spree/removed_apis.rb +274 -0
  199. data/lib/spree/reporting/default_vocabulary.rb +26 -6
  200. data/lib/spree/testing_support/factories/digital_asset_factory.rb +1 -1
  201. data/lib/spree/testing_support/factories/stock_level_factory.rb +1 -1
  202. data/lib/spree/testing_support/factories/taxon_factory.rb +1 -1
  203. data/lib/spree/testing_support/factories/taxonomy_factory.rb +1 -1
  204. data/lib/spree/testing_support/factories/wishlist_item_factory.rb +1 -1
  205. data/lib/spree/testing_support/i18n.rb +7 -2
  206. data/lib/spree/testing_support/order_walkthrough.rb +5 -2
  207. data/lib/spree/upgrades/5_6_to_6_0/manifest.yml +14 -14
  208. data/lib/tasks/carts_migration.rake +1 -1
  209. data/lib/tasks/categories_and_collections.rake +1 -1
  210. data/lib/tasks/deliveries_migration.rake +1 -1
  211. data/lib/tasks/delivery_method_rules_migration.rake +1 -1
  212. data/lib/tasks/delivery_migration.rake +1 -1
  213. data/lib/tasks/delivery_profiles_migration.rake +2 -2
  214. data/lib/tasks/diagnostics.rake +11 -0
  215. data/lib/tasks/fold_store_credit_categories.rake +1 -1
  216. data/lib/tasks/migrate_country_state_codes.rake +1 -1
  217. data/lib/tasks/migrate_returns.rake +4 -4
  218. data/lib/tasks/migrate_rich_text_to_columns.rake +1 -1
  219. data/lib/tasks/store_settings.rake +1 -1
  220. data/lib/tasks/typed_stock_movements_migration.rake +1 -1
  221. metadata +13 -6
@@ -67,6 +67,9 @@ module Spree
67
67
  scope :non_zero, -> { where.not(amount: [nil, 0]) }
68
68
  scope :discounted, -> { where('compare_at_amount > amount') }
69
69
  scope :base_prices, -> { where(price_list_id: nil) }
70
+ # Base prices with an amount: what puts a product on sale to everyone in a
71
+ # currency (docs/plans/6.0-volume-pricing.md).
72
+ scope :listing, -> { base_prices.where.not(amount: nil) }
70
73
  # A variant's rungs above its ordinary price on a list.
71
74
  scope :breaks, -> { where.not(min_quantity: 1) }
72
75
  scope :for_price_list, ->(price_list) { where(price_list_id: price_list) }
@@ -134,27 +137,38 @@ module Spree
134
137
  alias_attribute :price, :amount
135
138
  alias_attribute :compare_at_price, :compare_at_amount
136
139
 
137
- # @deprecated Prices are charged as entered for every buyer since 6.0. Use {#price}; removed in 6.1.
140
+ # @deprecated Prices are charged as entered for every buyer since 6.0. Use {#price}; removed in 6.3.
138
141
  def price_including_vat_for(_price_options = {})
139
- Spree::Deprecation.warn('Spree::Price#price_including_vat_for is deprecated and will be removed in Spree 6.1. Prices are charged as entered; use #price instead.')
142
+ Spree::Deprecation.warn(
143
+ 'Spree::Price#price_including_vat_for is deprecated and will be removed in Spree 6.3. Prices are charged as entered; use #price instead.'
144
+ )
140
145
  price
141
146
  end
142
147
 
143
- # @deprecated Use {#compare_at_price}; removed in 6.1.
148
+ # @deprecated Use {#compare_at_price}; removed in 6.3.
144
149
  def compare_at_price_including_vat_for(_price_options = {})
145
- Spree::Deprecation.warn('Spree::Price#compare_at_price_including_vat_for is deprecated and will be removed in Spree 6.1. Prices are charged as entered; use #compare_at_price instead.')
150
+ Spree::Deprecation.warn(
151
+ 'Spree::Price#compare_at_price_including_vat_for is deprecated and will be removed in Spree 6.3. ' \
152
+ 'Prices are charged as entered; use #compare_at_price instead.'
153
+ )
146
154
  compare_at_price
147
155
  end
148
156
 
149
- # @deprecated Use {#display_price}; removed in 6.1.
157
+ # @deprecated Use {#display_price}; removed in 6.3.
150
158
  def display_price_including_vat_for(_price_options = {})
151
- Spree::Deprecation.warn('Spree::Price#display_price_including_vat_for is deprecated and will be removed in Spree 6.1. Prices are charged as entered; use #display_price instead.')
159
+ Spree::Deprecation.warn(
160
+ 'Spree::Price#display_price_including_vat_for is deprecated and will be removed in Spree 6.3. ' \
161
+ 'Prices are charged as entered; use #display_price instead.'
162
+ )
152
163
  display_price
153
164
  end
154
165
 
155
- # @deprecated Use {#display_compare_at_price}; removed in 6.1.
166
+ # @deprecated Use {#display_compare_at_price}; removed in 6.3.
156
167
  def display_compare_at_price_including_vat_for(_price_options = {})
157
- Spree::Deprecation.warn('Spree::Price#display_compare_at_price_including_vat_for is deprecated and will be removed in Spree 6.1. Prices are charged as entered; use #display_compare_at_price instead.')
168
+ Spree::Deprecation.warn(
169
+ 'Spree::Price#display_compare_at_price_including_vat_for is deprecated and will be removed in Spree 6.3. ' \
170
+ 'Prices are charged as entered; use #display_compare_at_price instead.'
171
+ )
158
172
  display_compare_at_price
159
173
  end
160
174
 
@@ -130,25 +130,31 @@ module Spree
130
130
  include Spree::HasStatus
131
131
  has_status :draft, :active, :inactive, :scheduled, default: :draft
132
132
 
133
- # @deprecated Call Spree.price_list_activate_workflow — removed in 6.1.
133
+ # @deprecated Call Spree.price_list_activate_workflow — removed in 6.3.
134
134
  # Kept literal: the old event always went straight to active, and the
135
135
  # workflow schedules a future-dated list instead. A caller relying on
136
136
  # this shell gets what it always got.
137
137
  def activate
138
- Spree::Deprecation.warn('Spree::PriceList#activate is deprecated and will be removed in Spree 6.1. Call Spree.price_list_activate_workflow instead.')
138
+ Spree::Deprecation.warn(
139
+ 'Spree::PriceList#activate is deprecated and will be removed in Spree 6.3. Call Spree.price_list_activate_workflow instead.'
140
+ )
139
141
  update(status: 'active')
140
142
  end
141
143
 
142
- # @deprecated Call Spree.price_list_deactivate_workflow — removed in 6.1.
144
+ # @deprecated Call Spree.price_list_deactivate_workflow — removed in 6.3.
143
145
  def deactivate
144
- Spree::Deprecation.warn('Spree::PriceList#deactivate is deprecated and will be removed in Spree 6.1. Call Spree.price_list_deactivate_workflow instead.')
146
+ Spree::Deprecation.warn(
147
+ 'Spree::PriceList#deactivate is deprecated and will be removed in Spree 6.3. Call Spree.price_list_deactivate_workflow instead.'
148
+ )
145
149
  Spree.price_list_deactivate_workflow.call(price_list: self).success?
146
150
  end
147
151
 
148
- # @deprecated Call Spree.price_list_activate_workflow — removed in 6.1.
152
+ # @deprecated Call Spree.price_list_activate_workflow — removed in 6.3.
149
153
  # It picks scheduled or active from the dates itself.
150
154
  def schedule
151
- Spree::Deprecation.warn('Spree::PriceList#schedule is deprecated and will be removed in Spree 6.1. Call Spree.price_list_activate_workflow instead.')
155
+ Spree::Deprecation.warn(
156
+ 'Spree::PriceList#schedule is deprecated and will be removed in Spree 6.3. Call Spree.price_list_activate_workflow instead.'
157
+ )
152
158
  update(status: 'scheduled')
153
159
  end
154
160
 
@@ -1,6 +1,6 @@
1
1
  module Spree
2
2
  module PriceRules
3
- # Deprecated STI shell, removed in Spree 6.1. Exists only so price-rule
3
+ # Deprecated STI shell, removed in Spree 6.3. Exists only so price-rule
4
4
  # rows created before `spree:migrate_tax_zones` runs still load — the task
5
5
  # converts each row to a {MarketRule} where the zone's countries match a
6
6
  # market exactly, and otherwise deactivates the price list and removes the
@@ -80,14 +80,16 @@ module Spree
80
80
 
81
81
  has_many :product_option_types, -> { order(:position) }, dependent: :destroy, inverse_of: :product
82
82
  has_many :option_types, through: :product_option_types
83
- has_many :product_categories, -> { order(created_at: :asc) }, class_name: 'Spree::ProductCategory', dependent: :delete_all, inverse_of: :product
84
- has_many :categories, through: :product_categories, class_name: 'Spree::Category', source: :category, before_remove: :remove_category
83
+ has_many :product_categories, -> { order(created_at: :asc) }, class_name: 'Spree::ProductCategory',
84
+ dependent: :destroy, inverse_of: :product
85
+ has_many :categories, through: :product_categories, class_name: 'Spree::Category', source: :category,
86
+ dependent: :destroy
85
87
  has_many :taxonomies, through: :categories, deprecated: true
86
88
 
87
89
  # @deprecated The classification_count column was renamed to categories_count in 6.0.
88
90
  alias_attribute :classification_count, :categories_count
89
91
 
90
- # @deprecated Use #product_categories; removed in 6.1.
92
+ # @deprecated Use #product_categories; removed in 6.3.
91
93
  # The live row in the review trail, or nil for a product nobody submitted.
92
94
  #
93
95
  # @return [Spree::ProductSubmission, nil]
@@ -114,33 +116,33 @@ module Spree
114
116
  end
115
117
 
116
118
  def classifications
117
- Spree::Deprecation.warn('Spree::Product#classifications is deprecated and will be removed in Spree 6.1. Use #product_categories instead.')
119
+ Spree::Deprecation.warn('Spree::Product#classifications is deprecated and will be removed in Spree 6.3. Use #product_categories instead.')
118
120
  product_categories
119
121
  end
120
122
 
121
- # @deprecated Use #categories / #category_ids; removed in 6.1.
123
+ # @deprecated Use #categories / #category_ids; removed in 6.3.
122
124
  def taxons
123
- Spree::Deprecation.warn('Spree::Product#taxons is deprecated and will be removed in Spree 6.1. Use #categories instead.')
125
+ Spree::Deprecation.warn('Spree::Product#taxons is deprecated and will be removed in Spree 6.3. Use #categories instead.')
124
126
  categories
125
127
  end
126
128
 
127
129
  def taxons=(value)
128
- Spree::Deprecation.warn('Spree::Product#taxons= is deprecated and will be removed in Spree 6.1. Use #categories= instead.')
130
+ Spree::Deprecation.warn('Spree::Product#taxons= is deprecated and will be removed in Spree 6.3. Use #categories= instead.')
129
131
  self.categories = value
130
132
  end
131
133
 
132
134
  def taxon_ids
133
- Spree::Deprecation.warn('Spree::Product#taxon_ids is deprecated and will be removed in Spree 6.1. Use #category_ids instead.')
135
+ Spree::Deprecation.warn('Spree::Product#taxon_ids is deprecated and will be removed in Spree 6.3. Use #category_ids instead.')
134
136
  category_ids
135
137
  end
136
138
 
137
139
  def taxon_ids=(ids)
138
- Spree::Deprecation.warn('Spree::Product#taxon_ids= is deprecated and will be removed in Spree 6.1. Use #category_ids= instead.')
140
+ Spree::Deprecation.warn('Spree::Product#taxon_ids= is deprecated and will be removed in Spree 6.3. Use #category_ids= instead.')
139
141
  self.category_ids = ids
140
142
  end
141
143
 
142
- has_many :product_collections, class_name: 'Spree::ProductCollection', dependent: :destroy_async, inverse_of: :product
143
- has_many :collections, through: :product_collections
144
+ has_many :product_collections, class_name: 'Spree::ProductCollection', dependent: :destroy, inverse_of: :product
145
+ has_many :collections, through: :product_collections, dependent: :destroy
144
146
  has_many :catalog_products, class_name: 'Spree::CatalogProduct', dependent: :destroy_async, inverse_of: :product
145
147
  has_many :catalogs, through: :catalog_products
146
148
 
@@ -422,21 +424,23 @@ module Spree
422
424
  include Spree::HasStatus
423
425
  has_status(*ALL_STATUSES, default: :draft)
424
426
 
425
- # @deprecated Call Spree.product_activate_workflow — removed in 6.1.
427
+ # @deprecated Call Spree.product_activate_workflow — removed in 6.3.
426
428
  def activate!
427
- Spree::Deprecation.warn('Spree::Product#activate! is deprecated and will be removed in Spree 6.1. Call Spree.product_activate_workflow instead.')
429
+ Spree::Deprecation.warn(
430
+ 'Spree::Product#activate! is deprecated and will be removed in Spree 6.3. Call Spree.product_activate_workflow instead.'
431
+ )
428
432
  run_status_workflow(Spree.product_activate_workflow)
429
433
  end
430
434
 
431
- # @deprecated Call Spree.product_archive_workflow — removed in 6.1.
435
+ # @deprecated Call Spree.product_archive_workflow — removed in 6.3.
432
436
  def archive!
433
- Spree::Deprecation.warn('Spree::Product#archive! is deprecated and will be removed in Spree 6.1. Call Spree.product_archive_workflow instead.')
437
+ Spree::Deprecation.warn('Spree::Product#archive! is deprecated and will be removed in Spree 6.3. Call Spree.product_archive_workflow instead.')
434
438
  run_status_workflow(Spree.product_archive_workflow)
435
439
  end
436
440
 
437
- # @deprecated Call Spree.product_draft_workflow — removed in 6.1.
441
+ # @deprecated Call Spree.product_draft_workflow — removed in 6.3.
438
442
  def draft!
439
- Spree::Deprecation.warn('Spree::Product#draft! is deprecated and will be removed in Spree 6.1. Call Spree.product_draft_workflow instead.')
443
+ Spree::Deprecation.warn('Spree::Product#draft! is deprecated and will be removed in Spree 6.3. Call Spree.product_draft_workflow instead.')
440
444
  run_status_workflow(Spree.product_draft_workflow)
441
445
  end
442
446
 
@@ -548,7 +552,7 @@ module Spree
548
552
 
549
553
  variant_count > 1
550
554
  end
551
- # @deprecated Use #has_multiple_variants? — will be removed in Spree 6.1.
555
+ # @deprecated Use #has_multiple_variants? — will be removed in Spree 6.3.
552
556
  alias has_variants? has_multiple_variants?
553
557
 
554
558
  # Returns the product's media gallery.
@@ -579,12 +583,12 @@ module Spree
579
583
  @variant_for_images ||= find_variant_for_images
580
584
  end
581
585
 
582
- # @deprecated Read #gallery_media directly; removed in 6.1. Nothing in
586
+ # @deprecated Read #gallery_media directly; removed in 6.3. Nothing in
583
587
  # Spree calls this — a hover image is a storefront presentation choice,
584
588
  # not something core should name.
585
589
  # @return [Spree::Media, nil]
586
590
  def secondary_image
587
- Spree::Deprecation.warn('Spree::Product#secondary_image is deprecated and will be removed in Spree 6.1. Use #gallery_media instead.')
591
+ Spree::Deprecation.warn('Spree::Product#secondary_image is deprecated and will be removed in Spree 6.3. Use #gallery_media instead.')
588
592
  gallery_media.second
589
593
  end
590
594
 
@@ -768,25 +772,25 @@ module Spree
768
772
  end
769
773
  end
770
774
 
771
- # @deprecated Use {#stock_levels}; removed in 6.1.
775
+ # @deprecated Use {#stock_levels}; removed in 6.3.
772
776
  def stock_items
773
- Spree::Deprecation.warn('Spree::Product#stock_items is deprecated and will be removed in Spree 6.1. Use #stock_levels instead.')
777
+ Spree::Deprecation.warn('Spree::Product#stock_items is deprecated and will be removed in Spree 6.3. Use #stock_levels instead.')
774
778
  stock_levels
775
779
  end
776
780
 
777
- # @deprecated Use #default_variant — the master variant is being removed in Spree 6.1.
781
+ # @deprecated Use #default_variant — the master variant is being removed in Spree 6.3.
778
782
  def master
779
- Spree::Deprecation.warn('Spree::Product#master is deprecated and will be removed in Spree 6.1. Use #default_variant instead.')
783
+ Spree::Deprecation.warn('Spree::Product#master is deprecated and will be removed in Spree 6.3. Use #default_variant instead.')
780
784
  default_variant
781
785
  end
782
786
 
783
- # @deprecated Use #variants — will be removed in Spree 6.1.
787
+ # @deprecated Use #variants — will be removed in Spree 6.3.
784
788
  def variants_including_master
785
- Spree::Deprecation.warn('Spree::Product#variants_including_master is deprecated and will be removed in Spree 6.1. Use #variants instead.')
789
+ Spree::Deprecation.warn('Spree::Product#variants_including_master is deprecated and will be removed in Spree 6.3. Use #variants instead.')
786
790
  variants
787
791
  end
788
792
 
789
- # @deprecated Use #default_variant_id — will be removed in Spree 6.1.
793
+ # @deprecated Use #default_variant_id — will be removed in Spree 6.3.
790
794
  def master_id
791
795
  default_variant_id
792
796
  end
@@ -801,7 +805,7 @@ module Spree
801
805
 
802
806
  # @deprecated Use {#primary_category}.
803
807
  def main_taxon
804
- Spree::Deprecation.warn('Spree::Product#main_taxon is deprecated and will be removed in Spree 6.1. Use #primary_category instead.')
808
+ Spree::Deprecation.warn('Spree::Product#main_taxon is deprecated and will be removed in Spree 6.3. Use #primary_category instead.')
805
809
  primary_category
806
810
  end
807
811
 
@@ -1035,11 +1039,6 @@ module Spree
1035
1039
  end
1036
1040
  end
1037
1041
 
1038
- def remove_category(category)
1039
- removed_product_categories = product_categories.where(category: category)
1040
- removed_product_categories.each(&:remove_from_list)
1041
- end
1042
-
1043
1042
  def discontinue_on_must_be_later_than_make_active_at
1044
1043
  if discontinue_on < make_active_at
1045
1044
  errors.add(:discontinue_on, :invalid_date_range)
@@ -4,13 +4,19 @@ module Spree
4
4
  # alias). The category_id column was renamed in 6.0, so the association is a
5
5
  # plain #category with no foreign_key override.
6
6
  class ProductCategory < Spree.base_class
7
+ has_prefix_id :pctg
8
+
9
+ publishes_lifecycle_events only: %i[create delete]
10
+
7
11
  acts_as_list scope: :category_id
8
12
 
9
13
  with_options inverse_of: :product_categories, touch: true do
10
- belongs_to :product, class_name: 'Spree::Product', counter_cache: :categories_count
14
+ belongs_to :product, -> { with_deleted }, class_name: 'Spree::Product', counter_cache: :categories_count
11
15
  belongs_to :category, class_name: 'Spree::Category'
12
16
  end
13
17
 
18
+ delegate :store, to: :product, allow_nil: true
19
+
14
20
  validates :position, numericality: { only_integer: true, allow_blank: true, allow_nil: true }
15
21
  # For #3494
16
22
  validates :category_id, uniqueness: { scope: :product_id, message: :already_linked, allow_blank: true }
@@ -45,14 +51,14 @@ module Spree
45
51
  end
46
52
  }
47
53
 
48
- # @deprecated Use #category / #category=; removed in 6.1.
54
+ # @deprecated Use #category / #category=; removed in 6.3.
49
55
  def taxon
50
- Spree::Deprecation.warn('Spree::ProductCategory#taxon is deprecated and will be removed in Spree 6.1. Use #category instead.')
56
+ Spree::Deprecation.warn('Spree::ProductCategory#taxon is deprecated and will be removed in Spree 6.3. Use #category instead.')
51
57
  category
52
58
  end
53
59
 
54
60
  def taxon=(value)
55
- Spree::Deprecation.warn('Spree::ProductCategory#taxon= is deprecated and will be removed in Spree 6.1. Use #category= instead.')
61
+ Spree::Deprecation.warn('Spree::ProductCategory#taxon= is deprecated and will be removed in Spree 6.3. Use #category= instead.')
56
62
  self.category = value
57
63
  end
58
64
 
@@ -4,14 +4,21 @@ module Spree
4
4
  class ProductCollection < Spree.base_class
5
5
  self.table_name = 'spree_product_collections'
6
6
 
7
+ has_prefix_id :pcoll
8
+
9
+ publishes_lifecycle_events only: %i[create delete]
10
+
7
11
  acts_as_list scope: :collection
8
12
 
9
13
  # products_count is a plain Rails counter_cache on the collection (collections are
10
14
  # flat, so — unlike Classification — there is no descendant-inclusive recompute).
11
- belongs_to :product, class_name: 'Spree::Product', counter_cache: :collections_count, touch: true
15
+ belongs_to :product, -> { with_deleted }, class_name: 'Spree::Product', counter_cache: :collections_count, touch: true,
16
+ inverse_of: :product_collections
12
17
  belongs_to :collection, class_name: 'Spree::Collection', counter_cache: :products_count, touch: true,
13
18
  inverse_of: :product_collections
14
19
 
20
+ delegate :store, to: :product, allow_nil: true
21
+
15
22
  validates :position, numericality: { only_integer: true, allow_blank: true, allow_nil: true }
16
23
  validates :collection_id, uniqueness: { scope: :product_id, message: :already_linked, allow_blank: true }
17
24
 
@@ -74,56 +74,73 @@ module Spree
74
74
  end
75
75
 
76
76
  #
77
- # Deprecated aliases (removed in 6.1)
77
+ # Deprecated aliases (removed in 6.3)
78
78
  #
79
79
  # @deprecated Use #categories.
80
80
  def taxons
81
- Spree::Deprecation.warn('Spree::Promotion::Rules::Category#taxons is deprecated and will be removed in Spree 6.1. Use #categories instead.')
81
+ Spree::Deprecation.warn('Spree::Promotion::Rules::Category#taxons is deprecated and will be removed in Spree 6.3. Use #categories instead.')
82
82
  categories
83
83
  end
84
84
 
85
85
  # @deprecated Use #categories=.
86
86
  def taxons=(value)
87
- Spree::Deprecation.warn('Spree::Promotion::Rules::Category#taxons= is deprecated and will be removed in Spree 6.1. Use #categories= instead.')
87
+ Spree::Deprecation.warn(
88
+ 'Spree::Promotion::Rules::Category#taxons= is deprecated and will be removed in Spree 6.3. Use #categories= instead.'
89
+ )
88
90
  self.categories = value
89
91
  end
90
92
 
91
93
  # @deprecated Use #category_ids.
92
94
  def taxon_ids
93
- Spree::Deprecation.warn('Spree::Promotion::Rules::Category#taxon_ids is deprecated and will be removed in Spree 6.1. Use #category_ids instead.')
95
+ Spree::Deprecation.warn(
96
+ 'Spree::Promotion::Rules::Category#taxon_ids is deprecated and will be removed in Spree 6.3. Use #category_ids instead.'
97
+ )
94
98
  category_ids
95
99
  end
96
100
 
97
101
  # @deprecated Use #category_ids=.
98
102
  def taxon_ids=(ids)
99
- Spree::Deprecation.warn('Spree::Promotion::Rules::Category#taxon_ids= is deprecated and will be removed in Spree 6.1. Use #category_ids= instead.')
103
+ Spree::Deprecation.warn(
104
+ 'Spree::Promotion::Rules::Category#taxon_ids= is deprecated and will be removed in Spree 6.3. Use #category_ids= instead.'
105
+ )
100
106
  self.category_ids = ids
101
107
  end
102
108
 
103
109
  # @deprecated Use #eligible_category_ids.
104
110
  def eligible_taxon_ids
105
- Spree::Deprecation.warn('Spree::Promotion::Rules::Category#eligible_taxon_ids is deprecated and will be removed in Spree 6.1. Use #eligible_category_ids instead.')
111
+ Spree::Deprecation.warn(
112
+ 'Spree::Promotion::Rules::Category#eligible_taxon_ids is deprecated and will be removed in Spree 6.3. ' \
113
+ 'Use #eligible_category_ids instead.'
114
+ )
106
115
  eligible_category_ids
107
116
  end
108
117
 
109
118
  # @deprecated Use #category_ids_to_add.
110
119
  def taxon_ids_to_add
111
- Spree::Deprecation.warn('Spree::Promotion::Rules::Category#taxon_ids_to_add is deprecated and will be removed in Spree 6.1. Use #category_ids_to_add instead.')
120
+ Spree::Deprecation.warn(
121
+ 'Spree::Promotion::Rules::Category#taxon_ids_to_add is deprecated and will be removed in Spree 6.3. Use #category_ids_to_add instead.'
122
+ )
112
123
  category_ids_to_add
113
124
  end
114
125
 
115
126
  def taxon_ids_to_add=(ids)
116
- Spree::Deprecation.warn('Spree::Promotion::Rules::Category#taxon_ids_to_add= is deprecated and will be removed in Spree 6.1. Use #category_ids_to_add= instead.')
127
+ Spree::Deprecation.warn(
128
+ 'Spree::Promotion::Rules::Category#taxon_ids_to_add= is deprecated and will be removed in Spree 6.3. Use #category_ids_to_add= instead.'
129
+ )
117
130
  self.category_ids_to_add = ids
118
131
  end
119
132
 
120
133
  def taxon_ids_string
121
- Spree::Deprecation.warn('Spree::Promotion::Rules::Category#taxon_ids_string is deprecated and will be removed in Spree 6.1. Use #category_ids instead.')
134
+ Spree::Deprecation.warn(
135
+ 'Spree::Promotion::Rules::Category#taxon_ids_string is deprecated and will be removed in Spree 6.3. Use #category_ids instead.'
136
+ )
122
137
  categories.pluck(:id).join(',')
123
138
  end
124
139
 
125
140
  def taxon_ids_string=(s)
126
- Spree::Deprecation.warn('Spree::Promotion::Rules::Category#taxon_ids_string= is deprecated and will be removed in Spree 6.1. Use #category_ids= instead.')
141
+ Spree::Deprecation.warn(
142
+ 'Spree::Promotion::Rules::Category#taxon_ids_string= is deprecated and will be removed in Spree 6.3. Use #category_ids= instead.'
143
+ )
127
144
  ids = s.to_s.split(',').map(&:strip)
128
145
  self.categories = Spree::Category.for_stores(stores).find(ids)
129
146
  end
@@ -69,7 +69,7 @@ module Spree
69
69
 
70
70
  # Countries stopped being records in 6.0, so a rule still configured
71
71
  # with the legacy row id is resolved by reading the table the upgrade
72
- # keeps until 6.1. Rules saved since store the ISO code directly.
72
+ # keeps until 6.3. Rules saved since store the ISO code directly.
73
73
  def legacy_country_code(country_id)
74
74
  connection = ActiveRecord::Base.connection
75
75
  return nil unless connection.table_exists?('spree_countries')
@@ -7,10 +7,12 @@ module Spree
7
7
  # Spree::Promotion::Rules::Taxon in 6.0. A true constant alias, so old STI type
8
8
  # strings (`'Spree::Promotion::Rules::Taxon'`) still instantiate correctly until
9
9
  # the Phase 4 migration rewrites them. The warning fires when this file loads.
10
- # Removed in 6.1.
10
+ # Removed in 6.3.
11
11
  Taxon = Category
12
12
 
13
- Spree::Deprecation.warn('Spree::Promotion::Rules::Taxon is deprecated and will be removed in Spree 6.1. Use Spree::Promotion::Rules::Category instead.')
13
+ Spree::Deprecation.warn(
14
+ 'Spree::Promotion::Rules::Taxon is deprecated and will be removed in Spree 6.3. Use Spree::Promotion::Rules::Category instead.'
15
+ )
14
16
  end
15
17
  end
16
18
  end
@@ -18,7 +18,7 @@ module Spree
18
18
  self.additional_permitted_attributes = [customer_ids: []]
19
19
 
20
20
  # Wire-format shorthand is `customer`; the rule class keeps the `User`
21
- # name until the 6.1 rename (see docs/plans/6.0-platform-auth.md).
21
+ # name until the 6.3 rename (see docs/plans/6.0-platform-auth.md).
22
22
  def self.api_type
23
23
  'customer'
24
24
  end
@@ -60,7 +60,7 @@ module Spree
60
60
  end
61
61
 
62
62
  # STI type names for a discount scope, covering both the 6.0 names and
63
- # the legacy names still present in the type column until the 6.1 data
63
+ # the legacy names still present in the type column until the 6.3 data
64
64
  # migration.
65
65
  #
66
66
  # @param scope [Symbol] :line_item, :fulfillment or :order
@@ -1,21 +1,21 @@
1
1
  module Spree
2
2
  # Join model between a Spree::Promotion::Rules::Category rule and a
3
- # Spree::Category. Renamed from Spree::PromotionRuleTaxon in 6.0 (alias kept for
4
- # one release).
3
+ # Spree::Category. Renamed from Spree::PromotionRuleTaxon in 6.0 (alias kept
4
+ # until 6.3).
5
5
  class PromotionRuleCategory < Spree.base_class
6
6
  belongs_to :promotion_rule, class_name: 'Spree::PromotionRule'
7
7
  belongs_to :category, class_name: 'Spree::Category'
8
8
 
9
9
  validates :promotion_rule_id, uniqueness: { scope: :category_id }, allow_nil: true
10
10
 
11
- # @deprecated Use #category / #category=; removed in 6.1.
11
+ # @deprecated Use #category / #category=; removed in 6.3.
12
12
  def taxon
13
- Spree::Deprecation.warn('Spree::PromotionRuleCategory#taxon is deprecated and will be removed in Spree 6.1. Use #category instead.')
13
+ Spree::Deprecation.warn('Spree::PromotionRuleCategory#taxon is deprecated and will be removed in Spree 6.3. Use #category instead.')
14
14
  category
15
15
  end
16
16
 
17
17
  def taxon=(value)
18
- Spree::Deprecation.warn('Spree::PromotionRuleCategory#taxon= is deprecated and will be removed in Spree 6.1. Use #category= instead.')
18
+ Spree::Deprecation.warn('Spree::PromotionRuleCategory#taxon= is deprecated and will be removed in Spree 6.3. Use #category= instead.')
19
19
  self.category = value
20
20
  end
21
21
  end
@@ -3,8 +3,8 @@
3
3
  module Spree
4
4
  # Deprecation alias for Spree::PromotionRuleCategory, renamed from
5
5
  # Spree::PromotionRuleTaxon in 6.0. A true constant alias (AR-safe); the warning
6
- # fires when this file loads. Removed in 6.1.
6
+ # fires when this file loads. Removed in 6.3.
7
7
  PromotionRuleTaxon = PromotionRuleCategory
8
8
 
9
- Spree::Deprecation.warn('Spree::PromotionRuleTaxon is deprecated and will be removed in Spree 6.1. Use Spree::PromotionRuleCategory instead.')
9
+ Spree::Deprecation.warn('Spree::PromotionRuleTaxon is deprecated and will be removed in Spree 6.3. Use Spree::PromotionRuleCategory instead.')
10
10
  end
@@ -1,5 +1,8 @@
1
1
  module Spree
2
2
  # Constant alias for the legacy Spree::Prototype class, renamed to
3
- # Spree::ProductType in 6.0. Remove in 6.1.
3
+ # Spree::ProductType in 6.0. The warning fires when this
4
+ # file loads. Removed in 6.3.
4
5
  Prototype = ProductType
6
+
7
+ Spree::Deprecation.warn('Spree::Prototype is deprecated and will be removed in Spree 6.3. Use Spree::ProductType instead.')
5
8
  end
@@ -2,13 +2,13 @@
2
2
 
3
3
  module Spree
4
4
  # Deprecation alias for Spree::ReturnReason, renamed in 6.0 along with the
5
- # removal of the ReturnAuthorization chain. Retained for one release so
6
- # existing code and extensions keep working; removed in 6.1.
5
+ # removal of the ReturnAuthorization chain. Retained until 6.3 so
6
+ # existing code and extensions keep working; removed in 6.3.
7
7
  #
8
8
  # A true constant alias — the class, table (spree_return_reasons), prefix
9
9
  # (rar) and model_name are all Spree::ReturnReason, so is_a?, polymorphic
10
10
  # type strings and class_name: references keep resolving correctly.
11
11
  ReturnAuthorizationReason = ReturnReason
12
12
 
13
- Spree::Deprecation.warn('Spree::ReturnAuthorizationReason is deprecated and will be removed in Spree 6.1. Use Spree::ReturnReason instead.')
13
+ Spree::Deprecation.warn('Spree::ReturnAuthorizationReason is deprecated and will be removed in Spree 6.3. Use Spree::ReturnReason instead.')
14
14
  end
@@ -4,7 +4,7 @@ module Spree
4
4
  #
5
5
  # Renamed from Spree::ReturnAuthorizationReason in 6.0 now that the
6
6
  # ReturnAuthorization chain is gone; Spree::ReturnAuthorizationReason
7
- # remains as a deprecated alias for one release.
7
+ # remains as a deprecated alias until 6.3.
8
8
  class ReturnReason < Spree.base_class
9
9
  has_prefix_id :rar
10
10
 
@@ -27,9 +27,9 @@ module Spree
27
27
  @custom_field_schema ||= CustomFieldSchema.new(store, audience: audience)
28
28
  end
29
29
 
30
- # Deprecated 6.0 name, removed in 6.1.
30
+ # Deprecated 6.0 name, removed in 6.3.
31
31
  def metafield_schema
32
- Spree::Deprecation.warn('#metafield_schema is deprecated and will be removed in Spree 6.1. Use #custom_field_schema instead.')
32
+ Spree::Deprecation.warn('#metafield_schema is deprecated and will be removed in Spree 6.3. Use #custom_field_schema instead.')
33
33
  custom_field_schema
34
34
  end
35
35
 
@@ -2,7 +2,7 @@ module Spree
2
2
  module SearchProvider
3
3
  # Meilisearch moved out of core into the spree_meilisearch gem at 6.0, taking
4
4
  # the document presenter with it. Applications configure the provider by
5
- # class name, so resolve the old constants to the new ones for one release
5
+ # class name, so resolve the old constants to the new ones until 6.3
6
6
  # rather than failing at boot with a bare NameError.
7
7
  MOVED_TO_SPREE_MEILISEARCH = {
8
8
  Meilisearch: 'SpreeMeilisearch::SearchProvider',
@@ -18,10 +18,12 @@ module Spree
18
18
  "Add `gem 'spree_meilisearch'` to your Gemfile."
19
19
  end
20
20
 
21
- Spree::Deprecation.warn(
22
- "Spree::SearchProvider::#{name} is deprecated and will be removed in Spree 6.1. " \
23
- "Use #{replacement} instead."
24
- ) if defined?(Spree::Deprecation)
21
+ if defined?(Spree::Deprecation)
22
+ Spree::Deprecation.warn(
23
+ "Spree::SearchProvider::#{name} is deprecated and will be removed in Spree 6.3. " \
24
+ "Use #{replacement} instead."
25
+ )
26
+ end
25
27
 
26
28
  replacement.constantize
27
29
  end