solidus_legacy_promotions 4.7.3 → 4.8.1

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: 2437799e27ac497bdf921ac3a8d044dfc166a072d9f368fd9cabc3a8d2a71518
4
- data.tar.gz: bae186981e43abf5ca0424b75bb22ffe9119dc2d3033549d81b3a62158096010
3
+ metadata.gz: f32ed93304a964a9c756ea1bf1b4544936787c7ce13afea25d79ec8151e13ff8
4
+ data.tar.gz: 686d13317a25eaf7ab72eec6f8a81f024df87b8bce3cb6975b95b1eb56d83eb0
5
5
  SHA512:
6
- metadata.gz: d1e90fbf03bff5160dbe85165ce8c557a6440189f9f2c01caaa48789ae76d32050e281b6dd127ee400874725ca2c4f3f5657cb1676a489e1e5e005c73a46746c
7
- data.tar.gz: bd39cf56788617f06c38e354bc90e8c2265a2d58998eb9e1a24e56cda4ea8f1460fe27c5b8048c9a3a69865ad241c69c0524a81c6ef78554536116251685ea15
6
+ metadata.gz: c1470fb3ca91bbb0f49ebddfa7e3bc7c77c8b5c29bdfd6267cf81289d9d64308cf15b4f6c19442b0c27b58a1bcdbc6302f2ae817f58b4f7ae0ea9a765d02e470
7
+ data.tar.gz: c4999d2870f0d20837d0dee599aae83d29b47286fe6c2815e4f77cd62c4e8ba2de2e2bc4f7f89d7f9dbbbb5521193f23b544a6390b836f2bd8eab6b979bb073a
data/LICENSE ADDED
@@ -0,0 +1,29 @@
1
+ Copyright (c) 2007-2014, Spree Commerce, Inc. and other contributors
2
+ All rights reserved.
3
+
4
+ Copyright (c) 2015-2026, Solidus contributors
5
+ All rights reserved.
6
+
7
+ Redistribution and use in source and binary forms, with or without modification,
8
+ are permitted provided that the following conditions are met:
9
+
10
+ * Redistributions of source code must retain the above copyright notice,
11
+ this list of conditions and the following disclaimer.
12
+ * Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+ * Neither the name Spree nor the names of its contributors may be used to
16
+ endorse or promote products derived from this software without specific
17
+ prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
23
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -10,7 +10,7 @@ require_dependency "spree/calculator"
10
10
  module Spree
11
11
  class Calculator::DistributedAmount < Calculator
12
12
  preference :amount, :decimal, default: 0
13
- preference :currency, :string, default: -> { Spree::Config[:currency] }
13
+ preference :currency, :string, default: -> { Spree::Config.currency }
14
14
 
15
15
  def compute_line_item(line_item)
16
16
  return 0 unless line_item
@@ -7,7 +7,7 @@ module Spree
7
7
  preference :first_item, :decimal, default: 0
8
8
  preference :additional_item, :decimal, default: 0
9
9
  preference :max_items, :integer, default: 0
10
- preference :currency, :string, default: -> { Spree::Config[:currency] }
10
+ preference :currency, :string, default: -> { Spree::Config.currency }
11
11
 
12
12
  def compute(object)
13
13
  items_count = object.quantity
@@ -6,7 +6,7 @@ module Spree
6
6
  class Calculator::TieredFlatRate < Calculator
7
7
  preference :base_amount, :decimal, default: 0
8
8
  preference :tiers, :hash, default: {}
9
- preference :currency, :string, default: -> { Spree::Config[:currency] }
9
+ preference :currency, :string, default: -> { Spree::Config.currency }
10
10
 
11
11
  before_validation do
12
12
  # Convert tier values to decimals. Strings don't do us much good.
@@ -6,7 +6,7 @@ module Spree
6
6
  class Calculator::TieredPercent < Calculator
7
7
  preference :base_percent, :decimal, default: 0
8
8
  preference :tiers, :hash, default: {}
9
- preference :currency, :string, default: -> { Spree::Config[:currency] }
9
+ preference :currency, :string, default: -> { Spree::Config.currency }
10
10
 
11
11
  before_validation do
12
12
  # Convert tier values to decimals. Strings don't do us much good.
@@ -15,6 +15,7 @@ module Spree
15
15
 
16
16
  def call(persist: true)
17
17
  all_items = line_items + shipments
18
+ ActiveRecord::Associations::Preloader.new(records: all_items, associations: :adjustments).call
18
19
  all_items.each do |item|
19
20
  promotion_adjustments = item.adjustments.select(&:promotion?)
20
21
 
@@ -10,7 +10,7 @@ module Spree
10
10
  # To customize the error message you can also override `ineligible_message`.
11
11
  class ItemTotal < PromotionRule
12
12
  preference :amount, :decimal, default: 100.00
13
- preference :currency, :string, default: -> { Spree::Config[:currency] }
13
+ preference :currency, :string, default: -> { Spree::Config.currency }
14
14
  preference :operator, :string, default: "gt"
15
15
 
16
16
  # The list of allowed operators names mapped to their symbols.
@@ -240,6 +240,7 @@ module Spree
240
240
  when Spree::LineItem
241
241
  !promotable.variant.product.promotionable?
242
242
  when Spree::Order
243
+ ActiveRecord::Associations::Preloader.new(records: promotable.line_items, associations: {variant: :product}).call
243
244
  promotable.line_items.any? { |line_item| !line_item.variant.product.promotionable? }
244
245
  end
245
246
  end
@@ -13,7 +13,6 @@ module SolidusLegacyPromotions
13
13
  promotions_menu_item = Spree::BackendConfiguration::MenuItem.new(
14
14
  label: :legacy_promotions,
15
15
  icon: Spree::Backend::Config.admin_updated_navbar ? "ri-megaphone-line" : "bullhorn",
16
- partial: "spree/admin/shared/promotion_sub_menu",
17
16
  condition: -> { can?(:admin, Spree::Promotion) },
18
17
  url: :admin_promotions_path,
19
18
  data_hook: :admin_promotion_sub_tabs,
@@ -11,7 +11,7 @@
11
11
  "#{prefix}[calculator_attributes][preferred_currency]",
12
12
  options_for_select(
13
13
  Spree::Config.available_currencies,
14
- calculator.preferred_currency || Spree::Config[:currency]
14
+ calculator.preferred_currency || Spree::Config.currency
15
15
  ),
16
16
  { class: 'custom-select fullwidth' }
17
17
  ) %>
@@ -11,7 +11,7 @@
11
11
  "#{prefix}[calculator_attributes][preferred_currency]",
12
12
  options_for_select(
13
13
  Spree::Config.available_currencies,
14
- calculator.preferred_currency || Spree::Config[:currency]
14
+ calculator.preferred_currency || Spree::Config.currency
15
15
  ),
16
16
  { class: 'custom-select fullwidth' }
17
17
  ) %>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_legacy_promotions
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.7.3
4
+ version: 4.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Solidus Team
@@ -29,28 +29,28 @@ dependencies:
29
29
  requirements:
30
30
  - - '='
31
31
  - !ruby/object:Gem::Version
32
- version: 4.7.3
32
+ version: 4.8.1
33
33
  type: :runtime
34
34
  prerelease: false
35
35
  version_requirements: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - '='
38
38
  - !ruby/object:Gem::Version
39
- version: 4.7.3
39
+ version: 4.8.1
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: solidus_core
42
42
  requirement: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - '='
45
45
  - !ruby/object:Gem::Version
46
- version: 4.7.3
46
+ version: 4.8.1
47
47
  type: :runtime
48
48
  prerelease: false
49
49
  version_requirements: !ruby/object:Gem::Requirement
50
50
  requirements:
51
51
  - - '='
52
52
  - !ruby/object:Gem::Version
53
- version: 4.7.3
53
+ version: 4.8.1
54
54
  - !ruby/object:Gem::Dependency
55
55
  name: solidus_support
56
56
  requirement: !ruby/object:Gem::Requirement
@@ -77,6 +77,7 @@ executables: []
77
77
  extensions: []
78
78
  extra_rdoc_files: []
79
79
  files:
80
+ - LICENSE
80
81
  - README.md
81
82
  - Rakefile
82
83
  - app/assets/config/solidus_legacy_promotions/manifest.js