This is the first time I am setting up an OTRS environment and although I have read all the documentation I could find relating to the things that I wish to accomplish, I am stumbling on some basic concepts.
I am trying to accomplish the following:
Alter the customer / tickets screens so they could contain up to 30 different fields which would come from four different tables from an external mysql database.
In order to accomplish this and following the OTRS documentation and various posts on this and other forms I have generated the following Config.pm code from the Default.pm. For the sake of simplicity this Config.pm only has two external DB backends.
Code: Select all
package Kernel::Config;
use strict;
use warnings;
use utf8;
sub Load {
my $Self = shift;
# ---------------------------------------------------- #
# database settings #
# ---------------------------------------------------- #
# The database host
$Self->{'DatabaseHost'} = 'localhost';
# The database name
$Self->{'Database'} = 'otrs';
# The database user
$Self->{'DatabaseUser'} = 'otrs';
# The password of database user. You also can use bin/otrs.CryptPassword.pl
# for crypted passwords
$Self->{'DatabasePw'} = 'dbPass';
# The database DSN for MySQL ==> more: "perldoc DBD::mysql"
$Self->{DatabaseDSN} = "DBI:mysql:database=$Self->{Database};host=$Self->{DatabaseHost};";
# ---------------------------------------------------- #
# fs root directory
# ---------------------------------------------------- #
$Self->{Home} = '/opt/otrs';
# ---------------------------------------------------- #
# insert your own config settings "here" #
# config settings taken from Kernel/Config/Defaults.pm #
# ---------------------------------------------------- #
# $Self->{SessionUseCookie} = 0;
# $Self->{CheckMXRecord} = 0;
# ---------------------------------------------------- #
# data inserted by installer #
# ---------------------------------------------------- #
# $DIBI$
# --------------------------------------------------- #
# Start of config options!!! #
# CustomerUser stuff #
# --------------------------------------------------- #
# CustomerUser
# (customer user database backend and settings)
# CUSTOMER BACKEND Nº 1
$Self->{CustomerUser} = {
Name => 'Database Backend',
Module => 'Kernel::System::CustomerUser::DB',
Params => {
# if you want to use an external database, add the
# required settings
# DSN => 'DBI:odbc:yourdsn',
DSN => 'DBI:mysql:database=rcmovil;host=hostIP',
User => 'userID',
Password => 'dbPass',
Table => 'clientes',
# CaseSensitive will control if the SQL statements need LOWER()
# function calls to work case insensitively. Setting this to
# 1 will improve performance dramatically on large databases.
CaseSensitive => 0,
},
# customer uniq id
CustomerKey => 'id_cliente',
# customer #
CustomerID => 'id_cliente',
#CustomerValid => 'valid_id',
#CustomerValid => 'id_cliente',
CustomerUserListFields => [ 'email', 'Msisdn', 'id_cliente' ],
CustomerUserSearchFields => [ 'Msisdn', 'mombre', 'apellido1', 'apellido2', 'id_cliente', 'email' ],
CustomerUserSearchPrefix => '*',
CustomerUserSearchSuffix => '*',
CustomerUserSearchListLimit => 250,
CustomerUserPostMasterSearchFields => ['email'],
CustomerUserNameFields => [ 'mombre', 'apellido1', 'apellido2' ],
CustomerUserEmailUniqCheck => 0,
# # show now own tickets in customer panel, CompanyTickets
# CustomerUserExcludePrimaryCustomerID => 0,
# # generate auto logins
# AutoLoginCreation => 0,
# # generate auto login prefix
# AutoLoginCreationPrefix => 'auto',
# # admin can change customer preferences
# AdminSetPreferences => 1,
# # use customer company support (reference to company, See CustomerCompany settings)
# CustomerCompanySupport => 1,
# # cache time to live in sec. - cache any database queries
# CacheTTL => 0,
# # just a read only source
ReadOnly => 1,
Map => [
# note: Login, Email and CustomerID needed!
# var, frontend, storage, shown (1=always,2=lite), required, storage-type, http-link, readonly, http-link-target
[ 'UserFirstname', 'Firstname', 'mombre', 1, 1, 'var', '', 0 ],
[ 'UserLastname', 'Lastname', 'apellido1', 1, 1, 'var', '', 0 ],
[ 'UserLogin', 'Username', 'Msisdn', 1, 1, 'int', '', 0 ],
[ 'UserEmail', 'Email', 'email', 1, 1, 'var', '', 0 ],
[ 'UserCustomerID', 'CustomerID', 'id_cliente', 0, 1, 'int', '', 0 ],
[ 'UserMobile', 'Mobile', 'Msisdn', 1, 0, 'int', '', 0 ],
],
# default selections
Selections => {
# UserTitle => {
# 'Mr.' => 'Mr.',
# 'Mrs.' => 'Mrs.',
# },
},
};
# CUSTOMER BAKEND Nº 2
$Self->{CustomerUser1} = {
Name => 'Database Backend',
Module => 'Kernel::System::CustomerUser::DB',
Params => {
# if you want to use an external database, add the
# required settings
# DSN => 'DBI:odbc:yourdsn',
DSN => 'DBI:mysql:database=rcmovil;host=hostIP',
User => 'userID',
Password => 'dbPass',
Table => 'RC_SECOND',
# CaseSensitive will control if the SQL statements need LOWER()
# function calls to work case insensitively. Setting this to
# 1 will improve performance dramatically on large databases.
CaseSensitive => 0,
},
# customer uniq id
CustomerKey => 'RCS_ID',
# customer #
CustomerID => 'RCS_ID',
#CustomerValid => 'valid_id',
#CustomerValid => 'RCS_ID',
CustomerUserListFields => [ 'RCS_Name', 'RCS_LastName', 'RCS_Comments', ],
# CustomerUserListFields => ['login', 'first_name', 'last_name', 'customer_id', 'email'],
CustomerUserSearchFields => [ 'RCS_Login', 'RCS_Name', 'RCS_ID' ],
CustomerUserSearchPrefix => '*',
CustomerUserSearchSuffix => '*',
CustomerUserSearchListLimit => 250,
CustomerUserPostMasterSearchFields => ['RCS_Mail'],
CustomerUserNameFields => [ 'RCS_Name', 'RCS_LastName' ],
CustomerUserEmailUniqCheck => 0,
# # show now own tickets in customer panel, CompanyTickets
# CustomerUserExcludePrimaryCustomerID => 0,
# # generate auto logins
# AutoLoginCreation => 0,
# # generate auto login prefix
# AutoLoginCreationPrefix => 'auto',
# # admin can change customer preferences
# AdminSetPreferences => 1,
# # use customer company support (reference to company, See CustomerCompany settings)
# CustomerCompanySupport => 1,
# # cache time to live in sec. - cache any database queries
# CacheTTL => 0,
# # just a read only source
ReadOnly => 1,
Map => [
# note: Login, Email and CustomerID needed!
# var, frontend, storage, shown (1=always,2=lite), required, storage-type, http-link, readonly, http-link-target
[ 'UserFirstname', 'ARM Firstname', 'RCS_Name', 1, 1, 'var', '', 0 ],
[ 'UserLastname', 'ARM Lastname', 'RCS_LastName', 1, 1, 'var', '', 0 ],
[ 'UserLogin', 'ARM Username', 'RCS_Login', 1, 1, 'int', '', 0 ],
[ 'UserEmail', 'Email', 'RCS_Mail', 1, 1, 'var', '', 0 ],
[ 'UserCustomerID', 'ARM CustomerID', 'RCS_ID', 0, 1, 'int', '', 0 ],
[ 'UserComment', 'ARM Comment', 'RCS_Comments', 1, 1, 'var', '', 0 ],
# [ 'ValidID', 'ARM Valid', 'RCS_ID', 0, 1, 'int', '', 0 ],
],
# default selections
Selections => {
# UserTitle => {
# 'Mr.' => 'Mr.',
# 'Mrs.' => 'Mrs.',
# },
},
};
# Customer backend till here
}
# ---------------------------------------------------- #
# needed system stuff (don't edit this) #
# ---------------------------------------------------- #
use strict;
use warnings;
use vars qw(@ISA);
use Kernel::Config::Defaults;
push (@ISA, 'Kernel::Config::Defaults');
# -----------------------------------------------------#
1;
One thing to note, as all the documentation stated that login, email and customerId needed to be present in each backend, so fields mgmc_Msisdn, mgmc_email and mgmc_id_cliente from table mgm_clientes and mapped to the OTRS variables 'UserLogin', 'UserEmail' and 'UserCustomerID' contain the same data as the fields RCS_Login, RCS_Mail and RCS_ID from table RC_SECOND and mapped to the OTRS variables 'UserLogin', 'UserEmail' and 'UserCustomerID'
In the case I have posted, as the first backend name (CustomerUser) is the same as the one in the Default.pm (CustomerUser), the first backend configuration mapping is displayed once you click on a particular customer USERNAME.
However, none of the data from the second table mapping (CustomerUser1) is displayed and no data (neither from CustomerUser or CustomerUser1) is populated either. It simply displays the Edit Customer Screen but without any data populated in the corresponding fields. Kind of what you would expect to see if you need to create a new customer.
What am I doing wrong for it not to show the secondary data? and why is the data not populating in the fields?
On a related issue, on the UI screen "Customers / Customer User Administration", Is there another or easier way to change the columns you wish to appear without having to create a new theme by adding and editing the AdminCustomerUser.dtl into "Kernel/Output/HTML/Company" or is this the common practice and standard way of changing these types of screens?
Sorry for the long post, but I thought I would put in as much detail in order for you all to better understand the context.
I really appreciate any help or guidance anyone can provide.
Thank you very much,
Ariel