From a75f1abd71af1638dd95c3b3a0ae28ce1aec80ce Mon Sep 17 00:00:00 2001 From: Ricky Barrette Date: Wed, 9 Mar 2022 22:53:03 -0500 Subject: [PATCH] Removed extra white spaces --- app/controllers/customers_controller.rb | 12 ++++++------ app/controllers/vehicles_controller.rb | 2 +- app/models/customer.rb | 12 ++++++------ app/models/estimate.rb | 10 +++++----- app/models/invoice.rb | 16 ++++++++-------- app/models/qbo.rb | 3 +-- app/models/vehicle.rb | 4 ++-- app/views/customers/_form.html.erb | 8 ++++---- app/views/customers/view.html.erb | 2 +- app/views/vehicles/_form.html.erb | 4 ++-- app/views/vehicles/_search.html.erb | 2 +- assets/javascripts/application.js | 6 +++--- db/migrate/035_drop_qbo_prefix.rb | 1 - lib/issue_patch.rb | 4 ++-- lib/issues_show_hook_listener.rb | 4 ++-- lib/pdf_patch.rb | 16 ++++++++-------- lib/project_patch.rb | 2 +- lib/projects_form_hook_listener.rb | 4 ++-- lib/user_patch.rb | 4 ++-- lib/view_hook_listener.rb | 2 +- 20 files changed, 58 insertions(+), 60 deletions(-) diff --git a/app/controllers/customers_controller.rb b/app/controllers/customers_controller.rb index 9bf05b0..810f231 100644 --- a/app/controllers/customers_controller.rb +++ b/app/controllers/customers_controller.rb @@ -27,8 +27,8 @@ class CustomersController < ApplicationController include SortHelper helper :timelog - before_action :add_customer, :only => :new - before_action :view_customer, :except => [:new, :view] + before_action :add_customer, :only => :new + before_action :view_customer, :except => [:new, :view] skip_before_action :verify_authenticity_token, :check_if_login_required, :only => [:view] default_search_scope :names @@ -162,9 +162,9 @@ class CustomersController < ApplicationController session[:token] = @token.token @issue = Issue.find @token.issue_id @journals = @issue.journals. - preload(:details). - preload(:user => :email_address). - reorder(:created_on, :id).to_a + preload(:details). + preload(:user => :email_address). + reorder(:created_on, :id).to_a @journals.each_with_index {|j,i| j.indice = i+1} @journals.reject!(&:private_notes?) unless User.current.allowed_to?(:view_private_notes, @issue.project) Journal.preload_journals_details_custom_fields(@journals) @@ -212,7 +212,7 @@ class CustomersController < ApplicationController # format a quickbooks address to a human readable string def address_to_s (address) return if address.nil? - string = address.line1 + string = address.line1 string << "\n" + address.line2 if address.line2 string << "\n" + address.line3 if address.line3 string << "\n" + address.line4 if address.line4 diff --git a/app/controllers/vehicles_controller.rb b/app/controllers/vehicles_controller.rb index eed7ff9..e353c8e 100644 --- a/app/controllers/vehicles_controller.rb +++ b/app/controllers/vehicles_controller.rb @@ -110,7 +110,7 @@ class VehiclesController < ApplicationController private - # checks to see if there is only one item in an array + # checks to see if there is only one item in an array # @return true if array only has one item def only_one_non_zero?( array ) found_non_zero = false diff --git a/app/models/customer.rb b/app/models/customer.rb index d39c60f..ce9ba02 100644 --- a/app/models/customer.rb +++ b/app/models/customer.rb @@ -116,21 +116,21 @@ class Customer < ActiveRecord::Base # Magic Method # Maps Get/Set methods to QBO customer object - def method_missing(sym, *arguments) + def method_missing(sym, *arguments) # Check to see if the method exists if Quickbooks::Model::Customer.method_defined?(sym) # download details if required pull unless @details method_name = sym.to_s # Setter - if method_name[-1, 1] == "=" - @details.method(method_name).call(arguments[0]) + if method_name[-1, 1] == "=" + @details.method(method_name).call(arguments[0]) # Getter - else + else return @details.method(method_name).call end - end - end + end + end # proforms a bruteforce sync operation # This needs to be simplified diff --git a/app/models/estimate.rb b/app/models/estimate.rb index c7e23dd..4d9bf82 100644 --- a/app/models/estimate.rb +++ b/app/models/estimate.rb @@ -69,20 +69,20 @@ class Estimate < ActiveRecord::Base # Magic Method # Maps Get/Set methods to QBO estimate object - def method_missing(sym, *arguments) + def method_missing(sym, *arguments) # Check to see if the method exists if Quickbooks::Model::Estimate.method_defined?(sym) # download details if required pull unless @details method_name = sym.to_s # Setter - if method_name[-1, 1] == "=" - @details.method(method_name).call(arguments[0]) + if method_name[-1, 1] == "=" + @details.method(method_name).call(arguments[0]) # Getter - else + else return @details.method(method_name).call end - end + end end private diff --git a/app/models/invoice.rb b/app/models/invoice.rb index fb9e2bd..1910dc4 100644 --- a/app/models/invoice.rb +++ b/app/models/invoice.rb @@ -26,7 +26,7 @@ class Invoice < ActiveRecord::Base last = Qbo.first.last_sync query = "SELECT Id, DocNumber FROM Invoice" - query << " WHERE Metadata.LastUpdatedTime >= '#{last.iso8601}' " if last + query << " WHERE Metadata.LastUpdatedTime >= '#{last.iso8601}' " if last # TODO actually do something with the above query # .all() is never called since count is never initialized @@ -81,7 +81,7 @@ class Invoice < ActiveRecord::Base invoice.txn_date = invoice.txn_date invoice.save! - # Scan the private notes for hashtags and attach to the applicable issues + # Scan the private notes for hashtags and attach to the applicable issues if not invoice.private_note.nil? invoice.private_note.scan(/#(\w+)/).flatten.each { |issue| attach_to_issue(Issue.find_by_id(issue.to_i), invoice) @@ -157,7 +157,7 @@ class Invoice < ActiveRecord::Base logger.debug "Trying to update invoice" get_base.update(invoice) if is_changed rescue - # Do nothing, probaly custome field sync confict on the invoice. + # Do nothing, probaly custome field sync confict on the invoice. # This is a problem with how it's billed # TODO Add notes in memo area # TODO flag Invoice.cf_sync_confict here @@ -167,20 +167,20 @@ class Invoice < ActiveRecord::Base # Magic Method # Maps Get/Set methods to QBO invoice object - def method_missing(sym, *arguments) + def method_missing(sym, *arguments) # Check to see if the method exists if Quickbooks::Model::Invoice.method_defined?(sym) # download details if required pull unless @details method_name = sym.to_s # Setter - if method_name[-1, 1] == "=" - @details.method(method_name).call(arguments[0]) + if method_name[-1, 1] == "=" + @details.method(method_name).call(arguments[0]) # Getter - else + else return @details.method(method_name).call end - end + end end # pull the details from quickbooks diff --git a/app/models/qbo.rb b/app/models/qbo.rb index 8156beb..09f3515 100644 --- a/app/models/qbo.rb +++ b/app/models/qbo.rb @@ -28,7 +28,6 @@ class Qbo < ActiveRecord::Base return OAuth2::Client.new(OAUTH_CONSUMER_KEY, OAUTH_CONSUMER_SECRET, oauth_params) end - # # Getter for oauth consumer # @@ -74,7 +73,7 @@ class Qbo < ActiveRecord::Base when :account return Quickbooks::Service::Account.new(:company_id => qbo.company_id, :access_token => access_token) when :employee - return Quickbooks::Service:: Employee.new(:company_id => qbo.company_id, :access_token => access_token) + return Quickbooks::Service::Employee.new(:company_id => qbo.company_id, :access_token => access_token) else return access_token end diff --git a/app/models/vehicle.rb b/app/models/vehicle.rb index 56104d2..bc99259 100644 --- a/app/models/vehicle.rb +++ b/app/models/vehicle.rb @@ -66,8 +66,8 @@ class Vehicle < ActiveRecord::Base if @details begin self.year = @details.year unless @details.year.nil? - self.make = @details.make unless @details.make.nil? - self.model = @details.model unless @details.model.nil? + self.make = @details.make unless @details.make.nil? + self.model = @details.model unless @details.model.nil? self.doors = @details.doors unless @details.doors.nil? self.trim = @details.trim unless @details.trim.nil? rescue Exception => e diff --git a/app/views/customers/_form.html.erb b/app/views/customers/_form.html.erb index 36dcc2e..56a69f2 100644 --- a/app/views/customers/_form.html.erb +++ b/app/views/customers/_form.html.erb @@ -7,28 +7,28 @@
<%=t(:label_display_name)%>
- <%= f.text_field :name, :required => true, :autocomplete => "off" %> + <%= f.text_field :name, :required => true, :autocomplete => "off" %>
<%=t(:label_primary_phone)%>
- <%= f.telephone_field :primary_phone, :autocomplete => "off" %> + <%= f.telephone_field :primary_phone, :autocomplete => "off" %>
<%=t(:label_mobile_phone)%>:
- <%= f.telephone_field :mobile_phone, :autocomplete => "off" %> + <%= f.telephone_field :mobile_phone, :autocomplete => "off" %>
<%=t(:label_email)%>:
- <%= f.email_field :email, :autocomplete => "off" %> + <%= f.email_field :email, :autocomplete => "off" %>
diff --git a/app/views/customers/view.html.erb b/app/views/customers/view.html.erb index cfcee03..e968bb6 100644 --- a/app/views/customers/view.html.erb +++ b/app/views/customers/view.html.erb @@ -5,7 +5,7 @@ <%= avatar(@issue.author, :size => "50") %>
-<%= render_issue_subject_with_tree(@issue) %> +<%= render_issue_subject_with_tree(@issue) %> <%=t(:label_customer_link_expires)%> <%= distance_of_time_in_words(Time.now, @token.expires_at) %>

diff --git a/app/views/vehicles/_form.html.erb b/app/views/vehicles/_form.html.erb index 4674d34..8e85442 100644 --- a/app/views/vehicles/_form.html.erb +++ b/app/views/vehicles/_form.html.erb @@ -4,8 +4,8 @@ <%= form_for @vehicle do |f| %>

- <%=t(:field_customer)%>: -
+ <%=t(:field_customer)%>: +
<%= f.autocomplete_field :customer, autocomplete_customer_name_customers_path, :value => @customer.name, :update_elements => {:id => '#customer_id', :value => '#issue_customer'}, :required => true %> <%= f.hidden_field :customer_id, :id => "customer_id", :value => @customer.id %>
diff --git a/app/views/vehicles/_search.html.erb b/app/views/vehicles/_search.html.erb index 7b5e151..ba79ae2 100644 --- a/app/views/vehicles/_search.html.erb +++ b/app/views/vehicles/_search.html.erb @@ -1,4 +1,4 @@ <%= form_tag(vehicles_path, :method => "get", id: "search-form") do %> - <%= text_field_tag :search, params[:search], placeholder: t(:label_search_vin), :autocomplete => "off" %> + <%= text_field_tag :search, params[:search], placeholder: t(:label_search_vin), :autocomplete => "off" %> <%= submit_tag t(:label_search) %> <% end %> diff --git a/assets/javascripts/application.js b/assets/javascripts/application.js index 9476a52..7c6b938 100644 --- a/assets/javascripts/application.js +++ b/assets/javascripts/application.js @@ -1,13 +1,13 @@ $(function() { $("input#issue_customer_id").on("change", function() { $.ajax({ - url: "/filter_vehicles_by_customer", + url: "/filter_vehicles_by_customer", type: "GET", data: { selected_customer: $("input#issue_customer_id").val() } }); $.ajax({ - url: "/filter_estimates_by_customer", + url: "/filter_estimates_by_customer", type: "GET", data: { selected_customer: $("input#issue_customer_id").val() } }); @@ -15,7 +15,7 @@ $(function() { $("input#project_customer_id").on("change", function() { $.ajax({ - url: "/filter_vehicles_by_customer", + url: "/filter_vehicles_by_customer", type: "GET", data: { selected_customer: $("input#project_customer_id").val() } }); diff --git a/db/migrate/035_drop_qbo_prefix.rb b/db/migrate/035_drop_qbo_prefix.rb index 0d2f3a8..8fe7adb 100644 --- a/db/migrate/035_drop_qbo_prefix.rb +++ b/db/migrate/035_drop_qbo_prefix.rb @@ -18,6 +18,5 @@ class DropQboPrefix < ActiveRecord::Migration[5.1] rename_column :issues, :qbo_estimate_id, :estimate_id rename_column :users, :qbo_employee_id, :employee_id rename_column :invoices_issues, :qbo_invoice_id, :invoice_id - end end diff --git a/lib/issue_patch.rb b/lib/issue_patch.rb index 6b29172..8e4c75b 100644 --- a/lib/issue_patch.rb +++ b/lib/issue_patch.rb @@ -10,7 +10,7 @@ require_dependency 'issue' -# Patches Redmine's Issues dynamically. +# Patches Redmine's Issues dynamically. # Adds a relationships module IssuePatch @@ -102,7 +102,7 @@ module IssuePatch CustomerToken.create(:expires_at => Time.now + 1.month, :issue_id => id) end -end +end # Add module to Issue Issue.send(:include, IssuePatch) diff --git a/lib/issues_show_hook_listener.rb b/lib/issues_show_hook_listener.rb index e494625..54ab6f3 100644 --- a/lib/issues_show_hook_listener.rb +++ b/lib/issues_show_hook_listener.rb @@ -17,12 +17,12 @@ class IssuesShowHookListener < Redmine::Hook::ViewListener # Check to see if there is a quickbooks user attached to the issue if issue.customer - customer = link_to issue.customer.name, customer_path( issue.customer.id ) + customer = link_to issue.customer.name, customer_path( issue.customer.id ) end # Estimate Number if issue.estimate - estimate = issue.estimate.doc_number + estimate = issue.estimate.doc_number estimate_link = link_to estimate, estimate_path( issue.estimate.id ), :target => "_blank" end diff --git a/lib/pdf_patch.rb b/lib/pdf_patch.rb index a5796ee..ed659b0 100644 --- a/lib/pdf_patch.rb +++ b/lib/pdf_patch.rb @@ -89,14 +89,14 @@ module IssuesPdfHelperPatch if pdf.get_rtl border_first_top = 'RT' - border_last_top = 'LT' + border_last_top = 'LT' border_first = 'R' - border_last = 'L' + border_last = 'L' else border_first_top = 'LT' - border_last_top = 'RT' + border_last_top = 'RT' border_first = 'L' - border_last = 'R' + border_last = 'R' end rows = left.size > right.size ? left.size : right.size @@ -109,9 +109,9 @@ module IssuesPdfHelperPatch heights << pdf.get_string_height(35, item ? "#{item.first}:" : "") pdf.SetFontStyle('',9) item = left[i] - heights << pdf.get_string_height(60, item ? item.last.to_s : "") + heights << pdf.get_string_height(60, item ? item.last.to_s : "") item = right[i] - heights << pdf.get_string_height(60, item ? item.last.to_s : "") + heights << pdf.get_string_height(60, item ? item.last.to_s : "") height = heights.max item = left[i] @@ -122,7 +122,7 @@ module IssuesPdfHelperPatch item = right[i] pdf.SetFontStyle('B',9) - pdf.RDMMultiCell(35, height, item ? "#{item.first}:" : "", (i == 0 ? border_first_top : border_first), '', 0, 0) + pdf.RDMMultiCell(35, height, item ? "#{item.first}:" : "", (i == 0 ? border_first_top : border_first), '', 0, 0) pdf.SetFontStyle('',9) pdf.RDMMultiCell(60, height, item ? item.last.to_s : "", (i == 0 ? border_last_top : border_last), '', 0, 2) @@ -195,7 +195,7 @@ module IssuesPdfHelperPatch pdf.ln for changeset in issue.changesets pdf.SetFontStyle('B',8) - csstr = "#{l(:label_revision)} #{changeset.format_identifier} - " + csstr = "#{l(:label_revision)} #{changeset.format_identifier} - " csstr += format_time(changeset.committed_on) + " - " + changeset.author.to_s pdf.RDMCell(190, 5, csstr) pdf.ln diff --git a/lib/project_patch.rb b/lib/project_patch.rb index 20c3809..907031c 100644 --- a/lib/project_patch.rb +++ b/lib/project_patch.rb @@ -10,7 +10,7 @@ require_dependency 'project' -# Patches Redmine's Projects dynamically. +# Patches Redmine's Projects dynamically. # Adds a relationships module ProjectPatch diff --git a/lib/projects_form_hook_listener.rb b/lib/projects_form_hook_listener.rb index a15469a..ef04179 100644 --- a/lib/projects_form_hook_listener.rb +++ b/lib/projects_form_hook_listener.rb @@ -15,11 +15,11 @@ class ProjectsFormHookListener < Redmine::Hook::ViewListener f = context[:form] # Check to see if there is a quickbooks user attached to the issue - selected_customer = context[:project].customer ? context[:project].customer : nil + selected_customer = context[:project].customer ? context[:project].customer : nil selected_vehicle = context[:project].vehicle_id ? context[:project].vehicle_id : nil # Load customer information - customer = Customer.find_by_id(selected_customer) if selected_customer + customer = Customer.find_by_id(selected_customer) if selected_customer search_customer = f.autocomplete_field :customer, autocomplete_customer_name_customers_path, :selected => selected_customer, :update_elements => {:id => '#project_customer_id', :value => '#project_customer'} customer_id = f.hidden_field :customer_id, :id => "project_customer_id" diff --git a/lib/user_patch.rb b/lib/user_patch.rb index bcec6a0..3a6e494 100644 --- a/lib/user_patch.rb +++ b/lib/user_patch.rb @@ -10,7 +10,7 @@ require_dependency 'user' -# Patches Redmine's User dynamically. +# Patches Redmine's User dynamically. # Adds a relationships module UserPatch def self.included(base) # :nodoc: @@ -33,7 +33,7 @@ module UserPatch end -end +end # Add module to Issue User.send(:include, UserPatch) diff --git a/lib/view_hook_listener.rb b/lib/view_hook_listener.rb index 45625ef..f7cb0fe 100644 --- a/lib/view_hook_listener.rb +++ b/lib/view_hook_listener.rb @@ -11,5 +11,5 @@ class ViewHookListener < Redmine::Hook::ViewListener render_on :view_layouts_base_sidebar, :partial => "qbo/sidebar" - + end