spree_core 2.0.10 → 2.0.11
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/line_item.rb +1 -1
- data/app/models/spree/order.rb +7 -3
- data/app/models/spree/payment/processing.rb +8 -0
- data/app/models/spree/stock/availability_validator.rb +1 -1
- data/app/models/spree/stock/quantifier.rb +1 -9
- data/app/models/spree/stock_item.rb +4 -0
- data/app/models/spree/tax_rate.rb +4 -3
- data/app/models/spree/variant.rb +1 -1
- data/db/migrate/20130830001159_migrate_old_shipping_calculators.rb +1 -1
- data/db/migrate/20140415041315_add_user_id_created_by_id_index_to_order.rb +5 -0
- data/lib/spree/core/product_duplicator.rb +1 -1
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/core.rb +1 -0
- data/lib/spree/money.rb +1 -1
- metadata +18 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce81644f3167d18676644b782d34b38282cc43a4
|
4
|
+
data.tar.gz: 97ee622222799fab84efe8e61782361e569cf88e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45a8a9e3e94291dae3b17df911b1253303765f11ee78758d1daa66db2b49201735942db84817782f50af9df92ed38580dd427b9b7bbd03b4af208dab8aab4d2d
|
7
|
+
data.tar.gz: 1cf648e2e2680bb4c055913ed9a856844abde7e59b635f27adadca4b2b4e7f1e110582fbe6e3bacf5a69297d8011b531f8ed83c7b1b40a50e0f6be1f376709fa
|
data/app/models/spree/order.rb
CHANGED
@@ -90,8 +90,12 @@ module Spree
|
|
90
90
|
where(number: number)
|
91
91
|
end
|
92
92
|
|
93
|
+
scope :created_between, ->(start_date, end_date) { where(created_at: start_date..end_date) }
|
94
|
+
scope :completed_between, ->(start_date, end_date) { where(completed_at: start_date..end_date) }
|
95
|
+
|
93
96
|
def self.between(start_date, end_date)
|
94
|
-
|
97
|
+
ActiveSupport::Deprecation.warn("Order#between will be deprecated in Spree 2.3, please use either Order#created_between or Order#completed_between instead.")
|
98
|
+
self.created_between(start_date, end_date)
|
95
99
|
end
|
96
100
|
|
97
101
|
def self.by_customer(customer)
|
@@ -458,7 +462,7 @@ module Spree
|
|
458
462
|
end
|
459
463
|
|
460
464
|
def insufficient_stock_lines
|
461
|
-
|
465
|
+
line_items.select(&:insufficient_stock?)
|
462
466
|
end
|
463
467
|
|
464
468
|
def merge!(order, user = nil)
|
@@ -598,7 +602,7 @@ module Spree
|
|
598
602
|
|
599
603
|
def after_cancel
|
600
604
|
shipments.each { |shipment| shipment.cancel! }
|
601
|
-
payments.completed.each { |payment| payment.
|
605
|
+
payments.completed.each { |payment| payment.cancel! }
|
602
606
|
|
603
607
|
send_cancel_email
|
604
608
|
self.update_column(:payment_state, 'credit_owed') unless shipped?
|
@@ -106,6 +106,14 @@ module Spree
|
|
106
106
|
end
|
107
107
|
end
|
108
108
|
|
109
|
+
def cancel!
|
110
|
+
if payment_method.respond_to?(:cancel)
|
111
|
+
payment_method.cancel(response_code)
|
112
|
+
else
|
113
|
+
credit!
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
109
117
|
def partial_credit(amount)
|
110
118
|
return if amount > credit_allowed
|
111
119
|
started_processing!
|
@@ -4,7 +4,7 @@ module Spree
|
|
4
4
|
attr_reader :stock_items
|
5
5
|
|
6
6
|
def initialize(variant)
|
7
|
-
@variant =
|
7
|
+
@variant = variant
|
8
8
|
@stock_items = Spree::StockItem.joins(:stock_location).where(:variant_id => @variant, Spree::StockLocation.table_name =>{ :active => true})
|
9
9
|
end
|
10
10
|
|
@@ -24,14 +24,6 @@ module Spree
|
|
24
24
|
total_on_hand >= required || backorderable?
|
25
25
|
end
|
26
26
|
|
27
|
-
private
|
28
|
-
|
29
|
-
# return variant when passed either variant object or variant id
|
30
|
-
def resolve_variant_id(variant)
|
31
|
-
variant = Spree::Variant.find_by_id(variant) unless variant.respond_to?(:should_track_inventory?)
|
32
|
-
variant
|
33
|
-
end
|
34
|
-
|
35
27
|
end
|
36
28
|
end
|
37
29
|
end
|
@@ -26,9 +26,10 @@ module Spree
|
|
26
26
|
|
27
27
|
# Gets the array of TaxRates appropriate for the specified order
|
28
28
|
def self.match(order)
|
29
|
-
|
30
|
-
|
31
|
-
|
29
|
+
order_zone = order.tax_zone
|
30
|
+
return [] unless order_zone
|
31
|
+
includes(zone: { zone_members: :zoneable }).all.select do |rate|
|
32
|
+
rate.zone == order_zone || rate.zone.contains?(order_zone) || rate.zone.default_tax
|
32
33
|
end
|
33
34
|
end
|
34
35
|
|
data/app/models/spree/variant.rb
CHANGED
@@ -3,7 +3,7 @@ class MigrateOldShippingCalculators < ActiveRecord::Migration
|
|
3
3
|
Spree::ShippingMethod.all.each do |shipping_method|
|
4
4
|
old_calculator = shipping_method.calculator
|
5
5
|
next if old_calculator.class < Spree::ShippingCalculator # We don't want to mess with new shipping calculators
|
6
|
-
new_calculator = eval(
|
6
|
+
new_calculator = eval(old_calculator.class.name.sub("::Calculator::", "::Calculator::Shipping::")).new
|
7
7
|
new_calculator.preferences.keys.each do |pref|
|
8
8
|
# Preferences can't be read/set by name, you have to prefix preferred_
|
9
9
|
pref_method = "preferred_#{pref}"
|
@@ -49,7 +49,7 @@ module Spree
|
|
49
49
|
new_variant = variant.dup
|
50
50
|
new_variant.sku = "COPY OF #{new_variant.sku}"
|
51
51
|
new_variant.deleted_at = nil
|
52
|
-
new_variant.option_values = variant.option_values.map { |option_value| option_value
|
52
|
+
new_variant.option_values = variant.option_values.map { |option_value| option_value}
|
53
53
|
new_variant
|
54
54
|
end
|
55
55
|
|
data/lib/spree/core/version.rb
CHANGED
data/lib/spree/core.rb
CHANGED
data/lib/spree/money.rb
CHANGED
@@ -30,7 +30,7 @@ module Spree
|
|
30
30
|
|
31
31
|
# Check the first character for a currency symbol, alternatively get it
|
32
32
|
# from the stated currency string
|
33
|
-
c = if ::
|
33
|
+
c = if ::Monetize.assume_from_symbol && i =~ /^(\$|€|£)/
|
34
34
|
case i
|
35
35
|
when /^\$/ then "USD"
|
36
36
|
when /^€/ then "EUR"
|
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.11
|
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-05-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemerchant
|
@@ -164,6 +164,20 @@ dependencies:
|
|
164
164
|
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: 0.15.0
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: monetize
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
type: :runtime
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ">="
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
167
181
|
- !ruby/object:Gem::Dependency
|
168
182
|
name: paperclip
|
169
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -505,6 +519,7 @@ files:
|
|
505
519
|
- db/migrate/20131113035136_add_channel_to_spree_orders.rb
|
506
520
|
- db/migrate/20140120160805_add_index_to_variant_id_and_currency_on_prices.rb
|
507
521
|
- db/migrate/20140205181631_default_variant_weight_to_zero.rb
|
522
|
+
- db/migrate/20140415041315_add_user_id_created_by_id_index_to_order.rb
|
508
523
|
- db/seeds.rb
|
509
524
|
- lib/generators/spree/custom_user/custom_user_generator.rb
|
510
525
|
- lib/generators/spree/custom_user/templates/authentication_helpers.rb.tt
|
@@ -649,7 +664,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
649
664
|
version: '0'
|
650
665
|
requirements: []
|
651
666
|
rubyforge_project:
|
652
|
-
rubygems_version: 2.2.
|
667
|
+
rubygems_version: 2.2.0
|
653
668
|
signing_key:
|
654
669
|
specification_version: 4
|
655
670
|
summary: The bare bones necessary for Spree.
|