solidus_core 3.0.8 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of solidus_core might be problematic. Click here for more details.

Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/app/helpers/spree/base_helper.rb +1 -1
  3. data/app/helpers/spree/products_helper.rb +1 -1
  4. data/app/models/concerns/spree/active_storage_adapter/attachment.rb +2 -4
  5. data/app/models/concerns/spree/default_price.rb +63 -10
  6. data/app/models/concerns/spree/user_methods.rb +1 -20
  7. data/app/models/spree/adjustment.rb +6 -5
  8. data/app/models/spree/customer_return.rb +3 -2
  9. data/app/models/spree/image/active_storage_attachment.rb +2 -7
  10. data/app/models/spree/image/paperclip_attachment.rb +2 -2
  11. data/app/models/spree/line_item.rb +2 -2
  12. data/app/models/spree/log_entry.rb +1 -74
  13. data/app/models/spree/order.rb +10 -5
  14. data/app/models/spree/order_shipping.rb +9 -6
  15. data/app/models/spree/price.rb +2 -2
  16. data/app/models/spree/product/scopes.rb +5 -5
  17. data/app/models/spree/product.rb +12 -1
  18. data/app/models/spree/promotion/rules/item_total.rb +50 -6
  19. data/app/models/spree/promotion.rb +2 -2
  20. data/app/models/spree/promotion_code.rb +3 -3
  21. data/app/models/spree/refund.rb +0 -8
  22. data/app/models/spree/shipping_rate_tax.rb +1 -1
  23. data/app/models/spree/stock/availability.rb +11 -3
  24. data/app/models/spree/stock/simple_coordinator.rb +0 -10
  25. data/app/models/spree/stock_location.rb +1 -1
  26. data/app/models/spree/store_credit.rb +6 -9
  27. data/app/models/spree/tax_calculator/shipping_rate.rb +1 -1
  28. data/app/models/spree/taxon/active_storage_attachment.rb +2 -2
  29. data/app/models/spree/taxon/paperclip_attachment.rb +3 -3
  30. data/app/models/spree/variant/price_selector.rb +16 -3
  31. data/app/models/spree/variant.rb +26 -16
  32. data/config/locales/en.yml +2 -249
  33. data/db/migrate/20210312061050_change_column_null_on_prices.rb +7 -0
  34. data/lib/generators/solidus/install/install_generator.rb +2 -3
  35. data/lib/generators/solidus/install/templates/config/initializers/spree.rb.tt +3 -1
  36. data/lib/generators/solidus/update/templates/config/initializers/new_solidus_defaults.rb.tt +30 -0
  37. data/lib/generators/solidus/update/update_generator.rb +112 -0
  38. data/lib/generators/spree/dummy/templates/rails/application.rb.tt +0 -1
  39. data/lib/generators/spree/dummy/templates/rails/database.yml +78 -35
  40. data/lib/spree/app_configuration.rb +64 -19
  41. data/lib/spree/core/engine.rb +7 -22
  42. data/lib/spree/core/product_filters.rb +1 -1
  43. data/lib/spree/core/search/base.rb +1 -1
  44. data/lib/spree/core/state_machines/order.rb +1 -1
  45. data/lib/spree/core/validators/email.rb +1 -1
  46. data/lib/spree/core/version.rb +5 -1
  47. data/lib/spree/core/versioned_value.rb +75 -0
  48. data/lib/spree/core.rb +17 -0
  49. data/lib/spree/permitted_attributes.rb +1 -1
  50. data/lib/spree/preferences/configuration.rb +62 -0
  51. data/lib/spree/preferences/preferable.rb +8 -0
  52. data/lib/spree/preferences/preferable_class_methods.rb +5 -3
  53. data/lib/spree/preferences/preference_differentiator.rb +28 -0
  54. data/lib/spree/testing_support/blacklist_urls.rb +1 -1
  55. data/lib/spree/testing_support/dummy_app/database.yml +42 -22
  56. data/lib/spree/testing_support/dummy_app.rb +33 -19
  57. data/lib/spree/testing_support/factories/user_factory.rb +0 -6
  58. data/lib/tasks/solidus/delete_prices_with_nil_amount.rake +8 -0
  59. data/solidus_core.gemspec +0 -1
  60. metadata +9 -26
  61. data/app/models/spree/tax/shipping_rate_taxer.rb +0 -24
  62. data/lib/tasks/solidus/check_orders_with_invalid_email.rake +0 -18
  63. data/lib/tasks/upgrade.rake +0 -15
@@ -19,7 +19,7 @@ module Spree
19
19
  # Get the on_hand stock quantities
20
20
  # @return [Hash<Integer=>Spree::StockQuantities>] A map of stock_location_ids to the stock quantities available in that location
21
21
  def on_hand_by_stock_location_id
22
- counts_on_hand.to_a.group_by do |(_, stock_location_id), _|
22
+ quantities_by_location_id = counts_on_hand.to_a.group_by do |(_, stock_location_id), _|
23
23
  stock_location_id
24
24
  end.transform_values do |values|
25
25
  Spree::StockQuantities.new(
@@ -31,12 +31,13 @@ module Spree
31
31
  end.to_h
32
32
  )
33
33
  end
34
+ restore_location_order(quantities_by_location_id)
34
35
  end
35
36
 
36
- # Get the on_hand stock quantities
37
+ # Get the backorderable stock quantities
37
38
  # @return [Hash<Integer=>Spree::StockQuantities>] A map of stock_location_ids to the stock quantities available in that location
38
39
  def backorderable_by_stock_location_id
39
- backorderables.group_by(&:second).transform_values do |variant_ids|
40
+ quantities_by_location_id = backorderables.group_by(&:second).transform_values do |variant_ids|
40
41
  Spree::StockQuantities.new(
41
42
  variant_ids.map do |variant_id, _|
42
43
  variant = @variant_map[variant_id]
@@ -44,6 +45,7 @@ module Spree
44
45
  end.to_h
45
46
  )
46
47
  end
48
+ restore_location_order(quantities_by_location_id)
47
49
  end
48
50
 
49
51
  private
@@ -67,6 +69,12 @@ module Spree
67
69
  where(variant_id: @variants).
68
70
  where(stock_location_id: @stock_locations)
69
71
  end
72
+
73
+ def restore_location_order(quantities_by_location_id)
74
+ sorted_location_ids = @stock_locations.map(&:id)
75
+
76
+ quantities_by_location_id.sort_by { |key, _value| sorted_location_ids.index(key) }.to_h
77
+ end
70
78
  end
71
79
  end
72
80
  end
@@ -92,16 +92,6 @@ module Spree
92
92
  end
93
93
  end
94
94
 
95
- def sort_availability(availability)
96
- sorted_availability = availability.sort_by do |stock_location_id, _|
97
- @stock_locations.find_index do |stock_location|
98
- stock_location.id == stock_location_id
99
- end
100
- end
101
-
102
- Hash[sorted_availability]
103
- end
104
-
105
95
  def get_units(quantities)
106
96
  # Change our raw quantities back into inventory units
107
97
  quantities.flat_map do |variant, quantity|
@@ -26,7 +26,7 @@ module Spree
26
26
  validates_uniqueness_of :code, allow_blank: true, case_sensitive: false
27
27
 
28
28
  scope :active, -> { where(active: true) }
29
- scope :order_default, -> { order(default: :desc, name: :asc) }
29
+ scope :order_default, -> { order(default: :desc, position: :asc) }
30
30
 
31
31
  after_create :create_stock_items, if: :propagate_all_variants?
32
32
  after_save :ensure_one_default
@@ -40,14 +40,6 @@ class Spree::StoreCredit < Spree::PaymentSource
40
40
  extend Spree::DisplayMoney
41
41
  money_methods :amount, :amount_used, :amount_authorized
42
42
 
43
- # Sets this store credit's amount to a new value,
44
- # parsing it as a localized number if the new value is a string.
45
- #
46
- # @param number [String, #to_d] a new amount
47
- def amount=(number)
48
- self[:amount] = Spree::LocalizedNumber.parse(number)
49
- end
50
-
51
43
  def amount_remaining
52
44
  return 0.0.to_d if invalidated?
53
45
  amount - amount_used - amount_authorized
@@ -158,7 +150,12 @@ class Spree::StoreCredit < Spree::PaymentSource
158
150
  end
159
151
 
160
152
  def generate_authorization_code
161
- "#{id}-SC-#{Time.current.utc.strftime('%Y%m%d%H%M%S%6N')}"
153
+ [
154
+ id,
155
+ 'SC',
156
+ Time.current.utc.strftime('%Y%m%d%H%M%S%6N'),
157
+ SecureRandom.uuid
158
+ ].join('-')
162
159
  end
163
160
 
164
161
  def editable?
@@ -9,7 +9,7 @@ module Spree
9
9
  # looking to provide their own calculator should adhere to the API of this
10
10
  # class.
11
11
  #
12
- # @see Spree::Tax::ShippingRateTaxer
12
+ # @see Spree::Stock::Estimator
13
13
  class ShippingRate
14
14
  include Spree::Tax::TaxHelpers
15
15
 
@@ -6,8 +6,8 @@ module Spree::Taxon::ActiveStorageAttachment
6
6
 
7
7
  included do
8
8
  has_attachment :icon,
9
- styles: { mini: '32x32>', normal: '128x128>' },
10
- default_style: :mini
9
+ styles: Spree::Config.taxon_image_styles,
10
+ default_style: Spree::Config.taxon_image_style_default
11
11
  validate :icon_is_an_image
12
12
  end
13
13
  end
@@ -5,14 +5,14 @@ module Spree::Taxon::PaperclipAttachment
5
5
 
6
6
  included do
7
7
  has_attached_file :icon,
8
- styles: { mini: '32x32>', normal: '128x128>' },
9
- default_style: :mini,
8
+ styles: Spree::Config.taxon_image_styles,
9
+ default_style: Spree::Config.taxon_image_style_default,
10
10
  url: '/spree/taxons/:id/:style/:basename.:extension',
11
11
  path: ':rails_root/public/spree/taxons/:id/:style/:basename.:extension',
12
12
  default_url: '/assets/default_taxon.png'
13
13
 
14
14
  validates_attachment :icon,
15
- content_type: { content_type: %w[image/jpg image/jpeg image/png image/gif] }
15
+ content_type: { content_type: Spree::Config.allowed_image_mime_types }
16
16
  end
17
17
 
18
18
  def icon_present?
@@ -26,11 +26,24 @@ module Spree
26
26
  # @param [Spree::Variant::PricingOptions] price_options Pricing Options to abide by
27
27
  # @return [Spree::Money, nil] The most specific price for this set of pricing options.
28
28
  def price_for(price_options)
29
+ Spree::Deprecation.warn(
30
+ "price_for is deprecated and will be removed. The price_for method
31
+ should return a Spree::Price as described. Please use
32
+ #price_for_options and adjust your frontend code to explicitly call
33
+ &.money where required"
34
+ )
35
+ price_for_options(price_options)&.money
36
+ end
37
+
38
+ # The variant's Spree::Price record, given a set of pricing options
39
+ # @param [Spree::Variant::PricingOptions] price_options Pricing Options to abide by
40
+ # @return [Spree::Price, nil] The most specific price for this set of pricing options.
41
+ def price_for_options(price_options)
29
42
  variant.currently_valid_prices.detect do |price|
30
- ( price.country_iso == price_options.desired_attributes[:country_iso] ||
31
- price.country_iso.nil?
43
+ (price.country_iso == price_options.desired_attributes[:country_iso] ||
44
+ price.country_iso.nil?
32
45
  ) && price.currency == price_options.desired_attributes[:currency]
33
- end.try!(:money)
46
+ end
34
47
  end
35
48
  end
36
49
  end
@@ -24,7 +24,6 @@ module Spree
24
24
  stock_items.discard_all
25
25
  images.destroy_all
26
26
  prices.discard_all
27
- currently_valid_prices.discard_all
28
27
  end
29
28
 
30
29
  attr_writer :rebuild_vat_prices
@@ -58,13 +57,6 @@ module Spree
58
57
  inverse_of: :variant,
59
58
  autosave: true
60
59
 
61
- has_many :currently_valid_prices,
62
- -> { currently_valid },
63
- class_name: 'Spree::Price',
64
- dependent: :destroy,
65
- inverse_of: :variant,
66
- autosave: true
67
-
68
60
  before_validation :set_cost_currency
69
61
  before_validation :set_price, if: -> { product && product.master }
70
62
  before_validation :build_vat_prices, if: -> { rebuild_vat_prices? || new_record? && product }
@@ -276,16 +268,17 @@ module Spree
276
268
  end
277
269
 
278
270
  # Chooses an appropriate price for the given pricing options
271
+ # This has been deprecated in favor of #price_for_options.
279
272
  #
280
- # @see Spree::Variant::PriceSelector#price_for
273
+ # @see Spree::Variant::PriceSelector#price_for_options
281
274
  delegate :price_for, to: :price_selector
282
275
 
283
276
  # Returns the difference in price from the master variant
284
277
  def price_difference_from_master(pricing_options = Spree::Config.default_pricing_options)
285
- master_price = product.master.price_for(pricing_options)
286
- variant_price = price_for(pricing_options)
278
+ master_price = product.master.price_for_options(pricing_options)
279
+ variant_price = price_for_options(pricing_options)
287
280
  return unless master_price && variant_price
288
- variant_price - master_price
281
+ Spree::Money.new(variant_price.amount - master_price.amount, currency: pricing_options.currency)
289
282
  end
290
283
 
291
284
  def price_same_as_master?(pricing_options = Spree::Config.default_pricing_options)
@@ -293,6 +286,17 @@ module Spree
293
286
  diff && diff.zero?
294
287
  end
295
288
 
289
+ def price_for_options(price_options)
290
+ if price_selector.respond_to?(:price_for_options)
291
+ price_selector.price_for_options(price_options)
292
+ else
293
+ money = price_for(price_options)
294
+ return if money.nil?
295
+
296
+ Spree::Price.new(amount: money.to_d, variant: self, currency: price_options.currency)
297
+ end
298
+ end
299
+
296
300
  # Generates a friendly name and sku string.
297
301
  #
298
302
  # @return [String]
@@ -315,16 +319,22 @@ module Spree
315
319
  end
316
320
 
317
321
  # @param quantity [Fixnum] how many are desired
322
+ # @param stock_location [Spree::StockLocation] Optionally restrict stock
323
+ # quantity check to a specific stock location. If unspecified it will
324
+ # check inventory in all available StockLocations.
318
325
  # @return [Boolean] true if the desired quantity can be supplied
319
- def can_supply?(quantity = 1)
320
- Spree::Stock::Quantifier.new(self).can_supply?(quantity)
326
+ def can_supply?(quantity = 1, stock_location = nil)
327
+ Spree::Stock::Quantifier.new(self, stock_location).can_supply?(quantity)
321
328
  end
322
329
 
323
330
  # Fetches the on-hand quantity of the variant.
324
331
  #
332
+ # @param stock_location [Spree::StockLocation] Optionally restrict stock
333
+ # quantity check to a specific stock location. If unspecified it will
334
+ # check inventory in all available StockLocations.
325
335
  # @return [Fixnum] the number currently on-hand
326
- def total_on_hand
327
- Spree::Stock::Quantifier.new(self).total_on_hand
336
+ def total_on_hand(stock_location = nil)
337
+ Spree::Stock::Quantifier.new(self, stock_location).total_on_hand
328
338
  end
329
339
 
330
340
  # Shortcut method to determine if inventory tracking is enabled for this
@@ -1004,8 +1004,6 @@ en:
1004
1004
  use_product_tax_category: Use Product Tax Category
1005
1005
  new:
1006
1006
  new_variant: New Variant
1007
- table:
1008
- no_variants_found: No variants found for '%{term}'
1009
1007
  table_filter:
1010
1008
  show_deleted: Show Deleted Variants
1011
1009
  administration: Administration
@@ -1172,257 +1170,10 @@ en:
1172
1170
  country_based: Country Based
1173
1171
  country_name: Name
1174
1172
  country_names:
1175
- AD: Andorra
1176
- AE: United Arab Emirates
1177
- AF: Afghanistan
1178
- AG: Antigua and Barbuda
1179
- AI: Anguilla
1180
- AL: Albania
1181
- AM: Armenia
1182
- AO: Angola
1183
- AQ: Antarctica
1184
- AR: Argentina
1185
- AS: American Samoa
1186
- AT: Austria
1187
- AU: Australia
1188
- AW: Aruba
1189
- AX: Åland Islands
1190
- AZ: Azerbaijan
1191
- BA: Bosnia and Herzegovina
1192
- BB: Barbados
1193
- BD: Bangladesh
1194
- BE: Belgium
1195
- BF: Burkina Faso
1196
- BG: Bulgaria
1197
- BH: Bahrain
1198
- BI: Burundi
1199
- BJ: Benin
1200
- BL: Saint Barthélemy
1201
- BM: Bermuda
1202
- BN: Brunei Darussalam
1203
- BO: Bolivia, Plurinational State of
1204
- BQ: Bonaire, Sint Eustatius and Saba
1205
- BR: Brazil
1206
- BS: Bahamas
1207
- BT: Bhutan
1208
- BV: Bouvet Island
1209
- BW: Botswana
1210
- BY: Belarus
1211
- BZ: Belize
1212
1173
  CA: Canada
1213
- CC: Cocos (Keeling) Islands
1214
- CD: Congo, The Democratic Republic of the
1215
- CF: Central African Republic
1216
- CG: Congo
1217
- CH: Switzerland
1218
- CI: Côte d'Ivoire
1219
- CK: Cook Islands
1220
- CL: Chile
1221
- CM: Cameroon
1222
- CN: China
1223
- CO: Colombia
1224
- CR: Costa Rica
1225
- CU: Cuba
1226
- CV: Cabo Verde
1227
- CW: Curaçao
1228
- CX: Christmas Island
1229
- CY: Cyprus
1230
- CZ: Czechia
1231
- DE: Germany
1232
- DJ: Djibouti
1233
- DK: Denmark
1234
- DM: Dominica
1235
- DO: Dominican Republic
1236
- DZ: Algeria
1237
- EC: Ecuador
1238
- EE: Estonia
1239
- EG: Egypt
1240
- EH: Western Sahara
1241
- ER: Eritrea
1242
- ES: Spain
1243
- ET: Ethiopia
1244
- FI: Finland
1245
- FJ: Fiji
1246
- FK: Falkland Islands (Malvinas)
1247
- FM: Micronesia, Federated States of
1248
- FO: Faroe Islands
1249
- FR: France
1250
1174
  FRA: France
1251
- GA: Gabon
1252
- GB: United Kingdom
1253
- GD: Grenada
1254
- GE: Georgia
1255
- GF: French Guiana
1256
- GG: Guernsey
1257
- GH: Ghana
1258
- GI: Gibraltar
1259
- GL: Greenland
1260
- GM: Gambia
1261
- GN: Guinea
1262
- GP: Guadeloupe
1263
- GQ: Equatorial Guinea
1264
- GR: Greece
1265
- GS: South Georgia and the South Sandwich Islands
1266
- GT: Guatemala
1267
- GU: Guam
1268
- GW: Guinea-Bissau
1269
- GY: Guyana
1270
- HK: Hong Kong
1271
- HM: Heard Island and McDonald Islands
1272
- HN: Honduras
1273
- HR: Croatia
1274
- HT: Haiti
1275
- HU: Hungary
1276
- ID: Indonesia
1277
- IE: Ireland
1278
- IL: Israel
1279
- IM: Isle of Man
1280
- IN: India
1281
- IO: British Indian Ocean Territory
1282
- IQ: Iraq
1283
- IR: Iran, Islamic Republic of
1284
- IS: Iceland
1285
- IT: Italy
1286
1175
  ITA: Italy
1287
- JE: Jersey
1288
- JM: Jamaica
1289
- JO: Jordan
1290
- JP: Japan
1291
- KE: Kenya
1292
- KG: Kyrgyzstan
1293
- KH: Cambodia
1294
- KI: Kiribati
1295
- KM: Comoros
1296
- KN: Saint Kitts and Nevis
1297
- KP: Korea, Democratic People's Republic of
1298
- KR: Korea, Republic of
1299
- KW: Kuwait
1300
- KY: Cayman Islands
1301
- KZ: Kazakhstan
1302
- LA: Lao People's Democratic Republic
1303
- LB: Lebanon
1304
- LC: Saint Lucia
1305
- LI: Liechtenstein
1306
- LK: Sri Lanka
1307
- LR: Liberia
1308
- LS: Lesotho
1309
- LT: Lithuania
1310
- LU: Luxembourg
1311
- LV: Latvia
1312
- LY: Libya
1313
- MA: Morocco
1314
- MC: Monaco
1315
- MD: Moldova, Republic of
1316
- ME: Montenegro
1317
- MF: Saint Martin (French part)
1318
- MG: Madagascar
1319
- MH: Marshall Islands
1320
- MK: North Macedonia
1321
- ML: Mali
1322
- MM: Myanmar
1323
- MN: Mongolia
1324
- MO: Macao
1325
- MP: Northern Mariana Islands
1326
- MQ: Martinique
1327
- MR: Mauritania
1328
- MS: Montserrat
1329
- MT: Malta
1330
- MU: Mauritius
1331
- MV: Maldives
1332
- MW: Malawi
1333
- MX: Mexico
1334
- MY: Malaysia
1335
- MZ: Mozambique
1336
- NA: Namibia
1337
- NC: New Caledonia
1338
- NE: Niger
1339
- NF: Norfolk Island
1340
- NG: Nigeria
1341
- NI: Nicaragua
1342
- NL: Netherlands
1343
- 'NO': Norway
1344
- NP: Nepal
1345
- NR: Nauru
1346
- NU: Niue
1347
- NZ: New Zealand
1348
- OM: Oman
1349
- PA: Panama
1350
- PE: Peru
1351
- PF: French Polynesia
1352
- PG: Papua New Guinea
1353
- PH: Philippines
1354
- PK: Pakistan
1355
- PL: Poland
1356
- PM: Saint Pierre and Miquelon
1357
- PN: Pitcairn
1358
- PR: Puerto Rico
1359
- PS: Palestine, State of
1360
- PT: Portugal
1361
- PW: Palau
1362
- PY: Paraguay
1363
- QA: Qatar
1364
- RE: Réunion
1365
- RO: Romania
1366
- RS: Serbia
1367
- RU: Russia
1368
- RW: Rwanda
1369
- SA: Saudi Arabia
1370
- SB: Solomon Islands
1371
- SC: Seychelles
1372
- SD: Sudan
1373
- SE: Sweden
1374
- SG: Singapore
1375
- SH: Saint Helena, Ascension and Tristan da Cunha
1376
- SI: Slovenia
1377
- SJ: Svalbard and Jan Mayen
1378
- SK: Slovakia
1379
- SL: Sierra Leone
1380
- SM: San Marino
1381
- SN: Senegal
1382
- SO: Somalia
1383
- SR: Suriname
1384
- SS: South Sudan
1385
- ST: Sao Tome and Principe
1386
- SV: El Salvador
1387
- SX: Sint Maarten (Dutch part)
1388
- SY: Syrian Arab Republic
1389
- SZ: Eswatini
1390
- TC: Turks and Caicos Islands
1391
- TD: Chad
1392
- TF: French Southern Territories
1393
- TG: Togo
1394
- TH: Thailand
1395
- TJ: Tajikistan
1396
- TK: Tokelau
1397
- TL: Timor-Leste
1398
- TM: Turkmenistan
1399
- TN: Tunisia
1400
- TO: Tonga
1401
- TR: Turkey
1402
- TT: Trinidad and Tobago
1403
- TV: Tuvalu
1404
- TW: Taiwan
1405
- TZ: Tanzania, United Republic of
1406
- UA: Ukraine
1407
- UG: Uganda
1408
- UM: United States Minor Outlying Islands
1409
1176
  US: United States of America
1410
- UY: Uruguay
1411
- UZ: Uzbekistan
1412
- VA: Holy See (Vatican City State)
1413
- VC: Saint Vincent and the Grenadines
1414
- VE: Venezuela, Bolivarian Republic of
1415
- VG: Virgin Islands, British
1416
- VI: Virgin Islands, U.S.
1417
- VN: Vietnam
1418
- VU: Vanuatu
1419
- WF: Wallis and Futuna
1420
- WS: Samoa
1421
- YE: Yemen
1422
- YT: Mayotte
1423
- ZA: South Africa
1424
- ZM: Zambia
1425
- ZW: Zimbabwe
1426
1177
  coupon: Coupon
1427
1178
  coupon_code: Coupon code
1428
1179
  coupon_code_already_applied: The coupon code has already been applied to this
@@ -1537,6 +1288,8 @@ en:
1537
1288
  %{amount}.
1538
1289
  item_total_less_than_or_equal: This coupon code can't be applied to orders
1539
1290
  less than or equal to %{amount}.
1291
+ item_total_doesnt_match_with_operator: This coupon code can't be applied to
1292
+ orders %{operator} %{amount}.
1540
1293
  limit_once_per_user: This coupon code can only be used once per user.
1541
1294
  missing_product: This coupon code can't be applied because you don't have
1542
1295
  all of the necessary products in your cart.
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ChangeColumnNullOnPrices < ActiveRecord::Migration[5.2]
4
+ def change
5
+ change_column_null(:spree_prices, :amount, false)
6
+ end
7
+ end
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'rails/generators'
4
- require 'rails/version'
5
4
 
6
5
  module Solidus
7
6
  # @private
@@ -16,7 +15,7 @@ module Solidus
16
15
  class_option :migrate, type: :boolean, default: true, banner: 'Run Solidus migrations'
17
16
  class_option :seed, type: :boolean, default: true, banner: 'Load seed data (migrations must be run)'
18
17
  class_option :sample, type: :boolean, default: true, banner: 'Load sample data (migrations must be run)'
19
- class_option :active_storage, type: :boolean, default: Rails.gem_version >= Gem::Version.new("6.1.0"), banner: 'Install ActiveStorage as image attachments handler for products and taxons'
18
+ class_option :active_storage, type: :boolean, default: true, banner: 'Install ActiveStorage as image attachments handler for products and taxons'
20
19
  class_option :auto_accept, type: :boolean
21
20
  class_option :user_class, type: :string
22
21
  class_option :admin_email, type: :string
@@ -133,7 +132,7 @@ module Solidus
133
132
  Solidus has a default authentication extension that uses Devise.
134
133
  You can find more info at https://github.com/solidusio/solidus_auth_devise.
135
134
 
136
- Would you like to install it? (y/n)"))
135
+ Would you like to install it? (Y/n)"))
137
136
 
138
137
  @plugins_to_be_installed << 'solidus_auth_devise'
139
138
  @plugin_generators_to_run << 'solidus:auth:install'
@@ -1,9 +1,11 @@
1
1
  # Configure Solidus Preferences
2
2
  # See http://docs.solidus.io/Spree/AppConfiguration.html for details
3
3
 
4
+ # Solidus version defaults for preferences that are not overridden
5
+ Spree.load_defaults '<%= Spree.solidus_version %>'
6
+
4
7
  Spree.config do |config|
5
8
  # Core:
6
-
7
9
  # Default currency for new sites
8
10
  config.currency = "USD"
9
11
 
@@ -0,0 +1,30 @@
1
+ # This initializer lets you preview the defaults that have changed on the new
2
+ # Solidus version.
3
+ #
4
+ # It allows you to enable them one by one while you adapt your application.
5
+ # When you're done with all of them, you can safely remove this file and add
6
+ # the updated `load_defaults` calls to the top of the config blocks in your
7
+ # Solidus main initializer. You can also call `Spree.load_defaults(version)` to
8
+ # target all components at once.
9
+
10
+ Spree.config do |config|
11
+ <%= @core_changes %>
12
+ end
13
+
14
+ <% if defined?(Spree::Frontend::Engine) -%>
15
+ Spree::Frontend::Config.configure do |config|
16
+ <%= @frontend_changes %>
17
+ end
18
+ <% end -%>
19
+
20
+ <% if defined?(Spree::Backend::Engine) -%>
21
+ Spree::Backend::Config.configure do |config|
22
+ <%= @backend_changes %>
23
+ end
24
+ <% end -%>
25
+
26
+ <% if defined?(Spree::Api::Engine) -%>
27
+ Spree::Api::Config.configure do |config|
28
+ <%= @api_changes %>
29
+ end
30
+ <% end -%>