spree_core 2.1.9 → 2.1.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: bef9bb6cb651e122c3dd179632b3cd03db25db5c
4
- data.tar.gz: 847f17d74a32fd42dc00d455663908d9a7b161d7
3
+ metadata.gz: 2b54721ddb8bf665a1a369727a7a8d626ab9d250
4
+ data.tar.gz: 074680d373e2db813366a98a052ffbdef555a5cf
5
5
  SHA512:
6
- metadata.gz: 466fb2ea2e0628e982dfbced5a7f6ceac9b3c8889ce10b65f63b92c5804636731eb69c0a728cc096d47d4d1e8d16a32914605d131d71746ed8a1f80558cca279
7
- data.tar.gz: e30d22e469863e8eac638e5700dc094aed9db9f5e518ac976b6607d7feee5a3b74fddb30e26586d9e4213b6cec4246ba0f1b1602a8d307fc7506a0b2bacc76a4
6
+ metadata.gz: 15f8c6df2efafb71d4a96a08a49ce73e46ad0fe447bea094017ca8d07ba3828d442cb0d4b1caaf1a365f99a6b200ffec2c106961e4bc690499bb34875476d857
7
+ data.tar.gz: 587f314371b7e1b0dd636412fd36b504913dd9d8153c69bdaa7061c2d59f639823e6badd4d7ed70845fae0286f36123e47e1d0648b1f3807487ef829ac3bcf1c
@@ -164,9 +164,10 @@ module Spree
164
164
  end
165
165
 
166
166
  private
167
+
167
168
  # Returns style of image or nil
168
169
  def image_style_from_method_name(method_name)
169
- if style = method_name.to_s.sub(/_image$/, '')
170
+ if method_name.to_s.match(/_image$/) && style = method_name.to_s.sub(/_image$/, '')
170
171
  possible_styles = Spree::Image.attachment_definitions[:attachment][:styles]
171
172
  style if style.in? possible_styles.with_indifferent_access
172
173
  end
@@ -12,14 +12,13 @@ module Spree
12
12
 
13
13
  # returns the formatted price for the specified variant as a difference from product price
14
14
  def variant_price_diff(variant)
15
- diff = variant.amount_in(current_currency) - variant.product.amount_in(current_currency)
16
- return nil if diff == 0
17
- amount = Spree::Money.new(diff.abs, { currency: current_currency }).to_html
18
- if diff > 0
19
- "(#{Spree.t(:add)}: #{amount})".html_safe
20
- else
21
- "(#{Spree.t(:subtract)}: #{amount})".html_safe
22
- end
15
+ variant_amount = variant.amount_in(current_currency)
16
+ product_amount = variant.product.amount_in(current_currency)
17
+ return if variant_amount == product_amount || product_amount.nil?
18
+ diff = variant.amount_in(current_currency) - product_amount
19
+ amount = Spree::Money.new(diff.abs, currency: current_currency).to_html
20
+ label = diff > 0 ? :add : :subtract
21
+ "(#{Spree.t(label)}: #{amount})".html_safe
23
22
  end
24
23
 
25
24
  # returns the formatted full price for the variant, if at least one variant price differs from product price
@@ -18,6 +18,8 @@ module Spree
18
18
  ActiveMerchant::Billing::Response.new(true, "", {}, {})
19
19
  end
20
20
 
21
+ def cancel(response); end
22
+
21
23
  def void(*args)
22
24
  ActiveMerchant::Billing::Response.new(true, "", {}, {})
23
25
  end
@@ -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
@@ -8,7 +8,7 @@ module Spree
8
8
  helper_method :try_spree_current_user
9
9
 
10
10
  rescue_from CanCan::AccessDenied do |exception|
11
- unauthorized
11
+ redirect_unauthorized_access
12
12
  end
13
13
  end
14
14
 
@@ -20,7 +20,7 @@ module Spree
20
20
  # Redirect as appropriate when an access request fails. The default action is to redirect to the login screen.
21
21
  # Override this method in your controllers if you want to have special behavior in case the user is not authorized
22
22
  # to access the requested action. For example, a popup window might simply close itself.
23
- def unauthorized
23
+ def redirect_unauthorized_access
24
24
  if try_spree_current_user
25
25
  flash[:error] = Spree.t(:authorization_failure)
26
26
  redirect_to '/unauthorized'
@@ -1,5 +1,5 @@
1
1
  module Spree
2
2
  def self.version
3
- "2.1.9"
3
+ "2.1.10"
4
4
  end
5
5
  end
@@ -27,7 +27,7 @@ module Spree
27
27
  mattr_reader *ATTRIBUTES
28
28
 
29
29
  @@address_attributes = [
30
- :firstname, :lastname, :address1, :address2,
30
+ :id, :firstname, :lastname, :address1, :address2,
31
31
  :city, :country_id, :state_id, :zipcode, :phone,
32
32
  :state_name, :alternative_phone, :company,
33
33
  :country => [:iso, :name, :iso3, :iso_name],
@@ -68,7 +68,7 @@ module Spree
68
68
  # month / year may be provided by some sources, or others may elect to use one field
69
69
  @@source_attributes = [
70
70
  :number, :month, :year, :expiry, :verification_value,
71
- :first_name, :last_name, :cc_type, :gateway_customer_profile_id,
71
+ :first_name, :last_name, :cc_type, :gateway_customer_profile_id,
72
72
  :gateway_payment_profile_id, :last_digits, :name]
73
73
 
74
74
  @@stock_item_attributes = [:variant, :stock_location, :backorderable, :variant_id]
@@ -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
- determine_promotion_application_result(promo)
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
- #prevent errors for missing attributes (since rails 3.1 upgrade)
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.1.9
4
+ version: 2.1.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: 2014-09-19 00:00:00.000000000 Z
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: 4.0.5
215
+ version: 4.0.12
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: 4.0.5
222
+ version: 4.0.12
223
223
  - !ruby/object:Gem::Dependency
224
224
  name: ransack
225
225
  requirement: !ruby/object:Gem::Requirement