spree_core 4.7.2 → 4.8.0
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/LICENSE +1 -1
- data/app/finders/spree/taxons/find.rb +7 -3
- data/app/models/concerns/spree/named_type.rb +1 -1
- data/app/models/concerns/spree/product_scopes.rb +19 -19
- data/app/models/concerns/spree/user_address.rb +4 -2
- data/app/models/spree/address.rb +2 -21
- data/app/models/spree/asset.rb +2 -2
- data/app/models/spree/calculator/default_tax.rb +1 -1
- data/app/models/spree/cms_page.rb +3 -3
- data/app/models/spree/cms_section.rb +1 -1
- data/app/models/spree/country.rb +0 -26
- data/app/models/spree/credit_card.rb +5 -3
- data/app/models/spree/customer_return.rb +3 -3
- data/app/models/spree/digital.rb +1 -1
- data/app/models/spree/digital_link.rb +1 -1
- data/app/models/spree/image.rb +2 -2
- data/app/models/spree/inventory_unit.rb +1 -1
- data/app/models/spree/legacy_user.rb +3 -3
- data/app/models/spree/line_item.rb +2 -2
- data/app/models/spree/menu.rb +2 -2
- data/app/models/spree/menu_item.rb +1 -1
- data/app/models/spree/option_type.rb +6 -6
- data/app/models/spree/option_value.rb +5 -5
- data/app/models/spree/order.rb +9 -7
- data/app/models/spree/payment.rb +4 -4
- data/app/models/spree/payment_capture_event.rb +1 -1
- data/app/models/spree/payment_method.rb +1 -1
- data/app/models/spree/payment_source.rb +1 -1
- data/app/models/spree/price.rb +4 -2
- data/app/models/spree/product.rb +30 -19
- data/app/models/spree/product_property.rb +5 -3
- data/app/models/spree/promotion.rb +3 -3
- data/app/models/spree/property.rb +8 -6
- data/app/models/spree/prototype.rb +2 -2
- data/app/models/spree/refund.rb +2 -2
- data/app/models/spree/reimbursement.rb +2 -2
- data/app/models/spree/return_authorization.rb +2 -2
- data/app/models/spree/return_item.rb +1 -1
- data/app/models/spree/role.rb +1 -1
- data/app/models/spree/shipment.rb +4 -4
- data/app/models/spree/shipping_category.rb +2 -2
- data/app/models/spree/shipping_method.rb +2 -2
- data/app/models/spree/stock/estimator.rb +1 -1
- data/app/models/spree/stock_item.rb +3 -3
- data/app/models/spree/stock_location.rb +7 -2
- data/app/models/spree/stock_movement.rb +1 -1
- data/app/models/spree/stock_transfer.rb +4 -4
- data/app/models/spree/store.rb +3 -5
- data/app/models/spree/store_credit.rb +3 -3
- data/app/models/spree/store_favicon_image.rb +11 -2
- data/app/models/spree/tax_category.rb +1 -1
- data/app/models/spree/tax_rate.rb +1 -1
- data/app/models/spree/taxon.rb +23 -7
- data/app/models/spree/taxon_image.rb +2 -2
- data/app/models/spree/taxonomy.rb +5 -5
- data/app/models/spree/variant.rb +11 -6
- data/app/models/spree/wished_item.rb +1 -1
- data/app/models/spree/wishlist.rb +2 -2
- data/app/models/spree/zone.rb +2 -2
- data/app/services/spree/addresses/update.rb +1 -0
- data/app/services/spree/seeds/all.rb +15 -13
- data/app/services/spree/seeds/stores.rb +2 -2
- data/app/sorters/spree/products/sort.rb +1 -1
- data/config/initializers/mobility.rb +1 -0
- data/config/routes.rb +7 -8
- data/db/migrate/20210929090344_create_stock_item_stock_location_id_variant_id_coalesce_deleted_at_unique_index.rb +1 -28
- data/db/migrate/20230103144439_create_option_type_translations.rb +0 -1
- data/db/migrate/20230103151034_create_option_value_translations.rb +0 -1
- data/db/migrate/20230109084253_create_product_property_translations.rb +0 -1
- data/db/migrate/20230109105943_create_property_translations.rb +0 -2
- data/db/migrate/20230110142344_backfill_friendly_id_slug_locale.rb +2 -8
- data/db/migrate/20240303174340_fix_spree_stock_item_unique_index.rb +35 -0
- data/db/migrate/20240514105216_add_weight_and_dimension_units_to_spree_variants.rb +6 -0
- data/lib/generators/spree/custom_authentication/custom_authentication_generator.rb +23 -0
- data/lib/generators/spree/{custom_user → custom_authentication}/templates/authentication_helpers.rb.tt +1 -14
- data/lib/generators/spree/custom_user/custom_user_generator.rb +3 -8
- data/lib/generators/spree/custom_user/templates/current_user_helpers.rb.tt +15 -0
- data/lib/generators/spree/custom_user/templates/migration.rb.tt +2 -2
- data/lib/generators/spree/dummy/dummy_generator.rb +1 -6
- data/lib/generators/spree/dummy/templates/rails/database.yml +19 -21
- data/lib/generators/spree/dummy/templates/rails/test.rb +1 -1
- data/lib/generators/spree/install/templates/config/initializers/spree.rb +25 -0
- data/lib/spree/core/configuration.rb +11 -25
- data/lib/spree/core/controller_helpers/locale.rb +5 -1
- data/lib/spree/core/engine.rb +4 -1
- data/lib/spree/core/preferences/runtime_configuration.rb +43 -0
- data/lib/spree/core/product_duplicator.rb +2 -0
- data/lib/spree/core/product_filters.rb +9 -2
- data/lib/spree/core/runtime_configuration.rb +9 -0
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/core/webhooks.rb +13 -0
- data/lib/spree/core.rb +7 -0
- data/lib/spree/money.rb +38 -5
- data/lib/spree/testing_support/authorization_helpers.rb +3 -1
- data/lib/spree/testing_support/common_rake.rb +7 -18
- data/spree_core.gemspec +7 -7
- metadata +47 -50
- data/db/migrate/20220715120222_change_product_name_null_to_true.rb +0 -5
- data/db/migrate/20220718100948_change_taxon_name_null_to_true.rb +0 -5
- data/db/migrate/20220804073928_transfer_data_to_translatable_tables.rb +0 -66
- data/db/migrate/20230109094907_transfer_options_data_to_translatable_tables.rb +0 -58
- data/db/migrate/20230109110840_transfer_property_data_to_translatable_tables.rb +0 -59
- data/db/migrate/20230111122511_transfer_product_and_taxon_data_to_translatable_tables.rb +0 -82
- data/db/migrate/20230117120430_allow_null_taxonomy_name.rb +0 -5
- data/db/migrate/20230117121303_transfer_taxonomy_data_to_translatable_tables.rb +0 -11
- data/db/migrate/20230210142849_transfer_store_data_to_translatable_tables.rb +0 -11
- data/db/migrate/20230514162157_add_index_on_locale_and_permalink_to_spree_taxons.rb +0 -5
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
class TransferPropertyDataToTranslatableTables < ActiveRecord::Migration[6.1]
|
|
2
|
-
DEFAULT_LOCALE = 'en'
|
|
3
|
-
|
|
4
|
-
def up
|
|
5
|
-
# Properties
|
|
6
|
-
change_column_null :spree_properties, :presentation, true
|
|
7
|
-
|
|
8
|
-
if not Spree::Property::Translation.exists?
|
|
9
|
-
ActiveRecord::Base.connection.execute("
|
|
10
|
-
INSERT INTO spree_property_translations (name, presentation, filter_param, locale, spree_property_id, created_at, updated_at)
|
|
11
|
-
SELECT name, presentation, filter_param, '#{DEFAULT_LOCALE}', id, created_at, updated_at
|
|
12
|
-
FROM spree_properties;
|
|
13
|
-
")
|
|
14
|
-
ActiveRecord::Base.connection.execute("
|
|
15
|
-
UPDATE spree_properties
|
|
16
|
-
SET name=null, presentation=null, filter_param=null;
|
|
17
|
-
")
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
# Product Properties
|
|
21
|
-
if not Spree::ProductProperty::Translation.exists?
|
|
22
|
-
ActiveRecord::Base.connection.execute("
|
|
23
|
-
INSERT INTO spree_product_property_translations (value, filter_param, locale, spree_product_property_id, created_at, updated_at)
|
|
24
|
-
SELECT value, filter_param, '#{DEFAULT_LOCALE}', id, created_at, updated_at
|
|
25
|
-
FROM spree_product_properties;
|
|
26
|
-
")
|
|
27
|
-
ActiveRecord::Base.connection.execute("
|
|
28
|
-
UPDATE spree_product_properties
|
|
29
|
-
SET value=null, filter_param=null;
|
|
30
|
-
")
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
def down
|
|
35
|
-
# Properties
|
|
36
|
-
change_column_null :spree_properties, :presentation, false
|
|
37
|
-
|
|
38
|
-
ActiveRecord::Base.connection.execute("
|
|
39
|
-
UPDATE spree_properties AS properties
|
|
40
|
-
SET (name, presentation, filter_param) = (t_properties.name, t_properties.presentation, t_properties.filter_param)
|
|
41
|
-
FROM spree_property_translations AS t_properties
|
|
42
|
-
WHERE t_properties.spree_property_id = properties.id;
|
|
43
|
-
")
|
|
44
|
-
ActiveRecord::Base.connection.execute("
|
|
45
|
-
TRUNCATE TABLE spree_property_translations;
|
|
46
|
-
")
|
|
47
|
-
|
|
48
|
-
# Product Properties
|
|
49
|
-
ActiveRecord::Base.connection.execute("
|
|
50
|
-
UPDATE spree_product_properties AS product_properties
|
|
51
|
-
SET (value, filter_param) = (t_product_properties.value, t_product_properties.filter_param)
|
|
52
|
-
FROM spree_product_property_translations AS t_product_properties
|
|
53
|
-
WHERE t_product_properties.spree_product_property_id = product_properties.id;
|
|
54
|
-
")
|
|
55
|
-
ActiveRecord::Base.connection.execute("
|
|
56
|
-
TRUNCATE TABLE spree_product_property_translations;
|
|
57
|
-
")
|
|
58
|
-
end
|
|
59
|
-
end
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
class TransferProductAndTaxonDataToTranslatableTables < ActiveRecord::Migration[6.1]
|
|
2
|
-
DEFAULT_LOCALE = 'en'
|
|
3
|
-
PRODUCTS_TABLE = 'spree_products'
|
|
4
|
-
PRODUCT_TRANSLATIONS_TABLE = 'spree_product_translations'
|
|
5
|
-
TAXONS_TABLE = 'spree_taxons'
|
|
6
|
-
TAXON_TRANSLATIONS_TABLE = 'spree_taxon_translations'
|
|
7
|
-
|
|
8
|
-
def up
|
|
9
|
-
# Only transfer data if translation tables are being newly created / no translations exist
|
|
10
|
-
# Otherwise, assume translation data is already in place from spree_globalize
|
|
11
|
-
|
|
12
|
-
# Products
|
|
13
|
-
if not Spree::Product::Translation.exists?
|
|
14
|
-
ActiveRecord::Base.connection.execute("
|
|
15
|
-
INSERT INTO #{PRODUCT_TRANSLATIONS_TABLE} (name, description, locale, spree_product_id, created_at, updated_at, meta_description, meta_keywords, meta_title, slug)
|
|
16
|
-
SELECT name, description, '#{DEFAULT_LOCALE}' as locale, id, created_at, updated_at, meta_description, meta_keywords, meta_title, slug FROM #{PRODUCTS_TABLE};
|
|
17
|
-
")
|
|
18
|
-
ActiveRecord::Base.connection.execute("
|
|
19
|
-
UPDATE #{PRODUCTS_TABLE}
|
|
20
|
-
SET name=null, description=null, meta_description=null, meta_keywords=null, meta_title=null, slug=null;
|
|
21
|
-
")
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
# Taxons
|
|
25
|
-
if not Spree::Taxon::Translation.exists?
|
|
26
|
-
ActiveRecord::Base.connection.execute("
|
|
27
|
-
INSERT INTO #{TAXON_TRANSLATIONS_TABLE} (name, description, meta_title, meta_description, meta_keywords, permalink, locale, spree_taxon_id, created_at, updated_at)
|
|
28
|
-
SELECT name, description, meta_title, meta_description, meta_keywords, permalink, '#{DEFAULT_LOCALE}' as locale, id, created_at, updated_at FROM #{TAXONS_TABLE};
|
|
29
|
-
")
|
|
30
|
-
ActiveRecord::Base.connection.execute("
|
|
31
|
-
UPDATE #{TAXONS_TABLE}
|
|
32
|
-
SET name=null, description=null, meta_title=null, meta_description=null, meta_keywords=null, permalink=null;
|
|
33
|
-
")
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
def down
|
|
38
|
-
ActiveRecord::Base.connection.execute("
|
|
39
|
-
UPDATE #{PRODUCTS_TABLE} as products
|
|
40
|
-
SET (name,
|
|
41
|
-
description,
|
|
42
|
-
meta_description,
|
|
43
|
-
meta_keywords,
|
|
44
|
-
meta_title,
|
|
45
|
-
slug) =
|
|
46
|
-
(t_products.name,
|
|
47
|
-
t_products.description,
|
|
48
|
-
t_products.meta_description,
|
|
49
|
-
t_products.meta_keywords,
|
|
50
|
-
t_products.meta_title,
|
|
51
|
-
t_products.slug)
|
|
52
|
-
FROM #{PRODUCT_TRANSLATIONS_TABLE} AS t_products
|
|
53
|
-
WHERE t_products.spree_product_id = products.id
|
|
54
|
-
")
|
|
55
|
-
|
|
56
|
-
ActiveRecord::Base.connection.execute("
|
|
57
|
-
TRUNCATE TABLE #{PRODUCT_TRANSLATIONS_TABLE}
|
|
58
|
-
")
|
|
59
|
-
|
|
60
|
-
ActiveRecord::Base.connection.execute("
|
|
61
|
-
UPDATE #{TAXONS_TABLE} as taxons
|
|
62
|
-
SET (name,
|
|
63
|
-
description,
|
|
64
|
-
meta_title,
|
|
65
|
-
meta_description,
|
|
66
|
-
meta_keywords,
|
|
67
|
-
permalink) =
|
|
68
|
-
(t_taxons.name,
|
|
69
|
-
t_taxons.description,
|
|
70
|
-
t_taxons.meta_title,
|
|
71
|
-
t_taxons.meta_description,
|
|
72
|
-
t_taxons.meta_keywords,
|
|
73
|
-
t_taxons.permalink)
|
|
74
|
-
FROM #{TAXON_TRANSLATIONS_TABLE} AS t_taxons
|
|
75
|
-
WHERE t_taxons.spree_taxon_id = taxons.id
|
|
76
|
-
")
|
|
77
|
-
|
|
78
|
-
ActiveRecord::Base.connection.execute("
|
|
79
|
-
TRUNCATE TABLE #{TAXON_TRANSLATIONS_TABLE}
|
|
80
|
-
")
|
|
81
|
-
end
|
|
82
|
-
end
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
class TransferTaxonomyDataToTranslatableTables < ActiveRecord::Migration[6.1]
|
|
2
|
-
TRANSLATION_MIGRATION = Spree::TranslationMigrations.new(Spree::Taxonomy, 'en')
|
|
3
|
-
|
|
4
|
-
def up
|
|
5
|
-
TRANSLATION_MIGRATION.transfer_translation_data
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
def down
|
|
9
|
-
TRANSLATION_MIGRATION.revert_translation_data_transfer
|
|
10
|
-
end
|
|
11
|
-
end
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
class TransferStoreDataToTranslatableTables < ActiveRecord::Migration[6.1]
|
|
2
|
-
TRANSLATION_MIGRATION = Spree::TranslationMigrations.new(Spree::Store, 'en')
|
|
3
|
-
|
|
4
|
-
def up
|
|
5
|
-
TRANSLATION_MIGRATION.transfer_translation_data
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
def down
|
|
9
|
-
TRANSLATION_MIGRATION.revert_translation_data_transfer
|
|
10
|
-
end
|
|
11
|
-
end
|