We are implemented OTRS, and for customer company we require to show data from two different databases :
1. from OTRS customer_company table - which is default setup - MySQL connection
2. from mssql databse table - which is an external database.
I tried to implement both the databases, but don't know after doing changes in zzzcustomerbackend.pm, I am not able to open the login page.
changes to implement both the DB as below :
Code: Select all
##################################################
####### COMPANY BACKEND
##################################################
$Self->{CustomerCompany} = {
Name => 'Source AX-View for CustomerCompany',
Module => 'Kernel::System::CustomerCompany::DB',
Params => {
Table => 'customer_company',
CaseSensitive => 0,
},
# company unique id
CustomerCompanyKey => 'customer_id',
CustomerCompanyValid => 'valid_id',
CustomerCompanyListFields => [ 'customer_id', 'name' ],
CustomerCompanySearchFields => ['customer_id', 'name'],
CustomerCompanySearchPrefix => '*',
CustomerCompanySearchSuffix => '*',
CustomerCompanySearchListLimit => 250,
CacheTTL => 60 * 60 * 24, # use 0 to turn off cache
Map => [
# var, frontend, storage, shown (1=always,2=lite), required, storage-type, http-link, readonly
[ 'CustomerID', 'CustomerID', 'customer_id', 0, 1, 'var', '', 0 ],
[ 'CustomerCompanyName', 'Company', 'name', 1, 1, 'var', '', 0 ],
[ 'CustomerCompanyStreet', 'Street', 'street', 1, 0, 'var', '', 0 ],
[ 'CustomerCompanyZIP', 'Zip', 'zip', 1, 0, 'var', '', 0 ],
[ 'CustomerCompanyCity', 'City', 'city', 1, 0, 'var', '', 0 ],
[ 'CustomerCompanyCountry', 'Country', 'country', 1, 0, 'var', '', 0 ],
[ 'CustomerCompanyURL', 'URL', 'url', 1, 0, 'var', '$Data{"CustomerCompanyURL"}', 0 ],
[ 'CustomerCompanyComment', 'Comment', 'comments', 1, 0, 'var', '', 0 ],
[ 'ValidID', 'Valid', 'valid_id', 0, 1, 'int', '', 0 ],
],
};
##########second DB connection- mssql as below######################################
############ 1. Customer user backend: new DB
########### (customer user database backend and settings)
$Self->{CustomerCompany1} = {
Name => 'Customer Database Source AX-New View for CustomerCompany',
Module => 'Kernel::System::CustomerCompany::DB',
Params => {
# if you want to use an external database, add the
# required settings
DSN => 'DBI:odbc:database=externalDB;host=externalDB.local',
Type => 'mssql', # only for ODBC connections
User => 'externalDB_otrs',
Password => 'externalDB',
Table => 'Cust_Comp_externalDBView',
CaseSensitive => 0,
},
###### company unique id
CustomerCompanyKey => 'NAMEALIAS',
CustomerCompanyValid => 'CustValid',
CustomerCompanyListFields => [ 'NAMEALIAS', 'name' ],
CustomerCompanySearchFields => ['NAMEALIAS', 'name'],
CustomerCompanySearchPrefix => '*',
CustomerCompanySearchSuffix => '*',
CustomerCompanySearchListLimit => 250,
CacheTTL => 60 * 60 * 24, # use 0 to turn off cache
ReadOnly => 1,
Map => [
# var, frontend, storage, shown (1=always,2=lite), required, storage-type, http-link, readonly
[ 'CustomerID', 'CustomerID', 'NAMEALIAS', 0, 1, 'var', '', 0 ],
[ 'CustomerCompanyName', 'Company', 'name', 1, 1, 'var', '', 0 ],
[ 'CustomerCompanyStreet', 'Street', 'street', 1, 0, 'var', '', 0 ],
[ 'CustomerCompanyZIP', 'Zip', 'zipcode', 1, 0, 'var', '', 0 ],
[ 'CustomerCompanyCity', 'City', 'city', 1, 0, 'var', '', 0 ],
# [ 'CustomerCompanyCountry', 'Country', 'country', 1, 0, 'var', '', 0 ],
# [ 'CustomerCompanyURL', 'URL', 'url', 1, 0, 'var', '$Data{"CustomerCompanyURL"}', 0 ],
# [ 'CustomerCompanyComment', 'Comment', 'comments', 1, 0, 'var', '', 0 ],
[ 'ValidID', 'Valid', 'CustValid', 0, 1, 'int', '', 0 ],
],
};
Thanks in advance.
Regards,
GMunjal