spree_zoned 0.5.33 → 0.5.34

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,41 @@
1
+ module Spree
2
+ Address.class_eval do
3
+
4
+ def state_validate
5
+ # Skip state validation without country (also required)
6
+ # or when disabled by preference
7
+ return if country.blank? || !Spree::Config[:address_requires_state] || country.id != 214
8
+
9
+ # ensure associated state belongs to country
10
+ if state.present?
11
+ if state.country == country
12
+ self.state_name = nil #not required as we have a valid state and country combo
13
+ else
14
+ if state_name.present?
15
+ self.state = nil
16
+ else
17
+ errors.add(:state, :invalid)
18
+ end
19
+ end
20
+ end
21
+
22
+ # ensure state_name belongs to country without states, or that it matches a predefined state name/abbr
23
+ if state_name.present?
24
+ if country.states.present?
25
+ states = country.states.find_all_by_name_or_abbr(state_name)
26
+
27
+ if states.size == 1
28
+ self.state = states.first
29
+ self.state_name = nil
30
+ else
31
+ errors.add(:state, :invalid)
32
+ end
33
+ end
34
+ end
35
+
36
+ # ensure at least one state field is populated
37
+ errors.add :state, :blank if state.blank? && state_name.blank?
38
+ end
39
+
40
+ end
41
+ end
@@ -41,3 +41,4 @@ Rails.configuration.availableLanguages = Hash[ZONED_COMMON_LOCALES.map { |c, lgs
41
41
 
42
42
  Spree::Config.searcher_class = Spree::Zoned::Search::Base
43
43
  Spree::Config.admin_products_per_page = 64
44
+ Spree::PrintInvoice::Config[:print_invoice_logo_path] = "admin/bg/hau-to-logo-claim.png"
data/spree_zoned.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
  Gem::Specification.new do |s|
3
3
  s.platform = Gem::Platform::RUBY
4
4
  s.name = 'spree_zoned'
5
- s.version = '0.5.33'
5
+ s.version = '0.5.34'
6
6
  s.summary = 'A Spree extension to make your store zoned'
7
7
  s.description = "Everything you need for a zoned Spree store: zoned pricing, zoned products, zoned product ordering, zoned locales, ...\nProbalbly essential to you if you operate outside of the US."
8
8
  s.required_ruby_version = '>= 1.9.2'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_zoned
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.33
4
+ version: 0.5.34
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -139,6 +139,7 @@ files:
139
139
  - app/helpers/spree/admin/products_helper_decorator.rb
140
140
  - app/helpers/spree/base_helper_decorator.rb
141
141
  - app/helpers/spree/products_helper_decorator.rb
142
+ - app/models/spree/address_decorator.rb
142
143
  - app/models/spree/order_decorator.rb
143
144
  - app/models/spree/product_decorator.rb
144
145
  - app/models/spree/zoned/product.rb