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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2b6ba75da732715ef975c684a089a3586b67cec1
4
- data.tar.gz: 4afbf2136510cb63bab7f1b60e2192c03a10a48c
3
+ metadata.gz: d4be9412583b406e2838b0edc12866be3d271b6a
4
+ data.tar.gz: e519d7bff34aaa8c73de122d6d27c4cfc7b2da78
5
5
  SHA512:
6
- metadata.gz: 33a1fe7fdb7080cac31739ec3202a51d3d6e6ffb1da1bf80ea76688ac796b2a545326eba10f6773fcd1d80bbcc57a7abe0353fa610df2daeeab3209bad473f8d
7
- data.tar.gz: 2a9c302304140f816e3f1236790b147de50d96b1816e91208a2808b7ad9818ac426d389d53a6b4b978f3d86b888728d2cf7125f46cce75486ce7d7d2c391de46
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
- def stock_item(variant)
33
- stock_items.where(variant_id: variant).order(:id).first
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
- def stock_item_or_create(variant)
37
- stock_item(variant) || stock_items.create(variant: variant)
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)
@@ -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
@@ -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 Cost
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 Cost
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
@@ -0,0 +1,5 @@
1
+ class AddGuestTokenIndexToSpreeOrders < ActiveRecord::Migration
2
+ def change
3
+ add_index :spree_orders, :guest_token
4
+ end
5
+ end
@@ -1,5 +1,5 @@
1
1
  module Spree
2
2
  def self.version
3
- '2.3.5'
3
+ '2.3.6'
4
4
  end
5
5
  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: 2.3.5
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-20 00:00:00.000000000 Z
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