Hi John,
OTRS 2.0 comes with the <OTRS_CUSTOMER_*> option. That means every customer map tag can be used. This means you can use <OTRS_CUSTOMER_UserFirstname>.
This should solve your problem.
-Martin
John (Versimedia) wrote:
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 < [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > converts to " Joe"
Smith, Joe < [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > converts to " Joe"
Joe < [EMAIL PROTECTED] > converts to " Joe"
Mr. Joe Smith < [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > converts to " Joe " (I have to actually double check this one)
< [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > 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 =~ [EMAIL PROTECTED]) { $From = ""; }
if ($From ne "") { $From = " $From"; }
}
$Data{Salutation} =~ s/<OTRS_CUSTOMER_REALFIRSTNAME>/$From/g;
}
------------------------------------------------------------------------
_______________________________________________ OTRS mailing list: dev - Webpage: http://otrs.org/ Archive: http://lists.otrs.org/pipermail/dev To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/dev
