mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2025-12-29 14:11:00 -05:00
Fixed Estiamte & Invoice Link
Added Estimate Drop down Disabled Automatic Estimate Creation Added Controllers for Estimates & Invoices
This commit is contained in:
@@ -17,11 +17,13 @@ class IssuesFormHookListener < Redmine::Hook::ViewListener
|
||||
QboCustomer.update_all
|
||||
QboItem.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.id if context[:issue].qbo_customer
|
||||
@selected_item = context[:issue].qbo_item.id if context[:issue].qbo_item
|
||||
@selected_invoice = context[:issue].qbo_invoice.id if context[:issue].qbo_invoice
|
||||
@selected_estimate = context[:issue].qbo_estimate.id if context[:issue].qbo_estimate
|
||||
|
||||
# Generate the drop down list of quickbooks customers
|
||||
@select_customer = context[:form].select :qbo_customer_id, QboCustomer.all.pluck(:name, :id), :selected => @selected_customer, include_blank: true
|
||||
@@ -32,6 +34,10 @@ class IssuesFormHookListener < Redmine::Hook::ViewListener
|
||||
# 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
|
||||
|
||||
return "<p>#{@select_customer}</p> <p>#{@select_item}</p> <p>#{@select_invoice}</p>"
|
||||
# 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
|
||||
|
||||
|
||||
return "<p>#{@select_customer}</p> <p>#{@select_item}</p> <p>#{@select_invoice}</p> <p>#{@select_estimate}</p>"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -18,7 +18,7 @@ class IssuesSaveHookListener < Redmine::Hook::ViewListener
|
||||
if Qbo.first && issue.qbo_customer && issue.qbo_item
|
||||
|
||||
# if this is a quote, lets create a new estimate based off estimated hours
|
||||
if issue.tracker.name = "Quote" && issue.status.name = "New" && !issue.qbo_estimate
|
||||
if issue.tracker.name = "Quote" && issue.status.name = "New" && issue.qbo_estimate
|
||||
|
||||
# Get QBO Services
|
||||
item_service = QboItem.get_base.service
|
||||
@@ -46,8 +46,8 @@ class IssuesSaveHookListener < Redmine::Hook::ViewListener
|
||||
estimate.line_items << line_item
|
||||
|
||||
# Save the etimate to the issue
|
||||
issue.qbo_estimate_id = estimate_base.service.create(estimate).id
|
||||
issue.save!
|
||||
#issue.qbo_estimate_id = estimate_base.service.create(estimate).id
|
||||
#issue.save!
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -30,14 +30,14 @@ class IssuesShowHookListener < Redmine::Hook::ViewListener
|
||||
if issue.qbo_estimate
|
||||
QboEstimate.update(issue.qbo_estimate.id)
|
||||
@estimate = issue.qbo_estimate.doc_number
|
||||
@estimate_link = link_to @estimate, qbo_estimate_pdf_path(issue.qbo_estimate.id)
|
||||
@estimate_link = link_to @estimate, "#{Redmine::Utils::relative_url_root }/qbo/estimate/#{issue.qbo_estimate.id}", :target => "_blank"
|
||||
end
|
||||
|
||||
# Invoice Number
|
||||
if issue.qbo_invoice
|
||||
QboInvoice.update(issue.qbo_invoice.id)
|
||||
@invoice = issue.qbo_invoice.doc_number
|
||||
@invoice_link = link_to @invoice, qbo_invoice_pdf_path(issue.qbo_invoice.id)
|
||||
@invoice_link = link_to @invoice, "#{Redmine::Utils::relative_url_root }/qbo/invoice/#{issue.qbo_invoice.id}", :target => "_blank"
|
||||
end
|
||||
|
||||
return "<div class=\"attributes\">
|
||||
|
||||
Reference in New Issue
Block a user