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
|
@@ -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.
|
|
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.
|
|
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(
|
|
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.
|
|
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.
|
|
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.
|
|
77
|
+
# @deprecated Use {#publish_fulfillment_fulfilled_event}; removed in 6.3.
|
|
76
78
|
def publish_shipment_shipped_event
|
|
77
|
-
Spree::Deprecation.warn(
|
|
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.
|
|
86
|
+
# @deprecated Use {#publish_fulfillment_canceled_event}; removed in 6.3.
|
|
82
87
|
def publish_shipment_canceled_event
|
|
83
|
-
Spree::Deprecation.warn(
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
284
|
+
# @deprecated Use {#add_delivery_method}; removed in 6.3.
|
|
285
285
|
def add_shipping_method(delivery_method, selected = false)
|
|
286
|
-
Spree::Deprecation.warn(
|
|
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.
|
|
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
|
|
295
|
+
# called it directly keeps working until 6.3.
|
|
294
296
|
def after_cancel
|
|
295
|
-
Spree::Deprecation.warn(
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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(
|
|
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.
|
|
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.
|
|
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.
|
|
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')
|
|
@@ -64,10 +64,10 @@ module Spree
|
|
|
64
64
|
#
|
|
65
65
|
# Ransack
|
|
66
66
|
#
|
|
67
|
-
ransack_alias :state, :status # @deprecated filter alias — removed in 6.
|
|
67
|
+
ransack_alias :state, :status # @deprecated filter alias — removed in 6.5
|
|
68
68
|
self.whitelisted_ransackable_attributes = %w[code customer_id status state gift_card_batch_id created_by_id currency expires_at]
|
|
69
69
|
search_by :code
|
|
70
|
-
# `users` is the pre-6.0 name for `customers` — removed in 6.
|
|
70
|
+
# `users` is the pre-6.0 name for `customers` — removed in 6.3.
|
|
71
71
|
self.whitelisted_ransackable_associations = %w[customers users orders batch]
|
|
72
72
|
self.whitelisted_ransackable_scopes = %w[active expired redeemed partially_redeemed]
|
|
73
73
|
self.ransackable_scope_types = %w[active expired redeemed partially_redeemed].index_with('boolean')
|
|
@@ -189,36 +189,36 @@ module Spree
|
|
|
189
189
|
end.to_s
|
|
190
190
|
end
|
|
191
191
|
|
|
192
|
-
# @deprecated use +display_status+ — removed in 6.
|
|
192
|
+
# @deprecated use +display_status+ — removed in 6.3
|
|
193
193
|
def display_state
|
|
194
|
-
Spree::Deprecation.warn('Spree::GiftCard#display_state is deprecated and will be removed in Spree 6.
|
|
194
|
+
Spree::Deprecation.warn('Spree::GiftCard#display_state is deprecated and will be removed in Spree 6.3. Use #display_status instead.')
|
|
195
195
|
display_status
|
|
196
196
|
end
|
|
197
197
|
|
|
198
|
-
# @deprecated read +status+ — removed in 6.
|
|
198
|
+
# @deprecated read +status+ — removed in 6.3
|
|
199
199
|
def state
|
|
200
|
-
Spree::Deprecation.warn('Spree::GiftCard#state is deprecated and will be removed in Spree 6.
|
|
200
|
+
Spree::Deprecation.warn('Spree::GiftCard#state is deprecated and will be removed in Spree 6.3. Use #status instead.')
|
|
201
201
|
status
|
|
202
202
|
end
|
|
203
203
|
|
|
204
|
-
# @deprecated write +status+ — removed in 6.
|
|
204
|
+
# @deprecated write +status+ — removed in 6.3
|
|
205
205
|
def state=(value)
|
|
206
|
-
Spree::Deprecation.warn('Spree::GiftCard#state= is deprecated and will be removed in Spree 6.
|
|
206
|
+
Spree::Deprecation.warn('Spree::GiftCard#state= is deprecated and will be removed in Spree 6.3. Use #status= instead.')
|
|
207
207
|
self.status = value
|
|
208
208
|
end
|
|
209
209
|
|
|
210
|
-
# @deprecated Call Spree.gift_card_redeem_workflow — removed in 6.
|
|
210
|
+
# @deprecated Call Spree.gift_card_redeem_workflow — removed in 6.3.
|
|
211
211
|
# The workflow decides full versus partial redemption from the balance,
|
|
212
212
|
# so both old verbs land on it.
|
|
213
213
|
def redeem!
|
|
214
|
-
Spree::Deprecation.warn('Spree::GiftCard#redeem! is deprecated and will be removed in Spree 6.
|
|
214
|
+
Spree::Deprecation.warn('Spree::GiftCard#redeem! is deprecated and will be removed in Spree 6.3. Call Spree.gift_card_redeem_workflow instead.')
|
|
215
215
|
run_gift_card_workflow(Spree.gift_card_redeem_workflow)
|
|
216
216
|
end
|
|
217
217
|
alias partial_redeem! redeem!
|
|
218
218
|
|
|
219
|
-
# @deprecated Call Spree.gift_card_cancel_workflow — removed in 6.
|
|
219
|
+
# @deprecated Call Spree.gift_card_cancel_workflow — removed in 6.3.
|
|
220
220
|
def cancel!
|
|
221
|
-
Spree::Deprecation.warn('Spree::GiftCard#cancel! is deprecated and will be removed in Spree 6.
|
|
221
|
+
Spree::Deprecation.warn('Spree::GiftCard#cancel! is deprecated and will be removed in Spree 6.3. Call Spree.gift_card_cancel_workflow instead.')
|
|
222
222
|
run_gift_card_workflow(Spree.gift_card_cancel_workflow)
|
|
223
223
|
end
|
|
224
224
|
|
data/app/models/spree/import.rb
CHANGED
|
@@ -157,41 +157,49 @@ module Spree
|
|
|
157
157
|
nil
|
|
158
158
|
end
|
|
159
159
|
|
|
160
|
-
# @deprecated Call the Spree::Imports workflows — removed in 6.
|
|
160
|
+
# @deprecated Call the Spree::Imports workflows — removed in 6.3.
|
|
161
161
|
def start_mapping!
|
|
162
|
-
Spree::Deprecation.warn(
|
|
162
|
+
Spree::Deprecation.warn(
|
|
163
|
+
'Spree::Import#start_mapping! is deprecated and will be removed in Spree 6.3. Call Spree.import_start_mapping_workflow instead.'
|
|
164
|
+
)
|
|
163
165
|
run_pipeline_workflow(Spree.import_start_mapping_workflow)
|
|
164
166
|
end
|
|
165
167
|
|
|
166
|
-
# @deprecated Call Spree.import_complete_mapping_workflow — removed in 6.
|
|
168
|
+
# @deprecated Call Spree.import_complete_mapping_workflow — removed in 6.3.
|
|
167
169
|
def complete_mapping!
|
|
168
|
-
Spree::Deprecation.warn(
|
|
170
|
+
Spree::Deprecation.warn(
|
|
171
|
+
'Spree::Import#complete_mapping! is deprecated and will be removed in Spree 6.3. Call Spree.import_complete_mapping_workflow instead.'
|
|
172
|
+
)
|
|
169
173
|
run_pipeline_workflow(Spree.import_complete_mapping_workflow)
|
|
170
174
|
end
|
|
171
175
|
|
|
172
|
-
# @deprecated Call Spree.import_start_processing_workflow — removed in 6.
|
|
176
|
+
# @deprecated Call Spree.import_start_processing_workflow — removed in 6.3.
|
|
173
177
|
def start_processing!
|
|
174
|
-
Spree::Deprecation.warn(
|
|
178
|
+
Spree::Deprecation.warn(
|
|
179
|
+
'Spree::Import#start_processing! is deprecated and will be removed in Spree 6.3. Call Spree.import_start_processing_workflow instead.'
|
|
180
|
+
)
|
|
175
181
|
run_pipeline_workflow(Spree.import_start_processing_workflow)
|
|
176
182
|
end
|
|
177
183
|
|
|
178
|
-
# @deprecated Call Spree.import_complete_workflow — removed in 6.
|
|
184
|
+
# @deprecated Call Spree.import_complete_workflow — removed in 6.3.
|
|
179
185
|
def complete!
|
|
180
|
-
Spree::Deprecation.warn('Spree::Import#complete! is deprecated and will be removed in Spree 6.
|
|
186
|
+
Spree::Deprecation.warn('Spree::Import#complete! is deprecated and will be removed in Spree 6.3. Call Spree.import_complete_workflow instead.')
|
|
181
187
|
run_pipeline_workflow(Spree.import_complete_workflow)
|
|
182
188
|
end
|
|
183
189
|
|
|
184
|
-
# @deprecated Set the status — removed in 6.
|
|
190
|
+
# @deprecated Set the status — removed in 6.3. Failure was never a step of
|
|
185
191
|
# its own; the controller records the parse error directly.
|
|
186
192
|
def fail!
|
|
187
|
-
Spree::Deprecation.warn('Spree::Import#fail! is deprecated and will be removed in Spree 6.
|
|
193
|
+
Spree::Deprecation.warn('Spree::Import#fail! is deprecated and will be removed in Spree 6.3. Write the status instead.')
|
|
188
194
|
update!(status: 'failed')
|
|
189
195
|
end
|
|
190
196
|
|
|
191
|
-
# @deprecated Call Spree.import_retry_failed_rows_workflow — removed in 6.
|
|
197
|
+
# @deprecated Call Spree.import_retry_failed_rows_workflow — removed in 6.3.
|
|
192
198
|
# Returns false when there is nothing to retry, as the guarded event did.
|
|
193
199
|
def retry_failed_rows
|
|
194
|
-
Spree::Deprecation.warn(
|
|
200
|
+
Spree::Deprecation.warn(
|
|
201
|
+
'Spree::Import#retry_failed_rows is deprecated and will be removed in Spree 6.3. Call Spree.import_retry_failed_rows_workflow instead.'
|
|
202
|
+
)
|
|
195
203
|
Spree.import_retry_failed_rows_workflow.call(import: self).success?
|
|
196
204
|
end
|
|
197
205
|
|
|
@@ -363,7 +371,7 @@ module Spree
|
|
|
363
371
|
|
|
364
372
|
# Who ran this import — the seller when one did, otherwise the store.
|
|
365
373
|
#
|
|
366
|
-
# @deprecated Read `seller` and `store` — removed in 6.
|
|
374
|
+
# @deprecated Read `seller` and `store` — removed in 6.3. Kept because the
|
|
367
375
|
# polymorphic `owner` shipped in 5.6 and the v3 serializer still emits
|
|
368
376
|
# `owner_type`/`owner_id` from it.
|
|
369
377
|
# @return [Spree::Seller, Spree::Store]
|
|
@@ -371,9 +379,9 @@ module Spree
|
|
|
371
379
|
seller || store
|
|
372
380
|
end
|
|
373
381
|
|
|
374
|
-
# @deprecated Assign `seller:` or `store:` — removed in 6.
|
|
382
|
+
# @deprecated Assign `seller:` or `store:` — removed in 6.3.
|
|
375
383
|
def owner=(record)
|
|
376
|
-
Spree::Deprecation.warn('Spree::Import#owner= is deprecated and will be removed in Spree 6.
|
|
384
|
+
Spree::Deprecation.warn('Spree::Import#owner= is deprecated and will be removed in Spree 6.3. Assign seller: or store: instead.')
|
|
377
385
|
|
|
378
386
|
case record
|
|
379
387
|
when Spree::Seller
|
|
@@ -80,24 +80,24 @@ module Spree
|
|
|
80
80
|
data_json[mapping.file_column]
|
|
81
81
|
end
|
|
82
82
|
|
|
83
|
-
# @deprecated Write the status — removed in 6.
|
|
83
|
+
# @deprecated Write the status — removed in 6.3. A row's lifecycle belongs
|
|
84
84
|
# to +process!+, which is the only thing that should move it.
|
|
85
85
|
def start_processing!
|
|
86
|
-
Spree::Deprecation.warn('Spree::ImportRow#start_processing! is deprecated and will be removed in Spree 6.
|
|
86
|
+
Spree::Deprecation.warn('Spree::ImportRow#start_processing! is deprecated and will be removed in Spree 6.3. Use #process! instead.')
|
|
87
87
|
update!(status: 'processing')
|
|
88
88
|
end
|
|
89
89
|
|
|
90
|
-
# @deprecated Write the status — removed in 6.
|
|
90
|
+
# @deprecated Write the status — removed in 6.3.
|
|
91
91
|
def complete!
|
|
92
|
-
Spree::Deprecation.warn('Spree::ImportRow#complete! is deprecated and will be removed in Spree 6.
|
|
92
|
+
Spree::Deprecation.warn('Spree::ImportRow#complete! is deprecated and will be removed in Spree 6.3. Use #process! instead.')
|
|
93
93
|
update!(status: 'completed')
|
|
94
94
|
publish_event('import_row.completed')
|
|
95
95
|
true
|
|
96
96
|
end
|
|
97
97
|
|
|
98
|
-
# @deprecated Write the status — removed in 6.
|
|
98
|
+
# @deprecated Write the status — removed in 6.3.
|
|
99
99
|
def fail!
|
|
100
|
-
Spree::Deprecation.warn('Spree::ImportRow#fail! is deprecated and will be removed in Spree 6.
|
|
100
|
+
Spree::Deprecation.warn('Spree::ImportRow#fail! is deprecated and will be removed in Spree 6.3. Use #process! instead.')
|
|
101
101
|
update!(status: 'failed')
|
|
102
102
|
publish_event('import_row.failed')
|
|
103
103
|
true
|
|
@@ -76,15 +76,19 @@ module Spree
|
|
|
76
76
|
expires_at < Time.current
|
|
77
77
|
end
|
|
78
78
|
|
|
79
|
-
# @deprecated Call Spree.invitation_accept_workflow — removed in 6.
|
|
79
|
+
# @deprecated Call Spree.invitation_accept_workflow — removed in 6.3.
|
|
80
80
|
def accept
|
|
81
|
-
Spree::Deprecation.warn(
|
|
81
|
+
Spree::Deprecation.warn(
|
|
82
|
+
'Spree::Invitation#accept is deprecated and will be removed in Spree 6.3. Call Spree.invitation_accept_workflow instead.'
|
|
83
|
+
)
|
|
82
84
|
Spree.invitation_accept_workflow.call(invitation: self).success?
|
|
83
85
|
end
|
|
84
86
|
|
|
85
|
-
# @deprecated Call Spree.invitation_accept_workflow — removed in 6.
|
|
87
|
+
# @deprecated Call Spree.invitation_accept_workflow — removed in 6.3.
|
|
86
88
|
def accept!
|
|
87
|
-
Spree::Deprecation.warn(
|
|
89
|
+
Spree::Deprecation.warn(
|
|
90
|
+
'Spree::Invitation#accept! is deprecated and will be removed in Spree 6.3. Call Spree.invitation_accept_workflow instead.'
|
|
91
|
+
)
|
|
88
92
|
result = Spree.invitation_accept_workflow.call(invitation: self)
|
|
89
93
|
|
|
90
94
|
if result.failure?
|
|
@@ -120,9 +124,13 @@ module Spree
|
|
|
120
124
|
# the way the account's email uniqueness is, case-insensitively, so an
|
|
121
125
|
# address typed in another case still finds the one account it can belong
|
|
122
126
|
# to. Resolved by record rather than by comparing strings in Ruby, whose
|
|
123
|
-
# case folding is wider than the database's.
|
|
127
|
+
# case folding is wider than the database's. Failing that, an exact match
|
|
128
|
+
# through the model, so an app that encrypts email still finds the account.
|
|
124
129
|
def invitee_account
|
|
125
|
-
|
|
130
|
+
return if email.blank?
|
|
131
|
+
|
|
132
|
+
Spree.admin_user_class.where('LOWER(email) = LOWER(?)', email).first ||
|
|
133
|
+
Spree.admin_user_class.find_by(email: email)
|
|
126
134
|
end
|
|
127
135
|
|
|
128
136
|
private
|
|
@@ -106,15 +106,15 @@ module Spree
|
|
|
106
106
|
# (admin add-to-this-fulfillment flows).
|
|
107
107
|
attr_accessor :target_fulfillment
|
|
108
108
|
|
|
109
|
-
# @deprecated Use {#target_fulfillment}; removed in 6.
|
|
109
|
+
# @deprecated Use {#target_fulfillment}; removed in 6.3.
|
|
110
110
|
def target_shipment
|
|
111
|
-
Spree::Deprecation.warn('Spree::LineItem#target_shipment is deprecated and will be removed in Spree 6.
|
|
111
|
+
Spree::Deprecation.warn('Spree::LineItem#target_shipment is deprecated and will be removed in Spree 6.3. Use #target_fulfillment instead.')
|
|
112
112
|
target_fulfillment
|
|
113
113
|
end
|
|
114
114
|
|
|
115
|
-
# @deprecated Use {#target_fulfillment=}; removed in 6.
|
|
115
|
+
# @deprecated Use {#target_fulfillment=}; removed in 6.3.
|
|
116
116
|
def target_shipment=(value)
|
|
117
|
-
Spree::Deprecation.warn('Spree::LineItem#target_shipment= is deprecated and will be removed in Spree 6.
|
|
117
|
+
Spree::Deprecation.warn('Spree::LineItem#target_shipment= is deprecated and will be removed in Spree 6.3. Use #target_fulfillment= instead.')
|
|
118
118
|
self.target_fulfillment = value
|
|
119
119
|
end
|
|
120
120
|
|
|
@@ -347,15 +347,17 @@ module Spree
|
|
|
347
347
|
end
|
|
348
348
|
end
|
|
349
349
|
|
|
350
|
-
# @deprecated Use {#delivery_cost}; removed in 6.
|
|
350
|
+
# @deprecated Use {#delivery_cost}; removed in 6.3.
|
|
351
351
|
def shipping_cost
|
|
352
|
-
Spree::Deprecation.warn('Spree::LineItem#shipping_cost is deprecated and will be removed in Spree 6.
|
|
352
|
+
Spree::Deprecation.warn('Spree::LineItem#shipping_cost is deprecated and will be removed in Spree 6.3. Use #delivery_cost instead.')
|
|
353
353
|
delivery_cost
|
|
354
354
|
end
|
|
355
355
|
|
|
356
|
-
# @deprecated Use {#display_delivery_cost}; removed in 6.
|
|
356
|
+
# @deprecated Use {#display_delivery_cost}; removed in 6.3.
|
|
357
357
|
def display_shipping_cost
|
|
358
|
-
Spree::Deprecation.warn(
|
|
358
|
+
Spree::Deprecation.warn(
|
|
359
|
+
'Spree::LineItem#display_shipping_cost is deprecated and will be removed in Spree 6.3. Use #display_delivery_cost instead.'
|
|
360
|
+
)
|
|
359
361
|
display_delivery_cost
|
|
360
362
|
end
|
|
361
363
|
|
data/app/models/spree/media.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
module Spree
|
|
2
2
|
# Merchandising media for commerce entities — product photography, variant
|
|
3
3
|
# shots, product video. Renamed from Spree::Asset in 6.0; Spree::Asset stays
|
|
4
|
-
# readable as a deprecated alias
|
|
4
|
+
# readable as a deprecated alias until 6.3.
|
|
5
5
|
class Media < Spree.base_class
|
|
6
6
|
has_prefix_id :media
|
|
7
7
|
|
|
@@ -82,7 +82,31 @@ module Spree
|
|
|
82
82
|
)
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
self.whitelisted_ransackable_attributes = %w[alt media_type created_at updated_at]
|
|
85
|
+
self.whitelisted_ransackable_attributes = %w[alt media_type created_at updated_at filename byte_size]
|
|
86
|
+
|
|
87
|
+
# The attached file's name and size, so a library can be listed by them.
|
|
88
|
+
# They live on the blob, not the asset row, hence a subquery per row.
|
|
89
|
+
ransacker :filename do |parent|
|
|
90
|
+
attached_blob_column(parent, :filename)
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
ransacker :byte_size, type: :integer do |parent|
|
|
94
|
+
attached_blob_column(parent, :byte_size)
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def self.attached_blob_column(parent, column)
|
|
98
|
+
blobs = ActiveStorage::Blob.arel_table
|
|
99
|
+
attachments = ActiveStorage::Attachment.arel_table
|
|
100
|
+
Arel::Nodes::Grouping.new(
|
|
101
|
+
blobs.project(blobs[column]).
|
|
102
|
+
join(attachments).on(attachments[:blob_id].eq(blobs[:id])).
|
|
103
|
+
where(attachments[:record_type].eq(polymorphic_name)).
|
|
104
|
+
where(attachments[:record_id].eq(parent.table[:id])).
|
|
105
|
+
where(attachments[:name].eq('attachment')).
|
|
106
|
+
take(1)
|
|
107
|
+
)
|
|
108
|
+
end
|
|
109
|
+
private_class_method :attached_blob_column
|
|
86
110
|
self.whitelisted_ransackable_scopes = %w[attached unattached filename_cont]
|
|
87
111
|
self.ransackable_scope_types = { 'attached' => 'boolean', 'unattached' => 'boolean' }
|
|
88
112
|
|
|
@@ -157,7 +181,7 @@ module Spree
|
|
|
157
181
|
default_scope { includes(attachment_attachment: :blob, poster_attachment: :blob) }
|
|
158
182
|
|
|
159
183
|
# `type` is a vestige of the old Spree::Image/Spree::Video STI —
|
|
160
|
-
# media_type is the discriminator now. The column drops in 6.
|
|
184
|
+
# media_type is the discriminator now. The column drops in 6.3.
|
|
161
185
|
self.inheritance_column = nil
|
|
162
186
|
|
|
163
187
|
store_accessor :metadata, :session_uploaded_assets_uuid
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
module Spree
|
|
4
4
|
# Deprecation alias for Spree::CustomField, renamed from Spree::Metafield 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 warn on first reference and name the calling site, but it fails
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
module Spree
|
|
4
4
|
# Deprecation alias for Spree::CustomFieldDefinition, renamed from
|
|
5
|
-
# Spree::MetafieldDefinition in 6.0. Retained
|
|
5
|
+
# Spree::MetafieldDefinition in 6.0. Retained until 6.3.
|
|
6
6
|
# A plain constant alias for the same reason as {Spree::Metafield}.
|
|
7
7
|
#
|
|
8
8
|
# Note the columns renamed alongside the class: `name` is now `label`,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
module Spree
|
|
4
4
|
# Deprecation bridge for the 6.0 custom-fields rename. Serves the two roles
|
|
5
|
-
# the old `Spree::Metafields` name had, and is removed in 6.
|
|
5
|
+
# the old `Spree::Metafields` name had, and is removed in 6.3:
|
|
6
6
|
#
|
|
7
7
|
# 1. The concern — `include Spree::Metafields` still works and gives a model
|
|
8
8
|
# the full custom-fields surface via {Spree::HasCustomFields}.
|
|
@@ -22,7 +22,7 @@ module Spree
|
|
|
22
22
|
|
|
23
23
|
included do
|
|
24
24
|
Spree::Deprecation.warn(
|
|
25
|
-
|
|
25
|
+
'include Spree::Metafields is deprecated and will be removed in Spree 6.3. ' \
|
|
26
26
|
"Use include Spree::HasCustomFields instead (#{name})."
|
|
27
27
|
)
|
|
28
28
|
|
|
@@ -23,6 +23,32 @@ module Spree
|
|
|
23
23
|
:option_values
|
|
24
24
|
end
|
|
25
25
|
|
|
26
|
+
# The option names and values a write asks for that the store does not
|
|
27
|
+
# offer, matched as `Variant#set_option_value` matches them. A seller
|
|
28
|
+
# builds variants from these and never adds to them.
|
|
29
|
+
#
|
|
30
|
+
# @param store [Spree::Store]
|
|
31
|
+
# @param pairs [Array<Array(String, String)>] option type names and value names
|
|
32
|
+
# @return [Array<Hash>] one `{ name:, value:, option_type: }` per unknown pair;
|
|
33
|
+
# `option_type` is nil when the type itself is unknown
|
|
34
|
+
def self.unknown_options(store, pairs)
|
|
35
|
+
pairs = pairs.map { |name, value| [name.to_s, value.to_s] }.uniq { |name, value| [name.parameterize, value.parameterize] }
|
|
36
|
+
return [] if pairs.empty?
|
|
37
|
+
|
|
38
|
+
option_types = for_store(store).where(name: pairs.map { |name, _| name.parameterize }.uniq).index_by(&:name)
|
|
39
|
+
# Only the values named, not every value of each type: Size can carry hundreds.
|
|
40
|
+
known_values = Spree::OptionValue.where(option_type_id: option_types.values.map(&:id),
|
|
41
|
+
name: pairs.map { |_, value| value.parameterize }.uniq).
|
|
42
|
+
pluck(:option_type_id, :name).to_set
|
|
43
|
+
|
|
44
|
+
pairs.filter_map do |name, value|
|
|
45
|
+
option_type = option_types[name.parameterize]
|
|
46
|
+
next if option_type && known_values.include?([option_type.id, value.parameterize])
|
|
47
|
+
|
|
48
|
+
{ name: name, value: value, option_type: option_type }
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
26
52
|
#
|
|
27
53
|
# Magic methods
|
|
28
54
|
#
|