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
|
@@ -32,7 +32,7 @@ module Spree
|
|
|
32
32
|
if shipment || shipment_attributes
|
|
33
33
|
Spree::Deprecation.warn(
|
|
34
34
|
'Calling Spree::Fulfillments::Update with shipment:/shipment_attributes: keywords is deprecated ' \
|
|
35
|
-
'and will be removed in Spree 6.
|
|
35
|
+
'and will be removed in Spree 6.3. Use fulfillment:/fulfillment_attributes: instead.'
|
|
36
36
|
)
|
|
37
37
|
end
|
|
38
38
|
|
|
@@ -33,7 +33,9 @@ module Spree
|
|
|
33
33
|
super
|
|
34
34
|
|
|
35
35
|
unless restock_items.nil?
|
|
36
|
-
Spree::Deprecation.warn(
|
|
36
|
+
Spree::Deprecation.warn(
|
|
37
|
+
'Spree::Orders::Cancel no longer accepts restock_items — it never changed behavior and will be removed in Spree 6.3.'
|
|
38
|
+
)
|
|
37
39
|
end
|
|
38
40
|
|
|
39
41
|
step :ensure_cancellable
|
|
@@ -17,7 +17,7 @@ module Spree
|
|
|
17
17
|
# @param amount [BigDecimal, nil] in the currency's own units; nil
|
|
18
18
|
# captures in full, a smaller amount splits the remainder into a new
|
|
19
19
|
# pending payment. An Integer is read as hundredths of the currency,
|
|
20
|
-
# the pre-6.0 contract (deprecated, removed in 6.
|
|
20
|
+
# the pre-6.0 contract (deprecated, removed in 6.5).
|
|
21
21
|
def perform(payment:, amount: nil)
|
|
22
22
|
super
|
|
23
23
|
@amount = capture_amount(amount)
|
|
@@ -53,7 +53,7 @@ module Spree
|
|
|
53
53
|
|
|
54
54
|
Spree::Deprecation.warn(
|
|
55
55
|
'Passing an Integer amount to the payment capture workflow is deprecated and is read as hundredths of ' \
|
|
56
|
-
'the currency. Pass the amount in the currency\'s own units as a BigDecimal; removed in Spree 6.
|
|
56
|
+
'the currency. Pass the amount in the currency\'s own units as a BigDecimal; removed in Spree 6.3.'
|
|
57
57
|
)
|
|
58
58
|
Spree::Money::Rounding.from_hundredths(amount)
|
|
59
59
|
end
|
|
@@ -54,9 +54,13 @@ module Spree
|
|
|
54
54
|
# banks), and the capture webhook that follows must still be able to
|
|
55
55
|
# complete its payment. Not halt! — that is forbidden inside a
|
|
56
56
|
# transaction (there is nothing committed to halt with).
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
#
|
|
58
|
+
# Completing the owner is checked on its own, not folded into that
|
|
59
|
+
# guard: a payment can be completed (a synchronous confirmation, an
|
|
60
|
+
# earlier delivery) while the order is not, and a redelivery or job
|
|
61
|
+
# retry must still place the order or the buyer stays charged
|
|
62
|
+
# without one.
|
|
63
|
+
step :ensure_payment unless payment_session.reload.payment&.completed?
|
|
60
64
|
step :complete_session
|
|
61
65
|
step :complete_owner unless order.reload.completed?
|
|
62
66
|
end
|
|
@@ -9,7 +9,7 @@ module Spree
|
|
|
9
9
|
#
|
|
10
10
|
# Idempotent by the unique index on `(order_id) WHERE kind = 'earning'` —
|
|
11
11
|
# the fulfillment event can fire more than once (it is dual-emitted under a
|
|
12
|
-
# legacy name
|
|
12
|
+
# legacy name until 6.5), and a re-fired event must find the earning
|
|
13
13
|
# that exists rather than credit the seller twice.
|
|
14
14
|
class Create < Spree::Workflow
|
|
15
15
|
hooks :validate, :after_create
|
|
@@ -2,6 +2,11 @@ module Spree
|
|
|
2
2
|
module Sellers
|
|
3
3
|
# Lets a seller trade. Also the way back for one that was suspended or
|
|
4
4
|
# turned down, which is why the guard admits more than the linear path.
|
|
5
|
+
#
|
|
6
|
+
# A seller the operator created and never invited (or whose invitation is
|
|
7
|
+
# still open) can be admitted too, but only with `override_requirements`:
|
|
8
|
+
# the operator is skipping onboarding altogether, so it must be as
|
|
9
|
+
# deliberate — and as visible on the event — as skipping the checklist.
|
|
5
10
|
class Approve < Spree::Workflow
|
|
6
11
|
hooks :validate, :after_approve
|
|
7
12
|
|
|
@@ -40,6 +45,7 @@ module Spree
|
|
|
40
45
|
|
|
41
46
|
return if seller.onboarding? || seller.ready_for_review? ||
|
|
42
47
|
seller.suspended? || seller.rejected?
|
|
48
|
+
return if override_requirements && (seller.pending? || seller.invited?)
|
|
43
49
|
|
|
44
50
|
failure(seller, :not_approvable)
|
|
45
51
|
end
|
|
@@ -53,14 +53,17 @@ module Spree
|
|
|
53
53
|
# location in the marketplace needs to see. `default` is per-owner, so
|
|
54
54
|
# this is the default among *this seller's* locations and leaves the
|
|
55
55
|
# operator's own alone.
|
|
56
|
+
#
|
|
57
|
+
# A seller created with a returns address already has its location, so
|
|
58
|
+
# that one becomes the default rather than a second being made.
|
|
56
59
|
def provision_stock_location
|
|
57
|
-
@stock_location = seller.stock_locations.new(
|
|
60
|
+
@stock_location = seller.stock_locations.first || seller.stock_locations.new(
|
|
58
61
|
store: seller.store,
|
|
59
62
|
name: seller.name,
|
|
60
|
-
default: true,
|
|
61
63
|
active: true,
|
|
62
64
|
country_code: seller.store.default_country_code
|
|
63
65
|
)
|
|
66
|
+
@stock_location.default = true
|
|
64
67
|
# A new seller has no catalog, so there is nothing to propagate — the
|
|
65
68
|
# levels arrive with their products.
|
|
66
69
|
@stock_location.propagate_all_variants = false
|
|
@@ -13,8 +13,7 @@ module Spree
|
|
|
13
13
|
# external system knows. The movement records the delta between what Spree
|
|
14
14
|
# held and what the feed says.
|
|
15
15
|
class BulkUpsert < Spree::Workflow
|
|
16
|
-
|
|
17
|
-
# What the stock history shows against a movement this service wrote.
|
|
16
|
+
# What the stock history shows against a movement whose row gave no reason.
|
|
18
17
|
FEED_REASON = 'inventory_feed'.freeze
|
|
19
18
|
|
|
20
19
|
# @param store [Spree::Store] whose shelves these are. Ids are resolved
|
|
@@ -23,11 +22,13 @@ module Spree
|
|
|
23
22
|
# @param rows [Array<Hash>] one per shelf: +variant_id+ and
|
|
24
23
|
# +stock_location_id+ naming it (prefixed ids, or raw), then either
|
|
25
24
|
# +count_on_hand+ (the figure it should end at) or +adjustment+ (a
|
|
26
|
-
# signed change); +backorderable+ optional
|
|
27
|
-
# @return [Spree::ServiceModule::Result] +{ stock_level_count: N }
|
|
25
|
+
# signed change); +backorderable+ and +reason+ optional
|
|
26
|
+
# @return [Spree::ServiceModule::Result] +{ stock_level_count: N }+, or a
|
|
27
|
+
# failure naming the first row a record refused, by its position in
|
|
28
|
+
# +rows+; nothing is written then
|
|
28
29
|
def perform(store:, rows:)
|
|
29
30
|
@store = store
|
|
30
|
-
rows = resolve(Array(rows).map { |row| row.with_indifferent_access })
|
|
31
|
+
rows = resolve(Array(rows).each_with_index.map { |row, index| row.with_indifferent_access.merge(index: index) })
|
|
31
32
|
keyed = rows.select { |row| row[:variant_id].present? && row[:stock_location_id].present? }
|
|
32
33
|
return success(stock_level_count: 0) if keyed.empty?
|
|
33
34
|
|
|
@@ -38,7 +39,11 @@ module Spree
|
|
|
38
39
|
existing = existing_stock_levels(deduped)
|
|
39
40
|
count = 0
|
|
40
41
|
Spree::StockLevel.transaction do
|
|
41
|
-
deduped.each
|
|
42
|
+
deduped.each do |row|
|
|
43
|
+
count += 1 if apply_row(row, existing)
|
|
44
|
+
rescue ActiveRecord::RecordInvalid => e
|
|
45
|
+
reject_row(row, e.record.errors)
|
|
46
|
+
end
|
|
42
47
|
end
|
|
43
48
|
|
|
44
49
|
success(stock_level_count: count)
|
|
@@ -110,7 +115,7 @@ module Spree
|
|
|
110
115
|
stock_level: stock_level,
|
|
111
116
|
count_on_hand: row[:count_on_hand],
|
|
112
117
|
adjustment: row[:adjustment],
|
|
113
|
-
reason: FEED_REASON
|
|
118
|
+
reason: row[:reason].presence || FEED_REASON
|
|
114
119
|
)
|
|
115
120
|
# A feed that states a figure Spree cannot read means a typo, and a
|
|
116
121
|
# typo must be refused rather than obeyed: `to_i` would zero a shelf
|
|
@@ -119,6 +124,13 @@ module Spree
|
|
|
119
124
|
|
|
120
125
|
result.value.count_on_hand != before
|
|
121
126
|
end
|
|
127
|
+
|
|
128
|
+
# Raised inside the transaction, so every row before this one rolls back.
|
|
129
|
+
def reject_row(row, errors)
|
|
130
|
+
failure(nil, code: 'invalid_stock_levels',
|
|
131
|
+
message: "Row #{row[:index]}: #{errors.full_messages.to_sentence}",
|
|
132
|
+
rows: [{ index: row[:index], errors: errors.messages }])
|
|
133
|
+
end
|
|
122
134
|
end
|
|
123
135
|
end
|
|
124
136
|
end
|
data/config/locales/be.yml
CHANGED
|
@@ -446,7 +446,7 @@ be:
|
|
|
446
446
|
not_locked: не быў заблакаваны
|
|
447
447
|
not_saved:
|
|
448
448
|
many: "%{count} памылак перашкаджаюць захаванню %{resource}:"
|
|
449
|
-
one:
|
|
449
|
+
one: "%{count} памылка перашкаджае захаванню %{resource}:"
|
|
450
450
|
other: "%{count} памылкі перашкаджаюць захаванню %{resource}:"
|
|
451
451
|
number:
|
|
452
452
|
percentage:
|
data/config/locales/en.yml
CHANGED
|
@@ -926,6 +926,8 @@ en:
|
|
|
926
926
|
store_is_already_set: Store is already set
|
|
927
927
|
unknown_calculator_type: "%{type} is not a calculator offered here"
|
|
928
928
|
unknown_custom_field_type: 'is not a known custom field type (expected one of: %{types})'
|
|
929
|
+
unknown_option_type: names %{name}, which is not one of the marketplace's option types
|
|
930
|
+
unknown_option_value: names %{value}, which is not one of the values of %{option_type}
|
|
929
931
|
unknown_row_type: "%{type} is not a %{family} offered here (expected one of: %{types})"
|
|
930
932
|
unknown_scopes: 'contains unknown scopes: %{scopes}'
|
|
931
933
|
unregistered_actor: is not a registered actor class
|
|
@@ -1021,6 +1023,7 @@ en:
|
|
|
1021
1023
|
subject: Invitation to join %{resource_name}
|
|
1022
1024
|
invitation_not_acceptable: Invitation not found, expired, or already accepted.
|
|
1023
1025
|
invitation_role_resource_mismatch: must belong to the same store or seller as the invitation
|
|
1026
|
+
invitation_seller_rejected: This seller was rejected, so nobody can join its team.
|
|
1024
1027
|
iso: ISO Alpha-2
|
|
1025
1028
|
item: Item
|
|
1026
1029
|
items_cannot_be_shipped: We are unable to calculate shipping rates for the selected items.
|
|
@@ -1200,6 +1203,8 @@ en:
|
|
|
1200
1203
|
privacy_policy: Privacy Policy
|
|
1201
1204
|
processing: Processing
|
|
1202
1205
|
product: Product
|
|
1206
|
+
product_import_unknown_option_type: The marketplace has no option type named %{name}.
|
|
1207
|
+
product_import_unknown_option_value: "%{option_type} has no value named %{value}."
|
|
1203
1208
|
product_import_unknown_stock_location: You have no stock location named %{name}.
|
|
1204
1209
|
product_translations: Product Translations
|
|
1205
1210
|
products: Products
|
|
@@ -1654,6 +1659,13 @@ en:
|
|
|
1654
1659
|
name: Billing address
|
|
1655
1660
|
complete_profile:
|
|
1656
1661
|
description: Fill in the public profile shoppers see
|
|
1662
|
+
fields:
|
|
1663
|
+
about: a description
|
|
1664
|
+
contact_email: a contact email
|
|
1665
|
+
cover_photo: a cover photo
|
|
1666
|
+
logo: a logo
|
|
1667
|
+
name: a name
|
|
1668
|
+
missing: 'Still missing: %{fields}.'
|
|
1657
1669
|
name: Complete profile
|
|
1658
1670
|
delivery_method:
|
|
1659
1671
|
description: Offer at least one way to ship your orders
|
data/config/locales/fr.yml
CHANGED
|
@@ -418,7 +418,7 @@ fr:
|
|
|
418
418
|
not_found: Non trouvé(e)
|
|
419
419
|
not_locked: n'est pas bloqué
|
|
420
420
|
not_saved:
|
|
421
|
-
one: "%{resource} n'a pu etre sauvegardé à cause
|
|
421
|
+
one: "%{resource} n'a pu etre sauvegardé à cause de %{count} erreur:"
|
|
422
422
|
other: "%{resource} n'a pu etre sauvegardé à cause de %{count} erreurs:"
|
|
423
423
|
number:
|
|
424
424
|
percentage:
|
data/config/locales/lt.yml
CHANGED
|
@@ -418,7 +418,7 @@ lt:
|
|
|
418
418
|
not_found: nerastas
|
|
419
419
|
not_locked: nebuvo užrakinta
|
|
420
420
|
not_saved:
|
|
421
|
-
one:
|
|
421
|
+
one: "%{count} klaida neleido išsaugoti %{resource}:"
|
|
422
422
|
other: "%{count} klaidos neleido išsaugoti %{resource}:"
|
|
423
423
|
number:
|
|
424
424
|
percentage:
|
data/config/locales/ru.yml
CHANGED
|
@@ -426,7 +426,7 @@ ru:
|
|
|
426
426
|
not_locked: не был заблокирован
|
|
427
427
|
not_saved:
|
|
428
428
|
many: "%{count} ошибок препятствуют сохранению %{resource}:"
|
|
429
|
-
one:
|
|
429
|
+
one: "%{count} ошибка препятствует сохранению %{resource}:"
|
|
430
430
|
other: "%{count} ошибки препятствуют сохранению %{resource}:"
|
|
431
431
|
number:
|
|
432
432
|
percentage:
|
data/config/locales/uk.yml
CHANGED
|
@@ -419,7 +419,7 @@ uk:
|
|
|
419
419
|
not_saved:
|
|
420
420
|
few: "%{count} помилки завадили збереженню цього %{resource}:"
|
|
421
421
|
many: "%{count} помилок завадили збереженню цього %{resource}:"
|
|
422
|
-
one:
|
|
422
|
+
one: "%{count} помилка завадила збереженню цього %{resource}:"
|
|
423
423
|
other: "%{count} помилки завадили збереженню цього %{resource}:"
|
|
424
424
|
number:
|
|
425
425
|
percentage:
|
|
@@ -3,22 +3,26 @@ class FixSpreeStockItemUniqueIndex < ActiveRecord::Migration[6.1]
|
|
|
3
3
|
remove_index :spree_stock_items, name: 'stock_item_by_loc_var_id_deleted_at' if index_exists?(:spree_stock_items, [:stock_location_id, :variant_id], name: 'stock_item_by_loc_var_id_deleted_at')
|
|
4
4
|
|
|
5
5
|
unless index_exists?(:spree_stock_items, ['variant_id', 'stock_location_id'], name: 'index_spree_stock_items_unique_without_deleted_at')
|
|
6
|
-
# MySQL
|
|
7
|
-
|
|
6
|
+
# MySQL and MariaDB don't support partial indexes, and MariaDB rejects
|
|
7
|
+
# functional key parts too. Index a stored generated column instead,
|
|
8
|
+
# which both accept.
|
|
9
|
+
if Spree.mysql?
|
|
8
10
|
reversible do |dir|
|
|
9
11
|
dir.up do
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
unless column_exists?(:spree_stock_items, :live_key)
|
|
13
|
+
execute <<-SQL.squish
|
|
14
|
+
ALTER TABLE spree_stock_items
|
|
15
|
+
ADD COLUMN live_key TINYINT
|
|
16
|
+
AS (IF(deleted_at IS NULL, 1, NULL)) STORED
|
|
17
|
+
SQL
|
|
18
|
+
end
|
|
19
|
+
add_index :spree_stock_items, %w[stock_location_id variant_id live_key],
|
|
20
|
+
name: 'index_spree_stock_items_unique_without_deleted_at', unique: true
|
|
18
21
|
end
|
|
19
22
|
|
|
20
23
|
dir.down do
|
|
21
24
|
remove_index :spree_stock_items, name: :index_spree_stock_items_unique_without_deleted_at
|
|
25
|
+
remove_column :spree_stock_items, :live_key if column_exists?(:spree_stock_items, :live_key)
|
|
22
26
|
end
|
|
23
27
|
end
|
|
24
28
|
else
|
|
@@ -7,7 +7,7 @@ class RenameTaxonsToCategories < ActiveRecord::Migration[7.2]
|
|
|
7
7
|
# Promotion↔category join (Spree::PromotionRuleCategory) and the Mobility
|
|
8
8
|
# translations table follow the same rename now, so no class needs a
|
|
9
9
|
# table_name/foreign_key pin. (spree_taxon_rules + spree_prototype_taxons keep
|
|
10
|
-
# taxon_id: the former is dropped in 6.
|
|
10
|
+
# taxon_id: the former is dropped in 6.3, the latter renamed by 6.0-product-types.)
|
|
11
11
|
rename_table :spree_promotion_rule_taxons, :spree_promotion_rule_categories
|
|
12
12
|
rename_column :spree_promotion_rule_categories, :taxon_id, :category_id
|
|
13
13
|
|
|
@@ -48,7 +48,7 @@ class RenameShippingToFulfillmentAndDelivery < ActiveRecord::Migration[7.2]
|
|
|
48
48
|
rename_column :spree_orders, :shipment_state, :fulfillment_status
|
|
49
49
|
rename_column :spree_orders, :shipment_total, :delivery_total
|
|
50
50
|
|
|
51
|
-
# Authoritative from 6.0; display_on stays readable until the 6.
|
|
51
|
+
# Authoritative from 6.0; display_on stays readable until the 6.3 drop.
|
|
52
52
|
# Existing rows get their real value from the spree:migrate_shipping_to_delivery
|
|
53
53
|
# data task, which runs after this migration.
|
|
54
54
|
add_column :spree_delivery_methods, :storefront_visible, :boolean, null: false, default: true
|
|
@@ -4,7 +4,7 @@ class AddStoreIdToSpreeTaxRatesAndCategories < ActiveRecord::Migration[8.1]
|
|
|
4
4
|
# configuration, so they belong to a store like every other commerce
|
|
5
5
|
# setting. Kept null: true here; existing rows are backfilled by
|
|
6
6
|
# `spree:backfill_tax_store_ids` and presence is enforced on the model.
|
|
7
|
-
# The NOT NULL constraints land in 6.
|
|
7
|
+
# The NOT NULL constraints land in 6.3.
|
|
8
8
|
add_reference :spree_tax_rates, :store, null: true
|
|
9
9
|
add_reference :spree_tax_categories, :store, null: true
|
|
10
10
|
|
|
@@ -15,7 +15,7 @@ class AddCountryStateCodesToConsumers < ActiveRecord::Migration[7.2]
|
|
|
15
15
|
add_index :spree_market_countries, [:market_id, :country_code],
|
|
16
16
|
unique: true, name: 'index_spree_market_countries_on_market_id_and_country_code'
|
|
17
17
|
|
|
18
|
-
# The country foreign key stays until 6.
|
|
18
|
+
# The country foreign key stays until 6.3 so the upgrade task keeps its
|
|
19
19
|
# source data, but nothing writes it any more — a market country is
|
|
20
20
|
# identified by its ISO code now.
|
|
21
21
|
change_column_null :spree_market_countries, :country_id, true
|
|
@@ -32,7 +32,7 @@ class RenameMetafieldsToCustomFields < ActiveRecord::Migration[7.2]
|
|
|
32
32
|
# column (docs/plans/6.0-rich-text-descriptions.md). Action Text keys rows
|
|
33
33
|
# by the owner's STI base class, so they are found under the pre-rename
|
|
34
34
|
# class name. The source rows are left in place as the rollback path; the
|
|
35
|
-
# table is dropped in 6.
|
|
35
|
+
# table is dropped in 6.3.
|
|
36
36
|
copy_action_text_bodies_into_values
|
|
37
37
|
|
|
38
38
|
# display_on (both/front_end/back_end) collapses to a boolean. Only
|
|
@@ -10,7 +10,7 @@ class PromoteShippingCategoriesToDeliveryProfiles < ActiveRecord::Migration[8.1]
|
|
|
10
10
|
rename_column :spree_products, :shipping_category_id, :delivery_profile_id
|
|
11
11
|
|
|
12
12
|
# Nullable until the upgrade task assigns stores to 5.x rows; tightened
|
|
13
|
-
# in 6.
|
|
13
|
+
# in 6.3.
|
|
14
14
|
add_reference :spree_delivery_profiles, :store, index: true
|
|
15
15
|
add_column :spree_delivery_profiles, :default, :boolean, null: false, default: false
|
|
16
16
|
# STI: profile kinds declare behavior (Shipping, Digital, extension
|
|
@@ -10,7 +10,7 @@ class AddDeliveryTrackingToFulfillments < ActiveRecord::Migration[8.1]
|
|
|
10
10
|
add_column :spree_fulfillments, :delivered_at, :datetime
|
|
11
11
|
|
|
12
12
|
# `tracking` is the 5.6 column spree:migrate_deliveries reads; it is
|
|
13
|
-
# dropped in 6.
|
|
13
|
+
# dropped in 6.3 once every row has its delivery.
|
|
14
14
|
add_index :spree_fulfillments, :tracking
|
|
15
15
|
add_index :spree_fulfillments, :status
|
|
16
16
|
end
|
|
@@ -54,19 +54,25 @@ class RenameStockItemsToStockLevels < ActiveRecord::Migration[8.1]
|
|
|
54
54
|
# cannot honour is dropped without complaint, leaving a unique index over the
|
|
55
55
|
# wrong set of rows.
|
|
56
56
|
def rename_partial_uniqueness_index(from:, to:)
|
|
57
|
+
# Hosts that got the index through the generated column keep it as it is.
|
|
58
|
+
# Only the index changes name, as MariaDB cannot rebuild the expression form.
|
|
59
|
+
if column_exists?(:spree_stock_levels, :live_key)
|
|
60
|
+
rename_index :spree_stock_levels, from, to
|
|
61
|
+
return
|
|
62
|
+
end
|
|
63
|
+
|
|
57
64
|
remove_index :spree_stock_levels, name: from
|
|
58
65
|
|
|
59
66
|
if connection.supports_partial_index?
|
|
60
67
|
add_index :spree_stock_levels, %w[variant_id stock_location_id], name: to, unique: true, where: 'deleted_at IS NULL'
|
|
61
68
|
else
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
(COALESCE(deleted_at, CAST('1970-01-01' AS DATETIME)))
|
|
68
|
-
);
|
|
69
|
+
# MariaDB rejects an expression in the key, so index a stored generated column.
|
|
70
|
+
execute <<~SQL.squish
|
|
71
|
+
ALTER TABLE spree_stock_levels
|
|
72
|
+
ADD COLUMN live_key TINYINT
|
|
73
|
+
AS (IF(deleted_at IS NULL, 1, NULL)) STORED
|
|
69
74
|
SQL
|
|
75
|
+
add_index :spree_stock_levels, %w[stock_location_id variant_id live_key], name: to, unique: true
|
|
70
76
|
end
|
|
71
77
|
end
|
|
72
78
|
end
|
|
@@ -9,7 +9,7 @@ class AddStoreToSpreeMedia < ActiveRecord::Migration[8.1]
|
|
|
9
9
|
# to scope the library index without it.
|
|
10
10
|
#
|
|
11
11
|
# Existing rows are filled in by spree:upgrade:backfill_media_store_ids.
|
|
12
|
-
# The NOT NULL constraint waits for 6.
|
|
12
|
+
# The NOT NULL constraint waits for 6.3, once that task has had a release
|
|
13
13
|
# to run everywhere.
|
|
14
14
|
add_reference :spree_media, :store, index: true
|
|
15
15
|
end
|
|
@@ -32,7 +32,7 @@ class UnifyImportAndExportTenancy < ActiveRecord::Migration[8.1]
|
|
|
32
32
|
add_index :spree_imports, [:store_id, :seller_id]
|
|
33
33
|
add_index :spree_exports, [:store_id, :seller_id]
|
|
34
34
|
|
|
35
|
-
# `owner_type`/`owner_id` survive to 6.
|
|
35
|
+
# `owner_type`/`owner_id` survive to 6.3 as the backfill's source and its
|
|
36
36
|
# rollback path, and `Import#owner` keeps reading through them for one
|
|
37
37
|
# release. `null: false` on the new store_id waits for the same release,
|
|
38
38
|
# once spree:upgrade:backfill_import_export_tenancy has run everywhere.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Whether tax sits inside a price is the market's setting now, and the column is
|
|
2
2
|
# read once by `spree:markets:backfill_tax_inclusive`. New rates leave it empty,
|
|
3
3
|
# so that step, which every later upgrade runs again, never mistakes one for a
|
|
4
|
-
# rate whose tax was added on top. The column is dropped in 6.
|
|
4
|
+
# rate whose tax was added on top. The column is dropped in 6.3.
|
|
5
5
|
class RemoveDefaultFromSpreeTaxRatesIncludedInPrice < ActiveRecord::Migration[8.1]
|
|
6
6
|
def change
|
|
7
7
|
change_column_default :spree_tax_rates, :included_in_price, from: false, to: nil
|
data/lib/spree/agent_tool.rb
CHANGED
|
@@ -24,8 +24,8 @@ class AgentTool
|
|
|
24
24
|
# The parameter every generic resource tool takes for a resource that
|
|
25
25
|
# lives under another record, such as an order's items.
|
|
26
26
|
PARENT_ID_DESCRIPTION = 'For a resource reached through another record (describe_resource names ' \
|
|
27
|
-
'it as parent, e.g. an order for its items
|
|
28
|
-
'record\'s id as shown in search results'.freeze
|
|
27
|
+
'it as parent or listed_under, e.g. an order for its items and claims, a ' \
|
|
28
|
+
'category for its products): that record\'s id as shown in search results'.freeze
|
|
29
29
|
|
|
30
30
|
# Declarations live in class attributes rather than plain class-level
|
|
31
31
|
# instance variables so a subclass inherits them. Subclassing a tool to
|
|
@@ -257,7 +257,7 @@ class AgentTool
|
|
|
257
257
|
sentences << "Pass the #{owner}'s id as parent_id to reach them under it." if reachable
|
|
258
258
|
# Each suggested call is one this caller may actually make; a hint
|
|
259
259
|
# that leads straight to a permission refusal is worse than none.
|
|
260
|
-
readable = parent_entry
|
|
260
|
+
readable = parent_entry&.readable_by?(context)
|
|
261
261
|
writable = parent_entry&.write_permission.present? && context.permitted?(parent_entry.write_permission)
|
|
262
262
|
if attribute && writable
|
|
263
263
|
sentences << "Write them in the #{attribute} attribute of #{parent} — describe_resource #{parent} shows the shape and the accepted types."
|
|
@@ -31,7 +31,7 @@ module Spree
|
|
|
31
31
|
|
|
32
32
|
# @deprecated The 6.0.0 workflow allowlist, kept only so a reference to
|
|
33
33
|
# it does not break through 6.0.x. Nothing reads it: Admin API
|
|
34
|
-
# operations are tools on their own. Removed in 6.
|
|
34
|
+
# operations are tools on their own. Removed in 6.3.
|
|
35
35
|
WORKFLOWS = {
|
|
36
36
|
# Catalog
|
|
37
37
|
product_activate_workflow: 'write_products',
|
|
@@ -99,7 +99,7 @@ module Spree
|
|
|
99
99
|
|
|
100
100
|
# @deprecated The 6.0.0 exclusion list, kept like {WORKFLOWS}. Its
|
|
101
101
|
# reasons now travel as `agent_tool false, reason:` on the operation's
|
|
102
|
-
# rswag spec. Removed in 6.
|
|
102
|
+
# rswag spec. Removed in 6.3.
|
|
103
103
|
# The email template editor is a draft-and-publish surface: its steps
|
|
104
104
|
# move a draft through revisions against a live preview, and they mean
|
|
105
105
|
# nothing outside that screen. Publishing one sends real mail in the
|
|
@@ -19,7 +19,7 @@ module Spree
|
|
|
19
19
|
# to record tracking marked the delivery delivered. No endpoint sets a
|
|
20
20
|
# carrier status, so the name no longer answers rather than doing that.
|
|
21
21
|
#
|
|
22
|
-
# Removed in 6.
|
|
22
|
+
# Removed in 6.3, with the names that are no longer listed.
|
|
23
23
|
# See docs/plans/6.0-agent-tools-from-openapi.md.
|
|
24
24
|
module LegacyTools
|
|
25
25
|
# Old tool name => the operation it runs and its renamed parameters.
|
|
@@ -141,7 +141,7 @@ module Spree
|
|
|
141
141
|
def record_for(segment, id)
|
|
142
142
|
key = segment == 'id' ? operation.resource_key : operation.segment_keys[segment]
|
|
143
143
|
entry = key && ResourceMap.find(key)
|
|
144
|
-
return if entry.nil? || !
|
|
144
|
+
return if entry.nil? || !entry.readable_by?(context)
|
|
145
145
|
|
|
146
146
|
entry.scope_for(context).find_by_prefix_id(id)
|
|
147
147
|
rescue StandardError
|
|
@@ -9,7 +9,12 @@ module Spree
|
|
|
9
9
|
# Fields worth showing beneath the title, in the order they are preferred.
|
|
10
10
|
# Status is deliberately absent — it has its own badge on the row, and
|
|
11
11
|
# repeating it would push out the field that actually adds something.
|
|
12
|
-
SUBTITLE_FIELDS = %w[display_total display_price price email number sku].freeze
|
|
12
|
+
SUBTITLE_FIELDS = %w[display_total display_price price email number sku variant_sku].freeze
|
|
13
|
+
|
|
14
|
+
# Quantities and places a list row must carry for the model to answer
|
|
15
|
+
# from the search alone. Without them a stock level row was an id and
|
|
16
|
+
# nothing else, and "how much do I have" took one lookup per row.
|
|
17
|
+
DETAIL_FIELDS = %w[count_on_hand available_count stock_location_name options_text].freeze
|
|
13
18
|
|
|
14
19
|
# Anything that looks like a credential is dropped before a record can
|
|
15
20
|
# reach the model. The serializers are supposed to mask these already —
|
|
@@ -151,6 +156,7 @@ module Spree
|
|
|
151
156
|
title: title,
|
|
152
157
|
subtitle: subtitle_for(attributes, title),
|
|
153
158
|
status: attributes['status'],
|
|
159
|
+
details: attributes.slice(*DETAIL_FIELDS).compact.presence,
|
|
154
160
|
image_url: attributes['thumbnail_url'],
|
|
155
161
|
path: dashboard_path_from(entry, attributes['id'])
|
|
156
162
|
}.compact
|
|
@@ -160,7 +166,7 @@ module Spree
|
|
|
160
166
|
|
|
161
167
|
# The same preference order as a record's title, read from the payload.
|
|
162
168
|
def title_from(attributes)
|
|
163
|
-
%w[name number label title email sku].each do |field|
|
|
169
|
+
%w[name number label title email sku variant_name].each do |field|
|
|
164
170
|
value = attributes[field]
|
|
165
171
|
return value.to_s if value.is_a?(String) && value.present?
|
|
166
172
|
end
|