spree_core 2.3.5 → 2.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/spree/promotion/rules/product.rb +11 -0
- data/app/models/spree/stock_location.rb +24 -5
- data/app/models/spree/taxon.rb +1 -1
- data/config/locales/en.yml +2 -2
- data/db/migrate/20141120135441_add_guest_token_index_to_spree_orders.rb +5 -0
- data/lib/spree/core/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d4be9412583b406e2838b0edc12866be3d271b6a
|
4
|
+
data.tar.gz: e519d7bff34aaa8c73de122d6d27c4cfc7b2da78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11462b98f62e9ef52fcdb7c8327285f0c024e7c9a72d6ee19eee45e62e66d60a0b1141fc85bf0ee1aa846be067a075b517824affbb97cacf47bb3fd1cb4642c1
|
7
|
+
data.tar.gz: 6aa0a801e656d7381dfeb0f75960ddae08de7036c358ae3978b3be5632181f702c5e75efb1cc74df17edc1c2492edc8f004c9589e1e480812e869ae965bbb278
|
@@ -30,6 +30,17 @@ module Spree
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
+
def actionable?(line_item)
|
34
|
+
case preferred_match_policy
|
35
|
+
when 'any', 'all'
|
36
|
+
product_ids.include? line_item.variant.product_id
|
37
|
+
when 'none'
|
38
|
+
product_ids.exclude? line_item.variant.product_id
|
39
|
+
else
|
40
|
+
raise "unexpected match policy: #{preferred_match_policy.inspect}"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
33
44
|
def product_ids_string
|
34
45
|
product_ids.join(',')
|
35
46
|
end
|
@@ -16,7 +16,7 @@ module Spree
|
|
16
16
|
def state_text
|
17
17
|
state.try(:abbr) || state.try(:name) || state_name
|
18
18
|
end
|
19
|
-
|
19
|
+
|
20
20
|
# Wrapper for creating a new stock item respecting the backorderable config
|
21
21
|
def propagate_variant(variant)
|
22
22
|
self.stock_items.create!(variant: variant, backorderable: self.backorderable_default)
|
@@ -29,12 +29,31 @@ module Spree
|
|
29
29
|
self.stock_item(variant) || propagate_variant(variant)
|
30
30
|
end
|
31
31
|
|
32
|
-
|
33
|
-
|
32
|
+
# Returns an instance of StockItem for the variant id.
|
33
|
+
#
|
34
|
+
# @param variant_id [String] The id of a variant.
|
35
|
+
#
|
36
|
+
# @return [StockItem] Corresponding StockItem for the StockLocation's variant.
|
37
|
+
def stock_item(variant_id)
|
38
|
+
stock_items.where(variant_id: variant_id).order(:id).first
|
34
39
|
end
|
35
40
|
|
36
|
-
|
37
|
-
|
41
|
+
# Attempts to look up StockItem for the variant, and creates one if not found.
|
42
|
+
# This method accepts an id or instance of the variant since it is used in
|
43
|
+
# multiple ways. Other methods in this model attempt to pass a variant,
|
44
|
+
# but controller actions can pass just the variant id as a parameter.
|
45
|
+
#
|
46
|
+
# @param variant_or_id [Variant|String] Variant instance or string id of a variant.
|
47
|
+
#
|
48
|
+
# @return [StockItem] Corresponding StockItem for the StockLocation's variant.
|
49
|
+
def stock_item_or_create(variant_or_id)
|
50
|
+
vid = if variant_or_id.is_a?(Variant)
|
51
|
+
variant_or_id.id
|
52
|
+
else
|
53
|
+
ActiveSupport::Deprecation.warn "Passing a Variant ID is deprecated, and will be removed in Spree 3. Please pass a variant instance instead.", caller
|
54
|
+
variant_or_id
|
55
|
+
end
|
56
|
+
stock_item(vid) || stock_items.create(variant_id: vid)
|
38
57
|
end
|
39
58
|
|
40
59
|
def count_on_hand(variant)
|
data/app/models/spree/taxon.rb
CHANGED
@@ -20,7 +20,7 @@ module Spree
|
|
20
20
|
default_url: '/assets/default_taxon.png'
|
21
21
|
|
22
22
|
validates_attachment :icon,
|
23
|
-
content_type: { content_type: ["image/jpg", "image/jpeg", "image/png"] }
|
23
|
+
content_type: { content_type: ["image/jpg", "image/jpeg", "image/png", "image/gif"] }
|
24
24
|
|
25
25
|
# indicate which filters should be used for a taxon
|
26
26
|
# this method should be customized to your own site
|
data/config/locales/en.yml
CHANGED
@@ -343,7 +343,7 @@ en:
|
|
343
343
|
add_stock_management: Add Stock Management
|
344
344
|
add_to_cart: Add To Cart
|
345
345
|
add_variant: Add Variant
|
346
|
-
additional_item: Additional Item
|
346
|
+
additional_item: Additional Item
|
347
347
|
address1: Address
|
348
348
|
address2: Address (contd.)
|
349
349
|
adjustable: Adjustable
|
@@ -623,7 +623,7 @@ en:
|
|
623
623
|
finalize: Finalize
|
624
624
|
find_a_taxon: Find a Taxon
|
625
625
|
finalized: Finalized
|
626
|
-
first_item: First Item
|
626
|
+
first_item: First Item
|
627
627
|
first_name: First Name
|
628
628
|
first_name_begins_with: First Name Begins With
|
629
629
|
flat_percent: Flat Percent
|
data/lib/spree/core/version.rb
CHANGED
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: 2.3.
|
4
|
+
version: 2.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Schofield
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemerchant
|
@@ -621,6 +621,7 @@ files:
|
|
621
621
|
- db/migrate/20141021194502_add_state_lock_version_to_order.rb
|
622
622
|
- db/migrate/20141101231208_fix_adjustment_order_presence.rb
|
623
623
|
- db/migrate/20141105213646_update_classifications_positions.rb
|
624
|
+
- db/migrate/20141120135441_add_guest_token_index_to_spree_orders.rb
|
624
625
|
- db/seeds.rb
|
625
626
|
- lib/generators/spree/custom_user/custom_user_generator.rb
|
626
627
|
- lib/generators/spree/custom_user/templates/authentication_helpers.rb.tt
|