I would like to suggest the following code addition to the module:
AgentCompose.pm inserted at line 264...
it is a new variable for responses called:
<OTRS_CUSTOMER_REALFIRSTNAME>
Background, we found that we wanted to have pre-set responses but to make them sound as nice as possible we want to say:
Hi <firstname>,
The _REALNAME variable unfortunately shows a non-pretty format... This new variable works the following way:
Joe Smith < joe(a)smith.com > converts to " Joe"
Smith, Joe < joe(a)smith.com > converts to " Joe"
Joe < joe(a)smith.com > converts to " Joe"
Mr. Joe Smith < joe(a)smith.com > converts to " Joe " (I have to actually double check this one)
< joe(a)smith.com > converts to ""
Notice that all results except empty string have a " " (space) in front of them -- this is on purpose so that if you say:
Hi<..._REALFIRSTNAME>,
You won't wind up with a space between the "Hi" and "," if the result is nothing... but if there is a result, the space is inserted. This way the result looks exactly like it should in all cases.
It is working great so far and has saved us tons of work cleaning up responses based on what peoples email address is. Might need some tweaks over time as new emails come in but seems to do well right now.
-John
---------------------------------------------
Insert at line 264:
if ($Data{Salutation} =~ /<OTRS_CUSTOMER_REALFIRSTNAME>/) {
# get realname
my $From = '';
if ($Ticket{CustomerUserID}) {
$From = $Self->{CustomerUserObject}->CustomerName(UserLogin => $Ticket{CustomerUserID});
}
if (!$From) {
$From = $Data{OrigFrom} || '';
$From =~ s/<.*>|\(.*\)|\"|;//g;
$From =~ s#^.*?,##;
$From =~ s# +$##; $From =~ s#^ +##;
$From =~ s# +# #g;
foreach (split (' ',$From))
{ if ($_ !~ m#\.#) { $From = $_; last; } }
if ($From =~ m#\@#) { $From = ""; }
if ($From ne "") { $From = " $From"; }
}
$Data{Salutation} =~ s/<OTRS_CUSTOMER_REALFIRSTNAME>/$From/g;
}