caboose-cms 0.7.47 → 0.7.48

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 97e5d06a76226c44c19e33d6d818e1dde1728f9e
4
- data.tar.gz: e4bff286f011bef198631f52b910998c0c478fb0
3
+ metadata.gz: e90aa603ad21be1a2b9d3e2abe38a8ecd809610e
4
+ data.tar.gz: 87b0b0d31dccb25263087ed7dd4b46ff3ea3d3ed
5
5
  SHA512:
6
- metadata.gz: 516be68e61c0604aa4d83a8e6e78f0da7c9674c4d8ccc82dfe8e8b95f8559a02c31991a50814c928977eaf9b648bdba89fe24e766dd84e24c1c83d5ebf4a1809
7
- data.tar.gz: 9af2ec3cf136043d6e1fe647eaa08143a482d80836786c9f004380318497574ee19b3db0ed83d7f2aac4c102a5fcbc9995dd31c7e5f2335edcecfc4bd8a065d5
6
+ metadata.gz: 803d27ab5a34e4671cc653eabb084126aef317a74d8b52b7feac67af24b776af3a29e10fa9c616f53b98da6d2e89259efa82e46466f46b180ac8102fa0499bac
7
+ data.tar.gz: 2f2c7df6b1eae40ee8fc80079907b5b6024061595d7b0e31790e7e4ab31287d00d634d8cfcdabbc91927608c74d01cd44d5472000155d25778694b306c02e8d6
@@ -449,6 +449,13 @@ module Caboose
449
449
 
450
450
  end
451
451
 
452
+ def hide_prices_for_any_line_item?
453
+ self.line_items.each do |li|
454
+ return true if li.hide_prices
455
+ end
456
+ return false
457
+ end
458
+
452
459
  end
453
460
  end
454
461
 
@@ -115,15 +115,19 @@ module Caboose
115
115
 
116
116
  def order_table
117
117
 
118
+ hide_prices = order.hide_prices_for_any_line_item?
119
+
118
120
  tbl = []
119
121
  tbl << [
120
122
  { :content => "Package" , :align => :left , :valign => :bottom },
121
123
  { :content => "Product" , :align => :left , :valign => :bottom, :colspan => 2 },
122
124
  { :content => "Attributes" , :align => :left , :valign => :bottom },
123
- { :content => "Quantity" , :align => :right , :valign => :bottom },
124
- { :content => "Price" , :align => :right , :valign => :bottom },
125
- { :content => "Amount" , :align => :right , :valign => :bottom }
125
+ { :content => "Quantity" , :align => :right , :valign => :bottom }
126
126
  ]
127
+ if !hide_prices
128
+ tbl << { :content => "Price" , :align => :right , :valign => :bottom }
129
+ tbl << { :content => "Amount" , :align => :right , :valign => :bottom }
130
+ end
127
131
 
128
132
  order.calculate
129
133
 
@@ -155,10 +159,12 @@ module Caboose
155
159
  end
156
160
  arr << { :content => "#{li.variant.product.title}\n#{li.variant.sku}\n#{self.gift_options(li)}", :borders => [:top, :right, :bottom], :width => 100 }
157
161
  arr << { :content => options }
158
- arr << { :content => "#{li.quantity}" , :align => :right }
159
- arr << { :content => "$" + sprintf("%.2f", li.unit_price) , :align => :right }
160
- arr << { :content => "$" + sprintf("%.2f", li.subtotal) , :align => :right }
161
-
162
+ arr << { :content => "#{li.quantity}", :align => :right }
163
+ if !hide_prices
164
+ arr << { :content => "$" + sprintf("%.2f", li.unit_price) , :align => :right }
165
+ arr << { :content => "$" + sprintf("%.2f", li.subtotal) , :align => :right }
166
+ end
167
+
162
168
  tbl << arr
163
169
 
164
170
  end
@@ -187,20 +193,23 @@ module Caboose
187
193
  arr << { :content => "#{li.variant.product.title}\n#{li.variant.sku}\n#{self.gift_options(li)}", :borders => [:top, :right, :bottom], :width => 100 }
188
194
  arr << { :content => options }
189
195
  arr << { :content => "#{li.quantity}" , :align => :right }
190
- if li.unit_price
191
- arr << { :content => "$" + sprintf("%.2f", li.unit_price) , :align => :right }
192
- else
193
- arr << { :content => "" }
196
+ if !hide_prices
197
+ if li.unit_price
198
+ arr << { :content => "$" + sprintf("%.2f", li.unit_price) , :align => :right }
199
+ else
200
+ arr << { :content => "" }
201
+ end
202
+ arr << { :content => "$" + sprintf("%.2f", li.subtotal) , :align => :right }
194
203
  end
195
- arr << { :content => "$" + sprintf("%.2f", li.subtotal) , :align => :right }
196
204
  tbl << arr
197
205
  end
198
-
199
- tbl << [{ :content => "Subtotal" , :colspan => 6, :align => :right }, { :content => "$" + sprintf("%.2f", order.subtotal ) , :align => :right }]
200
- tbl << [{ :content => "Discount" , :colspan => 6, :align => :right }, { :content => "(-) $" + sprintf("%.2f", order.discount ? order.discount : 0.0 ) , :align => :right }]
201
- tbl << [{ :content => "Shipping and Handling Charges" , :colspan => 6, :align => :right }, { :content => "(+) $" + sprintf("%.2f", order.shipping_and_handling ) , :align => :right }]
202
- tbl << [{ :content => "Sales Tax" , :colspan => 6, :align => :right }, { :content => "(+) $" + sprintf("%.2f", order.tax ? order.tax : 0.0 ) , :align => :right }]
203
- tbl << [{ :content => "Grand Total" , :colspan => 6, :align => :right, :font_style => :bold }, { :content => "$" + sprintf("%.2f", order.total ) , :align => :right, :font_style => :bold }]
206
+ if !hide_prices
207
+ tbl << [{ :content => "Subtotal" , :colspan => 6, :align => :right }, { :content => "$" + sprintf("%.2f", order.subtotal ) , :align => :right }]
208
+ tbl << [{ :content => "Discount" , :colspan => 6, :align => :right }, { :content => "(-) $" + sprintf("%.2f", order.discount ? order.discount : 0.0 ) , :align => :right }]
209
+ tbl << [{ :content => "Shipping and Handling Charges" , :colspan => 6, :align => :right }, { :content => "(+) $" + sprintf("%.2f", order.shipping_and_handling ) , :align => :right }]
210
+ tbl << [{ :content => "Sales Tax" , :colspan => 6, :align => :right }, { :content => "(+) $" + sprintf("%.2f", order.tax ? order.tax : 0.0 ) , :align => :right }]
211
+ tbl << [{ :content => "Grand Total" , :colspan => 6, :align => :right, :font_style => :bold }, { :content => "$" + sprintf("%.2f", order.total ) , :align => :right, :font_style => :bold }]
212
+ end
204
213
 
205
214
  table tbl , :position => 7, :width => 530
206
215
  end
@@ -114,16 +114,20 @@ module Caboose
114
114
 
115
115
  def order_table(order)
116
116
 
117
+ hide_prices = order.hide_prices_for_any_line_item?
118
+
117
119
  tbl = []
118
120
  tbl << [
119
121
  { :content => "Package" , :align => :left , :valign => :bottom },
120
122
  { :content => "Product" , :align => :left , :valign => :bottom , :colspan => 2 },
121
123
  { :content => "Attributes" , :align => :left , :valign => :bottom },
122
- { :content => "Quantity" , :align => :right , :valign => :bottom },
123
- { :content => "Price" , :align => :right , :valign => :bottom },
124
- { :content => "Amount" , :align => :right , :valign => :bottom }
124
+ { :content => "Quantity" , :align => :right , :valign => :bottom }
125
125
  ]
126
-
126
+ if !hide_prices
127
+ tbl << { :content => "Price" , :align => :right , :valign => :bottom }
128
+ tbl << { :content => "Amount" , :align => :right , :valign => :bottom }
129
+ end
130
+
127
131
  #order.calculate
128
132
 
129
133
  order.order_packages.all.each do |pk|
@@ -157,8 +161,10 @@ module Caboose
157
161
  arr << { :content => "#{li.variant.product.title}\n#{li.variant.sku}\n#{self.gift_options(li)}", :borders => [:top, :right, :bottom], :width => 100 }
158
162
  arr << { :content => options }
159
163
  arr << { :content => "#{li.quantity}" , :align => :right }
160
- arr << { :content => "$" + sprintf("%.2f", li.unit_price) , :align => :right }
161
- arr << { :content => "$" + sprintf("%.2f", li.subtotal) , :align => :right }
164
+ if !hide_prices
165
+ arr << { :content => "$" + sprintf("%.2f", li.unit_price) , :align => :right }
166
+ arr << { :content => "$" + sprintf("%.2f", li.subtotal) , :align => :right }
167
+ end
162
168
 
163
169
  tbl << arr
164
170
 
@@ -190,20 +196,24 @@ module Caboose
190
196
  arr << { :content => "#{li.variant.product.title}\n#{li.variant.sku}\n#{self.gift_options(li)}", :borders => [:top, :right, :bottom], :width => 100 }
191
197
  arr << { :content => options }
192
198
  arr << { :content => "#{li.quantity}" , :align => :right }
193
- if li.unit_price
194
- arr << { :content => "$" + sprintf("%.2f", li.unit_price) , :align => :right }
195
- else
196
- arr << { :content => "" }
199
+ if !hide_prices
200
+ if li.unit_price
201
+ arr << { :content => "$" + sprintf("%.2f", li.unit_price) , :align => :right }
202
+ else
203
+ arr << { :content => "" }
204
+ end
205
+ arr << { :content => "$" + sprintf("%.2f", li.subtotal) , :align => :right }
197
206
  end
198
- arr << { :content => "$" + sprintf("%.2f", li.subtotal) , :align => :right }
199
207
  tbl << arr
200
208
  end
201
209
  order.calculate
202
- tbl << [{ :content => "Subtotal" , :colspan => 6, :align => :right }, { :content => "$" + sprintf("%.2f", order.subtotal ) , :align => :right }]
203
- tbl << [{ :content => "Discount" , :colspan => 6, :align => :right }, { :content => "(-) $" + sprintf("%.2f", order.discount ? order.discount : 0.0 ) , :align => :right }]
204
- tbl << [{ :content => "Shipping and Handling Charges" , :colspan => 6, :align => :right }, { :content => "(+) $" + sprintf("%.2f", order.shipping_and_handling ) , :align => :right }]
205
- tbl << [{ :content => "Sales Tax" , :colspan => 6, :align => :right }, { :content => "(+) $" + sprintf("%.2f", order.tax ? order.tax : 0.0 ) , :align => :right }]
206
- tbl << [{ :content => "Grand Total" , :colspan => 6, :align => :right, :font_style => :bold }, { :content => "$" + sprintf("%.2f", order.total ) , :align => :right, :font_style => :bold }]
210
+ if !hide_prices
211
+ tbl << [{ :content => "Subtotal" , :colspan => 6, :align => :right }, { :content => "$" + sprintf("%.2f", order.subtotal ) , :align => :right }]
212
+ tbl << [{ :content => "Discount" , :colspan => 6, :align => :right }, { :content => "(-) $" + sprintf("%.2f", order.discount ? order.discount : 0.0 ) , :align => :right }]
213
+ tbl << [{ :content => "Shipping and Handling Charges" , :colspan => 6, :align => :right }, { :content => "(+) $" + sprintf("%.2f", order.shipping_and_handling ) , :align => :right }]
214
+ tbl << [{ :content => "Sales Tax" , :colspan => 6, :align => :right }, { :content => "(+) $" + sprintf("%.2f", order.tax ? order.tax : 0.0 ) , :align => :right }]
215
+ tbl << [{ :content => "Grand Total" , :colspan => 6, :align => :right, :font_style => :bold }, { :content => "$" + sprintf("%.2f", order.total ) , :align => :right, :font_style => :bold }]
216
+ end
207
217
 
208
218
  table tbl , :position => 7, :width => 530
209
219
  end
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.7.47'
2
+ VERSION = '0.7.48'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caboose-cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.47
4
+ version: 0.7.48
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-11 00:00:00.000000000 Z
11
+ date: 2016-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg