From d80007bc845497acce01a6e62f658a72d1b94ecb Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Fri, 6 Feb 2026 18:52:11 -0500 Subject: [PATCH] Titleize the subject before save , but keep words containing numbers mixed with letters capitalized --- lib/redmine_qbo/patches/issue_patch.rb | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/redmine_qbo/patches/issue_patch.rb b/lib/redmine_qbo/patches/issue_patch.rb index a5f743e..6ec9bc4 100644 --- a/lib/redmine_qbo/patches/issue_patch.rb +++ b/lib/redmine_qbo/patches/issue_patch.rb @@ -110,11 +110,20 @@ module RedmineQbo CustomerToken.get_token self end - # Titleize the subject before save + # Titleize the subject before save , but keep words containing numbers mixed with letters capitalized 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 # Add module to Issue