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:
Claude committed 2026-10-31 09:12:52 -04:00
1 parent 3304fce92f
commit 06a78ebccb
11 files changed
+78 -115

No files matched your search

+3 -3
View File
@@ -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