mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2025-11-08 17:04:23 -05:00
PhysicalAddress to_s
This commit is contained in:
@@ -90,6 +90,8 @@ class CustomersController < ApplicationController
|
||||
@customer = Customer.find_by_id(params[:id])
|
||||
@vehicles = @customer.vehicles.paginate(:page => params[:page])
|
||||
@issues = @customer.issues
|
||||
@billing_address = address_to_s(@customer.billing_address)
|
||||
@shipping_address = address_to_s(@customer.shipping_address)
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
@@ -189,4 +191,18 @@ class CustomersController < ApplicationController
|
||||
found_non_zero
|
||||
end
|
||||
|
||||
# format a quickbooks address to a human readable string
|
||||
def address_to_s (address)
|
||||
return if address.nil?
|
||||
string = a.line1
|
||||
string << "\n" + address.line2 if address.line2
|
||||
string << "\n" + address.line3 if address.line3
|
||||
string << "\n" + address.line4 if address.line4
|
||||
string << "\n" + address.line5 if address.line5
|
||||
string << " " + address.city
|
||||
string << ", " + address.country_sub_division_code
|
||||
string << " " + address.postal_code
|
||||
return string
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -17,12 +17,12 @@
|
||||
|
||||
<tr>
|
||||
<th><%=t(:label_billing_address)%></th>
|
||||
<td><%= customer.billing_address %></td>
|
||||
<td><%= @billing_address %></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th><%=t(:label_shipping_address)%></th>
|
||||
<td><%= customer.shipping_address %></td>
|
||||
<td><%= @shipping_address %></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
@@ -35,11 +35,6 @@
|
||||
<td>$<%= customer.balance %></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th><%=t(:label_balance_with_jobs)%></th>
|
||||
<td>$<%= customer.balance_with_jobs %></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th><%=t(:field_notes)%></th>
|
||||
<td><%= customer.notes %></td>
|
||||
|
||||
Reference in New Issue
Block a user