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 +4 -4
- data/app/models/spree/app_configuration.rb +3 -1
- data/app/models/spree/promotion.rb +2 -1
- data/app/models/spree/promotion/actions/create_line_items.rb +12 -3
- data/app/models/spree/stock/package.rb +1 -1
- data/db/migrate/20140309033438_create_store_from_preferences.rb +7 -0
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/permitted_attributes.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 728b74de9c0f8e2e371fab35a9a103a220090f4f
|
4
|
+
data.tar.gz: b60a27598a180ae3a23f7c449aeca221ddea1eb5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
@@ -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') {}
|
data/lib/spree/core/version.rb
CHANGED
@@ -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.
|
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-
|
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.
|
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.
|
256
|
+
version: 4.1.9
|
257
257
|
- !ruby/object:Gem::Dependency
|
258
258
|
name: ransack
|
259
259
|
requirement: !ruby/object:Gem::Requirement
|