Дополнительное поле для хранения номера телефона я добавил с помощью конфига:
AgentPhoneNumber.xml
Код: Выделить всё
<otrs_config version="1.0" init="Framework">
<ConfigItem Name="PreferencesGroups###PersonalPhoneNumber" Required="0" Valid="0">
<Description Translatable="1">Defines the config parameters of this item, to be shown in the preferences view.</Description>
<Group>Framework</Group>
<SubGroup>Frontend::Agent::Preferences</SubGroup>
<Setting>
<Hash>
<Item Key="Module">Kernel::Output::HTML::Preferences::Generic</Item>
<Item Key="Column">Other Settings</Item>
<Item Key="Label" Translatable="1">Добавочный номер телефона</Item>
<Item Key="Key" Translatable="1">Номер телефона</Item>
<Item Key="Block">Input</Item>
<Item Key="Data">$Env{"telephoneNumber"}</Item>
<Item Key="PrefKey">telephoneNumber</Item>
<Item Key="Prio">7000</Item>
<Item Key="Active">1</Item>
</Hash>
</Setting>
</ConfigItem>
</otrs_config>
В подписи используется как <OTRS_Agent_telephoneNumber>
Но не решил проблему синхронизации с AD.
На форуме http://forums.otterhub.org/viewtopic.php?t=24108 есть предложение как решить вопрос, но пока не протестировал.
Кто-нибудь подобное делал?
Код: Выделить всё
$Self->{'AuthSyncModule::LDAP::UserPreferencesSyncMap'} = {
# DB -> LDAP (user preferences)
UserAgentenDurchwahl => 'telephoneNumber',
UserAgentenAbteilung => 'department',
}
Код: Выделить всё
# sync user preferences from ldap
my $UserPreferencesSyncMap = $ConfigObject->Get( 'AuthSyncModule::LDAP::UserPreferencesSyncMap' . $Self->{Count} );
if ($UserPreferencesSyncMap && $UserID) {
# get whole user dn
my %SyncUserPreferences;
for my $Entry ( $Result->all_entries() ) {
for my $Key ( sort keys %{$UserPreferencesSyncMap} ) {
my $AttributeNames = $UserPreferencesSyncMap->{$Key};
if ( ref $AttributeNames ne 'ARRAY' ) {
$AttributeNames = [$AttributeNames];
}
ATTRIBUTE_NAME:
for my $AttributeName ( @{$AttributeNames} ) {
if ( $AttributeName =~ /^_/ ) {
$SyncUserPreferences{$Key} = substr( $AttributeName, 1 );
last ATTRIBUTE_NAME;
}
elsif ( $Entry->get_value($AttributeName) ) {
$SyncUserPreferences{$Key} = $Entry->get_value($AttributeName);
last ATTRIBUTE_NAME;
}
}
# e. g. set utf-8 flag
$SyncUserPreferences{$Key} = $Self->_ConvertFrom(
$SyncUserPreferences{$Key},
'utf-8',
);
}
}
# update user preferences attributes (only if changed)
if (%SyncUserPreferences) {
# get user data
my %UserPreferencesData = $UserObject->GetPreferences( UserID => $UserID );
# check for changes
my $AttributeChange;
ATTRIBUTE:
for my $Attribute ( sort keys %SyncUserPreferences ) {
next ATTRIBUTE if $SyncUserPreferences{$Attribute} eq $UserPreferencesData{$Attribute};
$AttributeChange = 1;
last ATTRIBUTE;
}
if ($AttributeChange) {
for my $Attribute ( sort keys %SyncUserPreferences ) {
$UserObject->SetPreferences(
Key => $Attribute,
Value => $SyncUserPreferences{$Attribute},
UserID => $UserID,
);
}
}
}
}