[SOLVED] Truncate signatures variables

Moderator: crythias

Locked
Scheatt
Znuny newbie
Posts: 4
Joined: 12 Nov 2020, 20:29
Znuny Version: 6.0
Real Name: Aurélien

[SOLVED] Truncate signatures variables

Post by Scheatt »

Hello,
I want to know if it's possible to show only a part of the variable in the signature.
For example, i have a "Best Regards, <OTRS_FIRST_NAME>" but in my org, we have several people with same first name, and we don't want to display last names to the public, but for better recognition and supervision, we want to show the first letter of the first name.

A solution is, obviously, to edit the first name and replace, for example, "John" with "John D."
But, it doesnt work so well since, in my org, the first name is locked to the org parameters and reset to "John" each time the operator log on.

So, is it possible to force OTRS to display what i want, for example "<OTRS_FIRST_NAME> <OTRS_LAST_NAME>" but with the latter truncated to one or two letters ? or same with <OTRS_REALNAME> ?

Thanks !
Last edited by Scheatt on 14 Nov 2020, 18:16, edited 1 time in total.
root
Administrator
Posts: 4243
Joined: 18 Dec 2007, 12:23
Znuny Version: Znuny and Znuny LTS
Real Name: Roy Kaldung
Company: Znuny
Contact:

Re: Truncate signatures variables

Post by root »

Hi,

You can add a new agent preference and use this.

Place this xml in a new file likee MyCustomization.xml in Kernel/Config/Files/XML

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<otrs_config version="2.0" init="Config">
    <Setting Name="PreferencesGroups###CustomerAgentPref1" Required="0" Valid="1">
        <Description Translatable="1">The agent's last name initial.</Description>
        <Navigation>Frontend::Agent::View::Preferences</Navigation>
        <Value>
            <Hash>
                <Item Key="Module">Kernel::Output::HTML::Preferences::Generic</Item>
                <Item Key="PreferenceGroup">UserInitial</Item>
                <Item Key="Label" Translatable="1">Initial last name</Item>
                <Item Key="Key" Translatable="0">UserInitial</Item>
                <Item Key="Block">Input</Item>
                <Item Key="PrefKey">UserInitial</Item>
                <Item Key="Data">[% Env("UserInitial") %]</Item>
                <Item Key="Prio">1500</Item>
                <Item Key="Active">1</Item>
            </Hash>
        </Value>
    </Setting>
</otrs_config>
and run as OTRS user

Code: Select all

bin/otrs.Console.pl Maint::Config::Rebuild
Every agent has now a new setting in their preferences which can be user as <OTRS_xx_UserInitial> in the signature. Replace xx with CURRENT, OWNER or RESPONSIBLE, whatever you need.

- Roy
Znuny and Znuny LTS running on CentOS / RHEL / Debian / SLES / MySQL / PostgreSQL / Oracle / OpenLDAP / Active Directory / SSO

Use a test system - always.

Do you need professional services? Check out https://www.znuny.com/

Do you want to contribute or want to know where it goes ?
Scheatt
Znuny newbie
Posts: 4
Joined: 12 Nov 2020, 20:29
Znuny Version: 6.0
Real Name: Aurélien

Re: Truncate signatures variables

Post by Scheatt »

Oh, thanks a lot !
Locked