Compare commits

...

4 Commits

Author SHA1 Message Date
ricky 6da0972476 2026.4.1 2026-04-09 09:43:04 -04:00
ricky 35542ba1b9 Fix vehicle name fallback not applied in select by replacing pluck with model instances 2026-04-09 09:42:45 -04:00
ricky cc94401a1f 2026.4.0 2026-04-09 09:32:00 -04:00
ricky 6012434de2 Display year/make/model if name is blank 2026-04-09 09:31:31 -04:00
3 changed files with 17 additions and 6 deletions
+7
View File
@@ -41,6 +41,11 @@ class Vehicle < ApplicationRecord
super(val.to_s.strip)
end
def name
val = self[:name]
val.present? ? val : to_s
end
# Redmine compatibility shim
def project
nil
@@ -63,7 +68,9 @@ class Vehicle < ApplicationRecord
end
def to_s
return self[:name] if self[:name].present?
return vin if year.blank? || make.blank? || model.blank?
suffix = vin.to_s[9..] || vin
"#{year} #{make} #{model} - #{suffix}"
end
+1 -1
View File
@@ -14,7 +14,7 @@ Redmine::Plugin.register :redmine_qbo_vehicles do
name 'Redmine QBO Vehicles plugin'
author 'Rick Barrette'
description 'This is a plugin for Redmine to intergrate with the redmine_qbo plugin to provide vehicle data tracking'
version '2026.3.4'
version '2026.4.1'
url 'https://github.com/rickbarrette/redmine_qbo_vehicles'
author_url 'https://barrettefabrication.com'
requires_redmine version_or_higher: '6.1.0'
@@ -18,14 +18,18 @@ module Vehicles
def view_issues_form_details_bottom(context={})
# Load the customer's vehicles for selection in the issue form.
vehicles = context[:issue].customer&.vehicles || []
context[:controller].send(:render_to_string, {
partial: 'issues/form_hook_vehicles',
locals: {
vehicle: context[:form].select( :vehicle_id,
context[:issue].customer ? context[:issue].customer.vehicles.pluck(:name, :id) : [],
selected: context[:issue].vehicle ? context[:issue].vehicle.id : nil,
include_blank: true )
}
vehicle: context[:form].select(
:vehicle_id,
vehicles.map { |v| [v.name, v.id] },
selected: context[:issue].vehicle&.id,
include_blank: true
)
}
})
end