Update issues_form_hook_listener.rb

This commit is contained in:
2016-05-12 09:50:43 -04:00
parent 9d5d6d6c26
commit f19daef1d7

View File

@@ -21,9 +21,7 @@ class IssuesFormHookListener < Redmine::Hook::ViewListener
selected_invoice = context[:issue].qbo_invoice ? context[:issue].qbo_invoice.id : nil
selected_estimate = context[:issue].qbo_estimate ? context[:issue].qbo_estimate.id : nil
vehicle = context[:issue].vehicles_id
# Generate the drop down list of quickbooks customers
# Load customer information without callbacks
Customer.without_callback(:initialize, :after, :pull) do
@@customer = Customer.find_by_id(@@selected_customer) if @@selected_customer
@@select_customer = f.select :customer_id, Customer.all.pluck(:name, :id).sort, :selected => @@selected_customer, include_blank: true
@@ -38,10 +36,7 @@ class IssuesFormHookListener < Redmine::Hook::ViewListener
# Generate the drop down list of quickbooks extimates
select_estimate = f.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
#render_on :view_issues_form_details_bottom, :partial => 'hooks/redmine_qbo/vehicles/dropdown'
vehicles = @@customer.vehicles.pluck(:name, :id).sort! if @@selected_customer
vehicles = @@customer.vehicles.pluck(:name, :id).sort! if @@customer
vehicles = Vehicle.all.order(:name) if not vehicles
vehicle = f.select :vehicles_id, vehicles, include_blank: true, :selected => vehicle