spree_core 4.7.2 → 4.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/app/finders/spree/taxons/find.rb +7 -3
  4. data/app/models/concerns/spree/named_type.rb +1 -1
  5. data/app/models/concerns/spree/product_scopes.rb +19 -19
  6. data/app/models/concerns/spree/user_address.rb +4 -2
  7. data/app/models/spree/address.rb +2 -21
  8. data/app/models/spree/asset.rb +2 -2
  9. data/app/models/spree/calculator/default_tax.rb +1 -1
  10. data/app/models/spree/cms_page.rb +3 -3
  11. data/app/models/spree/cms_section.rb +1 -1
  12. data/app/models/spree/country.rb +0 -26
  13. data/app/models/spree/credit_card.rb +5 -3
  14. data/app/models/spree/customer_return.rb +3 -3
  15. data/app/models/spree/digital.rb +1 -1
  16. data/app/models/spree/digital_link.rb +1 -1
  17. data/app/models/spree/image.rb +2 -2
  18. data/app/models/spree/inventory_unit.rb +1 -1
  19. data/app/models/spree/legacy_user.rb +3 -3
  20. data/app/models/spree/line_item.rb +2 -2
  21. data/app/models/spree/menu.rb +2 -2
  22. data/app/models/spree/menu_item.rb +1 -1
  23. data/app/models/spree/option_type.rb +6 -6
  24. data/app/models/spree/option_value.rb +5 -5
  25. data/app/models/spree/order.rb +9 -7
  26. data/app/models/spree/payment.rb +4 -4
  27. data/app/models/spree/payment_capture_event.rb +1 -1
  28. data/app/models/spree/payment_method.rb +1 -1
  29. data/app/models/spree/payment_source.rb +1 -1
  30. data/app/models/spree/price.rb +4 -2
  31. data/app/models/spree/product.rb +30 -19
  32. data/app/models/spree/product_property.rb +5 -3
  33. data/app/models/spree/promotion.rb +3 -3
  34. data/app/models/spree/property.rb +8 -6
  35. data/app/models/spree/prototype.rb +2 -2
  36. data/app/models/spree/refund.rb +2 -2
  37. data/app/models/spree/reimbursement.rb +2 -2
  38. data/app/models/spree/return_authorization.rb +2 -2
  39. data/app/models/spree/return_item.rb +1 -1
  40. data/app/models/spree/role.rb +1 -1
  41. data/app/models/spree/shipment.rb +4 -4
  42. data/app/models/spree/shipping_category.rb +2 -2
  43. data/app/models/spree/shipping_method.rb +2 -2
  44. data/app/models/spree/stock/estimator.rb +1 -1
  45. data/app/models/spree/stock_item.rb +3 -3
  46. data/app/models/spree/stock_location.rb +7 -2
  47. data/app/models/spree/stock_movement.rb +1 -1
  48. data/app/models/spree/stock_transfer.rb +4 -4
  49. data/app/models/spree/store.rb +3 -5
  50. data/app/models/spree/store_credit.rb +3 -3
  51. data/app/models/spree/store_favicon_image.rb +11 -2
  52. data/app/models/spree/tax_category.rb +1 -1
  53. data/app/models/spree/tax_rate.rb +1 -1
  54. data/app/models/spree/taxon.rb +23 -7
  55. data/app/models/spree/taxon_image.rb +2 -2
  56. data/app/models/spree/taxonomy.rb +5 -5
  57. data/app/models/spree/variant.rb +11 -6
  58. data/app/models/spree/wished_item.rb +1 -1
  59. data/app/models/spree/wishlist.rb +2 -2
  60. data/app/models/spree/zone.rb +2 -2
  61. data/app/services/spree/addresses/update.rb +1 -0
  62. data/app/services/spree/seeds/all.rb +15 -13
  63. data/app/services/spree/seeds/stores.rb +2 -2
  64. data/app/sorters/spree/products/sort.rb +1 -1
  65. data/config/initializers/mobility.rb +1 -0
  66. data/config/routes.rb +7 -8
  67. data/db/migrate/20210929090344_create_stock_item_stock_location_id_variant_id_coalesce_deleted_at_unique_index.rb +1 -28
  68. data/db/migrate/20230103144439_create_option_type_translations.rb +0 -1
  69. data/db/migrate/20230103151034_create_option_value_translations.rb +0 -1
  70. data/db/migrate/20230109084253_create_product_property_translations.rb +0 -1
  71. data/db/migrate/20230109105943_create_property_translations.rb +0 -2
  72. data/db/migrate/20230110142344_backfill_friendly_id_slug_locale.rb +2 -8
  73. data/db/migrate/20240303174340_fix_spree_stock_item_unique_index.rb +35 -0
  74. data/db/migrate/20240514105216_add_weight_and_dimension_units_to_spree_variants.rb +6 -0
  75. data/lib/generators/spree/custom_authentication/custom_authentication_generator.rb +23 -0
  76. data/lib/generators/spree/{custom_user → custom_authentication}/templates/authentication_helpers.rb.tt +1 -14
  77. data/lib/generators/spree/custom_user/custom_user_generator.rb +3 -8
  78. data/lib/generators/spree/custom_user/templates/current_user_helpers.rb.tt +15 -0
  79. data/lib/generators/spree/custom_user/templates/migration.rb.tt +2 -2
  80. data/lib/generators/spree/dummy/dummy_generator.rb +1 -6
  81. data/lib/generators/spree/dummy/templates/rails/database.yml +19 -21
  82. data/lib/generators/spree/dummy/templates/rails/test.rb +1 -1
  83. data/lib/generators/spree/install/templates/config/initializers/spree.rb +25 -0
  84. data/lib/spree/core/configuration.rb +11 -25
  85. data/lib/spree/core/controller_helpers/locale.rb +5 -1
  86. data/lib/spree/core/engine.rb +4 -1
  87. data/lib/spree/core/preferences/runtime_configuration.rb +43 -0
  88. data/lib/spree/core/product_duplicator.rb +2 -0
  89. data/lib/spree/core/product_filters.rb +9 -2
  90. data/lib/spree/core/runtime_configuration.rb +9 -0
  91. data/lib/spree/core/version.rb +1 -1
  92. data/lib/spree/core/webhooks.rb +13 -0
  93. data/lib/spree/core.rb +7 -0
  94. data/lib/spree/money.rb +38 -5
  95. data/lib/spree/testing_support/authorization_helpers.rb +3 -1
  96. data/lib/spree/testing_support/common_rake.rb +7 -18
  97. data/spree_core.gemspec +7 -7
  98. metadata +47 -50
  99. data/db/migrate/20220715120222_change_product_name_null_to_true.rb +0 -5
  100. data/db/migrate/20220718100948_change_taxon_name_null_to_true.rb +0 -5
  101. data/db/migrate/20220804073928_transfer_data_to_translatable_tables.rb +0 -66
  102. data/db/migrate/20230109094907_transfer_options_data_to_translatable_tables.rb +0 -58
  103. data/db/migrate/20230109110840_transfer_property_data_to_translatable_tables.rb +0 -59
  104. data/db/migrate/20230111122511_transfer_product_and_taxon_data_to_translatable_tables.rb +0 -82
  105. data/db/migrate/20230117120430_allow_null_taxonomy_name.rb +0 -5
  106. data/db/migrate/20230117121303_transfer_taxonomy_data_to_translatable_tables.rb +0 -11
  107. data/db/migrate/20230210142849_transfer_store_data_to_translatable_tables.rb +0 -11
  108. 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,5 +0,0 @@
1
- class AllowNullTaxonomyName < ActiveRecord::Migration[6.1]
2
- def change
3
- change_column_null :spree_taxonomies, :name, true
4
- end
5
- 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
@@ -1,5 +0,0 @@
1
- class AddIndexOnLocaleAndPermalinkToSpreeTaxons < ActiveRecord::Migration[6.1]
2
- def change
3
- add_index :spree_taxon_translations, [:locale, :permalink], unique: true, name: 'unique_permalink_per_locale', if_not_exists: true
4
- end
5
- end