mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2025-11-08 17:04:23 -05:00
Update issues_form_hook_listener.rb
Fixed conventions, Removed explicit non-nil checks
This commit is contained in:
@@ -13,23 +13,21 @@ class IssuesFormHookListener < Redmine::Hook::ViewListener
|
|||||||
# Edit Issue Form
|
# Edit Issue Form
|
||||||
# Show a dropdown for quickbooks contacts
|
# Show a dropdown for quickbooks contacts
|
||||||
def view_issues_form_details_bottom(context={})
|
def view_issues_form_details_bottom(context={})
|
||||||
selected = ""
|
# Update the customer and item database
|
||||||
|
|
||||||
QboCustomer.update_all
|
QboCustomer.update_all
|
||||||
QboItem.update_all
|
QboItem.update_all
|
||||||
|
|
||||||
# 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 not context[:issue].qbo_customer_id.nil?
|
if context[:issue].qbo_customer && context[:issue].qbo_item
|
||||||
selected_customer = context[:issue].qbo_customer_id
|
@selected_customer = context[:issue].qbo_customer.id
|
||||||
selected_item = context[:issue].qbo_item_id
|
@selected_item = context[:issue].qbo_item.id
|
||||||
end
|
end
|
||||||
|
|
||||||
# Generate the drop down list of quickbooks contacts
|
# Generate the drop down list of quickbooks contacts
|
||||||
select_customer = context[:form].select :qbo_customer_id, QboCustomer.all.pluck(:name, :id), :selected => selected_customer, include_blank: true
|
@select_customer = context[:form].select :qbo_customer_id, QboCustomer.all.pluck(:name, :id), :selected => @selected_customer, include_blank: true
|
||||||
|
|
||||||
# Generate the drop down list of quickbooks contacts
|
# Generate the drop down list of quickbooks contacts
|
||||||
select_item = context[:form].select :qbo_item_id, QboItem.all.pluck(:name, :id).reverse, :selected => selected_item, include_blank: true
|
@select_item = context[:form].select :qbo_item_id, QboItem.all.pluck(:name, :id).reverse, :selected => @selected_item, include_blank: true
|
||||||
return "<p>#{select_customer}</p> <p>#{select_item}</p>"
|
return "<p>#{@select_customer}</p> <p>#{@select_item}</p>"
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user