spree_core 5.3.3 → 5.3.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '08d9b1a3cf8bea4f049c9dd444d3f1977e5752adfec8d31dc1fd91d8ee7ccc00'
4
- data.tar.gz: c3653bae9f794377013d94700bee1eaa9da04485737584af25f103f091e662f5
3
+ metadata.gz: 2b1ea480e8607e801d3c45d8decf522c829003eb3fa6c1f8f92b9185a4bfefec
4
+ data.tar.gz: 552fb0686b6da4a560dd47144d52079d1ab73c270a9e4c9093e62b9e556ef74f
5
5
  SHA512:
6
- metadata.gz: 987979ba7a79782bd0412b510a3ecf566b61adfc6af241801a547c5b26bd401e3a16475cfdd3712ab29db5c062a5e8dfadea2d7c21634e773b0dd8fbab8f0423
7
- data.tar.gz: 73229e1625bafe9ca1c1d8d00d0d1069bdca226aa91ee462abad53e618e4cd546a09cc242d9829a3f7a74ddae11e0ab69f9e4f9bdaf245ae1b4748af95ecb46a
6
+ metadata.gz: 1ed2cab50fb7c122df6565b931324ea7ba307c8580a98ac8f9e2e400140df75092ed417db47311a6d3ec01985a6696cfbce1d3e3fa7917c329646b13ef51b095
7
+ data.tar.gz: 34bd9929ed9e4a962696b2be41a5bb0da2c330fd12d1cbff89e34fa78cdceaa84d6b58cb7ae321d1868864c2888eccd752cd0bef7dbd9cd473aa68490619c2f6
@@ -103,7 +103,7 @@ module Spree
103
103
  translations.with_deleted.each { |rec| rec.update_columns(slug: new_slug.call(rec)) }
104
104
  slugs.with_deleted.each { |rec| rec.update_column(:slug, new_slug.call(rec)) }
105
105
 
106
- translations.find_by!(locale: I18n.locale).update_column(:slug, slug) if Spree.use_translations?
106
+ translations.find_by(locale: I18n.locale)&.update_column(:slug, slug) if Spree.use_translations?
107
107
  end
108
108
  end
109
109
  end
@@ -91,36 +91,33 @@ module Spree
91
91
  scope :backorderable, -> { left_joins(:stock_items).where(spree_stock_items: { backorderable: true }) }
92
92
  scope :in_stock_or_backorderable, -> { in_stock.or(backorderable) }
93
93
 
94
- scope :eligible, -> {
95
- where(is_master: false).or(
96
- where(
97
- product_id: Spree::Variant.
98
- select(:product_id).
99
- group(:product_id).
100
- having("COUNT(#{Spree::Variant.table_name}.id) = 1")
94
+ scope :eligible, lambda {
95
+ joins(:product).where(
96
+ arel_table[:is_master].eq(false).or(
97
+ Spree::Product.arel_table[:variant_count].eq(0)
101
98
  )
102
99
  )
103
100
  }
104
101
 
105
- scope :not_discontinued, -> do
102
+ scope :not_discontinued, lambda {
106
103
  where(
107
104
  arel_table[:discontinue_on].eq(nil).or(
108
105
  arel_table[:discontinue_on].gteq(Time.current)
109
106
  )
110
107
  )
111
- end
108
+ }
112
109
 
113
110
  scope :not_deleted, -> { where("#{Spree::Variant.quoted_table_name}.deleted_at IS NULL") }
114
111
 
115
- scope :for_currency_and_available_price_amount, ->(currency = nil) do
112
+ scope :for_currency_and_available_price_amount, lambda { |currency = nil|
116
113
  currency ||= Spree::Store.default.default_currency
117
114
  joins(:prices).where("#{Spree::Price.table_name}.currency = ?", currency).where("#{Spree::Price.table_name}.amount IS NOT NULL").distinct
118
- end
115
+ }
119
116
 
120
- scope :active, ->(currency = nil) do
117
+ scope :active, lambda { |currency = nil|
121
118
  not_discontinued.not_deleted.
122
119
  for_currency_and_available_price_amount(currency)
123
- end
120
+ }
124
121
 
125
122
  scope :with_option_value, lambda { |option_name, option_value|
126
123
  option_type_ids = OptionType.where(name: option_name).ids
@@ -187,7 +184,8 @@ module Spree
187
184
  )
188
185
 
189
186
  self.whitelisted_ransackable_associations = %w[option_values product tax_category prices default_price]
190
- self.whitelisted_ransackable_attributes = %w[weight depth width height sku discontinue_on is_master cost_price cost_currency track_inventory deleted_at]
187
+ self.whitelisted_ransackable_attributes = %w[weight depth width height sku discontinue_on is_master cost_price cost_currency track_inventory
188
+ deleted_at]
191
189
  self.whitelisted_ransackable_scopes = %i(product_name_or_sku_cont search_by_product_name_or_sku)
192
190
 
193
191
  def self.product_name_or_sku_cont(query)
@@ -258,9 +256,13 @@ module Spree
258
256
  # @return [String] the options text of the variant
259
257
  def options_text
260
258
  @options_text ||= if option_values.loaded?
261
- option_values.sort_by { |ov| ov.option_type.position }.map { |ov| "#{ov.option_type.presentation}: #{ov.presentation}" }.to_sentence(words_connector: ', ', two_words_connector: ', ')
259
+ option_values.sort_by do |ov|
260
+ ov.option_type.position
261
+ end.map { |ov| "#{ov.option_type.presentation}: #{ov.presentation}" }.to_sentence(words_connector: ', ', two_words_connector: ', ')
262
262
  else
263
- option_values.includes(:option_type).joins(:option_type).order("#{Spree::OptionType.table_name}.position").map { |ov| "#{ov.option_type.presentation}: #{ov.presentation}" }.to_sentence(words_connector: ', ', two_words_connector: ', ')
263
+ option_values.includes(:option_type).joins(:option_type).order("#{Spree::OptionType.table_name}.position").map do |ov|
264
+ "#{ov.option_type.presentation}: #{ov.presentation}"
265
+ end.to_sentence(words_connector: ', ', two_words_connector: ', ')
264
266
  end
265
267
  end
266
268
 
@@ -273,7 +275,7 @@ module Spree
273
275
  # Returns the descriptive name of the variant.
274
276
  # @return [String] the descriptive name of the variant
275
277
  def descriptive_name
276
- is_master? ? name + ' - Master' : name + ' - ' + options_text
278
+ is_master? ? "#{name} - Master" : "#{name} - #{options_text}"
277
279
  end
278
280
 
279
281
  # use deleted? rather than checking the attribute directly. this
@@ -18,7 +18,9 @@ module Spree
18
18
  result = products_list.call(store)
19
19
  if result.success?
20
20
  result.value[:products].find_each do |product|
21
- product.variants.active.find_each do |variant|
21
+ product.variants_including_master.active.find_each do |variant|
22
+ next if variant.is_master? && product.has_variants?
23
+
22
24
  add_variant_information_to_xml(xml, product, variant)
23
25
  end
24
26
  end
@@ -45,8 +45,7 @@
45
45
  </div>
46
46
  <%= render "spree/addresses/suggestions_box" %>
47
47
  </div>
48
- <span class="text-sm space-x-2 items-center hidden alert alert-info mt-2 align-items-center" data-address-autocomplete-target="addressWarning">
49
- <%= heroicon "exclamation-circle", variant: :outline if defined?(heroicon) %>
48
+ <span class="text-sm space-x-2 hidden alert alert-info mt-2 static" data-address-autocomplete-target="addressWarning">
50
49
  <%= Spree.t('address_book.add_house_number') %>
51
50
  </span>
52
51
  </div>
@@ -1,5 +1,5 @@
1
1
  module Spree
2
- VERSION = '5.3.3'.freeze
2
+ VERSION = '5.3.4'.freeze
3
3
 
4
4
  def self.version
5
5
  VERSION
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.3.3
4
+ version: 5.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Schofield
@@ -1717,9 +1717,9 @@ licenses:
1717
1717
  - BSD-3-Clause
1718
1718
  metadata:
1719
1719
  bug_tracker_uri: https://github.com/spree/spree/issues
1720
- changelog_uri: https://github.com/spree/spree/releases/tag/v5.3.3
1720
+ changelog_uri: https://github.com/spree/spree/releases/tag/v5.3.4
1721
1721
  documentation_uri: https://docs.spreecommerce.org/
1722
- source_code_uri: https://github.com/spree/spree/tree/v5.3.3
1722
+ source_code_uri: https://github.com/spree/spree/tree/v5.3.4
1723
1723
  rdoc_options: []
1724
1724
  require_paths:
1725
1725
  - lib