Attributes not showing in agents interface

Moderator: crythias

Post Reply
n0mad
Znuny newbie
Posts: 8
Joined: 20 Apr 2015, 15:33
Znuny Version: 5.0.12
Real Name: Renat Shaimardanov
Company: Agregator
Contact:

Attributes not showing in agents interface

Post by n0mad »

mod edit: This topic was split from viewtopic.php?f=62&t=24108
It seems working. Except for following - I can't view this fields in Admin->agents interface. Is it ok?


My configs attached bellow:
AgentPrefs-ADfields.xml

Code: Select all

<?xml version="1.0" encoding="utf-8" ?>
<otrs_config version="1.0" init="Framework">
    <ConfigItem Name="PreferencesGroups###ADDepartment" Required="0" Valid="1">
        <Description Translatable="1">Department name from AD</Description>
        <Group>Framework</Group>
        <SubGroup>Frontend::Agent::Preferences</SubGroup>
        <Setting>
            <Hash>
                <Item Key="Module">Kernel::Output::HTML::PreferencesGeneric</Item>
                <Item Key="Column">User Profile</Item>
                <Item Key="Label" Translatable="1">Department</Item>
                <Item Key="Key" Translatable="1">Name of Department</Item>
                <Item Key="Block">Input</Item>
                <Item Key="Data">$Env{"ADDepartment"}</Item>
                <Item Key="PrefKey">ADDepartment</Item>
                <Item Key="Prio">6101</Item>
                <Item Key="Active">1</Item>
            </Hash>
        </Setting>
    </ConfigItem>
    <ConfigItem Name="PreferencesGroups###ADPosition" Required="0" Valid="1">
        <Description Translatable="1">Position from AD</Description>
        <Group>Framework</Group>
        <SubGroup>Frontend::Agent::Preferences</SubGroup>
        <Setting>
            <Hash>
                <Item Key="Module">Kernel::Output::HTML::PreferencesGeneric</Item>
                <Item Key="Column">User Profile</Item>
                <Item Key="Label" Translatable="1">Position</Item>
                <Item Key="Key" Translatable="1">Name of Position</Item>
                <Item Key="Block">Input</Item>
                <Item Key="Data">$Env{"ADPosition"}</Item>
                <Item Key="PrefKey">ADPosition</Item>
                <Item Key="Prio">6102</Item>
                <Item Key="Active">1</Item>
            </Hash>
        </Setting>
    </ConfigItem>
    <ConfigItem Name="PreferencesGroups###ADPhone" Required="0" Valid="1">
        <Description Translatable="1">Phone number from AD</Description>
        <Group>Framework</Group>
        <SubGroup>Frontend::Agent::Preferences</SubGroup>
        <Setting>
            <Hash>
                <Item Key="Module">Kernel::Output::HTML::PreferencesGeneric</Item>
                <Item Key="Column">User Profile</Item>
                <Item Key="Label" Translatable="1">Phone</Item>
                <Item Key="Key" Translatable="1">Phone number</Item>
                <Item Key="Block">Input</Item>
                <Item Key="Data">$Env{"ADPhone"}</Item>
                <Item Key="PrefKey">ADPhone</Item>
                <Item Key="Prio">6103</Item>
                <Item Key="Active">1</Item>
            </Hash>
        </Setting>
    </ConfigItem>
    <ConfigItem Name="PreferencesGroups###ADMobile" Required="0" Valid="1">
        <Description Translatable="1">Mobile phone number from AD</Description>
        <Group>Framework</Group>
        <SubGroup>Frontend::Agent::Preferences</SubGroup>
        <Setting>
            <Hash>
                <Item Key="Module">Kernel::Output::HTML::PreferencesGeneric</Item>
                <Item Key="Column">User Profile</Item>
                <Item Key="Label" Translatable="1">Mobile</Item>
                <Item Key="Key" Translatable="1">Mobile number</Item>
                <Item Key="Block">Input</Item>
                <Item Key="Data">$Env{"ADMobile"}</Item>
                <Item Key="PrefKey">ADMobile</Item>
                <Item Key="Prio">6104</Item>
                <Item Key="Active">1</Item>
            </Hash>
        </Setting>
    </ConfigItem>
</otrs_config>
Config.pm

Code: Select all

    $Self->{'AuthSyncModule::LDAP::UserSyncMap1'} = {
        # DB -> LDAP
        UserFirstname => 'givenName',
        UserLastname  => 'sn',
        UserEmail     => 'mail',
        ADPosition => 'title',
        ADDepartment => 'department',
        ADPhone => 'telephoneNumber',
        ADMobile => 'mobile'
    };
User.pm

Code: Select all

    # get initial data
    my @Bind;
    my $SQL = "SELECT $Self->{UserTableUserID}, $Self->{UserTableUser}, "
        . " title, first_name, last_name, $Self->{UserTableUserPW}, valid_id, "
        . " create_time, change_time, department, position, phone, mobile FROM $Self->{UserTable} WHERE ";

Code: Select all

    my %Data;
    while ( my @Row = $DBObject->FetchrowArray() ) {
        $Data{UserID}        = $Row[0];
        $Data{UserLogin}     = $Row[1];
        $Data{UserTitle}     = $Row[2];
        $Data{UserFirstname} = $Row[3];
        $Data{UserLastname}  = $Row[4];
        $Data{UserPw}        = $Row[5];
        $Data{ValidID}       = $Row[6];
        $Data{CreateTime}    = $Row[7];
        $Data{ChangeTime}    = $Row[8];
        $Data{ADDepartment}  = $Row[9];
        $Data{ADPosition}    = $Row[10];
        $Data{ADPhone}       = $Row[11];
        $Data{ADMobile}      = $Row[12];
    }

Code: Select all

    # update db
    return if !$Kernel::OM->Get('Kernel::System::DB')->Do(
        SQL => "UPDATE $Self->{UserTable} SET title = ?, first_name = ?, last_name = ?, "
            . " $Self->{UserTableUser} = ?, valid_id = ?, "
            . " change_time = current_timestamp, change_by = ? "
            . ", department = ?, position = ?, phone = ?, mobile = ? "
            . " WHERE $Self->{UserTableUserID} = ?",
        Bind => [
            \$Param{UserTitle}, \$Param{UserFirstname}, \$Param{UserLastname},
            \$Param{UserLogin}, \$Param{ValidID}, \$Param{ChangeUserID},
            \$Param{ADDepartment}, \$Param{ADPosition}, \$Param{ADPhone}, \$Param{ADMobile},
            \$Param{UserID},
        ],
    );
UPD: Everything working fine. I've clear the OTRS cache
Last edited by crythias on 21 Apr 2015, 14:42, edited 1 time in total.
Reason: Split because it's important to set a topic for your issue.
Post Reply