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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8221f56f22472a62ce9ca4606e761fd718fcc448
4
- data.tar.gz: 2846b0e62b638dd5ae2071b3cf873dce9d7bd7a5
3
+ metadata.gz: f5b6037980373f52370687e88e0ee18fed5d9d8f
4
+ data.tar.gz: 7a422916efeb60a2d5260f65c96c8183aad094fa
5
5
  SHA512:
6
- metadata.gz: d39dfb9985e2425eab9de5697248c3cf4d2640dca0b4a3d3d3bfeddfb6b25c27f265e78e397588a6a4ee1f9bbc8713520acf67fae100faa7dd2a3fb3b6a5e4ed
7
- data.tar.gz: cb69f470e36ebc6b0cb24e1f047763b14e7574fd4a25ac462d7705e82b15e3724e361b84f813018b09ff01163747a7fc1f07d3b6dcb8b20106e9f6ebbc0e8377
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'
@@ -94,7 +94,7 @@ module Spree
94
94
  end
95
95
 
96
96
  def credit_allowed
97
- amount - offsets_total
97
+ amount - offsets_total.abs
98
98
  end
99
99
 
100
100
  def can_credit?
@@ -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.all.each do |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 tha might not be present yet
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.all.each do |stock_item|
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.each do |order|
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.each do |shipment|
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.all.each do |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.all.each do |transfer|
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
- Spree::LineItem.includes(:variant => { :product => :tax_category }).find_in_batches do |line_items|
4
- line_items.each do |line_item|
5
- line_item.update_column(:tax_category_id, line_item.product.tax_category_id)
6
- end
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
@@ -74,7 +74,7 @@ module Spree
74
74
  end
75
75
 
76
76
  def ip_address
77
- request.env['HTTP_X_REAL_IP'] || request.env['REMOTE_ADDR']
77
+ request.remote_ip
78
78
  end
79
79
  end
80
80
  end
@@ -1,5 +1,5 @@
1
1
  module Spree
2
2
  def self.version
3
- "2.0.9"
3
+ "2.0.10"
4
4
  end
5
5
  end
@@ -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 << (Spree::ShippingCategory.first || create(:shipping_category))
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.9
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-02-18 00:00:00.000000000 Z
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.16
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.16
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.0
652
+ rubygems_version: 2.2.2
653
653
  signing_key:
654
654
  specification_version: 4
655
655
  summary: The bare bones necessary for Spree.