solidus_core 2.11.10 → 3.0.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of solidus_core might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/app/assets/javascripts/spree.js.erb +0 -51
- data/app/helpers/spree/store_helper.rb +0 -11
- data/app/mailers/spree/carton_mailer.rb +1 -5
- data/app/models/concerns/spree/adjustment_source.rb +0 -15
- data/app/models/concerns/spree/calculated_adjustments.rb +0 -18
- data/app/models/concerns/spree/soft_deletable.rb +2 -4
- data/app/models/concerns/spree/user_address_book.rb +0 -37
- data/app/models/concerns/spree/user_methods.rb +2 -11
- data/app/models/spree/ability.rb +0 -37
- data/app/models/spree/address/name.rb +2 -20
- data/app/models/spree/address.rb +8 -186
- data/app/models/spree/adjustment.rb +0 -28
- data/app/models/spree/base.rb +0 -53
- data/app/models/spree/calculator/flexi_rate.rb +0 -5
- data/app/models/spree/calculator.rb +0 -7
- data/app/models/spree/country.rb +1 -6
- data/app/models/spree/credit_card.rb +0 -27
- data/app/models/spree/customer_return.rb +1 -4
- data/app/models/spree/image.rb +0 -7
- data/app/models/spree/inventory_unit.rb +0 -21
- data/app/models/spree/line_item.rb +2 -45
- data/app/models/spree/order.rb +4 -137
- data/app/models/spree/order_cancellations.rb +4 -24
- data/app/models/spree/order_updater.rb +2 -11
- data/app/models/spree/payment/cancellation.rb +1 -1
- data/app/models/spree/payment.rb +0 -3
- data/app/models/spree/payment_create.rb +1 -13
- data/app/models/spree/payment_method/credit_card.rb +1 -3
- data/app/models/spree/payment_method.rb +2 -103
- data/app/models/spree/product/scopes.rb +0 -27
- data/app/models/spree/product.rb +0 -40
- data/app/models/spree/promotion/actions/create_adjustment.rb +0 -3
- data/app/models/spree/promotion/actions/create_item_adjustments.rb +0 -3
- data/app/models/spree/promotion/actions/create_quantity_adjustments.rb +0 -3
- data/app/models/spree/promotion/rules/taxon.rb +2 -15
- data/app/models/spree/promotion.rb +2 -6
- data/app/models/spree/promotion_action.rb +2 -9
- data/app/models/spree/promotion_code/batch_builder.rb +0 -14
- data/app/models/spree/refund.rb +0 -52
- data/app/models/spree/reimbursement.rb +3 -41
- data/app/models/spree/reimbursement_performer.rb +2 -8
- data/app/models/spree/reimbursement_type/credit.rb +1 -4
- data/app/models/spree/reimbursement_type/reimbursement_helpers.rb +1 -2
- data/app/models/spree/reimbursement_type/store_credit.rb +1 -4
- data/app/models/spree/return_authorization.rb +1 -4
- data/app/models/spree/return_item.rb +3 -22
- data/app/models/spree/shipment.rb +1 -54
- data/app/models/spree/shipping_method.rb +0 -25
- data/app/models/spree/shipping_rate.rb +0 -2
- data/app/models/spree/state.rb +0 -4
- data/app/models/spree/stock/simple_coordinator.rb +6 -15
- data/app/models/spree/stock/splitter/base.rb +2 -7
- data/app/models/spree/stock_item.rb +1 -7
- data/app/models/spree/store.rb +0 -12
- data/app/models/spree/store_credit_category.rb +0 -32
- data/app/models/spree/tax_calculator/shipping_rate.rb +1 -12
- data/app/models/spree/tax_rate.rb +0 -27
- data/app/models/spree/taxon/active_storage_attachment.rb +0 -5
- data/app/models/spree/taxon/paperclip_attachment.rb +0 -5
- data/app/models/spree/taxon.rb +0 -11
- data/app/models/spree/user_address.rb +0 -5
- data/app/models/spree/variant.rb +2 -46
- data/config/locales/en.yml +0 -8
- data/db/migrate/20180416083007_add_apply_to_all_to_variant_property_rule.rb +1 -1
- data/lib/generators/solidus/install/install_generator.rb +12 -1
- data/lib/generators/solidus/install/templates/config/initializers/spree.rb.tt +3 -39
- data/lib/generators/spree/dummy/dummy_generator.rb +2 -1
- data/lib/generators/spree/dummy/templates/rails/database.yml +6 -1
- data/lib/generators/spree/dummy/templates/rails/storage.yml +3 -0
- data/lib/generators/spree/dummy/templates/rails/test.rb +2 -0
- data/lib/spree/app_configuration.rb +6 -65
- data/lib/spree/core/class_constantizer.rb +2 -0
- data/lib/spree/core/controller_helpers/auth.rb +1 -14
- data/lib/spree/core/controller_helpers/order.rb +2 -22
- data/lib/spree/core/controller_helpers/payment_parameters.rb +0 -54
- data/lib/spree/core/controller_helpers/pricing.rb +0 -8
- data/lib/spree/core/controller_helpers/strong_parameters.rb +0 -4
- data/lib/spree/core/engine.rb +0 -35
- data/lib/spree/core/environment_extension.rb +0 -9
- data/lib/spree/core/product_filters.rb +0 -40
- data/lib/spree/core/role_configuration.rb +0 -14
- data/lib/spree/core/search/base.rb +0 -26
- data/lib/spree/core/state_machines.rb +2 -11
- data/lib/spree/core/validators/email.rb +1 -1
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/core.rb +9 -8
- data/lib/spree/deprecation.rb +1 -1
- data/lib/spree/event/configuration.rb +0 -5
- data/lib/spree/event/subscriber.rb +0 -18
- data/lib/spree/event/subscriber_registry.rb +3 -1
- data/lib/spree/event.rb +0 -31
- data/lib/spree/i18n.rb +0 -22
- data/lib/spree/money.rb +3 -18
- data/lib/spree/permitted_attributes.rb +9 -54
- data/lib/spree/testing_support/capybara_ext.rb +0 -30
- data/lib/spree/testing_support/controller_requests.rb +0 -82
- data/lib/spree/testing_support/dummy_app/migrations.rb +0 -3
- data/lib/spree/testing_support/dummy_app.rb +7 -14
- data/lib/spree/testing_support/factories/order_factory.rb +0 -1
- data/lib/spree/testing_support/factories/refund_factory.rb +0 -1
- data/lib/spree/testing_support/order_walkthrough.rb +0 -3
- data/lib/spree/testing_support/preferences.rb +0 -25
- data/lib/tasks/upgrade.rake +7 -5
- data/solidus_core.gemspec +2 -5
- metadata +8 -49
- data/app/mailers/spree/test_mailer.rb +0 -13
- data/app/models/concerns/spree/user_payment_source.rb +0 -26
- data/app/models/spree/calculator/free_shipping.rb +0 -22
- data/app/models/spree/calculator/percent_per_item.rb +0 -51
- data/app/models/spree/calculator/price_sack.rb +0 -28
- data/app/models/spree/gateway/bogus.rb +0 -13
- data/app/models/spree/gateway/bogus_simple.rb +0 -13
- data/app/models/spree/gateway.rb +0 -14
- data/app/models/spree/order/checkout.rb +0 -244
- data/app/models/spree/order_capturing.rb +0 -50
- data/app/models/spree/promotion_handler/free_shipping.rb +0 -9
- data/lib/generators/spree/install/install_generator.rb +0 -15
- data/lib/solidus/migrations/rename_gateways.rb +0 -41
- data/lib/spree/core/current_store.rb +0 -24
- data/lib/spree/paranoia_deprecations.rb +0 -41
- data/lib/spree/promo/environment.rb +0 -12
- data/lib/spree/testing_support/bar_ability.rb +0 -19
- data/lib/tasks/core.rake +0 -104
- data/lib/tasks/email.rake +0 -12
- data/lib/tasks/migrations/copy_order_bill_address_to_credit_card.rake +0 -119
- data/lib/tasks/migrations/migrate_address_names.rake +0 -158
- data/lib/tasks/migrations/migrate_default_billing_addresses_to_address_book.rake +0 -26
- data/lib/tasks/migrations/migrate_shipping_rate_taxes.rake +0 -22
- data/lib/tasks/migrations/migrate_user_addresses.rake +0 -34
- data/lib/tasks/migrations/rename_gateways.rake +0 -23
- data/lib/tasks/order_capturing.rake +0 -27
@@ -6,11 +6,6 @@ module Spree
|
|
6
6
|
class ShippingMethod < Spree::Base
|
7
7
|
include Spree::SoftDeletable
|
8
8
|
include Spree::CalculatedAdjustments
|
9
|
-
DISPLAY = ActiveSupport::Deprecation::DeprecatedObjectProxy.new(
|
10
|
-
[:both, :front_end, :back_end],
|
11
|
-
"Spree::ShippingMethod::DISPLAY is deprecated",
|
12
|
-
Spree::Deprecation
|
13
|
-
)
|
14
9
|
|
15
10
|
has_many :shipping_method_categories, dependent: :destroy
|
16
11
|
has_many :shipping_categories, through: :shipping_method_categories
|
@@ -95,26 +90,6 @@ module Spree
|
|
95
90
|
tracking_url.gsub(/:tracking/, ERB::Util.url_encode(tracking)) # :url_encode exists in 1.8.7 through 2.1.0
|
96
91
|
end
|
97
92
|
|
98
|
-
def display_on
|
99
|
-
if available_to_users?
|
100
|
-
"both"
|
101
|
-
else
|
102
|
-
"back_end"
|
103
|
-
end
|
104
|
-
end
|
105
|
-
deprecate display_on: :available_to_users?, deprecator: Spree::Deprecation
|
106
|
-
|
107
|
-
def display_on=(value)
|
108
|
-
self.available_to_users = (value != "back_end")
|
109
|
-
end
|
110
|
-
deprecate 'display_on=': :available_to_users=, deprecator: Spree::Deprecation
|
111
|
-
|
112
|
-
# Some shipping methods are only meant to be set via backend
|
113
|
-
def frontend?
|
114
|
-
available_to_users?
|
115
|
-
end
|
116
|
-
deprecate frontend?: :available_to_users?, deprecator: Spree::Deprecation
|
117
|
-
|
118
93
|
private
|
119
94
|
|
120
95
|
def at_least_one_shipping_category
|
@@ -19,8 +19,6 @@ module Spree
|
|
19
19
|
delegate :code, to: :shipping_method, prefix: true
|
20
20
|
alias_attribute :amount, :cost
|
21
21
|
|
22
|
-
alias_method :discounted_amount, :amount
|
23
|
-
deprecate discounted_amount: :total_before_tax, deprecator: Spree::Deprecation
|
24
22
|
alias_method :total_before_tax, :amount
|
25
23
|
|
26
24
|
extend DisplayMoney
|
data/app/models/spree/state.rb
CHANGED
@@ -14,10 +14,6 @@ module Spree
|
|
14
14
|
)
|
15
15
|
)
|
16
16
|
end
|
17
|
-
class << self
|
18
|
-
alias_method :find_all_by_name_or_abbr, :with_name_or_abbr
|
19
|
-
deprecate find_all_by_name_or_abbr: :with_name_or_abbr, deprecator: Spree::Deprecation
|
20
|
-
end
|
21
17
|
|
22
18
|
self.whitelisted_ransackable_attributes = %w[name]
|
23
19
|
|
@@ -73,11 +73,16 @@ module Spree
|
|
73
73
|
packages = split_packages(packages)
|
74
74
|
|
75
75
|
# Turn the Stock::Packages into a Shipment with rates
|
76
|
-
packages.map do |package|
|
76
|
+
shipments = packages.map do |package|
|
77
77
|
shipment = package.shipment = package.to_shipment
|
78
78
|
shipment.shipping_rates = Spree::Config.stock.estimator_class.new.shipping_rates(package)
|
79
79
|
shipment
|
80
80
|
end
|
81
|
+
|
82
|
+
# Make sure we don't add the proposed shipments to the order
|
83
|
+
order.shipments = order.shipments - shipments
|
84
|
+
|
85
|
+
shipments
|
81
86
|
end
|
82
87
|
|
83
88
|
def split_packages(initial_packages)
|
@@ -87,20 +92,6 @@ module Spree
|
|
87
92
|
end
|
88
93
|
end
|
89
94
|
|
90
|
-
def allocate_inventory(availability_by_location)
|
91
|
-
sorted_availability = sort_availability(availability_by_location)
|
92
|
-
|
93
|
-
sorted_availability.transform_values do |available|
|
94
|
-
# Find the desired inventory which is available at this location
|
95
|
-
packaged = available & @desired
|
96
|
-
# Remove found inventory from desired
|
97
|
-
@desired -= packaged
|
98
|
-
packaged
|
99
|
-
end
|
100
|
-
end
|
101
|
-
deprecate allocate_inventory: 'allocate_inventory is deprecated. Please write your own allocator defining' \
|
102
|
-
'a Spree::Stock::Allocator::Base subclass', deprecator: Spree::Deprecation
|
103
|
-
|
104
95
|
def sort_availability(availability)
|
105
96
|
sorted_availability = availability.sort_by do |stock_location_id, _|
|
106
97
|
@stock_locations.find_index do |stock_location|
|
@@ -6,13 +6,8 @@ module Spree
|
|
6
6
|
class Base
|
7
7
|
attr_reader :stock_location, :next_splitter
|
8
8
|
|
9
|
-
def initialize(
|
10
|
-
|
11
|
-
@stock_location = stock_location_or_packer
|
12
|
-
else
|
13
|
-
Spree::Deprecation.warn("Initializing Splitters with a Packer is DEPRECATED. Pass a StockLocation instead.")
|
14
|
-
@stock_location = stock_location_or_packer.stock_location
|
15
|
-
end
|
9
|
+
def initialize(stock_location, next_splitter = nil)
|
10
|
+
@stock_location = stock_location
|
16
11
|
@next_splitter = next_splitter
|
17
12
|
end
|
18
13
|
|
@@ -110,13 +110,7 @@ module Spree
|
|
110
110
|
end
|
111
111
|
|
112
112
|
def inventory_cache_threshold
|
113
|
-
|
114
|
-
@cache_threshold ||= if Spree::Config.binary_inventory_cache
|
115
|
-
Spree::Deprecation.warn "Spree::Config.binary_inventory_cache=true is DEPRECATED. Instead use Spree::Config.inventory_cache_threshold=1"
|
116
|
-
1
|
117
|
-
else
|
118
|
-
Spree::Config.inventory_cache_threshold
|
119
|
-
end
|
113
|
+
@cache_threshold ||= Spree::Config.inventory_cache_threshold
|
120
114
|
end
|
121
115
|
end
|
122
116
|
end
|
data/app/models/spree/store.rb
CHANGED
@@ -25,12 +25,6 @@ module Spree
|
|
25
25
|
before_save :ensure_default_exists_and_is_unique
|
26
26
|
before_destroy :validate_not_default
|
27
27
|
|
28
|
-
scope :by_url, lambda { |url| where("url like ?", "%#{url}%") }
|
29
|
-
|
30
|
-
class << self
|
31
|
-
deprecate by_url: "Spree::Store.by_url is DEPRECATED", deprecator: Spree::Deprecation
|
32
|
-
end
|
33
|
-
|
34
28
|
def available_locales
|
35
29
|
locales = super()
|
36
30
|
if locales
|
@@ -49,12 +43,6 @@ module Spree
|
|
49
43
|
end
|
50
44
|
end
|
51
45
|
|
52
|
-
def self.current(store_key)
|
53
|
-
Spree::Deprecation.warn "Spree::Store.current is DEPRECATED"
|
54
|
-
current_store = Store.find_by(code: store_key) || Store.by_url(store_key).first if store_key
|
55
|
-
current_store || Store.default
|
56
|
-
end
|
57
|
-
|
58
46
|
def self.default
|
59
47
|
where(default: true).first || new
|
60
48
|
end
|
@@ -7,39 +7,7 @@ class Spree::StoreCreditCategory < Spree::Base
|
|
7
7
|
class_attribute :non_expiring_credit_types
|
8
8
|
self.non_expiring_credit_types = [Spree::StoreCreditType::NON_EXPIRING]
|
9
9
|
|
10
|
-
# @deprecated
|
11
|
-
class_attribute :reimbursement_category_name
|
12
|
-
self.reimbursement_category_name = I18n.t('spree.store_credit_category.default')
|
13
|
-
|
14
|
-
# @deprecated
|
15
|
-
def self.reimbursement_category(reimbursement)
|
16
|
-
reimbursement.store_credit_category
|
17
|
-
end
|
18
|
-
|
19
10
|
def non_expiring?
|
20
11
|
self.class.non_expiring_credit_types.include? name
|
21
12
|
end
|
22
|
-
|
23
|
-
public_instance_methods.grep(/^reimbursement_category_name/).each do |method|
|
24
|
-
deprecate(
|
25
|
-
method => 'Use Spree::Reimbursement#store_credit_category.name instead',
|
26
|
-
deprecator: Spree::Deprecation
|
27
|
-
)
|
28
|
-
end
|
29
|
-
|
30
|
-
class << self
|
31
|
-
public_instance_methods.grep(/^reimbursement_category_name/).each do |method|
|
32
|
-
deprecate(
|
33
|
-
method => 'Use Spree::Reimbursement.store_credit_category.name instead',
|
34
|
-
deprecator: Spree::Deprecation
|
35
|
-
)
|
36
|
-
end
|
37
|
-
|
38
|
-
public_instance_methods.grep(/^reimbursement_category$/).each do |method|
|
39
|
-
deprecate(
|
40
|
-
method => 'Use Spree::Reimbursement.store_credit_category instead',
|
41
|
-
deprecator: Spree::Deprecation
|
42
|
-
)
|
43
|
-
end
|
44
|
-
end
|
45
13
|
end
|
@@ -13,22 +13,12 @@ module Spree
|
|
13
13
|
class ShippingRate
|
14
14
|
include Spree::Tax::TaxHelpers
|
15
15
|
|
16
|
-
attr_reader :shipping_rate
|
17
|
-
|
18
16
|
# Create a new tax calculator.
|
19
17
|
#
|
20
18
|
# @param [Spree::Order] order the order to calculate taxes on
|
21
19
|
# @return [Spree::TaxCalculator::ShippingRate]
|
22
20
|
def initialize(order)
|
23
|
-
|
24
|
-
Spree::Deprecation.warn "passing a single shipping rate to Spree::TaxCalculator::ShippingRate is DEPRECATED. It now expects an order"
|
25
|
-
shipping_rate = order
|
26
|
-
@order = shipping_rate.order
|
27
|
-
@shipping_rate = shipping_rate
|
28
|
-
else
|
29
|
-
@order = order
|
30
|
-
@shipping_rate = nil
|
31
|
-
end
|
21
|
+
@order = order
|
32
22
|
end
|
33
23
|
|
34
24
|
# Calculate taxes for a shipping rate.
|
@@ -38,7 +28,6 @@ module Spree
|
|
38
28
|
# @return [Array<Spree::Tax::ItemTax>] the calculated taxes for the
|
39
29
|
# shipping rate
|
40
30
|
def calculate(shipping_rate)
|
41
|
-
shipping_rate ||= @shipping_rate
|
42
31
|
rates_for_item(shipping_rate).map do |rate|
|
43
32
|
amount = rate.compute_amount(shipping_rate)
|
44
33
|
|
@@ -87,23 +87,6 @@ module Spree
|
|
87
87
|
end
|
88
88
|
scope :included_in_price, -> { where(included_in_price: true) }
|
89
89
|
|
90
|
-
# Creates necessary tax adjustments for the order.
|
91
|
-
#
|
92
|
-
# @deprecated Please use `Spree::Tax::OrderAdjuster#adjust!` instead
|
93
|
-
def adjust(_order_tax_zone, item)
|
94
|
-
Spree::Deprecation.warn("`Spree::TaxRate#adjust` is deprecated. Please use `Spree::Tax::OrderAdjuster#adjust!` instead.", caller)
|
95
|
-
|
96
|
-
amount = compute_amount(item)
|
97
|
-
|
98
|
-
item.adjustments.create!(
|
99
|
-
source: self,
|
100
|
-
amount: amount,
|
101
|
-
order_id: item.order_id,
|
102
|
-
label: adjustment_label(amount),
|
103
|
-
included: included_in_price
|
104
|
-
)
|
105
|
-
end
|
106
|
-
|
107
90
|
# This method is used by Adjustment#update to recalculate the cost.
|
108
91
|
def compute_amount(item)
|
109
92
|
calculator.compute(item)
|
@@ -123,16 +106,6 @@ module Spree
|
|
123
106
|
)
|
124
107
|
end
|
125
108
|
|
126
|
-
def tax_category=(category)
|
127
|
-
self.tax_categories = [category]
|
128
|
-
end
|
129
|
-
|
130
|
-
def tax_category
|
131
|
-
tax_categories[0]
|
132
|
-
end
|
133
|
-
|
134
|
-
deprecate :tax_category => :tax_categories, :tax_category= => :tax_categories=, deprecator: Spree::Deprecation
|
135
|
-
|
136
109
|
private
|
137
110
|
|
138
111
|
def amount_for_adjustment_label
|
@@ -10,9 +10,4 @@ module Spree::Taxon::ActiveStorageAttachment
|
|
10
10
|
default_style: :mini
|
11
11
|
validate :icon_is_an_image
|
12
12
|
end
|
13
|
-
|
14
|
-
def attachment_partial_name
|
15
|
-
Spree::Deprecation.warn("calling #attachment_partial_name on Spree::Taxon is deprecated without replacement.")
|
16
|
-
'paperclip'
|
17
|
-
end
|
18
13
|
end
|
@@ -19,11 +19,6 @@ module Spree::Taxon::PaperclipAttachment
|
|
19
19
|
icon.present?
|
20
20
|
end
|
21
21
|
|
22
|
-
def attachment_partial_name
|
23
|
-
Spree::Deprecation.warn("calling #attachment_partial_name on Spree::Taxon is deprecated without replacement.")
|
24
|
-
'paperclip'
|
25
|
-
end
|
26
|
-
|
27
22
|
def destroy_attachment(definition)
|
28
23
|
return false unless respond_to?(definition)
|
29
24
|
|
data/app/models/spree/taxon.rb
CHANGED
@@ -29,17 +29,6 @@ module Spree
|
|
29
29
|
|
30
30
|
self.whitelisted_ransackable_attributes = %w[name]
|
31
31
|
|
32
|
-
# @note This method is meant to be overridden on a store by store basis.
|
33
|
-
# @return [Array] filters that should be used for a taxon
|
34
|
-
def applicable_filters
|
35
|
-
Spree::Deprecation.warn "Spree::Taxon#applicable_filters is deprecated, if you are using this functionality please move it into your own application."
|
36
|
-
|
37
|
-
fs = []
|
38
|
-
fs << Spree::Core::ProductFilters.price_filter if Spree::Core::ProductFilters.respond_to?(:price_filter)
|
39
|
-
fs << Spree::Core::ProductFilters.brand_filter if Spree::Core::ProductFilters.respond_to?(:brand_filter)
|
40
|
-
fs
|
41
|
-
end
|
42
|
-
|
43
32
|
# @return [String] meta_title if set otherwise a string containing the
|
44
33
|
# root name and taxon name
|
45
34
|
def seo_title
|
@@ -19,11 +19,6 @@ module Spree
|
|
19
19
|
scope :default_billing, -> { where(default_billing: true) }
|
20
20
|
scope :active, -> { where(archived: false) }
|
21
21
|
|
22
|
-
scope :default, -> do
|
23
|
-
Spree::Deprecation.warn "This scope is deprecated. Please start using ::default_shipping."
|
24
|
-
default_shipping
|
25
|
-
end
|
26
|
-
|
27
22
|
default_scope -> { order([default: :desc, updated_at: :desc]) }
|
28
23
|
end
|
29
24
|
end
|
data/app/models/spree/variant.rb
CHANGED
@@ -30,7 +30,7 @@ module Spree
|
|
30
30
|
attr_writer :rebuild_vat_prices
|
31
31
|
include Spree::DefaultPrice
|
32
32
|
|
33
|
-
belongs_to :product, -> { with_discarded }, touch: true, class_name: 'Spree::Product', inverse_of: :
|
33
|
+
belongs_to :product, -> { with_discarded }, touch: true, class_name: 'Spree::Product', inverse_of: :variants_including_master, optional: false
|
34
34
|
belongs_to :tax_category, class_name: 'Spree::TaxCategory', optional: true
|
35
35
|
|
36
36
|
delegate :name, :description, :slug, :available_on, :discontinue_on, :discontinued?,
|
@@ -83,7 +83,7 @@ module Spree
|
|
83
83
|
after_save :clear_in_stock_cache
|
84
84
|
after_touch :clear_in_stock_cache
|
85
85
|
|
86
|
-
|
86
|
+
after_destroy :destroy_option_values_variants
|
87
87
|
|
88
88
|
# Returns variants that are in stock. When stock locations are provided as
|
89
89
|
# a parameter, the scope is limited to variants that are in stock in the
|
@@ -121,17 +121,6 @@ module Spree
|
|
121
121
|
self.whitelisted_ransackable_associations = %w[option_values product prices default_price]
|
122
122
|
self.whitelisted_ransackable_attributes = %w[weight sku]
|
123
123
|
|
124
|
-
# Returns variants that are not deleted and have a price in the given
|
125
|
-
# currency.
|
126
|
-
#
|
127
|
-
# @deprecated Please use the .with_prices scope instead
|
128
|
-
# @param currency [String] the currency to filter by; defaults to Spree's default
|
129
|
-
# @return [ActiveRecord::Relation]
|
130
|
-
def self.active(currency = nil)
|
131
|
-
Spree::Deprecation.warn("`Variant.active(currency)` is deprecated. Please use `Variant.with_prices(pricing_options)` instead.", caller)
|
132
|
-
joins(:prices).where(deleted_at: nil).where('spree_prices.currency' => currency || Spree::Config[:currency]).where('spree_prices.amount IS NOT NULL')
|
133
|
-
end
|
134
|
-
|
135
124
|
# Returns variants that have a price for the given pricing options
|
136
125
|
# If you have modified the pricing options class, you might want to modify this scope too.
|
137
126
|
#
|
@@ -304,26 +293,6 @@ module Spree
|
|
304
293
|
diff && diff.zero?
|
305
294
|
end
|
306
295
|
|
307
|
-
# Converts the variant's price to the given currency.
|
308
|
-
#
|
309
|
-
# @deprecated Please use #price_for(pricing_options) instead
|
310
|
-
# @param currency [String] the desired currency
|
311
|
-
# @return [Spree::Price] the price in the desired currency
|
312
|
-
def price_in(currency)
|
313
|
-
prices.currently_valid.find_by(currency: currency)
|
314
|
-
end
|
315
|
-
deprecate price_in: :price_for, deprecator: Spree::Deprecation
|
316
|
-
|
317
|
-
# Fetches the price amount in the specified currency.
|
318
|
-
#
|
319
|
-
# @deprecated Please use #price_for instead and use a money object rathern than a BigDecimal.
|
320
|
-
# @param currency (see #price)
|
321
|
-
# @return [Float] the amount in the specified currency.
|
322
|
-
def amount_in(currency)
|
323
|
-
price_in(currency).try(:amount)
|
324
|
-
end
|
325
|
-
deprecate amount_in: :price_for, deprecator: Spree::Deprecation
|
326
|
-
|
327
296
|
# Generates a friendly name and sku string.
|
328
297
|
#
|
329
298
|
# @return [String]
|
@@ -367,19 +336,6 @@ module Spree
|
|
367
336
|
track_inventory? && Spree::Config.track_inventory_levels
|
368
337
|
end
|
369
338
|
|
370
|
-
# Image that can be used for the variant.
|
371
|
-
#
|
372
|
-
# Will first search for images on the variant. If it doesn't find any,
|
373
|
-
# it'll fallback to any variant image (unless +fallback+ is +false+) or to
|
374
|
-
# a new {Spree::Image}.
|
375
|
-
# @param fallback [Boolean] whether or not we should fallback to an image
|
376
|
-
# not from this variant
|
377
|
-
# @return [Spree::Image] the image to display
|
378
|
-
def display_image(fallback: true)
|
379
|
-
Spree::Deprecation.warn('Spree::Variant#display_image is DEPRECATED. Choose an image from Spree::Variant#gallery instead')
|
380
|
-
images.first || (fallback && product.variant_images.first) || Spree::Image.new
|
381
|
-
end
|
382
|
-
|
383
339
|
# Determines the variant's property values by verifying which of the product's
|
384
340
|
# variant property rules apply to itself.
|
385
341
|
#
|
data/config/locales/en.yml
CHANGED
@@ -26,8 +26,6 @@ en:
|
|
26
26
|
address2: Street Address (cont'd)
|
27
27
|
city: City
|
28
28
|
company: Company
|
29
|
-
firstname: First Name
|
30
|
-
lastname: Last Name
|
31
29
|
name: Name
|
32
30
|
phone: Phone
|
33
31
|
zipcode: Zip Code
|
@@ -76,7 +74,6 @@ en:
|
|
76
74
|
created_at: Date/Time
|
77
75
|
name: Name
|
78
76
|
number: Return Number
|
79
|
-
pre_tax_total: Pre-Tax Total
|
80
77
|
reimbursement_status: Reimbursement status
|
81
78
|
total: Total
|
82
79
|
total_excluding_vat: Pre-Tax Total
|
@@ -130,8 +127,6 @@ en:
|
|
130
127
|
spree/order/bill_address:
|
131
128
|
address1: Billing address street
|
132
129
|
city: Billing address city
|
133
|
-
firstname: Billing address first name
|
134
|
-
lastname: Billing address last name
|
135
130
|
name: Billing address name
|
136
131
|
phone: Billing address phone
|
137
132
|
state: Billing address state
|
@@ -139,8 +134,6 @@ en:
|
|
139
134
|
spree/order/ship_address:
|
140
135
|
address1: Shipping address street
|
141
136
|
city: Shipping address city
|
142
|
-
firstname: Shipping address first name
|
143
|
-
lastname: Shipping address last name
|
144
137
|
name: Shipping address name
|
145
138
|
phone: Shipping address phone
|
146
139
|
state: Shipping address state
|
@@ -282,7 +275,6 @@ en:
|
|
282
275
|
type: Type
|
283
276
|
spree/return_authorization:
|
284
277
|
amount: Amount
|
285
|
-
pre_tax_total: Pre-Tax Total
|
286
278
|
total_excluding_vat: Pre-Tax Total
|
287
279
|
spree/return_item:
|
288
280
|
acceptance_status: Acceptance Status
|