mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2026-11-17 18:20:36 -05:00
Move vehicle code out to redmine_qbo_vehicles
- IssueMileageListener removed: redmine_qbo_vehicles answers qbo_billing_issue_values with mileage. - New hook qbo_billing_build_issue sets plugins' fields on issues created from an estimate; the vehicle lookup by VIN moved to redmine_qbo_vehicles. - New hook qbo_billing_vin_options gives the VIN box's suggestions (RedmineQboBilling.vin_options) instead of reading customer.vehicles. - The customer page's New issue link script is generic: any checkbox with data-new-issue-param="issue[field]" fills that field. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
This commit is contained in:
11 files changed
+78
-115
No files matched your search
@@ -106,18 +106,18 @@ class QboEstimatesController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
# Customer details for the editor when a customer is picked: email, billing address and vehicles (VINs)
|
||||
# Customer details for the editor when a customer is picked: email, billing address and the VINs plugins
|
||||
# suggest for the VIN box (RedmineQboBilling.vin_options)
|
||||
def customer_info
|
||||
customer = Customer.find_by(id: params[:customer_id])
|
||||
return render(json: {}, status: :not_found) unless customer
|
||||
|
||||
vehicles = customer.respond_to?(:vehicles) ? customer.vehicles.to_a : []
|
||||
render json: {
|
||||
id: customer.id,
|
||||
name: customer.name,
|
||||
email: RedmineQboBilling::EstimateWriter.customer_email(customer),
|
||||
billing_address: RedmineQboBilling::EstimateWriter.customer_address(customer),
|
||||
vehicles: vehicles.select { |v| v.vin.present? }.map { |v| { vin: v.vin, name: v.to_s } }
|
||||
vin_options: RedmineQboBilling.vin_options(customer)
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
Reference in new issue
Block a user