https://github.com/netways/rt-extension-dbcustomfield
Connect databases to CustomFields
https://github.com/netways/rt-extension-dbcustomfield
database extension management organisation request-tracker ticket-system workflow
Last synced: 3 months ago
JSON representation
Connect databases to CustomFields
- Host: GitHub
- URL: https://github.com/netways/rt-extension-dbcustomfield
- Owner: NETWAYS
- License: gpl-2.0
- Created: 2017-12-27T13:09:43.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2024-01-16T11:14:14.000Z (almost 2 years ago)
- Last Synced: 2025-03-06T04:22:57.420Z (8 months ago)
- Topics: database, extension, management, organisation, request-tracker, ticket-system, workflow
- Language: Perl
- Homepage:
- Size: 212 KB
- Stars: 0
- Watchers: 8
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README
- Changelog: CHANGELOG.md
- License: LICENSE
- Authors: AUTHORS
Awesome Lists containing this project
README
NAME
RT::Extension::DBCustomField - Link custom field values with external
sourcesDESCRIPTION
This extension allows to link custom field values to external databases.Specific custom field types provided by this extension allow users to
choose from a list of suggestions what they want to associate with a
ticket. This works with the help of auto-completion which is invoked
once a user typed two or more characters.Stored and displayed is by default what the user chose. However, by
configuring custom templates it is possible to change what is displayed
to the user. This applies to the list of suggestions as well as to the
actual value users will see when viewing the ticket.Pleaes note that what is displayed to the user is not necessarily what
is internally stored by RT for the custom field. Any time a ticket is
viewed by a user the extension fetches what to display from the external
database. This way it is possible to e.g. only store a primary key value
and display just an associated name to users.RT VERSION
Works with RT 4.4.2REQUIREMENTS
DBI (>= 1.37)As well as an appropriate driver for the databases you want to
integrate. (e.g. DBD::mysql for MySQL)INSTALLATION
perl Makefile.PL
make
make install
May need root permissionsEdit your /opt/rt4/etc/RT_SiteConfig.pm
Add this line:Plugin('RT::Extension::DBCustomField');
Clear your mason cache
rm -rf /opt/rt4/var/mason_data/objRestart your webserver
CONFIGURATION
First you need to define $DBCustomField_Connections which is a hash of
available database connections.Set($DBCustomField_Connections, {
'sugarcrm' => {
'dsn' => 'DBI:mysql:database=SUGARCRMDB;host=MYHOST;port=3306;mysql_enable_utf8=1',
'username' => 'USER',
'password' => 'PASS'
}
});Then it is required to define $DBCustomField_Queries which is a hash of
available query definitions. Every query definition has a name and
consists of two queries. One for the auto-completion suggestions and one
to fetch display values with.Set ($DBCustomField_Queries, {
'companies' => {
# The connection to use
'connection' => 'sugarcrm',# The query to fetch auto-completion suggestions with. `field_value' is mandatory
# and any occurrence of `?' is replaced with a user's input.
'suggestions' => q{
SELECT
cstm.net_global_id_c AS field_value, cstm.shortname_c AS shortname, a.name
FROM accounts a
INNER JOIN accounts_cstm cstm ON cstm.id_c = a.id AND cstm.net_global_id_c
WHERE a.deleted = 0 AND (cstm.net_global_id_c = ? OR cstm.shortname_c LIKE ? OR a.name LIKE ?)
ORDER BY shortname
},# The display template to use for each entry returned by the suggestions query. To reference specific
# columns here encapsulate their name with curly braces. The default is just `{field_value}'
# HTML support: Yes
'suggestions_tpl' => q{
{shortname}
{name} ({field_value})
},# The query to fetch display values with. `field_value' is only required when not defining
# a custom display template. A single occurrence of `?' is replaced with the value internally
# stored by RT.
'display_value' => q{
SELECT
cstm.net_global_id_c AS field_value, cstm.shortname_c AS shortname
FROM accounts a
INNER JOIN accounts_cstm cstm ON cstm.id_c = a.id AND cstm.net_global_id_c
WHERE cstm.net_global_id_c = ?
},# The display template to use when showing the custom field value to users. To reference specific
# columns here encapsulate their name with curly braces. The default is just `{field_value}'.
# HTML support: Yes, but try to avoid manipulating the layout too much (e.g. with block elements)
'display_value_tpl' => '{shortname} ({field_value})'
},
});Last you need to define $DBCustomField_Fields which maps query
definitions to specific custom fields. This controls which suggestions a
user receives when typing something into a custom field input. Note that
these custom fields need to be of the type provided by this extension.Set($DBCustomField_Fields, {
'Client' => 'companies'
});By default the limit of suggestions displayed to the user is 10. To
adjust this you can use the following:Set($DBCustomField_Suggestion_Limit, 25);
ADVANCED CONFIGURATION
__TICKET__
Can be used as part of any query to reference a ticket's ID. (Is
replaced by this extension with an integer.)__VALUE__
Can be used only as part of the `display_value' query to reference
the `field_value'. (Is replaced by this extension with whatever has
been stored internally by RT.)AUTHOR
NETWAYS GmbHBUGS
All bugs should be reported on GitHub
COPYRIGHT AND LICENSE
This software is Copyright (c) 2018 by NETWAYS GmbHThis is free software, licensed under:
The GNU General Public License, Version 2, June 1991