spree_core 4.1.3 → 4.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/finders/spree/products/find.rb +7 -1
- data/app/helpers/spree/base_helper.rb +4 -0
- data/app/models/spree/line_item.rb +8 -1
- data/app/models/spree/zone.rb +2 -2
- data/lib/spree/core.rb +1 -0
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/database_type_utilities.rb +12 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 14259887630a60331633df140cfe4f7b9e94b9ecdf95342c5e8a31011dbfb807
|
4
|
+
data.tar.gz: 2801ca34a2ad369726b829ea9e3decf00ae64c9fcc4cc673cf04e0dc0aa826c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f644cd935bca9d371a3a558ffe76994143bc8af738ac9ff8621a778eef743d79339b3f5bda697e84a287c51e12e235bac989c500dd4923ca08f52a89ba8d80ac
|
7
|
+
data.tar.gz: 62203be51964aa4ccd9ea69a5e5fd47ea7408c6028e257a5c30a7769de7178127aecef002305731f58d5e676bd209c15b776d182246f23dc07a4a0679801d5d3
|
@@ -8,7 +8,7 @@ module Spree
|
|
8
8
|
@skus = String(params.dig(:filter, :skus)).split(',')
|
9
9
|
@price = String(params.dig(:filter, :price)).split(',').map(&:to_f)
|
10
10
|
@currency = params[:currency] || current_currency
|
11
|
-
@taxons =
|
11
|
+
@taxons = taxon_ids(params.dig(:filter, :taxons))
|
12
12
|
@name = params.dig(:filter, :name)
|
13
13
|
@options = params.dig(:filter, :options).try(:to_unsafe_hash)
|
14
14
|
@option_value_ids = params.dig(:filter, :option_value_ids)
|
@@ -159,6 +159,12 @@ module Spree
|
|
159
159
|
def include_discontinued(products)
|
160
160
|
discontinued ? products : products.available
|
161
161
|
end
|
162
|
+
|
163
|
+
def taxon_ids(taxon_id)
|
164
|
+
return unless (taxon = Spree::Taxon.find_by(id: taxon_id))
|
165
|
+
|
166
|
+
taxon.self_and_descendants.ids.map(&:to_s)
|
167
|
+
end
|
162
168
|
end
|
163
169
|
end
|
164
170
|
end
|
@@ -17,7 +17,14 @@ module Spree
|
|
17
17
|
before_validation :copy_tax_category
|
18
18
|
|
19
19
|
validates :variant, :order, presence: true
|
20
|
-
|
20
|
+
|
21
|
+
# numericality: :less_than_or_equal_to validation is due to the restriction at the database level
|
22
|
+
# https://github.com/spree/spree/issues/2695#issuecomment-143314161
|
23
|
+
validates :quantity, numericality: {
|
24
|
+
less_than_or_equal_to: DatabaseTypeUtilities.maximum_value_for(:integer),
|
25
|
+
only_integer: true, message: Spree.t('validation.must_be_int')
|
26
|
+
}
|
27
|
+
|
21
28
|
validates :price, numericality: true
|
22
29
|
|
23
30
|
validates_with Spree::Stock::AvailabilityValidator
|
data/app/models/spree/zone.rb
CHANGED
data/lib/spree/core.rb
CHANGED
data/lib/spree/core/version.rb
CHANGED
@@ -0,0 +1,12 @@
|
|
1
|
+
module Spree
|
2
|
+
module DatabaseTypeUtilities
|
3
|
+
def self.maximum_value_for(data_type)
|
4
|
+
case data_type
|
5
|
+
when :integer
|
6
|
+
ActiveModel::Type::Integer.new.instance_eval { range.max }
|
7
|
+
else
|
8
|
+
raise ArgumentError, 'Currently only :integer argument is acceptable'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.1.
|
4
|
+
version: 4.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Schofield
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-04-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemerchant
|
@@ -997,6 +997,7 @@ files:
|
|
997
997
|
- lib/spree/core/search/base.rb
|
998
998
|
- lib/spree/core/token_generator.rb
|
999
999
|
- lib/spree/core/version.rb
|
1000
|
+
- lib/spree/database_type_utilities.rb
|
1000
1001
|
- lib/spree/dependencies_helper.rb
|
1001
1002
|
- lib/spree/i18n.rb
|
1002
1003
|
- lib/spree/i18n/base.rb
|