diff --git a/Screenshots/issue.png b/Screenshots/issue.png deleted file mode 100644 index b5f3e5a..0000000 Binary files a/Screenshots/issue.png and /dev/null differ diff --git a/Screenshots/issue_form.png b/Screenshots/issue_form.png deleted file mode 100644 index 34a373d..0000000 Binary files a/Screenshots/issue_form.png and /dev/null differ diff --git a/Screenshots/plugin_config.png b/Screenshots/plugin_config.png deleted file mode 100644 index 55729c4..0000000 Binary files a/Screenshots/plugin_config.png and /dev/null differ diff --git a/Screenshots/plugin_cusomer_search.png b/Screenshots/plugin_cusomer_search.png deleted file mode 100644 index 2f97bb6..0000000 Binary files a/Screenshots/plugin_cusomer_search.png and /dev/null differ diff --git a/Screenshots/plugin_customer_detail.png b/Screenshots/plugin_customer_detail.png deleted file mode 100644 index edeb76a..0000000 Binary files a/Screenshots/plugin_customer_detail.png and /dev/null differ diff --git a/Screenshots/plugin_user_edit.png b/Screenshots/plugin_user_edit.png deleted file mode 100644 index 3dadac5..0000000 Binary files a/Screenshots/plugin_user_edit.png and /dev/null differ diff --git a/app/views/customers/_details.html.erb b/app/views/customers/_details.html.erb index 57f8d60..c727c09 100644 --- a/app/views/customers/_details.html.erb +++ b/app/views/customers/_details.html.erb @@ -1,3 +1,5 @@ +<%# Phone numbers as (401) 555-0101, left blank when the customer has none %> +<% phone = ->(number) { digits = number.to_s.gsub(/\D/, ''); digits.present? ? number_to_phone(digits.to_i, area_code: true) : '' } %> @@ -13,27 +15,27 @@ - + - + - + - + - + <% if customer.notes.present? %> diff --git a/test/integration/customers_controller_test.rb b/test/integration/customers_controller_test.rb index 8a28221..2435146 100644 --- a/test/integration/customers_controller_test.rb +++ b/test/integration/customers_controller_test.rb @@ -72,6 +72,26 @@ class CustomersControllerTest < Redmine::IntegrationTest assert_response :not_found end + def test_show_details_from_quickbooks + address = Quickbooks::Model::PhysicalAddress.new + address.line1 = '123 Main St' + address.city = 'Springfield' + address.country_sub_division_code = 'RI' + address.postal_code = '02900' + details = Quickbooks::Model::Customer.new(display_name: 'Jane Customer', balance: BigDecimal('125')) + details.billing_address = address + details.primary_phone = Quickbooks::Model::TelephoneNumber.new.tap { |t| t.free_form_number = '401-555-0101' } + @fake.customers['9101'] = details + grant(:view_customers) + get '/customers/9101' + rows = css_select('table tr').to_h { |tr| [tr.at('th')&.text.to_s.strip, tr.at('td')&.text.to_s.strip] } + assert_equal "123 Main St\nSpringfield, RI 02900", rows[I18n.t(:label_billing_address)] + assert_equal '(401) 555-0101', rows[I18n.t(:label_primary_phone)] + # No mobile number: blank, not "0" + assert_equal '', rows[I18n.t(:label_mobile_phone)] + assert_equal '$125.00', rows[I18n.t(:label_account_balance)] + end + def test_autocomplete grant(:view_customers) get '/customers/autocomplete', params: { q: 'jane custmer' }
<%= t(:label_primary_phone) %><%= number_to_phone(customer&.primary_phone&.gsub(/[^\d]/, '').to_i, area_code: true) %><%= phone.call(customer&.primary_phone) %>
<%= t(:label_mobile_phone) %><%= number_to_phone(customer&.mobile_phone&.gsub(/[^\d]/, '').to_i, area_code: true) %><%= phone.call(customer&.mobile_phone) %>
<%= t(:label_billing_address) %>
<%= @billing_address %>
<%= RedmineQboBilling::EstimateWriter.format_address(customer.billing_address) %>
<%= t(:label_shipping_address) %>
<%= @shipping_address %>
<%= RedmineQboBilling::EstimateWriter.format_address(customer.shipping_address) %>
<%= t(:label_account_balance) %>$<%= customer.balance %><%= number_to_currency(customer.balance || 0) %>