Removed extra white spaces

This commit is contained in:
2022-03-09 22:53:03 -05:00
parent 09c497ff96
commit a75f1abd71
20 changed files with 58 additions and 60 deletions

View File

@@ -27,8 +27,8 @@ class CustomersController < ApplicationController
include SortHelper include SortHelper
helper :timelog helper :timelog
before_action :add_customer, :only => :new before_action :add_customer, :only => :new
before_action :view_customer, :except => [:new, :view] before_action :view_customer, :except => [:new, :view]
skip_before_action :verify_authenticity_token, :check_if_login_required, :only => [:view] skip_before_action :verify_authenticity_token, :check_if_login_required, :only => [:view]
default_search_scope :names default_search_scope :names
@@ -162,9 +162,9 @@ class CustomersController < ApplicationController
session[:token] = @token.token session[:token] = @token.token
@issue = Issue.find @token.issue_id @issue = Issue.find @token.issue_id
@journals = @issue.journals. @journals = @issue.journals.
preload(:details). preload(:details).
preload(:user => :email_address). preload(:user => :email_address).
reorder(:created_on, :id).to_a reorder(:created_on, :id).to_a
@journals.each_with_index {|j,i| j.indice = i+1} @journals.each_with_index {|j,i| j.indice = i+1}
@journals.reject!(&:private_notes?) unless User.current.allowed_to?(:view_private_notes, @issue.project) @journals.reject!(&:private_notes?) unless User.current.allowed_to?(:view_private_notes, @issue.project)
Journal.preload_journals_details_custom_fields(@journals) Journal.preload_journals_details_custom_fields(@journals)
@@ -212,7 +212,7 @@ class CustomersController < ApplicationController
# format a quickbooks address to a human readable string # format a quickbooks address to a human readable string
def address_to_s (address) def address_to_s (address)
return if address.nil? return if address.nil?
string = address.line1 string = address.line1
string << "\n" + address.line2 if address.line2 string << "\n" + address.line2 if address.line2
string << "\n" + address.line3 if address.line3 string << "\n" + address.line3 if address.line3
string << "\n" + address.line4 if address.line4 string << "\n" + address.line4 if address.line4

View File

@@ -110,7 +110,7 @@ class VehiclesController < ApplicationController
private 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 # @return true if array only has one item
def only_one_non_zero?( array ) def only_one_non_zero?( array )
found_non_zero = false found_non_zero = false

View File

@@ -26,7 +26,7 @@ class Invoice < ActiveRecord::Base
last = Qbo.first.last_sync last = Qbo.first.last_sync
query = "SELECT Id, DocNumber FROM Invoice" 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 # TODO actually do something with the above query
# .all() is never called since count is never initialized # .all() is never called since count is never initialized
@@ -81,7 +81,7 @@ class Invoice < ActiveRecord::Base
invoice.txn_date = invoice.txn_date invoice.txn_date = invoice.txn_date
invoice.save! 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? if not invoice.private_note.nil?
invoice.private_note.scan(/#(\w+)/).flatten.each { |issue| invoice.private_note.scan(/#(\w+)/).flatten.each { |issue|
attach_to_issue(Issue.find_by_id(issue.to_i), invoice) 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" logger.debug "Trying to update invoice"
get_base.update(invoice) if is_changed get_base.update(invoice) if is_changed
rescue 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 # This is a problem with how it's billed
# TODO Add notes in memo area # TODO Add notes in memo area
# TODO flag Invoice.cf_sync_confict here # TODO flag Invoice.cf_sync_confict here

View File

@@ -28,7 +28,6 @@ class Qbo < ActiveRecord::Base
return OAuth2::Client.new(OAUTH_CONSUMER_KEY, OAUTH_CONSUMER_SECRET, oauth_params) return OAuth2::Client.new(OAUTH_CONSUMER_KEY, OAUTH_CONSUMER_SECRET, oauth_params)
end end
# #
# Getter for oauth consumer # Getter for oauth consumer
# #
@@ -74,7 +73,7 @@ class Qbo < ActiveRecord::Base
when :account when :account
return Quickbooks::Service::Account.new(:company_id => qbo.company_id, :access_token => access_token) return Quickbooks::Service::Account.new(:company_id => qbo.company_id, :access_token => access_token)
when :employee 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 else
return access_token return access_token
end end

View File

@@ -66,8 +66,8 @@ class Vehicle < ActiveRecord::Base
if @details if @details
begin begin
self.year = @details.year unless @details.year.nil? self.year = @details.year unless @details.year.nil?
self.make = @details.make unless @details.make.nil? self.make = @details.make unless @details.make.nil?
self.model = @details.model unless @details.model.nil? self.model = @details.model unless @details.model.nil?
self.doors = @details.doors unless @details.doors.nil? self.doors = @details.doors unless @details.doors.nil?
self.trim = @details.trim unless @details.trim.nil? self.trim = @details.trim unless @details.trim.nil?
rescue Exception => e rescue Exception => e

View File

@@ -7,28 +7,28 @@
<div class="clearfix"> <div class="clearfix">
<%=t(:label_display_name)%> <%=t(:label_display_name)%>
<div class="input"> <div class="input">
<%= f.text_field :name, :required => true, :autocomplete => "off" %> <%= f.text_field :name, :required => true, :autocomplete => "off" %>
</div> </div>
</div> </div>
<div class="clearfix"> <div class="clearfix">
<%=t(:label_primary_phone)%> <%=t(:label_primary_phone)%>
<div class="input"> <div class="input">
<%= f.telephone_field :primary_phone, :autocomplete => "off" %> <%= f.telephone_field :primary_phone, :autocomplete => "off" %>
</div> </div>
</div> </div>
<div class="clearfix"> <div class="clearfix">
<%=t(:label_mobile_phone)%>: <%=t(:label_mobile_phone)%>:
<div class="input"> <div class="input">
<%= f.telephone_field :mobile_phone, :autocomplete => "off" %> <%= f.telephone_field :mobile_phone, :autocomplete => "off" %>
</div> </div>
</div> </div>
<div class="clearfix"> <div class="clearfix">
<%=t(:label_email)%>: <%=t(:label_email)%>:
<div class="input"> <div class="input">
<%= f.email_field :email, :autocomplete => "off" %> <%= f.email_field :email, :autocomplete => "off" %>
</div> </div>
</div> </div>

View File

@@ -5,7 +5,7 @@
<%= avatar(@issue.author, :size => "50") %> <%= avatar(@issue.author, :size => "50") %>
<div class="subject"> <div class="subject">
<%= 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) %> <%=t(:label_customer_link_expires)%> <%= distance_of_time_in_words(Time.now, @token.expires_at) %>
</div> </div>
<p class="author"> <p class="author">

View File

@@ -4,8 +4,8 @@
<%= form_for @vehicle do |f| %> <%= form_for @vehicle do |f| %>
<div class="clearfix"> <div class="clearfix">
<%=t(:field_customer)%>: <%=t(:field_customer)%>:
<div class="input"> <div class="input">
<%= f.autocomplete_field :customer, autocomplete_customer_name_customers_path, :value => @customer.name, :update_elements => {:id => '#customer_id', :value => '#issue_customer'}, :required => true %> <%= 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 %> <%= f.hidden_field :customer_id, :id => "customer_id", :value => @customer.id %>
</div> </div>

View File

@@ -1,4 +1,4 @@
<%= form_tag(vehicles_path, :method => "get", id: "search-form") do %> <%= 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) %> <%= submit_tag t(:label_search) %>
<% end %> <% end %>

View File

@@ -1,13 +1,13 @@
$(function() { $(function() {
$("input#issue_customer_id").on("change", function() { $("input#issue_customer_id").on("change", function() {
$.ajax({ $.ajax({
url: "/filter_vehicles_by_customer", url: "/filter_vehicles_by_customer",
type: "GET", type: "GET",
data: { selected_customer: $("input#issue_customer_id").val() } data: { selected_customer: $("input#issue_customer_id").val() }
}); });
$.ajax({ $.ajax({
url: "/filter_estimates_by_customer", url: "/filter_estimates_by_customer",
type: "GET", type: "GET",
data: { selected_customer: $("input#issue_customer_id").val() } data: { selected_customer: $("input#issue_customer_id").val() }
}); });
@@ -15,7 +15,7 @@ $(function() {
$("input#project_customer_id").on("change", function() { $("input#project_customer_id").on("change", function() {
$.ajax({ $.ajax({
url: "/filter_vehicles_by_customer", url: "/filter_vehicles_by_customer",
type: "GET", type: "GET",
data: { selected_customer: $("input#project_customer_id").val() } data: { selected_customer: $("input#project_customer_id").val() }
}); });

View File

@@ -18,6 +18,5 @@ class DropQboPrefix < ActiveRecord::Migration[5.1]
rename_column :issues, :qbo_estimate_id, :estimate_id rename_column :issues, :qbo_estimate_id, :estimate_id
rename_column :users, :qbo_employee_id, :employee_id rename_column :users, :qbo_employee_id, :employee_id
rename_column :invoices_issues, :qbo_invoice_id, :invoice_id rename_column :invoices_issues, :qbo_invoice_id, :invoice_id
end end
end end

View File

@@ -17,12 +17,12 @@ class IssuesShowHookListener < Redmine::Hook::ViewListener
# Check to see if there is a quickbooks user attached to the issue # Check to see if there is a quickbooks user attached to the issue
if issue.customer 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 end
# Estimate Number # Estimate Number
if issue.estimate 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" estimate_link = link_to estimate, estimate_path( issue.estimate.id ), :target => "_blank"
end end

View File

@@ -89,14 +89,14 @@ module IssuesPdfHelperPatch
if pdf.get_rtl if pdf.get_rtl
border_first_top = 'RT' border_first_top = 'RT'
border_last_top = 'LT' border_last_top = 'LT'
border_first = 'R' border_first = 'R'
border_last = 'L' border_last = 'L'
else else
border_first_top = 'LT' border_first_top = 'LT'
border_last_top = 'RT' border_last_top = 'RT'
border_first = 'L' border_first = 'L'
border_last = 'R' border_last = 'R'
end end
rows = left.size > right.size ? left.size : right.size rows = left.size > right.size ? left.size : right.size
@@ -109,9 +109,9 @@ module IssuesPdfHelperPatch
heights << pdf.get_string_height(35, item ? "#{item.first}:" : "") heights << pdf.get_string_height(35, item ? "#{item.first}:" : "")
pdf.SetFontStyle('',9) pdf.SetFontStyle('',9)
item = left[i] 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] 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 height = heights.max
item = left[i] item = left[i]
@@ -122,7 +122,7 @@ module IssuesPdfHelperPatch
item = right[i] item = right[i]
pdf.SetFontStyle('B',9) 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.SetFontStyle('',9)
pdf.RDMMultiCell(60, height, item ? item.last.to_s : "", (i == 0 ? border_last_top : border_last), '', 0, 2) 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 pdf.ln
for changeset in issue.changesets for changeset in issue.changesets
pdf.SetFontStyle('B',8) 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 csstr += format_time(changeset.committed_on) + " - " + changeset.author.to_s
pdf.RDMCell(190, 5, csstr) pdf.RDMCell(190, 5, csstr)
pdf.ln pdf.ln

View File

@@ -15,7 +15,7 @@ class ProjectsFormHookListener < Redmine::Hook::ViewListener
f = context[:form] f = context[:form]
# Check to see if there is a quickbooks user attached to the issue # 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 selected_vehicle = context[:project].vehicle_id ? context[:project].vehicle_id : nil
# Load customer information # Load customer information