spree_core 3.0.4 → 3.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 825167ffd3b796e7bd880c79751eeb2631f9762e
4
- data.tar.gz: 3dfd8c5d5a0301435c90967be33a2befc3950087
3
+ metadata.gz: e9e78e82569d33a57fc77a288f4bb6478a0fdf25
4
+ data.tar.gz: ec9e23165c2db5df7e0d0c58aa11d243fed18bb7
5
5
  SHA512:
6
- metadata.gz: 9935e7fc716719657036cfb862d4a6ac5a705303c0029ca2828948ababadb82b97ea92d3a8e2580fc3a8c2df0a962b7920035ef7aec47bc81bd3bbc3d65b206b
7
- data.tar.gz: 65ef7e2171aecf3e4a62c863601959e550bfad2d8c0e80ac7314469a13adc2dbdb079b6dc48ba02acf8e412da7aed44124c06d073dcfeeec67f0b79d071e13ef
6
+ metadata.gz: ff1a688974b9cc46f3f4baecdc5212e3b6eb4ec6324cf47aeb29e1d8c50a2b1872635f9b3817b27a28f7cd5368fb7c10299e35e077ff7e9c9faadf6b6e8a2a34
7
+ data.tar.gz: 6cec5411da47ddfaf0504c2724dc866160d1443a021c3394e7b229745a469298396992d77a2b3cbfd98987efa1397d4999f53d09f7b742ee73676099d2feb222
@@ -31,15 +31,12 @@ module Spree
31
31
  preference :auto_capture, :boolean, default: false # automatically capture the credit card (as opposed to just authorize and capture later)
32
32
  preference :auto_capture_on_dispatch, :boolean, default: false # Captures payment for each shipment in Shipment#after_ship callback, and makes Shipment.ready when payment authorized.
33
33
  preference :binary_inventory_cache, :boolean, default: false # only invalidate product cache when a stock item changes whether it is in_stock
34
- preference :check_for_spree_alerts, :boolean, default: false
35
34
  preference :checkout_zone, :string, default: nil # replace with the name of a zone if you would like to limit the countries
36
35
  preference :company, :boolean, default: false # Request company field for billing and shipping addr
37
36
  preference :currency, :string, default: "USD"
38
37
  preference :default_country_id, :integer
39
- preference :dismissed_spree_alerts, :string, default: ''
40
38
  preference :expedited_exchanges, :boolean, default: false # NOTE this requires payment profiles to be supported on your gateway of choice as well as a delayed job handler to be configured with activejob. kicks off an exchange shipment upon return authorization save. charge customer if they do not return items within timely manner.
41
39
  preference :expedited_exchanges_days_window, :integer, default: 14 # the amount of days the customer has to return their item after the expedited exchange is shipped in order to avoid being charged
42
- preference :last_check_for_spree_alerts, :string, default: nil
43
40
  preference :layout, :string, default: 'spree/layouts/spree_application'
44
41
  preference :logo, :string, default: 'logo/spree_50.png'
45
42
  preference :max_level_in_taxons_menu, :integer, default: 1 # maximum nesting level in taxons menu
@@ -4,9 +4,10 @@ module Spree
4
4
  has_many :addresses, dependent: :nullify
5
5
 
6
6
  has_many :zone_members,
7
- -> { where(zoneable_type: 'Spree::Country') },
8
- class_name: 'Spree::ZoneMember',
9
- foreign_key: :zoneable_id
7
+ -> { where(zoneable_type: 'Spree::Country') },
8
+ class_name: 'Spree::ZoneMember',
9
+ dependent: :destroy,
10
+ foreign_key: :zoneable_id
10
11
 
11
12
  has_many :zones, through: :zone_members, class_name: 'Spree::Zone'
12
13
 
@@ -14,13 +14,15 @@ module Spree
14
14
  payment.state != 'void'
15
15
  end
16
16
 
17
- def capture(*args)
17
+ def capture(*)
18
18
  simulated_successful_billing_response
19
19
  end
20
20
 
21
- def cancel(response); end
21
+ def cancel(*)
22
+ simulated_successful_billing_response
23
+ end
22
24
 
23
- def void(*args)
25
+ def void(*)
24
26
  simulated_successful_billing_response
25
27
  end
26
28
 
@@ -28,7 +30,7 @@ module Spree
28
30
  false
29
31
  end
30
32
 
31
- def credit(*args)
33
+ def credit(*)
32
34
  simulated_successful_billing_response
33
35
  end
34
36
 
@@ -31,7 +31,7 @@ module Spree
31
31
  has_many :properties, through: :product_properties
32
32
 
33
33
  has_many :classifications, dependent: :delete_all, inverse_of: :product
34
- has_many :taxons, through: :classifications
34
+ has_many :taxons, through: :classifications, before_remove: :remove_taxon
35
35
  has_and_belongs_to_many :promotion_rules, join_table: :spree_products_promotion_rules
36
36
 
37
37
  belongs_to :tax_category, class_name: 'Spree::TaxCategory'
@@ -100,7 +100,7 @@ module Spree
100
100
  alias :options :product_option_types
101
101
 
102
102
  self.whitelisted_ransackable_associations = %w[stores variants_including_master master variants]
103
- self.whitelisted_ransackable_attributes = %w[slug]
103
+ self.whitelisted_ransackable_attributes = %w[description name slug]
104
104
 
105
105
  # the master variant is not a member of the variants array
106
106
  def has_variants?
@@ -351,6 +351,10 @@ module Spree
351
351
  Spree::Taxonomy.where(id: taxonomy_ids).update_all(updated_at: Time.current)
352
352
  end
353
353
 
354
+ def remove_taxon(taxon)
355
+ removed_classifications = classifications.where(taxon: taxon)
356
+ removed_classifications.each &:remove_from_list
357
+ end
354
358
  end
355
359
  end
356
360
 
@@ -19,10 +19,10 @@ module Spree
19
19
  end
20
20
 
21
21
  def property_name=(name)
22
- unless name.blank?
23
- unless property = Property.find_by(name: name)
24
- property = Property.create(name: name, presentation: name)
25
- end
22
+ if name.present?
23
+ # don't use `find_by :name` to workaround globalize/globalize#423 bug
24
+ property = Property.where(name: name).first ||
25
+ Property.create(name: name, presentation: name)
26
26
  self.property = property
27
27
  end
28
28
  end
@@ -4,9 +4,10 @@ module Spree
4
4
  has_many :addresses, dependent: :nullify
5
5
 
6
6
  has_many :zone_members,
7
- -> { where(zoneable_type: 'Spree::State') },
8
- class_name: 'Spree::ZoneMember',
9
- foreign_key: :zoneable_id
7
+ -> { where(zoneable_type: 'Spree::State') },
8
+ class_name: 'Spree::ZoneMember',
9
+ dependent: :destroy,
10
+ foreign_key: :zoneable_id
10
11
 
11
12
  has_many :zones, through: :zone_members, class_name: 'Spree::Zone'
12
13
 
@@ -4,12 +4,11 @@ module Spree
4
4
  def validate(line_item)
5
5
  unit_count = line_item.inventory_units.size
6
6
  return if unit_count >= line_item.quantity
7
+
7
8
  quantity = line_item.quantity - unit_count
8
9
  return if quantity.zero?
9
10
 
10
- quantifier = Stock::Quantifier.new(line_item.variant)
11
-
12
- return if quantifier.can_supply?(quantity)
11
+ return if item_available?(line_item, quantity)
13
12
 
14
13
  variant = line_item.variant
15
14
  display_name = "#{variant.name}"
@@ -20,6 +19,12 @@ module Spree
20
19
  item: display_name.inspect
21
20
  )
22
21
  end
22
+
23
+ private
24
+
25
+ def item_available?(line_item, quantity)
26
+ Stock::Quantifier.new(line_item.variant).can_supply?(quantity)
27
+ end
23
28
  end
24
29
  end
25
30
  end
@@ -216,6 +216,10 @@ module Spree
216
216
  self.track_inventory? && Spree::Config.track_inventory_levels
217
217
  end
218
218
 
219
+ def track_inventory
220
+ self.should_track_inventory?
221
+ end
222
+
219
223
  def volume
220
224
  (width || 0) * (height || 0) * (depth || 0)
221
225
  end
@@ -513,7 +513,6 @@ en:
513
513
  categories: Categories
514
514
  category: Category
515
515
  charged: Charged
516
- check_for_spree_alerts: Check for Spree alerts
517
516
  checkout: Checkout
518
517
  choose_a_customer: Choose a customer
519
518
  choose_a_taxon_to_sort_products_for: "Choose a taxon to sort products for"
@@ -616,6 +615,7 @@ en:
616
615
  destination: Destination
617
616
  destroy: Destroy
618
617
  discount_amount: Discount Amount
618
+ discontinue_on: Discontinue On
619
619
  dismiss_banner: No. Thanks! I'm not interested, do not display this message again
620
620
  display: Display
621
621
  doesnt_track_inventory: It doesn't track inventory
@@ -1,6 +1,6 @@
1
1
  class UpdateProductSlugIndex < ActiveRecord::Migration
2
2
  def change
3
- remove_index :spree_products, :slug
3
+ remove_index :spree_products, :slug if index_exists?(:spree_products, :slug)
4
4
  add_index :spree_products, :slug, unique: true
5
5
  end
6
6
  end
@@ -1,5 +1,6 @@
1
1
  class EnsurePaymentsHaveNumbers < ActiveRecord::Migration
2
2
  def change
3
+ add_index :spree_payments, :number unless index_exists?(:spree_payments, :number)
3
4
  Spree::Payment.where(number: nil).find_each do |payment|
4
5
  payment.generate_number
5
6
  payment.update_columns(number: payment.number)
@@ -1,5 +1,5 @@
1
1
  module Spree
2
2
  def self.version
3
- '3.0.4'
3
+ '3.0.5'
4
4
  end
5
5
  end
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: 3.0.4
4
+ version: 3.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Schofield
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-19 00:00:00.000000000 Z
11
+ date: 2016-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemerchant
@@ -150,20 +150,6 @@ dependencies:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
152
  version: 1.6.18
153
- - !ruby/object:Gem::Dependency
154
- name: httparty
155
- requirement: !ruby/object:Gem::Requirement
156
- requirements:
157
- - - "~>"
158
- - !ruby/object:Gem::Version
159
- version: '0.11'
160
- type: :runtime
161
- prerelease: false
162
- version_requirements: !ruby/object:Gem::Requirement
163
- requirements:
164
- - - "~>"
165
- - !ruby/object:Gem::Version
166
- version: '0.11'
167
153
  - !ruby/object:Gem::Dependency
168
154
  name: json
169
155
  requirement: !ruby/object:Gem::Requirement
@@ -352,6 +338,20 @@ dependencies:
352
338
  - - "~>"
353
339
  - !ruby/object:Gem::Version
354
340
  version: '3.0'
341
+ - !ruby/object:Gem::Dependency
342
+ name: sprockets-rails
343
+ requirement: !ruby/object:Gem::Requirement
344
+ requirements:
345
+ - - "~>"
346
+ - !ruby/object:Gem::Version
347
+ version: '2.0'
348
+ type: :runtime
349
+ prerelease: false
350
+ version_requirements: !ruby/object:Gem::Requirement
351
+ requirements:
352
+ - - "~>"
353
+ - !ruby/object:Gem::Version
354
+ version: '2.0'
355
355
  - !ruby/object:Gem::Dependency
356
356
  name: email_spec
357
357
  requirement: !ruby/object:Gem::Requirement
@@ -404,7 +404,6 @@ files:
404
404
  - app/models/spree/adjustable/adjustments_updater.rb
405
405
  - app/models/spree/adjustable/promotion_accumulator.rb
406
406
  - app/models/spree/adjustment.rb
407
- - app/models/spree/alert.rb
408
407
  - app/models/spree/app_configuration.rb
409
408
  - app/models/spree/asset.rb
410
409
  - app/models/spree/base.rb
@@ -922,8 +921,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
922
921
  version: 1.8.23
923
922
  requirements: []
924
923
  rubyforge_project:
925
- rubygems_version: 2.4.5
924
+ rubygems_version: 2.4.6
926
925
  signing_key:
927
926
  specification_version: 4
928
927
  summary: The bare bones necessary for Spree.
929
928
  test_files: []
929
+ has_rdoc:
@@ -1,17 +0,0 @@
1
- require 'httparty'
2
-
3
- module Spree
4
- class Alert
5
- def self.current(host)
6
- params = {
7
- version: Spree.version,
8
- name: Spree::Store.current.name,
9
- host: host,
10
- rails_env: Rails.env,
11
- rails_version: Rails.version
12
- }
13
-
14
- HTTParty.get('http://alerts.spreecommerce.com/alerts.json', query: params).parsed_response
15
- end
16
- end
17
- end