From c254c78ee56828491826a08ed000e04ce7c15556 Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Sat, 9 Apr 2016 21:53:38 -0400 Subject: [PATCH] Removed @ from variables --- lib/issues_form_hook_listener.rb | 22 +++++++++++----------- lib/issues_show_hook_listener.rb | 24 ++++++++++-------------- 2 files changed, 21 insertions(+), 25 deletions(-) diff --git a/lib/issues_form_hook_listener.rb b/lib/issues_form_hook_listener.rb index 044dc05..ae134d3 100644 --- a/lib/issues_form_hook_listener.rb +++ b/lib/issues_form_hook_listener.rb @@ -14,31 +14,31 @@ class IssuesFormHookListener < Redmine::Hook::ViewListener # Show a dropdown for quickbooks contacts def view_issues_form_details_bottom(context={}) # Update the customer and item database - #QboCustomer.update_all + QboCustomer.update_all #QboItem.update_all - #QboInvoice.update_all + QboInvoice.update_all #QboEstimate.update_all # Check to see if there is a quickbooks user attached to the issue - @selected_customer = context[:issue].qbo_customer ? context[:issue].qbo_customer.id : nil - @selected_item = context[:issue].qbo_item ? context[:issue].qbo_item.id : nil - @selected_invoice = context[:issue].qbo_invoice ? context[:issue].qbo_invoice.id : nil - @selected_estimate = context[:issue].qbo_estimate ? context[:issue].qbo_estimate.id : nil + selected_customer = context[:issue].qbo_customer ? context[:issue].qbo_customer.id : nil + selected_item = context[:issue].qbo_item ? context[:issue].qbo_item.id : nil + selected_invoice = context[:issue].qbo_invoice ? context[:issue].qbo_invoice.id : nil + selected_estimate = context[:issue].qbo_estimate ? context[:issue].qbo_estimate.id : nil # Generate the drop down list of quickbooks customers - @select_customer = context[:form].select :qbo_customer_id, QboCustomer.all.pluck(:name, :id).sort, :selected => @selected_customer, include_blank: true + select_customer = context[:form].select :qbo_customer_id, QboCustomer.all.pluck(:name, :id).sort, :selected => selected_customer, include_blank: true # Generate the drop down list of quickbooks items - @select_item = context[:form].select :qbo_item_id, QboItem.all.pluck(:name, :id).sort, :selected => @selected_item, include_blank: true + select_item = context[:form].select :qbo_item_id, QboItem.all.pluck(:name, :id).sort, :selected => selected_item, include_blank: true # Generate the drop down list of quickbooks invoices - @select_invoice = context[:form].select :qbo_invoice_id, QboInvoice.all.pluck(:doc_number, :id).sort! {|x, y| y <=> x}, :selected => @selected_invoice, include_blank: true + select_invoice = context[:form].select :qbo_invoice_id, QboInvoice.all.pluck(:doc_number, :id).sort! {|x, y| y <=> x}, :selected => selected_invoice, include_blank: true # Generate the drop down list of quickbooks extimates - @select_estimate = context[:form].select :qbo_estimate_id, QboEstimate.all.pluck(:doc_number, :id).sort! {|x, y| y <=> x}, :selected => @selected_estimate, include_blank: true + select_estimate = context[:form].select :qbo_estimate_id, QboEstimate.all.pluck(:doc_number, :id).sort! {|x, y| y <=> x}, :selected => selected_estimate, include_blank: true #@estimates_link = link_to qbo_update_estimates_path - return "

#{@select_customer}

#{@select_item}

#{@select_invoice}

#{@select_estimate} #{@estimates_link}

" + return "

#{select_customer}

#{select_item}

#{select_invoice}

#{select_estimate}

" end end diff --git a/lib/issues_show_hook_listener.rb b/lib/issues_show_hook_listener.rb index bdba610..123ba55 100644 --- a/lib/issues_show_hook_listener.rb +++ b/lib/issues_show_hook_listener.rb @@ -21,46 +21,42 @@ class IssuesShowHookListener < Redmine::Hook::ViewListener issue = context[:issue] # Check to see if there is a quickbooks user attached to the issue - @customer = issue.qbo_customer ? issue.qbo_customer.name : nil + customer = issue.qbo_customer ? issue.qbo_customer.name : nil # Check to see if there is a quickbooks item attached to the issue - @item = issue.qbo_item ? issue.qbo_item.name : nil + item = issue.qbo_item ? issue.qbo_item.name : nil - @estimate = nil - @estimate_link = nil # Estimate Number if issue.qbo_estimate - @estimate = issue.qbo_estimate.doc_number - @estimate_link = link_to @estimate, "#{Redmine::Utils::relative_url_root }/qbo/estimate/#{issue.qbo_estimate.id}", :target => "_blank" + estimate = issue.qbo_estimate.doc_number + estimate_link = link_to estimate, "#{Redmine::Utils::relative_url_root }/qbo/estimate/#{issue.qbo_estimate.id}", :target => "_blank" end - @invoice = nil - @invo = nil # Invoice Number if issue.qbo_invoice - @invoice = issue.qbo_invoice.doc_number - @invoice_link = link_to @invoice, "#{Redmine::Utils::relative_url_root }/qbo/invoice/#{issue.qbo_invoice.id}", :target => "_blank" + invoice = issue.qbo_invoice.doc_number + invoice_link = link_to invoice, "#{Redmine::Utils::relative_url_root }/qbo/invoice/#{issue.qbo_invoice.id}", :target => "_blank" end return "
Customer:
-
#{@customer}
+
#{customer}
Item:
-
#{@item}
+
#{item}
Estimate:
-
#{@estimate_link}
+
#{estimate_link}
Invoice:
-
#{@invoice_link}
+
#{invoice_link}
" end