From 0e47f9eb5f6ce580e7c4f631d56f3b88faae49a5 Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Tue, 4 Apr 2017 08:44:14 -0400 Subject: [PATCH 01/28] Some Cleanup & Fixed to_s to report vin to_s to report vin when year,make,model are nil --- app/models/vehicle.rb | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/app/models/vehicle.rb b/app/models/vehicle.rb index 2fa68f6..d3c6e09 100644 --- a/app/models/vehicle.rb +++ b/app/models/vehicle.rb @@ -12,8 +12,6 @@ class Vehicle < ActiveRecord::Base unloadable - API_KEY = Setting.plugin_redmine_qbo['settingsEdmundsAPIKey'] - belongs_to :customer has_many :issues, :foreign_key => 'vehicles_id' @@ -21,8 +19,6 @@ class Vehicle < ActiveRecord::Base validates_presence_of :customer validates :vin, uniqueness: true - #validates :year, numericality: { only_integer: true } - before_save :decode_vin after_initialize :get_details @@ -30,7 +26,10 @@ class Vehicle < ActiveRecord::Base # returns a human readable string def to_s - return "#{year} #{make} #{model}" + if year.nil? or make.nil? or model.nil? + return "#{year} #{make} #{model}" + else + return "#{vin}" end # returns the raw JSON details from EMUNDS @@ -97,8 +96,7 @@ class Vehicle < ActiveRecord::Base # returns the Edmunds decoder service def get_decoder - #TODO API Code via Settings - return decoder = Edmunds::Vin.new(API_KEY) + return decoder = Edmunds::Vin.new(Setting.plugin_redmine_qbo['settingsEdmundsAPIKey']) end # decodes a vin and updates self From 02aabe604559d3d333e350fe4445c9502749e765 Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Tue, 4 Apr 2017 08:45:34 -0400 Subject: [PATCH 02/28] Forgot End --- app/models/vehicle.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/vehicle.rb b/app/models/vehicle.rb index d3c6e09..7003384 100644 --- a/app/models/vehicle.rb +++ b/app/models/vehicle.rb @@ -30,6 +30,7 @@ class Vehicle < ActiveRecord::Base return "#{year} #{make} #{model}" else return "#{vin}" + end end # returns the raw JSON details from EMUNDS From 4adcbba840b1e9a8cd1d7673ec52550b2295a29a Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Tue, 4 Apr 2017 08:47:15 -0400 Subject: [PATCH 03/28] Update vehicle.rb --- app/models/vehicle.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/vehicle.rb b/app/models/vehicle.rb index 7003384..21bb919 100644 --- a/app/models/vehicle.rb +++ b/app/models/vehicle.rb @@ -26,7 +26,7 @@ class Vehicle < ActiveRecord::Base # returns a human readable string def to_s - if year.nil? or make.nil? or model.nil? + if year.nil? return "#{year} #{make} #{model}" else return "#{vin}" From b3f491a60b1ad5e1dc562b638650628795bf3827 Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Tue, 4 Apr 2017 08:48:36 -0400 Subject: [PATCH 04/28] Fixed logic --- app/models/vehicle.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/vehicle.rb b/app/models/vehicle.rb index 21bb919..b7171a8 100644 --- a/app/models/vehicle.rb +++ b/app/models/vehicle.rb @@ -26,10 +26,10 @@ class Vehicle < ActiveRecord::Base # returns a human readable string def to_s - if year.nil? - return "#{year} #{make} #{model}" - else + if year.nil? or manke.nil? or model.nil? return "#{vin}" + else + return "#{year} #{make} #{model}" end end From 7c63c3c816ebacfde078c040e1808b53b51b22f2 Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Tue, 4 Apr 2017 08:49:08 -0400 Subject: [PATCH 05/28] Fixed typo --- app/models/vehicle.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/vehicle.rb b/app/models/vehicle.rb index b7171a8..4e951a7 100644 --- a/app/models/vehicle.rb +++ b/app/models/vehicle.rb @@ -26,7 +26,7 @@ class Vehicle < ActiveRecord::Base # returns a human readable string def to_s - if year.nil? or manke.nil? or model.nil? + if year.nil? or make.nil? or model.nil? return "#{vin}" else return "#{year} #{make} #{model}" From fce3931858b6a2583f6547cda51a16f267ecd827 Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Tue, 4 Apr 2017 22:22:29 -0400 Subject: [PATCH 06/28] Added new customer button --- app/views/customers/index.html.erb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/views/customers/index.html.erb b/app/views/customers/index.html.erb index d3b3d95..1e99912 100644 --- a/app/views/customers/index.html.erb +++ b/app/views/customers/index.html.erb @@ -3,6 +3,7 @@ <%= form_tag(customers_path, :method => "get", id: "search-form") do %> <%= text_field_tag :search, params[:search], placeholder: "Search Customers" %> <%= submit_tag "Search" %> +<%= button_to "New Customer", new_customer_path, method: :get%> <% end %>
<% if @customers.present? %> From e4d770c2728732de0c2af94b0a99050fba32557e Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Tue, 4 Apr 2017 22:23:33 -0400 Subject: [PATCH 07/28] Update index.html.erb --- app/views/customers/index.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/customers/index.html.erb b/app/views/customers/index.html.erb index 1e99912..e0bba54 100644 --- a/app/views/customers/index.html.erb +++ b/app/views/customers/index.html.erb @@ -3,8 +3,8 @@ <%= form_tag(customers_path, :method => "get", id: "search-form") do %> <%= text_field_tag :search, params[:search], placeholder: "Search Customers" %> <%= submit_tag "Search" %> -<%= button_to "New Customer", new_customer_path, method: :get%> <% end %> +<%= button_to "New Customer", new_customer_path, method: :get%>
<% if @customers.present? %>
From 1a043bea7670700c44f8f9fcf64169a8e3cee1fc Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Tue, 4 Apr 2017 22:26:58 -0400 Subject: [PATCH 08/28] Added Permission Check --- app/views/customers/index.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/customers/index.html.erb b/app/views/customers/index.html.erb index e0bba54..7f1b872 100644 --- a/app/views/customers/index.html.erb +++ b/app/views/customers/index.html.erb @@ -4,7 +4,7 @@ <%= text_field_tag :search, params[:search], placeholder: "Search Customers" %> <%= submit_tag "Search" %> <% end %> -<%= button_to "New Customer", new_customer_path, method: :get%> +<%= button_to("New Customer", new_customer_path, method: :get) if allowed_to?(:add_customers)%>
<% if @customers.present? %>
From 77c7f0b6fe8dc8a4e67a5cf3f4cebd7a173ff320 Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Tue, 4 Apr 2017 22:28:20 -0400 Subject: [PATCH 09/28] Update index.html.erb --- app/views/customers/index.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/customers/index.html.erb b/app/views/customers/index.html.erb index 7f1b872..8305fe6 100644 --- a/app/views/customers/index.html.erb +++ b/app/views/customers/index.html.erb @@ -4,7 +4,7 @@ <%= text_field_tag :search, params[:search], placeholder: "Search Customers" %> <%= submit_tag "Search" %> <% end %> -<%= button_to("New Customer", new_customer_path, method: :get) if allowed_to?(:add_customers)%> +<%= button_to("New Customer", new_customer_path, method: :get) if User.current.allowed_to?(:add_customers)%>
<% if @customers.present? %>
From 429fb920fbb29259023484d5469f3cdd83df3217 Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Tue, 4 Apr 2017 22:29:06 -0400 Subject: [PATCH 10/28] Update index.html.erb --- app/views/customers/index.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/customers/index.html.erb b/app/views/customers/index.html.erb index 8305fe6..e0bba54 100644 --- a/app/views/customers/index.html.erb +++ b/app/views/customers/index.html.erb @@ -4,7 +4,7 @@ <%= text_field_tag :search, params[:search], placeholder: "Search Customers" %> <%= submit_tag "Search" %> <% end %> -<%= button_to("New Customer", new_customer_path, method: :get) if User.current.allowed_to?(:add_customers)%> +<%= button_to "New Customer", new_customer_path, method: :get%>
<% if @customers.present? %>
From 4d524a7d61dd843c7106e7b223653c0757a2ca78 Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Tue, 6 Jun 2017 08:10:28 -0400 Subject: [PATCH 11/28] Update issues_form_hook_listener.rb --- lib/issues_form_hook_listener.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/issues_form_hook_listener.rb b/lib/issues_form_hook_listener.rb index 1c23784..5fa5d43 100644 --- a/lib/issues_form_hook_listener.rb +++ b/lib/issues_form_hook_listener.rb @@ -33,7 +33,7 @@ class IssuesFormHookListener < Redmine::Hook::ViewListener customer_id = f.hidden_field :customer_id, :id => "issue_customer_id" if context[:issue].customer - vehicles = customer.vehicles.pluck(:name, :id).sort! + vehicles = customer.vehicles.pluck(:name, :id).sort! if customer.vehicles estimates = customer.qbo_estimates.pluck(:doc_number, :id).sort! {|x, y| y <=> x} else vehicles = [nil].compact From 129e3d48210e895e73921ec135117099e91b849b Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Tue, 6 Jun 2017 08:12:08 -0400 Subject: [PATCH 12/28] Update issues_form_hook_listener.rb --- lib/issues_form_hook_listener.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/issues_form_hook_listener.rb b/lib/issues_form_hook_listener.rb index 5fa5d43..d211b16 100644 --- a/lib/issues_form_hook_listener.rb +++ b/lib/issues_form_hook_listener.rb @@ -33,7 +33,7 @@ class IssuesFormHookListener < Redmine::Hook::ViewListener customer_id = f.hidden_field :customer_id, :id => "issue_customer_id" if context[:issue].customer - vehicles = customer.vehicles.pluck(:name, :id).sort! if customer.vehicles + vehicles = customer.vehicles.pluck(:name, :id) estimates = customer.qbo_estimates.pluck(:doc_number, :id).sort! {|x, y| y <=> x} else vehicles = [nil].compact From 3ba5337812fc3574d2ebdd03b1e16d91e555578c Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Tue, 6 Jun 2017 08:22:50 -0400 Subject: [PATCH 13/28] Update vehicle.rb Updated regex to remove invalid chars --- app/models/vehicle.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/vehicle.rb b/app/models/vehicle.rb index 4e951a7..5a534c4 100644 --- a/app/models/vehicle.rb +++ b/app/models/vehicle.rb @@ -72,7 +72,7 @@ class Vehicle < ActiveRecord::Base # Force Upper Case for VIN numbers def vin=(val) # The to_s is in case you get nil/non-string - write_attribute(:vin, val.to_s.scan(/^[A-Za-z0-9]+$/).join.upcase) + write_attribute(:vin, val.to_s.gsub(/[^ABCDEFGHJKLMNPRSTUVWXYZabcdefghjklmnprstuvwxyz0123456789]/, '').join.upcase) end # search for a vin From 56793cee7caee619022fc06e7dba605f4f20f7b2 Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Tue, 6 Jun 2017 08:25:35 -0400 Subject: [PATCH 14/28] Update vehicle.rb --- app/models/vehicle.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/vehicle.rb b/app/models/vehicle.rb index 5a534c4..c0fe620 100644 --- a/app/models/vehicle.rb +++ b/app/models/vehicle.rb @@ -72,7 +72,7 @@ class Vehicle < ActiveRecord::Base # Force Upper Case for VIN numbers def vin=(val) # The to_s is in case you get nil/non-string - write_attribute(:vin, val.to_s.gsub(/[^ABCDEFGHJKLMNPRSTUVWXYZabcdefghjklmnprstuvwxyz0123456789]/, '').join.upcase) + write_attribute(:vin, val.to_s.gsub!(/[^ABCDEFGHJKLMNPRSTUVWXYZabcdefghjklmnprstuvwxyz0123456789]/, '').join.upcase) end # search for a vin From 625e400c4801ce0f32f9d567cf7d4d9ae808e538 Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Tue, 6 Jun 2017 08:27:55 -0400 Subject: [PATCH 15/28] Update vehicle.rb --- app/models/vehicle.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/models/vehicle.rb b/app/models/vehicle.rb index c0fe620..82539e8 100644 --- a/app/models/vehicle.rb +++ b/app/models/vehicle.rb @@ -71,8 +71,11 @@ class Vehicle < ActiveRecord::Base # Force Upper Case for VIN numbers def vin=(val) + + val = val.to_s.gsub!(/[^ABCDEFGHJKLMNPRSTUVWXYZabcdefghjklmnprstuvwxyz0123456789]/,'') + # The to_s is in case you get nil/non-string - write_attribute(:vin, val.to_s.gsub!(/[^ABCDEFGHJKLMNPRSTUVWXYZabcdefghjklmnprstuvwxyz0123456789]/, '').join.upcase) + write_attribute(:vin, val.join.upcase) end # search for a vin From 01cf82813c1b11f2b58e819485194a9569ea03a2 Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Tue, 6 Jun 2017 08:32:21 -0400 Subject: [PATCH 16/28] Update vehicle.rb --- app/models/vehicle.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/vehicle.rb b/app/models/vehicle.rb index 82539e8..64ee8c9 100644 --- a/app/models/vehicle.rb +++ b/app/models/vehicle.rb @@ -72,7 +72,7 @@ class Vehicle < ActiveRecord::Base # Force Upper Case for VIN numbers def vin=(val) - val = val.to_s.gsub!(/[^ABCDEFGHJKLMNPRSTUVWXYZabcdefghjklmnprstuvwxyz0123456789]/,'') + val = val.to_s.gsub!(/[^[A-HJ-NPR-Za-hj-npr-z\d]{8}]/,'') # The to_s is in case you get nil/non-string write_attribute(:vin, val.join.upcase) From a359e8815bb19ddbc32015025d698a57b03c3463 Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Tue, 6 Jun 2017 08:53:36 -0400 Subject: [PATCH 17/28] Update issues_form_hook_listener.rb --- lib/issues_form_hook_listener.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/issues_form_hook_listener.rb b/lib/issues_form_hook_listener.rb index d211b16..2772d29 100644 --- a/lib/issues_form_hook_listener.rb +++ b/lib/issues_form_hook_listener.rb @@ -33,7 +33,11 @@ class IssuesFormHookListener < Redmine::Hook::ViewListener customer_id = f.hidden_field :customer_id, :id => "issue_customer_id" if context[:issue].customer - vehicles = customer.vehicles.pluck(:name, :id) + if customer.vehicles + vehicles = customer.vehicles.pluck(:name, :id) + else + vehicles = [nil].compact + end estimates = customer.qbo_estimates.pluck(:doc_number, :id).sort! {|x, y| y <=> x} else vehicles = [nil].compact From 2b8c4b4d4da5a0dcca1ee8b5a85a9f3286547393 Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Tue, 6 Jun 2017 08:58:11 -0400 Subject: [PATCH 18/28] Update vehicle.rb --- app/models/vehicle.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/vehicle.rb b/app/models/vehicle.rb index 64ee8c9..ba5a05c 100644 --- a/app/models/vehicle.rb +++ b/app/models/vehicle.rb @@ -75,7 +75,7 @@ class Vehicle < ActiveRecord::Base val = val.to_s.gsub!(/[^[A-HJ-NPR-Za-hj-npr-z\d]{8}]/,'') # The to_s is in case you get nil/non-string - write_attribute(:vin, val.join.upcase) + write_attribute(:vin, val.upcase) end # search for a vin From 7ca3315ce59ed9452dd48b785f97845c91dcf9a3 Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Tue, 13 Jun 2017 11:44:46 -0400 Subject: [PATCH 19/28] Update vehicle.rb --- app/models/vehicle.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/vehicle.rb b/app/models/vehicle.rb index ba5a05c..d9aea8f 100644 --- a/app/models/vehicle.rb +++ b/app/models/vehicle.rb @@ -75,7 +75,7 @@ class Vehicle < ActiveRecord::Base val = val.to_s.gsub!(/[^[A-HJ-NPR-Za-hj-npr-z\d]{8}]/,'') # The to_s is in case you get nil/non-string - write_attribute(:vin, val.upcase) + write_attribute(:vin, val.to_s.upcase) end # search for a vin From 7ced1bf94271f06a86d72e002efc530860ef0176 Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Tue, 13 Jun 2017 12:22:48 -0400 Subject: [PATCH 20/28] Create vehicle.rb --- app/models/vehicle.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/vehicle.rb b/app/models/vehicle.rb index d9aea8f..5d651ab 100644 --- a/app/models/vehicle.rb +++ b/app/models/vehicle.rb @@ -72,7 +72,7 @@ class Vehicle < ActiveRecord::Base # Force Upper Case for VIN numbers def vin=(val) - val = val.to_s.gsub!(/[^[A-HJ-NPR-Za-hj-npr-z\d]{8}]/,'') + val = val.to_s.gsub!(/[A-HJ-NPR-Za-hj-npr-z\d]/,'') # The to_s is in case you get nil/non-string write_attribute(:vin, val.to_s.upcase) From 7044377f169c92e7563e3667891de4e2e802d310 Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Tue, 13 Jun 2017 12:27:22 -0400 Subject: [PATCH 21/28] Update vehicle.rb --- app/models/vehicle.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/vehicle.rb b/app/models/vehicle.rb index 5d651ab..2322d08 100644 --- a/app/models/vehicle.rb +++ b/app/models/vehicle.rb @@ -72,7 +72,7 @@ class Vehicle < ActiveRecord::Base # Force Upper Case for VIN numbers def vin=(val) - val = val.to_s.gsub!(/[A-HJ-NPR-Za-hj-npr-z\d]/,'') + val = val.to_s.gsub(/[A-HJ-NPR-Za-hj-npr-z\d]/,'') # The to_s is in case you get nil/non-string write_attribute(:vin, val.to_s.upcase) From e43635b5d86d2f87507bed5955d9117788e700bc Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Tue, 13 Jun 2017 12:31:07 -0400 Subject: [PATCH 22/28] Update vehicle.rb --- app/models/vehicle.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/vehicle.rb b/app/models/vehicle.rb index 2322d08..165886a 100644 --- a/app/models/vehicle.rb +++ b/app/models/vehicle.rb @@ -72,7 +72,7 @@ class Vehicle < ActiveRecord::Base # Force Upper Case for VIN numbers def vin=(val) - val = val.to_s.gsub(/[A-HJ-NPR-Za-hj-npr-z\d]/,'') + val = val.to_s.gsub(/(?![A-HJ-NPR-Za-hj-npr-z\d])/,'') # The to_s is in case you get nil/non-string write_attribute(:vin, val.to_s.upcase) From 4a3b663333458dd99aa6fe09de7012844c64a32e Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Tue, 13 Jun 2017 21:49:10 -0400 Subject: [PATCH 23/28] Create vehicle.rb --- app/models/vehicle.rb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/models/vehicle.rb b/app/models/vehicle.rb index 165886a..fc02632 100644 --- a/app/models/vehicle.rb +++ b/app/models/vehicle.rb @@ -71,11 +71,10 @@ class Vehicle < ActiveRecord::Base # Force Upper Case for VIN numbers def vin=(val) - - val = val.to_s.gsub(/(?![A-HJ-NPR-Za-hj-npr-z\d])/,'') - - # The to_s is in case you get nil/non-string - write_attribute(:vin, val.to_s.upcase) + return if val.nil? + #strip VIN of all illegal chars (for barcode scanner) + val.to_s.upcase.gsub(/[^A-HJ-NPR-Za-hj-npr-z\d]+/,"") + write_attribute(:vin, val) end # search for a vin From c5a20c9e7fdb94eee87d2ea6c9380ff9be53fec5 Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Tue, 13 Jun 2017 21:50:50 -0400 Subject: [PATCH 24/28] Create vehicle.rb --- app/models/vehicle.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/models/vehicle.rb b/app/models/vehicle.rb index fc02632..57ad623 100644 --- a/app/models/vehicle.rb +++ b/app/models/vehicle.rb @@ -71,7 +71,6 @@ class Vehicle < ActiveRecord::Base # Force Upper Case for VIN numbers def vin=(val) - return if val.nil? #strip VIN of all illegal chars (for barcode scanner) val.to_s.upcase.gsub(/[^A-HJ-NPR-Za-hj-npr-z\d]+/,"") write_attribute(:vin, val) From 8d2351d3f9faee23999f76f6277418246a11f7a9 Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Tue, 13 Jun 2017 21:51:36 -0400 Subject: [PATCH 25/28] Create vehicle.rb --- app/models/vehicle.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/vehicle.rb b/app/models/vehicle.rb index 57ad623..0bf4fb1 100644 --- a/app/models/vehicle.rb +++ b/app/models/vehicle.rb @@ -72,7 +72,7 @@ class Vehicle < ActiveRecord::Base # Force Upper Case for VIN numbers def vin=(val) #strip VIN of all illegal chars (for barcode scanner) - val.to_s.upcase.gsub(/[^A-HJ-NPR-Za-hj-npr-z\d]+/,"") + val = val.to_s.upcase.gsub(/[^A-HJ-NPR-Za-hj-npr-z\d]+/,"") write_attribute(:vin, val) end From 512f5ad7ba86c1a78b82ab003814ed4f22fec84e Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Tue, 13 Jun 2017 21:55:13 -0400 Subject: [PATCH 26/28] Create index.html.erb --- app/views/customers/index.html.erb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/customers/index.html.erb b/app/views/customers/index.html.erb index e0bba54..2470aa3 100644 --- a/app/views/customers/index.html.erb +++ b/app/views/customers/index.html.erb @@ -4,7 +4,8 @@ <%= text_field_tag :search, params[:search], placeholder: "Search Customers" %> <%= submit_tag "Search" %> <% end %> -<%= button_to "New Customer", new_customer_path, method: :get%> +<%= button_to "New Customer", new_customer_path, method: :get%> +<%= button_to "Sync", qbo_sync_path, method: :get%>
<% if @customers.present? %>
From eaf0a57e51ae4290298edbc922eceb699eb05103 Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Tue, 13 Jun 2017 21:58:42 -0400 Subject: [PATCH 27/28] Create qbo_controller.rb --- app/controllers/qbo_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/qbo_controller.rb b/app/controllers/qbo_controller.rb index 7046870..718fe55 100644 --- a/app/controllers/qbo_controller.rb +++ b/app/controllers/qbo_controller.rb @@ -144,6 +144,6 @@ class QboController < ApplicationController ActiveRecord::Base.connection.close end - redirect_to qbo_path(:redmine_qbo), :flash => { :notice => "Successfully synced to Quickbooks" } + redirect_to :back, :flash => { :notice => "Successfully synced to Quickbooks" } end end From 8b2d88f80bbcffee84bec2416ddb49ba6b9f9b45 Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Wed, 14 Jun 2017 09:43:52 -0400 Subject: [PATCH 28/28] Create qbo_controller.rb --- app/controllers/qbo_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/qbo_controller.rb b/app/controllers/qbo_controller.rb index 718fe55..7046870 100644 --- a/app/controllers/qbo_controller.rb +++ b/app/controllers/qbo_controller.rb @@ -144,6 +144,6 @@ class QboController < ApplicationController ActiveRecord::Base.connection.close end - redirect_to :back, :flash => { :notice => "Successfully synced to Quickbooks" } + redirect_to qbo_path(:redmine_qbo), :flash => { :notice => "Successfully synced to Quickbooks" } end end