Titleize the subject before save , but keep words containing numbers mixed with letters capitalized

This commit is contained in:
2026-02-06 18:52:11 -05:00
parent b030f85b74
commit d80007bc84

View File

@@ -110,11 +110,20 @@ module RedmineQbo
CustomerToken.get_token self CustomerToken.get_token self
end end
# Titleize the subject before save # Titleize the subject before save , but keep words containing numbers mixed with letters capitalized
def titlize_subject def titlize_subject
self.subject = self.subject.titleize self.subject = self.subject.split(/\s+/).map do |word|
# If word is NOT purely alphanumeric (contains special chars),
# or is all upper/lower, we can handle it.
# excluding alphanumeric strings with mixed case and numbers (e.g., "ID555ABC") from being altered.
if word =~ /[A-Z]/ && word =~ /[0-9]/
word
else
word.downcase
word.capitalize
end
end.join(' ')
end end
end end
# Add module to Issue # Add module to Issue