mirror of
https://github.com/rickbarrette/redmine_qbo_vehicles.git
synced 2026-07-01 16:11:08 -04:00
Display year/make/model if name is blank
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user