spree_zoned 0.5.22 → 0.5.23

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.
@@ -1,6 +1,8 @@
1
1
  require 'delocalize'
2
2
 
3
3
  Spree::Admin::ProductsController.class_eval do
4
+
5
+ include ActionView::Helpers::NumberHelper
4
6
 
5
7
  before_filter :delocSetPrice, :only => :update
6
8
 
@@ -12,6 +14,20 @@ Spree::Admin::ProductsController.class_eval do
12
14
  inorout(@product.method :backtocountry)
13
15
  end
14
16
 
17
+ def update
18
+ puts "Here spree/admin/products_controller/update"
19
+ puts "BEFORE: @product.price: #{@product.price}"
20
+ puts "params[:product][:price]: #{params[:product][:price]}"
21
+ params[:product][:price] = Delocalize::LocalizedNumericParser.parse(params[:product][:price])
22
+ puts "params[:product][:price] after parse: #{params[:product][:price]}"
23
+ # delete cprice to prevent mass assignemnt error in ActiveModel
24
+ # cprice has already been handled in before_filter "delocSetrPrice"
25
+ params[:product].delete :cprice
26
+ @product.update_attributes(params[:product])
27
+ puts "AFTER: @product.price: #{@product.price}"
28
+ redirect_to :action => 'edit'
29
+ end
30
+
15
31
  protected
16
32
 
17
33
  #
@@ -90,15 +106,11 @@ protected
90
106
  end
91
107
 
92
108
  def delocSetPrice
93
- if params[:product] && params[:product][:price]
94
- params[:product][:price] = Delocalize::LocalizedNumericParser.parse(
95
- params[:product][:price])
96
- end
97
109
  country = session[:zoned] && session[:zoned][:prd_country]
98
- if country && country != 0 && params[:product] && params[:product][:price]
99
- @product.setprice(country.to_i, BigDecimal.new(params[:product][:price]))
110
+ if country && country.to_i != 0 && params[:product] && params[:product][:cprice]
111
+ puts "Here delocSetPrice before setprice: params[:product][:cprice]: #{params[:product][:cprice]}"
112
+ @product.setprice(country.to_i, BigDecimal.new(Delocalize::LocalizedNumericParser.parse(params[:product][:cprice])))
100
113
  end
101
- params[:product][:price] = @product.price
102
- end
114
+ end
103
115
 
104
116
  end
@@ -1,64 +1,73 @@
1
- <%= f.field_container :price do %>
2
- <%= f.label :price, t(:master_price) %> <span class="required">*</span>
3
- <br />(<%= t('country') + ": " -%>
4
- <% country = session[:zoned] && session[:zoned][:prd_country] %>
5
- <% country = country ? country.to_i : 0 %>
6
- <% c = Rails.application.config.commonCountriesForSelect.select {|e| e[1]==country} %>
7
- <%= c.length == 1 ? c[0][0] : t(:nocountrysel) -%>
8
- )<br />
9
- <%= f.text_field :price, :value => number_with_precision(
10
- getCPrice(@product), precision: 2)%>
11
- <%= f.error_message_on :price %>
12
- <% end %>
1
+ <% country = session[:zoned] && session[:zoned][:prd_country] %>
2
+ <% country = country ? country.to_i : 0 %>
3
+ <% c = Rails.application.config.commonCountriesForSelect.select {|e| e[1]==country} %>
4
+ <% csel = (c.length == 1) %>
13
5
 
14
- <%= f.field_container :cost_price do %>
15
- <%= f.label :cost_price, t(:cost_price) %><br />
16
- <%= f.text_field :cost_price, :value => number_with_precision(
17
- @product.cost_price, precision: 2) %>
18
- <%= f.error_message_on :cost_price %>
6
+ <% if csel %>
7
+ <%= f.field_container :cprice do %>
8
+ <%= f.label :cprice, t(:country_price) %> <span class="required">*</span>
9
+ <br />(<%= t('country') + ": #{c[0][0]}" -%>)<br />
10
+ <%= f.text_field :cprice, :value => number_with_precision(
11
+ getCPrice(@product), precision: 2) %>
12
+ <%= f.error_message_on :cprice %>
19
13
  <% end %>
14
+ <% end %>
20
15
 
21
- <%= f.field_container :available_on do %>
22
- <%= f.label :available_on, t(:available_on) %><br />
23
- <%= f.error_message_on :available_on %>
24
- <%= f.text_field :available_on, :class => 'datepicker' %>
25
- <% end %>
16
+ <%= f.field_container :price do %>
17
+ <%= f.label :price, t(:master_price) %> <span class="required">*</span><br />
18
+ <%= f.text_field :price, :value => number_with_precision(
19
+ @product.price, precision: 2) %>
20
+ <%= f.error_message_on :price %>
21
+ <% end %>
26
22
 
27
- <% unless @product.has_variants? %>
28
- <%= f.field_container :sku do %>
29
- <%= f.label :sku, t(:sku) %><br />
30
- <%= f.text_field :sku, :size => 16 %>
31
- <% end %>
23
+ <%= f.field_container :cost_price do %>
24
+ <%= f.label :cost_price, t(:cost_price) %><br />
25
+ <%= f.text_field :cost_price, :value => number_with_precision(
26
+ @product.cost_price, precision: 2) %>
27
+ <%= f.error_message_on :cost_price %>
28
+ <% end %>
32
29
 
33
- <% if Spree::Config[:track_inventory_levels] %>
34
- <%= f.field_container :on_hand do %>
35
- <%= f.label :on_hand, t(:on_hand) %><br />
36
- <%= f.number_field :on_hand, :min => 0 %>
37
- <% end %>
30
+ <%= f.field_container :available_on do %>
31
+ <%= f.label :available_on, t(:available_on) %><br />
32
+ <%= f.error_message_on :available_on %>
33
+ <%= f.text_field :available_on, :class => 'datepicker' %>
34
+ <% end %>
35
+
36
+ <% unless @product.has_variants? %>
37
+ <%= f.field_container :sku do %>
38
+ <%= f.label :sku, t(:sku) %><br />
39
+ <%= f.text_field :sku, :size => 16 %>
40
+ <% end %>
41
+
42
+ <% if Spree::Config[:track_inventory_levels] %>
43
+ <%= f.field_container :on_hand do %>
44
+ <%= f.label :on_hand, t(:on_hand) %><br />
45
+ <%= f.number_field :on_hand, :min => 0 %>
38
46
  <% end %>
47
+ <% end %>
39
48
 
40
- <ul id="shipping_specs">
41
- <li id="shipping_specs_weight_field">
42
- <%= f.label :weight, t(:weight) %>
43
- <%= f.text_field :weight, :size => 4, :value => number_with_precision(
44
- @product.weight, precision: 1) %>
45
- </li>
46
- <li id="shipping_specs_height_field">
47
- <%= f.label :height, t(:height) %>
48
- <%= f.text_field :height, :size => 4, :value => number_with_precision(
49
- @product.height, precision: 1) %>
50
- </li>
51
- <li id="shipping_specs_width_field">
52
- <%= f.label :width, t(:width) %>
53
- <%= f.text_field :width, :size => 4, :value => number_with_precision(
54
- @product.width, precision: 1) %>
55
- </li>
56
- <li id="shipping_specs_depth_field">
57
- <%= f.label :depth, t(:depth) %>
58
- <%= f.text_field :depth, :size => 4, :value => number_with_precision(
59
- @product.depth, precision: 1) %>
60
- </li>
61
- </ul>
49
+ <ul id="shipping_specs">
50
+ <li id="shipping_specs_weight_field">
51
+ <%= f.label :weight, t(:weight) %>
52
+ <%= f.text_field :weight, :size => 4, :value => number_with_precision(
53
+ @product.weight, precision: 1) %>
54
+ </li>
55
+ <li id="shipping_specs_height_field">
56
+ <%= f.label :height, t(:height) %>
57
+ <%= f.text_field :height, :size => 4, :value => number_with_precision(
58
+ @product.height, precision: 1) %>
59
+ </li>
60
+ <li id="shipping_specs_width_field">
61
+ <%= f.label :width, t(:width) %>
62
+ <%= f.text_field :width, :size => 4, :value => number_with_precision(
63
+ @product.width, precision: 1) %>
64
+ </li>
65
+ <li id="shipping_specs_depth_field">
66
+ <%= f.label :depth, t(:depth) %>
67
+ <%= f.text_field :depth, :size => 4, :value => number_with_precision(
68
+ @product.depth, precision: 1) %>
69
+ </li>
70
+ </ul>
62
71
  <% end %>
63
72
 
64
73
  <%= f.field_container :shipping_categories do %>
@@ -4,4 +4,6 @@
4
4
  de:
5
5
  nocountrysel: "Kein Land ausgewählt"
6
6
  deletefc: "Aus Land löschen"
7
- backtocountry: "Wieder ins Land"
7
+ backtocountry: "Wieder ins Land"
8
+ master_price: "Master - Preis"
9
+ country_price: "Länderpreis"
@@ -4,4 +4,5 @@
4
4
  en:
5
5
  nocountrysel: "No country selected"
6
6
  deletefc: "Delete from country"
7
- backtocountry: "Reassign to country"
7
+ backtocountry: "Reassign to country"
8
+ country_price: "Country-specific price"
data/spree_zoned.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
  Gem::Specification.new do |s|
3
3
  s.platform = Gem::Platform::RUBY
4
4
  s.name = 'spree_zoned'
5
- s.version = '0.5.22'
5
+ s.version = '0.5.23'
6
6
  s.summary = 'A Spree extension to make your store zoned'
7
7
  s.description = "Everything you need for a zoned Spree store: zoned pricing, zoned products, zoned product ordering, zoned locales, ...\nProbalbly essential to you if you operate outside of the US."
8
8
  s.required_ruby_version = '>= 1.9.2'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_zoned
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.22
4
+ version: 0.5.23
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-06 00:00:00.000000000 Z
12
+ date: 2012-07-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: spree_core