spree_core 2.3.9 → 2.3.10

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: 8e4467acc56bb7ed67d1c5604816505e8335e3ca
4
- data.tar.gz: 0fe54b4093014b0c0250644c146911c72a960658
3
+ metadata.gz: 728b74de9c0f8e2e371fab35a9a103a220090f4f
4
+ data.tar.gz: b60a27598a180ae3a23f7c449aeca221ddea1eb5
5
5
  SHA512:
6
- metadata.gz: cfbd785825e173763381a4fc74cd1304bfe2131b63a947b2efe85dd6a1d529b167dd7fe8da04d3e9b5f1ee4281620a009715cd6690e764c0522b29ef11060f75
7
- data.tar.gz: 9121b8723e0b55c561d6c747d6345b40a28a1a4dccca528f9f3784d694781e7083bfc449a3a6b2e3c8c0518a1b175febd1bc6cf6097d630723d9736208b8858d
6
+ metadata.gz: b70efe721217914f339f792721cdc192e80f17d2e860d8fa7983da76ba2034f071d2c04cb0b46c03e50c14180ee843ec8e224591b1c6991737f083adf5cb6f0b
7
+ data.tar.gz: e6e6f4412dc66a18e4f7891ebc1d9f440fb682e4f63593a35e83392a3f4982491d268e3f40e7f60f72ec67325244ba85a4ec5462a5ccc71a111cb7776ab96497
@@ -91,7 +91,9 @@ module Spree
91
91
  # support all the old preference methods with a warning
92
92
  define_method "preferred_#{old_preference_name}" do
93
93
  ActiveSupport::Deprecation.warn("#{old_preference_name} is no longer supported on Spree::Config, please access it through #{store_method} on Spree::Store")
94
- Store.default.send(store_method)
94
+ if ActiveRecord::Base.connection.table_exists?("spree_stores") # guards against 2.2 upgraders unable to rake db migration
95
+ Store.default.send(store_method)
96
+ end
95
97
  end
96
98
  end
97
99
  end
@@ -108,7 +108,8 @@ module Spree
108
108
  end
109
109
 
110
110
  def adjusted_credits_count(promotable)
111
- credits_count - promotable.adjustments.promotion.where(:source_id => actions.pluck(:id)).count
111
+ adjustments = promotable.is_a?(Order) ? promotable.all_adjustments : promotable.adjustments
112
+ credits_count - adjustments.promotion.where(:source_id => actions.pluck(:id)).count
112
113
  end
113
114
 
114
115
  def credits
@@ -39,14 +39,23 @@ module Spree
39
39
  order = options[:order]
40
40
  return unless self.eligible? order
41
41
 
42
+ action_taken = false
42
43
  promotion_action_line_items.each do |item|
43
44
  current_quantity = order.quantity_of(item.variant)
44
- if current_quantity < item.quantity
45
- order.contents.add(item.variant, item.quantity - current_quantity)
45
+ if current_quantity < item.quantity && item_available?(item)
46
+ line_item = order.contents.add(item.variant, item.quantity - current_quantity)
47
+ action_taken = true if line_item.try(:valid?)
46
48
  end
47
49
  end
48
- true
50
+ action_taken
49
51
  end
52
+
53
+ # Checks that there's enough stock to add the line item to the order
54
+ def item_available?(item)
55
+ quantifier = Spree::Stock::Quantifier.new(item.variant)
56
+ quantifier.can_supply? item.quantity
57
+ end
58
+
50
59
  end
51
60
  end
52
61
  end
@@ -55,7 +55,7 @@ module Spree
55
55
  end
56
56
 
57
57
  def currency
58
- #TODO calculate from first variant?
58
+ order.currency
59
59
  end
60
60
 
61
61
  def shipping_categories
@@ -1,5 +1,12 @@
1
1
  class CreateStoreFromPreferences < ActiveRecord::Migration
2
2
  def change
3
+ # workaround for spree_i18n and Store translations
4
+ Spree::Store.class_eval do
5
+ def self.translated?(name)
6
+ false
7
+ end
8
+ end
9
+
3
10
  preference_store = Spree::Preferences::Store.instance
4
11
  if store = Spree::Store.where(default: true).first
5
12
  store.meta_description = preference_store.get('spree/app_configuration/default_meta_description') {}
@@ -1,5 +1,5 @@
1
1
  module Spree
2
2
  def self.version
3
- '2.3.9'
3
+ '2.3.10'
4
4
  end
5
5
  end
@@ -28,7 +28,7 @@ module Spree
28
28
  mattr_reader *ATTRIBUTES
29
29
 
30
30
  @@address_attributes = [
31
- :firstname, :lastname, :first_name, :last_name,
31
+ :id, :firstname, :lastname, :first_name, :last_name,
32
32
  :address1, :address2, :city, :country_id, :state_id,
33
33
  :zipcode, :phone, :state_name, :alternative_phone, :company,
34
34
  :country => [:iso, :name, :iso3, :iso_name],
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.9
4
+ version: 2.3.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Schofield
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-10 00:00:00.000000000 Z
11
+ date: 2015-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemerchant
@@ -244,16 +244,16 @@ dependencies:
244
244
  name: rails
245
245
  requirement: !ruby/object:Gem::Requirement
246
246
  requirements:
247
- - - "~>"
247
+ - - '='
248
248
  - !ruby/object:Gem::Version
249
- version: 4.1.8
249
+ version: 4.1.9
250
250
  type: :runtime
251
251
  prerelease: false
252
252
  version_requirements: !ruby/object:Gem::Requirement
253
253
  requirements:
254
- - - "~>"
254
+ - - '='
255
255
  - !ruby/object:Gem::Version
256
- version: 4.1.8
256
+ version: 4.1.9
257
257
  - !ruby/object:Gem::Dependency
258
258
  name: ransack
259
259
  requirement: !ruby/object:Gem::Requirement