spree_core 2.1.5 → 2.1.6
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/helpers/spree/taxons_helper.rb +3 -3
- data/app/models/spree/order.rb +1 -1
- data/app/models/spree/payment.rb +1 -1
- data/app/models/spree/product.rb +4 -1
- data/app/models/spree/promotion.rb +5 -1
- data/app/models/spree/promotion/actions/create_adjustment.rb +1 -1
- data/app/models/spree/promotion_action.rb +4 -0
- data/app/models/spree/shipping_method.rb +2 -1
- data/app/models/spree/shipping_rate.rb +0 -5
- data/config/locales/en.yml +3 -0
- 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 -7
- data/lib/spree/core/controller_helpers/order.rb +1 -1
- data/lib/spree/core/product_duplicator.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: b4c8f9444abee12730e46a75f58276b4a89a54ce
|
4
|
+
data.tar.gz: 02d28150421a8deb02c47a16a514ceea6e6775ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94c500d3cba6d3c9388d64f5304dd43391ecd9fc8aabf0c694cec4f3678f7e808039e7dd082aa932623ddfbf200c1e3ca525e34861fc82a2302650f09c0db57e
|
7
|
+
data.tar.gz: 81aa93fc583a3eefaeea0804812ad174ecd359b4a1445f030a1ab40e54fb1290c8c9c570099b2e5ad5f8e12d46a0c91fda2a0682a07735a1883051a5c5da0276
|
@@ -4,12 +4,12 @@ module Spree
|
|
4
4
|
# that we can use configurations as well as make it easier for end users to override this determination. One idea is
|
5
5
|
# to show the most popular products for a particular taxon (that is an exercise left to the developer.)
|
6
6
|
def taxon_preview(taxon, max=4)
|
7
|
-
products = taxon.active_products.limit(max)
|
7
|
+
products = taxon.active_products.limit(max).uniq
|
8
8
|
if (products.size < max)
|
9
|
+
products_arel = Spree::Product.arel_table
|
9
10
|
taxon.descendants.each do |taxon|
|
10
11
|
to_get = max - products.length
|
11
|
-
products += taxon.active_products.limit(to_get)
|
12
|
-
products = products.uniq
|
12
|
+
products += taxon.active_products.where(products_arel[:id].not_in(products.map(&:id))).limit(to_get).uniq
|
13
13
|
break if products.size >= max
|
14
14
|
end
|
15
15
|
end
|
data/app/models/spree/order.rb
CHANGED
@@ -508,7 +508,7 @@ module Spree
|
|
508
508
|
# to delivery again so that proper updated shipments are created.
|
509
509
|
# e.g. customer goes back from payment step and changes order items
|
510
510
|
def ensure_updated_shipments
|
511
|
-
if shipments.any?
|
511
|
+
if shipments.any? && !self.completed?
|
512
512
|
self.shipments.destroy_all
|
513
513
|
restart_checkout_flow
|
514
514
|
end
|
data/app/models/spree/payment.rb
CHANGED
data/app/models/spree/product.rb
CHANGED
@@ -131,8 +131,11 @@ module Spree
|
|
131
131
|
!!deleted_at
|
132
132
|
end
|
133
133
|
|
134
|
+
# determine if product is available.
|
135
|
+
# deleted products and products with nil or future available_on date
|
136
|
+
# are not available
|
134
137
|
def available?
|
135
|
-
!(available_on.nil? || available_on.future?)
|
138
|
+
!(available_on.nil? || available_on.future?) && !deleted?
|
136
139
|
end
|
137
140
|
|
138
141
|
# split variants list into hash which shows mapping of opt value onto matching variants
|
@@ -83,7 +83,7 @@ module Spree
|
|
83
83
|
|
84
84
|
def adjusted_credits_count(order)
|
85
85
|
return credits_count if order.nil?
|
86
|
-
credits_count - (
|
86
|
+
credits_count - (exists_on_order?(order) ? 1 : 0)
|
87
87
|
end
|
88
88
|
|
89
89
|
def credits
|
@@ -97,5 +97,9 @@ module Spree
|
|
97
97
|
def code=(coupon_code)
|
98
98
|
write_attribute(:code, (coupon_code.downcase.strip rescue nil))
|
99
99
|
end
|
100
|
+
|
101
|
+
def exists_on_order?(order)
|
102
|
+
actions.any? { |a| a.credit_exists_on_order?(order) }
|
103
|
+
end
|
100
104
|
end
|
101
105
|
end
|
@@ -17,7 +17,7 @@ module Spree
|
|
17
17
|
# through options hash
|
18
18
|
def perform(options = {})
|
19
19
|
order = options[:order]
|
20
|
-
return if
|
20
|
+
return if credit_exists_on_order?(order)
|
21
21
|
|
22
22
|
self.create_adjustment("#{Spree.t(:promotion)} (#{promotion.name})", order, order)
|
23
23
|
end
|
@@ -1,14 +1,15 @@
|
|
1
1
|
module Spree
|
2
2
|
class ShippingMethod < ActiveRecord::Base
|
3
|
+
acts_as_paranoid
|
3
4
|
include Spree::Core::CalculatedAdjustments
|
4
5
|
DISPLAY = [:both, :front_end, :back_end]
|
5
6
|
|
6
7
|
default_scope -> { where(deleted_at: nil) }
|
7
8
|
|
8
|
-
has_many :shipments
|
9
9
|
has_many :shipping_method_categories, :dependent => :destroy
|
10
10
|
has_many :shipping_categories, through: :shipping_method_categories
|
11
11
|
has_many :shipping_rates, inverse_of: :shipping_method
|
12
|
+
has_many :shipments, :through => :shipping_rates
|
12
13
|
|
13
14
|
has_and_belongs_to_many :zones, :join_table => 'spree_shipping_methods_zones',
|
14
15
|
:class_name => 'Spree::Zone',
|
@@ -3,11 +3,6 @@ module Spree
|
|
3
3
|
belongs_to :shipment, class_name: 'Spree::Shipment'
|
4
4
|
belongs_to :shipping_method, class_name: 'Spree::ShippingMethod', inverse_of: :shipping_rates
|
5
5
|
|
6
|
-
scope :with_shipping_method,
|
7
|
-
-> { includes(:shipping_method).
|
8
|
-
references(:shipping_method).
|
9
|
-
order("cost ASC") }
|
10
|
-
|
11
6
|
delegate :order, :currency, to: :shipment
|
12
7
|
delegate :name, to: :shipping_method
|
13
8
|
|
data/config/locales/en.yml
CHANGED
@@ -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,12 +1,10 @@
|
|
1
1
|
class MigrateTaxCategoriesToLineItems < ActiveRecord::Migration
|
2
2
|
def change
|
3
|
-
Spree::LineItem.
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
line_item.update_column(:tax_category_id, line_item.product.tax_category_id)
|
9
|
-
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)
|
10
8
|
end
|
11
9
|
end
|
12
10
|
end
|
@@ -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
@@ -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.1.
|
4
|
+
version: 2.1.6
|
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: 4.0.
|
201
|
+
version: 4.0.3
|
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: 4.0.
|
208
|
+
version: 4.0.3
|
209
209
|
- !ruby/object:Gem::Dependency
|
210
210
|
name: ransack
|
211
211
|
requirement: !ruby/object:Gem::Requirement
|
@@ -663,7 +663,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
663
663
|
version: '0'
|
664
664
|
requirements: []
|
665
665
|
rubyforge_project:
|
666
|
-
rubygems_version: 2.2.
|
666
|
+
rubygems_version: 2.2.2
|
667
667
|
signing_key:
|
668
668
|
specification_version: 4
|
669
669
|
summary: The bare bones necessary for Spree.
|