Hello we are using the company function in OTRS. I would like to add a field in the DB and display it in the customer detail window.
Somebody has an idea how to do this?
Kr,
Chris
How to add a field in the company details window
Moderator: crythias
-
- Moderator
- Posts: 10170
- Joined: 04 May 2010, 18:38
- Znuny Version: 5.0.x
- Location: SouthWest Florida, USA
- Contact:
Re: How to add a field in the company details window
copy from Defaults.pm to Config.pm and edit:
Add fields in the map.
Fields are as follows:
The fields will appear in the order listed in the Map.
* The cursory search of code for 'var' is the following:
First, where is Entry 5 referenced?
grep -sir 'Entry->' * | grep 5
CustomerCompany.pm: if ( $Entry->[5] =~ /^int$/i ) {
CustomerCompany.pm: if ( $Entry->[5] =~ /^int$/i ) {
CustomerUser/DB.pm: if ( $Entry->[0] eq 'UserLogin' && $Entry->[5] =~ /^int$/i ) {
CustomerUser/DB.pm: if ( $Entry->[5] =~ /^int$/i ) {
CustomerUser/DB.pm: if ( $Entry->[5] =~ /^int$/i ) {
Next, where is "var" used that's properly cased, not used for keywords or in the word "variable" or pointing to a directory strucure?
grep -sir 'var' * | grep -v "Var" | grep -v "var[si]" | grep -v "VAR\w" | grep -v 'var/'
CustomerUser/DB.pm: # check if CustomerKey is var or int
FAQ.pm: # var for old versions
Support.pm: # ignore var directories
Support.pm: next FILE if $File =~ /^var\/tmp/;
Support.pm: next FILE if $File =~ /^var\/article/;
Ticket/Article.pm: # fill up dynamic varaibles
It appears that the word "var" in the map is merely a placeholder. It could be 'foobar', apparently, and still work, as long as it's not 'int'.
Code: Select all
$Self->{CustomerCompany} = {
Params => {
# if you want to use an external database, add the
# required settings
# DSN => 'DBI:odbc:yourdsn',
# DSN => 'DBI:mysql:database=customerdb;host=customerdbhost',
# User => '',
# Password => '',
Table => 'customer_company',
# ForeignDB => 0, # set this to 1 if your table does not have create_time, create_by, change_time and change_by fields
},
# company unique id
CustomerCompanyKey => 'customer_id',
CustomerCompanyValid => 'valid_id',
CustomerCompanyListFields => [ 'customer_id', 'name' ],
CustomerCompanySearchFields => ['customer_id', 'name'],
CustomerCompanySearchPrefix => '',
CustomerCompanySearchSuffix => '*',
CustomerCompanySearchListLimit => 250,
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 ],
],
};
Fields are as follows:
- the variable name when referenced in tags.
- the label that shows
- your table's column name
- when the variable shows (likely 1)
- required (0/1)
- storage-type (usually var, but can be int. Cursory glances at the code seem to assume anything not "int" is a string *)
- http-link (url that wraps the term)
- readonly (0/1)
The fields will appear in the order listed in the Map.
* The cursory search of code for 'var' is the following:
First, where is Entry 5 referenced?
grep -sir 'Entry->' * | grep 5
CustomerCompany.pm: if ( $Entry->[5] =~ /^int$/i ) {
CustomerCompany.pm: if ( $Entry->[5] =~ /^int$/i ) {
CustomerUser/DB.pm: if ( $Entry->[0] eq 'UserLogin' && $Entry->[5] =~ /^int$/i ) {
CustomerUser/DB.pm: if ( $Entry->[5] =~ /^int$/i ) {
CustomerUser/DB.pm: if ( $Entry->[5] =~ /^int$/i ) {
Next, where is "var" used that's properly cased, not used for keywords or in the word "variable" or pointing to a directory strucure?
grep -sir 'var' * | grep -v "Var" | grep -v "var[si]" | grep -v "VAR\w" | grep -v 'var/'
CustomerUser/DB.pm: # check if CustomerKey is var or int
FAQ.pm: # var for old versions
Support.pm: # ignore var directories
Support.pm: next FILE if $File =~ /^var\/tmp/;
Support.pm: next FILE if $File =~ /^var\/article/;
Ticket/Article.pm: # fill up dynamic varaibles
It appears that the word "var" in the map is merely a placeholder. It could be 'foobar', apparently, and still work, as long as it's not 'int'.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask