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)
|
super(val.to_s.strip)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def name
|
||||||
|
val = self[:name]
|
||||||
|
val.present? ? val : to_s
|
||||||
|
end
|
||||||
|
|
||||||
# Redmine compatibility shim
|
# Redmine compatibility shim
|
||||||
def project
|
def project
|
||||||
nil
|
nil
|
||||||
@@ -63,7 +68,9 @@ class Vehicle < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def to_s
|
def to_s
|
||||||
|
return self[:name] if self[:name].present?
|
||||||
return vin if year.blank? || make.blank? || model.blank?
|
return vin if year.blank? || make.blank? || model.blank?
|
||||||
|
|
||||||
suffix = vin.to_s[9..] || vin
|
suffix = vin.to_s[9..] || vin
|
||||||
"#{year} #{make} #{model} - #{suffix}"
|
"#{year} #{make} #{model} - #{suffix}"
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user