Apache Error: Connecting External database for Customers

Moderator: crythias

Locked
hitechunited
Znuny newbie
Posts: 6
Joined: 15 Aug 2013, 02:06
Znuny Version: 3.2.9

Apache Error: Connecting External database for Customers

Post by hitechunited »

I'm trying to test using an external database for customer information but keep getting the following error in my Apache error log:

Code: Select all

[Tue Mar 25 13:51:21 2014] [error] Can't load Perl file: /opt/otrs/scripts/apache2-perl-startup.pl for server hitech-otrs.esolute.com:80, exiting...
[Tue Mar 25 13:59:18 2014] [error] Global symbol "$Self" requires explicit package name at /opt/otrs//Kernel/Config.pm line 22.\nCompilation failed in require at /opt/otrs/scripts/apache2-perl-startup.pl line 69.\nBEGIN failed--compilation aborted at /opt/otrs/scripts/apache2-perl-startup.pl line 69.\nCompilation failed in require at (eval 2) line 1.\n
I can't find where I've gone wrong, if you can have a look and let me what I'll need to fix, it'll be greatly appreciated. Thank you.

Code: Select all

package Kernel::Config;

use strict;
use warnings;
use utf8;

sub Load {
    my $Self = shift;

    $Self->{'DatabaseHost'} = 'localhost';
    $Self->{'Database'} = "test-otrs.db";
    $Self->{'DatabaseUser'} = "test-otrs";
    $Self->{'DatabasePw'} = '******';
    $Self->{'DatabaseDSN'} = "DBI:mysql:database=$Self->{Database};host=$Self->{DatabaseHost}";

    $Self->{Home} = '/opt/otrs';
}

use base qw(Kernel::Config::Defaults);

# CustomerUser (Customer database backend and settings)
$Self->{CustomerUser} = {
        Name => 'External Datasource',
        Module => 'Kernel::System::CustomerUser::DB',
        Params => {
                DSN => 'DBI:mysql:database=customer.db;host=localhost',
                User => 'test-otrs',
                Password => '***********',
                Table => 'tblclients',
        },

        # Customer unique id
        CustomerKey => 'id',
        CustomerID => 'id',

        CustomerUserListFields => ['firstname', 'lastname', 'email'],
        CustomerUserSearchFields => ['id', 'lastname', 'email'],
        CustomerUserSearchPrefix => '',
        CustomerUserSearchSuffix => '*',
        CustomerUserSearchListLimit => 250,
        CustomerUserPostMasterSearchFields => ['email'],
        CustomerUserNameFields => ['firstname','lastname'],
        CustomerUserEmailUniqCheck => 1,

        ReadOnly => 1,

        Map => [
                [ 'UserCustomerID', 'CustomerID', 'id', 1, 1, 'var', '', 0 ],
                [ 'UserFirstname', 'Firstname', 'firstname', 1, 1, 'var', '', 0 ],
                [ 'UserLastname', 'Lastname', 'lastname', 1, 1, 'var', '', 0 ],
                [ 'UserLogin', 'Username', 'id', 1, 1, 'var', '', 0 ],
                [ 'UserEmail', 'Email', 'email', 1, 1, 'var', '', 0 ],
        ],
};

1;
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Apache Error: Connecting External database for Customers

Post by crythias »

Code: Select all

package Kernel::Config;

use strict;
use warnings;
use utf8;

sub Load { #begin of LOAD
    my $Self = shift;

    $Self->{'DatabaseHost'} = 'localhost';
    $Self->{'Database'} = "test-otrs.db";
    $Self->{'DatabaseUser'} = "test-otrs";
    $Self->{'DatabasePw'} = '******';
    $Self->{'DatabaseDSN'} = "DBI:mysql:database=$Self->{Database};host=$Self->{DatabaseHost}";

    $Self->{Home} = '/opt/otrs';
} #This terminates early Probably not what you want to do.

use base qw(Kernel::Config::Defaults);
### Probably should be paying attention to Config.pm.dist ... your own config options should be before the closing }
# CustomerUser (Customer database backend and settings)
$Self->{CustomerUser} = {
        Name => 'External Datasource',
        Module => 'Kernel::System::CustomerUser::DB',
        Params => {
                DSN => 'DBI:mysql:database=customer.db;host=localhost',
                User => 'test-otrs',
                Password => '***********',
                Table => 'tblclients',
        },

        # Customer unique id
        CustomerKey => 'id',
        CustomerID => 'id',

        CustomerUserListFields => ['firstname', 'lastname', 'email'],
        CustomerUserSearchFields => ['id', 'lastname', 'email'],
        CustomerUserSearchPrefix => '',
        CustomerUserSearchSuffix => '*',
        CustomerUserSearchListLimit => 250,
        CustomerUserPostMasterSearchFields => ['email'],
        CustomerUserNameFields => ['firstname','lastname'],
        CustomerUserEmailUniqCheck => 1,

        ReadOnly => 1,

        Map => [
                [ 'UserCustomerID', 'CustomerID', 'id', 1, 1, 'var', '', 0 ],
                [ 'UserFirstname', 'Firstname', 'firstname', 1, 1, 'var', '', 0 ],
                [ 'UserLastname', 'Lastname', 'lastname', 1, 1, 'var', '', 0 ],
                [ 'UserLogin', 'Username', 'id', 1, 1, 'var', '', 0 ],
                [ 'UserEmail', 'Email', 'email', 1, 1, 'var', '', 0 ],
        ],
};

1; 
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
hitechunited
Znuny newbie
Posts: 6
Joined: 15 Aug 2013, 02:06
Znuny Version: 3.2.9

Re: Apache Error: Connecting External database for Customers

Post by hitechunited »

Works. Thanks.
hitechunited
Znuny newbie
Posts: 6
Joined: 15 Aug 2013, 02:06
Znuny Version: 3.2.9

Re: Apache Error: Connecting External database for Customers

Post by hitechunited »

The fields I'm putting in the config file doesn't appear to be populated in the Agent Interface.

I would have thought the CustomerUserSearchFields would have changed the search fields in the Customer Information Centre search box.
e.g. CustomerUserSearchFields --> ['id', 'lastname', 'email'], the search box should present options for searching by id, lastname, email.

I've also added additional fields in the Maps section of the Config file but these fields are being displayed.

What else will I need to do to get these changes to come through? Thanks.
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Apache Error: Connecting External database for Customers

Post by crythias »

One box searches all search fields.
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
Locked