spree_core 2.0.9 → 2.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/models/spree/order_updater.rb +3 -1
- data/app/models/spree/payment.rb +1 -1
- data/app/models/spree/product.rb +4 -1
- data/app/models/spree/shipping_method.rb +1 -1
- data/db/migrate/20130213191427_create_default_stock.rb +3 -3
- data/db/migrate/20130417120035_update_adjustment_states.rb +2 -2
- data/db/migrate/20130417123427_add_shipping_rates_to_shipments.rb +1 -1
- data/db/migrate/20130509115210_add_number_to_stock_transfer.rb +1 -1
- data/db/migrate/20130802022321_migrate_tax_categories_to_line_items.rb +5 -4
- data/lib/spree/core/controller_helpers/order.rb +1 -1
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/testing_support/factories/shipping_method_factory.rb +3 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5b6037980373f52370687e88e0ee18fed5d9d8f
|
4
|
+
data.tar.gz: 7a422916efeb60a2d5260f65c96c8183aad094fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54e078aeffabf703f9e6dd38cd6949169378ecff49aee0694c23989e028b7ef4dccc9acf0ba13bfbf7626febabe814e7c76c0b8369f333252aabff811aeee559
|
7
|
+
data.tar.gz: a3f479ad64b7055f9b7612d85a71af7c5467e4bc08954bbf599d3189c05f3ca5164b5f3e4f11ac1809a0dd717adf6da2f2ed0ce8e74fefdb274680b5bf2a4d7f
|
@@ -101,13 +101,15 @@ module Spree
|
|
101
101
|
# The +payment_state+ value helps with reporting, etc. since it provides a quick and easy way to locate Orders needing attention.
|
102
102
|
def update_payment_state
|
103
103
|
|
104
|
-
#line_item are empty when user empties cart
|
104
|
+
# line_item are empty when user empties cart
|
105
105
|
if line_items.empty? || round_money(order.payment_total) < round_money(order.total)
|
106
106
|
if payments.present?
|
107
107
|
if payments.last.state == 'failed'
|
108
108
|
order.payment_state = 'failed'
|
109
109
|
elsif payments.last.state == 'completed'
|
110
110
|
order.payment_state = 'credit_owed'
|
111
|
+
else
|
112
|
+
order.payment_state = 'balance_due'
|
111
113
|
end
|
112
114
|
else
|
113
115
|
order.payment_state = 'balance_due'
|
data/app/models/spree/payment.rb
CHANGED
data/app/models/spree/product.rb
CHANGED
@@ -159,8 +159,11 @@ module Spree
|
|
159
159
|
!!deleted_at
|
160
160
|
end
|
161
161
|
|
162
|
+
# determine if product is available.
|
163
|
+
# deleted products and products with nil or future available_on date
|
164
|
+
# are not available
|
162
165
|
def available?
|
163
|
-
!(available_on.nil? || available_on.future?)
|
166
|
+
!(available_on.nil? || available_on.future?) && !deleted?
|
164
167
|
end
|
165
168
|
|
166
169
|
# split variants list into hash which shows mapping of opt value onto matching variants
|
@@ -5,10 +5,10 @@ module Spree
|
|
5
5
|
|
6
6
|
default_scope where(deleted_at: nil)
|
7
7
|
|
8
|
-
has_many :shipments
|
9
8
|
has_many :shipping_method_categories
|
10
9
|
has_many :shipping_categories, through: :shipping_method_categories
|
11
10
|
has_many :shipping_rates
|
11
|
+
has_many :shipments, :through => :shipping_rates
|
12
12
|
|
13
13
|
has_and_belongs_to_many :zones, :join_table => 'spree_shipping_methods_zones',
|
14
14
|
:class_name => 'Spree::Zone',
|
@@ -5,11 +5,11 @@ class CreateDefaultStock < ActiveRecord::Migration
|
|
5
5
|
location = Spree::StockLocation.new(name: 'default')
|
6
6
|
location.save(validate: false)
|
7
7
|
|
8
|
-
Spree::Variant.
|
8
|
+
Spree::Variant.find_each do |variant|
|
9
9
|
stock_item = Spree::StockItem.unscoped.build(stock_location: location, variant: variant)
|
10
10
|
stock_item.send(:count_on_hand=, variant.count_on_hand)
|
11
11
|
# Avoid running default_scope defined by acts_as_paranoid, related to #3805,
|
12
|
-
# validations would run a query with a delete_at column
|
12
|
+
# validations would run a query with a delete_at column that might not be present yet
|
13
13
|
stock_item.save! validate: false
|
14
14
|
end
|
15
15
|
|
@@ -19,7 +19,7 @@ class CreateDefaultStock < ActiveRecord::Migration
|
|
19
19
|
def down
|
20
20
|
add_column :spree_variants, :count_on_hand, :integer
|
21
21
|
|
22
|
-
Spree::StockItem.
|
22
|
+
Spree::StockItem.find_each do |stock_item|
|
23
23
|
stock_item.variant.update_column :count_on_hand, stock_item.count_on_hand
|
24
24
|
end
|
25
25
|
|
@@ -1,10 +1,10 @@
|
|
1
1
|
class UpdateAdjustmentStates < ActiveRecord::Migration
|
2
2
|
def up
|
3
|
-
Spree::Order.complete.
|
3
|
+
Spree::Order.complete.find_each do |order|
|
4
4
|
order.adjustments.update_all(:state => 'closed')
|
5
5
|
end
|
6
6
|
|
7
|
-
Spree::Shipment.shipped.
|
7
|
+
Spree::Shipment.shipped.includes(:adjustment).find_each do |shipment|
|
8
8
|
shipment.adjustment.update_column(:state, 'finalized') if shipment.adjustment
|
9
9
|
end
|
10
10
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class AddShippingRatesToShipments < ActiveRecord::Migration
|
2
2
|
def up
|
3
|
-
Spree::Shipment.
|
3
|
+
Spree::Shipment.find_each do |shipment|
|
4
4
|
shipment.shipping_rates.create(:shipping_method_id => shipment.shipping_method_id,
|
5
5
|
:cost => shipment.cost,
|
6
6
|
:selected => true)
|
@@ -6,7 +6,7 @@ class AddNumberToStockTransfer < ActiveRecord::Migration
|
|
6
6
|
rename_column :spree_stock_transfers, :reference_number, :reference
|
7
7
|
add_column :spree_stock_transfers, :number, :string
|
8
8
|
|
9
|
-
Spree::StockTransfer.
|
9
|
+
Spree::StockTransfer.find_each do |transfer|
|
10
10
|
transfer.send(:generate_stock_transfer_number)
|
11
11
|
transfer.save!
|
12
12
|
end
|
@@ -1,9 +1,10 @@
|
|
1
1
|
class MigrateTaxCategoriesToLineItems < ActiveRecord::Migration
|
2
2
|
def change
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
Spree::LineItem.find_each do |line_item|
|
4
|
+
next if line_item.variant.nil?
|
5
|
+
next if line_item.variant.product.nil?
|
6
|
+
next if line_item.product.nil?
|
7
|
+
line_item.update_column(:tax_category_id, line_item.product.tax_category_id)
|
7
8
|
end
|
8
9
|
end
|
9
10
|
end
|
data/lib/spree/core/version.rb
CHANGED
@@ -4,7 +4,9 @@ FactoryGirl.define do
|
|
4
4
|
name 'UPS Ground'
|
5
5
|
|
6
6
|
before(:create) do |shipping_method, evaluator|
|
7
|
-
shipping_method.shipping_categories
|
7
|
+
if shipping_method.shipping_categories.empty?
|
8
|
+
shipping_method.shipping_categories << (Spree::ShippingCategory.first || create(:shipping_category))
|
9
|
+
end
|
8
10
|
end
|
9
11
|
|
10
12
|
factory :shipping_method, class: Spree::ShippingMethod do
|
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.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-
|
11
|
+
date: 2014-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemerchant
|
@@ -198,14 +198,14 @@ dependencies:
|
|
198
198
|
requirements:
|
199
199
|
- - "~>"
|
200
200
|
- !ruby/object:Gem::Version
|
201
|
-
version: 3.2.
|
201
|
+
version: 3.2.17
|
202
202
|
type: :runtime
|
203
203
|
prerelease: false
|
204
204
|
version_requirements: !ruby/object:Gem::Requirement
|
205
205
|
requirements:
|
206
206
|
- - "~>"
|
207
207
|
- !ruby/object:Gem::Version
|
208
|
-
version: 3.2.
|
208
|
+
version: 3.2.17
|
209
209
|
- !ruby/object:Gem::Dependency
|
210
210
|
name: ransack
|
211
211
|
requirement: !ruby/object:Gem::Requirement
|
@@ -649,7 +649,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
649
649
|
version: '0'
|
650
650
|
requirements: []
|
651
651
|
rubyforge_project:
|
652
|
-
rubygems_version: 2.2.
|
652
|
+
rubygems_version: 2.2.2
|
653
653
|
signing_key:
|
654
654
|
specification_version: 4
|
655
655
|
summary: The bare bones necessary for Spree.
|