mirror of
https://github.com/rickbarrette/redmine_qbo_vehicles.git
synced 2026-11-18 02:40:37 -05:00
Own the QuickBooks VIN and Mileage fields
redmine_qbo now handles QuickBooks custom fields generically; this plugin claims the fields named like VIN and Mileage (Vehicles::QboFields) and supplies their behaviour: - qbo_billing_issue_values keyed by field id; qbo_billing_field_options (the customer's vehicles for the VIN box) and qbo_billing_field_defaults (the work orders' VIN and highest mileage) replace the VIN hooks. - Editor script (view_qbo_estimate_form_bottom): VINs in capitals; importing time or estimates fills the VIN from the work orders' vehicle (or an estimate's own VIN), warns about several vehicles, and fills the highest mileage. The several-vehicle and missing-VIN-field texts moved here. - qbo_calendar_appointment_params: an appointment added from an estimate gets the vehicle with its VIN. - The estimate's VIN is read through redmine_qbo's generic custom_field_value. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
This commit is contained in:
7 files changed
+150
-19
No files matched your search
@@ -18,7 +18,7 @@ module Vehicles
|
||||
# estimate's details leave them out, so a VIN field added recently in QuickBooks would never match.
|
||||
def vin(estimate)
|
||||
return nil unless estimate
|
||||
RedmineQboBilling::EstimateWriter.vin_for(estimate.id)
|
||||
QboFields.estimate_vin(estimate.id)
|
||||
rescue StandardError
|
||||
nil
|
||||
end
|
||||
@@ -35,5 +35,12 @@ module Vehicles
|
||||
|
||||
vehicles(estimate).detect { |v| v.vin.to_s.strip.casecmp?(estimate_vin) }
|
||||
end
|
||||
|
||||
# A customer's vehicle with the given VIN, or nil
|
||||
def for_vin(customer, vin)
|
||||
return nil if vin.blank? || !customer.respond_to?(:vehicles)
|
||||
|
||||
customer.vehicles.detect { |v| v.vin.to_s.strip.casecmp?(vin.to_s.strip) }
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user