spree_core 2.1.7 → 2.1.8
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/credit_card.rb +11 -6
- data/app/models/spree/order.rb +3 -6
- data/app/models/spree/payment.rb +1 -1
- data/app/models/spree/zone.rb +5 -5
- data/config/locales/en.yml +2 -0
- data/lib/spree/core/product_duplicator.rb +6 -2
- data/lib/spree/core/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 43818b70db72f063df0a2ca6ec5a814bbee08e32
|
4
|
+
data.tar.gz: f8cc6b3a6c23d6f8cef08b16a11cda8ef76041f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ca9edf26cea41ea8f52c020206da785cc243c808f2b1c6647310b2f44d23d661f9c18380b3eb4804162852bd5bdc6faec6bbb1c1bc751cc103dbef34bae5c89
|
7
|
+
data.tar.gz: a7da9a9569a87f7a6025d1ca7c837a3bb2bfb7c458daccfdce8ca5c914c0e6b5f3e480c09e9cc574b3ce5ecfb54512f590b9eb129ded0a4f15298bcbf4aa8021
|
@@ -120,7 +120,7 @@ module Spree
|
|
120
120
|
countries.collect do |country|
|
121
121
|
country.name = Spree.t(country.iso, scope: 'country_names', default: country.name)
|
122
122
|
country
|
123
|
-
end.
|
123
|
+
end.sort_by { |c| c.name.parameterize }
|
124
124
|
end
|
125
125
|
|
126
126
|
def seo_url(taxon)
|
@@ -34,9 +34,10 @@ module Spree
|
|
34
34
|
elsif match = expiry.match(/(\d{2})(\d{2,4})/) # will match mmyy and mmyyyy
|
35
35
|
[match[1], match[2]]
|
36
36
|
end
|
37
|
-
|
38
|
-
|
39
|
-
|
37
|
+
if self[:year]
|
38
|
+
self[:year] = "20" + self[:year] if self[:year].length == 2
|
39
|
+
self[:year] = self[:year].to_i
|
40
|
+
end
|
40
41
|
self[:month] = self[:month].to_i
|
41
42
|
end
|
42
43
|
|
@@ -125,9 +126,13 @@ module Spree
|
|
125
126
|
|
126
127
|
def expiry_not_in_the_past
|
127
128
|
if year.present? && month.present?
|
128
|
-
|
129
|
-
|
130
|
-
|
129
|
+
if month.to_i < 1 || month.to_i > 12
|
130
|
+
errors.add(:base, :expiry_invalid)
|
131
|
+
else
|
132
|
+
time = Time.zone.parse("#{year}-#{month}-1")
|
133
|
+
if time < Time.zone.now.to_time.beginning_of_month
|
134
|
+
errors.add(:base, :card_expired)
|
135
|
+
end
|
131
136
|
end
|
132
137
|
end
|
133
138
|
end
|
data/app/models/spree/order.rb
CHANGED
@@ -67,6 +67,7 @@ module Spree
|
|
67
67
|
|
68
68
|
validates :email, presence: true, if: :require_email
|
69
69
|
validates :email, email: true, if: :require_email, allow_blank: true
|
70
|
+
validates :number, uniqueness: true
|
70
71
|
validate :has_available_shipment
|
71
72
|
validate :has_available_payment
|
72
73
|
|
@@ -257,15 +258,11 @@ module Spree
|
|
257
258
|
end
|
258
259
|
end
|
259
260
|
|
260
|
-
# FIXME refactor this method and implement validation using validates_* utilities
|
261
261
|
def generate_order_number
|
262
|
-
|
263
|
-
while record
|
262
|
+
self.number ||= loop do
|
264
263
|
random = "R#{Array.new(9){rand(9)}.join}"
|
265
|
-
|
264
|
+
break random unless self.class.exists?(number: random)
|
266
265
|
end
|
267
|
-
self.number = random if self.number.blank?
|
268
|
-
self.number
|
269
266
|
end
|
270
267
|
|
271
268
|
def shipped_shipments
|
data/app/models/spree/payment.rb
CHANGED
@@ -83,7 +83,7 @@ module Spree
|
|
83
83
|
case amount
|
84
84
|
when String
|
85
85
|
separator = I18n.t('number.currency.format.separator')
|
86
|
-
number = amount.delete("^0-9-#{separator}").tr(separator, '.')
|
86
|
+
number = amount.delete("^0-9-#{separator}\.").tr(separator, '.')
|
87
87
|
number.to_d if number.present?
|
88
88
|
end || amount
|
89
89
|
end
|
data/app/models/spree/zone.rb
CHANGED
@@ -67,12 +67,12 @@ module Spree
|
|
67
67
|
# All zoneables belonging to the zone members. Will be a collection of either
|
68
68
|
# countries or states depending on the zone type.
|
69
69
|
def zoneables
|
70
|
-
members.collect(&:zoneable)
|
70
|
+
members.includes(:zoneable).collect(&:zoneable)
|
71
71
|
end
|
72
72
|
|
73
73
|
def country_ids
|
74
74
|
if kind == 'country'
|
75
|
-
members.
|
75
|
+
members.pluck(:zoneable_id)
|
76
76
|
else
|
77
77
|
[]
|
78
78
|
end
|
@@ -80,7 +80,7 @@ module Spree
|
|
80
80
|
|
81
81
|
def state_ids
|
82
82
|
if kind == 'state'
|
83
|
-
members.
|
83
|
+
members.pluck(:zoneable_id)
|
84
84
|
else
|
85
85
|
[]
|
86
86
|
end
|
@@ -117,9 +117,9 @@ module Spree
|
|
117
117
|
return false if zone_members.empty? || target.zone_members.empty?
|
118
118
|
|
119
119
|
if kind == target.kind
|
120
|
-
return false if target.zoneables.
|
120
|
+
return false if (target.zoneables.collect(&:id) - zoneables.collect(&:id)).present?
|
121
121
|
else
|
122
|
-
return false if target.zoneables.
|
122
|
+
return false if (target.zoneables.collect(&:country).collect(&:id) - zoneables.collect(&:id)).present?
|
123
123
|
end
|
124
124
|
true
|
125
125
|
end
|
data/config/locales/en.yml
CHANGED
@@ -225,6 +225,7 @@ en:
|
|
225
225
|
attributes:
|
226
226
|
base:
|
227
227
|
card_expired: "Card has expired"
|
228
|
+
expiry_invalid: "Card expiration is invalid"
|
228
229
|
devise:
|
229
230
|
confirmations:
|
230
231
|
confirmed: Your account was successfully confirmed. You are now signed in.
|
@@ -383,6 +384,7 @@ en:
|
|
383
384
|
back_to_prototypes_list: Back To Prototypes List
|
384
385
|
back_to_reports_list: Back To Reports List
|
385
386
|
back_to_shipping_categories: Back To Shipping Categories
|
387
|
+
back_to_shipping_categories_list: Back To Shipping Categories List
|
386
388
|
back_to_shipping_methods_list: Back To Shipping Methods List
|
387
389
|
back_to_states_list: Back To States List
|
388
390
|
back_to_stock_locations_list: Back to Stock Locations List
|
@@ -2,8 +2,12 @@ module Spree
|
|
2
2
|
class ProductDuplicator
|
3
3
|
attr_accessor :product
|
4
4
|
|
5
|
-
|
5
|
+
@@clone_images_default = true
|
6
|
+
mattr_accessor :clone_images_default
|
7
|
+
|
8
|
+
def initialize(product, include_images = @@clone_images_default)
|
6
9
|
@product = product
|
10
|
+
@include_images = include_images
|
7
11
|
end
|
8
12
|
|
9
13
|
def duplicate
|
@@ -39,7 +43,7 @@ module Spree
|
|
39
43
|
master.dup.tap do |new_master|
|
40
44
|
new_master.sku = "COPY OF #{master.sku}"
|
41
45
|
new_master.deleted_at = nil
|
42
|
-
new_master.images = master.images.map { |image| duplicate_image image }
|
46
|
+
new_master.images = master.images.map { |image| duplicate_image image } if @include_images
|
43
47
|
new_master.price = master.price
|
44
48
|
new_master.currency = master.currency
|
45
49
|
end
|
data/lib/spree/core/version.rb
CHANGED
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.
|
4
|
+
version: 2.1.8
|
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-08-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemerchant
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: 1.43.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.
|
26
|
+
version: 1.43.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: acts_as_list
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -212,14 +212,14 @@ dependencies:
|
|
212
212
|
requirements:
|
213
213
|
- - "~>"
|
214
214
|
- !ruby/object:Gem::Version
|
215
|
-
version: 4.0.
|
215
|
+
version: 4.0.5
|
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.
|
222
|
+
version: 4.0.5
|
223
223
|
- !ruby/object:Gem::Dependency
|
224
224
|
name: ransack
|
225
225
|
requirement: !ruby/object:Gem::Requirement
|
@@ -678,7 +678,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
678
678
|
version: '0'
|
679
679
|
requirements: []
|
680
680
|
rubyforge_project:
|
681
|
-
rubygems_version: 2.2.
|
681
|
+
rubygems_version: 2.2.2
|
682
682
|
signing_key:
|
683
683
|
specification_version: 4
|
684
684
|
summary: The bare bones necessary for Spree.
|