spree_core 2.0.13 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/spree/base_controller.rb +3 -0
  3. data/app/helpers/spree/base_helper.rb +6 -16
  4. data/app/helpers/spree/products_helper.rb +3 -8
  5. data/app/helpers/spree/taxons_helper.rb +1 -1
  6. data/app/mailers/spree/base_mailer.rb +0 -5
  7. data/app/models/spree/ability.rb +10 -7
  8. data/app/models/spree/address.rb +7 -17
  9. data/app/models/spree/adjustment.rb +15 -11
  10. data/app/models/spree/app_configuration.rb +0 -5
  11. data/app/models/spree/billing_integration.rb +0 -1
  12. data/app/models/spree/calculator/flat_percent_item_total.rb +1 -3
  13. data/app/models/spree/calculator/flat_rate.rb +2 -4
  14. data/app/models/spree/calculator/flexi_rate.rb +6 -9
  15. data/app/models/spree/calculator/per_item.rb +2 -4
  16. data/app/models/spree/calculator/percent_per_item.rb +1 -3
  17. data/app/models/spree/calculator/price_sack.rb +4 -9
  18. data/app/models/spree/calculator/shipping/flat_percent_item_total.rb +1 -2
  19. data/app/models/spree/calculator/shipping/flat_rate.rb +2 -4
  20. data/app/models/spree/calculator/shipping/flexi_rate.rb +4 -9
  21. data/app/models/spree/calculator/shipping/per_item.rb +2 -3
  22. data/app/models/spree/calculator/shipping/price_sack.rb +4 -9
  23. data/app/models/spree/classification.rb +0 -3
  24. data/app/models/spree/country.rb +1 -3
  25. data/app/models/spree/credit_card.rb +37 -38
  26. data/app/models/spree/gateway/bogus_simple.rb +0 -8
  27. data/app/models/spree/gateway.rb +1 -3
  28. data/app/models/spree/image.rb +1 -3
  29. data/app/models/spree/inventory_unit.rb +5 -8
  30. data/app/models/spree/legacy_user.rb +0 -4
  31. data/app/models/spree/line_item.rb +2 -15
  32. data/app/models/spree/option_type.rb +2 -5
  33. data/app/models/spree/option_value.rb +1 -3
  34. data/app/models/spree/order/checkout.rb +4 -13
  35. data/app/models/spree/order.rb +47 -99
  36. data/app/models/spree/order_contents.rb +4 -7
  37. data/app/models/spree/order_inventory.rb +4 -8
  38. data/app/models/spree/order_updater.rb +13 -12
  39. data/app/models/spree/payment/processing.rb +12 -19
  40. data/app/models/spree/payment.rb +17 -30
  41. data/app/models/spree/payment_method.rb +2 -3
  42. data/app/models/spree/preference.rb +1 -1
  43. data/app/models/spree/preferences/configuration.rb +1 -1
  44. data/app/models/spree/preferences/preferable.rb +1 -1
  45. data/app/models/spree/preferences/store.rb +1 -1
  46. data/app/models/spree/price.rb +0 -7
  47. data/app/models/spree/product/scopes.rb +16 -17
  48. data/app/models/spree/product.rb +27 -62
  49. data/app/models/spree/product_property.rb +3 -5
  50. data/app/models/spree/promotion/actions/create_adjustment.rb +9 -8
  51. data/app/models/spree/promotion/actions/create_line_items.rb +1 -2
  52. data/app/models/spree/promotion/rules/first_order.rb +1 -1
  53. data/app/models/spree/promotion/rules/item_total.rb +2 -4
  54. data/app/models/spree/promotion/rules/product.rb +2 -2
  55. data/app/models/spree/promotion/rules/user.rb +1 -3
  56. data/app/models/spree/promotion.rb +23 -24
  57. data/app/models/spree/promotion_action.rb +0 -2
  58. data/app/models/spree/promotion_action_line_item.rb +1 -3
  59. data/app/models/spree/promotion_rule.rb +0 -2
  60. data/app/models/spree/property.rb +2 -4
  61. data/app/models/spree/prototype.rb +0 -2
  62. data/app/models/spree/return_authorization.rb +6 -9
  63. data/app/models/spree/role.rb +0 -2
  64. data/app/models/spree/shipment.rb +19 -25
  65. data/app/models/spree/shipping_calculator.rb +0 -2
  66. data/app/models/spree/shipping_category.rb +0 -2
  67. data/app/models/spree/shipping_method.rb +6 -20
  68. data/app/models/spree/shipping_rate.rb +12 -10
  69. data/app/models/spree/state.rb +2 -4
  70. data/app/models/spree/stock/availability_validator.rb +2 -2
  71. data/app/models/spree/stock/estimator.rb +6 -20
  72. data/app/models/spree/stock/packer.rb +1 -1
  73. data/app/models/spree/stock/quantifier.rb +2 -3
  74. data/app/models/spree/stock/splitter/base.rb +1 -1
  75. data/app/models/spree/stock_item.rb +8 -18
  76. data/app/models/spree/stock_location.rb +2 -11
  77. data/app/models/spree/stock_movement.rb +2 -5
  78. data/app/models/spree/stock_transfer.rb +0 -2
  79. data/app/models/spree/tax_category.rb +0 -2
  80. data/app/models/spree/tax_rate.rb +12 -12
  81. data/app/models/spree/taxon.rb +1 -13
  82. data/app/models/spree/taxonomy.rb +3 -6
  83. data/app/models/spree/tracker.rb +0 -2
  84. data/app/models/spree/variant/scopes.rb +2 -2
  85. data/app/models/spree/variant.rb +13 -31
  86. data/app/models/spree/zone.rb +2 -7
  87. data/app/models/spree/zone_member.rb +0 -2
  88. data/app/views/spree/payments/_payment.html.erb +1 -3
  89. data/config/locales/en.yml +11 -26
  90. data/db/default/spree/countries.rb +230 -229
  91. data/db/default/spree/states.rb +57 -56
  92. data/db/default/spree/zones.rb +5 -5
  93. data/db/migrate/20130213191427_create_default_stock.rb +4 -7
  94. data/db/migrate/20130417120035_update_adjustment_states.rb +2 -2
  95. data/db/migrate/20130417123427_add_shipping_rates_to_shipments.rb +1 -1
  96. data/db/migrate/20130509115210_add_number_to_stock_transfer.rb +1 -1
  97. data/db/migrate/20130611054351_rename_shipping_methods_zones_to_spree_shipping_methods_zones.rb +0 -5
  98. data/db/migrate/20130611185927_add_user_id_index_to_spree_orders.rb +5 -0
  99. data/db/migrate/20130618041418_add_updated_at_to_spree_countries.rb +9 -0
  100. data/db/migrate/20130619012236_add_updated_at_to_spree_states.rb +9 -0
  101. data/db/migrate/20130802022321_migrate_tax_categories_to_line_items.rb +4 -5
  102. data/db/migrate/20130806145853_set_default_stock_location_on_shipments.rb +1 -1
  103. data/lib/generators/spree/dummy/dummy_generator.rb +3 -14
  104. data/lib/generators/spree/dummy/templates/rails/database.yml +0 -10
  105. data/lib/generators/spree/dummy/templates/rails/test.rb +2 -7
  106. data/lib/generators/spree/install/install_generator.rb +11 -8
  107. data/lib/spree/core/calculated_adjustments.rb +9 -8
  108. data/lib/spree/core/controller_helpers/auth.rb +2 -3
  109. data/lib/spree/core/controller_helpers/order.rb +8 -13
  110. data/lib/spree/core/controller_helpers/ssl.rb +13 -22
  111. data/lib/spree/core/controller_helpers/strong_parameters.rb +36 -0
  112. data/lib/spree/core/delegate_belongs_to.rb +0 -2
  113. data/lib/spree/core/engine.rb +1 -5
  114. data/lib/spree/core/ext/active_record.rb +2 -9
  115. data/lib/spree/core/permalinks.rb +1 -5
  116. data/lib/spree/core/product_duplicator.rb +2 -16
  117. data/lib/spree/core/product_filters.rb +37 -33
  118. data/lib/spree/core/search/base.rb +1 -1
  119. data/lib/spree/core/version.rb +1 -1
  120. data/lib/spree/core.rb +3 -31
  121. data/lib/spree/i18n.rb +0 -1
  122. data/lib/spree/money.rb +2 -177
  123. data/lib/spree/permitted_attributes.rb +95 -0
  124. data/lib/spree/promo/coupon_applicator.rb +4 -12
  125. data/lib/spree/testing_support/capybara_ext.rb +13 -17
  126. data/lib/spree/testing_support/common_rake.rb +1 -1
  127. data/lib/spree/testing_support/controller_requests.rb +3 -3
  128. data/lib/spree/testing_support/factories/credit_card_factory.rb +1 -1
  129. data/lib/spree/testing_support/factories/product_factory.rb +0 -4
  130. data/lib/spree/testing_support/factories/shipping_method_factory.rb +1 -3
  131. data/lib/spree/testing_support/factories/user_factory.rb +1 -1
  132. data/lib/spree/testing_support/factories/variant_factory.rb +0 -15
  133. data/lib/spree/testing_support/factories.rb +1 -1
  134. data/lib/spree/testing_support/order_walkthrough.rb +1 -1
  135. data/lib/tasks/core.rake +2 -2
  136. data/vendor/assets/javascripts/jquery.payment.js +497 -0
  137. metadata +166 -172
  138. data/app/views/spree/admin/shared/_report_order_criteria.html.erb +0 -17
  139. data/db/migrate/20130417120034_add_index_to_source_columns_on_adjustments.rb +0 -5
  140. data/db/migrate/20130830001033_add_shipping_category_to_shipping_methods_and_products.rb +0 -15
  141. data/db/migrate/20130830001159_migrate_old_shipping_calculators.rb +0 -19
  142. data/db/migrate/20130909115621_change_states_required_for_countries.rb +0 -9
  143. data/db/migrate/20131001013410_remove_unused_credit_card_fields.rb +0 -12
  144. data/db/migrate/20131026154747_add_track_inventory_to_variant.rb +0 -5
  145. data/db/migrate/20131113035136_add_channel_to_spree_orders.rb +0 -5
  146. data/db/migrate/20140120160805_add_index_to_variant_id_and_currency_on_prices.rb +0 -5
  147. data/db/migrate/20140205181631_default_variant_weight_to_zero.rb +0 -11
  148. data/db/migrate/20140415041315_add_user_id_created_by_id_index_to_order.rb +0 -5
  149. data/lib/spree/core/preference_rescue.rb +0 -25
@@ -1,17 +0,0 @@
1
- <%= search_form_for @search, :url => spree.sales_total_admin_reports_path do |s| %>
2
- <div class="date-range-filter field align-center">
3
- <%= label_tag nil, t(:start), :class => 'inline' %>
4
- <%= s.text_field :completed_at_gt, :class => 'datepicker datepicker-from', :value => datepicker_field_value(params[:q][:completed_at_gt]) %>
5
-
6
- <span class="range-divider">
7
- <i class="icon-arrow-right"></i>
8
- </span>
9
-
10
- <%= s.text_field :completed_at_lt, :class => 'datepicker datepicker-to', :value => datepicker_field_value(params[:q][:completed_at_lt]) %>
11
- <%= label_tag nil, t(:end), :class => 'inline' %>
12
- </div>
13
-
14
- <div class="actions filter-actions">
15
- <%= button t(:search), 'icon-search' %>
16
- </div>
17
- <% end %>
@@ -1,5 +0,0 @@
1
- class AddIndexToSourceColumnsOnAdjustments < ActiveRecord::Migration
2
- def change
3
- add_index :spree_adjustments, [:source_type, :source_id]
4
- end
5
- end
@@ -1,15 +0,0 @@
1
- class AddShippingCategoryToShippingMethodsAndProducts < ActiveRecord::Migration
2
- def up
3
- default_category = Spree::ShippingCategory.first
4
- default_category ||= Spree::ShippingCategory.create!(:name => "Default")
5
-
6
- Spree::ShippingMethod.all.each do |method|
7
- method.shipping_categories << default_category if method.shipping_categories.blank?
8
- end
9
-
10
- Spree::Product.where(shipping_category_id: nil).update_all(shipping_category_id: default_category.id)
11
- end
12
-
13
- def down
14
- end
15
- end
@@ -1,19 +0,0 @@
1
- class MigrateOldShippingCalculators < ActiveRecord::Migration
2
- def up
3
- Spree::ShippingMethod.all.each do |shipping_method|
4
- old_calculator = shipping_method.calculator
5
- next if old_calculator.class < Spree::ShippingCalculator # We don't want to mess with new shipping calculators
6
- new_calculator = eval(old_calculator.class.name.sub("::Calculator::", "::Calculator::Shipping::")).new
7
- new_calculator.preferences.keys.each do |pref|
8
- # Preferences can't be read/set by name, you have to prefix preferred_
9
- pref_method = "preferred_#{pref}"
10
- new_calculator.send("#{pref_method}=", old_calculator.send(pref_method))
11
- end
12
- new_calculator.calculable = old_calculator.calculable
13
- new_calculator.save
14
- end
15
- end
16
-
17
- def down
18
- end
19
- end
@@ -1,9 +0,0 @@
1
- class ChangeStatesRequiredForCountries < ActiveRecord::Migration
2
- def up
3
- change_column_default :spree_countries, :states_required, false
4
- end
5
-
6
- def down
7
- change_column_default :spree_countries, :states_required, true
8
- end
9
- end
@@ -1,12 +0,0 @@
1
- class RemoveUnusedCreditCardFields < ActiveRecord::Migration
2
- def up
3
- remove_column :spree_credit_cards, :start_month
4
- remove_column :spree_credit_cards, :start_year
5
- remove_column :spree_credit_cards, :issue_number
6
- end
7
- def down
8
- add_column :spree_credit_cards, :start_month, :string
9
- add_column :spree_credit_cards, :start_year, :string
10
- add_column :spree_credit_cards, :issue_number, :string
11
- end
12
- end
@@ -1,5 +0,0 @@
1
- class AddTrackInventoryToVariant < ActiveRecord::Migration
2
- def change
3
- add_column :spree_variants, :track_inventory, :boolean, :default => true
4
- end
5
- end
@@ -1,5 +0,0 @@
1
- class AddChannelToSpreeOrders < ActiveRecord::Migration
2
- def change
3
- add_column :spree_orders, :channel, :string, default: "spree"
4
- end
5
- end
@@ -1,5 +0,0 @@
1
- class AddIndexToVariantIdAndCurrencyOnPrices < ActiveRecord::Migration
2
- def change
3
- add_index :spree_prices, [:variant_id, :currency]
4
- end
5
- end
@@ -1,11 +0,0 @@
1
- class DefaultVariantWeightToZero < ActiveRecord::Migration
2
- def up
3
- Spree::Variant.unscoped.where(weight: nil).update_all("weight = 0.0")
4
-
5
- change_column :spree_variants, :weight, :decimal, precision: 8, scale: 2, default: 0.0
6
- end
7
-
8
- def down
9
- change_column :spree_variants, :weight, :decimal, precision: 8, scale: 2
10
- end
11
- end
@@ -1,5 +0,0 @@
1
- class AddUserIdCreatedByIdIndexToOrder < ActiveRecord::Migration
2
- def change
3
- add_index :spree_orders, [:user_id, :created_by_id]
4
- end
5
- end
@@ -1,25 +0,0 @@
1
- module Spree
2
- class OldPrefs < ActiveRecord::Base
3
- self.table_name = "spree_preferences"
4
- belongs_to :owner, :polymorphic => true
5
- attr_accessor :owner_klass
6
- end
7
-
8
- class PreferenceRescue
9
- def self.try
10
- OldPrefs.where(:key => nil).each do |old_pref|
11
- next unless owner = (old_pref.owner rescue nil)
12
- unless old_pref.owner_type == "Spree::Activator" || old_pref.owner_type == "Spree::Configuration"
13
- begin
14
- old_pref.key = [owner.class.name, old_pref.name, owner.id].join('::').underscore
15
- old_pref.value_type = owner.preference_type(old_pref.name)
16
- puts "Migrating Preference: #{old_pref.key}"
17
- old_pref.save
18
- rescue NoMethodError => ex
19
- puts ex.message
20
- end
21
- end
22
- end
23
- end
24
- end
25
- end