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

+7 -5
View File
@@ -283,12 +283,14 @@ $(function () {
loadedEmail = info.email || '';
$('#qbo-estimate-address').text(info.billing_address || '');
// VINs plugins suggest for this customer (e.g. their vehicles); one fills an empty VIN box
var options = info.vin_options || [];
var $list = $('#qbo-estimate-vins').empty();
(info.vehicles || []).forEach(function (vehicle) {
$('<option>').attr('value', vehicle.vin).text(vehicle.name).appendTo($list);
options.forEach(function (option) {
$('<option>').attr('value', option.vin).text(option.name).appendTo($list);
});
if ($vin.length && !$vin.prop('disabled') && !$vin.val().trim() && (info.vehicles || []).length === 1) {
$vin.val(info.vehicles[0].vin);
if ($vin.length && !$vin.prop('disabled') && !$vin.val().trim() && options.length === 1) {
$vin.val(options[0].vin);
}
});
});
@@ -381,7 +383,7 @@ $(function () {
return ids;
};
// VIN and mileage from the work orders (via plugins such as redmine_qbo_vehicles and redmine_mileage_cp):
// VIN and mileage from the work orders (via plugins such as redmine_qbo_vehicles):
// one vehicle fills the VIN box; the highest mileage fills the mileage box
var updateVehicleFields = function (issueIds) {
var values = (importData && importData.issue_values) || {};