Removed @ from variables

This commit is contained in:
2016-04-09 21:53:38 -04:00
parent dc1edaa651
commit c254c78ee5
2 changed files with 21 additions and 25 deletions

View File

@@ -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 "<p>#{@select_customer}</p> <p>#{@select_item}</p> <p>#{@select_invoice}</p> <p>#{@select_estimate} #{@estimates_link}</p>"
return "<p>#{select_customer}</p> <p>#{select_item}</p> <p>#{select_invoice}</p> <p>#{select_estimate}</p>"
end
end

View File

@@ -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 "<div class=\"attributes\">
<div class=\"qbo_customer_id attribute\">
<div class=\"label\"><span>Customer</span>:</div>
<div class=\"value\">#{@customer}</div>
<div class=\"value\">#{customer}</div>
</div>
<div class=\"qbo_item_id attribute\">
<div class=\"label\"><span>Item</span>:</div>
<div class=\"value\">#{@item}</div>
<div class=\"value\">#{item}</div>
</div>
<div class=\"qbo_estimate_id attribute\">
<div class=\"label\"><span>Estimate</span>:</div>
<div class=\"value\">#{@estimate_link}</div>
<div class=\"value\">#{estimate_link}</div>
</div>
<div class=\"qbo_invoice_id attribute\">
<div class=\"label\"><span>Invoice</span>:</div>
<div class=\"value\">#{@invoice_link}</div>
<div class=\"value\">#{invoice_link}</div>
</div>
</div>"
end