caboose-cms 0.9.3 → 0.9.4

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: 3c7ed09c651bd70cb879b25014784b3acc3f8d1c
4
- data.tar.gz: 4d0819e40963287c774d8561c059863c8fd6afd6
3
+ metadata.gz: c32bec44530cdc5f76808682909fd88aaa01f77b
4
+ data.tar.gz: 0865c9c5f04a41f8e45dc6a2ace2e0bb3e3f99dc
5
5
  SHA512:
6
- metadata.gz: 794cb19fac1f038300589876aa39774e0dfc7c105b9ec5c46c6eeae80ee8bfae8aa5c187b1d364f859bd44f167cb3d02e28d705849740de0fc22bdf27380298c
7
- data.tar.gz: 9432bccdc101e9711904adac6abf3273e2048f7058bafdd500e8a551db4f98bb797e43d91410f38d10aefb9d38b793599c45f67b283f4aece7b61ecd963d6db8
6
+ metadata.gz: fda2258243f5930f898dac1e72fb26e2be80805912396d555ca198197f615b53a9f456671f1c657c0ab1862b929a0370c896fef4042afe2d3a84a2ca496d2697
7
+ data.tar.gz: fef9a611187d7874093887dc89779f0b7806bd96c7c92e6217d23db93b645144fdb6ee2c7f1ecb4576dccc91a42bbb5b028d4c79de80c0648cc8d88bdce02c09
@@ -106,9 +106,16 @@ module Caboose
106
106
  ]
107
107
 
108
108
  sa = invoice.shipping_address
109
- sa_address = "#{sa.address1}" + (sa.address2.blank? ? '' : "\n#{sa.address2}") + "\n#{sa.city}, #{sa.state} #{sa.zip}"
109
+ sa_name = sa && sa.first_name ? "#{sa.first_name} #{sa.last_name}" : "#{c.first_name} #{c.last_name}"
110
+ sa_address = sa ?
111
+ (sa.address1 && sa.address1.length > 0 ? "#{sa.address1}\n" : '') +
112
+ (sa.address2 && sa.address2.length > 0 ? "#{sa.address2}\n" : '') +
113
+ (sa.city && sa.city.length > 0 ? "#{sa.city}, " : '') +
114
+ (sa.state && sa.state.length > 0 ? "#{sa.state} " : '') +
115
+ (sa.zip && sa.zip.length > 0 ? sa.zip : '') : ''
116
+
110
117
  shipped_to = [
111
- [{ :content => "Name" , :border_width => 0, :width => 55 },{ :content => "#{sa.first_name} #{sa.last_name}" , :border_width => 0, :width => 200 }],
118
+ [{ :content => "Name" , :border_width => 0, :width => 55 },{ :content => sa_name , :border_width => 0, :width => 200 }],
112
119
  [{ :content => "Address" , :border_width => 0, :width => 55 },{ :content => sa_address , :border_width => 0, :width => 200 }],
113
120
  [{ :content => "Email" , :border_width => 0, :width => 55 },{ :content => "#{c.email}" , :border_width => 0, :width => 200 }],
114
121
  [{ :content => "Phone" , :border_width => 0, :width => 55 },{ :content => "#{self.formatted_phone(c.phone)}" , :border_width => 0, :width => 200 }]
@@ -95,19 +95,19 @@ module Caboose
95
95
 
96
96
  sa = invoice.shipping_address
97
97
  shipped_to = []
98
- if sa
99
- sa_address = "#{sa.address1}" + (sa.address2.blank? ? '' : "\n#{sa.address2}") + "\n#{sa.city}, #{sa.state} #{sa.zip}"
100
- shipped_to << [{ :content => "Name" , :border_width => 0, :width => 55 },{ :content => "#{sa.first_name} #{sa.last_name}" , :border_width => 0, :width => 200 }]
101
- shipped_to << [{ :content => "Address" , :border_width => 0, :width => 55 },{ :content => sa_address , :border_width => 0, :width => 200 }]
102
- shipped_to << [{ :content => "Email" , :border_width => 0, :width => 55 },{ :content => "#{c.email}" , :border_width => 0, :width => 200 }]
103
- shipped_to << [{ :content => "Phone" , :border_width => 0, :width => 55 },{ :content => "#{self.formatted_phone(c.phone)}" , :border_width => 0, :width => 200 }]
104
- else
105
- shipped_to << [{ :content => "Name" , :border_width => 0 }]
106
- shipped_to << [{ :content => "Address" , :border_width => 0 }]
107
- shipped_to << [{ :content => "Email" , :border_width => 0 }]
108
- shipped_to << [{ :content => "Phone" , :border_width => 0 }]
109
- end
110
-
98
+ shipped_to_name = sa && sa.first_name && sa.first_name.length > 0 ? "#{sa.first_name} #{sa.last_name}" : "#{c.first_name} #{c.last_name}"
99
+ shipped_to_address = sa ?
100
+ (sa.address1 && sa.address1.length > 0 ? "#{sa.address1}\n" : '') +
101
+ (sa.address2 && sa.address2.length > 0 ? "#{sa.address2}\n" : '') +
102
+ (sa.city && sa.city.length > 0 ? "#{sa.city}, " : '') +
103
+ (sa.state && sa.state.length > 0 ? "#{sa.state} " : '') +
104
+ (sa.zip && sa.zip.length > 0 ? sa.zip : '') : ''
105
+
106
+ shipped_to << [{ :content => "Name" , :border_width => 0, :width => 55 },{ :content => shipped_to_name , :border_width => 0, :width => 200 }]
107
+ shipped_to << [{ :content => "Address" , :border_width => 0, :width => 55 },{ :content => shipped_to_address , :border_width => 0, :width => 200 }]
108
+ shipped_to << [{ :content => "Email" , :border_width => 0, :width => 55 },{ :content => "#{c.email}" , :border_width => 0, :width => 200 }]
109
+ shipped_to << [{ :content => "Phone" , :border_width => 0, :width => 55 },{ :content => "#{self.formatted_phone(c.phone)}" , :border_width => 0, :width => 200 }]
110
+
111
111
  tbl = []
112
112
  tbl << [
113
113
  { :content => "Shipping Information" , :align => :left, :width => 255, :font_style => :bold },
@@ -142,9 +142,9 @@ module Caboose
142
142
 
143
143
  invoice.invoice_packages.all.each do |pk|
144
144
 
145
- carrier = pk.shipping_method ? pk.shipping_method.carrier : nil
146
- service = pk.shipping_method ? pk.shipping_method.service_name : nil
147
- package = pk.shipping_package ? pk.shipping_package.name : nil
145
+ carrier = pk.shipping_method ? pk.shipping_method.carrier : ''
146
+ service = pk.shipping_method ? pk.shipping_method.service_name : ''
147
+ package = pk.shipping_package ? pk.shipping_package.name : ''
148
148
 
149
149
  pk.line_items.each_with_index do |li, index|
150
150
  options = ''
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.9.3'
2
+ VERSION = '0.9.4'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caboose-cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.3
4
+ version: 0.9.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry