spree_core 2.0.12 → 2.0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/helpers/spree/base_helper.rb +1 -1
- data/app/models/spree/country.rb +1 -1
- data/app/models/spree/inventory_unit.rb +1 -1
- data/app/models/spree/option_type.rb +2 -2
- data/app/models/spree/order.rb +3 -3
- data/app/models/spree/product.rb +1 -1
- data/app/models/spree/product_property.rb +1 -1
- data/app/models/spree/property.rb +2 -2
- data/app/models/spree/shipping_method.rb +2 -2
- data/app/models/spree/state.rb +2 -2
- data/app/models/spree/stock_movement.rb +1 -1
- data/app/models/spree/taxonomy.rb +1 -1
- data/app/models/spree/variant.rb +1 -1
- data/db/migrate/20130611054351_rename_shipping_methods_zones_to_spree_shipping_methods_zones.rb +5 -0
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/promo/coupon_applicator.rb +6 -1
- data/lib/tasks/core.rake +2 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a7abff523eebb24d6e7573a1276b2c68eac15b2
|
4
|
+
data.tar.gz: 59dd2a80a97247e186725cb8f0be540bf816ddf7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45e619b3362386a0fa401f357190c61d60c740064e68dc5a46802b60ddd41a0fe459d156eb59148e821d7573184a269260a838c16f045df11c5ae85c7a18c11a
|
7
|
+
data.tar.gz: 21e099c966c74e43758a2e3ef8c0864eefd5543f79c586d0d6354bcf923e695c7250d31d03b6bed10042800340634c1a0de657ffc1d9959aa198bd8bfa070bfa
|
@@ -172,7 +172,7 @@ module Spree
|
|
172
172
|
|
173
173
|
# Returns style of image or nil
|
174
174
|
def image_style_from_method_name(method_name)
|
175
|
-
if style = method_name.to_s.sub(/_image$/, '')
|
175
|
+
if method_name.to_s.match(/_image$/) && style = method_name.to_s.sub(/_image$/, '')
|
176
176
|
possible_styles = Spree::Image.attachment_definitions[:attachment][:styles]
|
177
177
|
style if style.in? possible_styles.with_indifferent_access
|
178
178
|
end
|
data/app/models/spree/country.rb
CHANGED
@@ -12,7 +12,7 @@ module Spree
|
|
12
12
|
.where("spree_shipments.state != 'canceled'")
|
13
13
|
.where(variant_id: stock_item.variant_id)
|
14
14
|
.where('spree_orders.completed_at is not null')
|
15
|
-
.backordered.order("
|
15
|
+
.backordered.order("#{Spree::Order.quoted_table_name}.completed_at ASC")
|
16
16
|
end
|
17
17
|
|
18
18
|
attr_accessible :shipment, :variant_id
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Spree
|
2
2
|
class OptionType < ActiveRecord::Base
|
3
|
-
has_many :option_values, order:
|
3
|
+
has_many :option_values, order: "#{Spree::OptionValue.quoted_table_name}.position", dependent: :destroy
|
4
4
|
has_many :product_option_types, dependent: :destroy
|
5
5
|
has_many :products, through: :product_option_types
|
6
6
|
has_and_belongs_to_many :prototypes, join_table: 'spree_option_types_prototypes'
|
@@ -8,7 +8,7 @@ module Spree
|
|
8
8
|
attr_accessible :name, :presentation, :option_values_attributes
|
9
9
|
|
10
10
|
validates :name, :presentation, presence: true
|
11
|
-
default_scope order: "#{
|
11
|
+
default_scope order: "#{quoted_table_name}.position"
|
12
12
|
|
13
13
|
accepts_nested_attributes_for :option_values, reject_if: lambda { |ov| ov[:name].blank? || ov[:presentation].blank? }, allow_destroy: true
|
14
14
|
end
|
data/app/models/spree/order.rb
CHANGED
@@ -47,9 +47,9 @@ module Spree
|
|
47
47
|
belongs_to :ship_address, foreign_key: :ship_address_id, class_name: 'Spree::Address'
|
48
48
|
alias_attribute :shipping_address, :ship_address
|
49
49
|
|
50
|
-
has_many :adjustments, as: :adjustable, dependent: :destroy, order:
|
50
|
+
has_many :adjustments, as: :adjustable, dependent: :destroy, order: "#{::Spree::Adjustment.quoted_table_name}.created_at ASC"
|
51
51
|
has_many :line_item_adjustments, through: :line_items, source: :adjustments
|
52
|
-
has_many :line_items, dependent: :destroy, order:
|
52
|
+
has_many :line_items, dependent: :destroy, order: "#{::Spree::LineItem.quoted_table_name}.created_at ASC"
|
53
53
|
has_many :payments, dependent: :destroy
|
54
54
|
has_many :return_authorizations, dependent: :destroy
|
55
55
|
has_many :state_changes, as: :stateful
|
@@ -100,7 +100,7 @@ module Spree
|
|
100
100
|
end
|
101
101
|
|
102
102
|
def self.by_customer(customer)
|
103
|
-
joins(:user).where("#{Spree.user_class.
|
103
|
+
joins(:user).where("#{Spree.user_class.quoted_table_name}.email" => customer)
|
104
104
|
end
|
105
105
|
|
106
106
|
def self.by_state(state)
|
data/app/models/spree/product.rb
CHANGED
@@ -48,7 +48,7 @@ module Spree
|
|
48
48
|
dependent: :destroy,
|
49
49
|
order: "#{::Spree::Variant.quoted_table_name}.position ASC"
|
50
50
|
|
51
|
-
has_many :prices, through: :variants, order:
|
51
|
+
has_many :prices, through: :variants, order: "#{::Spree::Variant.quoted_table_name}.position, #{::Spree::Variant.quoted_table_name}.id, #{::Spree::Price.quoted_table_name}.currency"
|
52
52
|
has_many :stock_items, through: :variants_including_master
|
53
53
|
|
54
54
|
delegate_belongs_to :master, :sku, :price, :currency, :display_amount, :display_price, :weight, :height, :width, :depth, :is_master, :has_default_price?, :cost_currency, :price_in, :amount_in
|
@@ -9,12 +9,12 @@ module Spree
|
|
9
9
|
|
10
10
|
validates :name, :presentation, presence: true
|
11
11
|
|
12
|
-
scope :sorted, -> { order(
|
12
|
+
scope :sorted, -> { order("#{quoted_table_name}.name") }
|
13
13
|
|
14
14
|
def self.find_all_by_prototype(prototype)
|
15
15
|
id = prototype
|
16
16
|
id = prototype.id if prototype.class == Prototype
|
17
|
-
joins("LEFT JOIN properties_prototypes ON property_id = #{
|
17
|
+
joins("LEFT JOIN properties_prototypes ON property_id = #{quoted_table_name}.id").
|
18
18
|
where(prototype_id: id)
|
19
19
|
end
|
20
20
|
end
|
@@ -64,11 +64,11 @@ module Spree
|
|
64
64
|
end
|
65
65
|
|
66
66
|
def self.on_backend_query
|
67
|
-
"#{
|
67
|
+
"#{quoted_table_name}.display_on != 'front_end' OR #{quoted_table_name}.display_on IS NULL"
|
68
68
|
end
|
69
69
|
|
70
70
|
def self.on_frontend_query
|
71
|
-
"#{
|
71
|
+
"#{quoted_table_name}.display_on != 'back_end' OR #{quoted_table_name}.display_on IS NULL"
|
72
72
|
end
|
73
73
|
end
|
74
74
|
end
|
data/app/models/spree/state.rb
CHANGED
@@ -7,14 +7,14 @@ module Spree
|
|
7
7
|
attr_accessible :name, :abbr
|
8
8
|
|
9
9
|
def self.find_all_by_name_or_abbr(name_or_abbr)
|
10
|
-
where(
|
10
|
+
where("#{quoted_table_name}.name = ? OR #{quoted_table_name}.abbr = ?", name_or_abbr, name_or_abbr)
|
11
11
|
end
|
12
12
|
|
13
13
|
# table of { country.id => [ state.id , state.name ] }, arrays sorted by name
|
14
14
|
# blank is added elsewhere, if needed
|
15
15
|
def self.states_group_by_country_id
|
16
16
|
state_info = Hash.new { |h, k| h[k] = [] }
|
17
|
-
self.order(
|
17
|
+
self.order("#{quoted_table_name}.name ASC").each { |state|
|
18
18
|
state_info[state.country_id.to_s].push [state.id, state.name]
|
19
19
|
}
|
20
20
|
state_info
|
data/app/models/spree/variant.rb
CHANGED
@@ -61,7 +61,7 @@ module Spree
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def options_text
|
64
|
-
values = self.option_values.joins(:option_type).order("#{Spree::OptionType.
|
64
|
+
values = self.option_values.joins(:option_type).order("#{Spree::OptionType.quoted_table_name}.position asc")
|
65
65
|
|
66
66
|
values.map! do |ov|
|
67
67
|
"#{ov.option_type.presentation}: #{ov.presentation}"
|
data/db/migrate/20130611054351_rename_shipping_methods_zones_to_spree_shipping_methods_zones.rb
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
class RenameShippingMethodsZonesToSpreeShippingMethodsZones < ActiveRecord::Migration
|
2
2
|
def change
|
3
3
|
rename_table :shipping_methods_zones, :spree_shipping_methods_zones
|
4
|
+
# If Spree::ShippingMethod zones association was patched in
|
5
|
+
# CreateShippingMethodZone migrations, it needs to be patched back
|
6
|
+
Spree::ShippingMethod.has_and_belongs_to_many :zones, :join_table => 'spree_shipping_methods_zones',
|
7
|
+
:class_name => 'Spree::Zone',
|
8
|
+
:foreign_key => 'shipping_method_id'
|
4
9
|
end
|
5
10
|
end
|
data/lib/spree/core/version.rb
CHANGED
@@ -34,7 +34,12 @@ module Spree
|
|
34
34
|
event_name = "spree.checkout.coupon_code_added"
|
35
35
|
if promotion.activate(:coupon_code => @order.coupon_code, :order => @order)
|
36
36
|
promo = @order.adjustments.includes(:originator).promotion.detect { |p| p.originator.promotion.code == @order.coupon_code }
|
37
|
-
|
37
|
+
if promo.present?
|
38
|
+
determine_promotion_application_result(promo)
|
39
|
+
else
|
40
|
+
# if action is create line items
|
41
|
+
return { :coupon_applied? => true, :success => Spree.t(:coupon_code_applied) }
|
42
|
+
end
|
38
43
|
else
|
39
44
|
return { :coupon_applied? => false, :error => Spree.t(:coupon_code_not_eligible) }
|
40
45
|
end
|
data/lib/tasks/core.rake
CHANGED
@@ -86,8 +86,8 @@ use rake db:load_file[/absolute/path/to/sample/filename.rb]}
|
|
86
86
|
end
|
87
87
|
|
88
88
|
if load_sample
|
89
|
-
#
|
90
|
-
|
89
|
+
# Reload models' attributes in case they were loaded in old migrations with wrong attributes
|
90
|
+
ActiveRecord::Base.descendants.each(&:reset_column_information)
|
91
91
|
Rake::Task["spree_sample:load"].invoke
|
92
92
|
end
|
93
93
|
|
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.0.
|
4
|
+
version: 2.0.13
|
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-11-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemerchant
|
@@ -212,14 +212,14 @@ dependencies:
|
|
212
212
|
requirements:
|
213
213
|
- - "~>"
|
214
214
|
- !ruby/object:Gem::Version
|
215
|
-
version: 3.2.
|
215
|
+
version: 3.2.21
|
216
216
|
type: :runtime
|
217
217
|
prerelease: false
|
218
218
|
version_requirements: !ruby/object:Gem::Requirement
|
219
219
|
requirements:
|
220
220
|
- - "~>"
|
221
221
|
- !ruby/object:Gem::Version
|
222
|
-
version: 3.2.
|
222
|
+
version: 3.2.21
|
223
223
|
- !ruby/object:Gem::Dependency
|
224
224
|
name: ransack
|
225
225
|
requirement: !ruby/object:Gem::Requirement
|