[solved] Custom agent preferences in OTRS 6

Moderator: crythias

Locked
jjurkus
Znuny newbie
Posts: 54
Joined: 29 Jan 2016, 15:36
Znuny Version: 6.0.17

[solved] Custom agent preferences in OTRS 6

Post by jjurkus »

In OTRS 5 I had a couple of custom agent preferences working. With the upgrade these seem to have vanished.

I updated the xml file I created previously:

Code: Select all

# su -c "/opt/otrs/bin/otrs.Console.pl Dev::Tools::Migrate::ConfigXMLStructure --source-directory /tmp" -s /bin/bash otrs
The new file has been placed in /opt/otrs/Kernel/Config/Files/XML/ as AgentPrefs.xml:

Code: Select all

<?xml version="1.0" encoding="utf-8" ?>
<otrs_config version="2.0" init="Framework">
    <Setting Name="PreferencesGroups###UserPhone" Required="0" Valid="1">
        <Description Translatable="1">Defines the config parameters of this item, to be shown in the preferences view.</Description>
        <Navigation>Frontend::Agent::View::Preferences</Navigation>
        <Value>
            <Hash>
                <Item Key="Module">Kernel::Output::HTML::PreferencesGeneric</Item>
                <Item Key="PreferenceGroup">User Profile</Item>
                <Item Key="Label" Translatable="1">Phone</Item>
                <Item Key="Key" Translatable="1">Phone</Item>
                <Item Key="Block">Input</Item>
                <Item Key="Data">$Env{"UserPhone"}</Item>
                <Item Key="PrefKey">UserPhone</Item>
                <Item Key="Prio">3510</Item>
                <Item Key="Active">1</Item>
            </Hash>
        </Value>
    </Setting>
    <Setting Name="PreferencesGroups###UserAddress" Required="0" Valid="1">
        <Description Translatable="1">Defines the config parameters of this item, to be shown in the preferences view.</Description>
        <Navigation>Frontend::Agent::View::Preferences</Navigation>
        <Value>
            <Hash>
                <Item Key="Module">Kernel::Output::HTML::PreferencesGeneric</Item>
                <Item Key="PreferenceGroup">User Profile</Item>
                <Item Key="Label" Translatable="1">Address</Item>
                <Item Key="Key" Translatable="1">Address</Item>
                <Item Key="Block">Input</Item>
                <Item Key="Data">$Env{"UserAddress"}</Item>
                <Item Key="PrefKey">UserAddress</Item>
                <Item Key="Prio">3511</Item>
                <Item Key="Active">1</Item>
            </Hash>
        </Value>
    </Setting>
    <Setting Name="PreferencesGroups###UserZip" Required="0" Valid="1">
        <Description Translatable="1">Defines the config parameters of this item, to be shown in the preferences view.</Description>
        <Navigation>Frontend::Agent::View::Preferences</Navigation>
        <Value>
            <Hash>
                <Item Key="Module">Kernel::Output::HTML::PreferencesGeneric</Item>
                <Item Key="PreferenceGroup">User Profile</Item>
                <Item Key="Label" Translatable="1">Zip</Item>
                <Item Key="Key" Translatable="1">Zip</Item>
                <Item Key="Block">Input</Item>
                <Item Key="Data">$Env{"UserZip"}</Item>
                <Item Key="PrefKey">UserZip</Item>
                <Item Key="Prio">3512</Item>
                <Item Key="Active">1</Item>
            </Hash>
        </Value>
    </Setting>
    <Setting Name="PreferencesGroups###UserCity" Required="0" Valid="1">
        <Description Translatable="1">Defines the config parameters of this item, to be shown in the preferences view.</Description>
        <Navigation>Frontend::Agent::View::Preferences</Navigation>
        <Value>
            <Hash>
                <Item Key="Module">Kernel::Output::HTML::PreferencesGeneric</Item>
                <Item Key="PreferenceGroup">User Profile</Item>
                <Item Key="Label" Translatable="1">City</Item>
                <Item Key="Key" Translatable="1">City</Item>
                <Item Key="Block">Input</Item>
                <Item Key="Data">$Env{"UserCity"}</Item>
                <Item Key="PrefKey">UserCity</Item>
                <Item Key="Prio">3513</Item>
                <Item Key="Active">1</Item>
            </Hash>
        </Value>
    </Setting>
    <Setting Name="PreferencesGroups###UserCompany" Required="0" Valid="1">
        <Description Translatable="1">Defines the config parameters of this item, to be shown in the preferences view.</Description>
        <Navigation>Frontend::Agent::View::Preferences</Navigation>
        <Value>
            <Hash>
                <Item Key="Module">Kernel::Output::HTML::PreferencesGeneric</Item>
                <Item Key="PreferenceGroup">User Profile</Item>
                <Item Key="Label" Translatable="1">Company</Item>
                <Item Key="Key" Translatable="1">Company</Item>
                <Item Key="Block">Input</Item>
                <Item Key="Data">$Env{"UserCompany"}</Item>
                <Item Key="PrefKey">UserCompany</Item>
                <Item Key="Prio">3514</Item>
                <Item Key="Active">1</Item>
            </Hash>
        </Value>
    </Setting>
    <Setting Name="PreferencesGroups###UserHomePage" Required="0" Valid="1">
        <Description Translatable="1">Defines the config parameters of this item, to be shown in the preferences view.</Description>
        <Navigation>Frontend::Agent::View::Preferences</Navigation>
        <Value>
            <Hash>
                <Item Key="Module">Kernel::Output::HTML::PreferencesGeneric</Item>
                <Item Key="PreferenceGroup">User Profile</Item>
                <Item Key="Label" Translatable="1">Homepage</Item>
                <Item Key="Key" Translatable="1">Homepage</Item>
                <Item Key="Block">Input</Item>
                <Item Key="Data">$Env{"UserHomePage"}</Item>
                <Item Key="PrefKey">UserHomePage</Item>
                <Item Key="Prio">3515</Item>
                <Item Key="Active">1</Item>
            </Hash>
        </Value>
    </Setting>
</otrs_config>
These prios were chosen so they would show up in the user profile after time zone. They are not visible in the user profile, nor in the 'create and manage agents' part in the admin menu.
However, the settings from AgentPrefs.xml do show up in the System Config:
https://helpdesk.domain/otrs/index.pl?A ... references

What am I doing wrong or forgetting?
Last edited by jjurkus on 26 Apr 2019, 16:14, edited 1 time in total.
OTRS 6.0.x on CentOS 7 with a PostgreSQL database.
root
Administrator
Posts: 4237
Joined: 18 Dec 2007, 12:23
Znuny Version: Znuny and Znuny LTS
Real Name: Roy Kaldung
Company: Znuny
Contact:

Re: Custom agent preferences in OTRS 6

Post by root »

Hi,

this is a valid one for OTRS 6:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<otrs_config version="2.0" init="Config">
    <Setting Name="PreferencesGroups###WhateverYouLike" Required="0" Valid="1">
        <Description Translatable="1">Whatever</Description>
        <Navigation>Frontend::Agent::View::Preferences</Navigation>
        <Value>
            <Hash>
                <Item Key="Module">Kernel::Output::HTML::Preferences::Generic</Item>
                <Item Key="PreferenceGroup">UserProfile</Item>
                <Item Key="Label" Translatable="1">Your Label</Item>
                <Item Key="Key" Translatable="1">UserPrefName</Item>
                <Item Key="Block">Input</Item>
                <Item Key="PrefKey">UserPrefName</Item>
                <Item Key="Data">[% Env("UserPrefName") %]</Item>
                <Item Key="Prio">0600</Item>
                <Item Key="Active">1</Item>
            </Hash>
        </Value>
    </Setting>
</otrs_config>
- 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 ?
jjurkus
Znuny newbie
Posts: 54
Joined: 29 Jan 2016, 15:36
Znuny Version: 6.0.17

Re: Custom agent preferences in OTRS 6

Post by jjurkus »

Thanks, I've got it working!

It seems the built-in converter doesn't convert Kernel::Output::HTML::PreferencesGeneric to Kernel::Output::HTML::Preferences::Generic

And of course I also buggered up by writing the PreferenceGroup with a space.
OTRS 6.0.x on CentOS 7 with a PostgreSQL database.
Locked