solidus_core 4.1.6 → 4.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +0 -1
  3. data/app/assets/images/logo/solidus.svg +18 -1
  4. data/app/assets/images/logo/solidus_logo.png +0 -0
  5. data/app/models/spree/adjustment.rb +2 -0
  6. data/app/models/spree/option_value.rb +1 -0
  7. data/app/models/spree/order.rb +1 -1
  8. data/app/models/spree/order_inventory.rb +6 -4
  9. data/app/models/spree/order_shipping.rb +1 -0
  10. data/app/models/spree/product.rb +19 -1
  11. data/app/models/spree/promotion_handler/coupon.rb +1 -1
  12. data/app/models/spree/stock/simple_coordinator.rb +36 -22
  13. data/app/models/spree/stock/splitter/shipping_category.rb +1 -1
  14. data/app/models/spree/store_selector/by_server_name.rb +1 -1
  15. data/app/models/spree/variant/scopes.rb +4 -0
  16. data/config/locales/en.yml +4 -1
  17. data/lib/generators/solidus/install/app_templates/frontend/starter.rb +1 -1
  18. data/lib/generators/solidus/install/install_generator.rb +9 -0
  19. data/lib/generators/solidus/install/templates/config/initializers/spree.rb.tt +6 -3
  20. data/lib/generators/spree/dummy/dummy_generator.rb +0 -1
  21. data/lib/generators/spree/dummy/templates/rails/database.yml +2 -2
  22. data/lib/spree/app_configuration.rb +0 -2
  23. data/lib/spree/core/state_machines/order.rb +1 -5
  24. data/lib/spree/core/version.rb +2 -2
  25. data/lib/spree/core.rb +0 -4
  26. data/lib/spree/money.rb +1 -1
  27. data/lib/spree/testing_support/dummy_app/assets/stylesheets/solidus_admin/tailwind.css +1 -0
  28. data/lib/spree/testing_support/extension_rake.rb +2 -2
  29. data/lib/spree/user_class_handle.rb +2 -2
  30. data/solidus_core.gemspec +1 -4
  31. metadata +4 -38
  32. data/app/models/spree/promotion_rule_role.rb +0 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 38811ef28b9faebde7b3e42b07d31d5565b80d06835baf1ac58bb0ae97414af9
4
- data.tar.gz: 2d6068d00488c061d340b7d3fd64f1e1ee1400b8d74dcb2e7488651b44738fd8
3
+ metadata.gz: 87d19e38f8adcb38c0b6ef11dbec002b9e91a318f2d4e17fdeacc0c5dc5e8a23
4
+ data.tar.gz: d72606376f7c22b9a3f33f6fde535c7e79170150aedbfcac3ac3a62048aa657f
5
5
  SHA512:
6
- metadata.gz: e6e9c756ed977b4f49af8d1289917227aab0d7014f48c57c7292cfbe7777ac73663e302845c7d2934c2103d8d67da7af622dbaac06e2c6e5ff20ee7e3d0fa313
7
- data.tar.gz: afd76f1f8e11e2c2c0f18fecb226a197b3c7a7ae70d22449bb3866c48f5e8d3dea0bb2b23113a0324dedb1439820bec6a87f2a4b5c5ad7f743b140e418d722f7
6
+ metadata.gz: d383cdf58d3939f4d0e013a9b2598e77e54e6aa0b72b91d3f4be512cce53f049cb560d3843bc7129ef6bbe23c1b36f5a8020e436a4df7d3d2f1e2f8aa3a73c4d
7
+ data.tar.gz: 4cb2ee92d241c9110dd1c261511771ccac993dd21e7d29826859ebaba3218e318da1d9b9f90af5f535c1187f3d46b884768b80fc46ff842f56cadedb39cfd6fc
data/Rakefile CHANGED
@@ -5,7 +5,6 @@ require 'rake'
5
5
  require 'rake/testtask'
6
6
  require 'rspec/core/rake_task'
7
7
  require 'spree/testing_support/dummy_app/rake_tasks'
8
- require 'bundler/gem_tasks'
9
8
 
10
9
  RSpec::Core::RakeTask.new
11
10
  task default: :spec
@@ -1 +1,18 @@
1
- <svg width="153" height="38" viewBox="0 0 153 38" xmlns="http://www.w3.org/2000/svg"><g fill="#242830" fill-rule="nonzero"><path d="M45.0815035 17.9295775l-4.2797203-.808169c-1.6476923-.2729578-2.5838811-.899155-2.5838811-2.0819719 0-1.6056338 1.8135315-2.4994366 3.6431119-2.4994366 1.3962587 0 3.2472377.4335211 5.3496503 2.2050704l2.4340909-2.9971831c-2.706923-1.93746476-5.1196153-2.75098589-7.863986-2.75098589-4.9537762 0-7.7890909 3.12563379-7.7890909 6.47605629 0 2.8312677 1.5620979 4.6242254 7.1417832 5.6678874l2.4126923.4549295c1.5620979.2943662 2.5838812.9794367 2.5838812 2.2907043 0 1.1025352-1.4818532 2.4994366-3.9373427 2.4994366-2.2040559 0-4.7023426-1.2684507-6.2216433-2.9169014l-2.9637063 2.9597183c2.706923 2.2907042 5.5796853 3.4788732 8.9285664 3.4788732 6.0183566 0 8.3882517-3.7464788 8.3882517-6.6847887s-1.727937-4.6456338-5.2426573-5.2932394zM62.960035 8.99690141c-6.9545455 0-10.9293357 5.20760559-10.9293357 10.43661969 0 5.2290141 4.0175874 10.4312676 10.9293357 10.4312676 6.9117482 0 10.9293356-5.2076056 10.9293356-10.4312676 0-5.2236619-4.0175874-10.43661969-10.9293356-10.43661969zm0 16.89126759c-3.5454364 0-6.4195805-2.8754669-6.4195805-6.4225352 0-3.5470682 2.8741441-6.4225352 6.4195805-6.4225352 3.5454363 0 6.4195804 2.875467 6.4195804 6.4225352.0277543 1.7117236-.6396762 3.3615035-1.8496498 4.572034-1.2099737 1.2105306-2.8589946 1.8782684-4.5699306 1.8505012zM88.5634615 3.58591549c-1.1818121 0-2.1398601.95848899-2.1398601 2.14084507 0 1.18235609.958048 2.14084507 2.1398601 2.14084507 1.1818122 0 2.1398602-.95848898 2.1398602-2.14084507 0-1.18235608-.958048-2.14084507-2.1398602-2.14084507zm-2.1238112 8.53661971h4.2476224v17.763662h-4.2476224v-17.763662zm23.8915387-1.0597183c-1.951059-1.37951017-4.293144-2.09615393-6.681713-2.04450704-6.9063991 0-10.9239865 5.20760564-10.9239865 10.43126764 0 5.2236619 4.0175874 10.4366197 10.9239865 10.4366197 2.388342.0384309 4.727465-.6810542 6.681713-2.0552113v2.0445071h4.247622V3.58591549h-4.247622v7.47690141zm-6.681713 14.8253521c-3.545437 0-6.4195809-2.8754669-6.4195809-6.4225352 0-3.5470682 2.8741439-6.4225352 6.4195809-6.4225352 3.545436 0 6.41958 2.875467 6.41958 6.4225352.027754 1.7117236-.639676 3.3615035-1.84965 4.572034-1.209974 1.2105306-2.858994 1.8782684-4.56993 1.8505012zm26.881993-5.2504225c0 2.9169014-2.139861 4.9988732-4.787938 4.9988732-2.648076 0-4.787937-2.0819718-4.787937-4.9988732V9.03971831h-4.27972V21.0123944c0 5.5822535 4.349266 8.8952112 9.051609 8.8952112 4.702342 0 9.083706-3.3343662 9.083706-8.8952112V9.03971831h-4.27972V20.6377465zm17.118881-2.6439437l-4.279721-.8135211c-1.647692-.2676056-2.583881-.8938028-2.583881-2.0819718 0-1.6056338 1.813532-2.4994367 3.643112-2.4994367 1.396259 0 3.247238.4388733 5.34965 2.2104226l2.434091-2.9971831c-2.701573-1.93746481-5.119615-2.75098594-7.863986-2.75098594-4.953776 0-7.783741 3.12563384-7.783741 6.47605634 0 2.8098592 1.556748 4.6242254 7.115035 5.6411268l2.418042.4602816c1.556748.2890141 2.578532.9794367 2.578532 2.2907043 0 1.1025352-1.476504 2.4994366-3.931993 2.4994366-2.209406 0-4.707693-1.2684507-6.226993-2.9169014l-2.91021 2.9811267c2.680175 2.2907043 5.547587 3.4788733 8.901818 3.4788733 6.013007 0 8.388252-3.7464789 8.388252-6.6847887 0-2.9383099-1.727937-4.6456338-5.248007-5.2932395zm-67.3734969 3.7678873V7.98c0-4.14788732-2.0382167-5.64647887-6.4195804-7.74985916L71.9848951 3.5859155l2.2896504 1.31126761c1.1822727.68507042 1.6637412 1.45577465 1.727937 3.45746479V22.1577465c0 4.1478873 2.0382168 5.6464789 6.4195804 7.7498591l1.8723777-3.3557746-2.2896504-1.3326761c-1.1876224-.6850704-1.6637412-1.4557746-1.7279371-3.4574648zM.20863636 37.8876056H23.6829021V.15521127H.20863636V37.8876056zM3.56821678 3.51633803H20.2698252V34.4729577H3.56821678V3.51633803z"/><path d="M13.5934615 24.2450704V13.6104225c0-3.2112676-1.5727972-4.35126757-4.95912584-5.97295771L7.18993007 10.2225352l1.76538462 1.0169014c.91479021.5352113 1.28391611 1.1239437 1.33206291 2.6760564v10.6507042c0 3.2112676 1.5727972 4.3512676 4.9591259 5.9729577l1.4497552-2.5850704-1.7707342-1.043662c-.9147902-.5298591-1.2839161-1.1239436-1.332063-2.6653521z"/></g></svg>
1
+ <svg width="800" height="154" viewBox="0 0 800 154" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g clip-path="url(#clip0_1325_2710)">
3
+ <path d="M47.8141 51.0973V102.195L0 54.3805C9.53862 22.9134 38.7766 0 73.3714 0C107.966 0 135.13 21.3237 145.654 51.0973H47.8141Z" fill="#EF3023"/>
4
+ <path d="M146.725 98.9286C137.187 130.413 107.949 153.309 73.3541 153.309C38.7593 153.309 11.595 131.968 1.07137 102.212H98.9114V51.0973L146.725 98.9114V98.9286Z" fill="#EF3023"/>
5
+ <path d="M282.53 99.9481C282.53 79.765 265.734 73.9934 251.028 69.9499C236.478 65.9063 225.972 64.3165 225.972 53.6547C225.972 45.8614 233.109 40.0898 243.615 40.0898C254.121 40.0898 261.811 46.4316 263.072 56.0912H281.13C278.469 36.0463 263.919 23.6392 243.615 23.6392C223.311 23.6392 207.776 36.772 207.776 53.9312C207.776 74.4081 224.434 80.1797 239.278 84.2232C253.828 88.1113 264.61 89.8565 264.61 100.518C264.61 108.156 256.627 113.928 245.568 113.928C232.556 113.928 224.849 107.724 223.173 96.4748H204.7C206.515 117.246 222.62 130.361 245.568 130.361C267.271 130.361 282.513 118.11 282.513 99.9309L282.53 99.9481Z" fill="#222222"/>
6
+ <path d="M345.637 130.378C375.739 130.378 396.44 106.878 396.44 77.0175C396.44 47.1574 375.721 23.6565 345.637 23.6565C315.552 23.6565 294.833 47.1574 294.833 77.0175C294.833 106.878 315.552 130.378 345.637 130.378ZM345.637 112.787C326.888 112.787 313.029 97.3562 313.029 77.0175C313.029 56.6788 326.888 41.2477 345.637 41.2477C364.385 41.2477 378.244 56.9725 378.244 77.0175C378.244 97.0624 362.848 112.787 345.637 112.787Z" fill="#222222"/>
7
+ <path d="M474.961 111.629H428.063V25.0906H410.42V128.927H474.944V111.612L474.961 111.629Z" fill="#222222"/>
8
+ <path d="M493.399 25.0906V128.927H511.042V25.0906H493.399Z" fill="#222222"/>
9
+ <path d="M566.753 25.0908H531.208V128.927H566.753C594.609 128.927 615.189 108.156 615.189 77.0002C615.189 45.8442 594.609 25.0735 566.753 25.0735V25.0908ZM566.338 111.63H548.834V42.4054H566.338C584.811 42.4054 596.993 56.2468 596.993 77.0175C596.993 97.7882 584.811 111.63 566.338 111.63Z" fill="#222222"/>
10
+ <path d="M708.156 25.0906H690.513V89.7009C690.513 103.11 683.238 112.77 668.671 112.77C655.797 112.77 646.829 104.977 646.829 89.7009V25.0906H629.186V90.1329C629.186 114.221 645.274 130.378 668.654 130.378C692.034 130.378 708.122 114.221 708.122 90.1329V25.0906H708.156Z" fill="#222222"/>
11
+ <path d="M800 99.9481C800 79.765 783.204 73.9934 768.498 69.9499C753.949 65.9063 743.442 64.3165 743.442 53.6547C743.442 45.8614 750.579 40.0898 761.085 40.0898C771.592 40.0898 779.281 46.4316 780.543 56.0912H798.6C795.939 36.0463 781.389 23.6392 761.085 23.6392C740.781 23.6392 725.246 36.772 725.246 53.9312C725.246 74.4081 741.904 80.1797 756.748 84.2232C771.298 88.1113 782.081 89.8565 782.081 100.518C782.081 108.156 774.097 113.928 763.038 113.928C750.026 113.928 742.319 107.724 740.643 96.4748H722.17C723.985 117.246 740.09 130.361 763.038 130.361C784.724 130.361 799.983 118.11 799.983 99.9309L800 99.9481Z" fill="#222222"/>
12
+ </g>
13
+ <defs>
14
+ <clipPath id="clip0_1325_2710">
15
+ <rect width="800" height="153.309" fill="white"/>
16
+ </clipPath>
17
+ </defs>
18
+ </svg>
@@ -48,6 +48,8 @@ module Spree
48
48
  scope :is_included, -> { where(included: true) }
49
49
  scope :additional, -> { where(included: false) }
50
50
 
51
+ singleton_class.deprecate :return_authorization, deprecator: Spree.deprecator
52
+
51
53
  extend DisplayMoney
52
54
  money_methods :amount
53
55
 
@@ -17,6 +17,7 @@ module Spree
17
17
  delegate :name, :presentation, to: :option_type, prefix: :option_type
18
18
 
19
19
  self.allowed_ransackable_attributes = %w[name presentation]
20
+ self.allowed_ransackable_associations = %w[variants]
20
21
 
21
22
  # Updates the updated_at column on all the variants associated with this
22
23
  # option value.
@@ -630,7 +630,7 @@ module Spree
630
630
  if can_complete? || complete?
631
631
  valid_store_credit_payments.to_a.sum(&:amount)
632
632
  else
633
- [total, user.try(:available_store_credit_total, currency: currency) || 0.0].min
633
+ [total, (user.try(:available_store_credit_total, currency: currency) || 0.0)].min
634
634
  end
635
635
  end
636
636
 
@@ -61,10 +61,12 @@ module Spree
61
61
 
62
62
  potential_shipments.detect do |shipment|
63
63
  shipment.include?(variant)
64
- end || potential_shipments.detect do |shipment|
65
- stock_item = variant.stock_items.detect { |stock_item| stock_item.stock_location == shipment.stock_location }
66
- if stock_item
67
- stock_item.backorderable? || stock_item.count_on_hand >= quantity
64
+ end || begin
65
+ stock_items = variant.stock_items.sort_by(&:id) # cache stock items to avoid N+1
66
+
67
+ potential_shipments.detect do |shipment|
68
+ stock_item = stock_items.detect { |stock_item| stock_item.stock_location == shipment.stock_location }
69
+ stock_item.backorderable? || stock_item.count_on_hand >= quantity if stock_item
68
70
  end
69
71
  end || potential_shipments.detect do |shipment|
70
72
  variant.stock_location_ids.include?(shipment.stock_location_id)
@@ -44,6 +44,7 @@ class Spree::OrderShipping
44
44
  # @return The carton created.
45
45
  def ship(inventory_units:, stock_location:, address:, shipping_method:,
46
46
  shipped_at: Time.current, external_number: nil, tracking_number: nil, suppress_mailer: false)
47
+
47
48
  carton = nil
48
49
 
49
50
  Spree::InventoryUnit.transaction do
@@ -131,8 +131,26 @@ module Spree
131
131
 
132
132
  alias :options :product_option_types
133
133
 
134
+ # The :variants_option_values ransacker filters Spree::Product based on
135
+ # variant option values ids.
136
+ #
137
+ # Usage:
138
+ # Spree::Product.ransack(
139
+ # variants_option_values_in: [option_value_id1, option_value_id2]
140
+ # ).result
141
+ ransacker :variants_option_values, formatter: proc { |v|
142
+ if OptionValue.exists?(v)
143
+ joins(variants_including_master: :option_values)
144
+ .where(spree_option_values: { id: v })
145
+ .distinct
146
+ .select(:id).arel
147
+ end
148
+ } do |parent|
149
+ parent.table[:id]
150
+ end
151
+
134
152
  self.allowed_ransackable_associations = %w[stores variants_including_master master variants]
135
- self.allowed_ransackable_attributes = %w[name slug]
153
+ self.allowed_ransackable_attributes = %w[name slug variants_option_values]
136
154
  self.allowed_ransackable_scopes = %i[available with_discarded with_all_variant_sku_cont with_kept_variant_sku_cont]
137
155
 
138
156
  # @return [Boolean] true if there are any variants
@@ -73,7 +73,7 @@ module Spree
73
73
 
74
74
  unless promotion.eligible?(order, promotion_code: promotion_code)
75
75
  set_promotion_eligibility_error_code(promotion)
76
- return error || ineligible_for_this_order
76
+ return (error || ineligible_for_this_order)
77
77
  end
78
78
 
79
79
  # If any of the actions for the promotion return `true`,
@@ -22,39 +22,65 @@ module Spree
22
22
  class SimpleCoordinator
23
23
  attr_reader :order
24
24
 
25
+ # @api private
26
+ attr_reader :inventory_units, :splitters, :stock_locations,
27
+ :filtered_stock_locations, :inventory_units_by_variant, :desired,
28
+ :availability, :allocator, :packages
29
+
25
30
  def initialize(order, inventory_units = nil)
26
31
  @order = order
27
32
  @inventory_units =
28
33
  inventory_units || Spree::Config.stock.inventory_unit_builder_class.new(order).units
29
34
  @splitters = Spree::Config.environment.stock_splitters
30
35
 
31
- filtered_stock_locations = Spree::Config.stock.location_filter_class.new(Spree::StockLocation.all, @order).filter
36
+ @filtered_stock_locations = Spree::Config.stock.location_filter_class.new(load_stock_locations, order).filter
32
37
  sorted_stock_locations = Spree::Config.stock.location_sorter_class.new(filtered_stock_locations).sort
33
38
  @stock_locations = sorted_stock_locations
34
39
 
35
40
  @inventory_units_by_variant = @inventory_units.group_by(&:variant)
36
- @desired = Spree::StockQuantities.new(@inventory_units_by_variant.transform_values(&:count))
41
+ @desired = Spree::StockQuantities.new(inventory_units_by_variant.transform_values(&:count))
37
42
  @availability = Spree::Stock::Availability.new(
38
- variants: @desired.variants,
39
- stock_locations: @stock_locations
43
+ variants: desired.variants,
44
+ stock_locations: stock_locations
40
45
  )
41
46
 
42
- @allocator = Spree::Config.stock.allocator_class.new(@availability)
47
+ @allocator = Spree::Config.stock.allocator_class.new(availability)
43
48
  end
44
49
 
45
50
  def shipments
46
- @shipments ||= build_shipments
51
+ @shipments ||= begin
52
+ @packages = build_packages
53
+ shipments = build_shipments
54
+
55
+ # Make sure we don't add the proposed shipments to the order
56
+ order.shipments = order.shipments - shipments
57
+
58
+ shipments
59
+ end
47
60
  end
48
61
 
49
62
  private
50
63
 
64
+ def load_stock_locations
65
+ Spree::StockLocation.all
66
+ end
67
+
51
68
  def build_shipments
69
+ # Turn the Stock::Packages into a Shipment with rates
70
+ packages.map do |package|
71
+ shipment = package.shipment = package.to_shipment
72
+ shipment.shipping_rates = Spree::Config.stock.estimator_class.new.shipping_rates(package)
73
+ shipment
74
+ end
75
+ end
76
+
77
+ def build_packages
52
78
  # Allocate any available on hand inventory and remaining desired inventory from backorders
53
- on_hand_packages, backordered_packages, leftover = @allocator.allocate_inventory(@desired)
79
+ on_hand_packages, backordered_packages, leftover = allocator.allocate_inventory(desired)
54
80
 
55
81
  raise Spree::Order::InsufficientStock.new(items: leftover.quantities) unless leftover.empty?
56
82
 
57
- packages = @stock_locations.map do |stock_location|
83
+ packages = stock_locations.map do |stock_location|
58
84
  # Combine on_hand and backorders into a single package per-location
59
85
  on_hand = on_hand_packages[stock_location.id] || Spree::StockQuantities.new
60
86
  backordered = backordered_packages[stock_location.id] || Spree::StockQuantities.new
@@ -71,19 +97,7 @@ module Spree
71
97
  end.compact
72
98
 
73
99
  # Split the packages
74
- packages = split_packages(packages)
75
-
76
- # Turn the Stock::Packages into a Shipment with rates
77
- shipments = packages.map do |package|
78
- shipment = package.shipment = package.to_shipment
79
- shipment.shipping_rates = Spree::Config.stock.estimator_class.new.shipping_rates(package)
80
- shipment
81
- end
82
-
83
- # Make sure we don't add the proposed shipments to the order
84
- order.shipments = order.shipments - shipments
85
-
86
- shipments
100
+ split_packages(packages)
87
101
  end
88
102
 
89
103
  def split_packages(initial_packages)
@@ -96,7 +110,7 @@ module Spree
96
110
  def get_units(quantities)
97
111
  # Change our raw quantities back into inventory units
98
112
  quantities.flat_map do |variant, quantity|
99
- @inventory_units_by_variant[variant].shift(quantity)
113
+ inventory_units_by_variant[variant].shift(quantity)
100
114
  end
101
115
  end
102
116
  end
@@ -24,7 +24,7 @@ module Spree
24
24
 
25
25
  def hash_to_packages(categories)
26
26
  packages = []
27
- categories.each_value do |contents|
27
+ categories.each do |_id, contents|
28
28
  packages << build_package(contents)
29
29
  end
30
30
  packages
@@ -25,7 +25,7 @@ module Spree
25
25
  store = Spree::Store.where(url: server_name).or(Store.where(default: true)).order(default: :asc).first
26
26
 
27
27
  # Provide a fallback, mostly for legacy/testing purposes
28
- store || Spree::Store.new
28
+ store || Spree::Store.new(url: server_name)
29
29
  end
30
30
  end
31
31
  end
@@ -10,6 +10,10 @@ module Spree
10
10
  order(Arel.sql("COALESCE((SELECT COUNT(*) FROM #{Spree::LineItem.quoted_table_name} GROUP BY #{Spree::LineItem.quoted_table_name}.variant_id HAVING #{Spree::LineItem.quoted_table_name}.variant_id = #{Spree::Variant.quoted_table_name}.id), 0) DESC"))
11
11
  }
12
12
 
13
+ scope :by_stock_location, ->(stock_location_id) {
14
+ joins(:stock_locations).where(spree_stock_locations: { id: stock_location_id })
15
+ }
16
+
13
17
  class << self
14
18
  # Returns variants that match a given option value
15
19
  #
@@ -179,6 +179,7 @@ en:
179
179
  price: Master Price
180
180
  promotionable: Promotable
181
181
  shipping_category: Shipping Category
182
+ sku: Master SKU
182
183
  slug: Slug
183
184
  tax_category: Tax Category
184
185
  weight: Weight
@@ -1539,7 +1540,6 @@ en:
1539
1540
  end: End
1540
1541
  ending_in: Ending in
1541
1542
  error: error
1542
- error_user_destroy_with_orders: Cannot delete a user with orders
1543
1543
  errors:
1544
1544
  messages:
1545
1545
  cannot_delete_finalized_stock_location: Stock Location cannot be destroyed if you have open stock transfers.
@@ -1790,6 +1790,9 @@ en:
1790
1790
  name_contains: Name Contains
1791
1791
  name_on_card: Name on card
1792
1792
  name_or_sku: Name or SKU (enter at least first 4 characters of product name)
1793
+ navigation:
1794
+ switch_to_legacy: Switch to legacy admin
1795
+ switch_to_solidus_admin: Switch to new admin
1793
1796
  negative_movement_absent_item: Cannot create negative movement for absent stock item.
1794
1797
  new: New
1795
1798
  new_adjustment: New Adjustment
@@ -1 +1 @@
1
- apply 'https://github.com/solidusio/solidus_starter_frontend/raw/v4.1/template.rb'
1
+ apply 'https://github.com/solidusio/solidus_starter_frontend/raw/v4.2/template.rb'
@@ -34,6 +34,7 @@ module Solidus
34
34
  class_option :seed, type: :boolean, default: true, banner: 'Load seed data (migrations must be run)'
35
35
  class_option :sample, type: :boolean, default: true, banner: 'Load sample data (migrations and seeds must be run)'
36
36
  class_option :active_storage, type: :boolean, default: true, banner: 'Install ActiveStorage as image attachments handler for products and taxons'
37
+ class_option :admin_preview, type: :boolean, default: false, desc: 'Install the admin preview'
37
38
  class_option :auto_accept, type: :boolean
38
39
  class_option :user_class, type: :string
39
40
  class_option :admin_email, type: :string
@@ -158,6 +159,14 @@ module Solidus
158
159
  end
159
160
  end
160
161
 
162
+ def install_solidus_admin
163
+ return unless options[:admin_preview]
164
+
165
+ say_status :installing, "SolidusAdmin", :blue
166
+ bundle_command 'add solidus_admin'
167
+ generate 'solidus_admin:install'
168
+ end
169
+
161
170
  def install_subcomponents
162
171
  apply_template_for :authentication, @selected_authentication
163
172
  apply_template_for :frontend, @selected_frontend
@@ -57,9 +57,12 @@ Spree::Backend::Config.configure do |config|
57
57
  # a new menu item:
58
58
  #
59
59
  # config.menu_items << config.class::MenuItem.new(
60
- # [:section],
61
- # 'icon-name',
62
- # url: 'https://solidus.io/'
60
+ # label: :my_reports,
61
+ # icon: 'file-text-o', # see https://fontawesome.com/v4/icons/
62
+ # url: :my_admin_reports_path,
63
+ # condition: -> { can?(:admin, MyReports) },
64
+ # partial: 'spree/admin/shared/my_reports_sub_menu',
65
+ # match_path: '/reports',
63
66
  # )
64
67
 
65
68
  # Custom frontend product path
@@ -44,7 +44,6 @@ module Spree
44
44
  opts[:skip_yarn] = true
45
45
  opts[:skip_bootsnap] = true
46
46
  opts[:skip_javascript] = true
47
- opts[:skip_action_cable] = true
48
47
 
49
48
  puts "Generating dummy Rails application..."
50
49
  invoke Rails::Generators::AppGenerator,
@@ -3,7 +3,7 @@
3
3
  'mysql'
4
4
  when 'postgres', 'postgresql'
5
5
  'postgres'
6
- when /sqlite3?/, '', nil
6
+ when 'sqlite', '', nil
7
7
  'sqlite'
8
8
  else
9
9
  raise "Invalid DB specified: #{ENV['DB']}"
@@ -19,7 +19,7 @@
19
19
  <% db_username = ENV['DB_USERNAME'] %>
20
20
  <% db_password = ENV['DB_PASSWORD'] %>
21
21
 
22
- <% case db
22
+ <% case ENV['DB']
23
23
  when 'mysql' %>
24
24
  development:
25
25
  adapter: mysql2
@@ -22,8 +22,6 @@ require "spree/core/search/variant"
22
22
  require 'spree/preferences/configuration'
23
23
  require 'spree/core/environment'
24
24
 
25
- require 'uri'
26
-
27
25
  module Spree
28
26
  class AppConfiguration < Preferences::Configuration
29
27
  # Preferences (alphabetized to more easily lookup particular preferences)
@@ -46,11 +46,7 @@ module Spree
46
46
 
47
47
  # Persist the state on the order
48
48
  after_transition do |order, transition|
49
- # Hard to say if this is really necessary, it was introduced in this commit:
50
- # https://github.com/mamhoff/solidus/commit/fa1d66c42e4c04ee7cd1c20d87e4cdb74a226d3d
51
- # But it seems to be harmless, so we'll keep it for now.
52
- order.state = order.state # rubocop:disable Lint/SelfAssignment
53
-
49
+ order.state = order.state
54
50
  order.state_changes.create(
55
51
  previous_state: transition.from,
56
52
  next_state: transition.to,
@@ -1,14 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Spree
4
- VERSION = "4.1.6"
4
+ VERSION = "4.2.0"
5
5
 
6
6
  def self.solidus_version
7
7
  VERSION
8
8
  end
9
9
 
10
10
  def self.previous_solidus_minor_version
11
- '4.0'
11
+ '4.1'
12
12
  end
13
13
 
14
14
  def self.solidus_gem_version
data/lib/spree/core.rb CHANGED
@@ -42,10 +42,6 @@ module Spree
42
42
  end
43
43
  end
44
44
 
45
- def self.user_class_name
46
- @@user_class
47
- end
48
-
49
45
  # Load the same version defaults for all available Solidus components
50
46
  #
51
47
  # @see Spree::Preferences::Configuration#load_defaults
data/lib/spree/money.rb CHANGED
@@ -35,7 +35,7 @@ module Spree
35
35
  if amount.is_a?(::Money)
36
36
  @money = amount
37
37
  else
38
- currency = options[:currency] || Spree::Config[:currency]
38
+ currency = (options[:currency] || Spree::Config[:currency])
39
39
 
40
40
  @money = Monetize.from_string(amount, currency)
41
41
  end
@@ -0,0 +1 @@
1
+ /* Placeholder for compiled tailwind.css file */
@@ -4,8 +4,8 @@ require 'spree/testing_support/common_rake'
4
4
 
5
5
  desc "Generates a dummy app for testing an extension"
6
6
  namespace :extension do
7
- task :test_app, [:user_class] do |_t, args|
7
+ task :test_app, [:user_class] do |_t, _args|
8
8
  Spree::DummyGeneratorHelper.inject_extension_requirements = true
9
- Rake::Task['common:test_app'].invoke(args[:user_class])
9
+ Rake::Task['common:test_app'].invoke
10
10
  end
11
11
  end
@@ -21,8 +21,8 @@ module Spree
21
21
  # @return [String] the name of the user class as a string.
22
22
  # @raise [RuntimeError] if Spree.user_class is nil
23
23
  def to_s
24
- fail "'Spree.user_class' has not been set yet." unless Spree.user_class_name
25
- "::#{Spree.user_class_name}"
24
+ fail "'Spree.user_class' has not been set yet." unless Spree.user_class
25
+ "::#{Spree.user_class}"
26
26
  end
27
27
  end
28
28
  end
data/solidus_core.gemspec CHANGED
@@ -25,7 +25,7 @@ Gem::Specification.new do |s|
25
25
 
26
26
  %w[
27
27
  actionmailer actionpack actionview activejob activemodel activerecord
28
- activestorage activesupport railties
28
+ activesupport railties
29
29
  ].each do |rails_dep|
30
30
  s.add_dependency rails_dep, ['>= 7.0', '< 7.1']
31
31
  end
@@ -35,9 +35,6 @@ Gem::Specification.new do |s|
35
35
  s.add_dependency 'awesome_nested_set', '~> 3.3'
36
36
  s.add_dependency 'cancancan', ['>= 2.2', '< 4.0']
37
37
  s.add_dependency 'carmen', '~> 1.1.0'
38
- # Adding a constraint here to make sure Rails 7.0 does not crash on startup
39
- # https://github.com/rails/rails/pull/54264
40
- s.add_dependency 'concurrent-ruby', '< 1.3.5'
41
38
  s.add_dependency 'discard', '~> 1.0'
42
39
  s.add_dependency 'friendly_id', '~> 5.0'
43
40
  s.add_dependency 'image_processing', '~> 1.10'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.6
4
+ version: 4.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Solidus Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-02-12 00:00:00.000000000 Z
11
+ date: 2023-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionmailer
@@ -130,26 +130,6 @@ dependencies:
130
130
  - - "<"
131
131
  - !ruby/object:Gem::Version
132
132
  version: '7.1'
133
- - !ruby/object:Gem::Dependency
134
- name: activestorage
135
- requirement: !ruby/object:Gem::Requirement
136
- requirements:
137
- - - ">="
138
- - !ruby/object:Gem::Version
139
- version: '7.0'
140
- - - "<"
141
- - !ruby/object:Gem::Version
142
- version: '7.1'
143
- type: :runtime
144
- prerelease: false
145
- version_requirements: !ruby/object:Gem::Requirement
146
- requirements:
147
- - - ">="
148
- - !ruby/object:Gem::Version
149
- version: '7.0'
150
- - - "<"
151
- - !ruby/object:Gem::Version
152
- version: '7.1'
153
133
  - !ruby/object:Gem::Dependency
154
134
  name: activesupport
155
135
  requirement: !ruby/object:Gem::Requirement
@@ -266,20 +246,6 @@ dependencies:
266
246
  - - "~>"
267
247
  - !ruby/object:Gem::Version
268
248
  version: 1.1.0
269
- - !ruby/object:Gem::Dependency
270
- name: concurrent-ruby
271
- requirement: !ruby/object:Gem::Requirement
272
- requirements:
273
- - - "<"
274
- - !ruby/object:Gem::Version
275
- version: 1.3.5
276
- type: :runtime
277
- prerelease: false
278
- version_requirements: !ruby/object:Gem::Requirement
279
- requirements:
280
- - - "<"
281
- - !ruby/object:Gem::Version
282
- version: 1.3.5
283
249
  - !ruby/object:Gem::Dependency
284
250
  name: discard
285
251
  requirement: !ruby/object:Gem::Requirement
@@ -611,7 +577,6 @@ files:
611
577
  - app/models/spree/promotion_handler/page.rb
612
578
  - app/models/spree/promotion_handler/shipping.rb
613
579
  - app/models/spree/promotion_rule.rb
614
- - app/models/spree/promotion_rule_role.rb
615
580
  - app/models/spree/promotion_rule_store.rb
616
581
  - app/models/spree/promotion_rule_taxon.rb
617
582
  - app/models/spree/promotion_rule_user.rb
@@ -930,6 +895,7 @@ files:
930
895
  - lib/spree/testing_support/controller_requests.rb
931
896
  - lib/spree/testing_support/dummy_app.rb
932
897
  - lib/spree/testing_support/dummy_app/assets/javascripts/spree/backend/all.js
898
+ - lib/spree/testing_support/dummy_app/assets/stylesheets/solidus_admin/tailwind.css
933
899
  - lib/spree/testing_support/dummy_app/assets/stylesheets/spree/backend/all.css
934
900
  - lib/spree/testing_support/dummy_app/database.yml
935
901
  - lib/spree/testing_support/dummy_app/mailer_previews/test_mailer_preview.rb
@@ -1062,7 +1028,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1062
1028
  - !ruby/object:Gem::Version
1063
1029
  version: 1.8.23
1064
1030
  requirements: []
1065
- rubygems_version: 3.5.3
1031
+ rubygems_version: 3.3.23
1066
1032
  signing_key:
1067
1033
  specification_version: 4
1068
1034
  summary: Essential models, mailers, and classes for the Solidus e-commerce project.
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Spree
4
- class PromotionRuleRole < Spree::Base
5
- belongs_to :promotion_rule, class_name: 'Spree::PromotionRule', optional: true
6
- belongs_to :role, class_name: 'Spree::Role', optional: true
7
- end
8
- end